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;
|
sharedState->fConstAttribColorIndex = -1;
|
||||||
break;
|
break;
|
||||||
|
case GrGLProgramDesc::kAllOnes_ColorInput:
|
||||||
|
sharedState->fConstAttribColorIndex = -1;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
SkFAIL("Unexpected color type.");
|
SkFAIL("Unexpected color type.");
|
||||||
}
|
}
|
||||||
@ -223,7 +226,7 @@ void GrGLProgram::setCoverage(const GrDrawState& drawState,
|
|||||||
}
|
}
|
||||||
sharedState->fConstAttribCoverageIndex = -1;
|
sharedState->fConstAttribCoverageIndex = -1;
|
||||||
break;
|
break;
|
||||||
case GrGLProgramDesc::kSolidWhite_ColorInput:
|
case GrGLProgramDesc::kAllOnes_ColorInput:
|
||||||
sharedState->fConstAttribCoverageIndex = -1;
|
sharedState->fConstAttribCoverageIndex = -1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -188,7 +188,9 @@ bool GrGLProgramDesc::Build(const GrDrawState& drawState,
|
|||||||
#endif
|
#endif
|
||||||
bool defaultToUniformInputs = GR_GL_NO_CONSTANT_ATTRIBUTES || gpu->caps()->pathRenderingSupport();
|
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;
|
header->fColorInput = kUniform_ColorInput;
|
||||||
} else {
|
} else {
|
||||||
header->fColorInput = kAttribute_ColorInput;
|
header->fColorInput = kAttribute_ColorInput;
|
||||||
@ -198,7 +200,7 @@ bool GrGLProgramDesc::Build(const GrDrawState& drawState,
|
|||||||
bool covIsSolidWhite = !requiresCoverageAttrib && 0xffffffff == drawState.getCoverageColor();
|
bool covIsSolidWhite = !requiresCoverageAttrib && 0xffffffff == drawState.getCoverageColor();
|
||||||
|
|
||||||
if ((covIsSolidWhite || !inputCoverageIsUsed) && !skipCoverage) {
|
if ((covIsSolidWhite || !inputCoverageIsUsed) && !skipCoverage) {
|
||||||
header->fCoverageInput = kSolidWhite_ColorInput;
|
header->fCoverageInput = kAllOnes_ColorInput;
|
||||||
} else if (defaultToUniformInputs && !requiresCoverageAttrib && inputCoverageIsUsed) {
|
} else if (defaultToUniformInputs && !requiresCoverageAttrib && inputCoverageIsUsed) {
|
||||||
header->fCoverageInput = kUniform_ColorInput;
|
header->fCoverageInput = kUniform_ColorInput;
|
||||||
} else {
|
} else {
|
||||||
|
@ -99,7 +99,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
// Specifies where the initial color comes from before the stages are applied.
|
// Specifies where the initial color comes from before the stages are applied.
|
||||||
enum ColorInput {
|
enum ColorInput {
|
||||||
kSolidWhite_ColorInput,
|
kAllOnes_ColorInput,
|
||||||
kAttribute_ColorInput,
|
kAttribute_ColorInput,
|
||||||
kUniform_ColorInput,
|
kUniform_ColorInput,
|
||||||
|
|
||||||
|
@ -51,6 +51,8 @@ bool GrGLProgramBuilder::genProgram(const GrEffectStage* colorStages[],
|
|||||||
"Color",
|
"Color",
|
||||||
&name);
|
&name);
|
||||||
inputColor = GrGLSLExpr4(name);
|
inputColor = GrGLSLExpr4(name);
|
||||||
|
} else if (GrGLProgramDesc::kAllOnes_ColorInput == header.fColorInput) {
|
||||||
|
inputColor = GrGLSLExpr4(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GrGLProgramDesc::kUniform_ColorInput == header.fCoverageInput) {
|
if (GrGLProgramDesc::kUniform_ColorInput == header.fCoverageInput) {
|
||||||
@ -61,7 +63,7 @@ bool GrGLProgramBuilder::genProgram(const GrEffectStage* colorStages[],
|
|||||||
"Coverage",
|
"Coverage",
|
||||||
&name);
|
&name);
|
||||||
inputCoverage = GrGLSLExpr4(name);
|
inputCoverage = GrGLSLExpr4(name);
|
||||||
} else if (GrGLProgramDesc::kSolidWhite_ColorInput == header.fCoverageInput) {
|
} else if (GrGLProgramDesc::kAllOnes_ColorInput == header.fCoverageInput) {
|
||||||
inputCoverage = GrGLSLExpr4(1);
|
inputCoverage = GrGLSLExpr4(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user