Insert clip fragment processor outside GrCMM
Review URL: https://codereview.chromium.org/1393553002
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 1edb48c..ba0142e 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -146,12 +146,17 @@
void GrDrawTarget::drawBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawBatch* batch) {
// Setup clip
GrScissorState scissorState;
- GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
GrPipelineBuilder::AutoRestoreStencil ars;
- if (!fClipMaskManager->setupClipping(pipelineBuilder, &arfps, &ars, &scissorState,
- &batch->bounds())) {
+ GrAppliedClip clip;
+ if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &scissorState, &batch->bounds(),
+ &clip)) {
return;
}
+ GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
+ if (clip.clipCoverageFragmentProcessor()) {
+ arfps.set(&pipelineBuilder);
+ arfps.addCoverageFragmentProcessor(clip.clipCoverageFragmentProcessor());
+ }
GrPipeline::CreateArgs args;
if (!this->installPipelineInDrawBatch(&pipelineBuilder, &scissorState, batch)) {
@@ -206,13 +211,18 @@
// Setup clip
GrScissorState scissorState;
- GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
GrPipelineBuilder::AutoRestoreStencil ars;
-
- if (!fClipMaskManager->setupClipping(pipelineBuilder, &arfps, &ars, &scissorState, nullptr)) {
+ GrAppliedClip clip;
+ if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &scissorState, nullptr, &clip)) {
return;
}
+ GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
+ if (clip.clipCoverageFragmentProcessor()) {
+ arfps.set(&pipelineBuilder);
+ arfps.addCoverageFragmentProcessor(clip.clipCoverageFragmentProcessor());
+ }
+
// set stencil settings for path
GrStencilSettings stencilSettings;
GrRenderTarget* rt = pipelineBuilder.getRenderTarget();
@@ -261,13 +271,19 @@
// batches.
GrScissorState scissorState;
- GrPipelineBuilder::AutoRestoreFragmentProcessorState arfps;
GrPipelineBuilder::AutoRestoreStencil ars;
- if (!fClipMaskManager->setupClipping(pipelineBuilder, &arfps, &ars, &scissorState,
- &batch->bounds())) {
+ GrAppliedClip clip;
+ if (!fClipMaskManager->setupClipping(pipelineBuilder, &ars, &scissorState, &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.
GrStencilSettings stencilSettings;
GrRenderTarget* rt = pipelineBuilder.getRenderTarget();