Revert of Attach GrOptDrawState into shader building pipeline (patchset #11 id:220001 of https://codereview.chromium.org/504203004/)
Reason for revert:
Failing some msaa gm's
Original issue's description:
> Attach GrOptDrawState into shader building pipeline
>
> The OptDrawState is now used for creating the actual gl shader. Current
> optimizations dones in GrOptDrawState include:
> All blend optimizations
> Constant color/coverage stage optimizations
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/ee6206572b42fec11f83ad0c1e6d435903640518
R=bsalomon@google.com, joshualitt@google.com
TBR=bsalomon@google.com, joshualitt@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Author: egdaniel@google.com
Review URL: https://codereview.chromium.org/560443004
diff --git a/src/gpu/GrOptDrawState.cpp b/src/gpu/GrOptDrawState.cpp
index 5f35296..83546ba 100644
--- a/src/gpu/GrOptDrawState.cpp
+++ b/src/gpu/GrOptDrawState.cpp
@@ -9,10 +9,7 @@
#include "GrDrawState.h"
-GrOptDrawState::GrOptDrawState(const GrDrawState& drawState,
- BlendOptFlags blendOptFlags,
- GrBlendCoeff optSrcCoeff,
- GrBlendCoeff optDstCoeff) : INHERITED(drawState) {
+GrOptDrawState::GrOptDrawState(const GrDrawState& drawState) : INHERITED(drawState) {
fColor = drawState.getColor();
fCoverage = drawState.getCoverage();
fViewMatrix = drawState.getViewMatrix();
@@ -23,15 +20,13 @@
fVAStride = drawState.getVertexStride();
fStencilSettings = drawState.getStencil();
fDrawFace = drawState.getDrawFace();
- fBlendOptFlags = blendOptFlags;
- fSrcBlend = optSrcCoeff;
- fDstBlend = optDstCoeff;
+
+ fBlendOptFlags = drawState.getBlendOpts(false, &fSrcBlend, &fDstBlend);
memcpy(fFixedFunctionVertexAttribIndices,
drawState.getFixedFunctionVertexAttribIndices(),
sizeof(fFixedFunctionVertexAttribIndices));
-
fInputColorIsUsed = true;
fInputCoverageIsUsed = true;
@@ -43,40 +38,8 @@
this->copyEffectiveColorStages(drawState);
this->copyEffectiveCoverageStages(drawState);
- this->adjustFromBlendOpts();
};
-void GrOptDrawState::adjustFromBlendOpts() {
-
- switch (fBlendOptFlags) {
- case kNone_BlendOpt:
- case kSkipDraw_BlendOptFlag:
- break;
- case kCoverageAsAlpha_BlendOptFlag:
- fFlagBits |= kCoverageDrawing_StateBit;
- break;
- case kEmitCoverage_BlendOptFlag:
- fColor = 0xffffffff;
- fInputColorIsUsed = true;
- fColorStages.reset();
- this->removeFixedFunctionVertexAttribs(0x1 << kColor_GrVertexAttribBinding);
- break;
- case kEmitTransBlack_BlendOptFlag:
- fColor = 0;
- fCoverage = 0xff;
- fInputColorIsUsed = true;
- fInputCoverageIsUsed = true;
- fColorStages.reset();
- fCoverageStages.reset();
- this->removeFixedFunctionVertexAttribs(0x1 << kColor_GrVertexAttribBinding |
- 0x1 << kCoverage_GrVertexAttribBinding);
- break;
- default:
- SkFAIL("Unknown BlendOptFlag");
-
- }
-}
-
void GrOptDrawState::removeFixedFunctionVertexAttribs(uint8_t removeVAFlag) {
int numToRemove = 0;
uint8_t maskCheck = 0x1;
@@ -87,7 +50,6 @@
}
maskCheck <<= 1;
}
-
fOptVA.reset(fVACount - numToRemove);
GrVertexAttrib* dst = fOptVA.get();
@@ -102,9 +64,9 @@
fFixedFunctionVertexAttribIndices[currAttrib.fBinding] = -1;
continue;
}
- fFixedFunctionVertexAttribIndices[currAttrib.fBinding] = newIdx;
}
memcpy(dst, src, sizeof(GrVertexAttrib));
+ fFixedFunctionVertexAttribIndices[currAttrib.fBinding] = newIdx;
++newIdx;
++dst;
}