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

Side by Side Diff: src/gpu/glsl/GrGLSLProgramBuilder.h

Issue 1457543003: Add ShaderBuilders to EmitArgs and remove gettings from ProgBuilder. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « src/gpu/glsl/GrGLSLPrimitiveProcessor.cpp ('k') | src/gpu/glsl/GrGLSLXferProcessor.h » ('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 2015 Google Inc. 2 * Copyright 2015 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 GrGLSLProgramBuilder_DEFINED 8 #ifndef GrGLSLProgramBuilder_DEFINED
9 #define GrGLSLProgramBuilder_DEFINED 9 #define GrGLSLProgramBuilder_DEFINED
10 10
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 const char* output) = 0; 158 const char* output) = 0;
159 159
160 /* 160 /*
161 * Creates a fragment shader varying that can be referred to. 161 * Creates a fragment shader varying that can be referred to.
162 * Comparable to GrGLSLUniformBuilder::addUniform(). 162 * Comparable to GrGLSLUniformBuilder::addUniform().
163 */ 163 */
164 virtual SeparableVaryingHandle addSeparableVarying( 164 virtual SeparableVaryingHandle addSeparableVarying(
165 const char* name, GrGLSLVertToFrag*, 165 const char* name, GrGLSLVertToFrag*,
166 GrSLPrecision fsPrecision = kDefault_GrSLPrecision) = 0; 166 GrSLPrecision fsPrecision = kDefault_GrSLPrecision) = 0;
167 167
168 // TODO rename getFragmentBuilder
169 virtual GrGLSLFragmentBuilder* getFragmentShaderBuilder() = 0;
170 virtual GrGLSLVertexBuilder* getVertexShaderBuilder() = 0;
171
172 /* 168 /*
173 * *NOTE* NO MEMBERS ALLOWED, MULTIPLE INHERITANCE 169 * *NOTE* NO MEMBERS ALLOWED, MULTIPLE INHERITANCE
174 */ 170 */
175 }; 171 };
176 172
177 173
178 /* a specializations for FPs. Lets the user add uniforms and FS code */ 174 /* a specializations for FPs. Lets the user add uniforms and FS code */
179 class GrGLSLFPBuilder : public virtual GrGLSLUniformBuilder { 175 class GrGLSLFPBuilder : public virtual GrGLSLUniformBuilder {
180 public: 176 public:
181 virtual GrGLSLFragmentBuilder* getFragmentShaderBuilder() = 0;
182
183 /* 177 /*
184 * *NOTE* NO MEMBERS ALLOWED, MULTIPLE INHERITANCE 178 * *NOTE* NO MEMBERS ALLOWED, MULTIPLE INHERITANCE
185 */ 179 */
186 }; 180 };
187 181
188 /* a specializations for XPs. Lets the user add uniforms and FS code */ 182 /* a specializations for XPs. Lets the user add uniforms and FS code */
189 class GrGLSLXPBuilder : public virtual GrGLSLUniformBuilder { 183 class GrGLSLXPBuilder : public virtual GrGLSLUniformBuilder {
190 public: 184 public:
191 virtual GrGLSLXPFragmentBuilder* getFragmentShaderBuilder() = 0;
192
193 /* 185 /*
194 * *NOTE* NO MEMBERS ALLOWED, MULTIPLE INHERITANCE 186 * *NOTE* NO MEMBERS ALLOWED, MULTIPLE INHERITANCE
195 */ 187 */
196 }; 188 };
197 189
198 class GrGLSLProgramBuilder : public GrGLSLGPBuilder, 190 class GrGLSLProgramBuilder : public GrGLSLGPBuilder,
199 public GrGLSLFPBuilder, 191 public GrGLSLFPBuilder,
200 public GrGLSLXPBuilder { 192 public GrGLSLXPBuilder {
201 public: 193 public:
202 typedef GrGpu::DrawArgs DrawArgs; 194 typedef GrGpu::DrawArgs DrawArgs;
203 195
204 GrGLSLXPFragmentBuilder* getFragmentShaderBuilder() override { return &fFS; }
205 GrGLSLVertexBuilder* getVertexShaderBuilder() override { return &fVS; }
206
207 // Handles for program uniforms (other than per-effect uniforms) 196 // Handles for program uniforms (other than per-effect uniforms)
208 struct BuiltinUniformHandles { 197 struct BuiltinUniformHandles {
209 UniformHandle fRTAdjustmentUni; 198 UniformHandle fRTAdjustmentUni;
210 199
211 // We use the render target height to provide a y-down frag coord when s pecifying 200 // We use the render target height to provide a y-down frag coord when s pecifying
212 // origin_upper_left is not supported. 201 // origin_upper_left is not supported.
213 UniformHandle fRTHeightUni; 202 UniformHandle fRTHeightUni;
214 }; 203 };
215 204
216 protected: 205 protected:
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 private: 244 private:
256 virtual void onAppendUniformDecls(ShaderVisibility visibility, SkString* out ) const = 0; 245 virtual void onAppendUniformDecls(ShaderVisibility visibility, SkString* out ) const = 0;
257 246
258 friend class GrGLSLShaderBuilder; 247 friend class GrGLSLShaderBuilder;
259 friend class GrGLSLVertexBuilder; 248 friend class GrGLSLVertexBuilder;
260 friend class GrGLSLFragmentShaderBuilder; 249 friend class GrGLSLFragmentShaderBuilder;
261 friend class GrGLSLGeometryBuilder; 250 friend class GrGLSLGeometryBuilder;
262 }; 251 };
263 252
264 #endif 253 #endif
OLDNEW
« no previous file with comments | « src/gpu/glsl/GrGLSLPrimitiveProcessor.cpp ('k') | src/gpu/glsl/GrGLSLXferProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698