diff options
author | 2018-06-26 09:12:38 -0400 | |
---|---|---|
committer | 2018-06-26 15:35:12 +0000 | |
commit | 493489054f85d1b7725412ad7a3cdc70c7ec5466 (patch) | |
tree | 45223f5039eefd3aba721d737cb70549baaa8d0d /src/gpu/ccpr/GrCCPathParser.cpp | |
parent | d5506cb888858bd19fa54be50714a8d661cedf33 (diff) |
Refactor GrPipeline dynamic state.
Remove scissor rect from GrPipeline.
Draws can specify "fixed dynamic state" which doesn't use the dynamism at
all or can specify dynamic state arrays with an entry per GrMesh.
When we state other than scissor rects this will allow the caller to
use a mix of truly dynamic and fixed dynamic state. So a caller that
only has dynamic scissor rects doesn't need to store its remaining
unvarying state in an array.
Change-Id: I8fcc07eb600c72a26cc712b185755c2116021a8a
Reviewed-on: https://skia-review.googlesource.com/137223
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/ccpr/GrCCPathParser.cpp')
-rw-r--r-- | src/gpu/ccpr/GrCCPathParser.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/gpu/ccpr/GrCCPathParser.cpp b/src/gpu/ccpr/GrCCPathParser.cpp index 6f9b2240d7..1935385eeb 100644 --- a/src/gpu/ccpr/GrCCPathParser.cpp +++ b/src/gpu/ccpr/GrCCPathParser.cpp @@ -517,7 +517,7 @@ bool GrCCPathParser::finalize(GrOnFlushResourceProvider* onFlushRP) { SkASSERT(instanceIndices[1].fConics == quadEndIdx); fMeshesScratchBuffer.reserve(fMaxMeshesPerDraw); - fDynamicStatesScratchBuffer.reserve(fMaxMeshesPerDraw); + fScissorRectScratchBuffer.reserve(fMaxMeshesPerDraw); return true; } @@ -564,11 +564,11 @@ void GrCCPathParser::drawPrimitives(GrOpFlushState* flushState, const GrPipeline GrCCCoverageProcessor::PrimitiveType primitiveType, int PrimitiveTallies::*instanceType, const SkIRect& drawBounds) const { - SkASSERT(pipeline.getScissorState().enabled()); + SkASSERT(pipeline.isScissorEnabled()); // Don't call reset(), as that also resets the reserve count. fMeshesScratchBuffer.pop_back_n(fMeshesScratchBuffer.count()); - fDynamicStatesScratchBuffer.pop_back_n(fDynamicStatesScratchBuffer.count()); + fScissorRectScratchBuffer.pop_back_n(fScissorRectScratchBuffer.count()); GrCCCoverageProcessor proc(flushState->resourceProvider(), primitiveType); @@ -584,8 +584,8 @@ void GrCCPathParser::drawPrimitives(GrOpFlushState* flushState, const GrPipeline int baseInstance = fBaseInstances[(int)ScissorMode::kNonScissored].*instanceType + previousBatch.fEndNonScissorIndices.*instanceType; proc.appendMesh(fInstanceBuffer.get(), instanceCount, baseInstance, &fMeshesScratchBuffer); - fDynamicStatesScratchBuffer.push_back().fScissorRect.setXYWH(0, 0, drawBounds.width(), - drawBounds.height()); + fScissorRectScratchBuffer.push_back().setXYWH(0, 0, drawBounds.width(), + drawBounds.height()); SkDEBUGCODE(totalInstanceCount += instanceCount); } @@ -603,17 +603,17 @@ void GrCCPathParser::drawPrimitives(GrOpFlushState* flushState, const GrPipeline SkASSERT(instanceCount > 0); proc.appendMesh(fInstanceBuffer.get(), instanceCount, baseScissorInstance + startIndex, &fMeshesScratchBuffer); - fDynamicStatesScratchBuffer.push_back().fScissorRect = scissorSubBatch.fScissor; + fScissorRectScratchBuffer.push_back() = scissorSubBatch.fScissor; SkDEBUGCODE(totalInstanceCount += instanceCount); } - SkASSERT(fMeshesScratchBuffer.count() == fDynamicStatesScratchBuffer.count()); + SkASSERT(fMeshesScratchBuffer.count() == fScissorRectScratchBuffer.count()); SkASSERT(fMeshesScratchBuffer.count() <= fMaxMeshesPerDraw); SkASSERT(totalInstanceCount == batch.fTotalPrimitiveCounts.*instanceType); if (!fMeshesScratchBuffer.empty()) { - proc.draw(flushState, pipeline, fMeshesScratchBuffer.begin(), - fDynamicStatesScratchBuffer.begin(), fMeshesScratchBuffer.count(), + proc.draw(flushState, pipeline, fScissorRectScratchBuffer.begin(), + fMeshesScratchBuffer.begin(), fMeshesScratchBuffer.count(), SkRect::Make(drawBounds)); } } |