diff --git a/src/gpu/gl/GrGLProgram.cpp b/src/gpu/gl/GrGLProgram.cpp index 11efda9214..534e3c38a1 100644 --- a/src/gpu/gl/GrGLProgram.cpp +++ b/src/gpu/gl/GrGLProgram.cpp @@ -188,6 +188,9 @@ void GrGLProgram::setColor(const GrDrawState& drawState, } sharedState->fConstAttribColorIndex = -1; break; + case GrGLProgramDesc::kAllOnes_ColorInput: + sharedState->fConstAttribColorIndex = -1; + break; default: SkFAIL("Unexpected color type."); } @@ -223,7 +226,7 @@ void GrGLProgram::setCoverage(const GrDrawState& drawState, } sharedState->fConstAttribCoverageIndex = -1; break; - case GrGLProgramDesc::kSolidWhite_ColorInput: + case GrGLProgramDesc::kAllOnes_ColorInput: sharedState->fConstAttribCoverageIndex = -1; break; default: diff --git a/src/gpu/gl/GrGLProgramDesc.cpp b/src/gpu/gl/GrGLProgramDesc.cpp index 286924e1ef..545ed2114c 100644 --- a/src/gpu/gl/GrGLProgramDesc.cpp +++ b/src/gpu/gl/GrGLProgramDesc.cpp @@ -188,7 +188,9 @@ bool GrGLProgramDesc::Build(const GrDrawState& drawState, #endif bool defaultToUniformInputs = GR_GL_NO_CONSTANT_ATTRIBUTES || gpu->caps()->pathRenderingSupport(); - if (defaultToUniformInputs && !requiresColorAttrib && inputColorIsUsed) { + if (!inputColorIsUsed && !skipColor) { + header->fColorInput = kAllOnes_ColorInput; + } else if (defaultToUniformInputs && !requiresColorAttrib && inputColorIsUsed) { header->fColorInput = kUniform_ColorInput; } else { header->fColorInput = kAttribute_ColorInput; @@ -198,7 +200,7 @@ bool GrGLProgramDesc::Build(const GrDrawState& drawState, bool covIsSolidWhite = !requiresCoverageAttrib && 0xffffffff == drawState.getCoverageColor(); if ((covIsSolidWhite || !inputCoverageIsUsed) && !skipCoverage) { - header->fCoverageInput = kSolidWhite_ColorInput; + header->fCoverageInput = kAllOnes_ColorInput; } else if (defaultToUniformInputs && !requiresCoverageAttrib && inputCoverageIsUsed) { header->fCoverageInput = kUniform_ColorInput; } else { diff --git a/src/gpu/gl/GrGLProgramDesc.h b/src/gpu/gl/GrGLProgramDesc.h index 4796d5a4b3..aefcb508e2 100644 --- a/src/gpu/gl/GrGLProgramDesc.h +++ b/src/gpu/gl/GrGLProgramDesc.h @@ -99,7 +99,7 @@ public: private: // Specifies where the initial color comes from before the stages are applied. enum ColorInput { - kSolidWhite_ColorInput, + kAllOnes_ColorInput, kAttribute_ColorInput, kUniform_ColorInput, diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp index 141442d599..7664bab90f 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp +++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp @@ -51,6 +51,8 @@ bool GrGLProgramBuilder::genProgram(const GrEffectStage* colorStages[], "Color", &name); inputColor = GrGLSLExpr4(name); + } else if (GrGLProgramDesc::kAllOnes_ColorInput == header.fColorInput) { + inputColor = GrGLSLExpr4(1); } if (GrGLProgramDesc::kUniform_ColorInput == header.fCoverageInput) { @@ -61,7 +63,7 @@ bool GrGLProgramBuilder::genProgram(const GrEffectStage* colorStages[], "Coverage", &name); inputCoverage = GrGLSLExpr4(name); - } else if (GrGLProgramDesc::kSolidWhite_ColorInput == header.fCoverageInput) { + } else if (GrGLProgramDesc::kAllOnes_ColorInput == header.fCoverageInput) { inputCoverage = GrGLSLExpr4(1); }