OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 105 } |
106 | 106 |
107 // Gets the location of a uniform by name. | 107 // Gets the location of a uniform by name. |
108 GLint GetUniformLocation(const std::string& name) const; | 108 GLint GetUniformLocation(const std::string& name) const; |
109 | 109 |
110 // Gets the UniformInfo of a uniform by location. | 110 // Gets the UniformInfo of a uniform by location. |
111 const UniformInfo* GetUniformInfoByLocation( | 111 const UniformInfo* GetUniformInfoByLocation( |
112 GLint location, GLint* array_index) const; | 112 GLint location, GLint* array_index) const; |
113 | 113 |
114 // Gets all the program info. | 114 // Gets all the program info. |
115 void GetProgramInfo(CommonDecoder::Bucket* bucket) const; | 115 void GetProgramInfo( |
| 116 ProgramManager* manager, CommonDecoder::Bucket* bucket) const; |
116 | 117 |
117 // Sets the sampler values for a uniform. | 118 // Sets the sampler values for a uniform. |
118 // This is safe to call for any location. If the location is not | 119 // This is safe to call for any location. If the location is not |
119 // a sampler uniform nothing will happen. | 120 // a sampler uniform nothing will happen. |
120 bool SetSamplers(GLint location, GLsizei count, const GLint* value); | 121 bool SetSamplers(GLint location, GLsizei count, const GLint* value); |
121 | 122 |
122 bool IsDeleted() const { | 123 bool IsDeleted() const { |
123 return service_id_ == 0; | 124 return service_id_ == 0; |
124 } | 125 } |
125 | 126 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 271 |
271 // Makes a program as unused. If deleted the program info will be removed. | 272 // Makes a program as unused. If deleted the program info will be removed. |
272 void UnuseProgram(ShaderManager* shader_manager, ProgramInfo* info); | 273 void UnuseProgram(ShaderManager* shader_manager, ProgramInfo* info); |
273 | 274 |
274 // Returns true if prefix is invalid for gl. | 275 // Returns true if prefix is invalid for gl. |
275 static bool IsInvalidPrefix(const char* name, size_t length); | 276 static bool IsInvalidPrefix(const char* name, size_t length); |
276 | 277 |
277 // Check if a ProgramInfo is owned by this ProgramManager. | 278 // Check if a ProgramInfo is owned by this ProgramManager. |
278 bool IsOwned(ProgramInfo* info); | 279 bool IsOwned(ProgramInfo* info); |
279 | 280 |
| 281 GLint SwizzleLocation(GLint unswizzled_location) const; |
| 282 GLint UnswizzleLocation(GLint swizzled_location) const; |
| 283 |
280 private: | 284 private: |
281 // Info for each "successfully linked" program by service side program Id. | 285 // Info for each "successfully linked" program by service side program Id. |
282 // TODO(gman): Choose a faster container. | 286 // TODO(gman): Choose a faster container. |
283 typedef std::map<GLuint, ProgramInfo::Ref> ProgramInfoMap; | 287 typedef std::map<GLuint, ProgramInfo::Ref> ProgramInfoMap; |
284 ProgramInfoMap program_infos_; | 288 ProgramInfoMap program_infos_; |
285 | 289 |
| 290 int uniform_swizzle_; |
| 291 |
286 void RemoveProgramInfoIfUnused( | 292 void RemoveProgramInfoIfUnused( |
287 ShaderManager* shader_manager, ProgramInfo* info); | 293 ShaderManager* shader_manager, ProgramInfo* info); |
288 | 294 |
289 DISALLOW_COPY_AND_ASSIGN(ProgramManager); | 295 DISALLOW_COPY_AND_ASSIGN(ProgramManager); |
290 }; | 296 }; |
291 | 297 |
292 } // namespace gles2 | 298 } // namespace gles2 |
293 } // namespace gpu | 299 } // namespace gpu |
294 | 300 |
295 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ | 301 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ |
OLD | NEW |