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

Unified Diff: src/gpu/glsl/GrGLSLProgramBuilder.cpp

Issue 2326503002: Add default version of fsDistanceVector if it is required but not implemented (Closed)
Patch Set: Created 4 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/glsl/GrGLSLProgramBuilder.cpp
diff --git a/src/gpu/glsl/GrGLSLProgramBuilder.cpp b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
index a6bff8a85ac983fadd717d80f17ee5e4f19bc068..f32042d821810eb0bdafb347d55d087636b75bcf 100644
--- a/src/gpu/glsl/GrGLSLProgramBuilder.cpp
+++ b/src/gpu/glsl/GrGLSLProgramBuilder.cpp
@@ -88,11 +88,17 @@ void GrGLSLProgramBuilder::emitAndInstallPrimProc(const GrPrimitiveProcessor& pr
this->nameExpression(outputCoverage, "outputCoverage");
const char* distanceVectorName = nullptr;
- if (this->fPipeline.usesDistanceVectorField() && proc.implementsDistanceVector()) {
+ if (this->fPipeline.usesDistanceVectorField()) {
distanceVectorName = fFS.distanceVectorName();
fFS.codeAppend( "// Normalized vector to the closest geometric edge (in device space)\n");
fFS.codeAppend( "// Distance to the edge encoded in the z-component\n");
- fFS.codeAppendf("vec4 %s;", distanceVectorName);
+
+ if (proc.implementsDistanceVector()) {
+ fFS.codeAppendf("vec4 %s;", distanceVectorName);
+ } else {
+ fFS.codeAppendf("vec4 %s = vec4(1,0,0,0); // not implemented by primitive processor\n",
+ distanceVectorName);
+ }
}
// Enclose custom code in a block to avoid namespace conflicts
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698