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

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

Issue 674543004: OptState owns program descriptor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 class GrGLProgramBuilder : public GrGLGPBuilder, 112 class GrGLProgramBuilder : public GrGLGPBuilder,
113 public GrGLFPBuilder { 113 public GrGLFPBuilder {
114 public: 114 public:
115 /** Generates a shader program. 115 /** Generates a shader program.
116 * 116 *
117 * The program implements what is specified in the stages given as input. 117 * The program implements what is specified in the stages given as input.
118 * After successful generation, the builder result objects are available 118 * After successful generation, the builder result objects are available
119 * to be used. 119 * to be used.
120 * @return true if generation was successful. 120 * @return true if generation was successful.
121 */ 121 */
122 static GrGLProgram* CreateProgram(const GrOptDrawState&, 122 static GrGLProgram* CreateProgram(const GrOptDrawState&, GrGpu::DrawType, Gr GpuGL*);
123 const GrGLProgramDesc&,
124 GrGpu::DrawType,
125 GrGpuGL* gpu);
126 123
127 virtual UniformHandle addUniform(uint32_t visibility, 124 virtual UniformHandle addUniform(uint32_t visibility,
128 GrSLType type, 125 GrSLType type,
129 const char* name, 126 const char* name,
130 const char** outName = NULL) SK_OVERRIDE { 127 const char** outName = NULL) SK_OVERRIDE {
131 return this->addUniformArray(visibility, type, name, GrGLShaderVar::kNon Array, outName); 128 return this->addUniformArray(visibility, type, name, GrGLShaderVar::kNon Array, outName);
132 } 129 }
133 virtual UniformHandle addUniformArray(uint32_t visibility, 130 virtual UniformHandle addUniformArray(uint32_t visibility,
134 GrSLType type, 131 GrSLType type,
135 const char* name, 132 const char* name,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 UniformHandle fDstCopyTopLeftUni; 170 UniformHandle fDstCopyTopLeftUni;
174 UniformHandle fDstCopyScaleUni; 171 UniformHandle fDstCopyScaleUni;
175 UniformHandle fDstCopySamplerUni; 172 UniformHandle fDstCopySamplerUni;
176 }; 173 };
177 174
178 protected: 175 protected:
179 typedef GrGLProgramDesc::ProcKeyProvider ProcKeyProvider; 176 typedef GrGLProgramDesc::ProcKeyProvider ProcKeyProvider;
180 typedef GrGLProgramDataManager::UniformInfo UniformInfo; 177 typedef GrGLProgramDataManager::UniformInfo UniformInfo;
181 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray; 178 typedef GrGLProgramDataManager::UniformInfoArray UniformInfoArray;
182 179
183 static GrGLProgramBuilder* CreateProgramBuilder(const GrGLProgramDesc&, 180 static GrGLProgramBuilder* CreateProgramBuilder(const GrOptDrawState&,
184 const GrOptDrawState&,
185 GrGpu::DrawType, 181 GrGpu::DrawType,
186 bool hasGeometryProcessor, 182 bool hasGeometryProcessor,
187 GrGpuGL*); 183 GrGpuGL*);
188 184
189 GrGLProgramBuilder(GrGpuGL*, const GrOptDrawState&, const GrGLProgramDesc&); 185 GrGLProgramBuilder(GrGpuGL*, const GrOptDrawState&);
190 186
191 const GrOptDrawState& optState() const { return fOptState; } 187 const GrOptDrawState& optState() const { return fOptState; }
192 const GrGLProgramDesc& desc() const { return fDesc; } 188 const GrGLProgramDesc& desc() const { return fDesc; }
193 const GrGLProgramDesc::KeyHeader& header() const { return fDesc.getHeader(); } 189 const GrGLProgramDesc::GLKeyHeader& header() const { return fDesc.header(); }
194 190
195 // Generates a name for a variable. The generated string will be name prefix ed by the prefix 191 // Generates a name for a variable. The generated string will be name prefix ed by the prefix
196 // char (unless the prefix is '\0'). It also mangles the name to be stage-sp ecific if we're 192 // char (unless the prefix is '\0'). It also mangles the name to be stage-sp ecific if we're
197 // generating stage code. 193 // generating stage code.
198 void nameVariable(SkString* out, char prefix, const char* name); 194 void nameVariable(SkString* out, char prefix, const char* name);
199 void setupUniformColorAndCoverageIfNeeded(GrGLSLExpr4* inputColor, GrGLSLExp r4* inputCoverage); 195 void setupUniformColorAndCoverageIfNeeded(GrGLSLExpr4* inputColor, GrGLSLExp r4* inputCoverage);
200 void emitAndInstallProcs(const GrOptDrawState& optState, 196 void emitAndInstallProcs(const GrOptDrawState& optState,
201 GrGLSLExpr4* inputColor, 197 GrGLSLExpr4* inputColor,
202 GrGLSLExpr4* inputCoverage); 198 GrGLSLExpr4* inputCoverage);
203 void emitAndInstallFragProcs(int procOffset, int numProcs, GrGLSLExpr4* inOu t); 199 void emitAndInstallFragProcs(int procOffset, int numProcs, GrGLSLExpr4* inOu t);
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 SkSTArray<2, Transform, true> fTransforms; 337 SkSTArray<2, Transform, true> fTransforms;
342 bool fLocalCoordAttrib; 338 bool fLocalCoordAttrib;
343 }; 339 };
344 340
345 struct GrGLInstalledFragProcs : public SkRefCnt { 341 struct GrGLInstalledFragProcs : public SkRefCnt {
346 virtual ~GrGLInstalledFragProcs(); 342 virtual ~GrGLInstalledFragProcs();
347 SkSTArray<8, GrGLInstalledFragProc*, true> fProcs; 343 SkSTArray<8, GrGLInstalledFragProc*, true> fProcs;
348 }; 344 };
349 345
350 #endif 346 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698