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

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

Issue 491673002: Initial refactor of shaderbuilder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/GrGLProgram.cpp ('k') | src/gpu/gl/GrGLProgramDataManager.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 2012 Google Inc. 2 * Copyright 2012 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 GrGLProgramDataManager_DEFINED 8 #ifndef GrGLProgramDataManager_DEFINED
9 #define GrGLProgramDataManager_DEFINED 9 #define GrGLProgramDataManager_DEFINED
10 10
11 #include "gl/GrGLShaderVar.h" 11 #include "gl/GrGLShaderVar.h"
12 #include "gl/GrGLSL.h" 12 #include "gl/GrGLSL.h"
13 #include "GrAllocator.h" 13 #include "GrAllocator.h"
14 14
15 #include "SkTArray.h" 15 #include "SkTArray.h"
16 16
17 class GrGpuGL; 17 class GrGpuGL;
18 class SkMatrix; 18 class SkMatrix;
19 class GrGLProgram; 19 class GrGLProgram;
20 class GrGLShaderBuilder; 20 class GrGLProgramBuilder;
21 21
22 /** Manages the resources used by a shader program. 22 /** Manages the resources used by a shader program.
23 * The resources are objects the program uses to communicate with the 23 * The resources are objects the program uses to communicate with the
24 * application code. 24 * application code.
25 */ 25 */
26 class GrGLProgramDataManager : public SkRefCnt { 26 class GrGLProgramDataManager : public SkRefCnt {
27 public: 27 public:
28 // Opaque handle to a uniform 28 // Opaque handle to a uniform
29 class UniformHandle { 29 class UniformHandle {
30 public: 30 public:
(...skipping 13 matching lines...) Expand all
44 UniformHandle(int value) 44 UniformHandle(int value)
45 : fValue(value) { 45 : fValue(value) {
46 SkASSERT(isValid()); 46 SkASSERT(isValid());
47 } 47 }
48 48
49 int toProgramDataIndex() const { SkASSERT(isValid()); return fValue; } 49 int toProgramDataIndex() const { SkASSERT(isValid()); return fValue; }
50 int toShaderBuilderIndex() const { return toProgramDataIndex(); } 50 int toShaderBuilderIndex() const { return toProgramDataIndex(); }
51 51
52 int fValue; 52 int fValue;
53 friend class GrGLProgramDataManager; // For accessing toProgramDataIndex (). 53 friend class GrGLProgramDataManager; // For accessing toProgramDataIndex ().
54 friend class GrGLShaderBuilder; // For accessing toShaderBuilderIndex(). 54 friend class GrGLProgramBuilder; // For accessing toShaderBuilderIndex() .
55 }; 55 };
56 56
57 GrGLProgramDataManager(GrGpuGL*, GrGLProgram*, const GrGLShaderBuilder&); 57 GrGLProgramDataManager(GrGpuGL*, GrGLProgram*, const GrGLProgramBuilder&);
58 58
59 /** Functions for uploading uniform values. The varities ending in v can be used to upload to an 59 /** Functions for uploading uniform values. The varities ending in v can be used to upload to an
60 * array of uniforms. arrayCount must be <= the array count of the uniform. 60 * array of uniforms. arrayCount must be <= the array count of the uniform.
61 */ 61 */
62 void setSampler(UniformHandle, GrGLint texUnit) const; 62 void setSampler(UniformHandle, GrGLint texUnit) const;
63 void set1f(UniformHandle, GrGLfloat v0) const; 63 void set1f(UniformHandle, GrGLfloat v0) const;
64 void set1fv(UniformHandle, int arrayCount, const GrGLfloat v[]) const; 64 void set1fv(UniformHandle, int arrayCount, const GrGLfloat v[]) const;
65 void set2f(UniformHandle, GrGLfloat, GrGLfloat) const; 65 void set2f(UniformHandle, GrGLfloat, GrGLfloat) const;
66 void set2fv(UniformHandle, int arrayCount, const GrGLfloat v[]) const; 66 void set2fv(UniformHandle, int arrayCount, const GrGLfloat v[]) const;
67 void set3f(UniformHandle, GrGLfloat, GrGLfloat, GrGLfloat) const; 67 void set3f(UniformHandle, GrGLfloat, GrGLfloat, GrGLfloat) const;
(...skipping 24 matching lines...) Expand all
92 ); 92 );
93 }; 93 };
94 94
95 SkTArray<Uniform, true> fUniforms; 95 SkTArray<Uniform, true> fUniforms;
96 GrGpuGL* fGpu; 96 GrGpuGL* fGpu;
97 97
98 typedef SkRefCnt INHERITED; 98 typedef SkRefCnt INHERITED;
99 }; 99 };
100 100
101 #endif 101 #endif
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLProgram.cpp ('k') | src/gpu/gl/GrGLProgramDataManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698