Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: src/gpu/gl/GrGLProgramEffects.h

Issue 26190003: Potentially optimize some GrGLEffects for known input color values (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/gpu/gl/GrGLEffect.h ('k') | src/gpu/gl/GrGLProgramEffects.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 GrGLProgramEffects_DEFINED 8 #ifndef GrGLProgramEffects_DEFINED
9 #define GrGLProgramEffects_DEFINED 9 #define GrGLProgramEffects_DEFINED
10 10
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 * This is an abstract base class for constructing different types of GrGLProgra mEffects objects. 128 * This is an abstract base class for constructing different types of GrGLProgra mEffects objects.
129 */ 129 */
130 class GrGLProgramEffectsBuilder { 130 class GrGLProgramEffectsBuilder {
131 public: 131 public:
132 /** 132 /**
133 * Emits the effect's shader code, and stores the necessary uniforms interna lly. 133 * Emits the effect's shader code, and stores the necessary uniforms interna lly.
134 */ 134 */
135 virtual void emitEffect(const GrEffectStage&, 135 virtual void emitEffect(const GrEffectStage&,
136 GrGLProgramEffects::EffectKey, 136 GrGLProgramEffects::EffectKey,
137 const char* outColor, 137 const char* outColor,
138 const char* inColor, 138 const GrGLSLExpr4& inColor,
139 int stageIndex) = 0; 139 int stageIndex) = 0;
140 }; 140 };
141 141
142 //////////////////////////////////////////////////////////////////////////////// 142 ////////////////////////////////////////////////////////////////////////////////
143 143
144 /** 144 /**
145 * This is a GrGLProgramEffects implementation that does coord transforms with t he vertex shader. 145 * This is a GrGLProgramEffects implementation that does coord transforms with t he vertex shader.
146 */ 146 */
147 class GrGLVertexProgramEffects : public GrGLProgramEffects { 147 class GrGLVertexProgramEffects : public GrGLProgramEffects {
148 public: 148 public:
(...skipping 11 matching lines...) Expand all
160 } 160 }
161 161
162 /** 162 /**
163 * Helper for GrGLProgramEffectsBuilder::emitEfffect(). This method is meant to only be called 163 * Helper for GrGLProgramEffectsBuilder::emitEfffect(). This method is meant to only be called
164 * during the construction phase. 164 * during the construction phase.
165 */ 165 */
166 void emitEffect(GrGLFullShaderBuilder*, 166 void emitEffect(GrGLFullShaderBuilder*,
167 const GrEffectStage&, 167 const GrEffectStage&,
168 GrGLProgramEffects::EffectKey, 168 GrGLProgramEffects::EffectKey,
169 const char* outColor, 169 const char* outColor,
170 const char* inColor, 170 const GrGLSLExpr4& inColor,
171 int stageIndex); 171 int stageIndex);
172 172
173 /** 173 /**
174 * Helper for emitEffect(). Emits any attributes an effect may have. 174 * Helper for emitEffect(). Emits any attributes an effect may have.
175 */ 175 */
176 void emitAttributes(GrGLFullShaderBuilder*, const GrEffectStage&); 176 void emitAttributes(GrGLFullShaderBuilder*, const GrEffectStage&);
177 177
178 /** 178 /**
179 * Helper for emitEffect(). Emits code to implement an effect's coord transf orms in the VS. 179 * Helper for emitEffect(). Emits code to implement an effect's coord transf orms in the VS.
180 * Varyings are added as an outputs of the VS and inputs to the FS. The vary ings may be either a 180 * Varyings are added as an outputs of the VS and inputs to the FS. The vary ings may be either a
(...skipping 27 matching lines...) Expand all
208 /** 208 /**
209 * This class is used to construct a GrGLVertexProgramEffects* object. 209 * This class is used to construct a GrGLVertexProgramEffects* object.
210 */ 210 */
211 class GrGLVertexProgramEffectsBuilder : public GrGLProgramEffectsBuilder { 211 class GrGLVertexProgramEffectsBuilder : public GrGLProgramEffectsBuilder {
212 public: 212 public:
213 GrGLVertexProgramEffectsBuilder(GrGLFullShaderBuilder*, int reserveCount); 213 GrGLVertexProgramEffectsBuilder(GrGLFullShaderBuilder*, int reserveCount);
214 214
215 virtual void emitEffect(const GrEffectStage&, 215 virtual void emitEffect(const GrEffectStage&,
216 GrGLProgramEffects::EffectKey, 216 GrGLProgramEffects::EffectKey,
217 const char* outColor, 217 const char* outColor,
218 const char* inColor, 218 const GrGLSLExpr4& inColor,
219 int stageIndex) SK_OVERRIDE; 219 int stageIndex) SK_OVERRIDE;
220 220
221 /** 221 /**
222 * Finalizes the building process and returns the effect array. After this c all, the builder 222 * Finalizes the building process and returns the effect array. After this c all, the builder
223 * becomes invalid. 223 * becomes invalid.
224 */ 224 */
225 GrGLProgramEffects* finish() { return fProgramEffects.detach(); } 225 GrGLProgramEffects* finish() { return fProgramEffects.detach(); }
226 226
227 private: 227 private:
228 GrGLFullShaderBuilder* fBuilder; 228 GrGLFullShaderBuilder* fBuilder;
(...skipping 23 matching lines...) Expand all
252 } 252 }
253 253
254 /** 254 /**
255 * Helper for GrGLProgramEffectsBuilder::emitEfffect(). This method is meant to only be called 255 * Helper for GrGLProgramEffectsBuilder::emitEfffect(). This method is meant to only be called
256 * during the construction phase. 256 * during the construction phase.
257 */ 257 */
258 void emitEffect(GrGLFragmentOnlyShaderBuilder*, 258 void emitEffect(GrGLFragmentOnlyShaderBuilder*,
259 const GrEffectStage&, 259 const GrEffectStage&,
260 GrGLProgramEffects::EffectKey, 260 GrGLProgramEffects::EffectKey,
261 const char* outColor, 261 const char* outColor,
262 const char* inColor, 262 const GrGLSLExpr4& inColor,
263 int stageIndex); 263 int stageIndex);
264 264
265 /** 265 /**
266 * Helper for emitEffect(). Allocates texture units from the builder for eac h transform in an 266 * Helper for emitEffect(). Allocates texture units from the builder for eac h transform in an
267 * effect. The transforms all use adjacent texture units. They either use tw o or three of the 267 * effect. The transforms all use adjacent texture units. They either use tw o or three of the
268 * coordinates at a given texture unit, depending on if they need perspectiv e interpolation. 268 * coordinates at a given texture unit, depending on if they need perspectiv e interpolation.
269 * The expressions to access the transformed coords (i.e. 'vec2(gl_TexCoord[ 0])') as well as the 269 * The expressions to access the transformed coords (i.e. 'vec2(gl_TexCoord[ 0])') as well as the
270 * types are appended to the TransformedCoordsArray* object, which is in tur n passed to the 270 * types are appended to the TransformedCoordsArray* object, which is in tur n passed to the
271 * effect's emitCode() function. 271 * effect's emitCode() function.
272 */ 272 */
(...skipping 22 matching lines...) Expand all
295 /** 295 /**
296 * This class is used to construct a GrGLTexGenProgramEffects* object. 296 * This class is used to construct a GrGLTexGenProgramEffects* object.
297 */ 297 */
298 class GrGLTexGenProgramEffectsBuilder : public GrGLProgramEffectsBuilder { 298 class GrGLTexGenProgramEffectsBuilder : public GrGLProgramEffectsBuilder {
299 public: 299 public:
300 GrGLTexGenProgramEffectsBuilder(GrGLFragmentOnlyShaderBuilder*, int reserveC ount); 300 GrGLTexGenProgramEffectsBuilder(GrGLFragmentOnlyShaderBuilder*, int reserveC ount);
301 301
302 virtual void emitEffect(const GrEffectStage&, 302 virtual void emitEffect(const GrEffectStage&,
303 GrGLProgramEffects::EffectKey, 303 GrGLProgramEffects::EffectKey,
304 const char* outColor, 304 const char* outColor,
305 const char* inColor, 305 const GrGLSLExpr4& inColor,
306 int stageIndex) SK_OVERRIDE; 306 int stageIndex) SK_OVERRIDE;
307 307
308 /** 308 /**
309 * Finalizes the building process and returns the effect array. After this c all, the builder 309 * Finalizes the building process and returns the effect array. After this c all, the builder
310 * becomes invalid. 310 * becomes invalid.
311 */ 311 */
312 GrGLProgramEffects* finish() { return fProgramEffects.detach(); } 312 GrGLProgramEffects* finish() { return fProgramEffects.detach(); }
313 313
314 private: 314 private:
315 GrGLFragmentOnlyShaderBuilder* fBuilder; 315 GrGLFragmentOnlyShaderBuilder* fBuilder;
316 SkAutoTDelete<GrGLTexGenProgramEffects> fProgramEffects; 316 SkAutoTDelete<GrGLTexGenProgramEffects> fProgramEffects;
317 317
318 typedef GrGLProgramEffectsBuilder INHERITED; 318 typedef GrGLProgramEffectsBuilder INHERITED;
319 }; 319 };
320 320
321 #endif 321 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLEffect.h ('k') | src/gpu/gl/GrGLProgramEffects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698