Chromium Code Reviews| Index: src/gpu/GrInOrderDrawBuffer.cpp |
| diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp |
| index cae1bd5c9ec3bebeb07cfd107e24222c4ff2e9bf..77ce88a26b86640d09375b58d8aeeb76694f2223 100644 |
| --- a/src/gpu/GrInOrderDrawBuffer.cpp |
| +++ b/src/gpu/GrInOrderDrawBuffer.cpp |
| @@ -251,7 +251,8 @@ void GrInOrderDrawBuffer::onDraw(const GrPipelineBuilder& pipelineBuilder, |
| SkASSERT(info.vertexBuffer() && (!info.isIndexed() || info.indexBuffer())); |
| this->closeBatch(); |
| - if (!this->recordStateAndShouldDraw(pipelineBuilder, gp, scissorState, info.getDevBounds())) { |
| + if (!this->recordStateAndSetupPipeline(gp, pipelineBuilder, scissorState, |
| + info.getDevBounds())) { |
| return; |
| } |
| @@ -274,7 +275,7 @@ void GrInOrderDrawBuffer::onDrawBatch(GrBatch* batch, |
| const GrPipelineBuilder& pipelineBuilder, |
| const GrScissorState& scissorState, |
| const SkRect* devBounds) { |
| - if (!this->recordStateAndShouldDraw(batch, pipelineBuilder, scissorState, devBounds)) { |
| + if (!this->recordStateAndSetupPipeline(batch, pipelineBuilder, scissorState, devBounds)) { |
| return; |
| } |
| @@ -319,7 +320,7 @@ void GrInOrderDrawBuffer::onDrawPath(const GrPipelineBuilder& pipelineBuilder, |
| this->closeBatch(); |
| // TODO: Only compare the subset of GrPipelineBuilder relevant to path covering? |
| - if (!this->recordStateAndShouldDraw(pipelineBuilder, pathProc, scissorState, devBounds)) { |
| + if (!this->recordStateAndSetupPipeline(pathProc, pipelineBuilder, scissorState, devBounds)) { |
| return; |
| } |
| DrawPath* dp = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, DrawPath, (path)); |
| @@ -343,7 +344,7 @@ void GrInOrderDrawBuffer::onDrawPaths(const GrPipelineBuilder& pipelineBuilder, |
| SkASSERT(transformValues); |
| this->closeBatch(); |
| - if (!this->recordStateAndShouldDraw(pipelineBuilder, pathProc, scissorState, devBounds)) { |
| + if (!this->recordStateAndSetupPipeline(pathProc, pipelineBuilder, scissorState, devBounds)) { |
| return; |
| } |
| @@ -584,17 +585,21 @@ bool GrInOrderDrawBuffer::onCopySurface(GrSurface* dst, |
| return false; |
| } |
| -bool GrInOrderDrawBuffer::recordStateAndShouldDraw(const GrPipelineBuilder& pipelineBuilder, |
| - const GrPrimitiveProcessor* primProc, |
| - const GrScissorState& scissor, |
| - const SkRect* devBounds) { |
| +bool GrInOrderDrawBuffer::recordStateAndSetupPipeline(const GrPrimitiveProcessor* primProc, |
| + const GrPipelineBuilder& pipelineBuilder, |
| + const GrScissorState& scissor, |
| + const SkRect* devBounds) { |
| + const GrProcOptInfo& colorPOI = pipelineBuilder.colorProcInfo(primProc); |
| + const GrProcOptInfo& coveragePOI = pipelineBuilder.coverageProcInfo(primProc); |
| + |
| GrDeviceCoordTexture dstCopy; |
| - if (!this->setupDstReadIfNecessary(pipelineBuilder, &dstCopy, devBounds)) { |
| + if (!this->setupDstReadIfNecessary(pipelineBuilder, colorPOI, coveragePOI, |
| + &dstCopy, devBounds)) { |
| return false; |
| } |
| SetState* ss = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, SetState, |
| - (pipelineBuilder, primProc, *this->getGpu()->caps(), |
| - scissor, &dstCopy)); |
| + (pipelineBuilder, colorPOI, coveragePOI, |
| + *this->getGpu()->caps(), scissor, &dstCopy, primProc)); |
| if (ss->fPipeline.mustSkip()) { |
| fCmdBuffer.pop_back(); |
| return false; |
| @@ -616,20 +621,28 @@ bool GrInOrderDrawBuffer::recordStateAndShouldDraw(const GrPipelineBuilder& pipe |
| return true; |
| } |
| -bool GrInOrderDrawBuffer::recordStateAndShouldDraw(GrBatch* batch, |
| - const GrPipelineBuilder& pipelineBuilder, |
| - const GrScissorState& scissor, |
| - const SkRect* devBounds) { |
| +bool GrInOrderDrawBuffer::recordStateAndSetupPipeline(GrBatch* batch, |
| + const GrPipelineBuilder& pipelineBuilder, |
| + const GrScissorState& scissor, |
| + const SkRect* devBounds) { |
| + GrBatchOpt batchOpt; |
|
bsalomon
2015/02/11 15:38:03
seems weird that we're doing this here.
egdaniel
2015/02/11 16:48:08
So the reason we are doing this here is that we ne
bsalomon
2015/02/11 16:51:23
It seems to like everything from 628 to 643 should
|
| + batchOpt.fCanTweakAlphaForCoverage = pipelineBuilder.canTweakAlphaForCoverage(); |
| + batch->initBatchOpt(batchOpt); |
| + |
| + const GrProcOptInfo& colorPOI = pipelineBuilder.colorProcInfo(batch); |
| + const GrProcOptInfo& coveragePOI = pipelineBuilder.coverageProcInfo(batch); |
| + |
| GrDeviceCoordTexture dstCopy; |
| - if (!this->setupDstReadIfNecessary(pipelineBuilder, &dstCopy, devBounds)) { |
| + if (!this->setupDstReadIfNecessary(pipelineBuilder, colorPOI, coveragePOI, |
| + &dstCopy, devBounds)) { |
| return false; |
| } |
| // TODO this gets much simpler when we have batches everywhere. |
| // If the previous command is also a set state, then we check to see if it has a Batch. If so, |
| // and we can make the two batches equal, and we can combine the states, then we make them equal |
| SetState* ss = GrNEW_APPEND_TO_RECORDER(fCmdBuffer, SetState, |
| - (batch, pipelineBuilder, *this->getGpu()->caps(), scissor, |
| - &dstCopy)); |
| + (pipelineBuilder, colorPOI, coveragePOI, |
| + *this->getGpu()->caps(), scissor, &dstCopy)); |
| if (ss->fPipeline.mustSkip()) { |
| fCmdBuffer.pop_back(); |
| return false; |