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 | |
60 /* | 50 /* |
61 * This class allows the GrPipeline to communicate information about the pipelin
e to a | 51 * This class allows the GrPipeline to communicate information about the pipelin
e to a |
62 * GrBatch which should be forwarded to the GrPrimitiveProcessor(s) created by t
he batch. | 52 * GrBatch which should be forwarded to the GrPrimitiveProcessor(s) created by t
he batch. |
63 * These are not properly part of the pipeline because they assume the specific
inputs | 53 * These are not properly part of the pipeline because they assume the specific
inputs |
64 * that the batch provided when it created the pipeline. Identical pipelines may
be | 54 * that the batch provided when it created the pipeline. Identical pipelines may
be |
65 * created by different batches with different input assumptions and therefore d
ifferent | 55 * created by different batches with different input assumptions and therefore d
ifferent |
66 * computed optimizations. It is the batch-specific optimizations that allow the
pipelines | 56 * computed optimizations. It is the batch-specific optimizations that allow the
pipelines |
67 * to be equal. | 57 * to be equal. |
68 */ | 58 */ |
69 class GrXPOverridesForBatch { | 59 class GrXPOverridesForBatch { |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 */ | 192 */ |
203 virtual void getGLSLProcessorKey(const GrGLSLCaps& caps, | 193 virtual void getGLSLProcessorKey(const GrGLSLCaps& caps, |
204 GrProcessorKeyBuilder* b) const = 0; | 194 GrProcessorKeyBuilder* b) const = 0; |
205 | 195 |
206 | 196 |
207 /** Returns a new instance of the appropriate *GL* implementation class | 197 /** Returns a new instance of the appropriate *GL* implementation class |
208 for the given GrProcessor; caller is responsible for deleting | 198 for the given GrProcessor; caller is responsible for deleting |
209 the object. */ | 199 the object. */ |
210 virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps& caps)
const = 0; | 200 virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps& caps)
const = 0; |
211 | 201 |
212 virtual bool isPathRendering() const { return false; } | 202 bool isPathRendering() const { return fIsPathRendering; } |
213 | 203 |
214 /** | 204 /** |
215 * No Local Coord Transformation is needed in the shader, instead transforme
d local coords will | 205 * No Local Coord Transformation is needed in the shader, instead transforme
d local coords will |
216 * be provided via vertex attribute. | 206 * be provided via vertex attribute. |
217 */ | 207 */ |
218 virtual bool hasTransformedLocalCoords() const = 0; | 208 virtual bool hasTransformedLocalCoords() const = 0; |
219 | 209 |
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 | |
229 protected: | 210 protected: |
230 GrPrimitiveProcessor() | 211 GrPrimitiveProcessor(bool isPathRendering) |
231 : fNumAttribs(0) | 212 : fNumAttribs(0) |
232 , fVertexStride(0) {} | 213 , fVertexStride(0) |
| 214 , fIsPathRendering(isPathRendering) {} |
233 | 215 |
234 Attribute fAttribs[kMaxVertexAttribs]; | 216 Attribute fAttribs[kMaxVertexAttribs]; |
235 int fNumAttribs; | 217 int fNumAttribs; |
236 size_t fVertexStride; | 218 size_t fVertexStride; |
237 | 219 |
238 private: | 220 private: |
239 void notifyRefCntIsZero() const final {}; | 221 void notifyRefCntIsZero() const final {}; |
240 virtual bool hasExplicitLocalCoords() const = 0; | 222 virtual bool hasExplicitLocalCoords() const = 0; |
241 | 223 |
| 224 bool fIsPathRendering; |
| 225 |
242 typedef GrProcessor INHERITED; | 226 typedef GrProcessor INHERITED; |
243 }; | 227 }; |
244 | 228 |
245 #endif | 229 #endif |
OLD | NEW |