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

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

Issue 385163004: Revert of Remove gpu shader optimatization for solid white or trans black colors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/GrGLProgram.cpp ('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 cff4a2bab6f46ab886fa4889d5c62e396b8239f8..ecd48e014810eb4158a452a256418bad0aaba159 100644
--- a/src/gpu/gl/GrGLProgramDesc.cpp
+++ b/src/gpu/gl/GrGLProgramDesc.cpp
@@ -89,6 +89,11 @@
bool requiresLocalCoordAttrib = !(skipCoverage && skipColor) &&
drawState.hasLocalCoordAttribute();
+ bool colorIsTransBlack = SkToBool(blendOpts & GrDrawState::kEmitTransBlack_BlendOptFlag);
+ bool colorIsSolidWhite = (blendOpts & GrDrawState::kEmitCoverage_BlendOptFlag) ||
+ (!requiresColorAttrib && 0xffffffff == drawState.getColor()) ||
+ (!inputColorIsUsed);
+
int numEffects = (skipColor ? 0 : (drawState.numColorStages() - firstEffectiveColorStage)) +
(skipCoverage ? 0 : (drawState.numCoverageStages() - firstEffectiveCoverageStage));
@@ -143,7 +148,11 @@
#endif
bool defaultToUniformInputs = GR_GL_NO_CONSTANT_ATTRIBUTES || gpu->caps()->pathRenderingSupport();
- if (defaultToUniformInputs && !requiresColorAttrib) {
+ if (colorIsTransBlack) {
+ header->fColorInput = kTransBlack_ColorInput;
+ } else if (colorIsSolidWhite) {
+ header->fColorInput = kSolidWhite_ColorInput;
+ } else if (defaultToUniformInputs && !requiresColorAttrib) {
header->fColorInput = kUniform_ColorInput;
} else {
header->fColorInput = kAttribute_ColorInput;
@@ -152,7 +161,9 @@
bool covIsSolidWhite = !requiresCoverageAttrib && 0xffffffff == drawState.getCoverageColor();
- if (covIsSolidWhite || !inputCoverageIsUsed) {
+ if (skipCoverage) {
+ header->fCoverageInput = kTransBlack_ColorInput;
+ } else if (covIsSolidWhite || !inputCoverageIsUsed) {
header->fCoverageInput = kSolidWhite_ColorInput;
} else if (defaultToUniformInputs && !requiresCoverageAttrib) {
header->fCoverageInput = kUniform_ColorInput;
« no previous file with comments | « src/gpu/gl/GrGLProgram.cpp ('k') | src/gpu/gl/GrGLShaderBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698