OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 GrPrimitiveProcessor_DEFINED | 8 #ifndef GrPrimitiveProcessor_DEFINED |
9 #define GrPrimitiveProcessor_DEFINED | 9 #define GrPrimitiveProcessor_DEFINED |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 * can be updated alongside the GrBatchTracker struct itself, ultimately allowin
g the | 40 * can be updated alongside the GrBatchTracker struct itself, ultimately allowin
g the |
41 * GrPrimitiveProcessor complete control of how it gets data into the fragment s
hader as long as | 41 * GrPrimitiveProcessor complete control of how it gets data into the fragment s
hader as long as |
42 * it emits the appropriate color, or none at all, as directed. | 42 * it emits the appropriate color, or none at all, as directed. |
43 */ | 43 */ |
44 | 44 |
45 class GrGLSLCaps; | 45 class GrGLSLCaps; |
46 class GrGLSLPrimitiveProcessor; | 46 class GrGLSLPrimitiveProcessor; |
47 | 47 |
48 struct GrInitInvariantOutput; | 48 struct GrInitInvariantOutput; |
49 | 49 |
| 50 // Describes the state of pixel local storage with respect to the current draw. |
| 51 enum GrPixelLocalStorageState { |
| 52 // The draw is actively updating PLS. |
| 53 kDraw_GrPixelLocalStorageState, |
| 54 // The draw is a "finish" operation which is reading from PLS and writing co
lor. |
| 55 kFinish_GrPixelLocalStorageState, |
| 56 // The draw does not use PLS. |
| 57 kDisabled_GrPixelLocalStorageState |
| 58 }; |
| 59 |
50 /* | 60 /* |
51 * This class allows the GrPipeline to communicate information about the pipelin
e to a | 61 * This class allows the GrPipeline to communicate information about the pipelin
e to a |
52 * GrBatch which should be forwarded to the GrPrimitiveProcessor(s) created by t
he batch. | 62 * GrBatch which should be forwarded to the GrPrimitiveProcessor(s) created by t
he batch. |
53 * These are not properly part of the pipeline because they assume the specific
inputs | 63 * These are not properly part of the pipeline because they assume the specific
inputs |
54 * that the batch provided when it created the pipeline. Identical pipelines may
be | 64 * that the batch provided when it created the pipeline. Identical pipelines may
be |
55 * created by different batches with different input assumptions and therefore d
ifferent | 65 * created by different batches with different input assumptions and therefore d
ifferent |
56 * computed optimizations. It is the batch-specific optimizations that allow the
pipelines | 66 * computed optimizations. It is the batch-specific optimizations that allow the
pipelines |
57 * to be equal. | 67 * to be equal. |
58 */ | 68 */ |
59 class GrXPOverridesForBatch { | 69 class GrXPOverridesForBatch { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 */ | 202 */ |
193 virtual void getGLSLProcessorKey(const GrGLSLCaps& caps, | 203 virtual void getGLSLProcessorKey(const GrGLSLCaps& caps, |
194 GrProcessorKeyBuilder* b) const = 0; | 204 GrProcessorKeyBuilder* b) const = 0; |
195 | 205 |
196 | 206 |
197 /** Returns a new instance of the appropriate *GL* implementation class | 207 /** Returns a new instance of the appropriate *GL* implementation class |
198 for the given GrProcessor; caller is responsible for deleting | 208 for the given GrProcessor; caller is responsible for deleting |
199 the object. */ | 209 the object. */ |
200 virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps& caps)
const = 0; | 210 virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps& caps)
const = 0; |
201 | 211 |
202 bool isPathRendering() const { return fIsPathRendering; } | 212 virtual bool isPathRendering() const { return false; } |
203 | 213 |
204 /** | 214 /** |
205 * No Local Coord Transformation is needed in the shader, instead transforme
d local coords will | 215 * No Local Coord Transformation is needed in the shader, instead transforme
d local coords will |
206 * be provided via vertex attribute. | 216 * be provided via vertex attribute. |
207 */ | 217 */ |
208 virtual bool hasTransformedLocalCoords() const = 0; | 218 virtual bool hasTransformedLocalCoords() const = 0; |
209 | 219 |
| 220 virtual GrPixelLocalStorageState getPixelLocalStorageState() const { |
| 221 return kDisabled_GrPixelLocalStorageState; |
| 222 } |
| 223 |
| 224 /** |
| 225 * If non-null, overrides the dest color returned by GrGLSLFragmentShaderBui
lder::dstColor(). |
| 226 */ |
| 227 virtual const char* getDestColorOverride() const { return nullptr; } |
| 228 |
210 protected: | 229 protected: |
211 GrPrimitiveProcessor(bool isPathRendering) | 230 GrPrimitiveProcessor() |
212 : fNumAttribs(0) | 231 : fNumAttribs(0) |
213 , fVertexStride(0) | 232 , fVertexStride(0) {} |
214 , fIsPathRendering(isPathRendering) {} | |
215 | 233 |
216 Attribute fAttribs[kMaxVertexAttribs]; | 234 Attribute fAttribs[kMaxVertexAttribs]; |
217 int fNumAttribs; | 235 int fNumAttribs; |
218 size_t fVertexStride; | 236 size_t fVertexStride; |
219 | 237 |
220 private: | 238 private: |
221 void notifyRefCntIsZero() const final {}; | 239 void notifyRefCntIsZero() const final {}; |
222 virtual bool hasExplicitLocalCoords() const = 0; | 240 virtual bool hasExplicitLocalCoords() const = 0; |
223 | 241 |
224 bool fIsPathRendering; | |
225 | |
226 typedef GrProcessor INHERITED; | 242 typedef GrProcessor INHERITED; |
227 }; | 243 }; |
228 | 244 |
229 #endif | 245 #endif |
OLD | NEW |