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_SERVICE_PROGRAM_MANAGER_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 const std::string* log_info() const { | 147 const std::string* log_info() const { |
148 return log_info_.get(); | 148 return log_info_.get(); |
149 } | 149 } |
150 | 150 |
151 bool InUse() const { | 151 bool InUse() const { |
152 DCHECK_GE(use_count_, 0); | 152 DCHECK_GE(use_count_, 0); |
153 return use_count_ != 0; | 153 return use_count_ != 0; |
154 } | 154 } |
155 | 155 |
| 156 // Sets attribute-location binding from a glBindAttribLocation() call. |
| 157 void SetAttribLocationBinding(const std::string& attrib, |
| 158 GLint location) { |
| 159 bind_attrib_location_map_[attrib] = location; |
| 160 } |
| 161 |
| 162 // Detects if there are attribute location conflicts from |
| 163 // glBindAttribLocation() calls. |
| 164 // We only consider the declared attributes in the program. |
| 165 bool DetectAttribLocationBindingConflicts() const; |
| 166 |
156 static inline GLint GetFakeLocation( | 167 static inline GLint GetFakeLocation( |
157 GLint fake_base_location, GLint element_index) { | 168 GLint fake_base_location, GLint element_index) { |
158 return fake_base_location | element_index << 16; | 169 return fake_base_location | element_index << 16; |
159 } | 170 } |
160 | 171 |
161 private: | 172 private: |
162 friend class base::RefCounted<ProgramInfo>; | 173 friend class base::RefCounted<ProgramInfo>; |
163 friend class ProgramManager; | 174 friend class ProgramManager; |
164 | 175 |
165 ~ProgramInfo(); | 176 ~ProgramInfo(); |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 ShaderManager::ShaderInfo::Ref attached_shaders_[kMaxAttachedShaders]; | 251 ShaderManager::ShaderInfo::Ref attached_shaders_[kMaxAttachedShaders]; |
241 | 252 |
242 // This is true if glLinkProgram was successful at least once. | 253 // This is true if glLinkProgram was successful at least once. |
243 bool valid_; | 254 bool valid_; |
244 | 255 |
245 // This is true if glLinkProgram was successful last time it was called. | 256 // This is true if glLinkProgram was successful last time it was called. |
246 bool link_status_; | 257 bool link_status_; |
247 | 258 |
248 // Log info | 259 // Log info |
249 scoped_ptr<std::string> log_info_; | 260 scoped_ptr<std::string> log_info_; |
| 261 |
| 262 // attribute-location binding map from glBindAttribLocation() calls. |
| 263 std::map<std::string, GLint> bind_attrib_location_map_; |
250 }; | 264 }; |
251 | 265 |
252 ProgramManager(); | 266 ProgramManager(); |
253 ~ProgramManager(); | 267 ~ProgramManager(); |
254 | 268 |
255 // Must call before destruction. | 269 // Must call before destruction. |
256 void Destroy(bool have_context); | 270 void Destroy(bool have_context); |
257 | 271 |
258 // Creates a new program info. | 272 // Creates a new program info. |
259 ProgramInfo* CreateProgramInfo(GLuint client_id, GLuint service_id); | 273 ProgramInfo* CreateProgramInfo(GLuint client_id, GLuint service_id); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 void RemoveProgramInfoIfUnused( | 307 void RemoveProgramInfoIfUnused( |
294 ShaderManager* shader_manager, ProgramInfo* info); | 308 ShaderManager* shader_manager, ProgramInfo* info); |
295 | 309 |
296 DISALLOW_COPY_AND_ASSIGN(ProgramManager); | 310 DISALLOW_COPY_AND_ASSIGN(ProgramManager); |
297 }; | 311 }; |
298 | 312 |
299 } // namespace gles2 | 313 } // namespace gles2 |
300 } // namespace gpu | 314 } // namespace gpu |
301 | 315 |
302 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ | 316 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ |
OLD | NEW |