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

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

Issue 365853002: Rename GrGLUniformManager to GrGLProgramResourceManager (Closed) Base URL: https://skia.googlesource.com/skia.git@02-path-program-fragment
Patch Set: rebase Created 6 years, 4 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
« no previous file with comments | « src/gpu/gl/GrGLProgramDataManager.cpp ('k') | src/gpu/gl/GrGLProgramEffects.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 2013 Google Inc. 2 * Copyright 2013 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 GrGLProgramEffects_DEFINED 8 #ifndef GrGLProgramEffects_DEFINED
9 #define GrGLProgramEffects_DEFINED 9 #define GrGLProgramEffects_DEFINED
10 10
11 #include "GrBackendEffectFactory.h" 11 #include "GrBackendEffectFactory.h"
12 #include "GrGLUniformManager.h" 12 #include "GrGLProgramDataManager.h"
13 #include "GrTexture.h" 13 #include "GrTexture.h"
14 #include "GrTextureAccess.h" 14 #include "GrTextureAccess.h"
15 15
16 class GrEffect; 16 class GrEffect;
17 class GrEffectStage; 17 class GrEffectStage;
18 class GrGLVertexProgramEffectsBuilder; 18 class GrGLVertexProgramEffectsBuilder;
19 class GrGLShaderBuilder; 19 class GrGLShaderBuilder;
20 class GrGLFullShaderBuilder; 20 class GrGLFullShaderBuilder;
21 class GrGLFragmentOnlyShaderBuilder; 21 class GrGLFragmentOnlyShaderBuilder;
22 22
23 /** 23 /**
24 * This class encapsulates an array of GrGLEffects and their supporting data (co ord transforms 24 * This class encapsulates an array of GrGLEffects and their supporting data (co ord transforms
25 * and textures). It is built with GrGLProgramEffectsBuilder, then used to manag e the necessary GL 25 * and textures). It is built with GrGLProgramEffectsBuilder, then used to manag e the necessary GL
26 * state and shader uniforms. 26 * state and shader uniforms.
27 */ 27 */
28 class GrGLProgramEffects : public SkRefCnt { 28 class GrGLProgramEffects : public SkRefCnt {
29 public: 29 public:
30 typedef GrGLUniformManager::UniformHandle UniformHandle; 30 typedef GrGLProgramDataManager::UniformHandle UniformHandle;
31 31
32 /** 32 /**
33 * This class emits some of the code inserted into the shaders for an effect . The code it 33 * This class emits some of the code inserted into the shaders for an effect . The code it
34 * creates may be dependent on properties of the effect that the effect itse lf doesn't use 34 * creates may be dependent on properties of the effect that the effect itse lf doesn't use
35 * in its key (e.g. the pixel format of textures used). So this class insert s a meta-key for 35 * in its key (e.g. the pixel format of textures used). So this class insert s a meta-key for
36 * every effect using this function. It is also responsible for inserting th e effect's class ID 36 * every effect using this function. It is also responsible for inserting th e effect's class ID
37 * which must be different for every GrEffect subclass. It can fail if an ef fect uses too many 37 * which must be different for every GrEffect subclass. It can fail if an ef fect uses too many
38 * textures, attributes, etc for the space allotted in the meta-key. 38 * textures, attributes, etc for the space allotted in the meta-key.
39 */ 39 */
40 static bool GenEffectMetaKey(const GrDrawEffect&, const GrGLCaps&, GrEffectK eyBuilder*); 40 static bool GenEffectMetaKey(const GrDrawEffect&, const GrGLCaps&, GrEffectK eyBuilder*);
41 41
42 virtual ~GrGLProgramEffects(); 42 virtual ~GrGLProgramEffects();
43 43
44 /** 44 /**
45 * Assigns a texture unit to each sampler. It starts on *texUnitIdx and writ es the next 45 * Assigns a texture unit to each sampler. It starts on *texUnitIdx and writ es the next
46 * available unit to *texUnitIdx when it returns. 46 * available unit to *texUnitIdx when it returns.
47 */ 47 */
48 void initSamplers(const GrGLUniformManager&, int* texUnitIdx); 48 void initSamplers(const GrGLProgramDataManager&, int* texUnitIdx);
49 49
50 /** 50 /**
51 * Calls setData() on each effect, and sets their transformation matrices an d texture bindings. 51 * Calls setData() on each effect, and sets their transformation matrices an d texture bindings.
52 */ 52 */
53 virtual void setData(GrGpuGL*, 53 virtual void setData(GrGpuGL*,
54 const GrGLUniformManager&, 54 const GrGLProgramDataManager&,
55 const GrEffectStage* effectStages[]) = 0; 55 const GrEffectStage* effectStages[]) = 0;
56 56
57 /** 57 /**
58 * Passed to GrGLEffects so they can add transformed coordinates to their sh ader code. 58 * Passed to GrGLEffects so they can add transformed coordinates to their sh ader code.
59 */ 59 */
60 class TransformedCoords { 60 class TransformedCoords {
61 public: 61 public:
62 TransformedCoords(const SkString& name, GrSLType type) 62 TransformedCoords(const SkString& name, GrSLType type)
63 : fName(name), fType(type) { 63 : fName(name), fType(type) {
64 } 64 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 }; 155 };
156 156
157 //////////////////////////////////////////////////////////////////////////////// 157 ////////////////////////////////////////////////////////////////////////////////
158 158
159 /** 159 /**
160 * This is a GrGLProgramEffects implementation that does coord transforms with t he vertex shader. 160 * This is a GrGLProgramEffects implementation that does coord transforms with t he vertex shader.
161 */ 161 */
162 class GrGLVertexProgramEffects : public GrGLProgramEffects { 162 class GrGLVertexProgramEffects : public GrGLProgramEffects {
163 public: 163 public:
164 virtual void setData(GrGpuGL*, 164 virtual void setData(GrGpuGL*,
165 const GrGLUniformManager&, 165 const GrGLProgramDataManager&,
166 const GrEffectStage* effectStages[]) SK_OVERRIDE; 166 const GrEffectStage* effectStages[]) SK_OVERRIDE;
167 167
168 private: 168 private:
169 friend class GrGLVertexProgramEffectsBuilder; 169 friend class GrGLVertexProgramEffectsBuilder;
170 170
171 GrGLVertexProgramEffects(int reserveCount, bool explicitLocalCoords) 171 GrGLVertexProgramEffects(int reserveCount, bool explicitLocalCoords)
172 : INHERITED(reserveCount) 172 : INHERITED(reserveCount)
173 , fTransforms(reserveCount) 173 , fTransforms(reserveCount)
174 , fHasExplicitLocalCoords(explicitLocalCoords) { 174 , fHasExplicitLocalCoords(explicitLocalCoords) {
175 } 175 }
(...skipping 21 matching lines...) Expand all
197 * of the varyings in the VS and FS as well their types are appended to the 197 * of the varyings in the VS and FS as well their types are appended to the
198 * TransformedCoordsArray* object, which is in turn passed to the effect's e mitCode() function. 198 * TransformedCoordsArray* object, which is in turn passed to the effect's e mitCode() function.
199 */ 199 */
200 void emitTransforms(GrGLFullShaderBuilder*, 200 void emitTransforms(GrGLFullShaderBuilder*,
201 const GrDrawEffect&, 201 const GrDrawEffect&,
202 TransformedCoordsArray*); 202 TransformedCoordsArray*);
203 203
204 /** 204 /**
205 * Helper for setData(). Sets all the transform matrices for an effect. 205 * Helper for setData(). Sets all the transform matrices for an effect.
206 */ 206 */
207 void setTransformData(const GrGLUniformManager&, const GrDrawEffect&, int ef fectIdx); 207 void setTransformData(const GrGLProgramDataManager&, const GrDrawEffect&, in t effectIdx);
208 208
209 struct Transform { 209 struct Transform {
210 Transform() { fCurrentValue = SkMatrix::InvalidMatrix(); } 210 Transform() { fCurrentValue = SkMatrix::InvalidMatrix(); }
211 UniformHandle fHandle; 211 UniformHandle fHandle;
212 SkMatrix fCurrentValue; 212 SkMatrix fCurrentValue;
213 }; 213 };
214 214
215 SkTArray<SkSTArray<2, Transform, true> > fTransforms; 215 SkTArray<SkSTArray<2, Transform, true> > fTransforms;
216 bool fHasExplicitLocalCoords; 216 bool fHasExplicitLocalCoords;
217 217
(...skipping 29 matching lines...) Expand all
247 247
248 //////////////////////////////////////////////////////////////////////////////// 248 ////////////////////////////////////////////////////////////////////////////////
249 249
250 /** 250 /**
251 * This is a GrGLProgramEffects implementation that does coord transforms with 251 * This is a GrGLProgramEffects implementation that does coord transforms with
252 * the the NV_path_rendering PathTexGen functionality. 252 * the the NV_path_rendering PathTexGen functionality.
253 */ 253 */
254 class GrGLPathTexGenProgramEffects : public GrGLProgramEffects { 254 class GrGLPathTexGenProgramEffects : public GrGLProgramEffects {
255 public: 255 public:
256 virtual void setData(GrGpuGL*, 256 virtual void setData(GrGpuGL*,
257 const GrGLUniformManager&, 257 const GrGLProgramDataManager&,
258 const GrEffectStage* effectStages[]) SK_OVERRIDE; 258 const GrEffectStage* effectStages[]) SK_OVERRIDE;
259 259
260 private: 260 private:
261 friend class GrGLPathTexGenProgramEffectsBuilder; 261 friend class GrGLPathTexGenProgramEffectsBuilder;
262 262
263 GrGLPathTexGenProgramEffects(int reserveCount) 263 GrGLPathTexGenProgramEffects(int reserveCount)
264 : INHERITED(reserveCount) 264 : INHERITED(reserveCount)
265 , fTransforms(reserveCount) { 265 , fTransforms(reserveCount) {
266 } 266 }
267 267
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 GrGLProgramEffects* finish() { return fProgramEffects.detach(); } 326 GrGLProgramEffects* finish() { return fProgramEffects.detach(); }
327 327
328 private: 328 private:
329 GrGLFragmentOnlyShaderBuilder* fBuilder; 329 GrGLFragmentOnlyShaderBuilder* fBuilder;
330 SkAutoTDelete<GrGLPathTexGenProgramEffects> fProgramEffects; 330 SkAutoTDelete<GrGLPathTexGenProgramEffects> fProgramEffects;
331 331
332 typedef GrGLProgramEffectsBuilder INHERITED; 332 typedef GrGLProgramEffectsBuilder INHERITED;
333 }; 333 };
334 334
335 #endif 335 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgramDataManager.cpp ('k') | src/gpu/gl/GrGLProgramEffects.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698