Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(239)

Unified Diff: src/gpu/GrDrawState.h

Issue 719203002: Add GrProcOptInfo class to track various output information for color and coverage stages. (Closed) Base URL: https://skia.googlesource.com/skia.git@moveIO
Patch Set: initialize values Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/gpu/GrInvariantOutput.h ('k') | src/gpu/GrDrawState.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawState.h
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index 5c76aed6a3bcdca88cfbd35ae664e93d1b524770..454390cfbc651382e833f4fd3ec841f40916d62d 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -14,6 +14,7 @@
#include "GrGeometryProcessor.h"
#include "GrGpuResourceRef.h"
#include "GrProcessorStage.h"
+#include "GrProcOptInfo.h"
#include "GrRenderTarget.h"
#include "GrStencil.h"
#include "SkMatrix.h"
@@ -181,6 +182,7 @@ public:
void setColor(GrColor color) {
if (color != fColor) {
fColor = color;
+ fColorProcInfoValid = false;
}
}
@@ -212,6 +214,7 @@ public:
void setCoverage(uint8_t coverage) {
if (coverage != fCoverage) {
fCoverage = coverage;
+ fCoverageProcInfoValid = false;
}
}
@@ -227,6 +230,7 @@ public:
SkASSERT(geometryProcessor);
SkASSERT(!this->hasGeometryProcessor());
fGeometryProcessor.reset(SkRef(geometryProcessor));
+ fCoverageProcInfoValid = false;
return geometryProcessor;
}
@@ -270,12 +274,14 @@ public:
const GrFragmentProcessor* addColorProcessor(const GrFragmentProcessor* effect) {
SkASSERT(effect);
SkNEW_APPEND_TO_TARRAY(&fColorStages, GrFragmentStage, (effect));
+ fColorProcInfoValid = false;
return effect;
}
const GrFragmentProcessor* addCoverageProcessor(const GrFragmentProcessor* effect) {
SkASSERT(effect);
SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrFragmentStage, (effect));
+ fCoverageProcInfoValid = false;
return effect;
}
@@ -802,6 +808,18 @@ private:
*/
bool srcAlphaWillBeOne() const;
+ /**
+ * If fColorProcInfoValid is false, function calculates the invariant output for the color
+ * stages and results are stored in fColorProcInfo.
+ */
+ void calcColorInvariantOutput() const;
+
+ /**
+ * If fCoverageProcInfoValid is false, function calculates the invariant output for the coverage
+ * stages and results are stored in fCoverageProcInfo.
+ */
+ void calcCoverageInvariantOutput() const;
+
void onReset(const SkMatrix* initialViewMatrix);
// Some of the auto restore objects assume that no effects are removed during their lifetime.
@@ -838,6 +856,11 @@ private:
// not need to be compared in op==.
int fFixedFunctionVertexAttribIndices[kGrFixedFunctionVertexAttribBindingCnt];
+ mutable GrProcOptInfo fColorProcInfo;
+ mutable GrProcOptInfo fCoverageProcInfo;
+ mutable bool fColorProcInfoValid;
+ mutable bool fCoverageProcInfoValid;
+
friend class GrOptDrawState;
typedef SkRefCnt INHERITED;
« no previous file with comments | « include/gpu/GrInvariantOutput.h ('k') | src/gpu/GrDrawState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698