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" |
11 #include "base/memory/linked_ptr.h" | 11 #include "base/memory/linked_ptr.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 14 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
15 #include "gpu/command_buffer/service/gles2_cmd_validation.h" | 15 #include "gpu/command_buffer/service/gles2_cmd_validation.h" |
16 #include "gpu/command_buffer/service/feature_info.h" | 16 #include "gpu/command_buffer/service/feature_info.h" |
17 #include "gpu/gpu_export.h" | 17 #include "gpu/gpu_export.h" |
18 | 18 |
19 namespace gpu { | 19 namespace gpu { |
20 | 20 |
21 class IdAllocatorInterface; | 21 class IdAllocatorInterface; |
22 class TransferBufferManagerInterface; | 22 class TransferBufferManagerInterface; |
23 | 23 |
24 namespace gles2 { | 24 namespace gles2 { |
25 | 25 |
26 class ProgramCache; | 26 class ProgramCache; |
27 class BufferManager; | 27 class BufferManager; |
28 class GLES2Decoder; | 28 class GLES2Decoder; |
29 class FramebufferManager; | 29 class FramebufferManager; |
| 30 class ImageManager; |
30 class MailboxManager; | 31 class MailboxManager; |
31 class RenderbufferManager; | 32 class RenderbufferManager; |
32 class ProgramManager; | 33 class ProgramManager; |
33 class ShaderManager; | 34 class ShaderManager; |
34 class TextureManager; | 35 class TextureManager; |
35 class MemoryTracker; | 36 class MemoryTracker; |
36 struct DisallowedFeatures; | 37 struct DisallowedFeatures; |
37 | 38 |
38 // A Context Group helps manage multiple GLES2Decoders that share | 39 // A Context Group helps manage multiple GLES2Decoders that share |
39 // resources. | 40 // resources. |
40 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { | 41 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { |
41 public: | 42 public: |
42 typedef scoped_refptr<ContextGroup> Ref; | 43 typedef scoped_refptr<ContextGroup> Ref; |
43 | 44 |
44 ContextGroup( | 45 ContextGroup( |
45 MailboxManager* mailbox_manager, | 46 MailboxManager* mailbox_manager, |
| 47 ImageManager* image_manager, |
46 MemoryTracker* memory_tracker, | 48 MemoryTracker* memory_tracker, |
47 bool bind_generates_resource); | 49 bool bind_generates_resource); |
48 | 50 |
49 // This should only be called by GLES2Decoder. This must be paired with a | 51 // This should only be called by GLES2Decoder. This must be paired with a |
50 // call to destroy if it succeeds. | 52 // call to destroy if it succeeds. |
51 bool Initialize(const DisallowedFeatures& disallowed_features, | 53 bool Initialize(const DisallowedFeatures& disallowed_features, |
52 const char* allowed_features); | 54 const char* allowed_features); |
53 | 55 |
54 // Destroys all the resources when called for the last context in the group. | 56 // Destroys all the resources when called for the last context in the group. |
55 // It should only be called by GLES2Decoder. | 57 // It should only be called by GLES2Decoder. |
56 void Destroy(bool have_context); | 58 void Destroy(bool have_context); |
57 | 59 |
58 MailboxManager* mailbox_manager() const { | 60 MailboxManager* mailbox_manager() const { |
59 return mailbox_manager_.get(); | 61 return mailbox_manager_.get(); |
60 } | 62 } |
61 | 63 |
| 64 ImageManager* image_manager() const { |
| 65 return image_manager_.get(); |
| 66 } |
| 67 |
62 MemoryTracker* memory_tracker() const { | 68 MemoryTracker* memory_tracker() const { |
63 return memory_tracker_.get(); | 69 return memory_tracker_.get(); |
64 } | 70 } |
65 | 71 |
66 bool bind_generates_resource() { | 72 bool bind_generates_resource() { |
67 return bind_generates_resource_; | 73 return bind_generates_resource_; |
68 } | 74 } |
69 | 75 |
70 uint32 max_vertex_attribs() const { | 76 uint32 max_vertex_attribs() const { |
71 return max_vertex_attribs_; | 77 return max_vertex_attribs_; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 private: | 148 private: |
143 friend class base::RefCounted<ContextGroup>; | 149 friend class base::RefCounted<ContextGroup>; |
144 ~ContextGroup(); | 150 ~ContextGroup(); |
145 | 151 |
146 bool CheckGLFeature(GLint min_required, GLint* v); | 152 bool CheckGLFeature(GLint min_required, GLint* v); |
147 bool CheckGLFeatureU(GLint min_required, uint32* v); | 153 bool CheckGLFeatureU(GLint min_required, uint32* v); |
148 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); | 154 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); |
149 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v); | 155 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v); |
150 | 156 |
151 scoped_refptr<MailboxManager> mailbox_manager_; | 157 scoped_refptr<MailboxManager> mailbox_manager_; |
| 158 scoped_refptr<ImageManager> image_manager_; |
152 scoped_refptr<MemoryTracker> memory_tracker_; | 159 scoped_refptr<MemoryTracker> memory_tracker_; |
153 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; | 160 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; |
154 | 161 |
155 // Whether or not this context is initialized. | 162 // Whether or not this context is initialized. |
156 int num_contexts_; | 163 int num_contexts_; |
157 bool enforce_gl_minimums_; | 164 bool enforce_gl_minimums_; |
158 bool bind_generates_resource_; | 165 bool bind_generates_resource_; |
159 | 166 |
160 uint32 max_vertex_attribs_; | 167 uint32 max_vertex_attribs_; |
161 uint32 max_texture_units_; | 168 uint32 max_texture_units_; |
(...skipping 24 matching lines...) Expand all Loading... |
186 | 193 |
187 DISALLOW_COPY_AND_ASSIGN(ContextGroup); | 194 DISALLOW_COPY_AND_ASSIGN(ContextGroup); |
188 }; | 195 }; |
189 | 196 |
190 } // namespace gles2 | 197 } // namespace gles2 |
191 } // namespace gpu | 198 } // namespace gpu |
192 | 199 |
193 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 200 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
194 | 201 |
195 | 202 |
OLD | NEW |