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

Unified Diff: src/gpu/gl/GrGLProgramDesc.cpp

Issue 375823005: Remove gpu shader optimatization for solid white or trans black colors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Change ignore function name Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/gl/GrGLProgramDesc.h ('k') | src/gpu/gl/GrGLShaderBuilder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLProgramDesc.cpp
diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp
index 27a1fab1e0e1a3e892c1f8866aa38077c64493b7..e1a319104d1d66b2b215cab22fc5457170ef00ac 100644
--- a/src/gpu/gl/GrGLProgramDesc.cpp
+++ b/src/gpu/gl/GrGLProgramDesc.cpp
@@ -66,6 +66,7 @@ bool GrGLProgramDesc::Build(const GrDrawState& drawState,
bool skipColor = SkToBool(blendOpts & (GrDrawState::kEmitTransBlack_BlendOptFlag |
GrDrawState::kEmitCoverage_BlendOptFlag));
+
int firstEffectiveColorStage = 0;
bool inputColorIsUsed = true;
if (!skipColor) {
@@ -99,11 +100,6 @@ bool GrGLProgramDesc::Build(const GrDrawState& drawState,
bool requiresLocalCoordAttrib = !(skipCoverage && skipColor) &&
drawState.hasLocalCoordAttribute();
- bool colorIsTransBlack = SkToBool(blendOpts & GrDrawState::kEmitTransBlack_BlendOptFlag);
- bool colorIsSolidWhite = (blendOpts & GrDrawState::kEmitCoverage_BlendOptFlag) ||
- (!requiresColorAttrib && 0xffffffff == drawState.getColor()) ||
- (!inputColorIsUsed);
-
bool readsDst = false;
bool readFragPosition = false;
// We use vertexshader-less shader programs only when drawing paths.
@@ -192,11 +188,7 @@ bool GrGLProgramDesc::Build(const GrDrawState& drawState,
#endif
bool defaultToUniformInputs = GR_GL_NO_CONSTANT_ATTRIBUTES || gpu->caps()->pathRenderingSupport();
- if (colorIsTransBlack) {
- header->fColorInput = kTransBlack_ColorInput;
- } else if (colorIsSolidWhite) {
- header->fColorInput = kSolidWhite_ColorInput;
- } else if (defaultToUniformInputs && !requiresColorAttrib) {
+ if (defaultToUniformInputs && !requiresColorAttrib && inputColorIsUsed) {
header->fColorInput = kUniform_ColorInput;
} else {
header->fColorInput = kAttribute_ColorInput;
@@ -205,11 +197,9 @@ bool GrGLProgramDesc::Build(const GrDrawState& drawState,
bool covIsSolidWhite = !requiresCoverageAttrib && 0xffffffff == drawState.getCoverageColor();
- if (skipCoverage) {
- header->fCoverageInput = kTransBlack_ColorInput;
- } else if (covIsSolidWhite || !inputCoverageIsUsed) {
+ if ((covIsSolidWhite || !inputCoverageIsUsed) && !skipCoverage) {
header->fCoverageInput = kSolidWhite_ColorInput;
- } else if (defaultToUniformInputs && !requiresCoverageAttrib) {
+ } else if (defaultToUniformInputs && !requiresCoverageAttrib && inputCoverageIsUsed) {
header->fCoverageInput = kUniform_ColorInput;
} else {
header->fCoverageInput = kAttribute_ColorInput;
« no previous file with comments | « src/gpu/gl/GrGLProgramDesc.h ('k') | src/gpu/gl/GrGLShaderBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698