diff options
author | 2016-05-10 14:23:01 -0700 | |
---|---|---|
committer | 2016-05-10 14:23:01 -0700 | |
commit | 12dbb3947e1aaf205b4fcf13b40e54e50650eb37 (patch) | |
tree | b5f94e96f154882abce1ba1793e2ad45b8fef8d9 /src/gpu/GrDrawContext.cpp | |
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 'src/gpu/GrDrawContext.cpp')
-rw-r--r-- | src/gpu/GrDrawContext.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp index a7c7f6ae5f..7f5cdc78ed 100644 --- a/src/gpu/GrDrawContext.cpp +++ b/src/gpu/GrDrawContext.cpp @@ -375,7 +375,7 @@ void GrDrawContext::drawRect(const GrClip& clip, } bool GrDrawContextPriv::drawAndStencilRect(const SkIRect* scissorRect, - const GrStencilSettings& ss, + const GrUserStencilSettings* ss, SkRegion::Op op, bool invert, bool doAA, @@ -397,7 +397,7 @@ bool GrDrawContextPriv::drawAndStencilRect(const SkIRect* scissorRect, GrPipelineBuilder pipelineBuilder(paint, fDrawContext->accessRenderTarget(), GrClip::WideOpen()); - pipelineBuilder.setStencil(ss); + pipelineBuilder.setUserStencil(ss); fDrawContext->getDrawTarget()->drawBatch(pipelineBuilder, batch, scissorRect); return true; @@ -855,7 +855,7 @@ void GrDrawContext::drawPath(const GrClip& clip, } bool GrDrawContextPriv::drawAndStencilPath(const SkIRect* scissorRect, - const GrStencilSettings& ss, + const GrUserStencilSettings* ss, SkRegion::Op op, bool invert, bool doAA, @@ -880,7 +880,7 @@ bool GrDrawContextPriv::drawAndStencilPath(const SkIRect* scissorRect, // aa. If we have some future driver-mojo path AA that can do the right // thing WRT to the blend then we'll need some query on the PR. bool useCoverageAA = doAA && !fDrawContext->fRenderTarget->isUnifiedMultisampled(); - bool isStencilDisabled = true; + bool hasUserStencilSettings = (&GrUserStencilSettings::kUnused != ss); bool isStencilBufferMSAA = fDrawContext->fRenderTarget->isStencilBufferMultisampled(); const GrPathRendererChain::DrawType type = @@ -893,7 +893,7 @@ bool GrDrawContextPriv::drawAndStencilPath(const SkIRect* scissorRect, canDrawArgs.fPath = &path; canDrawArgs.fStyle = &GrStyle::SimpleFill(); canDrawArgs.fAntiAlias = useCoverageAA; - canDrawArgs.fIsStencilDisabled = isStencilDisabled; + canDrawArgs.fHasUserStencilSettings = hasUserStencilSettings; canDrawArgs.fIsStencilBufferMSAA = isStencilBufferMSAA; // Don't allow the SW renderer @@ -913,7 +913,7 @@ bool GrDrawContextPriv::drawAndStencilPath(const SkIRect* scissorRect, } GrPipelineBuilder pipelineBuilder(paint, fDrawContext->accessRenderTarget(), clip); - pipelineBuilder.setStencil(ss); + pipelineBuilder.setUserStencil(ss); GrPathRenderer::DrawPathArgs args; args.fTarget = fDrawContext->getDrawTarget(); @@ -939,7 +939,7 @@ void GrDrawContext::internalDrawPath(const GrClip& clip, SkASSERT(!origPath.isEmpty()); bool useCoverageAA = should_apply_coverage_aa(paint, fRenderTarget.get()); - const bool isStencilDisabled = true; + constexpr bool kHasUserStencilSettings = false; bool isStencilBufferMSAA = fRenderTarget->isStencilBufferMultisampled(); const GrPathRendererChain::DrawType type = @@ -955,7 +955,7 @@ void GrDrawContext::internalDrawPath(const GrClip& clip, canDrawArgs.fPath = &origPath; canDrawArgs.fStyle = &origStyle; canDrawArgs.fAntiAlias = useCoverageAA; - canDrawArgs.fIsStencilDisabled = isStencilDisabled; + canDrawArgs.fHasUserStencilSettings = kHasUserStencilSettings; canDrawArgs.fIsStencilBufferMSAA = isStencilBufferMSAA; // Try a 1st time without applying any of the style to the geometry (and barring sw) |