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

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

Issue 159183002: Revert 250146 "Merge 249460 "Hookup clear_uniforms_before_first_..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1750/src/
Patch Set: Created 6 years, 10 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/gles2_cmd_decoder.h" 16 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
17 #include "gpu/command_buffer/service/shader_manager.h" 17 #include "gpu/command_buffer/service/shader_manager.h"
18 #include "gpu/gpu_export.h" 18 #include "gpu/gpu_export.h"
19 19
20 namespace gpu { 20 namespace gpu {
21 namespace gles2 { 21 namespace gles2 {
22 22
23 class FeatureInfo;
23 class ProgramCache; 24 class ProgramCache;
24 class ProgramManager; 25 class ProgramManager;
25 class Shader; 26 class Shader;
26 class ShaderManager; 27 class ShaderManager;
27 class ShaderTranslator; 28 class ShaderTranslator;
28 29
29 // This is used to track which attributes a particular program needs 30 // This is used to track which attributes a particular program needs
30 // so we can verify at glDrawXXX time that every attribute is either disabled 31 // so we can verify at glDrawXXX time that every attribute is either disabled
31 // or if enabled that it points to a valid source. 32 // or if enabled that it points to a valid source.
32 class GPU_EXPORT Program : public base::RefCounted<Program> { 33 class GPU_EXPORT Program : public base::RefCounted<Program> {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 150
150 bool AttachShader(ShaderManager* manager, Shader* shader); 151 bool AttachShader(ShaderManager* manager, Shader* shader);
151 bool DetachShader(ShaderManager* manager, Shader* shader); 152 bool DetachShader(ShaderManager* manager, Shader* shader);
152 153
153 bool CanLink() const; 154 bool CanLink() const;
154 155
155 // Performs glLinkProgram and related activities. 156 // Performs glLinkProgram and related activities.
156 bool Link(ShaderManager* manager, 157 bool Link(ShaderManager* manager,
157 ShaderTranslator* vertex_translator, 158 ShaderTranslator* vertex_translator,
158 ShaderTranslator* fragment_shader, 159 ShaderTranslator* fragment_shader,
160 FeatureInfo* feature_info,
159 const ShaderCacheCallback& shader_callback); 161 const ShaderCacheCallback& shader_callback);
160 162
161 // Performs glValidateProgram and related activities. 163 // Performs glValidateProgram and related activities.
162 void Validate(); 164 void Validate();
163 165
164 const std::string* log_info() const { 166 const std::string* log_info() const {
165 return log_info_.get(); 167 return log_info_.get();
166 } 168 }
167 169
168 bool InUse() const { 170 bool InUse() const {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 // uniform-location binding map from glBindUniformLocationCHROMIUM() calls. 329 // uniform-location binding map from glBindUniformLocationCHROMIUM() calls.
328 LocationMap bind_uniform_location_map_; 330 LocationMap bind_uniform_location_map_;
329 }; 331 };
330 332
331 // Tracks the Programs. 333 // Tracks the Programs.
332 // 334 //
333 // NOTE: To support shared resources an instance of this class will 335 // NOTE: To support shared resources an instance of this class will
334 // need to be shared by multiple GLES2Decoders. 336 // need to be shared by multiple GLES2Decoders.
335 class GPU_EXPORT ProgramManager { 337 class GPU_EXPORT ProgramManager {
336 public: 338 public:
337 enum TranslatedShaderSourceType {
338 kANGLE,
339 kGL, // GL or GLES
340 };
341
342 explicit ProgramManager(ProgramCache* program_cache, 339 explicit ProgramManager(ProgramCache* program_cache,
343 uint32 max_varying_vectors); 340 uint32 max_varying_vectors);
344 ~ProgramManager(); 341 ~ProgramManager();
345 342
346 // Must call before destruction. 343 // Must call before destruction.
347 void Destroy(bool have_context); 344 void Destroy(bool have_context);
348 345
349 // Creates a new program. 346 // Creates a new program.
350 Program* CreateProgram(GLuint client_id, GLuint service_id); 347 Program* CreateProgram(GLuint client_id, GLuint service_id);
351 348
(...skipping 19 matching lines...) Expand all
371 void ClearUniforms(Program* program); 368 void ClearUniforms(Program* program);
372 369
373 // Returns true if prefix is invalid for gl. 370 // Returns true if prefix is invalid for gl.
374 static bool IsInvalidPrefix(const char* name, size_t length); 371 static bool IsInvalidPrefix(const char* name, size_t length);
375 372
376 // Check if a Program is owned by this ProgramManager. 373 // Check if a Program is owned by this ProgramManager.
377 bool IsOwned(Program* program); 374 bool IsOwned(Program* program);
378 375
379 static int32 MakeFakeLocation(int32 index, int32 element); 376 static int32 MakeFakeLocation(int32 index, int32 element);
380 377
381 void DoCompileShader( 378 void DoCompileShader(Shader* shader,
382 Shader* shader, 379 ShaderTranslator* translator,
383 ShaderTranslator* translator, 380 FeatureInfo* feature_info);
384 TranslatedShaderSourceType translated_shader_source_type);
385 381
386 uint32 max_varying_vectors() const { 382 uint32 max_varying_vectors() const {
387 return max_varying_vectors_; 383 return max_varying_vectors_;
388 } 384 }
389 385
390 private: 386 private:
391 friend class Program; 387 friend class Program;
392 388
393 void StartTracking(Program* program); 389 void StartTracking(Program* program);
394 void StopTracking(Program* program); 390 void StopTracking(Program* program);
395 391
396 void RemoveProgramInfoIfUnused( 392 void RemoveProgramInfoIfUnused(
397 ShaderManager* shader_manager, Program* program); 393 ShaderManager* shader_manager, Program* program);
398 394
399 // Info for each "successfully linked" program by service side program Id. 395 // Info for each "successfully linked" program by service side program Id.
400 // TODO(gman): Choose a faster container. 396 // TODO(gman): Choose a faster container.
401 typedef std::map<GLuint, scoped_refptr<Program> > ProgramMap; 397 typedef std::map<GLuint, scoped_refptr<Program> > ProgramMap;
402 ProgramMap programs_; 398 ProgramMap programs_;
403 399
404 // Counts the number of Program allocated with 'this' as its manager. 400 // Counts the number of Program allocated with 'this' as its manager.
405 // Allows to check no Program will outlive this. 401 // Allows to check no Program will outlive this.
406 unsigned int program_count_; 402 unsigned int program_count_;
407 403
408 bool have_context_; 404 bool have_context_;
409 405
406 bool disable_workarounds_;
407
410 // Used to clear uniforms. 408 // Used to clear uniforms.
411 std::vector<uint8> zero_; 409 std::vector<uint8> zero_;
412 410
413 ProgramCache* program_cache_; 411 ProgramCache* program_cache_;
414 412
415 uint32 max_varying_vectors_; 413 uint32 max_varying_vectors_;
416 414
417 DISALLOW_COPY_AND_ASSIGN(ProgramManager); 415 DISALLOW_COPY_AND_ASSIGN(ProgramManager);
418 }; 416 };
419 417
420 } // namespace gles2 418 } // namespace gles2
421 } // namespace gpu 419 } // namespace gpu
422 420
423 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ 421 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc ('k') | gpu/command_buffer/service/program_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698