aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl
diff options
context:
space:
mode:
authorGravatar wangyix <wangyix@google.com>2015-07-22 15:08:53 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-22 15:08:53 -0700
commit7c157a988845fb00f9024d6db6dda142c3458033 (patch)
tree3a3523e91c6ec7501afd200d5402ba41347a73f8 /src/gpu/gl
parent243406e5800ad4ff296da8d4cb30d0a33d6f7b2a (diff)
Added GrGLFragmentProcessor::EmitArgs struct for use with emitCode()
Diffstat (limited to 'src/gpu/gl')
-rw-r--r--src/gpu/gl/GrGLFragmentProcessor.h30
-rw-r--r--src/gpu/gl/builders/GrGLProgramBuilder.cpp3
2 files changed, 25 insertions, 8 deletions
diff --git a/src/gpu/gl/GrGLFragmentProcessor.h b/src/gpu/gl/GrGLFragmentProcessor.h
index 723806feab..e130dba1e4 100644
--- a/src/gpu/gl/GrGLFragmentProcessor.h
+++ b/src/gpu/gl/GrGLFragmentProcessor.h
@@ -41,14 +41,30 @@ public:
@param samplers Contains one entry for each GrTextureAccess of the GrProcessor. These
can be passed to the builder to emit texture reads in the generated
code.
- TODO this should take a struct
*/
- virtual void emitCode(GrGLFPBuilder* builder,
- const GrFragmentProcessor&,
- const char* outputColor,
- const char* inputColor,
- const TransformedCoordsArray& coords,
- const TextureSamplerArray& samplers) = 0;
+
+ struct EmitArgs {
+ EmitArgs(GrGLFPBuilder* builder,
+ const GrFragmentProcessor& fp,
+ const char* outputColor,
+ const char* inputColor,
+ const TransformedCoordsArray& coords,
+ const TextureSamplerArray& samplers)
+ : fBuilder(builder)
+ , fFp(fp)
+ , fOutputColor(outputColor)
+ , fInputColor(inputColor)
+ , fCoords(coords)
+ , fSamplers(samplers) {}
+ GrGLFPBuilder* fBuilder;
+ const GrFragmentProcessor& fFp;
+ const char* fOutputColor;
+ const char* fInputColor;
+ const TransformedCoordsArray& fCoords;
+ const TextureSamplerArray& fSamplers;
+ };
+
+ virtual void emitCode(EmitArgs&) = 0;
/** A GrGLFragmentProcessor instance can be reused with any GrFragmentProcessor that produces
the same stage key; this function reads data from a GrFragmentProcessor and uploads any
diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
index a07bd732af..b0d68fbcd9 100644
--- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp
+++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp
@@ -286,7 +286,8 @@ void GrGLProgramBuilder::emitAndInstallProc(const GrPendingFragmentStage& fs,
SkSTArray<4, GrGLProcessor::TextureSampler> samplers(fp.numTextures());
this->emitSamplers(fp, &samplers, ifp);
- ifp->fGLProc->emitCode(this, fp, outColor, inColor, fOutCoords[index], samplers);
+ GrGLFragmentProcessor::EmitArgs args(this, fp, outColor, inColor, fOutCoords[index], samplers);
+ ifp->fGLProc->emitCode(args);
// We have to check that effects and the code they emit are consistent, ie if an effect
// asks for dst color, then the emit code needs to follow suit