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

Side by Side Diff: src/gpu/gl/builders/GrGLProgramBuilder.h

Issue 788733003: Make addUniform take a precision (Closed) Base URL: https://skia.googlesource.com/skia.git@move_prec
Patch Set: rebase Created 6 years 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
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 GrGLProgramBuilder_DEFINED 8 #ifndef GrGLProgramBuilder_DEFINED
9 #define GrGLProgramBuilder_DEFINED 9 #define GrGLProgramBuilder_DEFINED
10 10
(...skipping 27 matching lines...) Expand all
38 virtual ~GrGLUniformBuilder() {} 38 virtual ~GrGLUniformBuilder() {}
39 39
40 typedef GrGLProgramDataManager::UniformHandle UniformHandle; 40 typedef GrGLProgramDataManager::UniformHandle UniformHandle;
41 41
42 /** Add a uniform variable to the current program, that has visibility in on e or more shaders. 42 /** Add a uniform variable to the current program, that has visibility in on e or more shaders.
43 visibility is a bitfield of ShaderVisibility values indicating from whic h shaders the 43 visibility is a bitfield of ShaderVisibility values indicating from whic h shaders the
44 uniform should be accessible. At least one bit must be set. Geometry sha der uniforms are not 44 uniform should be accessible. At least one bit must be set. Geometry sha der uniforms are not
45 supported at this time. The actual uniform name will be mangled. If outN ame is not NULL then 45 supported at this time. The actual uniform name will be mangled. If outN ame is not NULL then
46 it will refer to the final uniform name after return. Use the addUniform Array variant to add 46 it will refer to the final uniform name after return. Use the addUniform Array variant to add
47 an array of uniforms. */ 47 an array of uniforms. */
48 virtual UniformHandle addUniform(uint32_t visibility, 48 UniformHandle addUniform(uint32_t visibility,
49 GrSLType type, 49 GrSLType type,
50 const char* name, 50 GrSLPrecision precision,
51 const char** outName = NULL) = 0; 51 const char* name,
52 virtual UniformHandle addUniformArray(uint32_t visibility, 52 const char** outName = NULL) {
53 GrSLType type, 53 return this->addUniformArray(visibility, type, precision, name, 0, outNa me);
54 const char* name, 54 }
55 int arrayCount, 55
56 const char** outName = NULL) = 0; 56 virtual UniformHandle addUniformArray(
57 uint32_t visibility,
58 GrSLType type,
59 GrSLPrecision precision,
60 const char* name,
61 int arrayCount,
62 const char** outName = NULL) = 0;
57 63
58 virtual const GrGLShaderVar& getUniformVariable(UniformHandle u) const = 0; 64 virtual const GrGLShaderVar& getUniformVariable(UniformHandle u) const = 0;
59 65
60 /** 66 /**
61 * Shortcut for getUniformVariable(u).c_str() 67 * Shortcut for getUniformVariable(u).c_str()
62 */ 68 */
63 virtual const char* getUniformCStr(UniformHandle u) const = 0; 69 virtual const char* getUniformCStr(UniformHandle u) const = 0;
64 70
65 virtual const GrGLContextInfo& ctxInfo() const = 0; 71 virtual const GrGLContextInfo& ctxInfo() const = 0;
66 72
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 public: 187 public:
182 /** Generates a shader program. 188 /** Generates a shader program.
183 * 189 *
184 * The program implements what is specified in the stages given as input. 190 * The program implements what is specified in the stages given as input.
185 * After successful generation, the builder result objects are available 191 * After successful generation, the builder result objects are available
186 * to be used. 192 * to be used.
187 * @return true if generation was successful. 193 * @return true if generation was successful.
188 */ 194 */
189 static GrGLProgram* CreateProgram(const GrOptDrawState&, GrGpuGL*); 195 static GrGLProgram* CreateProgram(const GrOptDrawState&, GrGpuGL*);
190 196
191 virtual UniformHandle addUniform(uint32_t visibility, 197 UniformHandle addUniformArray(uint32_t visibility,
192 GrSLType type, 198 GrSLType type,
193 const char* name, 199 GrSLPrecision precision,
194 const char** outName = NULL) SK_OVERRIDE { 200 const char* name,
195 return this->addUniformArray(visibility, type, name, GrGLShaderVar::kNon Array, outName); 201 int arrayCount,
196 } 202 const char** outName) SK_OVERRIDE;
197 virtual UniformHandle addUniformArray(uint32_t visibility,
198 GrSLType type,
199 const char* name,
200 int arrayCount,
201 const char** outName = NULL) SK_OVERRI DE;
202 203
203 virtual const GrGLShaderVar& getUniformVariable(UniformHandle u) const SK_OV ERRIDE { 204 const GrGLShaderVar& getUniformVariable(UniformHandle u) const SK_OVERRIDE {
204 return fUniforms[u.toShaderBuilderIndex()].fVariable; 205 return fUniforms[u.toShaderBuilderIndex()].fVariable;
205 } 206 }
206 207
207 virtual const char* getUniformCStr(UniformHandle u) const SK_OVERRIDE { 208 const char* getUniformCStr(UniformHandle u) const SK_OVERRIDE {
208 return this->getUniformVariable(u).c_str(); 209 return this->getUniformVariable(u).c_str();
209 } 210 }
210 211
211 virtual const GrGLContextInfo& ctxInfo() const SK_OVERRIDE; 212 const GrGLContextInfo& ctxInfo() const SK_OVERRIDE;
212 213
213 virtual GrGpuGL* gpu() const SK_OVERRIDE { return fGpu; } 214 GrGpuGL* gpu() const SK_OVERRIDE { return fGpu; }
214 215
215 virtual GrGLFPFragmentBuilder* getFragmentShaderBuilder() SK_OVERRIDE { retu rn &fFS; } 216 GrGLFPFragmentBuilder* getFragmentShaderBuilder() SK_OVERRIDE { return &fFS; }
216 virtual GrGLVertexBuilder* getVertexShaderBuilder() SK_OVERRIDE { return &fV S; } 217 GrGLVertexBuilder* getVertexShaderBuilder() SK_OVERRIDE { return &fVS; }
217 218
218 virtual void addVarying( 219 void addVarying(
219 const char* name, 220 const char* name,
220 GrGLVarying*, 221 GrGLVarying*,
221 GrSLPrecision fsPrecision = kDefault_GrSLPrecision) SK_OVERRIDE; 222 GrSLPrecision fsPrecision = kDefault_GrSLPrecision) SK_OVERRIDE;
222 223
223 virtual void addPassThroughAttribute(const GrGeometryProcessor::GrAttribute* , 224 void addPassThroughAttribute(const GrGeometryProcessor::GrAttribute*,
224 const char* output) SK_OVERRIDE; 225 const char* output) SK_OVERRIDE;
225 226
226 227
227 // Handles for program uniforms (other than per-effect uniforms) 228 // Handles for program uniforms (other than per-effect uniforms)
228 struct BuiltinUniformHandles { 229 struct BuiltinUniformHandles {
229 UniformHandle fViewMatrixUni; 230 UniformHandle fViewMatrixUni;
230 UniformHandle fRTAdjustmentUni; 231 UniformHandle fRTAdjustmentUni;
231 UniformHandle fColorUni; 232 UniformHandle fColorUni;
232 UniformHandle fCoverageUni; 233 UniformHandle fCoverageUni;
233 234
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 SkAutoTDelete<GrGLFragmentProcessor> fGLProc; 418 SkAutoTDelete<GrGLFragmentProcessor> fGLProc;
418 SkSTArray<2, Transform, true> fTransforms; 419 SkSTArray<2, Transform, true> fTransforms;
419 }; 420 };
420 421
421 struct GrGLInstalledFragProcs : public SkRefCnt { 422 struct GrGLInstalledFragProcs : public SkRefCnt {
422 virtual ~GrGLInstalledFragProcs(); 423 virtual ~GrGLInstalledFragProcs();
423 SkSTArray<8, GrGLInstalledFragProc*, true> fProcs; 424 SkSTArray<8, GrGLInstalledFragProc*, true> fProcs;
424 }; 425 };
425 426
426 #endif 427 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/builders/GrGLFragmentShaderBuilder.cpp ('k') | src/gpu/gl/builders/GrGLProgramBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698