Index: src/gpu/GrDrawState.cpp |
diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp |
index 36042e19ab21fb1b224406481ee41635ffdecc02..604f309714e2aa7fa98a508e09300192507f5c70 100644 |
--- a/src/gpu/GrDrawState.cpp |
+++ b/src/gpu/GrDrawState.cpp |
@@ -59,6 +59,8 @@ GrDrawState& GrDrawState::operator=(const GrDrawState& that) { |
fCoverageCache = that.fCoverageCache; |
fColorPrimProc = that.fColorPrimProc; |
fCoveragePrimProc = that.fCoveragePrimProc; |
+ fColorBatch = that.fColorBatch; |
+ fCoverageBatch = that.fCoverageBatch; |
if (fColorProcInfoValid) { |
fColorProcInfo = that.fColorProcInfo; |
} |
@@ -88,6 +90,9 @@ void GrDrawState::onReset() { |
fColorPrimProc = NULL; |
fCoveragePrimProc = NULL; |
+ |
+ fColorBatch = NULL; |
+ fCoverageBatch = NULL; |
} |
void GrDrawState::setFromPaint(const GrPaint& paint, GrRenderTarget* rt) { |
@@ -127,6 +132,9 @@ void GrDrawState::setFromPaint(const GrPaint& paint, GrRenderTarget* rt) { |
fColorPrimProc = NULL; |
fCoveragePrimProc = NULL; |
+ |
+ fColorBatch = NULL; |
+ fCoverageBatch = NULL; |
} |
//////////////////////////////////////////////////////////////////////////////// |
@@ -154,6 +162,14 @@ bool GrDrawState::willEffectReadDstColor(const GrPrimitiveProcessor* pp) const { |
return fXPFactory->willReadDst(fColorProcInfo, fCoverageProcInfo); |
} |
+bool GrDrawState::willEffectReadDstColor(const GrBatch* batch) const { |
+ this->calcColorInvariantOutput(batch); |
+ this->calcCoverageInvariantOutput(batch); |
+ |
+ return fXPFactory->willReadDst(fColorProcInfo, fCoverageProcInfo); |
+} |
+ |
+ |
void GrDrawState::AutoRestoreEffects::set(GrDrawState* ds) { |
if (fDrawState) { |
int m = fDrawState->numColorStages() - fColorEffectCnt; |
@@ -219,6 +235,29 @@ void GrDrawState::calcCoverageInvariantOutput(const GrPrimitiveProcessor* pp) co |
} |
} |
+void GrDrawState::calcColorInvariantOutput(const GrBatch* batch) const { |
+ if (!fColorProcInfoValid || fColorBatch != batch) { |
bsalomon
2015/01/20 16:14:02
all this storing of mutable ptrs seems very fragil
joshualitt
2015/01/20 17:03:08
How could we assign a uniqueID to each batch witho
bsalomon
2015/01/20 20:49:58
I mean its fragile because two batches that exist
|
+ GrBatchOpt batchOpt; |
+ batchOpt.fCanTweakAlphaForCoverage = this->canTweakAlphaForCoverage(); |
+ fColorProcInfo.calcColorWithBatch(batch, batchOpt, fColorStages.begin(), |
+ this->numColorStages()); |
+ fColorProcInfoValid = true; |
+ fColorBatch = batch; |
+ } |
+} |
+ |
+void GrDrawState::calcCoverageInvariantOutput(const GrBatch* batch) const { |
+ if (!fCoverageProcInfoValid || fCoverageBatch != batch) { |
+ GrBatchOpt batchOpt; |
+ batchOpt.fCanTweakAlphaForCoverage = this->canTweakAlphaForCoverage(); |
+ fCoverageProcInfo.calcCoverageWithBatch(batch, batchOpt, fCoverageStages.begin(), |
+ this->numCoverageStages()); |
+ fCoverageProcInfoValid = true; |
+ fCoverageBatch = batch; |
+ } |
+} |
+ |
+ |
void GrDrawState::calcColorInvariantOutput(GrColor color) const { |
if (!fColorProcInfoValid || color != fColorCache) { |
GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; |