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

Unified Diff: src/gpu/GrGeometryProcessor.h

Issue 1243583002: Add support for transformedLocalCoords to GrDefaultGeoProc (Closed) Base URL: https://skia.googlesource.com/skia.git@pipelinetobatch2
Patch Set: tweaks Created 5 years, 4 months 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 | « src/gpu/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/GrPathProcessor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrGeometryProcessor.h
diff --git a/src/gpu/GrGeometryProcessor.h b/src/gpu/GrGeometryProcessor.h
index ea4e890ee1a424a71adf36a6ebf6af133e9cebbd..96c1cb6bf3643ae9a6a539990861a45a2f78fb97 100644
--- a/src/gpu/GrGeometryProcessor.h
+++ b/src/gpu/GrGeometryProcessor.h
@@ -22,7 +22,7 @@ public:
GrGeometryProcessor()
: INHERITED(false)
, fWillUseGeoShader(false)
- , fHasLocalCoords(false) {}
+ , fLocalCoordsType(kUnused_LocalCoordsType) {}
bool willUseGeoShader() const override { return fWillUseGeoShader; }
@@ -45,6 +45,14 @@ public:
SkFAIL("Unsupported\n");
}
+ bool hasTransformedLocalCoords() const override {
+ return kHasTransformed_LocalCoordsType == fLocalCoordsType;
+ }
+
+ bool hasExplicitLocalCoords() const override {
+ return kHasExplicit_LocalCoordsType == fLocalCoordsType;
+ }
+
protected:
/**
* Subclasses call this from their constructor to register vertex attributes. Attributes
@@ -64,14 +72,32 @@ protected:
void setWillUseGeoShader() { fWillUseGeoShader = true; }
- // TODO hack see above
- void setHasLocalCoords() { fHasLocalCoords = true; }
+ /**
+ * If a GrFragmentProcessor in the GrPipeline needs localCoods, we will provide them in one of
+ * three ways
+ * 1) LocalCoordTransform * Position - in Shader
+ * 2) LocalCoordTransform * ExplicitLocalCoords- in Shader
+ * 3) A transformation on the CPU uploaded via vertex attribute
+ * TODO make this GrBatches responsibility
+ */
+ enum LocalCoordsType {
+ kUnused_LocalCoordsType,
+ kHasExplicit_LocalCoordsType,
+ kHasTransformed_LocalCoordsType
+ };
+
+ void setHasExplicitLocalCoords() {
+ SkASSERT(kUnused_LocalCoordsType == fLocalCoordsType);
+ fLocalCoordsType = kHasExplicit_LocalCoordsType;
+ }
+ void setHasTransformedLocalCoords() {
+ SkASSERT(kUnused_LocalCoordsType == fLocalCoordsType);
+ fLocalCoordsType = kHasTransformed_LocalCoordsType;
+ }
private:
- bool hasExplicitLocalCoords() const override { return fHasLocalCoords; }
-
bool fWillUseGeoShader;
- bool fHasLocalCoords;
+ LocalCoordsType fLocalCoordsType;
typedef GrPrimitiveProcessor INHERITED;
};
« no previous file with comments | « src/gpu/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/GrPathProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698