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

Side by Side Diff: src/gpu/glsl/GrGLSLProgramBuilder.cpp

Issue 2223053002: Split distance vector into direction and magnitude components (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "glsl/GrGLSLProgramBuilder.h" 8 #include "glsl/GrGLSLProgramBuilder.h"
9 9
10 #include "GrPipeline.h" 10 #include "GrPipeline.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 GrGLSLExpr4* outputColor, 83 GrGLSLExpr4* outputColor,
84 GrGLSLExpr4* outputCoverage) { 84 GrGLSLExpr4* outputCoverage) {
85 // Program builders have a bit of state we need to clear with each effect 85 // Program builders have a bit of state we need to clear with each effect
86 AutoStageAdvance adv(this); 86 AutoStageAdvance adv(this);
87 this->nameExpression(outputColor, "outputColor"); 87 this->nameExpression(outputColor, "outputColor");
88 this->nameExpression(outputCoverage, "outputCoverage"); 88 this->nameExpression(outputCoverage, "outputCoverage");
89 89
90 const char* distanceVectorName = nullptr; 90 const char* distanceVectorName = nullptr;
91 if (this->fPipeline.usesDistanceVectorField() && proc.implementsDistanceVect or()) { 91 if (this->fPipeline.usesDistanceVectorField() && proc.implementsDistanceVect or()) {
92 distanceVectorName = fFS.distanceVectorName(); 92 distanceVectorName = fFS.distanceVectorName();
93 fFS.codeAppend( "// Un-normalized vector to the closed geometric edge (i n source space)\n"); 93 fFS.codeAppend( "// Normalized vector to the closest geometric edge (in source space)\n");
94 fFS.codeAppendf("vec2 %s;", distanceVectorName); 94 fFS.codeAppend( "// Distance to the edge encoded in the z-component\n");
95 fFS.codeAppendf("vec3 %s;", distanceVectorName);
95 } 96 }
96 97
97 // Enclose custom code in a block to avoid namespace conflicts 98 // Enclose custom code in a block to avoid namespace conflicts
98 SkString openBrace; 99 SkString openBrace;
99 openBrace.printf("{ // Stage %d, %s\n", fStageIndex, proc.name()); 100 openBrace.printf("{ // Stage %d, %s\n", fStageIndex, proc.name());
100 fFS.codeAppend(openBrace.c_str()); 101 fFS.codeAppend(openBrace.c_str());
101 fVS.codeAppendf("// Primitive Processor %s\n", proc.name()); 102 fVS.codeAppendf("// Primitive Processor %s\n", proc.name());
102 103
103 SkASSERT(!fGeometryProcessor); 104 SkASSERT(!fGeometryProcessor);
104 fGeometryProcessor = proc.createGLSLInstance(*this->glslCaps()); 105 fGeometryProcessor = proc.createGLSLInstance(*this->glslCaps());
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 delete fFragmentProcessors[i]; 412 delete fFragmentProcessors[i];
412 } 413 }
413 } 414 }
414 415
415 void GrGLSLProgramBuilder::finalizeShaders() { 416 void GrGLSLProgramBuilder::finalizeShaders() {
416 this->varyingHandler()->finalize(); 417 this->varyingHandler()->finalize();
417 fVS.finalize(kVertex_GrShaderFlag); 418 fVS.finalize(kVertex_GrShaderFlag);
418 fFS.finalize(kFragment_GrShaderFlag); 419 fFS.finalize(kFragment_GrShaderFlag);
419 420
420 } 421 }
OLDNEW
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698