| OLD | NEW |
| 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> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <map> | 11 #include <map> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <vector> | 13 #include <vector> |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 17 #include "gpu/command_buffer/service/common_decoder.h" | 17 #include "gpu/command_buffer/service/common_decoder.h" |
| 18 #include "gpu/command_buffer/service/gl_utils.h" | 18 #include "gpu/command_buffer/service/gl_utils.h" |
| 19 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 19 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 20 #include "gpu/command_buffer/service/shader_manager.h" | 20 #include "gpu/command_buffer/service/shader_manager.h" |
| 21 #include "gpu/gpu_export.h" | 21 #include "gpu/gpu_export.h" |
| 22 | 22 |
| 23 namespace gpu { | 23 namespace gpu { |
| 24 |
| 25 struct GpuPreferences; |
| 26 |
| 24 namespace gles2 { | 27 namespace gles2 { |
| 25 | 28 |
| 26 class FeatureInfo; | 29 class FeatureInfo; |
| 27 class ProgramCache; | 30 class ProgramCache; |
| 28 class ProgramManager; | 31 class ProgramManager; |
| 29 class Shader; | 32 class Shader; |
| 30 class ShaderManager; | 33 class ShaderManager; |
| 31 class FeatureInfo; | |
| 32 | 34 |
| 33 // This is used to track which attributes a particular program needs | 35 // This is used to track which attributes a particular program needs |
| 34 // so we can verify at glDrawXXX time that every attribute is either disabled | 36 // so we can verify at glDrawXXX time that every attribute is either disabled |
| 35 // or if enabled that it points to a valid source. | 37 // or if enabled that it points to a valid source. |
| 36 class GPU_EXPORT Program : public base::RefCounted<Program> { | 38 class GPU_EXPORT Program : public base::RefCounted<Program> { |
| 37 public: | 39 public: |
| 38 static const int kMaxAttachedShaders = 2; | 40 static const int kMaxAttachedShaders = 2; |
| 39 | 41 |
| 40 enum VaryingsPackingOption { | 42 enum VaryingsPackingOption { |
| 41 kCountOnlyStaticallyUsed, | 43 kCountOnlyStaticallyUsed, |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 // glBindFragDataLocation() and ..IndexedEXT() calls. | 537 // glBindFragDataLocation() and ..IndexedEXT() calls. |
| 536 LocationIndexMap bind_program_output_location_index_map_; | 538 LocationIndexMap bind_program_output_location_index_map_; |
| 537 }; | 539 }; |
| 538 | 540 |
| 539 // Tracks the Programs. | 541 // Tracks the Programs. |
| 540 // | 542 // |
| 541 // NOTE: To support shared resources an instance of this class will | 543 // NOTE: To support shared resources an instance of this class will |
| 542 // need to be shared by multiple GLES2Decoders. | 544 // need to be shared by multiple GLES2Decoders. |
| 543 class GPU_EXPORT ProgramManager { | 545 class GPU_EXPORT ProgramManager { |
| 544 public: | 546 public: |
| 545 explicit ProgramManager(ProgramCache* program_cache, | 547 ProgramManager(ProgramCache* program_cache, |
| 546 uint32_t max_varying_vectors, | 548 uint32_t max_varying_vectors, |
| 547 uint32_t max_dual_source_draw_buffers, | 549 uint32_t max_dual_source_draw_buffers, |
| 548 FeatureInfo* feature_info); | 550 const GpuPreferences& gpu_preferences, |
| 551 FeatureInfo* feature_info); |
| 549 ~ProgramManager(); | 552 ~ProgramManager(); |
| 550 | 553 |
| 551 // Must call before destruction. | 554 // Must call before destruction. |
| 552 void Destroy(bool have_context); | 555 void Destroy(bool have_context); |
| 553 | 556 |
| 554 // Creates a new program. | 557 // Creates a new program. |
| 555 Program* CreateProgram(GLuint client_id, GLuint service_id); | 558 Program* CreateProgram(GLuint client_id, GLuint service_id); |
| 556 | 559 |
| 557 // Gets a program. | 560 // Gets a program. |
| 558 Program* GetProgram(GLuint client_id); | 561 Program* GetProgram(GLuint client_id); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 bool have_context_; | 614 bool have_context_; |
| 612 | 615 |
| 613 // Used to clear uniforms. | 616 // Used to clear uniforms. |
| 614 std::vector<uint8_t> zero_; | 617 std::vector<uint8_t> zero_; |
| 615 | 618 |
| 616 ProgramCache* program_cache_; | 619 ProgramCache* program_cache_; |
| 617 | 620 |
| 618 uint32_t max_varying_vectors_; | 621 uint32_t max_varying_vectors_; |
| 619 uint32_t max_dual_source_draw_buffers_; | 622 uint32_t max_dual_source_draw_buffers_; |
| 620 | 623 |
| 624 const GpuPreferences& gpu_preferences_; |
| 621 scoped_refptr<FeatureInfo> feature_info_; | 625 scoped_refptr<FeatureInfo> feature_info_; |
| 622 | 626 |
| 623 DISALLOW_COPY_AND_ASSIGN(ProgramManager); | 627 DISALLOW_COPY_AND_ASSIGN(ProgramManager); |
| 624 }; | 628 }; |
| 625 | 629 |
| 626 inline const FeatureInfo& Program::feature_info() const { | 630 inline const FeatureInfo& Program::feature_info() const { |
| 627 return *manager_->feature_info_.get(); | 631 return *manager_->feature_info_.get(); |
| 628 } | 632 } |
| 629 | 633 |
| 630 } // namespace gles2 | 634 } // namespace gles2 |
| 631 } // namespace gpu | 635 } // namespace gpu |
| 632 | 636 |
| 633 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ | 637 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ |
| OLD | NEW |