From 652ecb51624941545aaedcea47bf51b314738c9c Mon Sep 17 00:00:00 2001 From: Brian Salomon Date: Tue, 17 Jan 2017 12:39:53 -0500 Subject: 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 Reviewed-by: Robert Phillips --- src/gpu/GrPipeline.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'src/gpu/GrPipeline.cpp') 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; -- cgit v1.2.3