OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 GrBackendProcessorFactory_DEFINED | 8 #ifndef GrBackendProcessorFactory_DEFINED |
9 #define GrBackendProcessorFactory_DEFINED | 9 #define GrBackendProcessorFactory_DEFINED |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 * | 61 * |
62 * const GrBackendProcessorFactory& MyProcessor::getFactory() const { | 62 * const GrBackendProcessorFactory& MyProcessor::getFactory() const { |
63 * return GrTBackendProcessorFactory<MyProcessor>::getInstance(); | 63 * return GrTBackendProcessorFactory<MyProcessor>::getInstance(); |
64 * } | 64 * } |
65 * | 65 * |
66 * Using GrTBackendProcessorFactory places a few constraints on the processor. S
ee that class's | 66 * Using GrTBackendProcessorFactory places a few constraints on the processor. S
ee that class's |
67 * comments. | 67 * comments. |
68 */ | 68 */ |
69 class GrBackendProcessorFactory : SkNoncopyable { | 69 class GrBackendProcessorFactory : SkNoncopyable { |
70 public: | 70 public: |
71 /** | |
72 * Generates an processor's key. The key is based on the aspects of the GrPr
ocessor object's | |
73 * configuration that affect GLSL code generation. Two GrProcessor instances
that would cause | |
74 * this->createGLInstance()->emitCode() to produce different code must produ
ce different keys. | |
75 */ | |
76 virtual void getGLProcessorKey(const GrProcessor&, const GrGLCaps&, | |
77 GrProcessorKeyBuilder*) const = 0; | |
78 | |
79 /** | 71 /** |
80 * Produces a human-reable name for the v. | 72 * Produces a human-reable name for the v. |
81 */ | 73 */ |
82 virtual const char* name() const = 0; | 74 virtual const char* name() const = 0; |
83 | 75 |
84 /** | 76 /** |
85 * A unique value for every instance of this factory. It is automatically in
corporated into the | 77 * A unique value for every instance of this factory. It is automatically in
corporated into the |
86 * processor's key. This allows keys generated by getGLProcessorKey() to onl
y be unique within a | 78 * processor's key. This allows keys generated by getGLProcessorKey() to onl
y be unique within a |
87 * GrProcessor subclass and not necessarily across subclasses. | 79 * GrProcessor subclass and not necessarily across subclasses. |
88 */ | 80 */ |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 class GrGLXferProcessor; | 113 class GrGLXferProcessor; |
122 | 114 |
123 /** | 115 /** |
124 * Backend processor factory cannot actually create anything, it is up to subcla
sses to implement | 116 * Backend processor factory cannot actually create anything, it is up to subcla
sses to implement |
125 * a create binding which matches Gr to GL in a type safe way | 117 * a create binding which matches Gr to GL in a type safe way |
126 */ | 118 */ |
127 | 119 |
128 class GrBackendFragmentProcessorFactory : public GrBackendProcessorFactory { | 120 class GrBackendFragmentProcessorFactory : public GrBackendProcessorFactory { |
129 public: | 121 public: |
130 /** | 122 /** |
| 123 * Generates an processor's key. The key is based on the aspects of the GrPr
ocessor object's |
| 124 * configuration that affect GLSL code generation. Two GrProcessor instances
that would cause |
| 125 * this->createGLInstance()->emitCode() to produce different code must produ
ce different keys. |
| 126 */ |
| 127 virtual void getGLProcessorKey(const GrFragmentProcessor&, |
| 128 const GrGLCaps&, |
| 129 GrProcessorKeyBuilder*) const = 0; |
| 130 |
| 131 /** |
131 * Creates a GrGLProcessor instance that is used both to generate code for t
he GrProcessor in a | 132 * Creates a GrGLProcessor instance that is used both to generate code for t
he GrProcessor in a |
132 * GLSL program and to manage updating uniforms for the program when it is u
sed. | 133 * GLSL program and to manage updating uniforms for the program when it is u
sed. |
133 */ | 134 */ |
134 virtual GrGLFragmentProcessor* createGLInstance(const GrFragmentProcessor&)
const = 0; | 135 virtual GrGLFragmentProcessor* createGLInstance(const GrFragmentProcessor&)
const = 0; |
135 }; | 136 }; |
136 | 137 |
137 class GrBackendXferProcessorFactory : public GrBackendProcessorFactory { | 138 class GrBackendXferProcessorFactory : public GrBackendProcessorFactory { |
138 public: | 139 public: |
139 /** | 140 /** |
140 * Creates a GrGLProcessor instance that is used both to generate code for t
he GrProcessor in a | 141 * Creates a GrGLProcessor instance that is used both to generate code for t
he GrProcessor in a |
141 * GLSL program and to manage updating uniforms for the program when it is u
sed. | 142 * GLSL program and to manage updating uniforms for the program when it is u
sed. |
142 */ | 143 */ |
143 virtual GrGLXferProcessor* createGLInstance(const GrXferProcessor&) const =
0; | 144 virtual GrGLXferProcessor* createGLInstance(const GrXferProcessor&) const =
0; |
144 }; | 145 }; |
145 | 146 |
| 147 class GrBatchTracker; |
| 148 |
146 class GrBackendGeometryProcessorFactory : public GrBackendProcessorFactory { | 149 class GrBackendGeometryProcessorFactory : public GrBackendProcessorFactory { |
147 public: | 150 public: |
148 /** | 151 /** |
| 152 * Generates an processor's key. The key is based on the aspects of the GrPr
ocessor object's |
| 153 * configuration that affect GLSL code generation. Two GrProcessor instances
that would cause |
| 154 * this->createGLInstance()->emitCode() to produce different code must produ
ce different keys. |
| 155 */ |
| 156 virtual void getGLProcessorKey(const GrGeometryProcessor&, |
| 157 const GrBatchTracker&, |
| 158 const GrGLCaps&, |
| 159 GrProcessorKeyBuilder*) const = 0; |
| 160 |
| 161 /** |
149 * Creates a GrGLProcessor instance that is used both to generate code for t
he GrProcessor in a | 162 * Creates a GrGLProcessor instance that is used both to generate code for t
he GrProcessor in a |
150 * GLSL program and to manage updating uniforms for the program when it is u
sed. | 163 * GLSL program and to manage updating uniforms for the program when it is u
sed. |
151 */ | 164 */ |
152 virtual GrGLGeometryProcessor* createGLInstance(const GrGeometryProcessor&)
const = 0; | 165 virtual GrGLGeometryProcessor* createGLInstance(const GrGeometryProcessor&, |
| 166 const GrBatchTracker&) const
= 0; |
153 }; | 167 }; |
154 | 168 |
155 #endif | 169 #endif |
OLD | NEW |