Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Unified Diff: src/gpu/gl/GrGLProgram.h

Issue 16180006: separate arrays for color and coverage effects. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add helper function Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/gpu/gl/GrGLProgram.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLProgram.h
diff --git a/src/gpu/gl/GrGLProgram.h b/src/gpu/gl/GrGLProgram.h
index ce43b710bfeb3dd13e9458a905a81e7b9b846272..3534552f9803756264531b2f56fc3faeeddbf0d1 100644
--- a/src/gpu/gl/GrGLProgram.h
+++ b/src/gpu/gl/GrGLProgram.h
@@ -38,7 +38,8 @@ public:
static GrGLProgram* Create(const GrGLContext& gl,
const GrGLProgramDesc& desc,
- const GrEffectStage* stages[]);
+ const GrEffectStage* colorStages[],
+ const GrEffectStage* coverageStages[]);
virtual ~GrGLProgram();
@@ -103,59 +104,19 @@ public:
/**
* This function uploads uniforms and calls each GrGLEffect's setData. It is called before a
* draw occurs using the program after the program has already been bound. It also uses the
- * GrGpuGL object to bind the textures required by the GrGLEffects.
+ * GrGpuGL object to bind the textures required by the GrGLEffects. The color and coverage
+ * stages come from GrGLProgramDesc::Build().
*/
void setData(GrGpuGL*,
GrDrawState::BlendOptFlags,
- const GrEffectStage* stages[], // output of GrGLProgramDesc:Build()
+ const GrEffectStage* colorStages[],
+ const GrEffectStage* coverageStages[],
const GrDeviceCoordTexture* dstCopy, // can be NULL
SharedGLState*);
private:
- GrGLProgram(const GrGLContext& gl,
- const GrGLProgramDesc& desc,
- const GrEffectStage* stages[]);
-
- bool succeeded() const { return 0 != fProgramID; }
-
- /**
- * This is the heavy initialization routine for building a GLProgram. stages is all the enabled
- * color stages followed by all the enabled coverage stages as output by
- * GrGLProgramDesc::Build()
- */
- bool genProgram(const GrEffectStage* stages[]);
-
- GrSLConstantVec genInputColor(GrGLShaderBuilder* builder, SkString* inColor);
-
- GrSLConstantVec genInputCoverage(GrGLShaderBuilder* builder, SkString* inCoverage);
-
- void genGeometryShader(GrGLShaderBuilder* segments) const;
-
typedef GrGLUniformManager::UniformHandle UniformHandle;
- // Creates a GL program ID, binds shader attributes to GL vertex attrs, and links the program
- bool bindOutputsAttribsAndLinkProgram(const GrGLShaderBuilder& builder,
- bool bindColorOut,
- bool bindDualSrcOut);
-
- // Sets the texture units for samplers
- void initSamplerUniforms();
-
- bool compileShaders(const GrGLShaderBuilder& builder);
-
- const char* adjustInColor(const SkString& inColor) const;
-
- // Helper for setData(). Makes GL calls to specify the initial color when there is not
- // per-vertex colors.
- void setColor(const GrDrawState&, GrColor color, SharedGLState*);
-
- // Helper for setData(). Makes GL calls to specify the initial coverage when there is not
- // per-vertex coverages.
- void setCoverage(const GrDrawState&, GrColor coverage, SharedGLState*);
-
- // Helper for setData() that sets the view matrix and loads the render target height uniform
- void setMatrixAndRenderTargetHeight(const GrDrawState&);
-
// handles for uniforms (aside from per-effect samplers)
struct UniformHandles {
UniformHandle fViewMatrixUni;
@@ -195,6 +156,52 @@ private:
TextureUnitSArray fTextureUnits; // texture unit used for each entry of fSamplerUnis
};
+ GrGLProgram(const GrGLContext& gl,
+ const GrGLProgramDesc& desc,
+ const GrEffectStage* colorStages[],
+ const GrEffectStage* coverageStages[]);
+
+ bool succeeded() const { return 0 != fProgramID; }
+
+ /**
+ * This is the heavy initialization routine for building a GLProgram. colorStages and
+ * coverageStages correspond to the output of GrGLProgramDesc::Build().
+ */
+ bool genProgram(const GrEffectStage* colorStages[], const GrEffectStage* coverageStages[]);
+
+ GrSLConstantVec genInputColor(GrGLShaderBuilder* builder, SkString* inColor);
+
+ GrSLConstantVec genInputCoverage(GrGLShaderBuilder* builder, SkString* inCoverage);
+
+ void genGeometryShader(GrGLShaderBuilder* segments) const;
+
+ // Creates a GL program ID, binds shader attributes to GL vertex attrs, and links the program
+ bool bindOutputsAttribsAndLinkProgram(const GrGLShaderBuilder& builder,
+ bool bindColorOut,
+ bool bindDualSrcOut);
+
+ // Sets the texture units for samplers
+ void initSamplerUniforms();
+ void initEffectSamplerUniforms(EffectAndSamplers* effect, int* texUnitIdx);
+
+ bool compileShaders(const GrGLShaderBuilder& builder);
+
+ const char* adjustInColor(const SkString& inColor) const;
+
+ // Helper for setData().
+ void setEffectData(GrGpuGL* gpu, const GrEffectStage& stage, const EffectAndSamplers& effect);
+
+ // Helper for setData(). Makes GL calls to specify the initial color when there is not
+ // per-vertex colors.
+ void setColor(const GrDrawState&, GrColor color, SharedGLState*);
+
+ // Helper for setData(). Makes GL calls to specify the initial coverage when there is not
+ // per-vertex coverages.
+ void setCoverage(const GrDrawState&, GrColor coverage, SharedGLState*);
+
+ // Helper for setData() that sets the view matrix and loads the render target height uniform
+ void setMatrixAndRenderTargetHeight(const GrDrawState&);
+
// GL IDs
GrGLuint fVShaderID;
GrGLuint fGShaderID;
@@ -208,7 +215,8 @@ private:
GrColor fColorFilterColor;
int fDstCopyTexUnit;
- SkTArray<EffectAndSamplers> fEffectStates;
+ SkTArray<EffectAndSamplers> fColorEffects;
+ SkTArray<EffectAndSamplers> fCoverageEffects;
GrGLProgramDesc fDesc;
const GrGLContext& fContext;
« no previous file with comments | « no previous file | src/gpu/gl/GrGLProgram.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698