When ignoring color input don't use vertex attribs on gpu
Also rename SolidWhite_ColorInput enum to be AllOnes_ColorInput to better reflect what it's use is BUG=skia: R=bsalomon@google.com Author: egdaniel@google.com Review URL: https://codereview.chromium.org/525433002
This commit is contained in:
parent
871dca8ea9
commit
842b086a3c
@ -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:
|
||||
|
@ -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 {
|
||||
|
@ -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,
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user