diff options
author | Brian Salomon <bsalomon@google.com> | 2017-04-03 10:38:00 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-04-03 15:13:48 +0000 |
commit | d3ccb0a37f0e62c84fdcd6a77b7b15476b04db7a (patch) | |
tree | a050c5624e60eee8193f4aa015269ad3bf14e329 /tests | |
parent | dffe9827b18444d1426859d9035f9f0087201f44 (diff) |
Move pipeline handling out of GrMeshDrawOp.
The monolithic GrPipeline is moved to a subclass GrLegacyDrawMeshOp.
The pipeline used to record a GrMesh draw in a GrMeshDrawOp must now be passed rather than implicitly using the op's pipeline.
Change-Id: I50d77e4dcc8d91a523fa7566ce43a9a291174706
Reviewed-on: https://skia-review.googlesource.com/11002
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/GLProgramsTest.cpp | 10 | ||||
-rw-r--r-- | tests/PreFlushCallbackTest.cpp | 11 | ||||
-rw-r--r-- | tests/PrimitiveProcessorTest.cpp | 18 | ||||
-rw-r--r-- | tests/ProcessorTest.cpp | 10 |
4 files changed, 24 insertions, 25 deletions
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index 125f5d064c..489aec1391 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -323,7 +323,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) { GrPaint grPaint; - std::unique_ptr<GrMeshDrawOp> op(GrRandomDrawOp(&random, context)); + std::unique_ptr<GrLegacyMeshDrawOp> op(GrRandomDrawOp(&random, context)); SkASSERT(op); GrProcessorTestData ptd(&random, context, renderTargetContext.get(), dummyTextures); @@ -336,8 +336,8 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) { static constexpr GrAAType kAATypes[] = {GrAAType::kNone, GrAAType::kCoverage}; GrAAType aaType = kAATypes[random.nextULessThan(SK_ARRAY_COUNT(kAATypes))]; - renderTargetContext->priv().testingOnly_addMeshDrawOp(std::move(grPaint), aaType, - std::move(op), uss, snapToCenters); + renderTargetContext->priv().testingOnly_addLegacyMeshDrawOp( + std::move(grPaint), aaType, std::move(op), uss, snapToCenters); } // Flush everything, test passes if flush is successful(ie, no asserts are hit, no crashes) drawingManager->flush(nullptr); @@ -358,7 +358,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) { for (int i = 0; i < fpFactoryCnt; ++i) { // Since FP factories internally randomize, call each 10 times. for (int j = 0; j < 10; ++j) { - std::unique_ptr<GrMeshDrawOp> op(GrRandomDrawOp(&random, context)); + std::unique_ptr<GrLegacyMeshDrawOp> op(GrRandomDrawOp(&random, context)); SkASSERT(op); GrProcessorTestData ptd(&random, context, renderTargetContext.get(), dummyTextures); GrPaint grPaint; @@ -370,7 +370,7 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages) { BlockInputFragmentProcessor::Make(std::move(fp))); grPaint.addColorFragmentProcessor(std::move(blockFP)); - renderTargetContext->priv().testingOnly_addMeshDrawOp( + renderTargetContext->priv().testingOnly_addLegacyMeshDrawOp( std::move(grPaint), GrAAType::kNone, std::move(op)); drawingManager->flush(nullptr); } diff --git a/tests/PreFlushCallbackTest.cpp b/tests/PreFlushCallbackTest.cpp index e5acae9e42..7be01fb709 100644 --- a/tests/PreFlushCallbackTest.cpp +++ b/tests/PreFlushCallbackTest.cpp @@ -21,7 +21,7 @@ // This is a simplified mesh drawing op that can be used in the atlas generation test. // Please see AtlasedRectOp below. -class NonAARectOp : public GrMeshDrawOp { +class NonAARectOp : public GrLegacyMeshDrawOp { public: DEFINE_OP_CLASS_ID const char* name() const override { return "NonAARectOp"; } @@ -150,10 +150,10 @@ private: firstVertex, firstIndex, 4, 6); - target->draw(gp.get(), mesh); + target->draw(gp.get(), this->pipeline(), mesh); } - typedef GrMeshDrawOp INHERITED; + typedef GrLegacyMeshDrawOp INHERITED; }; #ifdef SK_DEBUG @@ -444,9 +444,8 @@ static sk_sp<GrTextureProxy> make_upstream_image(GrContext* context, AtlasObject AtlasedRectOp* sparePtr = op.get(); - uint32_t opListID = rtc->priv().testingOnly_addMeshDrawOp(std::move(paint), - GrAAType::kNone, - std::move(op)); + uint32_t opListID = rtc->priv().testingOnly_addLegacyMeshDrawOp( + std::move(paint), GrAAType::kNone, std::move(op)); object->addOp(opListID, sparePtr); } diff --git a/tests/PrimitiveProcessorTest.cpp b/tests/PrimitiveProcessorTest.cpp index 337c8b93cf..4e4edb7e35 100644 --- a/tests/PrimitiveProcessorTest.cpp +++ b/tests/PrimitiveProcessorTest.cpp @@ -25,14 +25,14 @@ #include "ops/GrMeshDrawOp.h" namespace { -class Op : public GrMeshDrawOp { +class Op : public GrLegacyMeshDrawOp { public: DEFINE_OP_CLASS_ID const char* name() const override { return "Dummy Op"; } - static std::unique_ptr<GrMeshDrawOp> Make(int numAttribs) { - return std::unique_ptr<GrMeshDrawOp>(new Op(numAttribs)); + static std::unique_ptr<GrLegacyMeshDrawOp> Make(int numAttribs) { + return std::unique_ptr<GrLegacyMeshDrawOp>(new Op(numAttribs)); } private: @@ -93,12 +93,12 @@ private: size_t vertexStride = gp->getVertexStride(); SkPoint* vertices = reinterpret_cast<SkPoint*>(helper.init(target, vertexStride, 1)); vertices->setRectFan(0.f, 0.f, 1.f, 1.f, vertexStride); - helper.recordDraw(target, gp.get()); + helper.recordDraw(target, gp.get(), this->pipeline()); } int fNumAttribs; - typedef GrMeshDrawOp INHERITED; + typedef GrLegacyMeshDrawOp INHERITED; }; } @@ -126,16 +126,16 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(VertexAttributeCount, reporter, ctxInfo) { #endif GrPaint grPaint; // This one should succeed. - renderTargetContext->priv().testingOnly_addMeshDrawOp(GrPaint(grPaint), GrAAType::kNone, - Op::Make(attribCnt)); + renderTargetContext->priv().testingOnly_addLegacyMeshDrawOp(GrPaint(grPaint), GrAAType::kNone, + Op::Make(attribCnt)); context->flush(); #if GR_GPU_STATS REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 1); REPORTER_ASSERT(reporter, context->getGpu()->stats()->numFailedDraws() == 0); #endif context->resetGpuStats(); - renderTargetContext->priv().testingOnly_addMeshDrawOp(std::move(grPaint), GrAAType::kNone, - Op::Make(attribCnt + 1)); + renderTargetContext->priv().testingOnly_addLegacyMeshDrawOp(std::move(grPaint), GrAAType::kNone, + Op::Make(attribCnt + 1)); context->flush(); #if GR_GPU_STATS REPORTER_ASSERT(reporter, context->getGpu()->stats()->numDraws() == 0); diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp index 140ff15cfd..241c0fa4e3 100644 --- a/tests/ProcessorTest.cpp +++ b/tests/ProcessorTest.cpp @@ -28,8 +28,8 @@ public: DEFINE_OP_CLASS_ID const char* name() const override { return "TestOp"; } - static std::unique_ptr<GrMeshDrawOp> Make() { - return std::unique_ptr<GrMeshDrawOp>(new TestOp); + static std::unique_ptr<GrLegacyMeshDrawOp> Make() { + return std::unique_ptr<GrLegacyMeshDrawOp>(new TestOp); } private: @@ -170,7 +170,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) { images.emplace_back(texture3, GrIOType::kWrite_GrIOType); images.emplace_back(texture4, GrIOType::kRW_GrIOType); } - std::unique_ptr<GrMeshDrawOp> op(TestOp::Make()); + std::unique_ptr<GrLegacyMeshDrawOp> op(TestOp::Make()); GrPaint paint; auto fp = TestFP::Make(context, std::move(proxies), std::move(buffers), std::move(images)); @@ -178,7 +178,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) { fp = TestFP::Make(std::move(fp)); } paint.addColorFragmentProcessor(std::move(fp)); - renderTargetContext->priv().testingOnly_addMeshDrawOp( + renderTargetContext->priv().testingOnly_addLegacyMeshDrawOp( std::move(paint), GrAAType::kNone, std::move(op)); } int refCnt, readCnt, writeCnt; @@ -270,7 +270,7 @@ void test_draw_op(GrRenderTargetContext* rtc, sk_sp<GrFragmentProcessor> fp, auto op = GrNonAAFillRectOp::Make(GrColor_WHITE, SkMatrix::I(), SkRect::MakeWH(rtc->width(), rtc->height()), nullptr, nullptr); - rtc->addMeshDrawOp(pb, GrNoClip(), std::move(op)); + rtc->addLegacyMeshDrawOp(pb, GrNoClip(), std::move(op)); } #include "SkCommandLineFlags.h" |