diff options
author | cdalton <cdalton@nvidia.com> | 2016-05-10 14:23:01 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-10 14:23:01 -0700 |
commit | 12dbb3947e1aaf205b4fcf13b40e54e50650eb37 (patch) | |
tree | b5f94e96f154882abce1ba1793e2ad45b8fef8d9 /tests | |
parent | 554784cd85029c05d9ed04b1aeb71520d196153a (diff) |
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
Diffstat (limited to 'tests')
-rw-r--r-- | tests/GLProgramsTest.cpp | 36 |
1 files changed, 20 insertions, 16 deletions
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); } } |