Index: src/gpu/GrOptDrawState.cpp |
diff --git a/src/gpu/GrOptDrawState.cpp b/src/gpu/GrOptDrawState.cpp |
index 409305ce33fae912d79acbd2f3964ed589d4464a..63b5f4d088dd04b1ce99cb047936c8e8d9824a89 100644 |
--- a/src/gpu/GrOptDrawState.cpp |
+++ b/src/gpu/GrOptDrawState.cpp |
@@ -14,6 +14,7 @@ |
#include "GrXferProcessor.h" |
GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, |
+ const GrGeometryProcessor* gp, |
GrColor color, |
uint8_t coverage, |
const GrDrawTargetCaps& caps, |
@@ -24,8 +25,8 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, |
GrColor coverageColor = GrColorPackRGBA(coverage, coverage, coverage, coverage); |
fDrawType = drawType; |
- const GrProcOptInfo& colorPOI = drawState.colorProcInfo(color); |
- const GrProcOptInfo& coveragePOI = drawState.coverageProcInfo(coverageColor); |
+ const GrProcOptInfo& colorPOI = drawState.colorProcInfo(gp, color); |
+ const GrProcOptInfo& coveragePOI = drawState.coverageProcInfo(gp, coverageColor); |
fColor = colorPOI.inputColorToEffectiveStage(); |
fCoverage = coverage; |
@@ -85,14 +86,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(); |
@@ -105,7 +103,6 @@ GrOptDrawState::GrOptDrawState(const GrDrawState& drawState, |
int firstCoverageStageIdx = 0; |
fDescInfo.fInputCoverageIsUsed = true; |
- |
GrXferProcessor::BlendInfo blendInfo; |
fXferProcessor->getBlendInfo(&blendInfo); |
fSrcBlend = blendInfo.fSrcBlend; |
@@ -118,10 +115,8 @@ 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()); |
+ SkASSERT(GrGpu::IsPathRenderingDrawType(drawType) || GrGpu::kStencilPath_DrawType || gp); |
+ fGeometryProcessor.reset(gp); |
// Copy Stages from DS to ODS |
for (int i = firstColorStageIdx; i < drawState.numColorStages(); ++i) { |
@@ -138,7 +133,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; |
@@ -161,7 +156,7 @@ void GrOptDrawState::setOutputStateInfo(const GrDrawState& ds, |
// Determine whether we should use dual source blending or shader code to keep coverage |
// separate from color. |
bool keepCoverageSeparate = !(optFlags & GrXferProcessor::kSetCoverageDrawing_OptFlag); |
- if (keepCoverageSeparate && !ds.hasSolidCoverage(coverage)) { |
+ if (keepCoverageSeparate && !ds.hasSolidCoverage(fGeometryProcessor.get(), coverage)) { |
if (caps.dualSourceBlendingSupport()) { |
if (kZero_GrBlendCoeff == fDstBlend) { |
// write the coverage value to second color |