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_CONTEXT_GROUP_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 class TextureManager; | 31 class TextureManager; |
32 struct DisallowedFeatures; | 32 struct DisallowedFeatures; |
33 | 33 |
34 // A Context Group helps manage multiple GLES2Decoders that share | 34 // A Context Group helps manage multiple GLES2Decoders that share |
35 // resources. | 35 // resources. |
36 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { | 36 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { |
37 public: | 37 public: |
38 typedef scoped_refptr<ContextGroup> Ref; | 38 typedef scoped_refptr<ContextGroup> Ref; |
39 | 39 |
40 explicit ContextGroup(bool bind_generates_resource); | 40 explicit ContextGroup(bool bind_generates_resource); |
41 ~ContextGroup(); | |
42 | 41 |
43 // This should only be called by GLES2Decoder. This must be paired with a | 42 // This should only be called by GLES2Decoder. This must be paired with a |
44 // call to destroy if it succeeds. | 43 // call to destroy if it succeeds. |
45 bool Initialize(const DisallowedFeatures& disallowed_features, | 44 bool Initialize(const DisallowedFeatures& disallowed_features, |
46 const char* allowed_features); | 45 const char* allowed_features); |
47 | 46 |
48 // Destroys all the resources when called for the last context in the group. | 47 // Destroys all the resources when called for the last context in the group. |
49 // It should only be called by GLES2Decoder. | 48 // It should only be called by GLES2Decoder. |
50 void Destroy(bool have_context); | 49 void Destroy(bool have_context); |
51 | 50 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 return program_manager_.get(); | 104 return program_manager_.get(); |
106 } | 105 } |
107 | 106 |
108 ShaderManager* shader_manager() const { | 107 ShaderManager* shader_manager() const { |
109 return shader_manager_.get(); | 108 return shader_manager_.get(); |
110 } | 109 } |
111 | 110 |
112 IdAllocatorInterface* GetIdAllocator(unsigned namespace_id); | 111 IdAllocatorInterface* GetIdAllocator(unsigned namespace_id); |
113 | 112 |
114 private: | 113 private: |
| 114 friend class base::RefCounted<ContextGroup>; |
| 115 ~ContextGroup(); |
| 116 |
115 // Whether or not this context is initialized. | 117 // Whether or not this context is initialized. |
116 int num_contexts_; | 118 int num_contexts_; |
117 bool bind_generates_resource_; | 119 bool bind_generates_resource_; |
118 | 120 |
119 uint32 max_vertex_attribs_; | 121 uint32 max_vertex_attribs_; |
120 uint32 max_texture_units_; | 122 uint32 max_texture_units_; |
121 uint32 max_texture_image_units_; | 123 uint32 max_texture_image_units_; |
122 uint32 max_vertex_texture_image_units_; | 124 uint32 max_vertex_texture_image_units_; |
123 uint32 max_fragment_uniform_vectors_; | 125 uint32 max_fragment_uniform_vectors_; |
124 uint32 max_varying_vectors_; | 126 uint32 max_varying_vectors_; |
(...skipping 18 matching lines...) Expand all Loading... |
143 | 145 |
144 DISALLOW_COPY_AND_ASSIGN(ContextGroup); | 146 DISALLOW_COPY_AND_ASSIGN(ContextGroup); |
145 }; | 147 }; |
146 | 148 |
147 } // namespace gles2 | 149 } // namespace gles2 |
148 } // namespace gpu | 150 } // namespace gpu |
149 | 151 |
150 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 152 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
151 | 153 |
152 | 154 |
OLD | NEW |