Chromium Code Reviews| Index: include/gpu/GrProcessor.h |
| diff --git a/include/gpu/GrProcessor.h b/include/gpu/GrProcessor.h |
| index a8188ca043b932ac0ae21fdee2390d175ab4d4c5..1754f2d0156bd3f39ae17998cc39b30b9c971b82 100644 |
| --- a/include/gpu/GrProcessor.h |
| +++ b/include/gpu/GrProcessor.h |
| @@ -39,7 +39,12 @@ public: |
| struct InvariantOutput{ |
| InvariantOutput() : fColor(0), fValidFlags(0), fIsSingleComponent(false), |
| - fNonMulStageFound(false) {} |
| + fNonMulStageFound(false), fWillUseInputColor(true) {} |
| + |
| + enum ReadInput { |
| + kWill_ReadInput, |
| + kWillNot_ReadInput, |
| + }; |
| void mulByUnknownOpaqueColor() { |
| if (this->isOpaque()) { |
| @@ -69,26 +74,38 @@ public: |
| } |
| } |
| - void invalidateComponents(uint8_t invalidateFlags) { |
| + void invalidateComponents(uint8_t invalidateFlags, ReadInput readsInput) { |
| fValidFlags &= ~invalidateFlags; |
| fIsSingleComponent = false; |
| + if (kWillNot_ReadInput == readsInput) { |
| + fWillUseInputColor = false; |
| + } |
| } |
| - void setToTransparentBlack() { |
| + void setToTransparentBlack(ReadInput readsInput) { |
|
bsalomon
2014/10/15 14:52:42
Does this one need it? Aren't we going to omit the
egdaniel
2014/10/15 18:37:48
Changed function to be mulByKnownAlpha to clear up
|
| this->internalSetToTransparentBlack(); |
| fNonMulStageFound = true; |
| + if (kWillNot_ReadInput == readsInput) { |
| + fWillUseInputColor = false; |
| + } |
| } |
| - void setToOther(uint8_t validFlags, GrColor color) { |
| + void setToOther(uint8_t validFlags, GrColor color, ReadInput readsInput) { |
| fValidFlags = validFlags; |
| fColor = color; |
| fIsSingleComponent = false; |
| fNonMulStageFound = true; |
| + if (kWillNot_ReadInput == readsInput) { |
| + fWillUseInputColor = false; |
| + } |
| } |
| - void setToUnknown() { |
| + void setToUnknown(ReadInput readsInput) { |
| this->internalSetToUnknown(); |
| fNonMulStageFound= true; |
| + if (kWillNot_ReadInput == readsInput) { |
| + fWillUseInputColor = false; |
| + } |
| } |
| bool isOpaque() const { |
| @@ -136,11 +153,13 @@ public: |
| friend class GrDrawState; |
| friend class GrOptDrawState; |
| friend class GrPaint; |
| + friend class GrProcessor; |
| GrColor fColor; |
| uint32_t fValidFlags; |
| bool fIsSingleComponent; |
| bool fNonMulStageFound; |
| + bool fWillUseInputColor; |
| }; |
| /** |
| @@ -152,6 +171,7 @@ public: |
| * meaning if the corresponding bit in validFlags is set. |
| */ |
| void computeInvariantOutput(InvariantOutput* inout) const { |
| + inout->fWillUseInputColor = true; |
| this->onComputeInvariantOutput(inout); |
| #ifdef SK_DEBUG |
| inout->validate(); |
| @@ -269,8 +289,7 @@ class GrFragmentProcessor : public GrProcessor { |
| public: |
| GrFragmentProcessor() |
| : INHERITED() |
| - , fWillReadDstColor(false) |
| - , fWillUseInputColor(true) {} |
| + , fWillReadDstColor(false) {} |
| virtual const GrBackendFragmentProcessorFactory& getFactory() const = 0; |
| @@ -283,9 +302,6 @@ public: |
| /** Will this effect read the destination pixel value? */ |
| bool willReadDstColor() const { return fWillReadDstColor; } |
| - /** Will this effect read the source color value? */ |
| - bool willUseInputColor() const { return fWillUseInputColor; } |
| - |
| protected: |
| /** |
| * Fragment Processor subclasses call this from their constructor to register coordinate |
| @@ -304,17 +320,9 @@ protected: |
| */ |
| void setWillReadDstColor() { fWillReadDstColor = true; } |
| - /** |
| - * If the effect will generate a result that does not depend on the input color value then it |
| - * must call this function from its constructor. Otherwise, when its generated backend-specific |
| - * code might fail during variable binding due to unused variables. |
| - */ |
| - void setWillNotUseInputColor() { fWillUseInputColor = false; } |
| - |
| private: |
| SkSTArray<4, const GrCoordTransform*, true> fCoordTransforms; |
| bool fWillReadDstColor; |
| - bool fWillUseInputColor; |
| typedef GrProcessor INHERITED; |
| }; |