Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 1966763002: Eliminate special case nvpr batch handling (Closed) Base URL: https://skia.googlesource.com/skia.git@reallyupload_userstencil
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/gpu/GrDrawTarget.cpp
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index f824c8112baefd1784acc9b4fca53de2ec311edc..e627cdd3f4bce4a60aa906f87d4ad940eb278b8a 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -270,38 +270,6 @@ void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder,
this->recordBatch(batch);
}
-inline static const GrUserStencilSettings& get_path_stencil_settings_for_fill(
- GrPathRendering::FillType fill) {
- static constexpr GrUserStencilSettings kWindingStencilSettings(
- GrUserStencilSettings::StaticInit<
- 0xffff,
- GrUserStencilTest::kAlwaysIfInClip,
- 0xffff,
- GrUserStencilOp::kIncMaybeClamp, // TODO: Use wrap ops for NVPR.
- GrUserStencilOp::kIncMaybeClamp,
- 0xffff>()
- );
-
- static constexpr GrUserStencilSettings kEvenOddStencilSettings(
- GrUserStencilSettings::StaticInit<
- 0xffff,
- GrUserStencilTest::kAlwaysIfInClip,
- 0xffff,
- GrUserStencilOp::kInvert,
- GrUserStencilOp::kInvert,
- 0xffff>()
- );
-
- switch (fill) {
- default:
- SkFAIL("Unexpected path fill.");
- case GrPathRendering::kWinding_FillType:
- return kWindingStencilSettings;
- case GrPathRendering::kEvenOdd_FillType:
- return kEvenOddStencilSettings;
- }
-}
-
void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder,
const SkMatrix& viewMatrix,
const GrPath* path,
@@ -322,15 +290,13 @@ void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder,
arfps.addCoverageFragmentProcessor(clip.clipCoverageFragmentProcessor());
}
- GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
- GrStencilAttachment* stencilAttachment = rt->renderTargetPriv().getStencilAttachment();
- SkASSERT(stencilAttachment)
+ const GrRenderTargetPriv& rtPriv = pipelineBuilder.getRenderTarget()->renderTargetPriv();
GrBatch* batch = GrStencilPathBatch::Create(viewMatrix,
pipelineBuilder.isHWAntialias(),
- get_path_stencil_settings_for_fill(fill),
+ fill,
clip.hasStencilClip(),
- stencilAttachment->bits(),
+ rtPriv.numStencilBits(),
clip.scissorState(),
pipelineBuilder.getRenderTarget(),
path);
@@ -338,42 +304,6 @@ void GrDrawTarget::stencilPath(const GrPipelineBuilder& pipelineBuilder,
batch->unref();
}
-void GrDrawTarget::drawPathBatch(const GrPipelineBuilder& pipelineBuilder,
- GrDrawPathBatchBase* batch) {
- // This looks like drawBatch() but there is an added wrinkle that stencil settings get inserted
- // after setting up clipping but before onDrawBatch(). TODO: Figure out a better model for
- // handling stencil settings WRT interactions between pipeline(builder), clipmaskmanager, and
- // batches.
- SkASSERT(this->caps()->shaderCaps()->pathRenderingSupport());
-
- GrAppliedClip clip;
- if (!fClipMaskManager->setupClipping(pipelineBuilder, &batch->bounds(), &clip)) {
- return;
- }
-
- GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
- if (clip.clipCoverageFragmentProcessor()) {
- arfps.set(&pipelineBuilder);
- arfps.addCoverageFragmentProcessor(clip.clipCoverageFragmentProcessor());
- }
-
- // Ensure the render target has a stencil buffer and get the stencil settings.
- GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
- GrStencilAttachment* sb = fResourceProvider->attachStencilAttachment(rt);
- // TODO: Move this step into GrDrawPathPath::onPrepare().
- batch->setStencilSettings(get_path_stencil_settings_for_fill(batch->fillType()),
- clip.hasStencilClip(),
- sb->bits());
-
- GrPipeline::CreateArgs args;
- if (!this->installPipelineInDrawBatch(&pipelineBuilder, &clip.scissorState(),
- clip.hasStencilClip(), batch)) {
- return;
- }
-
- this->recordBatch(batch);
-}
-
void GrDrawTarget::clear(const SkIRect* rect,
GrColor color,
bool canIgnoreRect,
@@ -558,11 +488,7 @@ bool GrDrawTarget::installPipelineInDrawBatch(const GrPipelineBuilder* pipelineB
args.fCaps = this->caps();
args.fScissor = scissor;
if (pipelineBuilder->hasUserStencilSettings() || hasStencilClip) {
- GrRenderTarget* rt = pipelineBuilder->getRenderTarget();
- GrStencilAttachment* sb = fResourceProvider->attachStencilAttachment(rt);
- args.fNumStencilBits = sb->bits();
- } else {
- args.fNumStencilBits = 0;
+ fResourceProvider->attachStencilAttachment(pipelineBuilder->getRenderTarget());
}
args.fHasStencilClip = hasStencilClip;
batch->getPipelineOptimizations(&args.fOpts);
« no previous file with comments | « src/gpu/GrDrawTarget.h ('k') | src/gpu/GrPathRendering.h » ('j') | src/gpu/GrPipeline.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698