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

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

Issue 1626553002: Revert of added support for PLS path rendering (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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/glsl/GrGLSLProgramBuilder.h ('k') | src/gpu/glsl/GrGLSLShaderVar.h » ('j') | 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 return false; 46 return false;
47 } 47 }
48 } 48 }
49 49
50 this->emitAndInstallPrimProc(primProc, inputColor, inputCoverage); 50 this->emitAndInstallPrimProc(primProc, inputColor, inputCoverage);
51 51
52 int numProcs = this->pipeline().numFragmentProcessors(); 52 int numProcs = this->pipeline().numFragmentProcessors();
53 this->emitAndInstallFragProcs(0, this->pipeline().numColorFragmentProcessors (), inputColor); 53 this->emitAndInstallFragProcs(0, this->pipeline().numColorFragmentProcessors (), inputColor);
54 this->emitAndInstallFragProcs(this->pipeline().numColorFragmentProcessors(), numProcs, 54 this->emitAndInstallFragProcs(this->pipeline().numColorFragmentProcessors(), numProcs,
55 inputCoverage); 55 inputCoverage);
56 if (primProc.getPixelLocalStorageState() != 56 this->emitAndInstallXferProc(this->pipeline().getXferProcessor(), *inputColo r, *inputCoverage,
57 GrPixelLocalStorageState::kDraw_GrPixelLocalStorageState) { 57 this->pipeline().ignoresCoverage());
58 this->emitAndInstallXferProc(this->pipeline().getXferProcessor(), *input Color, 58 this->emitFSOutputSwizzle(this->pipeline().getXferProcessor().hasSecondaryOu tput());
59 *inputCoverage, this->pipeline().ignoresCov erage(),
60 primProc.getPixelLocalStorageState());
61 this->emitFSOutputSwizzle(this->pipeline().getXferProcessor().hasSeconda ryOutput());
62 }
63 return true; 59 return true;
64 } 60 }
65 61
66 void GrGLSLProgramBuilder::emitAndInstallPrimProc(const GrPrimitiveProcessor& pr oc, 62 void GrGLSLProgramBuilder::emitAndInstallPrimProc(const GrPrimitiveProcessor& pr oc,
67 GrGLSLExpr4* outputColor, 63 GrGLSLExpr4* outputColor,
68 GrGLSLExpr4* outputCoverage) { 64 GrGLSLExpr4* outputCoverage) {
69 // Program builders have a bit of state we need to clear with each effect 65 // Program builders have a bit of state we need to clear with each effect
70 AutoStageAdvance adv(this); 66 AutoStageAdvance adv(this);
71 this->nameExpression(outputColor, "outputColor"); 67 this->nameExpression(outputColor, "outputColor");
72 this->nameExpression(outputCoverage, "outputCoverage"); 68 this->nameExpression(outputCoverage, "outputCoverage");
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 // asks for dst color, then the emit code needs to follow suit 144 // asks for dst color, then the emit code needs to follow suit
149 verify(fp); 145 verify(fp);
150 fFragmentProcessors.push_back(fragProc); 146 fFragmentProcessors.push_back(fragProc);
151 147
152 fFS.codeAppend("}"); 148 fFS.codeAppend("}");
153 } 149 }
154 150
155 void GrGLSLProgramBuilder::emitAndInstallXferProc(const GrXferProcessor& xp, 151 void GrGLSLProgramBuilder::emitAndInstallXferProc(const GrXferProcessor& xp,
156 const GrGLSLExpr4& colorIn, 152 const GrGLSLExpr4& colorIn,
157 const GrGLSLExpr4& coverageIn, 153 const GrGLSLExpr4& coverageIn,
158 bool ignoresCoverage, 154 bool ignoresCoverage) {
159 GrPixelLocalStorageState plsSt ate) {
160 // Program builders have a bit of state we need to clear with each effect 155 // Program builders have a bit of state we need to clear with each effect
161 AutoStageAdvance adv(this); 156 AutoStageAdvance adv(this);
162 157
163 SkASSERT(!fXferProcessor); 158 SkASSERT(!fXferProcessor);
164 fXferProcessor = xp.createGLSLInstance(); 159 fXferProcessor = xp.createGLSLInstance();
165 160
166 // Enable dual source secondary output if we have one 161 // Enable dual source secondary output if we have one
167 if (xp.hasSecondaryOutput()) { 162 if (xp.hasSecondaryOutput()) {
168 fFS.enableSecondaryOutput(); 163 fFS.enableSecondaryOutput();
169 } 164 }
170 165
171 if (this->glslCaps()->mustDeclareFragmentShaderOutput()) { 166 if (this->glslCaps()->mustDeclareFragmentShaderOutput()) {
172 fFS.enableCustomOutput(); 167 fFS.enableCustomOutput();
173 } 168 }
174 169
175 SkString openBrace; 170 SkString openBrace;
176 openBrace.printf("{ // Xfer Processor: %s\n", xp.name()); 171 openBrace.printf("{ // Xfer Processor: %s\n", xp.name());
177 fFS.codeAppend(openBrace.c_str()); 172 fFS.codeAppend(openBrace.c_str());
178 173
179 SkSTArray<4, GrGLSLTextureSampler> samplers(xp.numTextures()); 174 SkSTArray<4, GrGLSLTextureSampler> samplers(xp.numTextures());
180 this->emitSamplers(xp, &samplers); 175 this->emitSamplers(xp, &samplers);
181 176
182 bool usePLSDstRead = (plsState == GrPixelLocalStorageState::kFinish_GrPixelL ocalStorageState);
183 GrGLSLXferProcessor::EmitArgs args(&fFS, 177 GrGLSLXferProcessor::EmitArgs args(&fFS,
184 this->uniformHandler(), 178 this->uniformHandler(),
185 this->glslCaps(), 179 this->glslCaps(),
186 xp, colorIn.c_str(), 180 xp, colorIn.c_str(),
187 ignoresCoverage ? nullptr : coverageIn.c_ str(), 181 ignoresCoverage ? nullptr : coverageIn.c_ str(),
188 fFS.getPrimaryColorOutputName(), 182 fFS.getPrimaryColorOutputName(),
189 fFS.getSecondaryColorOutputName(), 183 fFS.getSecondaryColorOutputName(),
190 samplers, 184 samplers);
191 usePLSDstRead);
192 fXferProcessor->emitCode(args); 185 fXferProcessor->emitCode(args);
193 186
194 // We have to check that effects and the code they emit are consistent, ie i f an effect 187 // We have to check that effects and the code they emit are consistent, ie i f an effect
195 // asks for dst color, then the emit code needs to follow suit 188 // asks for dst color, then the emit code needs to follow suit
196 verify(xp); 189 verify(xp);
197 fFS.codeAppend("}"); 190 fFS.codeAppend("}");
198 } 191 }
199 192
200 void GrGLSLProgramBuilder::emitFSOutputSwizzle(bool hasSecondaryOutput) { 193 void GrGLSLProgramBuilder::emitFSOutputSwizzle(bool hasSecondaryOutput) {
201 // Swizzle the fragment shader outputs if necessary. 194 // Swizzle the fragment shader outputs if necessary.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 kFloat_GrSLType, kDefault_Gr SLPrecision, 272 kFloat_GrSLType, kDefault_Gr SLPrecision,
280 name, false, 0, outName); 273 name, false, 0, outName);
281 } 274 }
282 275
283 void GrGLSLProgramBuilder::cleanupFragmentProcessors() { 276 void GrGLSLProgramBuilder::cleanupFragmentProcessors() {
284 for (int i = 0; i < fFragmentProcessors.count(); ++i) { 277 for (int i = 0; i < fFragmentProcessors.count(); ++i) {
285 delete fFragmentProcessors[i]; 278 delete fFragmentProcessors[i];
286 } 279 }
287 } 280 }
288 281
OLDNEW
« no previous file with comments | « src/gpu/glsl/GrGLSLProgramBuilder.h ('k') | src/gpu/glsl/GrGLSLShaderVar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698