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

Unified Diff: include/gpu/GrProcessor.h

Issue 656503002: Move willUseInputColor check to computeInvariantOutput (Closed) Base URL: https://skia.googlesource.com/skia.git@addMultFlag
Patch Set: Update InvariantOutput validate Created 6 years, 2 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 | « include/gpu/GrPaint.h ('k') | src/effects/SkColorFilters.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrProcessor.h
diff --git a/include/gpu/GrProcessor.h b/include/gpu/GrProcessor.h
index bbcc919caa525ec545e1b4337a4030df5848bcf9..5f541262d1cca6584ae157ebe9755664a6981501 100644
--- a/include/gpu/GrProcessor.h
+++ b/include/gpu/GrProcessor.h
@@ -39,7 +39,7 @@ public:
struct InvariantOutput{
InvariantOutput() : fColor(0), fValidFlags(0), fIsSingleComponent(false),
- fInputIsOnlyModulated(true) {}
+ fInputIsOnlyModulated(true), fWillUseInputColor(true) {}
void mulByUnknownOpaqueColor() {
if (this->isOpaque()) {
@@ -91,6 +91,16 @@ public:
fInputIsOnlyModulated = false;
}
+ /**
+ * If the effect will generate a result that does not depend on the input color value then
+ * it must call this function from its onComputeInvariantOutput(). Otherwise, when its
+ * generated backend-specific code might fail during variable binding due to unused
+ * variables.
+ */
+ void setWillNotUseInputColor() {
bsalomon 2014/10/13 20:54:42 Instead of a new setter can we make it be a requir
egdaniel 2014/10/14 17:49:57 Done.
+ fWillUseInputColor = false;
+ }
+
bool isOpaque() const {
return ((fValidFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpackA(fColor));
}
@@ -136,11 +146,13 @@ public:
friend class GrDrawState;
friend class GrOptDrawState;
friend class GrPaint;
+ friend class GrProcessor;
GrColor fColor;
uint32_t fValidFlags;
bool fIsSingleComponent;
bool fInputIsOnlyModulated;
+ bool fWillUseInputColor;
};
/**
@@ -152,6 +164,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();
@@ -287,17 +300,13 @@ class GrFragmentProcessor : public GrProcessor {
public:
GrFragmentProcessor()
: INHERITED()
- , fWillReadDstColor(false)
- , fWillUseInputColor(true) {}
+ , fWillReadDstColor(false) {}
virtual const GrBackendFragmentProcessorFactory& getFactory() const = 0;
/** 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:
/**
* If the effect subclass will read the destination pixel value then it must call this function
@@ -306,16 +315,8 @@ 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:
bool fWillReadDstColor;
- bool fWillUseInputColor;
typedef GrProcessor INHERITED;
};
« no previous file with comments | « include/gpu/GrPaint.h ('k') | src/effects/SkColorFilters.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698