OLD | NEW |
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 "GrAllocator.h" | 11 #include "GrAllocator.h" |
12 #include "gl/GrGLShaderVar.h" | |
13 #include "gl/GrGLTypes.h" | 12 #include "gl/GrGLTypes.h" |
| 13 #include "glsl/GrGLSLShaderVar.h" |
14 | 14 |
15 #include "SkTArray.h" | 15 #include "SkTArray.h" |
16 | 16 |
17 class GrGLGpu; | 17 class GrGLGpu; |
18 class SkMatrix; | 18 class SkMatrix; |
19 class GrGLProgram; | 19 class GrGLProgram; |
20 class GrGLProgramBuilder; | 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 |
(...skipping 18 matching lines...) Expand all Loading... |
42 int toIndex() const { SkASSERT(this->isValid()); return fValue; } | 42 int toIndex() const { SkASSERT(this->isValid()); return fValue; } |
43 | 43 |
44 private: | 44 private: |
45 static const int kInvalid_ShaderResourceHandle = -1; | 45 static const int kInvalid_ShaderResourceHandle = -1; |
46 int fValue; | 46 int fValue; |
47 }; | 47 }; |
48 | 48 |
49 typedef ShaderResourceHandle UniformHandle; | 49 typedef ShaderResourceHandle UniformHandle; |
50 | 50 |
51 struct UniformInfo { | 51 struct UniformInfo { |
52 GrGLShaderVar fVariable; | 52 GrGLSLShaderVar fVariable; |
53 uint32_t fVisibility; | 53 uint32_t fVisibility; |
54 GrGLint fLocation; | 54 GrGLint fLocation; |
55 }; | 55 }; |
56 | 56 |
57 struct SeparableVaryingInfo { | 57 struct SeparableVaryingInfo { |
58 GrGLShaderVar fVariable; | 58 GrGLSLShaderVar fVariable; |
59 GrGLint fLocation; | 59 GrGLint fLocation; |
60 }; | 60 }; |
61 | 61 |
62 // This uses an allocator rather than array so that the GrGLShaderVars don't
move in memory | 62 // This uses an allocator rather than array so that the GrGLSLShaderVars don
't move in memory |
63 // after they are inserted. Users of GrGLShaderBuilder get refs to the vars
and ptrs to their | 63 // after they are inserted. Users of GrGLShaderBuilder get refs to the vars
and ptrs to their |
64 // name strings. Otherwise, we'd have to hand out copies. | 64 // name strings. Otherwise, we'd have to hand out copies. |
65 typedef GrTAllocator<UniformInfo> UniformInfoArray; | 65 typedef GrTAllocator<UniformInfo> UniformInfoArray; |
66 typedef GrTAllocator<SeparableVaryingInfo> SeparableVaryingInfoArray; | 66 typedef GrTAllocator<SeparableVaryingInfo> SeparableVaryingInfoArray; |
67 | 67 |
68 GrGLProgramDataManager(GrGLGpu*, GrGLuint programID, const UniformInfoArray&
, | 68 GrGLProgramDataManager(GrGLGpu*, GrGLuint programID, const UniformInfoArray&
, |
69 const SeparableVaryingInfoArray&); | 69 const SeparableVaryingInfoArray&); |
70 | 70 |
71 /** Functions for uploading uniform values. The varities ending in v can be
used to upload to an | 71 /** Functions for uploading uniform values. The varities ending in v can be
used to upload to an |
72 * array of uniforms. arrayCount must be <= the array count of the uniform. | 72 * array of uniforms. arrayCount must be <= the array count of the uniform. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 | 124 |
125 SkTArray<Uniform, true> fUniforms; | 125 SkTArray<Uniform, true> fUniforms; |
126 SkTArray<SeparableVarying, true> fSeparableVaryings; | 126 SkTArray<SeparableVarying, true> fSeparableVaryings; |
127 GrGLGpu* fGpu; | 127 GrGLGpu* fGpu; |
128 GrGLuint fProgramID; | 128 GrGLuint fProgramID; |
129 | 129 |
130 typedef SkNoncopyable INHERITED; | 130 typedef SkNoncopyable INHERITED; |
131 }; | 131 }; |
132 | 132 |
133 #endif | 133 #endif |
OLD | NEW |