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

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

Issue 1542513002: Switch to standard integer types in gpu/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years 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
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 <stddef.h>
9 #include <stdint.h>
10
8 #include <map> 11 #include <map>
9 #include <string> 12 #include <string>
10 #include <vector> 13 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
14 #include "gpu/command_buffer/service/common_decoder.h" 17 #include "gpu/command_buffer/service/common_decoder.h"
15 #include "gpu/command_buffer/service/gl_utils.h" 18 #include "gpu/command_buffer/service/gl_utils.h"
16 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 19 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
17 #include "gpu/command_buffer/service/shader_manager.h" 20 #include "gpu/command_buffer/service/shader_manager.h"
18 #include "gpu/gpu_export.h" 21 #include "gpu/gpu_export.h"
19 22
20 namespace gpu { 23 namespace gpu {
21 namespace gles2 { 24 namespace gles2 {
22 25
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 bool _is_array, 92 bool _is_array,
90 const std::vector<GLint>& service_locations); 93 const std::vector<GLint>& service_locations);
91 ~UniformInfo(); 94 ~UniformInfo();
92 bool IsSampler() const { 95 bool IsSampler() const {
93 return type == GL_SAMPLER_2D || type == GL_SAMPLER_2D_RECT_ARB || 96 return type == GL_SAMPLER_2D || type == GL_SAMPLER_2D_RECT_ARB ||
94 type == GL_SAMPLER_CUBE || type == GL_SAMPLER_EXTERNAL_OES; 97 type == GL_SAMPLER_CUBE || type == GL_SAMPLER_EXTERNAL_OES;
95 } 98 }
96 99
97 GLsizei size; 100 GLsizei size;
98 GLenum type; 101 GLenum type;
99 uint32 accepts_api_type; 102 uint32_t accepts_api_type;
100 GLint fake_location_base; 103 GLint fake_location_base;
101 bool is_array; 104 bool is_array;
102 std::string name; 105 std::string name;
103 std::vector<GLint> element_locations; 106 std::vector<GLint> element_locations;
104 std::vector<GLuint> texture_units; 107 std::vector<GLuint> texture_units;
105 }; 108 };
106 struct VertexAttrib { 109 struct VertexAttrib {
107 VertexAttrib(GLsizei _size, GLenum _type, const std::string& _name, 110 VertexAttrib(GLsizei _size, GLenum _type, const std::string& _name,
108 GLint _location) 111 GLint _location)
109 : size(_size), 112 : size(_size),
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 const std::string& prefix); 428 const std::string& prefix);
426 429
427 // Get UniformBlock from InterfaceBlock 430 // Get UniformBlock from InterfaceBlock
428 void GetUniformBlockFromInterfaceBlock( 431 void GetUniformBlockFromInterfaceBlock(
429 Shader* shader, const sh::InterfaceBlock& interface_block); 432 Shader* shader, const sh::InterfaceBlock& interface_block);
430 433
431 // Get UniformBlocks info 434 // Get UniformBlocks info
432 void GatherInterfaceBlockInfo(); 435 void GatherInterfaceBlockInfo();
433 436
434 // Clears all the uniforms. 437 // Clears all the uniforms.
435 void ClearUniforms(std::vector<uint8>* zero_buffer); 438 void ClearUniforms(std::vector<uint8_t>* zero_buffer);
436 439
437 // If long attribate names are mapped during shader translation, call 440 // If long attribate names are mapped during shader translation, call
438 // glBindAttribLocation() again with the mapped names. 441 // glBindAttribLocation() again with the mapped names.
439 // This is called right before the glLink() call, but after shaders are 442 // This is called right before the glLink() call, but after shaders are
440 // translated. 443 // translated.
441 void ExecuteBindAttribLocationCalls(); 444 void ExecuteBindAttribLocationCalls();
442 445
443 // The names of transform feedback varyings need to be hashed just 446 // The names of transform feedback varyings need to be hashed just
444 // like bound attributes' locations, just before the link call. 447 // like bound attributes' locations, just before the link call.
445 // Returns false upon failure. 448 // Returns false upon failure.
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 LocationIndexMap bind_program_output_location_index_map_; 535 LocationIndexMap bind_program_output_location_index_map_;
533 }; 536 };
534 537
535 // Tracks the Programs. 538 // Tracks the Programs.
536 // 539 //
537 // NOTE: To support shared resources an instance of this class will 540 // NOTE: To support shared resources an instance of this class will
538 // need to be shared by multiple GLES2Decoders. 541 // need to be shared by multiple GLES2Decoders.
539 class GPU_EXPORT ProgramManager { 542 class GPU_EXPORT ProgramManager {
540 public: 543 public:
541 explicit ProgramManager(ProgramCache* program_cache, 544 explicit ProgramManager(ProgramCache* program_cache,
542 uint32 max_varying_vectors, 545 uint32_t max_varying_vectors,
543 uint32 max_dual_source_draw_buffers, 546 uint32_t max_dual_source_draw_buffers,
544 FeatureInfo* feature_info); 547 FeatureInfo* feature_info);
545 ~ProgramManager(); 548 ~ProgramManager();
546 549
547 // Must call before destruction. 550 // Must call before destruction.
548 void Destroy(bool have_context); 551 void Destroy(bool have_context);
549 552
550 // Creates a new program. 553 // Creates a new program.
551 Program* CreateProgram(GLuint client_id, GLuint service_id); 554 Program* CreateProgram(GLuint client_id, GLuint service_id);
552 555
553 // Gets a program. 556 // Gets a program.
(...skipping 17 matching lines...) Expand all
571 // Clears the uniforms for this program. 574 // Clears the uniforms for this program.
572 void ClearUniforms(Program* program); 575 void ClearUniforms(Program* program);
573 576
574 // Returns true if |name| has a prefix that is intended for GL built-in shader 577 // Returns true if |name| has a prefix that is intended for GL built-in shader
575 // variables. 578 // variables.
576 static bool HasBuiltInPrefix(const std::string& name); 579 static bool HasBuiltInPrefix(const std::string& name);
577 580
578 // Check if a Program is owned by this ProgramManager. 581 // Check if a Program is owned by this ProgramManager.
579 bool IsOwned(Program* program) const; 582 bool IsOwned(Program* program) const;
580 583
581 static int32 MakeFakeLocation(int32 index, int32 element); 584 static int32_t MakeFakeLocation(int32_t index, int32_t element);
582 585
583 uint32 max_varying_vectors() const { 586 uint32_t max_varying_vectors() const { return max_varying_vectors_; }
584 return max_varying_vectors_;
585 }
586 587
587 uint32 max_dual_source_draw_buffers() const { 588 uint32_t max_dual_source_draw_buffers() const {
588 return max_dual_source_draw_buffers_; 589 return max_dual_source_draw_buffers_;
589 } 590 }
590 591
591 private: 592 private:
592 friend class Program; 593 friend class Program;
593 594
594 void StartTracking(Program* program); 595 void StartTracking(Program* program);
595 void StopTracking(Program* program); 596 void StopTracking(Program* program);
596 597
597 void RemoveProgramInfoIfUnused( 598 void RemoveProgramInfoIfUnused(
598 ShaderManager* shader_manager, Program* program); 599 ShaderManager* shader_manager, Program* program);
599 600
600 // Info for each "successfully linked" program by service side program Id. 601 // Info for each "successfully linked" program by service side program Id.
601 // TODO(gman): Choose a faster container. 602 // TODO(gman): Choose a faster container.
602 typedef std::map<GLuint, scoped_refptr<Program> > ProgramMap; 603 typedef std::map<GLuint, scoped_refptr<Program> > ProgramMap;
603 ProgramMap programs_; 604 ProgramMap programs_;
604 605
605 // Counts the number of Program allocated with 'this' as its manager. 606 // Counts the number of Program allocated with 'this' as its manager.
606 // Allows to check no Program will outlive this. 607 // Allows to check no Program will outlive this.
607 unsigned int program_count_; 608 unsigned int program_count_;
608 609
609 bool have_context_; 610 bool have_context_;
610 611
611 // Used to clear uniforms. 612 // Used to clear uniforms.
612 std::vector<uint8> zero_; 613 std::vector<uint8_t> zero_;
613 614
614 ProgramCache* program_cache_; 615 ProgramCache* program_cache_;
615 616
616 uint32 max_varying_vectors_; 617 uint32_t max_varying_vectors_;
617 uint32 max_dual_source_draw_buffers_; 618 uint32_t max_dual_source_draw_buffers_;
618 619
619 scoped_refptr<FeatureInfo> feature_info_; 620 scoped_refptr<FeatureInfo> feature_info_;
620 621
621 DISALLOW_COPY_AND_ASSIGN(ProgramManager); 622 DISALLOW_COPY_AND_ASSIGN(ProgramManager);
622 }; 623 };
623 624
624 inline const FeatureInfo& Program::feature_info() const { 625 inline const FeatureInfo& Program::feature_info() const {
625 return *manager_->feature_info_.get(); 626 return *manager_->feature_info_.get();
626 } 627 }
627 628
628 } // namespace gles2 629 } // namespace gles2
629 } // namespace gpu 630 } // namespace gpu
630 631
631 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ 632 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/program_cache.cc ('k') | gpu/command_buffer/service/program_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698