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 | 22 |
23 namespace gles2 { | 23 namespace gles2 { |
24 | 24 |
| 25 class BufferManager; |
25 class GLES2Decoder; | 26 class GLES2Decoder; |
26 class BufferManager; | |
27 class FramebufferManager; | 27 class FramebufferManager; |
| 28 class MailboxManager; |
28 class RenderbufferManager; | 29 class RenderbufferManager; |
29 class ProgramManager; | 30 class ProgramManager; |
30 class ShaderManager; | 31 class ShaderManager; |
31 class TextureManager; | 32 class TextureManager; |
32 struct DisallowedFeatures; | 33 struct DisallowedFeatures; |
33 | 34 |
34 // A Context Group helps manage multiple GLES2Decoders that share | 35 // A Context Group helps manage multiple GLES2Decoders that share |
35 // resources. | 36 // resources. |
36 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { | 37 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { |
37 public: | 38 public: |
38 typedef scoped_refptr<ContextGroup> Ref; | 39 typedef scoped_refptr<ContextGroup> Ref; |
39 | 40 |
40 explicit ContextGroup(bool bind_generates_resource); | 41 explicit ContextGroup(MailboxManager* mailbox_manager, |
| 42 bool bind_generates_resource); |
41 ~ContextGroup(); | 43 ~ContextGroup(); |
42 | 44 |
43 // This should only be called by GLES2Decoder. This must be paired with a | 45 // This should only be called by GLES2Decoder. This must be paired with a |
44 // call to destroy if it succeeds. | 46 // call to destroy if it succeeds. |
45 bool Initialize(const DisallowedFeatures& disallowed_features, | 47 bool Initialize(const DisallowedFeatures& disallowed_features, |
46 const char* allowed_features); | 48 const char* allowed_features); |
47 | 49 |
48 // Destroys all the resources when called for the last context in the group. | 50 // Destroys all the resources when called for the last context in the group. |
49 // It should only be called by GLES2Decoder. | 51 // It should only be called by GLES2Decoder. |
50 void Destroy(bool have_context); | 52 void Destroy(bool have_context); |
51 | 53 |
| 54 MailboxManager* mailbox_manager() const { |
| 55 return mailbox_manager_.get(); |
| 56 } |
| 57 |
52 bool bind_generates_resource() { | 58 bool bind_generates_resource() { |
53 return bind_generates_resource_; | 59 return bind_generates_resource_; |
54 } | 60 } |
55 | 61 |
56 uint32 max_vertex_attribs() const { | 62 uint32 max_vertex_attribs() const { |
57 return max_vertex_attribs_; | 63 return max_vertex_attribs_; |
58 } | 64 } |
59 | 65 |
60 uint32 max_texture_units() const { | 66 uint32 max_texture_units() const { |
61 return max_texture_units_; | 67 return max_texture_units_; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 } | 116 } |
111 | 117 |
112 IdAllocatorInterface* GetIdAllocator(unsigned namespace_id); | 118 IdAllocatorInterface* GetIdAllocator(unsigned namespace_id); |
113 | 119 |
114 private: | 120 private: |
115 bool CheckGLFeature(GLint min_required, GLint* v); | 121 bool CheckGLFeature(GLint min_required, GLint* v); |
116 bool CheckGLFeatureU(GLint min_required, uint32* v); | 122 bool CheckGLFeatureU(GLint min_required, uint32* v); |
117 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); | 123 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); |
118 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v); | 124 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v); |
119 | 125 |
| 126 scoped_refptr<MailboxManager> mailbox_manager_; |
| 127 |
120 // Whether or not this context is initialized. | 128 // Whether or not this context is initialized. |
121 int num_contexts_; | 129 int num_contexts_; |
122 bool enforce_gl_minimums_; | 130 bool enforce_gl_minimums_; |
123 bool bind_generates_resource_; | 131 bool bind_generates_resource_; |
124 | 132 |
125 uint32 max_vertex_attribs_; | 133 uint32 max_vertex_attribs_; |
126 uint32 max_texture_units_; | 134 uint32 max_texture_units_; |
127 uint32 max_texture_image_units_; | 135 uint32 max_texture_image_units_; |
128 uint32 max_vertex_texture_image_units_; | 136 uint32 max_vertex_texture_image_units_; |
129 uint32 max_fragment_uniform_vectors_; | 137 uint32 max_fragment_uniform_vectors_; |
(...skipping 19 matching lines...) Expand all Loading... |
149 | 157 |
150 DISALLOW_COPY_AND_ASSIGN(ContextGroup); | 158 DISALLOW_COPY_AND_ASSIGN(ContextGroup); |
151 }; | 159 }; |
152 | 160 |
153 } // namespace gles2 | 161 } // namespace gles2 |
154 } // namespace gpu | 162 } // namespace gpu |
155 | 163 |
156 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 164 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
157 | 165 |
158 | 166 |
OLD | NEW |