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

Side by Side Diff: src/gpu/gl/GrGLProgram.cpp

Issue 554833002: Calculate Primary and Secondary output types in the GrOptDrawState (Closed) Base URL: https://skia.googlesource.com/skia.git@optReadDst
Patch Set: Rebase Created 6 years, 3 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 2011 Google Inc. 2 * Copyright 2011 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 #include "GrGLProgram.h" 7 #include "GrGLProgram.h"
8 8
9 #include "builders/GrGLFragmentOnlyProgramBuilder.h" 9 #include "builders/GrGLFragmentOnlyProgramBuilder.h"
10 #include "builders/GrGLFullProgramBuilder.h" 10 #include "builders/GrGLFullProgramBuilder.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 GrGLProgram::~GrGLProgram() { 65 GrGLProgram::~GrGLProgram() {
66 if (fProgramID) { 66 if (fProgramID) {
67 GL_CALL(DeleteProgram(fProgramID)); 67 GL_CALL(DeleteProgram(fProgramID));
68 } 68 }
69 } 69 }
70 70
71 void GrGLProgram::abandon() { 71 void GrGLProgram::abandon() {
72 fProgramID = 0; 72 fProgramID = 0;
73 } 73 }
74 74
75 void GrGLProgram::overrideBlend(GrBlendCoeff* srcCoeff,
76 GrBlendCoeff* dstCoeff) const {
77 switch (fDesc.getHeader().fCoverageOutput) {
78 case GrGLProgramDesc::kModulate_CoverageOutput:
79 break;
80 // The prog will write a coverage value to the secondary
81 // output and the dst is blended by one minus that value.
82 case GrGLProgramDesc::kSecondaryCoverage_CoverageOutput:
83 case GrGLProgramDesc::kSecondaryCoverageISA_CoverageOutput:
84 case GrGLProgramDesc::kSecondaryCoverageISC_CoverageOutput:
85 *dstCoeff = (GrBlendCoeff)GrGpu::kIS2C_GrBlendCoeff;
86 break;
87 case GrGLProgramDesc::kCombineWithDst_CoverageOutput:
88 // We should only have set this if the blend was specified as (1, 0)
89 SkASSERT(kOne_GrBlendCoeff == *srcCoeff && kZero_GrBlendCoeff == *ds tCoeff);
90 break;
91 default:
92 SkFAIL("Unexpected coverage output");
93 break;
94 }
95 }
96
97 void GrGLProgram::initSamplerUniforms() { 75 void GrGLProgram::initSamplerUniforms() {
98 GL_CALL(UseProgram(fProgramID)); 76 GL_CALL(UseProgram(fProgramID));
99 GrGLint texUnitIdx = 0; 77 GrGLint texUnitIdx = 0;
100 if (fBuiltinUniformHandles.fDstCopySamplerUni.isValid()) { 78 if (fBuiltinUniformHandles.fDstCopySamplerUni.isValid()) {
101 fProgramDataManager.setSampler(fBuiltinUniformHandles.fDstCopySamplerUni , texUnitIdx); 79 fProgramDataManager.setSampler(fBuiltinUniformHandles.fDstCopySamplerUni , texUnitIdx);
102 fDstCopyTexUnit = texUnitIdx++; 80 fDstCopyTexUnit = texUnitIdx++;
103 } 81 }
104 if (fGeometryProcessor.get()) { 82 if (fGeometryProcessor.get()) {
105 fGeometryProcessor->initSamplers(fProgramDataManager, &texUnitIdx); 83 fGeometryProcessor->initSamplers(fProgramDataManager, &texUnitIdx);
106 } 84 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 241
264 GrGLfloat viewMatrix[3 * 3]; 242 GrGLfloat viewMatrix[3 * 3];
265 fMatrixState.getGLMatrix<3>(viewMatrix); 243 fMatrixState.getGLMatrix<3>(viewMatrix);
266 fProgramDataManager.setMatrix3f(fBuiltinUniformHandles.fViewMatrixUni, v iewMatrix); 244 fProgramDataManager.setMatrix3f(fBuiltinUniformHandles.fViewMatrixUni, v iewMatrix);
267 245
268 GrGLfloat rtAdjustmentVec[4]; 246 GrGLfloat rtAdjustmentVec[4];
269 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec); 247 fMatrixState.getRTAdjustmentVec(rtAdjustmentVec);
270 fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, r tAdjustmentVec); 248 fProgramDataManager.set4fv(fBuiltinUniformHandles.fRTAdjustmentUni, 1, r tAdjustmentVec);
271 } 249 }
272 } 250 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698