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

Unified Diff: src/gpu/GrDrawState.h

Issue 791743003: Remove GP from drawstate, revision of invariant output for GP (Closed) Base URL: https://skia.googlesource.com/skia.git@color-to-gp
Patch Set: feedback inc Created 6 years 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
Index: src/gpu/GrDrawState.h
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index 17bd0f43df8fe0e6ab80a57871420b001d9debfa..44da4964e156c644593df45d60f41ef091ef4bea 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -68,21 +68,6 @@ public:
*/
void setFromPaint(const GrPaint& , const SkMatrix& viewMatrix, GrRenderTarget*);
- ///////////////////////////////////////////////////////////////////////////
- /// @name Vertex Attributes
- ////
-
- // TODO when we move this info off of GrGeometryProcessor, delete these
- bool hasLocalCoordAttribute() const {
- return this->hasGeometryProcessor() && this->getGeometryProcessor()->hasLocalCoords();
- }
- bool hasColorVertexAttribute() const {
- return this->hasGeometryProcessor() && this->getGeometryProcessor()->hasVertexColor();
- }
- bool hasCoverageVertexAttribute() const {
- return this->hasGeometryProcessor() && this->getGeometryProcessor()->hasVertexCoverage();
- }
-
/// @}
/**
@@ -100,29 +85,13 @@ public:
/**
* Determines whether the output coverage is guaranteed to be one for all pixels hit by a draw.
*/
- bool hasSolidCoverage(GrColor coverage) const;
+ bool hasSolidCoverage(const GrPrimitiveProcessor*) const;
/**
* This function returns true if the render target destination pixel values will be read for
* blending during draw.
*/
- bool willBlendWithDst(GrColor color, GrColor coverage) const;
-
- /// @}
-
- /**
- * The geometry processor is the sole element of the skia pipeline which can use the vertex,
- * geometry, and tesselation shaders. The GP may also compute a coverage in its fragment shader
- * but is never put in the color processing pipeline.
- */
-
- const GrGeometryProcessor* setGeometryProcessor(const GrGeometryProcessor* geometryProcessor) {
- SkASSERT(geometryProcessor);
- SkASSERT(!this->hasGeometryProcessor());
- fGeometryProcessor.reset(SkRef(geometryProcessor));
- fCoverageProcInfoValid = false;
- return geometryProcessor;
- }
+ bool willBlendWithDst(const GrPrimitiveProcessor*) const;
///////////////////////////////////////////////////////////////////////////
/// @name Effect Stages
@@ -147,12 +116,6 @@ public:
int numColorStages() const { return fColorStages.count(); }
int numCoverageStages() const { return fCoverageStages.count(); }
int numFragmentStages() const { return this->numColorStages() + this->numCoverageStages(); }
- int numTotalStages() const {
- return this->numFragmentStages() + (this->hasGeometryProcessor() ? 1 : 0);
- }
-
- bool hasGeometryProcessor() const { return SkToBool(fGeometryProcessor.get()); }
- const GrGeometryProcessor* getGeometryProcessor() const { return fGeometryProcessor.get(); }
const GrXPFactory* getXPFactory() const { return fXPFactory.get(); }
@@ -163,7 +126,7 @@ public:
* Checks whether any of the effects will read the dst pixel color.
* TODO remove when we have an XP
*/
- bool willEffectReadDstColor(GrColor color, GrColor coverage) const;
+ bool willEffectReadDstColor(const GrPrimitiveProcessor*) const;
/**
* The xfer processor factory.
@@ -555,22 +518,29 @@ public:
GrDrawState& operator= (const GrDrawState& that);
private:
- bool isEqual(const GrDrawState& that) const;
+ bool isEqual(const GrDrawState& that, bool explicitLocalCoords) const;
- const GrProcOptInfo& colorProcInfo(GrColor color) const {
- this->calcColorInvariantOutput(color);
+ const GrProcOptInfo& colorProcInfo(const GrPrimitiveProcessor* pp) const {
+ this->calcColorInvariantOutput(pp);
return fColorProcInfo;
}
- const GrProcOptInfo& coverageProcInfo(GrColor coverage) const {
- this->calcCoverageInvariantOutput(coverage);
+ const GrProcOptInfo& coverageProcInfo(const GrPrimitiveProcessor* pp) const {
+ this->calcCoverageInvariantOutput(pp);
return fCoverageProcInfo;
}
/**
- * Determines whether src alpha is guaranteed to be one for all src pixels
+ * If fColorProcInfoValid is false, function calculates the invariant output for the color
+ * stages and results are stored in fColorProcInfo.
+ */
+ void calcColorInvariantOutput(const GrPrimitiveProcessor*) const;
+
+ /**
+ * If fCoverageProcInfoValid is false, function calculates the invariant output for the coverage
+ * stages and results are stored in fCoverageProcInfo.
*/
- bool srcAlphaWillBeOne(GrColor color, GrColor coverage) const;
+ void calcCoverageInvariantOutput(const GrPrimitiveProcessor*) const;
/**
* If fColorProcInfoValid is false, function calculates the invariant output for the color
@@ -597,7 +567,6 @@ private:
uint32_t fFlagBits;
GrStencilSettings fStencilSettings;
DrawFace fDrawFace;
- SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor;
SkAutoTUnref<const GrXPFactory> fXPFactory;
FragmentStageArray fColorStages;
FragmentStageArray fCoverageStages;
@@ -609,6 +578,8 @@ private:
mutable bool fCoverageProcInfoValid;
mutable GrColor fColorCache;
mutable GrColor fCoverageCache;
+ mutable const GrPrimitiveProcessor* fColorPrimProc;
+ mutable const GrPrimitiveProcessor* fCoveragePrimProc;
friend class GrOptDrawState;
};

Powered by Google App Engine
This is Rietveld 408576698