diff options
author | 2017-01-17 12:39:53 -0500 | |
---|---|---|
committer | 2017-01-17 18:15:28 +0000 | |
commit | 652ecb51624941545aaedcea47bf51b314738c9c (patch) | |
tree | 8ff80bfbba8220627ed45d19fa027fe387fe1ffd /src/gpu/GrPipeline.cpp | |
parent | 4493a9dc9df8cf306a974bde7e0e9c5470ebcdc9 (diff) |
Pass GrAppliedClip to pipeline creation.
This skips adding the clip's coverage processor to the GrPipelineBuilder before creating GrPipeline.
Change-Id: I1282dd8600701ab2b6a049abd8ad571abbbcbbe5
Reviewed-on: https://skia-review.googlesource.com/7020
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrPipeline.cpp')
-rw-r--r-- | src/gpu/GrPipeline.cpp | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp index ea3f0f234f..96051eaaa5 100644 --- a/src/gpu/GrPipeline.cpp +++ b/src/gpu/GrPipeline.cpp @@ -7,11 +7,12 @@ #include "GrPipeline.h" +#include "GrAppliedClip.h" #include "GrCaps.h" -#include "GrRenderTargetContext.h" #include "GrGpu.h" #include "GrPipelineBuilder.h" #include "GrProcOptInfo.h" +#include "GrRenderTargetContext.h" #include "GrRenderTargetOpList.h" #include "GrRenderTargetPriv.h" #include "GrXferProcessor.h" @@ -30,8 +31,8 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args, GrPipeline* pipeline = new (memory) GrPipeline; pipeline->fRenderTarget.reset(rt); SkASSERT(pipeline->fRenderTarget); - pipeline->fScissorState = *args.fScissor; - pipeline->fWindowRectsState = *args.fWindowRectsState; + pipeline->fScissorState = args.fAppliedClip->scissorState(); + pipeline->fWindowRectsState = args.fAppliedClip->windowRectsState(); pipeline->fUserStencilSettings = userStencil; pipeline->fDrawFace = builder.getDrawFace(); @@ -51,10 +52,10 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args, if (builder.getUsesDistanceVectorField()) { pipeline->fFlags |= kUsesDistanceVectorField_Flag; } - if (args.fHasStencilClip) { + if (args.fAppliedClip->hasStencilClip()) { pipeline->fFlags |= kHasStencilClip_Flag; } - if (!userStencil->isDisabled(args.fHasStencilClip)) { + if (!userStencil->isDisabled(args.fAppliedClip->hasStencilClip())) { pipeline->fFlags |= kStencilEnabled_Flag; } @@ -84,10 +85,9 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args, const GrXferProcessor* xpForOpts = xferProcessor ? xferProcessor.get() : &GrPorterDuffXPFactory::SimpleSrcOverXP(); - optFlags = xpForOpts->getOptimizations(args.fAnalysis, - userStencil->doesWrite(args.fHasStencilClip), - &overrideColor, - *args.fCaps); + optFlags = xpForOpts->getOptimizations( + args.fAnalysis, userStencil->doesWrite(args.fAppliedClip->hasStencilClip()), + &overrideColor, *args.fCaps); // When path rendering the stencil settings are not always set on the GrPipelineBuilder // so we must check the draw type. In cases where we will skip drawing we simply return a @@ -122,6 +122,9 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args, pipeline->fNumColorProcessors = builder.numColorFragmentProcessors() - firstColorProcessorIdx; int numTotalProcessors = pipeline->fNumColorProcessors + builder.numCoverageFragmentProcessors() - firstCoverageProcessorIdx; + if (args.fAppliedClip->clipCoverageFragmentProcessor()) { + ++numTotalProcessors; + } pipeline->fFragmentProcessors.reset(numTotalProcessors); int currFPIdx = 0; for (int i = firstColorProcessorIdx; i < builder.numColorFragmentProcessors(); @@ -137,6 +140,10 @@ GrPipeline* GrPipeline::CreateAt(void* memory, const CreateArgs& args, pipeline->fFragmentProcessors[currFPIdx].reset(fp); usesLocalCoords = usesLocalCoords || fp->usesLocalCoords(); } + if (const GrFragmentProcessor* fp = args.fAppliedClip->clipCoverageFragmentProcessor()) { + pipeline->fFragmentProcessors[currFPIdx].reset(fp); + usesLocalCoords = usesLocalCoords || fp->usesLocalCoords(); + } // Setup info we need to pass to GrPrimitiveProcessors that are used with this GrPipeline. optimizations->fFlags = 0; |