| 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 #include "gl/GrGLProgram.h" | 9 #include "gl/GrGLProgram.h" |
| 10 #include "gl/GrGLSLPrettyPrint.h" | 10 #include "gl/GrGLSLPrettyPrint.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 GrGLSLExpr4 outputColor; | 230 GrGLSLExpr4 outputColor; |
| 231 GrGLSLExpr4 outputCoverage; | 231 GrGLSLExpr4 outputCoverage; |
| 232 this->emitAndInstallProc(gp, &outputColor, &outputCoverage); | 232 this->emitAndInstallProc(gp, &outputColor, &outputCoverage); |
| 233 | 233 |
| 234 // We may override color and coverage here if we have unform color or co
verage. This is | 234 // We may override color and coverage here if we have unform color or co
verage. This is |
| 235 // obviously not ideal. | 235 // obviously not ideal. |
| 236 // TODO lets the GP itself do the override | 236 // TODO lets the GP itself do the override |
| 237 if (GrProgramDesc::kAttribute_ColorInput == header.fColorInput) { | 237 if (GrProgramDesc::kAttribute_ColorInput == header.fColorInput) { |
| 238 *inputColor = outputColor; | 238 *inputColor = outputColor; |
| 239 } | 239 } |
| 240 if (GrProgramDesc::kUniform_ColorInput != header.fCoverageInput) { | 240 |
| 241 *inputCoverage = outputCoverage; | 241 // We may have uniform coverage, if so we need to multiply the GPs outpu
t by the uniform |
| 242 // coverage |
| 243 if (GrProgramDesc::kUniform_ColorInput == header.fCoverageInput) { |
| 244 fFS.codeAppendf("%s *= %s;", outputCoverage.c_str(), inputCoverage->
c_str()); |
| 242 } | 245 } |
| 246 *inputCoverage = outputCoverage; |
| 243 } | 247 } |
| 244 | 248 |
| 245 fFragmentProcessors.reset(SkNEW(GrGLInstalledFragProcs)); | 249 fFragmentProcessors.reset(SkNEW(GrGLInstalledFragProcs)); |
| 246 int numProcs = fOptState.numFragmentStages(); | 250 int numProcs = fOptState.numFragmentStages(); |
| 247 this->emitAndInstallFragProcs(0, fOptState.numColorStages(), inputColor); | 251 this->emitAndInstallFragProcs(0, fOptState.numColorStages(), inputColor); |
| 248 this->emitAndInstallFragProcs(fOptState.numColorStages(), numProcs, inputCo
verage); | 252 this->emitAndInstallFragProcs(fOptState.numColorStages(), numProcs, inputCo
verage); |
| 249 | 253 |
| 250 if (fOptState.hasGeometryProcessor()) { | 254 if (fOptState.hasGeometryProcessor()) { |
| 251 fVS.transformToNormalizedDeviceSpace(); | 255 fVS.transformToNormalizedDeviceSpace(); |
| 252 } | 256 } |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 } | 588 } |
| 585 | 589 |
| 586 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 590 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 587 | 591 |
| 588 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { | 592 GrGLInstalledFragProcs::~GrGLInstalledFragProcs() { |
| 589 int numProcs = fProcs.count(); | 593 int numProcs = fProcs.count(); |
| 590 for (int e = 0; e < numProcs; ++e) { | 594 for (int e = 0; e < numProcs; ++e) { |
| 591 SkDELETE(fProcs[e]); | 595 SkDELETE(fProcs[e]); |
| 592 } | 596 } |
| 593 } | 597 } |
| OLD | NEW |