Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(253)

Unified Diff: src/gpu/GrOptDrawState.cpp

Issue 560443004: Revert of Attach GrOptDrawState into shader building pipeline (Closed) Base URL: https://skia.googlesource.com/skia.git@opt2
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrOptDrawState.h ('k') | src/gpu/GrRODrawState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrOptDrawState.cpp
diff --git a/src/gpu/GrOptDrawState.cpp b/src/gpu/GrOptDrawState.cpp
index 5f352966b8a3441d5faf603c6234788dc2e23db6..83546ba3b789aa556caefafd166baee52b38bef7 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,14 +20,12 @@
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,39 +38,7 @@
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;
@@ -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;
}
« no previous file with comments | « src/gpu/GrOptDrawState.h ('k') | src/gpu/GrRODrawState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698