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

Unified Diff: include/gpu/GrProcessor.h

Issue 1734163002: Replace fWillReadFragmentPosition with a bitfield (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: BuiltInState -> RequiredFeatures Created 4 years, 10 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 | « no previous file | src/gpu/GrFragmentProcessor.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 9b5db5e033912e36be0070babb40468b23563a89..5afd8ea3882b0ee9086945a6648658cca409a215 100644
--- a/include/gpu/GrProcessor.h
+++ b/include/gpu/GrProcessor.h
@@ -79,8 +79,17 @@ 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 features that a processor can request for the fragment shader.
+ */
+ enum RequiredFeatures {
+ kNone_RequiredFeatures = 0,
+ kFragmentPosition_RequiredFeature = 1
+ };
+
+ GR_DECL_BITFIELD_OPS_FRIENDS(RequiredFeatures);
+
+ RequiredFeatures requiredFeatures() const { return fRequiredFeatures; }
void* operator new(size_t size);
void operator delete(void* target);
@@ -100,7 +109,7 @@ public:
uint32_t classID() const { SkASSERT(kIllegalProcessorClassID != fClassID); return fClassID; }
protected:
- GrProcessor() : fClassID(kIllegalProcessorClassID), fWillReadFragmentPosition(false) {}
+ GrProcessor() : fClassID(kIllegalProcessorClassID), fRequiredFeatures(kNone_RequiredFeatures) {}
/**
* Subclasses call this from their constructor to register GrTextureAccesses. The processor
@@ -117,7 +126,11 @@ protected:
* 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 setWillReadFragmentPosition() { fRequiredFeatures |= kFragmentPosition_RequiredFeature; }
+
+ void combineRequiredFeatures(const GrProcessor& other) {
+ fRequiredFeatures |= other.fRequiredFeatures;
+ }
template <typename PROC_SUBCLASS> void initClassID() {
static uint32_t kClassID = GenClassID();
@@ -145,9 +158,11 @@ private:
};
static int32_t gCurrProcessorClassID;
- bool fWillReadFragmentPosition;
+ RequiredFeatures fRequiredFeatures;
typedef GrProgramElement INHERITED;
};
+GR_MAKE_BITFIELD_OPS(GrProcessor::RequiredFeatures);
+
#endif
« no previous file with comments | « no previous file | src/gpu/GrFragmentProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698