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 |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 namespace gpu { | 25 namespace gpu { |
26 | 26 |
27 struct GpuPreferences; | 27 struct GpuPreferences; |
28 | 28 |
29 namespace gles2 { | 29 namespace gles2 { |
30 | 30 |
31 class FeatureInfo; | 31 class FeatureInfo; |
32 class ProgramCache; | 32 class ProgramCache; |
33 class ProgramManager; | 33 class ProgramManager; |
| 34 class ProgressReporter; |
34 class Shader; | 35 class Shader; |
35 class ShaderManager; | 36 class ShaderManager; |
36 | 37 |
37 // This is used to track which attributes a particular program needs | 38 // This is used to track which attributes a particular program needs |
38 // so we can verify at glDrawXXX time that every attribute is either disabled | 39 // so we can verify at glDrawXXX time that every attribute is either disabled |
39 // or if enabled that it points to a valid source. | 40 // or if enabled that it points to a valid source. |
40 class GPU_EXPORT Program : public base::RefCounted<Program> { | 41 class GPU_EXPORT Program : public base::RefCounted<Program> { |
41 public: | 42 public: |
42 static const int kMaxAttachedShaders = 2; | 43 static const int kMaxAttachedShaders = 2; |
43 | 44 |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 // NOTE: To support shared resources an instance of this class will | 592 // NOTE: To support shared resources an instance of this class will |
592 // need to be shared by multiple GLES2Decoders. | 593 // need to be shared by multiple GLES2Decoders. |
593 class GPU_EXPORT ProgramManager { | 594 class GPU_EXPORT ProgramManager { |
594 public: | 595 public: |
595 ProgramManager(ProgramCache* program_cache, | 596 ProgramManager(ProgramCache* program_cache, |
596 uint32_t max_varying_vectors, | 597 uint32_t max_varying_vectors, |
597 uint32_t max_draw_buffers, | 598 uint32_t max_draw_buffers, |
598 uint32_t max_dual_source_draw_buffers, | 599 uint32_t max_dual_source_draw_buffers, |
599 uint32_t max_vertex_attribs, | 600 uint32_t max_vertex_attribs, |
600 const GpuPreferences& gpu_preferences, | 601 const GpuPreferences& gpu_preferences, |
601 FeatureInfo* feature_info); | 602 FeatureInfo* feature_info, |
| 603 ProgressReporter* progress_reporter); |
602 ~ProgramManager(); | 604 ~ProgramManager(); |
603 | 605 |
604 // Must call before destruction. | 606 // Must call before destruction. |
605 void Destroy(bool have_context); | 607 void Destroy(bool have_context); |
606 | 608 |
607 // Creates a new program. | 609 // Creates a new program. |
608 Program* CreateProgram(GLuint client_id, GLuint service_id); | 610 Program* CreateProgram(GLuint client_id, GLuint service_id); |
609 | 611 |
610 // Gets a program. | 612 // Gets a program. |
611 Program* GetProgram(GLuint client_id); | 613 Program* GetProgram(GLuint client_id); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 ProgramCache* program_cache_; | 675 ProgramCache* program_cache_; |
674 | 676 |
675 uint32_t max_varying_vectors_; | 677 uint32_t max_varying_vectors_; |
676 uint32_t max_draw_buffers_; | 678 uint32_t max_draw_buffers_; |
677 uint32_t max_dual_source_draw_buffers_; | 679 uint32_t max_dual_source_draw_buffers_; |
678 uint32_t max_vertex_attribs_; | 680 uint32_t max_vertex_attribs_; |
679 | 681 |
680 const GpuPreferences& gpu_preferences_; | 682 const GpuPreferences& gpu_preferences_; |
681 scoped_refptr<FeatureInfo> feature_info_; | 683 scoped_refptr<FeatureInfo> feature_info_; |
682 | 684 |
| 685 // Used to notify the watchdog thread of progress during destruction, |
| 686 // preventing time-outs when destruction takes a long time. May be null when |
| 687 // using in-process command buffer. |
| 688 ProgressReporter* progress_reporter_; |
| 689 |
683 DISALLOW_COPY_AND_ASSIGN(ProgramManager); | 690 DISALLOW_COPY_AND_ASSIGN(ProgramManager); |
684 }; | 691 }; |
685 | 692 |
686 inline const FeatureInfo& Program::feature_info() const { | 693 inline const FeatureInfo& Program::feature_info() const { |
687 return *manager_->feature_info_.get(); | 694 return *manager_->feature_info_.get(); |
688 } | 695 } |
689 | 696 |
690 } // namespace gles2 | 697 } // namespace gles2 |
691 } // namespace gpu | 698 } // namespace gpu |
692 | 699 |
693 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ | 700 #endif // GPU_COMMAND_BUFFER_SERVICE_PROGRAM_MANAGER_H_ |
OLD | NEW |