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. | 50 // Describes the state of pixel local storage with respect to the current draw. |
51 enum GrPixelLocalStorageState { | 51 enum GrPixelLocalStorageState { |
52 // The draw is actively updating PLS. | 52 // The draw is actively updating PLS. |
53 kDraw_GrPixelLocalStorageState, | 53 kDraw_GrPixelLocalStorageState, |
54 // The draw is a "finish" operation which is reading from PLS and writing co
lor. | 54 // The draw is a "finish" operation which is reading from PLS and writing co
lor. |
55 kFinish_GrPixelLocalStorageState, | 55 kFinish_GrPixelLocalStorageState, |
56 // The draw does not use PLS. | 56 // The draw does not use PLS. |
57 kDisabled_GrPixelLocalStorageState | 57 kDisabled_GrPixelLocalStorageState |
58 }; | 58 }; |
59 | 59 |
60 /* | 60 /* |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps& caps)
const = 0; | 201 virtual GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps& caps)
const = 0; |
202 | 202 |
203 virtual bool isPathRendering() const { return false; } | 203 virtual bool isPathRendering() const { return false; } |
204 | 204 |
205 /** | 205 /** |
206 * No Local Coord Transformation is needed in the shader, instead transforme
d local coords will | 206 * No Local Coord Transformation is needed in the shader, instead transforme
d local coords will |
207 * be provided via vertex attribute. | 207 * be provided via vertex attribute. |
208 */ | 208 */ |
209 virtual bool hasTransformedLocalCoords() const = 0; | 209 virtual bool hasTransformedLocalCoords() const = 0; |
210 | 210 |
211 virtual GrPixelLocalStorageState getPixelLocalStorageState() const { | 211 virtual GrPixelLocalStorageState getPixelLocalStorageState() const { |
212 return kDisabled_GrPixelLocalStorageState; | 212 return kDisabled_GrPixelLocalStorageState; |
213 } | 213 } |
214 | 214 |
215 /** | 215 /** |
216 * If non-null, overrides the dest color returned by GrGLSLFragmentShaderBui
lder::dstColor(). | 216 * If non-null, overrides the dest color returned by GrGLSLFragmentShaderBui
lder::dstColor(). |
217 */ | 217 */ |
218 virtual const char* getDestColorOverride() const { return nullptr; } | 218 virtual const char* getDestColorOverride() const { return nullptr; } |
219 | 219 |
220 virtual float getSampleShading() const { | 220 virtual float getSampleShading() const { |
221 return 0.0; | 221 return 0.0; |
222 } | 222 } |
223 | 223 |
224 protected: | 224 protected: |
225 GrPrimitiveProcessor() : fVertexStride(0) {} | 225 GrPrimitiveProcessor() : fVertexStride(0) {} |
226 | 226 |
227 enum { kPreallocAttribCnt = 8 }; | 227 enum { kPreallocAttribCnt = 8 }; |
228 SkSTArray<kPreallocAttribCnt, Attribute> fAttribs; | 228 SkSTArray<kPreallocAttribCnt, Attribute> fAttribs; |
229 size_t fVertexStride; | 229 size_t fVertexStride; |
230 | 230 |
231 private: | 231 private: |
232 void notifyRefCntIsZero() const final {}; | 232 void notifyRefCntIsZero() const final {}; |
233 virtual bool hasExplicitLocalCoords() const = 0; | 233 virtual bool hasExplicitLocalCoords() const = 0; |
234 | 234 |
235 typedef GrProcessor INHERITED; | 235 typedef GrProcessor INHERITED; |
236 }; | 236 }; |
237 | 237 |
238 #endif | 238 #endif |
OLD | NEW |