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 14 matching lines...) Expand all Loading... |
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 MailboxManager; | 30 class MailboxManager; |
31 class RenderbufferManager; | 31 class RenderbufferManager; |
32 class ProgramManager; | 32 class ProgramManager; |
33 class ShaderManager; | 33 class ShaderManager; |
34 class TextureManager; | 34 class TextureManager; |
| 35 class MemoryTracker; |
35 struct DisallowedFeatures; | 36 struct DisallowedFeatures; |
36 | 37 |
37 // A Context Group helps manage multiple GLES2Decoders that share | 38 // A Context Group helps manage multiple GLES2Decoders that share |
38 // resources. | 39 // resources. |
39 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { | 40 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { |
40 public: | 41 public: |
41 typedef scoped_refptr<ContextGroup> Ref; | 42 typedef scoped_refptr<ContextGroup> Ref; |
42 | 43 |
43 ContextGroup( | 44 ContextGroup( |
44 MailboxManager* mailbox_manager, | 45 MailboxManager* mailbox_manager, |
| 46 MemoryTracker* memory_tracker, |
45 bool bind_generates_resource); | 47 bool bind_generates_resource); |
46 | 48 |
47 // This should only be called by GLES2Decoder. This must be paired with a | 49 // This should only be called by GLES2Decoder. This must be paired with a |
48 // call to destroy if it succeeds. | 50 // call to destroy if it succeeds. |
49 bool Initialize(const DisallowedFeatures& disallowed_features, | 51 bool Initialize(const DisallowedFeatures& disallowed_features, |
50 const char* allowed_features); | 52 const char* allowed_features); |
51 | 53 |
52 // Destroys all the resources when called for the last context in the group. | 54 // Destroys all the resources when called for the last context in the group. |
53 // It should only be called by GLES2Decoder. | 55 // It should only be called by GLES2Decoder. |
54 void Destroy(bool have_context); | 56 void Destroy(bool have_context); |
55 | 57 |
56 MailboxManager* mailbox_manager() const { | 58 MailboxManager* mailbox_manager() const { |
57 return mailbox_manager_.get(); | 59 return mailbox_manager_.get(); |
58 } | 60 } |
59 | 61 |
| 62 MemoryTracker* memory_tracker() const { |
| 63 return memory_tracker_.get(); |
| 64 } |
| 65 |
60 bool bind_generates_resource() { | 66 bool bind_generates_resource() { |
61 return bind_generates_resource_; | 67 return bind_generates_resource_; |
62 } | 68 } |
63 | 69 |
64 uint32 max_vertex_attribs() const { | 70 uint32 max_vertex_attribs() const { |
65 return max_vertex_attribs_; | 71 return max_vertex_attribs_; |
66 } | 72 } |
67 | 73 |
68 uint32 max_texture_units() const { | 74 uint32 max_texture_units() const { |
69 return max_texture_units_; | 75 return max_texture_units_; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 private: | 142 private: |
137 friend class base::RefCounted<ContextGroup>; | 143 friend class base::RefCounted<ContextGroup>; |
138 ~ContextGroup(); | 144 ~ContextGroup(); |
139 | 145 |
140 bool CheckGLFeature(GLint min_required, GLint* v); | 146 bool CheckGLFeature(GLint min_required, GLint* v); |
141 bool CheckGLFeatureU(GLint min_required, uint32* v); | 147 bool CheckGLFeatureU(GLint min_required, uint32* v); |
142 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); | 148 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); |
143 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v); | 149 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v); |
144 | 150 |
145 scoped_refptr<MailboxManager> mailbox_manager_; | 151 scoped_refptr<MailboxManager> mailbox_manager_; |
| 152 scoped_refptr<MemoryTracker> memory_tracker_; |
146 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; | 153 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; |
147 | 154 |
148 // Whether or not this context is initialized. | 155 // Whether or not this context is initialized. |
149 int num_contexts_; | 156 int num_contexts_; |
150 bool enforce_gl_minimums_; | 157 bool enforce_gl_minimums_; |
151 bool bind_generates_resource_; | 158 bool bind_generates_resource_; |
152 | 159 |
153 uint32 max_vertex_attribs_; | 160 uint32 max_vertex_attribs_; |
154 uint32 max_texture_units_; | 161 uint32 max_texture_units_; |
155 uint32 max_texture_image_units_; | 162 uint32 max_texture_image_units_; |
(...skipping 23 matching lines...) Expand all Loading... |
179 | 186 |
180 DISALLOW_COPY_AND_ASSIGN(ContextGroup); | 187 DISALLOW_COPY_AND_ASSIGN(ContextGroup); |
181 }; | 188 }; |
182 | 189 |
183 } // namespace gles2 | 190 } // namespace gles2 |
184 } // namespace gpu | 191 } // namespace gpu |
185 | 192 |
186 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 193 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
187 | 194 |
188 | 195 |
OLD | NEW |