OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef GPU_COMMAND_BUFFER_CLIENT_PROGRAM_INFO_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_PROGRAM_INFO_MANAGER_H_ |
6 #define GPU_COMMAND_BUFFER_CLIENT_PROGRAM_INFO_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_CLIENT_PROGRAM_INFO_MANAGER_H_ |
7 | 7 |
8 #include <GLES3/gl3.h> | 8 #include <GLES3/gl3.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 GLES2Implementation* gl, GLuint program, const char* name); | 53 GLES2Implementation* gl, GLuint program, const char* name); |
54 | 54 |
55 bool GetActiveUniformBlockName( | 55 bool GetActiveUniformBlockName( |
56 GLES2Implementation* gl, GLuint program, GLuint index, | 56 GLES2Implementation* gl, GLuint program, GLuint index, |
57 GLsizei buf_size, GLsizei* length, char* name); | 57 GLsizei buf_size, GLsizei* length, char* name); |
58 | 58 |
59 bool GetActiveUniformBlockiv( | 59 bool GetActiveUniformBlockiv( |
60 GLES2Implementation* gl, GLuint program, GLuint index, | 60 GLES2Implementation* gl, GLuint program, GLuint index, |
61 GLenum pname, GLint* params); | 61 GLenum pname, GLint* params); |
62 | 62 |
| 63 // Attempt to update the |index| uniform block binding. |
| 64 // It's no op if the program does not exist, or the |index| uniform block |
| 65 // is not in the cache, or binding >= GL_MAX_UNIFORM_BUFFER_BINDINGS. |
| 66 void UniformBlockBinding( |
| 67 GLES2Implementation* gl, GLuint program, GLuint index, GLuint binding); |
| 68 |
63 private: | 69 private: |
64 friend class ProgramInfoManagerTest; | 70 friend class ProgramInfoManagerTest; |
65 | 71 |
66 FRIEND_TEST_ALL_PREFIXES(ProgramInfoManagerTest, UpdateES3UniformBlocks); | 72 FRIEND_TEST_ALL_PREFIXES(ProgramInfoManagerTest, UpdateES3UniformBlocks); |
67 | 73 |
68 enum ProgramInfoType { | 74 enum ProgramInfoType { |
69 kES2, | 75 kES2, |
70 kES3UniformBlocks, | 76 kES3UniformBlocks, |
71 kNone, | 77 kNone, |
72 }; | 78 }; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 GLint GetUniformLocation(const std::string& name) const; | 125 GLint GetUniformLocation(const std::string& name) const; |
120 | 126 |
121 GLint GetFragDataLocation(const std::string& name) const; | 127 GLint GetFragDataLocation(const std::string& name) const; |
122 void CacheFragDataLocation(const std::string& name, GLint loc); | 128 void CacheFragDataLocation(const std::string& name, GLint loc); |
123 | 129 |
124 bool GetProgramiv(GLenum pname, GLint* params); | 130 bool GetProgramiv(GLenum pname, GLint* params); |
125 | 131 |
126 // Gets the index of a uniform block by name. | 132 // Gets the index of a uniform block by name. |
127 GLuint GetUniformBlockIndex(const std::string& name) const; | 133 GLuint GetUniformBlockIndex(const std::string& name) const; |
128 const UniformBlock* GetUniformBlock(GLuint index) const; | 134 const UniformBlock* GetUniformBlock(GLuint index) const; |
| 135 // Update the binding if the |index| uniform block is in the cache. |
| 136 void UniformBlockBinding(GLuint index, GLuint binding); |
129 | 137 |
130 // Updates the ES2 only program info after a successful link. | 138 // Updates the ES2 only program info after a successful link. |
131 void UpdateES2(const std::vector<int8>& result); | 139 void UpdateES2(const std::vector<int8>& result); |
132 | 140 |
133 // Updates the ES3 UniformBlock info after a successful link. | 141 // Updates the ES3 UniformBlock info after a successful link. |
134 void UpdateES3UniformBlocks(const std::vector<int8>& result); | 142 void UpdateES3UniformBlocks(const std::vector<int8>& result); |
135 | 143 |
136 bool IsCached(ProgramInfoType type) const; | 144 bool IsCached(ProgramInfoType type) const; |
137 | 145 |
138 private: | 146 private: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 | 178 |
171 ProgramInfoMap program_infos_; | 179 ProgramInfoMap program_infos_; |
172 | 180 |
173 mutable base::Lock lock_; | 181 mutable base::Lock lock_; |
174 }; | 182 }; |
175 | 183 |
176 } // namespace gles2 | 184 } // namespace gles2 |
177 } // namespace gpu | 185 } // namespace gpu |
178 | 186 |
179 #endif // GPU_COMMAND_BUFFER_CLIENT_PROGRAM_INFO_MANAGER_H_ | 187 #endif // GPU_COMMAND_BUFFER_CLIENT_PROGRAM_INFO_MANAGER_H_ |
OLD | NEW |