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

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

Issue 15199008: Disable blending when there is an effect that reads the dst and draw state blend is 1,0. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrDrawState.cpp ('k') | no next file » | 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 2013 Google Inc. 2 * Copyright 2013 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 "GrGLProgramDesc.h" 8 #include "GrGLProgramDesc.h"
9 #include "GrBackendEffectFactory.h" 9 #include "GrBackendEffectFactory.h"
10 #include "GrDrawEffect.h" 10 #include "GrDrawEffect.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 } else if (kSA_GrBlendCoeff == dstCoeff) { 171 } else if (kSA_GrBlendCoeff == dstCoeff) {
172 // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially covered. 172 // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially covered.
173 desc->fCoverageOutput = kSecondaryCoverageISA_CoverageOutput; 173 desc->fCoverageOutput = kSecondaryCoverageISA_CoverageOutput;
174 desc->fFirstCoverageStage = firstCoverageStage; 174 desc->fFirstCoverageStage = firstCoverageStage;
175 } else if (kSC_GrBlendCoeff == dstCoeff) { 175 } else if (kSC_GrBlendCoeff == dstCoeff) {
176 // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially covered. 176 // SA dst coeff becomes 1-(1-SA)*coverage when dst is partially covered.
177 desc->fCoverageOutput = kSecondaryCoverageISC_CoverageOutput; 177 desc->fCoverageOutput = kSecondaryCoverageISC_CoverageOutput;
178 desc->fFirstCoverageStage = firstCoverageStage; 178 desc->fFirstCoverageStage = firstCoverageStage;
179 } 179 }
180 } else if (readsDst && 180 } else if (readsDst &&
181 kOne_GrBlendCoeff == drawState.getSrcBlendCoeff() && 181 kOne_GrBlendCoeff == srcCoeff &&
182 kZero_GrBlendCoeff == drawState.getDstBlendCoeff()) { 182 kZero_GrBlendCoeff == dstCoeff) {
183 desc->fCoverageOutput = kCombineWithDst_CoverageOutput; 183 desc->fCoverageOutput = kCombineWithDst_CoverageOutput;
184 desc->fFirstCoverageStage = firstCoverageStage; 184 desc->fFirstCoverageStage = firstCoverageStage;
185 } 185 }
186 } 186 }
187 187
188 desc->fPositionAttributeIndex = drawState.positionAttributeIndex(); 188 desc->fPositionAttributeIndex = drawState.positionAttributeIndex();
189 desc->fLocalCoordAttributeIndex = drawState.localCoordAttributeIndex(); 189 desc->fLocalCoordAttributeIndex = drawState.localCoordAttributeIndex();
190 190
191 // For constant color and coverage we need an attribute with an index beyond those already set 191 // For constant color and coverage we need an attribute with an index beyond those already set
192 int availableAttributeIndex = drawState.getVertexAttribCount(); 192 int availableAttributeIndex = drawState.getVertexAttribCount();
193 if (requiresColorAttrib) { 193 if (requiresColorAttrib) {
194 desc->fColorAttributeIndex = drawState.colorVertexAttributeIndex(); 194 desc->fColorAttributeIndex = drawState.colorVertexAttributeIndex();
195 } else if (GrGLProgramDesc::kAttribute_ColorInput == desc->fColorInput) { 195 } else if (GrGLProgramDesc::kAttribute_ColorInput == desc->fColorInput) {
196 GrAssert(availableAttributeIndex < GrDrawState::kMaxVertexAttribCnt); 196 GrAssert(availableAttributeIndex < GrDrawState::kMaxVertexAttribCnt);
197 desc->fColorAttributeIndex = availableAttributeIndex; 197 desc->fColorAttributeIndex = availableAttributeIndex;
198 availableAttributeIndex++; 198 availableAttributeIndex++;
199 } else { 199 } else {
200 desc->fColorAttributeIndex = -1; 200 desc->fColorAttributeIndex = -1;
201 } 201 }
202 202
203 if (requiresCoverageAttrib) { 203 if (requiresCoverageAttrib) {
204 desc->fCoverageAttributeIndex = drawState.coverageVertexAttributeIndex() ; 204 desc->fCoverageAttributeIndex = drawState.coverageVertexAttributeIndex() ;
205 } else if (GrGLProgramDesc::kAttribute_ColorInput == desc->fCoverageInput) { 205 } else if (GrGLProgramDesc::kAttribute_ColorInput == desc->fCoverageInput) {
206 GrAssert(availableAttributeIndex < GrDrawState::kMaxVertexAttribCnt); 206 GrAssert(availableAttributeIndex < GrDrawState::kMaxVertexAttribCnt);
207 desc->fCoverageAttributeIndex = availableAttributeIndex; 207 desc->fCoverageAttributeIndex = availableAttributeIndex;
208 } else { 208 } else {
209 desc->fCoverageAttributeIndex = -1; 209 desc->fCoverageAttributeIndex = -1;
210 } 210 }
211 } 211 }
OLDNEW
« no previous file with comments | « src/gpu/GrDrawState.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698