diff options
author | Brian Salomon <bsalomon@google.com> | 2018-07-02 09:00:27 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-02 13:46:30 +0000 |
commit | a219419c9d76432dca74494b611ff1f59086d139 (patch) | |
tree | e6e5d964b27c4d4656ed1e912700796ad1fff441 /tests | |
parent | 00d2e8ebcb13c388339ff1cfbd202fff9589e77a (diff) |
Some scissor state cleanup.
Separate flushing the enablement of scissor from the rect in GrGLGpu.
Move GrPipeline::ScissorState to a global enum and use more broadly.
Rename to GrScissorTest to avoid name conflict with existing
GrScissorState.
Change-Id: Ib32160b3300bc12de2d2e1761d152fd1bba8b683
Reviewed-on: https://skia-review.googlesource.com/137395
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/GLProgramsTest.cpp | 3 | ||||
-rw-r--r-- | tests/GrMeshTest.cpp | 2 | ||||
-rw-r--r-- | tests/GrPipelineDynamicStateTest.cpp | 24 |
3 files changed, 11 insertions, 18 deletions
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index 359527fce5..06b8f71080 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -292,9 +292,6 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages, int ma return false; } - // dummy scissor state - GrScissorState scissor; - SkRandom random; static const int NUM_TESTS = 1024; for (int t = 0; t < NUM_TESTS; t++) { diff --git a/tests/GrMeshTest.cpp b/tests/GrMeshTest.cpp index aa951c0364..e8c124d950 100644 --- a/tests/GrMeshTest.cpp +++ b/tests/GrMeshTest.cpp @@ -392,7 +392,7 @@ sk_sp<const GrBuffer> DrawMeshHelper::getIndexBuffer() { void DrawMeshHelper::drawMesh(const GrMesh& mesh) { GrRenderTargetProxy* proxy = fState->drawOpArgs().fProxy; - GrPipeline pipeline(proxy, GrPipeline::ScissorState::kDisabled, SkBlendMode::kSrc); + GrPipeline pipeline(proxy, GrScissorTest::kDisabled, SkBlendMode::kSrc); GrMeshTestProcessor mtp(mesh.isInstanced(), mesh.hasVertexData()); fState->rtCommandBuffer()->draw(mtp, pipeline, nullptr, nullptr, &mesh, 1, SkRect::MakeIWH(kImageWidth, kImageHeight)); diff --git a/tests/GrPipelineDynamicStateTest.cpp b/tests/GrPipelineDynamicStateTest.cpp index b2aaecc48b..ad631899b9 100644 --- a/tests/GrPipelineDynamicStateTest.cpp +++ b/tests/GrPipelineDynamicStateTest.cpp @@ -28,8 +28,6 @@ * scissor rectangles then reads back the result to verify a successful test. */ -using ScissorState = GrPipeline::ScissorState; - static constexpr int kScreenSize = 6; static constexpr int kNumMeshes = 4; static constexpr int kScreenSplitX = kScreenSize/2; @@ -113,20 +111,18 @@ public: DEFINE_OP_CLASS_ID static std::unique_ptr<GrDrawOp> Make(GrContext* context, - ScissorState scissorState, + GrScissorTest scissorTest, sk_sp<const GrBuffer> vbuff) { GrOpMemoryPool* pool = context->contextPriv().opMemoryPool(); - return pool->allocate<GrPipelineDynamicStateTestOp>(scissorState, std::move(vbuff)); + return pool->allocate<GrPipelineDynamicStateTestOp>(scissorTest, std::move(vbuff)); } private: friend class GrOpMemoryPool; - GrPipelineDynamicStateTestOp(ScissorState scissorState, sk_sp<const GrBuffer> vbuff) - : INHERITED(ClassID()) - , fScissorState(scissorState) - , fVertexBuffer(std::move(vbuff)) { + GrPipelineDynamicStateTestOp(GrScissorTest scissorTest, sk_sp<const GrBuffer> vbuff) + : INHERITED(ClassID()), fScissorTest(scissorTest), fVertexBuffer(std::move(vbuff)) { this->setBounds(SkRect::MakeIWH(kScreenSize, kScreenSize), HasAABloat::kNo, IsZeroArea::kNo); } @@ -141,7 +137,7 @@ private: void onPrepare(GrOpFlushState*) override {} void onExecute(GrOpFlushState* state) override { GrRenderTargetProxy* proxy = state->drawOpArgs().fProxy; - GrPipeline pipeline(proxy, fScissorState, SkBlendMode::kSrc); + GrPipeline pipeline(proxy, fScissorTest, SkBlendMode::kSrc); SkSTArray<kNumMeshes, GrMesh> meshes; for (int i = 0; i < kNumMeshes; ++i) { GrMesh& mesh = meshes.emplace_back(GrPrimitiveType::kTriangleStrip); @@ -155,7 +151,7 @@ private: SkRect::MakeIWH(kScreenSize, kScreenSize)); } - ScissorState fScissorState; + GrScissorTest fScissorTest; const sk_sp<const GrBuffer> fVertexBuffer; typedef GrDrawOp INHERITED; @@ -208,17 +204,17 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrPipelineDynamicStateTest, reporter, ctxInfo uint32_t resultPx[kScreenSize * kScreenSize]; - for (ScissorState scissorState : {ScissorState::kEnabled, ScissorState::kDisabled}) { + for (GrScissorTest scissorTest : {GrScissorTest::kEnabled, GrScissorTest::kDisabled}) { rtc->clear(nullptr, 0xbaaaaaad, GrRenderTargetContext::CanClearFullscreen::kYes); rtc->priv().testingOnly_addDrawOp( - GrPipelineDynamicStateTestOp::Make(context, scissorState, vbuff)); + GrPipelineDynamicStateTestOp::Make(context, scissorTest, vbuff)); rtc->readPixels(SkImageInfo::Make(kScreenSize, kScreenSize, kRGBA_8888_SkColorType, kPremul_SkAlphaType), resultPx, 4 * kScreenSize, 0, 0, 0); for (int y = 0; y < kScreenSize; ++y) { for (int x = 0; x < kScreenSize; ++x) { int expectedColorIdx; - if (ScissorState::kEnabled == scissorState) { + if (scissorTest == GrScissorTest::kEnabled) { expectedColorIdx = (x < kScreenSplitX ? 0 : 2) + (y < kScreenSplitY ? 0 : 1); } else { expectedColorIdx = kNumMeshes - 1; @@ -227,7 +223,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrPipelineDynamicStateTest, reporter, ctxInfo uint32_t actual = resultPx[y * kScreenSize + x]; if (expected != actual) { ERRORF(reporter, "[scissor=%s] pixel (%i,%i): got 0x%x expected 0x%x", - ScissorState::kEnabled == scissorState ? "enabled" : "disabled", x, y, + scissorTest == GrScissorTest::kEnabled ? "enabled" : "disabled", x, y, actual, expected); return; } |