From 96182216f187fd103392ccaa34f505fe54fcff7e Mon Sep 17 00:00:00 2001 From: "bsalomon@google.com" Date: Wed, 24 Oct 2012 17:34:46 +0000 Subject: [PATCH] Pass the GrCustomStage and key to GrGLProgramStage emitCode. The key computation may encode some analysis that emitCode may be able to skip by examining the key. Review URL: https://codereview.appspot.com/6709075 git-svn-id: http://skia.googlecode.com/svn/trunk@6075 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/gpu/gl/GrGLProgram.cpp | 8 +++++++- src/gpu/gl/GrGLProgramStage.h | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp index bc17ebf..d5ccdac 100644 --- a/src/gpu/gl/GrGLProgram.cpp +++ b/src/gpu/gl/GrGLProgram.cpp @@ -955,7 +955,13 @@ GrGLProgramStage* GrGLProgram::GenStageCode(const GrCustomStage* stage, // Enclose custom code in a block to avoid namespace conflicts builder->fVSCode.appendf("\t{ // %s\n", glStage->name()); builder->fFSCode.appendf("\t{ // %s \n", glStage->name()); - glStage->emitCode(builder, varyingVSName, fsOutColor, fsInColor, textureSamplers); + glStage->emitCode(builder, + *stage, + desc.fCustomStageKey, + varyingVSName, + fsOutColor, + fsInColor, + textureSamplers); builder->fVSCode.appendf("\t}\n"); builder->fFSCode.appendf("\t}\n"); diff --git a/src/gpu/gl/GrGLProgramStage.h b/src/gpu/gl/GrGLProgramStage.h index d835c0b..fce82d2 100644 --- a/src/gpu/gl/GrGLProgramStage.h +++ b/src/gpu/gl/GrGLProgramStage.h @@ -50,6 +50,9 @@ public: stages. @param builder Interface used to emit code in the shaders. + @param stage The custom stage that generated this program stage. + @param key The key that was computed by StageKey() from the generating + GrCustomStage. @param vertexCoords A vec2 of texture coordinates in the VS, which may be altered. This will be removed soon and stages will be responsible for computing their own coords. @@ -66,6 +69,8 @@ public: reads in the generated code. */ virtual void emitCode(GrGLShaderBuilder* builder, + const GrCustomStage& stage, + StageKey key, const char* vertexCoords, const char* outputColor, const char* inputColor, @@ -103,6 +108,8 @@ public: const TextureSamplerArray&) = 0; virtual void emitCode(GrGLShaderBuilder* builder, + const GrCustomStage&, + StageKey, const char* vertexCoords, const char* outputColor, const char* inputColor, -- 2.7.4