Uses enums explicitly sized to 8 bits in GrGLProgramDesc::KeyHeader,
instead of storing them as uint8_t values. This avoids the need to
static_cast them.
R=bsalomon@google.com
Author: cdalton@nvidia.com
Review URL: https://codereview.chromium.org/
23875048
git-svn-id: http://skia.googlecode.com/svn/trunk@11560
2bbb7eff-a529-9590-31e7-
b0007b416f81
SkXfermode::Coeff colorCoeff;
SkXfermode::Coeff filterColorCoeff;
SkAssertResult(
- SkXfermode::ModeAsCoeff(static_cast<SkXfermode::Mode>(header.fColorFilterXfermode),
+ SkXfermode::ModeAsCoeff(header.fColorFilterXfermode,
&filterColorCoeff,
&colorCoeff));
bool needColor, needFilterColor;
}
}
- GrGLProgramDesc::CoverageOutput coverageOutput =
- static_cast<GrGLProgramDesc::CoverageOutput>(header.fCoverageOutput);
- if (GrGLProgramDesc::CoverageOutputUsesSecondaryOutput(coverageOutput)) {
+ if (GrGLProgramDesc::CoverageOutputUsesSecondaryOutput(header.fCoverageOutput)) {
const char* secondaryOutputName = builder.enableSecondaryOutput();
// default coeff to ones for kCoverage_DualSrcOutput
kOnes_GrSLConstantVec,
knownColorValue,
true);
- } else if (GrGLProgramDesc::kSecondaryCoverageISC_CoverageOutput == coverageOutput) {
+ } else if (GrGLProgramDesc::kSecondaryCoverageISC_CoverageOutput == header.fCoverageOutput) {
// Get (1-RGBA) into coeff
knownCoeffValue = GrGLSLSubtractf<4>(&coeff,
NULL,
knownCoverageValue,
true);
// Now tack on "+(1-coverage)dst onto the frag color if we were asked to do so.
- if (GrGLProgramDesc::kCombineWithDst_CoverageOutput == coverageOutput) {
+ if (GrGLProgramDesc::kCombineWithDst_CoverageOutput == header.fCoverageOutput) {
SkString dstCoeff;
GrSLConstantVec knownDstCoeffValue = GrGLSLSubtractf<4>(&dstCoeff,
NULL,
// should the FS discard if the coverage is zero (to avoid stencil manipulation)
SkBool8 fDiscardIfZeroCoverage;
- uint8_t fColorInput; // casts to enum ColorInput
- uint8_t fCoverageInput; // casts to enum ColorInput
- uint8_t fCoverageOutput; // casts to enum CoverageOutput
+ ColorInput fColorInput : 8;
+ ColorInput fCoverageInput : 8;
+ CoverageOutput fCoverageOutput : 8;
SkBool8 fHasVertexCode;
SkBool8 fEmitsPointSize;
- uint8_t fColorFilterXfermode; // casts to enum SkXfermode::Mode
+ SkXfermode::Mode fColorFilterXfermode : 8;
// To enable experimental geometry shader code (not for use in
// production)
// if the effects have used up all off the available attributes,
// don't try to use color or coverage attributes as input
do {
- header->fColorInput = random->nextULessThan(kColorInputCnt);
+ header->fColorInput = static_cast<GrGLProgramDesc::ColorInput>(
+ random->nextULessThan(kColorInputCnt));
} while (GrDrawState::kMaxVertexAttribCnt <= currAttribIndex &&
kAttribute_ColorInput == header->fColorInput);
header->fColorAttributeIndex = (header->fColorInput == kAttribute_ColorInput) ?
-1;
do {
- header->fCoverageInput = random->nextULessThan(kColorInputCnt);
+ header->fCoverageInput = static_cast<GrGLProgramDesc::ColorInput>(
+ random->nextULessThan(kColorInputCnt));
} while (GrDrawState::kMaxVertexAttribCnt <= currAttribIndex &&
kAttribute_ColorInput == header->fCoverageInput);
header->fCoverageAttributeIndex = (header->fCoverageInput == kAttribute_ColorInput) ?
currAttribIndex++ :
-1;
- header->fColorFilterXfermode = random->nextULessThan(SkXfermode::kLastCoeffMode + 1);
+ header->fColorFilterXfermode = static_cast<SkXfermode::Mode>(
+ random->nextULessThan(SkXfermode::kLastCoeffMode + 1));
#if GR_GL_EXPERIMENTAL_GS
header->fExperimentalGS = gpu->caps()->geometryShaderSupport() && random->nextBool();