OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrProcessor_DEFINED | 8 #ifndef GrProcessor_DEFINED |
9 #define GrProcessor_DEFINED | 9 #define GrProcessor_DEFINED |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 const GrTextureAccess& textureAccess(int index) const { return *fTextureAcce
sses[index]; } | 77 const GrTextureAccess& textureAccess(int index) const { return *fTextureAcce
sses[index]; } |
78 | 78 |
79 /** Shortcut for textureAccess(index).texture(); */ | 79 /** Shortcut for textureAccess(index).texture(); */ |
80 GrTexture* texture(int index) const { return this->textureAccess(index).getT
exture(); } | 80 GrTexture* texture(int index) const { return this->textureAccess(index).getT
exture(); } |
81 | 81 |
82 /** | 82 /** |
83 * Platform specific built-in features that a processor can request for the
fragment shader. | 83 * Platform specific built-in features that a processor can request for the
fragment shader. |
84 */ | 84 */ |
85 enum RequiredFeatures { | 85 enum RequiredFeatures { |
86 kNone_RequiredFeatures = 0, | 86 kNone_RequiredFeatures = 0, |
87 kFragmentPosition_RequiredFeature = 1 | 87 kFragmentPosition_RequiredFeature = 1 << 0, |
| 88 kSampleLocations_RequiredFeature = 1 << 1 |
88 }; | 89 }; |
89 | 90 |
90 GR_DECL_BITFIELD_OPS_FRIENDS(RequiredFeatures); | 91 GR_DECL_BITFIELD_OPS_FRIENDS(RequiredFeatures); |
91 | 92 |
92 RequiredFeatures requiredFeatures() const { return fRequiredFeatures; } | 93 RequiredFeatures requiredFeatures() const { return fRequiredFeatures; } |
93 | 94 |
94 void* operator new(size_t size); | 95 void* operator new(size_t size); |
95 void operator delete(void* target); | 96 void operator delete(void* target); |
96 | 97 |
97 void* operator new(size_t size, void* placement) { | 98 void* operator new(size_t size, void* placement) { |
(...skipping 17 matching lines...) Expand all Loading... |
115 * Subclasses call this from their constructor to register GrTextureAccesses
. The processor | 116 * Subclasses call this from their constructor to register GrTextureAccesses
. The processor |
116 * subclass manages the lifetime of the accesses (this function only stores
a pointer). The | 117 * subclass manages the lifetime of the accesses (this function only stores
a pointer). The |
117 * GrTextureAccess is typically a member field of the GrProcessor subclass.
This must only be | 118 * GrTextureAccess is typically a member field of the GrProcessor subclass.
This must only be |
118 * called from the constructor because GrProcessors are immutable. | 119 * called from the constructor because GrProcessors are immutable. |
119 */ | 120 */ |
120 virtual void addTextureAccess(const GrTextureAccess* textureAccess); | 121 virtual void addTextureAccess(const GrTextureAccess* textureAccess); |
121 | 122 |
122 bool hasSameTextureAccesses(const GrProcessor&) const; | 123 bool hasSameTextureAccesses(const GrProcessor&) const; |
123 | 124 |
124 /** | 125 /** |
125 * If the prcoessor will generate a backend-specific processor that will rea
d the fragment | 126 * If the prcoessor will generate code that uses platform specific built-in
features, then it |
126 * position in the FS then it must call this method from its constructor. Ot
herwise, the | 127 * must call these methods from its constructor. Otherwise, requests to use
these features will |
127 * request to access the fragment position will be denied. | 128 * be denied. |
128 */ | 129 */ |
129 void setWillReadFragmentPosition() { fRequiredFeatures |= kFragmentPosition_
RequiredFeature; } | 130 void setWillReadFragmentPosition() { fRequiredFeatures |= kFragmentPosition_
RequiredFeature; } |
| 131 void setWillUseSampleLocations() { fRequiredFeatures |= kSampleLocations_Req
uiredFeature; } |
130 | 132 |
131 void combineRequiredFeatures(const GrProcessor& other) { | 133 void combineRequiredFeatures(const GrProcessor& other) { |
132 fRequiredFeatures |= other.fRequiredFeatures; | 134 fRequiredFeatures |= other.fRequiredFeatures; |
133 } | 135 } |
134 | 136 |
135 template <typename PROC_SUBCLASS> void initClassID() { | 137 template <typename PROC_SUBCLASS> void initClassID() { |
136 static uint32_t kClassID = GenClassID(); | 138 static uint32_t kClassID = GenClassID(); |
137 fClassID = kClassID; | 139 fClassID = kClassID; |
138 } | 140 } |
139 | 141 |
(...skipping 19 matching lines...) Expand all Loading... |
159 static int32_t gCurrProcessorClassID; | 161 static int32_t gCurrProcessorClassID; |
160 | 162 |
161 RequiredFeatures fRequiredFeatures; | 163 RequiredFeatures fRequiredFeatures; |
162 | 164 |
163 typedef GrProgramElement INHERITED; | 165 typedef GrProgramElement INHERITED; |
164 }; | 166 }; |
165 | 167 |
166 GR_MAKE_BITFIELD_OPS(GrProcessor::RequiredFeatures); | 168 GR_MAKE_BITFIELD_OPS(GrProcessor::RequiredFeatures); |
167 | 169 |
168 #endif | 170 #endif |
OLD | NEW |