Chromium Code Reviews| Index: include/gpu/GrProcessor.h |
| diff --git a/include/gpu/GrProcessor.h b/include/gpu/GrProcessor.h |
| index 7053872bbe4a75d6e0039c0c646daf00af8043a9..3060b2bdf78bc25d07e1cba636c55ac5d8e82f36 100644 |
| --- a/include/gpu/GrProcessor.h |
| +++ b/include/gpu/GrProcessor.h |
| @@ -40,11 +40,19 @@ public: |
| /** |
| * This function is used to perform optimizations. When called the color and validFlags params |
| * indicate whether the input components to this effect in the FS will have known values. |
| - * validFlags is a bitfield of GrColorComponentFlags. The function updates both params to |
| - * indicate known values of its output. A component of the color param only has meaning if the |
| - * corresponding bit in validFlags is set. |
| + * validFlags is a bitfield of GrColorComponentFlags. The isSingleComponent param indicates |
| + * whether the input will be 1 or 4 bytes. The function updates all params to indicate known |
| + * values of its output. A component of the color param only has meaning if the corresponding |
| + * bit in validFlags is set. If an effect sets isSingleComponent to true, then validFlags must |
| + * be all 1's or all 0's. If it is all 1's then all color components must be equal. |
|
bsalomon
2014/09/29 15:28:04
all 1's isn't quit right (since this is a uint32_t
egdaniel
2014/09/29 15:50:20
Done.
|
| */ |
| - virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags) const = 0; |
| + void getConstantColorComponents(GrColor* color, uint32_t* validFlags, |
| + bool* isSingleComponent) const { |
| + this->onGetConstantColorComponents(color, validFlags, isSingleComponent); |
| +#ifdef SK_DEBUG |
| + this->validateComponents(*color, *validFlags, *isSingleComponent); |
| +#endif |
| + } |
| /** This object, besides creating back-end-specific helper objects, is used for run-time-type- |
| identification. The factory should be an instance of templated class, |
| @@ -153,11 +161,19 @@ protected: |
| private: |
| SkDEBUGCODE(void assertEquality(const GrProcessor& other) const;) |
| + SkDEBUGCODE(void validateComponents(GrColor color, uint32_t validFlags, |
| + bool isSingleComponent) const;) |
| + |
| /** Subclass implements this to support isEqual(). It will only be called if it is known that |
| the two effects are of the same subclass (i.e. they return the same object from |
| getFactory()).*/ |
| virtual bool onIsEqual(const GrProcessor& other) const = 0; |
| + /** |
| + * Subclass implements this to support getConstantColorComponents(...). |
| + */ |
| + virtual void onGetConstantColorComponents(GrColor* color, uint32_t* validFlags, |
| + bool* isSingleComponent) const = 0; |
| friend class GrGeometryProcessor; // to set fRequiresVertexShader and build fVertexAttribTypes. |
| SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms; |