From 12dbb3947e1aaf205b4fcf13b40e54e50650eb37 Mon Sep 17 00:00:00 2001 From: cdalton Date: Tue, 10 May 2016 14:23:01 -0700 Subject: Separate user and raw stencil settings Adds a new GrUserStencilSettings class that describes in abstract terms how a draw will use the stencil (e.g. kAlwaysIfInClip, kSetClipBit, etc.). GrPipelineBuilder now only defines the GrUserStencilSettings. When the GrPipeline is finalized, the user stencil settings are then translated into concrete GrStencilSettings. At this point, GrClipMaskManager only needs to tell the GrAppliedClip whether or not there is a stencil clip. It does not need to modify stencil settings and GrPipelineBuilder does not need AutoRestoreStencil. This is one step of the stencil overhaul. In the future it will also allow us to clean up the special case handling for nvpr and the stateful fClipMode member of GrClipMaskManager. BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1962243002 Review-Url: https://codereview.chromium.org/1962243002 --- tests/GLProgramsTest.cpp | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'tests') diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp index c5d61d87cb..3cbc76cab7 100644 --- a/tests/GLProgramsTest.cpp +++ b/tests/GLProgramsTest.cpp @@ -277,25 +277,29 @@ static void set_random_state(GrPipelineBuilder* pipelineBuilder, SkRandom* rando // right now, the only thing we seem to care about in drawState's stencil is 'doesWrite()' static void set_random_stencil(GrPipelineBuilder* pipelineBuilder, SkRandom* random) { - static constexpr GrStencilSettings kDoesWriteStencil( - kReplace_StencilOp, - kReplace_StencilOp, - kAlways_StencilFunc, - 0xffff, - 0xffff, - 0xffff); - static constexpr GrStencilSettings kDoesNotWriteStencil( - kKeep_StencilOp, - kKeep_StencilOp, - kNever_StencilFunc, - 0xffff, - 0xffff, - 0xffff); + static constexpr GrUserStencilSettings kDoesWriteStencil( + GrUserStencilSettings::StaticInit< + 0xffff, + GrUserStencilTest::kAlways, + 0xffff, + GrUserStencilOp::kReplace, + GrUserStencilOp::kReplace, + 0xffff>() + ); + static constexpr GrUserStencilSettings kDoesNotWriteStencil( + GrUserStencilSettings::StaticInit< + 0xffff, + GrUserStencilTest::kNever, + 0xffff, + GrUserStencilOp::kKeep, + GrUserStencilOp::kKeep, + 0xffff>() + ); if (random->nextBool()) { - pipelineBuilder->setStencil(kDoesWriteStencil); + pipelineBuilder->setUserStencil(&kDoesWriteStencil); } else { - pipelineBuilder->setStencil(kDoesNotWriteStencil); + pipelineBuilder->setUserStencil(&kDoesNotWriteStencil); } } -- cgit v1.2.3