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 GrGLProcessor_DEFINED | 8 #ifndef GrGLProcessor_DEFINED |
9 #define GrGLProcessor_DEFINED | 9 #define GrGLProcessor_DEFINED |
10 | 10 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) {} | 80 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) {} |
81 | 81 |
82 const char* name() const { return fFactory.name(); } | 82 const char* name() const { return fFactory.name(); } |
83 | 83 |
84 static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilde
r*) {} | 84 static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilde
r*) {} |
85 | 85 |
86 protected: | 86 protected: |
87 const GrBackendProcessorFactory& fFactory; | 87 const GrBackendProcessorFactory& fFactory; |
88 }; | 88 }; |
89 | 89 |
| 90 class GrGLFPBuilder; |
| 91 |
90 class GrGLFragmentProcessor : public GrGLProcessor { | 92 class GrGLFragmentProcessor : public GrGLProcessor { |
91 public: | 93 public: |
92 GrGLFragmentProcessor(const GrBackendProcessorFactory& factory) | 94 GrGLFragmentProcessor(const GrBackendProcessorFactory& factory) |
93 : INHERITED(factory) { | 95 : INHERITED(factory) { |
94 } | 96 } |
95 | 97 |
96 virtual ~GrGLFragmentProcessor() {} | 98 virtual ~GrGLFragmentProcessor() {} |
97 | 99 |
98 /** Called when the program stage should insert its code into the shaders. T
he code in each | 100 /** Called when the program stage should insert its code into the shaders. T
he code in each |
99 shader will be in its own block ({}) and so locally scoped names will no
t collide across | 101 shader will be in its own block ({}) and so locally scoped names will no
t collide across |
100 stages. | 102 stages. |
101 | 103 |
102 @param builder Interface used to emit code in the shaders. | 104 @param builder Interface used to emit code in the shaders. |
103 @param effect The effect that generated this program stage. | 105 @param effect The effect that generated this program stage. |
104 @param key The key that was computed by GenKey() from the gener
ating GrProcessor. | 106 @param key The key that was computed by GenKey() from the gener
ating GrProcessor. |
105 @param outputColor A predefined vec4 in the FS in which the stage shoul
d place its output | 107 @param outputColor A predefined vec4 in the FS in which the stage shoul
d place its output |
106 color (or coverage). | 108 color (or coverage). |
107 @param inputColor A vec4 that holds the input color to the stage in th
e FS. This may be | 109 @param inputColor A vec4 that holds the input color to the stage in th
e FS. This may be |
108 NULL in which case the implied input is solid white
(all ones). | 110 NULL in which case the implied input is solid white
(all ones). |
109 TODO: Better system for communicating optimization i
nfo (e.g. input | 111 TODO: Better system for communicating optimization i
nfo (e.g. input |
110 color is solid white, trans black, known to be opaqu
e, etc.) that allows | 112 color is solid white, trans black, known to be opaqu
e, etc.) that allows |
111 the effect to communicate back similar known info ab
out its output. | 113 the effect to communicate back similar known info ab
out its output. |
112 @param samplers Contains one entry for each GrTextureAccess of the G
rProcessor. These | 114 @param samplers Contains one entry for each GrTextureAccess of the G
rProcessor. These |
113 can be passed to the builder to emit texture reads i
n the generated | 115 can be passed to the builder to emit texture reads i
n the generated |
114 code. | 116 code. |
115 */ | 117 */ |
116 virtual void emitCode(GrGLProgramBuilder* builder, | 118 virtual void emitCode(GrGLFPBuilder* builder, |
117 const GrFragmentProcessor& effect, | 119 const GrFragmentProcessor& effect, |
118 const GrProcessorKey& key, | 120 const GrProcessorKey& key, |
119 const char* outputColor, | 121 const char* outputColor, |
120 const char* inputColor, | 122 const char* inputColor, |
121 const TransformedCoordsArray& coords, | 123 const TransformedCoordsArray& coords, |
122 const TextureSamplerArray& samplers) = 0; | 124 const TextureSamplerArray& samplers) = 0; |
123 | 125 |
124 private: | 126 private: |
125 typedef GrGLProcessor INHERITED; | 127 typedef GrGLProcessor INHERITED; |
126 }; | 128 }; |
127 | 129 |
128 #endif | 130 #endif |
OLD | NEW |