aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
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 /tests
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 'tests')
-rw-r--r--tests/GrMeshTest.cpp2
-rw-r--r--tests/GrPipelineDynamicStateTest.cpp16
-rw-r--r--tests/OnFlushCallbackTest.cpp3
-rw-r--r--tests/PrimitiveProcessorTest.cpp6
4 files changed, 15 insertions, 12 deletions
diff --git a/tests/GrMeshTest.cpp b/tests/GrMeshTest.cpp
index af6633fce7..aa951c0364 100644
--- a/tests/GrMeshTest.cpp
+++ b/tests/GrMeshTest.cpp
@@ -394,7 +394,7 @@ void DrawMeshHelper::drawMesh(const GrMesh& mesh) {
GrRenderTargetProxy* proxy = fState->drawOpArgs().fProxy;
GrPipeline pipeline(proxy, GrPipeline::ScissorState::kDisabled, SkBlendMode::kSrc);
GrMeshTestProcessor mtp(mesh.isInstanced(), mesh.hasVertexData());
- fState->rtCommandBuffer()->draw(mtp, pipeline, &mesh, nullptr, 1,
+ fState->rtCommandBuffer()->draw(mtp, pipeline, nullptr, nullptr, &mesh, 1,
SkRect::MakeIWH(kImageWidth, kImageHeight));
}
diff --git a/tests/GrPipelineDynamicStateTest.cpp b/tests/GrPipelineDynamicStateTest.cpp
index b8e893be6e..b2aaecc48b 100644
--- a/tests/GrPipelineDynamicStateTest.cpp
+++ b/tests/GrPipelineDynamicStateTest.cpp
@@ -35,11 +35,11 @@ static constexpr int kNumMeshes = 4;
static constexpr int kScreenSplitX = kScreenSize/2;
static constexpr int kScreenSplitY = kScreenSize/2;
-static const GrPipeline::DynamicState kDynamicStates[kNumMeshes] = {
- {SkIRect::MakeLTRB(0, 0, kScreenSplitX, kScreenSplitY)},
- {SkIRect::MakeLTRB(0, kScreenSplitY, kScreenSplitX, kScreenSize)},
- {SkIRect::MakeLTRB(kScreenSplitX, 0, kScreenSize, kScreenSplitY)},
- {SkIRect::MakeLTRB(kScreenSplitX, kScreenSplitY, kScreenSize, kScreenSize)},
+static const SkIRect kDynamicScissors[kNumMeshes] = {
+ SkIRect::MakeLTRB(0, 0, kScreenSplitX, kScreenSplitY),
+ SkIRect::MakeLTRB(0, kScreenSplitY, kScreenSplitX, kScreenSize),
+ SkIRect::MakeLTRB(kScreenSplitX, 0, kScreenSize, kScreenSplitY),
+ SkIRect::MakeLTRB(kScreenSplitX, kScreenSplitY, kScreenSize, kScreenSize),
};
static const GrColor kMeshColors[kNumMeshes] {
@@ -148,8 +148,10 @@ private:
mesh.setNonIndexedNonInstanced(4);
mesh.setVertexData(fVertexBuffer.get(), 4 * i);
}
- state->rtCommandBuffer()->draw(GrPipelineDynamicStateTestProcessor(), pipeline,
- meshes.begin(), kDynamicStates, 4,
+ GrPipeline::DynamicStateArrays dynamicState;
+ dynamicState.fScissorRects = kDynamicScissors;
+ state->rtCommandBuffer()->draw(GrPipelineDynamicStateTestProcessor(), pipeline, nullptr,
+ &dynamicState, meshes.begin(), 4,
SkRect::MakeIWH(kScreenSize, kScreenSize));
}
diff --git a/tests/OnFlushCallbackTest.cpp b/tests/OnFlushCallbackTest.cpp
index a8752057c8..c60ae7c7da 100644
--- a/tests/OnFlushCallbackTest.cpp
+++ b/tests/OnFlushCallbackTest.cpp
@@ -163,7 +163,8 @@ private:
mesh.setIndexed(indexBuffer, 6, firstIndex, 0, 3, GrPrimitiveRestart::kNo);
mesh.setVertexData(vertexBuffer, firstVertex);
- target->draw(gp.get(), fHelper.makePipeline(target), mesh);
+ auto pipe = fHelper.makePipeline(target);
+ target->draw(gp.get(), pipe.fPipeline, pipe.fFixedDynamicState, mesh);
}
Helper fHelper;
diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp
index 60b2205cf7..e9fbfd101a 100644
--- a/tests/PrimitiveProcessorTest.cpp
+++ b/tests/PrimitiveProcessorTest.cpp
@@ -111,9 +111,9 @@ private:
SkASSERT(vertexStride == gp->debugOnly_vertexStride());
SkPoint* vertices = reinterpret_cast<SkPoint*>(helper.init(target, vertexStride, 1));
SkPointPriv::SetRectTriStrip(vertices, 0.f, 0.f, 1.f, 1.f, vertexStride);
- helper.recordDraw(target, gp.get(),
- target->makePipeline(0, GrProcessorSet::MakeEmptySet(),
- target->detachAppliedClip()));
+ auto pipe = target->makePipeline(0, GrProcessorSet::MakeEmptySet(),
+ target->detachAppliedClip());
+ helper.recordDraw(target, gp.get(), pipe.fPipeline, pipe.fFixedDynamicState);
}
int fNumAttribs;