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

Unified Diff: gm/dcshader.cpp

Issue 1457543003: Add ShaderBuilders to EmitArgs and remove gettings from ProgBuilder. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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 | « experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp ('k') | src/core/SkLightingShader.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 d22ab023df85890bda916bd09b485fd31519d155..4dedf74093e0bb8c04af2dd2c45457b8b7ce1f8e 100644
--- a/gm/dcshader.cpp
+++ b/gm/dcshader.cpp
@@ -67,16 +67,17 @@ public:
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override {
class DCGLFP : public GrGLSLFragmentProcessor {
void emitCode(EmitArgs& args) override {
- GrGLSLFragmentBuilder* 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,"
- "(r.x + r.y) / 20.0,"
- "distance(r, vec2(15.0)) / 20.0 + 0.2);");
- fpb->codeAppendf("color.rgb *= color.a;"
- "%s = color * %s;",
- args.fOutputColor, GrGLSLExpr4(args.fInputColor).c_str());
+ GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
+ fragBuilder->codeAppendf("vec2 c = %s;",
+ fragBuilder->ensureFSCoords2D(args.fCoords, 0).c_str());
+ fragBuilder->codeAppend("vec2 r = mod(c, vec2(20.0));");
+ fragBuilder->codeAppend("vec4 color = vec4(0.5*sin(c.x / 15.0) + 0.5,"
+ "0.5*cos((c.x + c.y) / 15.0) + 0.5,"
+ "(r.x + r.y) / 20.0,"
+ "distance(r, vec2(15.0)) / 20.0 + 0.2);");
+ fragBuilder->codeAppendf("color.rgb *= color.a;"
+ "%s = color * %s;",
+ args.fOutputColor, GrGLSLExpr4(args.fInputColor).c_str());
}
void onSetData(const GrGLSLProgramDataManager&, const GrProcessor&) override {}
};
« no previous file with comments | « experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp ('k') | src/core/SkLightingShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698