Chromium Code Reviews| Index: src/gpu/GrGeometryProcessor.h |
| diff --git a/src/gpu/GrGeometryProcessor.h b/src/gpu/GrGeometryProcessor.h |
| index ea4e890ee1a424a71adf36a6ebf6af133e9cebbd..51e2a4fa72161283b9c47b5f8f13bd8a4319a2e4 100644 |
| --- a/src/gpu/GrGeometryProcessor.h |
| +++ b/src/gpu/GrGeometryProcessor.h |
| @@ -22,7 +22,7 @@ public: |
| GrGeometryProcessor() |
| : INHERITED(false) |
| , fWillUseGeoShader(false) |
| - , fHasLocalCoords(false) {} |
| + , fLocalCoordsType(kIgnoredOrPosition_LocalCoordsType) {} |
| bool willUseGeoShader() const override { return fWillUseGeoShader; } |
| @@ -45,6 +45,14 @@ public: |
| SkFAIL("Unsupported\n"); |
| } |
| + bool hasTransformedLocalCoords() const override { |
|
bsalomon
2015/08/05 16:20:19
enum getter here rather than two queries?
joshualitt
2015/08/05 16:32:30
I'd rather just leave the queries. All of this wi
|
| + 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 { |
| + kIgnoredOrPosition_LocalCoordsType, |
|
bsalomon
2015/08/05 16:20:19
Are there really ignored local local coords? Unuse
joshualitt
2015/08/05 16:32:30
Acknowledged.
|
| + kHasExplicit_LocalCoordsType, |
| + kHasTransformed_LocalCoordsType |
| + }; |
| + |
| + void setHasExplicitLocalCoords() { |
| + SkASSERT(kIgnoredOrPosition_LocalCoordsType == fLocalCoordsType); |
| + fLocalCoordsType = kHasExplicit_LocalCoordsType; |
| + } |
| + void setHasTransformedLocalCoords() { |
| + SkASSERT(kIgnoredOrPosition_LocalCoordsType == fLocalCoordsType); |
| + fLocalCoordsType = kHasTransformed_LocalCoordsType; |
| + } |
| private: |
| - bool hasExplicitLocalCoords() const override { return fHasLocalCoords; } |
| - |
| bool fWillUseGeoShader; |
| - bool fHasLocalCoords; |
| + LocalCoordsType fLocalCoordsType; |
| typedef GrPrimitiveProcessor INHERITED; |
| }; |