From d818ebf4a31724aa93fd439a2ac4195f69ae3af0 Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Mon, 2 Jul 2018 14:08:49 +0000 Subject: Revert "Some scissor state cleanup." This reverts commit a219419c9d76432dca74494b611ff1f59086d139. Reason for revert: breaking things Original change's description: > 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 > Reviewed-by: Chris Dalton TBR=bsalomon@google.com,csmartdalton@google.com Change-Id: If71a5c5efc86d4239b40675bad2a6cb1f77460f8 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/138900 Reviewed-by: Brian Salomon Commit-Queue: Brian Salomon --- tests/GLProgramsTest.cpp | 3 +++ tests/GrMeshTest.cpp | 2 +- tests/GrPipelineDynamicStateTest.cpp | 24 ++++++++++++++---------- 3 files changed, 18 insertions(+), 11 deletions(-) (limited to 'tests') diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index 06b8f71080..359527fce5 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -292,6 +292,9 @@ 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 e8c124d950..aa951c0364 100644 --- a/tests/GrMeshTest.cpp +++ b/tests/GrMeshTest.cpp @@ -392,7 +392,7 @@ sk_sp DrawMeshHelper::getIndexBuffer() { void DrawMeshHelper::drawMesh(const GrMesh& mesh) { GrRenderTargetProxy* proxy = fState->drawOpArgs().fProxy; - GrPipeline pipeline(proxy, GrScissorTest::kDisabled, SkBlendMode::kSrc); + GrPipeline pipeline(proxy, GrPipeline::ScissorState::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 ad631899b9..b2aaecc48b 100644 --- a/tests/GrPipelineDynamicStateTest.cpp +++ b/tests/GrPipelineDynamicStateTest.cpp @@ -28,6 +28,8 @@ * 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; @@ -111,18 +113,20 @@ public: DEFINE_OP_CLASS_ID static std::unique_ptr Make(GrContext* context, - GrScissorTest scissorTest, + ScissorState scissorState, sk_sp vbuff) { GrOpMemoryPool* pool = context->contextPriv().opMemoryPool(); - return pool->allocate(scissorTest, std::move(vbuff)); + return pool->allocate(scissorState, std::move(vbuff)); } private: friend class GrOpMemoryPool; - GrPipelineDynamicStateTestOp(GrScissorTest scissorTest, sk_sp vbuff) - : INHERITED(ClassID()), fScissorTest(scissorTest), fVertexBuffer(std::move(vbuff)) { + GrPipelineDynamicStateTestOp(ScissorState scissorState, sk_sp vbuff) + : INHERITED(ClassID()) + , fScissorState(scissorState) + , fVertexBuffer(std::move(vbuff)) { this->setBounds(SkRect::MakeIWH(kScreenSize, kScreenSize), HasAABloat::kNo, IsZeroArea::kNo); } @@ -137,7 +141,7 @@ private: void onPrepare(GrOpFlushState*) override {} void onExecute(GrOpFlushState* state) override { GrRenderTargetProxy* proxy = state->drawOpArgs().fProxy; - GrPipeline pipeline(proxy, fScissorTest, SkBlendMode::kSrc); + GrPipeline pipeline(proxy, fScissorState, SkBlendMode::kSrc); SkSTArray meshes; for (int i = 0; i < kNumMeshes; ++i) { GrMesh& mesh = meshes.emplace_back(GrPrimitiveType::kTriangleStrip); @@ -151,7 +155,7 @@ private: SkRect::MakeIWH(kScreenSize, kScreenSize)); } - GrScissorTest fScissorTest; + ScissorState fScissorState; const sk_sp fVertexBuffer; typedef GrDrawOp INHERITED; @@ -204,17 +208,17 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(GrPipelineDynamicStateTest, reporter, ctxInfo uint32_t resultPx[kScreenSize * kScreenSize]; - for (GrScissorTest scissorTest : {GrScissorTest::kEnabled, GrScissorTest::kDisabled}) { + for (ScissorState scissorState : {ScissorState::kEnabled, ScissorState::kDisabled}) { rtc->clear(nullptr, 0xbaaaaaad, GrRenderTargetContext::CanClearFullscreen::kYes); rtc->priv().testingOnly_addDrawOp( - GrPipelineDynamicStateTestOp::Make(context, scissorTest, vbuff)); + GrPipelineDynamicStateTestOp::Make(context, scissorState, 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 (scissorTest == GrScissorTest::kEnabled) { + if (ScissorState::kEnabled == scissorState) { expectedColorIdx = (x < kScreenSplitX ? 0 : 2) + (y < kScreenSplitY ? 0 : 1); } else { expectedColorIdx = kNumMeshes - 1; @@ -223,7 +227,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", - scissorTest == GrScissorTest::kEnabled ? "enabled" : "disabled", x, y, + ScissorState::kEnabled == scissorState ? "enabled" : "disabled", x, y, actual, expected); return; } -- cgit v1.2.3