OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 explicit ProgramInfo(GLuint service_id); | 68 explicit ProgramInfo(GLuint service_id); |
69 | 69 |
70 GLuint service_id() const { | 70 GLuint service_id() const { |
71 return service_id_; | 71 return service_id_; |
72 } | 72 } |
73 | 73 |
74 const SamplerIndices& sampler_indices() { | 74 const SamplerIndices& sampler_indices() { |
75 return sampler_indices_; | 75 return sampler_indices_; |
76 } | 76 } |
77 | 77 |
78 // Resets the program after an unsuccessful link. | |
79 void Reset(); | |
80 | |
81 // Updates the program info after a successful link. | 78 // Updates the program info after a successful link. |
82 void Update(); | 79 void Update(); |
83 | 80 |
84 // Updates the program log info. | 81 // Updates the program log info. |
85 void UpdateLogInfo(); | 82 void UpdateLogInfo(); |
86 | 83 |
87 const AttribInfoVector& GetAttribInfos() const { | 84 const AttribInfoVector& GetAttribInfos() const { |
88 return attrib_infos_; | 85 return attrib_infos_; |
89 } | 86 } |
90 | 87 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 bool IsDeleted() const { | 121 bool IsDeleted() const { |
125 return service_id_ == 0; | 122 return service_id_ == 0; |
126 } | 123 } |
127 | 124 |
128 void GetProgramiv(GLenum pname, GLint* params); | 125 void GetProgramiv(GLenum pname, GLint* params); |
129 | 126 |
130 bool IsValid() const { | 127 bool IsValid() const { |
131 return valid_; | 128 return valid_; |
132 } | 129 } |
133 | 130 |
| 131 void ClearLinkStatus() { |
| 132 link_status_ = false; |
| 133 } |
| 134 |
134 bool AttachShader(ShaderManager* manager, ShaderManager::ShaderInfo* info); | 135 bool AttachShader(ShaderManager* manager, ShaderManager::ShaderInfo* info); |
135 void DetachShader(ShaderManager* manager, ShaderManager::ShaderInfo* info); | 136 void DetachShader(ShaderManager* manager, ShaderManager::ShaderInfo* info); |
136 | 137 |
137 bool CanLink() const; | 138 bool CanLink() const; |
138 | 139 |
139 const std::string& log_info() const { | 140 const std::string& log_info() const { |
140 return log_info_; | 141 return log_info_; |
141 } | 142 } |
142 | 143 |
143 void set_log_info(const std::string& str) { | 144 void set_log_info(const std::string& str) { |
(...skipping 18 matching lines...) Expand all Loading... |
162 void DecUseCount() { | 163 void DecUseCount() { |
163 --use_count_; | 164 --use_count_; |
164 DCHECK_GE(use_count_, 0); | 165 DCHECK_GE(use_count_, 0); |
165 } | 166 } |
166 | 167 |
167 void MarkAsDeleted() { | 168 void MarkAsDeleted() { |
168 DCHECK_NE(service_id_, 0u); | 169 DCHECK_NE(service_id_, 0u); |
169 service_id_ = 0; | 170 service_id_ = 0; |
170 } | 171 } |
171 | 172 |
| 173 // Resets the program. |
| 174 void Reset(); |
| 175 |
172 const UniformInfo* AddUniformInfo( | 176 const UniformInfo* AddUniformInfo( |
173 GLsizei size, GLenum type, GLint location, const std::string& name); | 177 GLsizei size, GLenum type, GLint location, const std::string& name); |
174 | 178 |
175 void GetCorrectedVariableInfo( | 179 void GetCorrectedVariableInfo( |
176 bool use_uniforms, const std::string& name, std::string* corrected_name, | 180 bool use_uniforms, const std::string& name, std::string* corrected_name, |
177 GLsizei* size, GLenum* type) const; | 181 GLsizei* size, GLenum* type) const; |
178 | 182 |
179 void DetachShaders(ShaderManager* manager); | 183 void DetachShaders(ShaderManager* manager); |
180 | 184 |
181 int use_count_; | 185 int use_count_; |
(...skipping 16 matching lines...) Expand all Loading... |
198 | 202 |
199 // The indices of the uniforms that are samplers. | 203 // The indices of the uniforms that are samplers. |
200 SamplerIndices sampler_indices_; | 204 SamplerIndices sampler_indices_; |
201 | 205 |
202 // The program this ProgramInfo is tracking. | 206 // The program this ProgramInfo is tracking. |
203 GLuint service_id_; | 207 GLuint service_id_; |
204 | 208 |
205 // Shaders by type of shader. | 209 // Shaders by type of shader. |
206 ShaderManager::ShaderInfo::Ref attached_shaders_[kMaxAttachedShaders]; | 210 ShaderManager::ShaderInfo::Ref attached_shaders_[kMaxAttachedShaders]; |
207 | 211 |
208 // This is true if glLinkProgram was successful. | 212 // This is true if glLinkProgram was successful at least once. |
209 bool valid_; | 213 bool valid_; |
210 | 214 |
| 215 // This is true if glLinkProgram was successful last time it was called. |
| 216 bool link_status_; |
| 217 |
211 // Log info | 218 // Log info |
212 std::string log_info_; | 219 std::string log_info_; |
213 }; | 220 }; |
214 | 221 |
215 ProgramManager(); | 222 ProgramManager(); |
216 ~ProgramManager(); | 223 ~ProgramManager(); |
217 | 224 |
218 // Must call before destruction. | 225 // Must call before destruction. |
219 void Destroy(bool have_context); | 226 void Destroy(bool have_context); |
220 | 227 |
(...skipping 27 matching lines...) Expand all Loading... |
248 void RemoveProgramInfoIfUnused( | 255 void RemoveProgramInfoIfUnused( |
249 ShaderManager* shader_manager, ProgramInfo* info); | 256 ShaderManager* shader_manager, ProgramInfo* info); |
250 | 257 |
251 DISALLOW_COPY_AND_ASSIGN(ProgramManager); | 258 DISALLOW_COPY_AND_ASSIGN(ProgramManager); |
252 }; | 259 }; |
253 | 260 |
254 } // namespace gles2 | 261 } // namespace gles2 |
255 } // namespace gpu | 262 } // namespace gpu |
256 | 263 |
257 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ | 264 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ |
OLD | NEW |