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_State, | |
bsalomon
2016/01/13 19:15:34
The style is that tag after the "_" is the name of
| |
54 // The draw is a "finish" operation which is reading from PLS and writing co lor. | |
55 kFinish_State, | |
56 // The draw does not use PLS. | |
57 kDisabled_State | |
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 { return kDisabled_State; } | |
221 | |
222 /** | |
223 * If non-null, overrides the dest color returned by GrGLSLFragmentShaderBui lder::dstColor(). | |
224 */ | |
225 virtual const char* getDestColorOverride() const { return nullptr; } | |
226 | |
210 protected: | 227 protected: |
211 GrPrimitiveProcessor(bool isPathRendering) | 228 GrPrimitiveProcessor() |
212 : fNumAttribs(0) | 229 : fNumAttribs(0) |
213 , fVertexStride(0) | 230 , fVertexStride(0) {} |
214 , fIsPathRendering(isPathRendering) {} | |
215 | 231 |
216 Attribute fAttribs[kMaxVertexAttribs]; | 232 Attribute fAttribs[kMaxVertexAttribs]; |
217 int fNumAttribs; | 233 int fNumAttribs; |
218 size_t fVertexStride; | 234 size_t fVertexStride; |
219 | 235 |
220 private: | 236 private: |
221 void notifyRefCntIsZero() const final {}; | 237 void notifyRefCntIsZero() const final {}; |
222 virtual bool hasExplicitLocalCoords() const = 0; | 238 virtual bool hasExplicitLocalCoords() const = 0; |
223 | 239 |
224 bool fIsPathRendering; | |
225 | |
226 typedef GrProcessor INHERITED; | 240 typedef GrProcessor INHERITED; |
227 }; | 241 }; |
228 | 242 |
229 #endif | 243 #endif |
OLD | NEW |