diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/effects/gradients/SkGradientShaderPriv.h | 1 | ||||
-rw-r--r-- | src/gpu/GrPendingFragmentStage.h | 53 | ||||
-rw-r--r-- | src/gpu/GrPipeline.cpp | 16 | ||||
-rw-r--r-- | src/gpu/GrPipeline.h | 5 | ||||
-rw-r--r-- | src/gpu/GrPipelineBuilder.h | 2 | ||||
-rw-r--r-- | src/gpu/GrProcOptInfo.cpp | 2 | ||||
-rw-r--r-- | src/gpu/GrProcOptInfo.h | 2 | ||||
-rw-r--r-- | src/gpu/effects/GrConfigConversionEffect.h | 1 | ||||
-rw-r--r-- | src/gpu/gl/builders/GrGLProgramBuilder.h | 1 |
9 files changed, 71 insertions, 12 deletions
diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h index cb882b2a6d..9dc6b66930 100644 --- a/src/effects/gradients/SkGradientShaderPriv.h +++ b/src/effects/gradients/SkGradientShaderPriv.h @@ -296,6 +296,7 @@ static inline int next_dither_toggle16(int toggle) { #include "GrFragmentProcessor.h" #include "gl/GrGLProcessor.h" +class GrFragmentStage; class GrInvariantOutput; /* diff --git a/src/gpu/GrPendingFragmentStage.h b/src/gpu/GrPendingFragmentStage.h new file mode 100644 index 0000000000..0bf984ab7d --- /dev/null +++ b/src/gpu/GrPendingFragmentStage.h @@ -0,0 +1,53 @@ +/* + * Copyright 2014 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef GrPendingProcessorStage_DEFINED +#define GrPendingProcessorStage_DEFINED + +#include "GrFragmentStage.h" +#include "GrCoordTransform.h" +#include "GrFragmentProcessor.h" +#include "GrPendingProgramElement.h" + +/** + * This a baked variant of GrFragmentStage, as recorded in GrOptDrawState. + */ +class GrPendingFragmentStage { +public: + GrPendingFragmentStage(const GrFragmentStage& stage) : fProc(stage.processor()) {} + + GrPendingFragmentStage(const GrPendingFragmentStage& that) { *this = that; } + + GrPendingFragmentStage& operator=(const GrPendingFragmentStage& that) { + fProc.reset(that.fProc.get()); + return *this; + } + + bool operator==(const GrPendingFragmentStage& that) const { + return this->processor()->isEqual(*that.processor()); + } + + bool operator!=(const GrPendingFragmentStage& that) const { return !(*this == that); } + + /** + * For a coord transform on the fragment processor, does it or the coord change matrix (if + * relevant) contain perspective? + */ + bool isPerspectiveCoordTransform(int matrixIndex) const { + const GrCoordTransform& coordTransform = this->processor()->coordTransform(matrixIndex); + uint32_t type = coordTransform.getMatrix().getType(); + return SkToBool(SkMatrix::kPerspective_Mask & type); + } + + const char* name() const { return fProc->name(); } + + const GrFragmentProcessor* processor() const { return fProc.get(); } + +protected: + GrPendingProgramElement<const GrFragmentProcessor> fProc; +}; +#endif diff --git a/src/gpu/GrPipeline.cpp b/src/gpu/GrPipeline.cpp index 2c3422a746..8c40438a27 100644 --- a/src/gpu/GrPipeline.cpp +++ b/src/gpu/GrPipeline.cpp @@ -87,16 +87,20 @@ GrPipeline::GrPipeline(const GrPipelineBuilder& pipelineBuilder, // Copy Stages from PipelineBuilder to Pipeline for (int i = firstColorStageIdx; i < pipelineBuilder.numColorFragmentStages(); ++i) { - const GrFragmentProcessor* fp = pipelineBuilder.fColorStages[i].processor(); - SkNEW_APPEND_TO_TARRAY(&fFragmentStages, GrPendingFragmentStage, (fp)); - usesLocalCoords = usesLocalCoords || fp->usesLocalCoords(); + SkNEW_APPEND_TO_TARRAY(&fFragmentStages, + GrPendingFragmentStage, + (pipelineBuilder.fColorStages[i])); + usesLocalCoords = usesLocalCoords || + pipelineBuilder.fColorStages[i].processor()->usesLocalCoords(); } fNumColorStages = fFragmentStages.count(); for (int i = firstCoverageStageIdx; i < pipelineBuilder.numCoverageFragmentStages(); ++i) { - const GrFragmentProcessor* fp = pipelineBuilder.fCoverageStages[i].processor(); - SkNEW_APPEND_TO_TARRAY(&fFragmentStages, GrPendingFragmentStage, (fp)); - usesLocalCoords = usesLocalCoords || fp->usesLocalCoords(); + SkNEW_APPEND_TO_TARRAY(&fFragmentStages, + GrPendingFragmentStage, + (pipelineBuilder.fCoverageStages[i])); + usesLocalCoords = usesLocalCoords || + pipelineBuilder.fCoverageStages[i].processor()->usesLocalCoords(); } // Setup info we need to pass to GrPrimitiveProcessors that are used with this GrPipeline. diff --git a/src/gpu/GrPipeline.h b/src/gpu/GrPipeline.h index fb90d47b55..bf8ca8a725 100644 --- a/src/gpu/GrPipeline.h +++ b/src/gpu/GrPipeline.h @@ -10,8 +10,7 @@ #include "GrColor.h" #include "GrGpu.h" -#include "GrStagedProcessor.h" -#include "GrPendingProgramElement.h" +#include "GrPendingFragmentStage.h" #include "GrPrimitiveProcessor.h" #include "GrProgramDesc.h" #include "GrStencil.h" @@ -23,8 +22,6 @@ class GrBatch; class GrDeviceCoordTexture; class GrPipelineBuilder; -typedef GrStagedProcessor<GrPendingProgramElement> GrPendingFragmentStage; - /** * Class that holds an optimized version of a GrPipelineBuilder. It is meant to be an immutable * class, and contains all data needed to set the state for a gpu draw. diff --git a/src/gpu/GrPipelineBuilder.h b/src/gpu/GrPipelineBuilder.h index 209845461d..dd3db6e092 100644 --- a/src/gpu/GrPipelineBuilder.h +++ b/src/gpu/GrPipelineBuilder.h @@ -12,7 +12,7 @@ #include "GrCaps.h" #include "GrClip.h" #include "GrGpuResourceRef.h" -#include "GrStagedProcessor.h" +#include "GrFragmentStage.h" #include "GrProcOptInfo.h" #include "GrProcessorDataManager.h" #include "GrRenderTarget.h" diff --git a/src/gpu/GrProcOptInfo.cpp b/src/gpu/GrProcOptInfo.cpp index 53f2e02451..dc499fa337 100644 --- a/src/gpu/GrProcOptInfo.cpp +++ b/src/gpu/GrProcOptInfo.cpp @@ -8,6 +8,8 @@ #include "GrProcOptInfo.h" #include "GrBatch.h" +#include "GrFragmentProcessor.h" +#include "GrFragmentStage.h" #include "GrGeometryProcessor.h" void GrProcOptInfo::calcColorWithBatch(const GrBatch* batch, diff --git a/src/gpu/GrProcOptInfo.h b/src/gpu/GrProcOptInfo.h index 0430916405..f518172e22 100644 --- a/src/gpu/GrProcOptInfo.h +++ b/src/gpu/GrProcOptInfo.h @@ -10,9 +10,9 @@ #include "GrColor.h" #include "GrInvariantOutput.h" -#include "GrStagedProcessor.h" class GrBatch; +class GrFragmentStage; class GrFragmentProcessor; class GrPrimitiveProcessor; class GrProcessor; diff --git a/src/gpu/effects/GrConfigConversionEffect.h b/src/gpu/effects/GrConfigConversionEffect.h index d87d009469..f00a284177 100644 --- a/src/gpu/effects/GrConfigConversionEffect.h +++ b/src/gpu/effects/GrConfigConversionEffect.h @@ -10,6 +10,7 @@ #include "GrSingleTextureEffect.h" +class GrFragmentStage; class GrInvariantOutput; /** diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.h b/src/gpu/gl/builders/GrGLProgramBuilder.h index 8143230495..4b784aceea 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.h +++ b/src/gpu/gl/builders/GrGLProgramBuilder.h @@ -16,6 +16,7 @@ #include "../GrGLUniformHandle.h" #include "../GrGLPrimitiveProcessor.h" #include "../GrGLXferProcessor.h" +#include "../../GrPendingFragmentStage.h" #include "../../GrPipeline.h" /* |