| 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 |
| 71 /** | 79 /** |
| 72 * Produces a human-reable name for the v. | 80 * Produces a human-reable name for the v. |
| 73 */ | 81 */ |
| 74 virtual const char* name() const = 0; | 82 virtual const char* name() const = 0; |
| 75 | 83 |
| 76 /** | 84 /** |
| 77 * A unique value for every instance of this factory. It is automatically in
corporated into the | 85 * A unique value for every instance of this factory. It is automatically in
corporated into the |
| 78 * processor's key. This allows keys generated by getGLProcessorKey() to onl
y be unique within a | 86 * processor's key. This allows keys generated by getGLProcessorKey() to onl
y be unique within a |
| 79 * GrProcessor subclass and not necessarily across subclasses. | 87 * GrProcessor subclass and not necessarily across subclasses. |
| 80 */ | 88 */ |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 class GrGLXferProcessor; | 121 class GrGLXferProcessor; |
| 114 | 122 |
| 115 /** | 123 /** |
| 116 * Backend processor factory cannot actually create anything, it is up to subcla
sses to implement | 124 * Backend processor factory cannot actually create anything, it is up to subcla
sses to implement |
| 117 * a create binding which matches Gr to GL in a type safe way | 125 * a create binding which matches Gr to GL in a type safe way |
| 118 */ | 126 */ |
| 119 | 127 |
| 120 class GrBackendFragmentProcessorFactory : public GrBackendProcessorFactory { | 128 class GrBackendFragmentProcessorFactory : public GrBackendProcessorFactory { |
| 121 public: | 129 public: |
| 122 /** | 130 /** |
| 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 /** | |
| 132 * Creates a GrGLProcessor instance that is used both to generate code for t
he GrProcessor in a | 131 * Creates a GrGLProcessor instance that is used both to generate code for t
he GrProcessor in a |
| 133 * GLSL program and to manage updating uniforms for the program when it is u
sed. | 132 * GLSL program and to manage updating uniforms for the program when it is u
sed. |
| 134 */ | 133 */ |
| 135 virtual GrGLFragmentProcessor* createGLInstance(const GrFragmentProcessor&)
const = 0; | 134 virtual GrGLFragmentProcessor* createGLInstance(const GrFragmentProcessor&)
const = 0; |
| 136 }; | 135 }; |
| 137 | 136 |
| 138 class GrBackendXferProcessorFactory : public GrBackendProcessorFactory { | 137 class GrBackendXferProcessorFactory : public GrBackendProcessorFactory { |
| 139 public: | 138 public: |
| 140 /** | 139 /** |
| 141 * Creates a GrGLProcessor instance that is used both to generate code for t
he GrProcessor in a | 140 * Creates a GrGLProcessor instance that is used both to generate code for t
he GrProcessor in a |
| 142 * GLSL program and to manage updating uniforms for the program when it is u
sed. | 141 * GLSL program and to manage updating uniforms for the program when it is u
sed. |
| 143 */ | 142 */ |
| 144 virtual GrGLXferProcessor* createGLInstance(const GrXferProcessor&) const =
0; | 143 virtual GrGLXferProcessor* createGLInstance(const GrXferProcessor&) const =
0; |
| 145 }; | 144 }; |
| 146 | 145 |
| 147 class GrBatchTracker; | |
| 148 | |
| 149 class GrBackendGeometryProcessorFactory : public GrBackendProcessorFactory { | 146 class GrBackendGeometryProcessorFactory : public GrBackendProcessorFactory { |
| 150 public: | 147 public: |
| 151 /** | 148 /** |
| 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 /** | |
| 162 * Creates a GrGLProcessor instance that is used both to generate code for t
he GrProcessor in a | 149 * Creates a GrGLProcessor instance that is used both to generate code for t
he GrProcessor in a |
| 163 * GLSL program and to manage updating uniforms for the program when it is u
sed. | 150 * GLSL program and to manage updating uniforms for the program when it is u
sed. |
| 164 */ | 151 */ |
| 165 virtual GrGLGeometryProcessor* createGLInstance(const GrGeometryProcessor&, | 152 virtual GrGLGeometryProcessor* createGLInstance(const GrGeometryProcessor&)
const = 0; |
| 166 const GrBatchTracker&) const
= 0; | |
| 167 }; | 153 }; |
| 168 | 154 |
| 169 #endif | 155 #endif |
| OLD | NEW |