diff options
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/GrPipeline.cpp | 28 | ||||
-rw-r--r-- | src/gpu/GrPipeline.h | 15 |
2 files changed, 25 insertions, 18 deletions
diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp index c3b8e77c1a..fbdd84bda5 100644 --- a/src/gpu/GrPipeline.cpp +++ b/src/gpu/GrPipeline.cpp @@ -87,20 +87,20 @@ GrPipeline::GrPipeline(const GrPipelineBuilder& pipelineBuilder, // Copy Stages from PipelineBuilder to Pipeline for (int i = firstColorStageIdx; i < pipelineBuilder.numColorFragmentStages(); ++i) { - SkNEW_APPEND_TO_TARRAY(&fFragmentStages, - GrPendingFragmentStage, - (pipelineBuilder.fColorStages[i])); - usesLocalCoords = usesLocalCoords || - pipelineBuilder.fColorStages[i].processor()->usesLocalCoords(); + const GrFragmentStage& fps = pipelineBuilder.fColorStages[i]; + const GrFragmentProcessor* fp = fps.processor(); + SkNEW_APPEND_TO_TARRAY(&fFragmentStages, GrPendingFragmentStage, (fps)); + usesLocalCoords = usesLocalCoords || fp->usesLocalCoords(); + fp->gatherCoordTransforms(&fCoordTransforms); } fNumColorStages = fFragmentStages.count(); for (int i = firstCoverageStageIdx; i < pipelineBuilder.numCoverageFragmentStages(); ++i) { - SkNEW_APPEND_TO_TARRAY(&fFragmentStages, - GrPendingFragmentStage, - (pipelineBuilder.fCoverageStages[i])); - usesLocalCoords = usesLocalCoords || - pipelineBuilder.fCoverageStages[i].processor()->usesLocalCoords(); + const GrFragmentStage& fps = pipelineBuilder.fCoverageStages[i]; + const GrFragmentProcessor* fp = fps.processor(); + SkNEW_APPEND_TO_TARRAY(&fFragmentStages, GrPendingFragmentStage, (fps)); + usesLocalCoords = usesLocalCoords || fp->usesLocalCoords(); + fp->gatherCoordTransforms(&fCoordTransforms); } // Setup info we need to pass to GrPrimitiveProcessors that are used with this GrPipeline. @@ -152,7 +152,7 @@ void GrPipeline::adjustProgramFromOptimizations(const GrPipelineBuilder& pipelin //////////////////////////////////////////////////////////////////////////////// -bool GrPipeline::isEqual(const GrPipeline& that) const { +bool GrPipeline::isEqual(const GrPipeline& that, bool ignoreCoordTransforms) const { // If we point to the same pipeline, then we are necessarily equal if (this == &that) { return true; @@ -172,11 +172,9 @@ bool GrPipeline::isEqual(const GrPipeline& that) const { return false; } - // The program desc comparison should have already assured that the stage counts match. - SkASSERT(this->numFragmentStages() == that.numFragmentStages()); for (int i = 0; i < this->numFragmentStages(); i++) { - - if (this->getFragmentStage(i) != that.getFragmentStage(i)) { + if (!this->getFragmentStage(i).processor()->isEqual(*that.getFragmentStage(i).processor(), + ignoreCoordTransforms)) { return false; } } diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h index 3b5181831a..77adb368d7 100644 --- a/src/gpu/GrPipeline.h +++ b/src/gpu/GrPipeline.h @@ -37,9 +37,12 @@ public: const GrXferProcessor::DstTexture*); /* - * Returns true if these pipelines are equivalent. + * Returns true if these pipelines are equivalent. Coord transforms may be applied either on + * the GPU or the CPU. When we apply them on the CPU then the matrices need not agree in order + * to combine draws. Therefore we take a param that indicates whether coord transforms should be + * compared." */ - bool isEqual(const GrPipeline& that) const; + bool isEqual(const GrPipeline& that, bool ignoreCoordTransforms = false) const; /// @} @@ -100,6 +103,10 @@ public: return fInfoForPrimitiveProcessor; } + const SkTArray<const GrCoordTransform*, true>& coordTransforms() const { + return fCoordTransforms; + } + private: /** * Alter the program desc and inputs (attribs and processors) based on the blend optimization. @@ -141,7 +148,9 @@ private: // This function is equivalent to the offset into fFragmentStages where coverage stages begin. int fNumColorStages; - GrProgramDesc fDesc; + SkSTArray<8, const GrCoordTransform*, true> fCoordTransforms; + int fNumCoordTransforms; + GrProgramDesc fDesc; typedef SkRefCnt INHERITED; }; |