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

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

Issue 25474006: Move VertexBuilder to a GrGLFullShaderBuilder subclass (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
OLDNEW
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 GrGLEffect_DEFINED 8 #ifndef GrGLEffect_DEFINED
9 #define GrGLEffect_DEFINED 9 #define GrGLEffect_DEFINED
10 10
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 color (or coverage). 66 color (or coverage).
67 @param inputColor A vec4 that holds the input color to the stage in th e FS. This may be 67 @param inputColor A vec4 that holds the input color to the stage in th e FS. This may be
68 NULL in which case the implied input is solid white (all ones). 68 NULL in which case the implied input is solid white (all ones).
69 TODO: Better system for communicating optimization i nfo (e.g. input 69 TODO: Better system for communicating optimization i nfo (e.g. input
70 color is solid white, trans black, known to be opaqu e, etc.) that allows 70 color is solid white, trans black, known to be opaqu e, etc.) that allows
71 the effect to communicate back similar known info ab out its output. 71 the effect to communicate back similar known info ab out its output.
72 @param samplers One entry for each GrTextureAccess of the GrEffect t hat generated the 72 @param samplers One entry for each GrTextureAccess of the GrEffect t hat generated the
73 GrGLEffect. These can be passed to the builder to em it texture 73 GrGLEffect. These can be passed to the builder to em it texture
74 reads in the generated code. 74 reads in the generated code.
75 */ 75 */
76 virtual void emitCode(GrGLFullShaderBuilder* builder,
77 const GrDrawEffect& drawEffect,
78 EffectKey key,
79 const char* outputColor,
80 const char* inputColor,
81 const TransformedCoordsArray& coords,
82 const TextureSamplerArray& samplers) {
83 GrGLShaderBuilder* baseBuilder = builder;
84 this->emitCode(baseBuilder, drawEffect, key, outputColor, inputColor, co ords, samplers);
85 }
86
76 virtual void emitCode(GrGLShaderBuilder* builder, 87 virtual void emitCode(GrGLShaderBuilder* builder,
77 const GrDrawEffect& drawEffect, 88 const GrDrawEffect& drawEffect,
78 EffectKey key, 89 EffectKey key,
79 const char* outputColor, 90 const char* outputColor,
80 const char* inputColor, 91 const char* inputColor,
81 const TransformedCoordsArray& coords, 92 const TransformedCoordsArray& coords,
82 const TextureSamplerArray& samplers) = 0; 93 const TextureSamplerArray& samplers) = 0;
83 94
84 /** A GrGLEffect instance can be reused with any GrEffect that produces the same stage 95 /** A GrGLEffect instance can be reused with any GrEffect that produces the same stage
85 key; this function reads data from a stage and uploads any uniform varia bles required 96 key; this function reads data from a stage and uploads any uniform varia bles required
86 by the shaders created in emitCode(). The GrEffect installed in the GrEf fectStage is 97 by the shaders created in emitCode(). The GrEffect installed in the GrEf fectStage is
87 guaranteed to be of the same type that created this GrGLEffect and to ha ve an identical 98 guaranteed to be of the same type that created this GrGLEffect and to ha ve an identical
88 EffectKey as the one that created this GrGLEffect. Effects that use loca l coords have 99 EffectKey as the one that created this GrGLEffect. Effects that use loca l coords have
89 to consider whether the GrEffectStage's coord change matrix should be us ed. When explicit 100 to consider whether the GrEffectStage's coord change matrix should be us ed. When explicit
90 local coordinates are used it can be ignored. */ 101 local coordinates are used it can be ignored. */
91 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) {} 102 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) {}
92 103
93 const char* name() const { return fFactory.name(); } 104 const char* name() const { return fFactory.name(); }
94 105
95 static inline EffectKey GenKey(const GrDrawEffect&, const GrGLCaps&) { retur n 0; } 106 static inline EffectKey GenKey(const GrDrawEffect&, const GrGLCaps&) { retur n 0; }
96 107
97 protected: 108 protected:
98 const GrBackendEffectFactory& fFactory; 109 const GrBackendEffectFactory& fFactory;
99 }; 110 };
100 111
112 ////////////////////////////////////////////////////////////////////////////////
113
114 class GrGLVertexEffect : public GrGLEffect {
115 public:
116 GrGLVertexEffect(const GrBackendEffectFactory& factory) : INHERITED(factory) {}
117
118 virtual void emitCode(GrGLFullShaderBuilder* builder,
119 const GrDrawEffect& drawEffect,
120 EffectKey key,
121 const char* outputColor,
122 const char* inputColor,
123 const TransformedCoordsArray& coords,
124 const TextureSamplerArray& samplers) SK_OVERRIDE = 0;
125
126 virtual void emitCode(GrGLShaderBuilder* builder,
bsalomon 2013/10/03 14:44:52 Is this a case where it would make sense to redecl
Chris Dalton 2013/10/03 21:43:22 Done. (It will be enough protection to hide the Gr
127 const GrDrawEffect& drawEffect,
128 EffectKey key,
129 const char* outputColor,
130 const char* inputColor,
131 const TransformedCoordsArray& coords,
132 const TextureSamplerArray& samplers) SK_OVERRIDE {
133 GrCrash("GrGLVertexEffect requires a GrGLFullShaderBuilder in emitCode." );
134 }
135
136 private:
137 typedef GrGLEffect INHERITED;
138 };
139
101 #endif 140 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698