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

Unified Diff: src/gpu/GrOptDrawState.cpp

Issue 791743003: Remove GP from drawstate, revision of invariant output for GP (Closed) Base URL: https://skia.googlesource.com/skia.git@color-to-gp
Patch Set: more windows fix 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 b4c1a60b477702f4ec30f4767760c5427635aa58..60360d21c6168d3dd8134c6e3b8eb483bb25a60e 100644
--- a/src/gpu/GrOptDrawState.cpp
+++ b/src/gpu/GrOptDrawState.cpp
@@ -14,21 +14,36 @@
#include "GrXferProcessor.h"
GrOptDrawState::GrOptDrawState(const GrDrawState& drawState,
- GrColor color,
- uint8_t coverage,
+ const GrGeometryProcessor* gp,
+ const GrPathProcessor* pathProc,
const GrDrawTargetCaps& caps,
const ScissorState& scissorState,
const GrDeviceCoordTexture* dstCopy,
GrGpu::DrawType drawType)
: fFinalized(false) {
- GrColor coverageColor = GrColorPackRGBA(coverage, coverage, coverage, coverage);
fDrawType = drawType;
- const GrProcOptInfo& colorPOI = drawState.colorProcInfo(color);
- const GrProcOptInfo& coveragePOI = drawState.coverageProcInfo(coverageColor);
+ // 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);
fColor = colorPOI.inputColorToEffectiveStage();
- fCoverage = coverage;
+ // TODO fix this when coverage stages work correctly
+ // fCoverage = coveragePOI.inputColorToEffectiveStage();
+ fCoverage = fPrimitiveProcessor->coverage();
// Create XferProcessor from DS's XPFactory
SkAutoTUnref<GrXferProcessor> xferProcessor(
@@ -83,14 +98,11 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState,
fFlags |= kDither_Flag;
}
- fDescInfo.fHasVertexColor = drawState.hasGeometryProcessor() &&
- drawState.getGeometryProcessor()->hasVertexColor();
+ fDescInfo.fHasVertexColor = gp && gp->hasVertexColor();
- fDescInfo.fHasVertexCoverage = drawState.hasGeometryProcessor() &&
- drawState.getGeometryProcessor()->hasVertexCoverage();
+ fDescInfo.fHasVertexCoverage = gp && gp->hasVertexCoverage();
- bool hasLocalCoords = drawState.hasGeometryProcessor() &&
- drawState.getGeometryProcessor()->hasLocalCoords();
+ bool hasLocalCoords = gp && gp->hasLocalCoords();
int firstColorStageIdx = colorPOI.firstEffectiveStageIndex();
fDescInfo.fInputColorIsUsed = colorPOI.inputColorIsUsed();
@@ -103,7 +115,6 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState,
int firstCoverageStageIdx = 0;
fDescInfo.fInputCoverageIsUsed = true;
-
GrXferProcessor::BlendInfo blendInfo;
fXferProcessor->getBlendInfo(&blendInfo);
@@ -112,12 +123,6 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState,
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,
@@ -133,7 +138,7 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState,
}
// let the GP init the batch tracker
- if (drawState.hasGeometryProcessor()) {
+ if (gp) {
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