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

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

Issue 302663006: Incremental refactoring of GrGLProgram and GrGLShaderBuilder (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 6 years, 6 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 | « no previous file | src/gpu/gl/GrGLProgram.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 2011 Google Inc. 2 * Copyright 2011 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 8
9 #ifndef GrGLProgram_DEFINED 9 #ifndef GrGLProgram_DEFINED
10 #define GrGLProgram_DEFINED 10 #define GrGLProgram_DEFINED
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 const GrEffectStage* colorStages[], 159 const GrEffectStage* colorStages[],
160 const GrEffectStage* coverageStages[], 160 const GrEffectStage* coverageStages[],
161 const GrDeviceCoordTexture* dstCopy, // can be NULL 161 const GrDeviceCoordTexture* dstCopy, // can be NULL
162 SharedGLState*); 162 SharedGLState*);
163 163
164 private: 164 private:
165 typedef GrGLUniformManager::UniformHandle UniformHandle; 165 typedef GrGLUniformManager::UniformHandle UniformHandle;
166 166
167 GrGLProgram(GrGpuGL* gpu, 167 GrGLProgram(GrGpuGL* gpu,
168 const GrGLProgramDesc& desc, 168 const GrGLProgramDesc& desc,
169 const GrEffectStage* colorStages[], 169 GrGLUniformManager* uman,
170 const GrEffectStage* coverageStages[]); 170 const GrGLShaderBuilder::GenProgramOutput& builderOutput);
171
172 bool succeeded() const { return 0 != fProgramID; }
173
174 /**
175 * This is the heavy initialization routine for building a GLProgram. colorS tages and
176 * coverageStages correspond to the output of GrGLProgramDesc::Build().
177 */
178 bool genProgram(GrGLShaderBuilder* builder,
179 const GrEffectStage* colorStages[],
180 const GrEffectStage* coverageStages[]);
181 171
182 // Sets the texture units for samplers 172 // Sets the texture units for samplers
183 void initSamplerUniforms(); 173 void initSamplerUniforms();
184 174
185 // Helper for setData(). Makes GL calls to specify the initial color when th ere is not 175 // Helper for setData(). Makes GL calls to specify the initial color when th ere is not
186 // per-vertex colors. 176 // per-vertex colors.
187 void setColor(const GrDrawState&, GrColor color, SharedGLState*); 177 void setColor(const GrDrawState&, GrColor color, SharedGLState*);
188 178
189 // Helper for setData(). Makes GL calls to specify the initial coverage when there is not 179 // Helper for setData(). Makes GL calls to specify the initial coverage when there is not
190 // per-vertex coverages. 180 // per-vertex coverages.
191 void setCoverage(const GrDrawState&, GrColor coverage, SharedGLState*); 181 void setCoverage(const GrDrawState&, GrColor coverage, SharedGLState*);
192 182
193 // Helper for setData() that sets the view matrix and loads the render targe t height uniform 183 // Helper for setData() that sets the view matrix and loads the render targe t height uniform
194 void setMatrixAndRenderTargetHeight(const GrDrawState&); 184 void setMatrixAndRenderTargetHeight(const GrDrawState&);
195 185
196 // GL program ID 186 // GL program ID
197 GrGLuint fProgramID; 187 GrGLuint fProgramID;
198 188
199 // these reflect the current values of uniforms (GL uniform values travel wi th program) 189 // these reflect the current values of uniforms (GL uniform values travel wi th program)
200 MatrixState fMatrixState; 190 MatrixState fMatrixState;
201 GrColor fColor; 191 GrColor fColor;
202 GrColor fCoverage; 192 GrColor fCoverage;
203 int fDstCopyTexUnit; 193 int fDstCopyTexUnit;
204 194
205 SkAutoTDelete<GrGLProgramEffects> fColorEffects; 195 SkAutoTDelete<GrGLProgramEffects> fColorEffects;
206 SkAutoTDelete<GrGLProgramEffects> fCoverageEffects; 196 SkAutoTDelete<GrGLProgramEffects> fCoverageEffects;
197
198 GrGLProgramDesc fDesc;
199
200 GrGpuGL* fGpu;
207 201
208 GrGLProgramDesc fDesc; 202 SkAutoTUnref<GrGLUniformManager> fUniformManager;
209 GrGpuGL* fGpu; 203 GrGLShaderBuilder::UniformHandles fUniformHandles;
210 204
211 GrGLUniformManager fUniformManager; 205 bool fHasVertexShader;
212 GrGLShaderBuilder::UniformHandles fUniformHandles; 206 int fNumTexCoordSets;
213
214 bool fHasVertexShader;
215 int fNumTexCoordSets;
216 207
217 typedef SkRefCnt INHERITED; 208 typedef SkRefCnt INHERITED;
218 }; 209 };
219 210
220 #endif 211 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/gl/GrGLProgram.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698