Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(33)

Side by Side Diff: gpu/command_buffer/service/program_manager.h

Issue 12326146: Refactor/Rename a bunch of GPU stuff (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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>
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "gpu/command_buffer/service/common_decoder.h" 14 #include "gpu/command_buffer/service/common_decoder.h"
15 #include "gpu/command_buffer/service/gl_utils.h" 15 #include "gpu/command_buffer/service/gl_utils.h"
16 #include "gpu/command_buffer/service/shader_manager.h" 16 #include "gpu/command_buffer/service/shader_manager.h"
17 #include "gpu/gpu_export.h" 17 #include "gpu/gpu_export.h"
18 18
19 namespace gpu { 19 namespace gpu {
20 namespace gles2 { 20 namespace gles2 {
21
22 class FeatureInfo;
21 class ProgramCache; 23 class ProgramCache;
22 class FeatureInfo; 24 class ProgramManager;
25
26 // This is used to track which attributes a particular program needs
27 // so we can verify at glDrawXXX time that every attribute is either disabled
28 // or if enabled that it points to a valid source.
29 class GPU_EXPORT Program : public base::RefCounted<Program> {
30 public:
31 static const int kMaxAttachedShaders = 2;
32
33 struct UniformInfo {
34 UniformInfo();
35 UniformInfo(
36 GLsizei _size, GLenum _type, GLint _fake_location_base,
37 const std::string& _name);
38 ~UniformInfo();
39
40 bool IsValid() const {
41 return size != 0;
42 }
43
44 bool IsSampler() const {
45 return type == GL_SAMPLER_2D || type == GL_SAMPLER_2D_RECT_ARB ||
46 type == GL_SAMPLER_CUBE || type == GL_SAMPLER_EXTERNAL_OES;
47 }
48
49 GLsizei size;
50 GLenum type;
51 GLint fake_location_base;
52 bool is_array;
53 std::string name;
54 std::vector<GLint> element_locations;
55 std::vector<GLuint> texture_units;
56 };
57 struct VertexAttrib {
58 VertexAttrib(GLsizei _size, GLenum _type, const std::string& _name,
59 GLint _location)
60 : size(_size),
61 type(_type),
62 location(_location),
63 name(_name) {
64 }
65 GLsizei size;
66 GLenum type;
67 GLint location;
68 std::string name;
69 };
70
71 typedef std::vector<UniformInfo> UniformInfoVector;
72 typedef std::vector<VertexAttrib> AttribInfoVector;
73 typedef std::vector<int> SamplerIndices;
74 typedef std::map<std::string, GLint> LocationMap;
75
76 Program(ProgramManager* manager, GLuint service_id);
77
78 GLuint service_id() const {
79 return service_id_;
80 }
81
82 const SamplerIndices& sampler_indices() {
83 return sampler_indices_;
84 }
85
86 const AttribInfoVector& GetAttribInfos() const {
87 return attrib_infos_;
88 }
89
90 const VertexAttrib* GetAttribInfo(GLint index) const {
91 return (static_cast<size_t>(index) < attrib_infos_.size()) ?
92 &attrib_infos_[index] : NULL;
93 }
94
95 GLint GetAttribLocation(const std::string& name) const;
96
97 const VertexAttrib* GetAttribInfoByLocation(GLuint location) const {
98 if (location < attrib_location_to_index_map_.size()) {
99 GLint index = attrib_location_to_index_map_[location];
100 if (index >= 0) {
101 return &attrib_infos_[index];
102 }
103 }
104 return NULL;
105 }
106
107 const UniformInfo* GetUniformInfo(GLint index) const;
108
109 // If the original name is not found, return NULL.
110 const std::string* GetAttribMappedName(
111 const std::string& original_name) const;
112
113 // If the hashed name is not found, return NULL.
114 const std::string* GetOriginalNameFromHashedName(
115 const std::string& hashed_name) const;
116
117 // Gets the fake location of a uniform by name.
118 GLint GetUniformFakeLocation(const std::string& name) const;
119
120 // Gets the UniformInfo of a uniform by location.
121 const UniformInfo* GetUniformInfoByFakeLocation(
122 GLint fake_location, GLint* real_location, GLint* array_index) const;
123
124 // Gets all the program info.
125 void GetProgram(
126 ProgramManager* manager, CommonDecoder::Bucket* bucket) const;
127
128 // Sets the sampler values for a uniform.
129 // This is safe to call for any location. If the location is not
130 // a sampler uniform nothing will happen.
131 // Returns false if fake_location is a sampler and any value
132 // is >= num_texture_units. Returns true otherwise.
133 bool SetSamplers(
134 GLint num_texture_units, GLint fake_location,
135 GLsizei count, const GLint* value);
136
137 bool IsDeleted() const {
138 return deleted_;
139 }
140
141 void GetProgramiv(GLenum pname, GLint* params);
142
143 bool IsValid() const {
144 return valid_;
145 }
146
147 bool AttachShader(ShaderManager* manager, Shader* info);
148 bool DetachShader(ShaderManager* manager, Shader* info);
149
150 bool CanLink() const;
151
152 // Performs glLinkProgram and related activities.
153 bool Link(ShaderManager* manager,
154 ShaderTranslator* vertex_translator,
155 ShaderTranslator* fragment_shader,
156 FeatureInfo* feature_info);
157
158 // Performs glValidateProgram and related activities.
159 void Validate();
160
161 const std::string* log_info() const {
162 return log_info_.get();
163 }
164
165 bool InUse() const {
166 DCHECK_GE(use_count_, 0);
167 return use_count_ != 0;
168 }
169
170 // Sets attribute-location binding from a glBindAttribLocation() call.
171 void SetAttribLocationBinding(const std::string& attrib, GLint location) {
172 bind_attrib_location_map_[attrib] = location;
173 }
174
175 // Sets uniform-location binding from a glBindUniformLocationCHROMIUM call.
176 // returns false if error.
177 bool SetUniformLocationBinding(const std::string& name, GLint location);
178
179 // Detects if there are attribute location conflicts from
180 // glBindAttribLocation() calls.
181 // We only consider the declared attributes in the program.
182 bool DetectAttribLocationBindingConflicts() const;
183
184 // Visible for testing
185 const LocationMap& bind_attrib_location_map() const {
186 return bind_attrib_location_map_;
187 }
188
189 private:
190 friend class base::RefCounted<Program>;
191 friend class ProgramManager;
192
193 ~Program();
194
195 void set_log_info(const char* str) {
196 log_info_.reset(str ? new std::string(str) : NULL);
197 }
198
199 void ClearLinkStatus() {
200 link_status_ = false;
201 }
202
203 void IncUseCount() {
204 ++use_count_;
205 }
206
207 void DecUseCount() {
208 --use_count_;
209 DCHECK_GE(use_count_, 0);
210 }
211
212 void MarkAsDeleted() {
213 DCHECK(!deleted_);
214 deleted_ = true;
215 }
216
217 // Resets the program.
218 void Reset();
219
220 // Updates the program info after a successful link.
221 void Update();
222
223 // Process the program log, replacing the hashed names with original names.
224 std::string ProcessLogInfo(const std::string& log);
225
226 // Updates the program log info from GL
227 void UpdateLogInfo();
228
229 // Clears all the uniforms.
230 void ClearUniforms(std::vector<uint8>* zero_buffer);
231
232 // If long attribate names are mapped during shader translation, call
233 // glBindAttribLocation() again with the mapped names.
234 // This is called right before the glLink() call, but after shaders are
235 // translated.
236 void ExecuteBindAttribLocationCalls();
237
238 bool AddUniformInfo(
239 GLsizei size, GLenum type, GLint location, GLint fake_base_location,
240 const std::string& name, const std::string& original_name,
241 size_t* next_available_index);
242
243 void GetCorrectedVariableInfo(
244 bool use_uniforms, const std::string& name, std::string* corrected_name,
245 std::string* original_name, GLsizei* size, GLenum* type) const;
246
247 void DetachShaders(ShaderManager* manager);
248
249 static inline GLint GetUniformInfoIndexFromFakeLocation(
250 GLint fake_location) {
251 return fake_location & 0xFFFF;
252 }
253
254 static inline GLint GetArrayElementIndexFromFakeLocation(
255 GLint fake_location) {
256 return (fake_location >> 16) & 0xFFFF;
257 }
258
259 ProgramManager* manager_;
260
261 int use_count_;
262
263 GLsizei max_attrib_name_length_;
264
265 // Attrib by index.
266 AttribInfoVector attrib_infos_;
267
268 // Attrib by location to index.
269 std::vector<GLint> attrib_location_to_index_map_;
270
271 GLsizei max_uniform_name_length_;
272
273 // Uniform info by index.
274 UniformInfoVector uniform_infos_;
275
276 // The indices of the uniforms that are samplers.
277 SamplerIndices sampler_indices_;
278
279 // The program this Program is tracking.
280 GLuint service_id_;
281
282 // Shaders by type of shader.
283 scoped_refptr<Shader>
284 attached_shaders_[kMaxAttachedShaders];
285
286 // True if this program is marked as deleted.
287 bool deleted_;
288
289 // This is true if glLinkProgram was successful at least once.
290 bool valid_;
291
292 // This is true if glLinkProgram was successful last time it was called.
293 bool link_status_;
294
295 // True if the uniforms have been cleared.
296 bool uniforms_cleared_;
297
298 // This is different than uniform_infos_.size() because
299 // that is a sparce array.
300 GLint num_uniforms_;
301
302 // Log info
303 scoped_ptr<std::string> log_info_;
304
305 // attribute-location binding map from glBindAttribLocation() calls.
306 LocationMap bind_attrib_location_map_;
307
308 // uniform-location binding map from glBindUniformLocationCHROMIUM() calls.
309 LocationMap bind_uniform_location_map_;
310 };
23 311
24 // Tracks the Programs. 312 // Tracks the Programs.
25 // 313 //
26 // NOTE: To support shared resources an instance of this class will 314 // NOTE: To support shared resources an instance of this class will
27 // need to be shared by multiple GLES2Decoders. 315 // need to be shared by multiple GLES2Decoders.
28 class GPU_EXPORT ProgramManager { 316 class GPU_EXPORT ProgramManager {
29 public: 317 public:
30 typedef std::map<std::string, GLint> LocationMap;
31
32 // This is used to track which attributes a particular program needs
33 // so we can verify at glDrawXXX time that every attribute is either disabled
34 // or if enabled that it points to a valid source.
35 class GPU_EXPORT ProgramInfo : public base::RefCounted<ProgramInfo> {
36 public:
37 typedef scoped_refptr<ProgramInfo> Ref;
38
39 static const int kMaxAttachedShaders = 2;
40
41 struct UniformInfo {
42 UniformInfo();
43 UniformInfo(
44 GLsizei _size, GLenum _type, GLint _fake_location_base,
45 const std::string& _name);
46 ~UniformInfo();
47
48 bool IsValid() const {
49 return size != 0;
50 }
51
52 bool IsSampler() const {
53 return type == GL_SAMPLER_2D || type == GL_SAMPLER_2D_RECT_ARB ||
54 type == GL_SAMPLER_CUBE || type == GL_SAMPLER_EXTERNAL_OES;
55 }
56
57 GLsizei size;
58 GLenum type;
59 GLint fake_location_base;
60 bool is_array;
61 std::string name;
62 std::vector<GLint> element_locations;
63 std::vector<GLuint> texture_units;
64 };
65 struct VertexAttribInfo {
66 VertexAttribInfo(GLsizei _size, GLenum _type, const std::string& _name,
67 GLint _location)
68 : size(_size),
69 type(_type),
70 location(_location),
71 name(_name) {
72 }
73 GLsizei size;
74 GLenum type;
75 GLint location;
76 std::string name;
77 };
78
79 typedef std::vector<UniformInfo> UniformInfoVector;
80 typedef std::vector<VertexAttribInfo> AttribInfoVector;
81 typedef std::vector<int> SamplerIndices;
82
83 ProgramInfo(ProgramManager* manager, GLuint service_id);
84
85 GLuint service_id() const {
86 return service_id_;
87 }
88
89 const SamplerIndices& sampler_indices() {
90 return sampler_indices_;
91 }
92
93 const AttribInfoVector& GetAttribInfos() const {
94 return attrib_infos_;
95 }
96
97 const VertexAttribInfo* GetAttribInfo(GLint index) const {
98 return (static_cast<size_t>(index) < attrib_infos_.size()) ?
99 &attrib_infos_[index] : NULL;
100 }
101
102 GLint GetAttribLocation(const std::string& name) const;
103
104 const VertexAttribInfo* GetAttribInfoByLocation(GLuint location) const {
105 if (location < attrib_location_to_index_map_.size()) {
106 GLint index = attrib_location_to_index_map_[location];
107 if (index >= 0) {
108 return &attrib_infos_[index];
109 }
110 }
111 return NULL;
112 }
113
114 const UniformInfo* GetUniformInfo(GLint index) const;
115
116 // If the original name is not found, return NULL.
117 const std::string* GetAttribMappedName(
118 const std::string& original_name) const;
119
120 // If the hashed name is not found, return NULL.
121 const std::string* GetOriginalNameFromHashedName(
122 const std::string& hashed_name) const;
123
124 // Gets the fake location of a uniform by name.
125 GLint GetUniformFakeLocation(const std::string& name) const;
126
127 // Gets the UniformInfo of a uniform by location.
128 const UniformInfo* GetUniformInfoByFakeLocation(
129 GLint fake_location, GLint* real_location, GLint* array_index) const;
130
131 // Gets all the program info.
132 void GetProgramInfo(
133 ProgramManager* manager, CommonDecoder::Bucket* bucket) const;
134
135 // Sets the sampler values for a uniform.
136 // This is safe to call for any location. If the location is not
137 // a sampler uniform nothing will happen.
138 // Returns false if fake_location is a sampler and any value
139 // is >= num_texture_units. Returns true otherwise.
140 bool SetSamplers(
141 GLint num_texture_units, GLint fake_location,
142 GLsizei count, const GLint* value);
143
144 bool IsDeleted() const {
145 return deleted_;
146 }
147
148 void GetProgramiv(GLenum pname, GLint* params);
149
150 bool IsValid() const {
151 return valid_;
152 }
153
154 bool AttachShader(ShaderManager* manager, ShaderManager::ShaderInfo* info);
155 bool DetachShader(ShaderManager* manager, ShaderManager::ShaderInfo* info);
156
157 bool CanLink() const;
158
159 // Performs glLinkProgram and related activities.
160 bool Link(ShaderManager* manager,
161 ShaderTranslator* vertex_translator,
162 ShaderTranslator* fragment_shader,
163 FeatureInfo* feature_info);
164
165 // Performs glValidateProgram and related activities.
166 void Validate();
167
168 const std::string* log_info() const {
169 return log_info_.get();
170 }
171
172 bool InUse() const {
173 DCHECK_GE(use_count_, 0);
174 return use_count_ != 0;
175 }
176
177 // Sets attribute-location binding from a glBindAttribLocation() call.
178 void SetAttribLocationBinding(const std::string& attrib, GLint location) {
179 bind_attrib_location_map_[attrib] = location;
180 }
181
182 // Sets uniform-location binding from a glBindUniformLocationCHROMIUM call.
183 // returns false if error.
184 bool SetUniformLocationBinding(const std::string& name, GLint location);
185
186 // Detects if there are attribute location conflicts from
187 // glBindAttribLocation() calls.
188 // We only consider the declared attributes in the program.
189 bool DetectAttribLocationBindingConflicts() const;
190
191 // Visible for testing
192 const LocationMap& bind_attrib_location_map() const {
193 return bind_attrib_location_map_;
194 }
195
196 private:
197 friend class base::RefCounted<ProgramInfo>;
198 friend class ProgramManager;
199
200 ~ProgramInfo();
201
202 void set_log_info(const char* str) {
203 log_info_.reset(str ? new std::string(str) : NULL);
204 }
205
206 void ClearLinkStatus() {
207 link_status_ = false;
208 }
209
210 void IncUseCount() {
211 ++use_count_;
212 }
213
214 void DecUseCount() {
215 --use_count_;
216 DCHECK_GE(use_count_, 0);
217 }
218
219 void MarkAsDeleted() {
220 DCHECK(!deleted_);
221 deleted_ = true;
222 }
223
224 // Resets the program.
225 void Reset();
226
227 // Updates the program info after a successful link.
228 void Update();
229
230 // Process the program log, replacing the hashed names with original names.
231 std::string ProcessLogInfo(const std::string& log);
232
233 // Updates the program log info from GL
234 void UpdateLogInfo();
235
236 // Clears all the uniforms.
237 void ClearUniforms(std::vector<uint8>* zero_buffer);
238
239 // If long attribate names are mapped during shader translation, call
240 // glBindAttribLocation() again with the mapped names.
241 // This is called right before the glLink() call, but after shaders are
242 // translated.
243 void ExecuteBindAttribLocationCalls();
244
245 bool AddUniformInfo(
246 GLsizei size, GLenum type, GLint location, GLint fake_base_location,
247 const std::string& name, const std::string& original_name,
248 size_t* next_available_index);
249
250 void GetCorrectedVariableInfo(
251 bool use_uniforms, const std::string& name, std::string* corrected_name,
252 std::string* original_name, GLsizei* size, GLenum* type) const;
253
254 void DetachShaders(ShaderManager* manager);
255
256 static inline GLint GetUniformInfoIndexFromFakeLocation(
257 GLint fake_location) {
258 return fake_location & 0xFFFF;
259 }
260
261 static inline GLint GetArrayElementIndexFromFakeLocation(
262 GLint fake_location) {
263 return (fake_location >> 16) & 0xFFFF;
264 }
265
266 ProgramManager* manager_;
267
268 int use_count_;
269
270 GLsizei max_attrib_name_length_;
271
272 // Attrib by index.
273 AttribInfoVector attrib_infos_;
274
275 // Attrib by location to index.
276 std::vector<GLint> attrib_location_to_index_map_;
277
278 GLsizei max_uniform_name_length_;
279
280 // Uniform info by index.
281 UniformInfoVector uniform_infos_;
282
283 // The indices of the uniforms that are samplers.
284 SamplerIndices sampler_indices_;
285
286 // The program this ProgramInfo is tracking.
287 GLuint service_id_;
288
289 // Shaders by type of shader.
290 ShaderManager::ShaderInfo::Ref attached_shaders_[kMaxAttachedShaders];
291
292 // True if this program is marked as deleted.
293 bool deleted_;
294
295 // This is true if glLinkProgram was successful at least once.
296 bool valid_;
297
298 // This is true if glLinkProgram was successful last time it was called.
299 bool link_status_;
300
301 // True if the uniforms have been cleared.
302 bool uniforms_cleared_;
303
304 // This is different than uniform_infos_.size() because
305 // that is a sparce array.
306 GLint num_uniforms_;
307
308 // Log info
309 scoped_ptr<std::string> log_info_;
310
311 // attribute-location binding map from glBindAttribLocation() calls.
312 LocationMap bind_attrib_location_map_;
313
314 // uniform-location binding map from glBindUniformLocationCHROMIUM() calls.
315 LocationMap bind_uniform_location_map_;
316 };
317
318 explicit ProgramManager(ProgramCache* program_cache); 318 explicit ProgramManager(ProgramCache* program_cache);
319 ~ProgramManager(); 319 ~ProgramManager();
320 320
321 // Must call before destruction. 321 // Must call before destruction.
322 void Destroy(bool have_context); 322 void Destroy(bool have_context);
323 323
324 // Creates a new program info. 324 // Creates a new program info.
325 ProgramInfo* CreateProgramInfo(GLuint client_id, GLuint service_id); 325 Program* CreateProgram(GLuint client_id, GLuint service_id);
326 326
327 // Gets a program info 327 // Gets a program info
328 ProgramInfo* GetProgramInfo(GLuint client_id); 328 Program* GetProgram(GLuint client_id);
329 329
330 // Gets a client id for a given service id. 330 // Gets a client id for a given service id.
331 bool GetClientId(GLuint service_id, GLuint* client_id) const; 331 bool GetClientId(GLuint service_id, GLuint* client_id) const;
332 332
333 // Gets the shader cache 333 // Gets the shader cache
334 ProgramCache* program_cache() const; 334 ProgramCache* program_cache() const;
335 335
336 // Marks a program as deleted. If it is not used the info will be deleted. 336 // Marks a program as deleted. If it is not used the info will be deleted.
337 void MarkAsDeleted(ShaderManager* shader_manager, ProgramInfo* info); 337 void MarkAsDeleted(ShaderManager* shader_manager, Program* info);
338 338
339 // Marks a program as used. 339 // Marks a program as used.
340 void UseProgram(ProgramInfo* info); 340 void UseProgram(Program* info);
341 341
342 // Makes a program as unused. If deleted the program info will be removed. 342 // Makes a program as unused. If deleted the program info will be removed.
343 void UnuseProgram(ShaderManager* shader_manager, ProgramInfo* info); 343 void UnuseProgram(ShaderManager* shader_manager, Program* info);
344 344
345 // Clears the uniforms for this program. 345 // Clears the uniforms for this program.
346 void ClearUniforms(ProgramInfo* info); 346 void ClearUniforms(Program* info);
347 347
348 // Returns true if prefix is invalid for gl. 348 // Returns true if prefix is invalid for gl.
349 static bool IsInvalidPrefix(const char* name, size_t length); 349 static bool IsInvalidPrefix(const char* name, size_t length);
350 350
351 // Check if a ProgramInfo is owned by this ProgramManager. 351 // Check if a Program is owned by this ProgramManager.
352 bool IsOwned(ProgramInfo* info); 352 bool IsOwned(Program* info);
353 353
354 static int32 MakeFakeLocation(int32 index, int32 element); 354 static int32 MakeFakeLocation(int32 index, int32 element);
355 355
356 // Cache-aware shader compiling. If no cache or if the shader wasn't 356 // Cache-aware shader compiling. If no cache or if the shader wasn't
357 // previously compiled, ForceCompileShader is called 357 // previously compiled, ForceCompileShader is called
358 void DoCompileShader(ShaderManager::ShaderInfo* info, 358 void DoCompileShader(Shader* info,
359 ShaderTranslator* translator, 359 ShaderTranslator* translator,
360 FeatureInfo* feature_info); 360 FeatureInfo* feature_info);
361 361
362 // Actually compiles the shader 362 // Actually compiles the shader
363 void ForceCompileShader(const std::string* source, 363 void ForceCompileShader(const std::string* source,
364 ShaderManager::ShaderInfo* info, 364 Shader* info,
365 ShaderTranslator* translator, 365 ShaderTranslator* translator,
366 FeatureInfo* feature_info); 366 FeatureInfo* feature_info);
367 367
368 private: 368 private:
369 void StartTracking(ProgramInfo* info); 369 friend class Program;
370 void StopTracking(ProgramInfo* info); 370
371 void StartTracking(Program* info);
372 void StopTracking(Program* info);
371 373
372 // Info for each "successfully linked" program by service side program Id. 374 // Info for each "successfully linked" program by service side program Id.
373 // TODO(gman): Choose a faster container. 375 // TODO(gman): Choose a faster container.
374 typedef std::map<GLuint, ProgramInfo::Ref> ProgramInfoMap; 376 typedef std::map<GLuint, scoped_refptr<Program> > ProgramInfoMap;
375 ProgramInfoMap program_infos_; 377 ProgramInfoMap program_infos_;
376 378
377 // Counts the number of ProgramInfo allocated with 'this' as its manager. 379 // Counts the number of Program allocated with 'this' as its manager.
378 // Allows to check no ProgramInfo will outlive this. 380 // Allows to check no Program will outlive this.
379 unsigned int program_info_count_; 381 unsigned int program_info_count_;
380 382
381 bool have_context_; 383 bool have_context_;
382 384
383 bool disable_workarounds_; 385 bool disable_workarounds_;
384 386
385 // Used to clear uniforms. 387 // Used to clear uniforms.
386 std::vector<uint8> zero_; 388 std::vector<uint8> zero_;
387 389
388 ProgramCache* program_cache_; 390 ProgramCache* program_cache_;
389 391
390 void RemoveProgramInfoIfUnused( 392 void RemoveProgramInfoIfUnused(
391 ShaderManager* shader_manager, ProgramInfo* info); 393 ShaderManager* shader_manager, Program* info);
392 394
393 DISALLOW_COPY_AND_ASSIGN(ProgramManager); 395 DISALLOW_COPY_AND_ASSIGN(ProgramManager);
394 }; 396 };
395 397
396 } // namespace gles2 398 } // namespace gles2
397 } // namespace gpu 399 } // namespace gpu
398 400
399 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ 401 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/program_cache_unittest.cc ('k') | gpu/command_buffer/service/program_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698