| OLD | NEW |
| 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 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 ignoresCoverage ? nullptr : coverageIn.c_
str(), | 253 ignoresCoverage ? nullptr : coverageIn.c_
str(), |
| 254 fFS.getPrimaryColorOutputName(), | 254 fFS.getPrimaryColorOutputName(), |
| 255 fFS.getSecondaryColorOutputName(), | 255 fFS.getSecondaryColorOutputName(), |
| 256 samplers); | 256 samplers); |
| 257 fXferProcessor->fGLProc->emitCode(args); | 257 fXferProcessor->fGLProc->emitCode(args); |
| 258 | 258 |
| 259 // We have to check that effects and the code they emit are consistent, ie i
f an effect | 259 // We have to check that effects and the code they emit are consistent, ie i
f an effect |
| 260 // asks for dst color, then the emit code needs to follow suit | 260 // asks for dst color, then the emit code needs to follow suit |
| 261 verify(xp); | 261 verify(xp); |
| 262 fFS.codeAppend("}"); | 262 fFS.codeAppend("}"); |
| 263 |
| 264 if (this->desc().header().fSwapDstRedAndAlpha) { |
| 265 fFS.codeAppendf("%s = %s.agbr;", fFS.getPrimaryColorOutputName(), |
| 266 fFS.getPrimaryColorOutputName()); |
| 267 if (xp.hasSecondaryOutput()) { |
| 268 fFS.codeAppendf("%s = %s.agbr;", fFS.getSecondaryColorOutputName(), |
| 269 fFS.getSecondaryColorOutputName()); |
| 270 } |
| 271 } |
| 263 } | 272 } |
| 264 | 273 |
| 265 void GrGLProgramBuilder::verify(const GrPrimitiveProcessor& gp) { | 274 void GrGLProgramBuilder::verify(const GrPrimitiveProcessor& gp) { |
| 266 SkASSERT(fFS.hasReadFragmentPosition() == gp.willReadFragmentPosition()); | 275 SkASSERT(fFS.hasReadFragmentPosition() == gp.willReadFragmentPosition()); |
| 267 } | 276 } |
| 268 | 277 |
| 269 void GrGLProgramBuilder::verify(const GrXferProcessor& xp) { | 278 void GrGLProgramBuilder::verify(const GrXferProcessor& xp) { |
| 270 SkASSERT(fFS.hasReadDstColor() == xp.willReadDstColor()); | 279 SkASSERT(fFS.hasReadDstColor() == xp.willReadDstColor()); |
| 271 } | 280 } |
| 272 | 281 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 } | 487 } |
| 479 | 488 |
| 480 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 489 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 481 | 490 |
| 482 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { | 491 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { |
| 483 int numProcs = fProcs.count(); | 492 int numProcs = fProcs.count(); |
| 484 for (int i = 0; i < numProcs; ++i) { | 493 for (int i = 0; i < numProcs; ++i) { |
| 485 delete fProcs[i]; | 494 delete fProcs[i]; |
| 486 } | 495 } |
| 487 } | 496 } |
| OLD | NEW |