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

Unified Diff: gm/dcshader.cpp

Issue 1251173002: Added GrGLFragmentProcessor::EmitArgs struct for use with emitCode() (Closed) Base URL: https://skia.googlesource.com/skia@composeshader_gpu
Patch Set: Created 5 years, 5 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 | samplecode/SampleLighting.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/dcshader.cpp
diff --git a/gm/dcshader.cpp b/gm/dcshader.cpp
index 744ea9d65d9b08c8bfecab5333a8454e6beac68b..c60c28a3ee00c856c0cdc2143ae0f295bc551e96 100644
--- a/gm/dcshader.cpp
+++ b/gm/dcshader.cpp
@@ -65,14 +65,9 @@ public:
GrGLFragmentProcessor* createGLInstance() const override {
class DCGLFP : public GrGLFragmentProcessor {
- void emitCode(GrGLFPBuilder* builder,
- const GrFragmentProcessor& fp,
- const char* outputColor,
- const char* inputColor,
- const TransformedCoordsArray& coords,
- const TextureSamplerArray& samplers) override {
- GrGLFragmentBuilder* fpb = builder->getFragmentShaderBuilder();
- fpb->codeAppendf("vec2 c = %s;", fpb->ensureFSCoords2D(coords, 0).c_str());
+ void emitCode(EmitArgs& args) override {
+ GrGLFragmentBuilder* fpb = args.fBuilder->getFragmentShaderBuilder();
+ fpb->codeAppendf("vec2 c = %s;", fpb->ensureFSCoords2D(args.fCoords, 0).c_str());
fpb->codeAppend("vec2 r = mod(c, vec2(20.0));");
fpb->codeAppend("vec4 color = vec4(0.5*sin(c.x / 15.0) + 0.5,"
"0.5*cos((c.x + c.y) / 15.0) + 0.5,"
@@ -80,7 +75,7 @@ public:
"distance(r, vec2(15.0)) / 20.0 + 0.2);");
fpb->codeAppendf("color.rgb *= color.a;"
"%s = color * %s;",
- outputColor, GrGLSLExpr4(inputColor).c_str());
+ args.fOutputColor, GrGLSLExpr4(args.fInputColor).c_str());
}
void setData(const GrGLProgramDataManager&, const GrProcessor&) override {}
};
« no previous file with comments | « no previous file | samplecode/SampleLighting.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698