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

Unified Diff: src/gpu/GrOptDrawState.cpp

Issue 794843002: Revert of Remove GP from drawstate, revision of invariant output for GP (Closed) Base URL: https://skia.googlesource.com/skia.git@color-to-gp
Patch Set: Created 6 years 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/GrOvalRenderer.cpp » ('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 010fe4b7392fb2444a8e4ad2c4f4d91f004dee6f..9ebe551d6bc5d5fa141f94854ca75e17ebf17daf 100644
--- a/src/gpu/GrOptDrawState.cpp
+++ b/src/gpu/GrOptDrawState.cpp
@@ -14,36 +14,21 @@
#include "GrXferProcessor.h"
GrOptDrawState::GrOptDrawState(const GrDrawState& drawState,
- const GrGeometryProcessor* gp,
- const GrPathProcessor* pathProc,
+ GrColor color,
+ uint8_t coverage,
const GrDrawTargetCaps& caps,
const ScissorState& scissorState,
const GrDeviceCoordTexture* dstCopy,
GrGpu::DrawType drawType)
: fFinalized(false) {
+ GrColor coverageColor = GrColorPackRGBA(coverage, coverage, coverage, coverage);
fDrawType = drawType;
- // Copy GeometryProcesssor from DS or ODS
- if (gp) {
- SkASSERT(!pathProc);
- SkASSERT(!(GrGpu::IsPathRenderingDrawType(drawType) ||
- GrGpu::kStencilPath_DrawType == drawType));
- fGeometryProcessor.reset(gp);
- fPrimitiveProcessor.reset(gp);
- } else {
- SkASSERT(!gp && pathProc && (GrGpu::IsPathRenderingDrawType(drawType) ||
- GrGpu::kStencilPath_DrawType == drawType));
- fPrimitiveProcessor.reset(pathProc);
- }
-
-
- const GrProcOptInfo& colorPOI = drawState.colorProcInfo(fPrimitiveProcessor);
- const GrProcOptInfo& coveragePOI = drawState.coverageProcInfo(fPrimitiveProcessor);
+ const GrProcOptInfo& colorPOI = drawState.colorProcInfo(color);
+ const GrProcOptInfo& coveragePOI = drawState.coverageProcInfo(coverageColor);
fColor = colorPOI.inputColorToEffectiveStage();
- // TODO fix this when coverage stages work correctly
- // fCoverage = coveragePOI.inputColorToEffectiveStage();
- fCoverage = fPrimitiveProcessor->coverage();
+ fCoverage = coverage;
// Create XferProcessor from DS's XPFactory
SkAutoTUnref<GrXferProcessor> xferProcessor(
@@ -101,11 +86,14 @@
fFlags |= kDither_Flag;
}
- fDescInfo.fHasVertexColor = gp && gp->hasVertexColor();
-
- fDescInfo.fHasVertexCoverage = gp && gp->hasVertexCoverage();
-
- bool hasLocalCoords = gp && gp->hasLocalCoords();
+ fDescInfo.fHasVertexColor = drawState.hasGeometryProcessor() &&
+ drawState.getGeometryProcessor()->hasVertexColor();
+
+ fDescInfo.fHasVertexCoverage = drawState.hasGeometryProcessor() &&
+ drawState.getGeometryProcessor()->hasVertexCoverage();
+
+ bool hasLocalCoords = drawState.hasGeometryProcessor() &&
+ drawState.getGeometryProcessor()->hasLocalCoords();
int firstColorStageIdx = colorPOI.firstEffectiveStageIndex();
fDescInfo.fInputColorIsUsed = colorPOI.inputColorIsUsed();
@@ -117,6 +105,7 @@
// drawState's coverageProcInfo (like color above) to set this initial information.
int firstCoverageStageIdx = 0;
fDescInfo.fInputCoverageIsUsed = true;
+
GrXferProcessor::BlendInfo blendInfo;
fXferProcessor->getBlendInfo(&blendInfo);
@@ -129,6 +118,12 @@
fDescInfo.fRequiresLocalCoordAttrib = hasLocalCoords;
+ // Copy GeometryProcesssor from DS or ODS
+ SkASSERT(GrGpu::IsPathRenderingDrawType(drawType) ||
+ GrGpu::kStencilPath_DrawType ||
+ drawState.hasGeometryProcessor());
+ fGeometryProcessor.reset(drawState.getGeometryProcessor());
+
// Copy Stages from DS to ODS
for (int i = firstColorStageIdx; i < drawState.numColorStages(); ++i) {
SkNEW_APPEND_TO_TARRAY(&fFragmentStages,
@@ -144,7 +139,7 @@
}
// let the GP init the batch tracker
- if (gp) {
+ if (drawState.hasGeometryProcessor()) {
GrGeometryProcessor::InitBT init;
init.fOutputColor = fDescInfo.fInputColorIsUsed;
init.fOutputCoverage = fDescInfo.fInputCoverageIsUsed;
« no previous file with comments | « src/gpu/GrOptDrawState.h ('k') | src/gpu/GrOvalRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698