| Index: src/gpu/GrDrawState.h
|
| diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
|
| index c02429f9658f7aa624923058bf2b44ff4a260373..b794ec5002560a053c2ef328ead7fc296a273895 100644
|
| --- a/src/gpu/GrDrawState.h
|
| +++ b/src/gpu/GrDrawState.h
|
| @@ -8,7 +8,7 @@
|
| #ifndef GrDrawState_DEFINED
|
| #define GrDrawState_DEFINED
|
|
|
| -
|
| +#include "GrBatch.h"
|
| #include "GrBlend.h"
|
| #include "GrDrawTargetCaps.h"
|
| #include "GrGeometryProcessor.h"
|
| @@ -406,6 +406,15 @@ public:
|
| private:
|
| bool isEqual(const GrDrawState& that, bool explicitLocalCoords) const;
|
|
|
| + // Calculating invariant color / coverage information is expensive, so we partially cache the
|
| + // results.
|
| + //
|
| + // canUseFracCoveragePrimProc() - Called in regular skia draw, caches results but only for a
|
| + // specific color and coverage. May be called multiple times
|
| + // willBlendWithDst() - only called by Nvpr, does not cache results
|
| + // GrOptDrawState constructor - never caches results
|
| +
|
| + // TODO delete when we have Batch
|
| const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const {
|
| this->calcColorInvariantOutput(pp);
|
| return fColorProcInfo;
|
| @@ -416,17 +425,28 @@ private:
|
| return fCoverageProcInfo;
|
| }
|
|
|
| + const GrProcOptInfo& colorProcInfo(const GrBatch* batch) const {
|
| + this->calcColorInvariantOutput(batch);
|
| + return fColorProcInfo;
|
| + }
|
| +
|
| + const GrProcOptInfo& coverageProcInfo(const GrBatch* batch) const {
|
| + this->calcCoverageInvariantOutput(batch);
|
| + return fCoverageProcInfo;
|
| + }
|
| +
|
| /**
|
| - * If fColorProcInfoValid is false, function calculates the invariant output for the color
|
| - * stages and results are stored in fColorProcInfo.
|
| + * Primproc variants of the calc functions
|
| + * TODO remove these when batch is everywhere
|
| */
|
| void calcColorInvariantOutput(const GrPrimitiveProcessor*) const;
|
| + void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const;
|
|
|
| /**
|
| - * If fCoverageProcInfoValid is false, function calculates the invariant output for the coverage
|
| - * stages and results are stored in fCoverageProcInfo.
|
| + * GrBatch provides the initial seed for these loops based off of its initial geometry data
|
| */
|
| - void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const;
|
| + void calcColorInvariantOutput(const GrBatch*) const;
|
| + void calcCoverageInvariantOutput(const GrBatch*) const;
|
|
|
| /**
|
| * If fColorProcInfoValid is false, function calculates the invariant output for the color
|
| @@ -462,8 +482,6 @@ private:
|
| mutable bool fCoverageProcInfoValid;
|
| mutable GrColor fColorCache;
|
| mutable GrColor fCoverageCache;
|
| - mutable const GrPrimitiveProcessor* fColorPrimProc;
|
| - mutable const GrPrimitiveProcessor* fCoveragePrimProc;
|
|
|
| friend class GrOptDrawState;
|
| };
|
|
|