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

Unified Diff: src/gpu/effects/GrDitherEffect.cpp

Issue 491673002: Initial refactor of shaderbuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 | « src/gpu/effects/GrDistanceFieldTextureEffect.cpp ('k') | src/gpu/effects/GrMatrixConvolutionEffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrDitherEffect.cpp
diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp
index a431897a4eaa2a987bb902f6a0504020bb3ed09b..443df9ed362991b49b78c0c57002dbd65ed0392f 100644
--- a/src/gpu/effects/GrDitherEffect.cpp
+++ b/src/gpu/effects/GrDitherEffect.cpp
@@ -5,10 +5,10 @@
* found in the LICENSE file.
*/
+#include "gl/builders/GrGLProgramBuilder.h"
#include "GrDitherEffect.h"
#include "gl/GrGLEffect.h"
-#include "gl/GrGLShaderBuilder.h"
#include "gl/GrGLSL.h"
#include "GrTBackendEffectFactory.h"
@@ -70,7 +70,7 @@ class GLDitherEffect : public GrGLEffect {
public:
GLDitherEffect(const GrBackendEffectFactory&, const GrDrawEffect&);
- virtual void emitCode(GrGLShaderBuilder* builder,
+ virtual void emitCode(GrGLProgramBuilder* builder,
const GrDrawEffect& drawEffect,
const GrEffectKey& key,
const char* outputColor,
@@ -87,13 +87,14 @@ GLDitherEffect::GLDitherEffect(const GrBackendEffectFactory& factory,
: INHERITED (factory) {
}
-void GLDitherEffect::emitCode(GrGLShaderBuilder* builder,
+void GLDitherEffect::emitCode(GrGLProgramBuilder* builder,
const GrDrawEffect& drawEffect,
const GrEffectKey& key,
const char* outputColor,
const char* inputColor,
const TransformedCoordsArray&,
const TextureSamplerArray& samplers) {
+ GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder();
// Generate a random number based on the fragment position. For this
// random number generator, we use the "GLSL rand" function
// that seems to be floating around on the internet. It works under
@@ -103,10 +104,10 @@ void GLDitherEffect::emitCode(GrGLShaderBuilder* builder,
// For each channel c, add the random offset to the pixel to either bump
// it up or let it remain constant during quantization.
- builder->fsCodeAppendf("\t\tfloat r = "
+ fsBuilder->codeAppendf("\t\tfloat r = "
"fract(sin(dot(%s.xy ,vec2(12.9898,78.233))) * 43758.5453);\n",
- builder->fragmentPosition());
- builder->fsCodeAppendf("\t\t%s = (1.0/255.0) * vec4(r, r, r, r) + %s;\n",
+ fsBuilder->fragmentPosition());
+ fsBuilder->codeAppendf("\t\t%s = (1.0/255.0) * vec4(r, r, r, r) + %s;\n",
outputColor, GrGLSLExpr4(inputColor).c_str());
}
« no previous file with comments | « src/gpu/effects/GrDistanceFieldTextureEffect.cpp ('k') | src/gpu/effects/GrMatrixConvolutionEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698