| 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 30 matching lines...) Expand all Loading... |
| 119 class GrGLGeometryProcessor; | 111 class GrGLGeometryProcessor; |
| 120 | 112 |
| 121 /** | 113 /** |
| 122 * Backend processor factory cannot actually create anything, it is up to subcla
sses to implement | 114 * Backend processor factory cannot actually create anything, it is up to subcla
sses to implement |
| 123 * a create binding which matches Gr to GL in a type safe way | 115 * a create binding which matches Gr to GL in a type safe way |
| 124 */ | 116 */ |
| 125 | 117 |
| 126 class GrBackendFragmentProcessorFactory : public GrBackendProcessorFactory { | 118 class GrBackendFragmentProcessorFactory : public GrBackendProcessorFactory { |
| 127 public: | 119 public: |
| 128 /** | 120 /** |
| 121 * Generates an processor's key. The key is based on the aspects of the GrPr
ocessor object's |
| 122 * configuration that affect GLSL code generation. Two GrProcessor instances
that would cause |
| 123 * this->createGLInstance()->emitCode() to produce different code must produ
ce different keys. |
| 124 */ |
| 125 virtual void getGLProcessorKey(const GrFragmentProcessor&, |
| 126 const GrGLCaps&, |
| 127 GrProcessorKeyBuilder*) const = 0; |
| 128 |
| 129 /** |
| 129 * Creates a GrGLProcessor instance that is used both to generate code for t
he GrProcessor in a | 130 * Creates a GrGLProcessor instance that is used both to generate code for t
he GrProcessor in a |
| 130 * GLSL program and to manage updating uniforms for the program when it is u
sed. | 131 * GLSL program and to manage updating uniforms for the program when it is u
sed. |
| 131 */ | 132 */ |
| 132 virtual GrGLFragmentProcessor* createGLInstance(const GrFragmentProcessor&)
const = 0; | 133 virtual GrGLFragmentProcessor* createGLInstance(const GrFragmentProcessor&)
const = 0; |
| 133 }; | 134 }; |
| 134 | 135 |
| 136 class GrBatchTracker; |
| 137 |
| 135 class GrBackendGeometryProcessorFactory : public GrBackendProcessorFactory { | 138 class GrBackendGeometryProcessorFactory : public GrBackendProcessorFactory { |
| 136 public: | 139 public: |
| 137 /** | 140 /** |
| 141 * Generates an processor's key. The key is based on the aspects of the GrPr
ocessor object's |
| 142 * configuration that affect GLSL code generation. Two GrProcessor instances
that would cause |
| 143 * this->createGLInstance()->emitCode() to produce different code must produ
ce different keys. |
| 144 */ |
| 145 virtual void getGLProcessorKey(const GrGeometryProcessor&, |
| 146 const GrBatchTracker&, |
| 147 const GrGLCaps&, |
| 148 GrProcessorKeyBuilder*) const = 0; |
| 149 |
| 150 /** |
| 138 * Creates a GrGLProcessor instance that is used both to generate code for t
he GrProcessor in a | 151 * Creates a GrGLProcessor instance that is used both to generate code for t
he GrProcessor in a |
| 139 * GLSL program and to manage updating uniforms for the program when it is u
sed. | 152 * GLSL program and to manage updating uniforms for the program when it is u
sed. |
| 140 */ | 153 */ |
| 141 virtual GrGLGeometryProcessor* createGLInstance(const GrGeometryProcessor&)
const = 0; | 154 virtual GrGLGeometryProcessor* createGLInstance(const GrGeometryProcessor&, |
| 155 const GrBatchTracker&) const
= 0; |
| 142 }; | 156 }; |
| 143 | 157 |
| 144 #endif | 158 #endif |
| OLD | NEW |