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

Unified Diff: src/gpu/effects/GrConvolutionEffect.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 | « src/gpu/effects/GrConvexPolyEffect.cpp ('k') | src/gpu/effects/GrCoverageSetOpXP.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrConvolutionEffect.cpp
diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp
index f26ddd18a6693b1be8465814f2d7b82adcbac37f..8e05f4789b7a067810d4ba8413b4b6b3afaf1db7 100644
--- a/src/gpu/effects/GrConvolutionEffect.cpp
+++ b/src/gpu/effects/GrConvolutionEffect.cpp
@@ -60,16 +60,16 @@ void GrGLConvolutionEffect::emitCode(EmitArgs& args) {
kFloat_GrSLType, kDefault_GrSLPrecision,
"Kernel", this->width());
- GrGLSLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBuilder();
- SkString coords2D = fsBuilder->ensureFSCoords2D(args.fCoords, 0);
+ GrGLSLFragmentBuilder* fragBuilder = args.fFragBuilder;
+ SkString coords2D = fragBuilder->ensureFSCoords2D(args.fCoords, 0);
- fsBuilder->codeAppendf("\t\t%s = vec4(0, 0, 0, 0);\n", args.fOutputColor);
+ fragBuilder->codeAppendf("\t\t%s = vec4(0, 0, 0, 0);\n", args.fOutputColor);
int width = this->width();
const GrGLSLShaderVar& kernel = args.fBuilder->getUniformVariable(fKernelUni);
const char* imgInc = args.fBuilder->getUniformCStr(fImageIncrementUni);
- fsBuilder->codeAppendf("\t\tvec2 coord = %s - %d.0 * %s;\n", coords2D.c_str(), fRadius, imgInc);
+ fragBuilder->codeAppendf("\t\tvec2 coord = %s - %d.0 * %s;\n", coords2D.c_str(), fRadius, imgInc);
// Manually unroll loop because some drivers don't; yields 20-30% speedup.
for (int i = 0; i < width; i++) {
@@ -84,21 +84,21 @@ void GrGLConvolutionEffect::emitCode(EmitArgs& args) {
// to have a bug that caused corruption.
const char* bounds = args.fBuilder->getUniformCStr(fBoundsUni);
const char* component = this->direction() == Gr1DKernelEffect::kY_Direction ? "y" : "x";
- fsBuilder->codeAppendf("if (coord.%s >= %s.x && coord.%s <= %s.y) {",
- component, bounds, component, bounds);
+ fragBuilder->codeAppendf("if (coord.%s >= %s.x && coord.%s <= %s.y) {",
+ component, bounds, component, bounds);
}
- fsBuilder->codeAppendf("\t\t%s += ", args.fOutputColor);
- fsBuilder->appendTextureLookup(args.fSamplers[0], "coord");
- fsBuilder->codeAppendf(" * %s;\n", kernelIndex.c_str());
+ fragBuilder->codeAppendf("\t\t%s += ", args.fOutputColor);
+ fragBuilder->appendTextureLookup(args.fSamplers[0], "coord");
+ fragBuilder->codeAppendf(" * %s;\n", kernelIndex.c_str());
if (this->useBounds()) {
- fsBuilder->codeAppend("}");
+ fragBuilder->codeAppend("}");
}
- fsBuilder->codeAppendf("\t\tcoord += %s;\n", imgInc);
+ fragBuilder->codeAppendf("\t\tcoord += %s;\n", imgInc);
}
SkString modulate;
GrGLSLMulVarBy4f(&modulate, args.fOutputColor, args.fInputColor);
- fsBuilder->codeAppend(modulate.c_str());
+ fragBuilder->codeAppend(modulate.c_str());
}
void GrGLConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
« no previous file with comments | « src/gpu/effects/GrConvexPolyEffect.cpp ('k') | src/gpu/effects/GrCoverageSetOpXP.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698