Index: include/gpu/GrProcessor.h |
diff --git a/include/gpu/GrProcessor.h b/include/gpu/GrProcessor.h |
index 9b5db5e033912e36be0070babb40468b23563a89..e23c2489274e7b5f5a5c5d64b4e63b686f27d268 100644 |
--- a/include/gpu/GrProcessor.h |
+++ b/include/gpu/GrProcessor.h |
@@ -79,8 +79,18 @@ public: |
/** Shortcut for textureAccess(index).texture(); */ |
GrTexture* texture(int index) const { return this->textureAccess(index).getTexture(); } |
- /** Will this processor read the fragment position? */ |
- bool willReadFragmentPosition() const { return fWillReadFragmentPosition; } |
+ /** |
+ * Platform specific built-in state that a processor can include in the fragment shader. A |
+ * processor must enable this state before using it. |
+ */ |
+ enum BuiltInState { |
+ kNone_BuiltInState = 0, |
+ kFragmentPosition_BuiltInState = 1 |
+ }; |
+ |
+ GR_DECL_BITFIELD_OPS_FRIENDS(BuiltInState); |
+ |
+ BuiltInState builtInState() const { return fBuiltInState; } |
void* operator new(size_t size); |
void operator delete(void* target); |
@@ -100,7 +110,7 @@ public: |
uint32_t classID() const { SkASSERT(kIllegalProcessorClassID != fClassID); return fClassID; } |
protected: |
- GrProcessor() : fClassID(kIllegalProcessorClassID), fWillReadFragmentPosition(false) {} |
+ GrProcessor() : fClassID(kIllegalProcessorClassID), fBuiltInState(kNone_BuiltInState) {} |
/** |
* Subclasses call this from their constructor to register GrTextureAccesses. The processor |
@@ -112,12 +122,7 @@ protected: |
bool hasSameTextureAccesses(const GrProcessor&) const; |
- /** |
- * If the prcoessor will generate a backend-specific processor that will read the fragment |
- * position in the FS then it must call this method from its constructor. Otherwise, the |
- * request to access the fragment position will be denied. |
- */ |
- void setWillReadFragmentPosition() { fWillReadFragmentPosition = true; } |
+ void enableBuiltInState(BuiltInState state) { fBuiltInState |= state; } |
joshualitt
2016/02/25 19:21:29
This is more a question for Brian / Robert, but do
Chris Dalton
2016/02/25 19:45:30
So, willRead isn't very needed anymore on this cla
Chris Dalton
2016/02/25 20:38:37
Also, FWIW, this feels pretty similar to "fsBuilde
bsalomon
2016/02/25 21:11:03
I find the setWillFoo() a bit more readable than e
Chris Dalton
2016/02/25 22:24:24
Ok, brought back "setWillFoo()".
For children FPs
|
template <typename PROC_SUBCLASS> void initClassID() { |
static uint32_t kClassID = GenClassID(); |
@@ -145,9 +150,11 @@ private: |
}; |
static int32_t gCurrProcessorClassID; |
- bool fWillReadFragmentPosition; |
+ BuiltInState fBuiltInState; |
typedef GrProgramElement INHERITED; |
}; |
+GR_MAKE_BITFIELD_OPS(GrProcessor::BuiltInState); |
+ |
#endif |