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 25 matching lines...) Expand all Loading... |
36 * In a deferred geometry world, the GrPrimitiveProcessor can always 'batch' To
do this, each | 36 * In a deferred geometry world, the GrPrimitiveProcessor can always 'batch' To
do this, each |
37 * primitive type is associated with one GrPrimitiveProcessor, who has complete
control of how | 37 * primitive type is associated with one GrPrimitiveProcessor, who has complete
control of how |
38 * it draws. Each primitive draw will bundle all required data to perform the d
raw, and these | 38 * it draws. Each primitive draw will bundle all required data to perform the d
raw, and these |
39 * bundles of data will be owned by an instance of the associated GrPrimitivePro
cessor. Bundles | 39 * bundles of data will be owned by an instance of the associated GrPrimitivePro
cessor. Bundles |
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 GrGLPrimitiveProcessor; | 46 class GrGLSLPrimitiveProcessor; |
47 | 47 |
48 struct GrInitInvariantOutput; | 48 struct GrInitInvariantOutput; |
49 | 49 |
50 /* | 50 /* |
51 * 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 |
52 * 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. |
53 * 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 |
54 * 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 |
55 * 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 |
56 * 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 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 * | 190 * |
191 * TODO: A better name for this function would be "compute" instead of "get
". | 191 * TODO: A better name for this function would be "compute" instead of "get
". |
192 */ | 192 */ |
193 virtual void getGLProcessorKey(const GrGLSLCaps& caps, | 193 virtual void getGLProcessorKey(const GrGLSLCaps& caps, |
194 GrProcessorKeyBuilder* b) const = 0; | 194 GrProcessorKeyBuilder* b) const = 0; |
195 | 195 |
196 | 196 |
197 /** Returns a new instance of the appropriate *GL* implementation class | 197 /** Returns a new instance of the appropriate *GL* implementation class |
198 for the given GrProcessor; caller is responsible for deleting | 198 for the given GrProcessor; caller is responsible for deleting |
199 the object. */ | 199 the object. */ |
200 virtual GrGLPrimitiveProcessor* createGLInstance(const GrGLSLCaps& caps) con
st = 0; | 200 virtual GrGLSLPrimitiveProcessor* createGLInstance(const GrGLSLCaps& caps) c
onst = 0; |
201 | 201 |
202 bool isPathRendering() const { return fIsPathRendering; } | 202 bool isPathRendering() const { return fIsPathRendering; } |
203 | 203 |
204 /** | 204 /** |
205 * 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 |
206 * be provided via vertex attribute. | 206 * be provided via vertex attribute. |
207 */ | 207 */ |
208 virtual bool hasTransformedLocalCoords() const = 0; | 208 virtual bool hasTransformedLocalCoords() const = 0; |
209 | 209 |
210 protected: | 210 protected: |
211 GrPrimitiveProcessor(bool isPathRendering) | 211 GrPrimitiveProcessor(bool isPathRendering) |
212 : fNumAttribs(0) | 212 : fNumAttribs(0) |
213 , fVertexStride(0) | 213 , fVertexStride(0) |
214 , fIsPathRendering(isPathRendering) {} | 214 , fIsPathRendering(isPathRendering) {} |
215 | 215 |
216 Attribute fAttribs[kMaxVertexAttribs]; | 216 Attribute fAttribs[kMaxVertexAttribs]; |
217 int fNumAttribs; | 217 int fNumAttribs; |
218 size_t fVertexStride; | 218 size_t fVertexStride; |
219 | 219 |
220 private: | 220 private: |
221 void notifyRefCntIsZero() const final {}; | 221 void notifyRefCntIsZero() const final {}; |
222 virtual bool hasExplicitLocalCoords() const = 0; | 222 virtual bool hasExplicitLocalCoords() const = 0; |
223 | 223 |
224 bool fIsPathRendering; | 224 bool fIsPathRendering; |
225 | 225 |
226 typedef GrProcessor INHERITED; | 226 typedef GrProcessor INHERITED; |
227 }; | 227 }; |
228 | 228 |
229 #endif | 229 #endif |
OLD | NEW |