aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrGpuCommandBuffer.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2018-06-26 09:12:38 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-06-26 15:35:12 +0000
commit493489054f85d1b7725412ad7a3cdc70c7ec5466 (patch)
tree45223f5039eefd3aba721d737cb70549baaa8d0d /src/gpu/GrGpuCommandBuffer.cpp
parentd5506cb888858bd19fa54be50714a8d661cedf33 (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/GrGpuCommandBuffer.cpp')
-rw-r--r--src/gpu/GrGpuCommandBuffer.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/gpu/GrGpuCommandBuffer.cpp b/src/gpu/GrGpuCommandBuffer.cpp
index 617ed75ae7..42e00f355f 100644
--- a/src/gpu/GrGpuCommandBuffer.cpp
+++ b/src/gpu/GrGpuCommandBuffer.cpp
@@ -26,12 +26,10 @@ void GrGpuRTCommandBuffer::clearStencilClip(const GrFixedClip& clip, bool inside
this->onClearStencilClip(clip, insideStencilMask);
}
-bool GrGpuRTCommandBuffer::draw(const GrPrimitiveProcessor& primProc,
- const GrPipeline& pipeline,
- const GrMesh meshes[],
- const GrPipeline::DynamicState dynamicStates[],
- int meshCount,
- const SkRect& bounds) {
+bool GrGpuRTCommandBuffer::draw(const GrPrimitiveProcessor& primProc, const GrPipeline& pipeline,
+ const GrPipeline::FixedDynamicState* fixedDynamicState,
+ const GrPipeline::DynamicStateArrays* dynamicStateArrays,
+ const GrMesh meshes[], int meshCount, const SkRect& bounds) {
#ifdef SK_DEBUG
SkASSERT(!primProc.hasInstanceAttributes() || this->gpu()->caps()->instanceAttribSupport());
for (int i = 0; i < meshCount; ++i) {
@@ -41,6 +39,9 @@ bool GrGpuRTCommandBuffer::draw(const GrPrimitiveProcessor& primProc,
SkASSERT(primProc.hasInstanceAttributes() == meshes[i].isInstanced());
}
#endif
+ SkASSERT(!pipeline.isScissorEnabled() || fixedDynamicState ||
+ (dynamicStateArrays && dynamicStateArrays->fScissorRects));
+
auto resourceProvider = this->gpu()->getContext()->contextPriv().resourceProvider();
if (pipeline.isBad() || !primProc.instantiate(resourceProvider)) {
@@ -51,6 +52,7 @@ bool GrGpuRTCommandBuffer::draw(const GrPrimitiveProcessor& primProc,
this->gpu()->stats()->incNumFailedDraws();
return false;
}
- this->onDraw(primProc, pipeline, meshes, dynamicStates, meshCount, bounds);
+ this->onDraw(primProc, pipeline, fixedDynamicState, dynamicStateArrays, meshes, meshCount,
+ bounds);
return true;
}