Adds a build flag for GL to never use vertex attributes that don't have per-vertex values.
Also promotes the ATTRIBUTE_MATRIX flag that was local to cpp files to the public config file.
Review URL: http://codereview.appspot.com/4434057/
git-svn-id: http://skia.googlecode.com/svn/trunk@1155 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrGLProgram.h b/gpu/src/GrGLProgram.h
index 1a15953..bc74038 100644
--- a/gpu/src/GrGLProgram.h
+++ b/gpu/src/GrGLProgram.h
@@ -84,16 +84,22 @@
//Parameters that affect code generation
struct ProgramDesc {
+ ProgramDesc() {
+ // since we use this as part of a key we can't have any unitialized
+ // padding
+ memset(this, 0, sizeof(ProgramDesc));
+ }
+
+ // stripped of bits that don't affect prog generation
GrVertexLayout fVertexLayout;
enum {
- kNotPoints_OptFlagBit = 0x1,
- kVertexColorAllOnes_OptFlagBit = 0x2,
- };
- // we're assuming optflags and layout pack into 32 bits
- // VS 2010 seems to require short rather than just unsigned
- // for this to pack
- unsigned short fOptFlags : 16;
+ kNone_ColorType = 0,
+ kAttribute_ColorType = 1,
+ kUniform_ColorType = 2,
+ } fColorType;
+
+ bool fEmitsPointSize;
struct StageDesc {
enum OptFlagBits {
@@ -118,6 +124,8 @@
} fStages[GrDrawTarget::kNumStages];
} fProgramDesc;
+ const ProgramDesc& getDesc() { return fProgramDesc; }
+
public:
struct StageUniLocations {
GrGLint fTextureMatrixUni;
@@ -127,6 +135,7 @@
struct UniLocations {
GrGLint fViewMatrixUni;
+ GrGLint fColorUni;
StageUniLocations fStages[GrDrawTarget::kNumStages];
};
@@ -177,6 +186,7 @@
// these reflect the current values of uniforms
// (GL uniform values travel with program)
+ GrColor fColor;
GrMatrix fTextureMatrices[GrDrawTarget::kNumStages];
GrScalar fRadial2CenterX1[GrDrawTarget::kNumStages];
GrScalar fRadial2Radius0[GrDrawTarget::kNumStages];