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

Side by Side Diff: src/gpu/gl/builders/GrGLProgramBuilder.cpp

Issue 1541903002: 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
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "GrGLProgramBuilder.h" 8 #include "GrGLProgramBuilder.h"
9 9
10 #include "GrAutoLocaleSetter.h" 10 #include "GrAutoLocaleSetter.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 } 88 }
89 89
90 this->emitAndInstallProc(primProc, inputColor, inputCoverage); 90 this->emitAndInstallProc(primProc, inputColor, inputCoverage);
91 91
92 fFragmentProcessors.reset(new GrGLInstalledFragProcs); 92 fFragmentProcessors.reset(new GrGLInstalledFragProcs);
93 int numProcs = this->pipeline().numFragmentProcessors(); 93 int numProcs = this->pipeline().numFragmentProcessors();
94 this->emitAndInstallFragProcs(0, this->pipeline().numColorFragmentProcessors (), inputColor); 94 this->emitAndInstallFragProcs(0, this->pipeline().numColorFragmentProcessors (), inputColor);
95 this->emitAndInstallFragProcs(this->pipeline().numColorFragmentProcessors(), numProcs, 95 this->emitAndInstallFragProcs(this->pipeline().numColorFragmentProcessors(), numProcs,
96 inputCoverage); 96 inputCoverage);
97 this->emitAndInstallXferProc(this->pipeline().getXferProcessor(), *inputColo r, *inputCoverage, 97 if (primProc.getPixelLocalStorageState() != GrPixelLocalStorageState::kDraw_ State) {
98 this->pipeline().ignoresCoverage()); 98 this->emitAndInstallXferProc(this->pipeline().getXferProcessor(), *input Color,
99 this->emitFSOutputSwizzle(this->pipeline().getXferProcessor().hasSecondaryOu tput()); 99 *inputCoverage, this->pipeline().ignoresCov erage(),
100 primProc.getPixelLocalStorageState());
101 this->emitFSOutputSwizzle(this->pipeline().getXferProcessor().hasSeconda ryOutput());
102 }
100 return true; 103 return true;
101 } 104 }
102 105
103 void GrGLProgramBuilder::emitAndInstallFragProcs(int procOffset, 106 void GrGLProgramBuilder::emitAndInstallFragProcs(int procOffset,
104 int numProcs, 107 int numProcs,
105 GrGLSLExpr4* inOut) { 108 GrGLSLExpr4* inOut) {
106 for (int i = procOffset; i < numProcs; ++i) { 109 for (int i = procOffset; i < numProcs; ++i) {
107 GrGLSLExpr4 output; 110 GrGLSLExpr4 output;
108 const GrFragmentProcessor& fp = this->pipeline().getFragmentProcessor(i) ; 111 const GrFragmentProcessor& fp = this->pipeline().getFragmentProcessor(i) ;
109 this->emitAndInstallProc(fp, i, *inOut, &output); 112 this->emitAndInstallProc(fp, i, *inOut, &output);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 fGeometryProcessor->fGLProc->emitCode(args); 219 fGeometryProcessor->fGLProc->emitCode(args);
217 220
218 // We have to check that effects and the code they emit are consistent, ie i f an effect 221 // We have to check that effects and the code they emit are consistent, ie i f an effect
219 // asks for dst color, then the emit code needs to follow suit 222 // asks for dst color, then the emit code needs to follow suit
220 verify(gp); 223 verify(gp);
221 } 224 }
222 225
223 void GrGLProgramBuilder::emitAndInstallXferProc(const GrXferProcessor& xp, 226 void GrGLProgramBuilder::emitAndInstallXferProc(const GrXferProcessor& xp,
224 const GrGLSLExpr4& colorIn, 227 const GrGLSLExpr4& colorIn,
225 const GrGLSLExpr4& coverageIn, 228 const GrGLSLExpr4& coverageIn,
226 bool ignoresCoverage) { 229 bool ignoresCoverage,
230 GrPixelLocalStorageState plsStat e) {
227 // Program builders have a bit of state we need to clear with each effect 231 // Program builders have a bit of state we need to clear with each effect
228 AutoStageAdvance adv(this); 232 AutoStageAdvance adv(this);
229 233
230 SkASSERT(!fXferProcessor); 234 SkASSERT(!fXferProcessor);
231 fXferProcessor = new GrGLInstalledXferProc; 235 fXferProcessor = new GrGLInstalledXferProc;
232 236
233 fXferProcessor->fGLProc.reset(xp.createGLSLInstance()); 237 fXferProcessor->fGLProc.reset(xp.createGLSLInstance());
234 238
235 // Enable dual source secondary output if we have one 239 // Enable dual source secondary output if we have one
236 if (xp.hasSecondaryOutput()) { 240 if (xp.hasSecondaryOutput()) {
(...skipping 11 matching lines...) Expand all
248 SkSTArray<4, GrGLSLTextureSampler> samplers(xp.numTextures()); 252 SkSTArray<4, GrGLSLTextureSampler> samplers(xp.numTextures());
249 this->emitSamplers(xp, &samplers, fXferProcessor); 253 this->emitSamplers(xp, &samplers, fXferProcessor);
250 254
251 GrGLSLXferProcessor::EmitArgs args(&fFS, 255 GrGLSLXferProcessor::EmitArgs args(&fFS,
252 &fUniformHandler, 256 &fUniformHandler,
253 this->glslCaps(), 257 this->glslCaps(),
254 xp, colorIn.c_str(), 258 xp, colorIn.c_str(),
255 ignoresCoverage ? nullptr : coverageIn.c_ str(), 259 ignoresCoverage ? nullptr : coverageIn.c_ str(),
256 fFS.getPrimaryColorOutputName(), 260 fFS.getPrimaryColorOutputName(),
257 fFS.getSecondaryColorOutputName(), 261 fFS.getSecondaryColorOutputName(),
258 samplers); 262 samplers,
263 plsState == GrPixelLocalStorageState::kFi nish_State);
259 fXferProcessor->fGLProc->emitCode(args); 264 fXferProcessor->fGLProc->emitCode(args);
260 265
261 // We have to check that effects and the code they emit are consistent, ie i f an effect 266 // We have to check that effects and the code they emit are consistent, ie i f an effect
262 // asks for dst color, then the emit code needs to follow suit 267 // asks for dst color, then the emit code needs to follow suit
263 verify(xp); 268 verify(xp);
264 fFS.codeAppend("}"); 269 fFS.codeAppend("}");
265 } 270 }
266 271
267 void GrGLProgramBuilder::emitFSOutputSwizzle(bool hasSecondaryOutput) { 272 void GrGLProgramBuilder::emitFSOutputSwizzle(bool hasSecondaryOutput) {
268 // Swizzle the fragment shader outputs if necessary. 273 // Swizzle the fragment shader outputs if necessary.
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 } 501 }
497 502
498 //////////////////////////////////////////////////////////////////////////////// /////////////////// 503 //////////////////////////////////////////////////////////////////////////////// ///////////////////
499 504
500 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { 505 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() {
501 int numProcs = fProcs.count(); 506 int numProcs = fProcs.count();
502 for (int i = 0; i < numProcs; ++i) { 507 for (int i = 0; i < numProcs; ++i) {
503 delete fProcs[i]; 508 delete fProcs[i];
504 } 509 }
505 } 510 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698