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 Display; |
25 class GLES2Decoder; | 26 class GLES2Decoder; |
26 class BufferManager; | 27 class BufferManager; |
27 class FramebufferManager; | 28 class FramebufferManager; |
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(Display* display, bool bind_generates_resource); |
41 ~ContextGroup(); | 42 ~ContextGroup(); |
42 | 43 |
43 // This should only be called by GLES2Decoder. This must be paired with a | 44 // This should only be called by GLES2Decoder. This must be paired with a |
44 // call to destroy if it succeeds. | 45 // call to destroy if it succeeds. |
45 bool Initialize(const DisallowedFeatures& disallowed_features, | 46 bool Initialize(const DisallowedFeatures& disallowed_features, |
46 const char* allowed_features); | 47 const char* allowed_features); |
47 | 48 |
48 // Destroys all the resources when called for the last context in the group. | 49 // Destroys all the resources when called for the last context in the group. |
49 // It should only be called by GLES2Decoder. | 50 // It should only be called by GLES2Decoder. |
50 void Destroy(bool have_context); | 51 void Destroy(bool have_context); |
51 | 52 |
| 53 Display* display() const { |
| 54 return display_.get(); |
| 55 } |
| 56 |
52 bool bind_generates_resource() { | 57 bool bind_generates_resource() { |
53 return bind_generates_resource_; | 58 return bind_generates_resource_; |
54 } | 59 } |
55 | 60 |
56 uint32 max_vertex_attribs() const { | 61 uint32 max_vertex_attribs() const { |
57 return max_vertex_attribs_; | 62 return max_vertex_attribs_; |
58 } | 63 } |
59 | 64 |
60 uint32 max_texture_units() const { | 65 uint32 max_texture_units() const { |
61 return max_texture_units_; | 66 return max_texture_units_; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 return program_manager_.get(); | 110 return program_manager_.get(); |
106 } | 111 } |
107 | 112 |
108 ShaderManager* shader_manager() const { | 113 ShaderManager* shader_manager() const { |
109 return shader_manager_.get(); | 114 return shader_manager_.get(); |
110 } | 115 } |
111 | 116 |
112 IdAllocatorInterface* GetIdAllocator(unsigned namespace_id); | 117 IdAllocatorInterface* GetIdAllocator(unsigned namespace_id); |
113 | 118 |
114 private: | 119 private: |
| 120 scoped_refptr<Display> display_; |
| 121 |
115 // Whether or not this context is initialized. | 122 // Whether or not this context is initialized. |
116 int num_contexts_; | 123 int num_contexts_; |
117 bool bind_generates_resource_; | 124 bool bind_generates_resource_; |
118 | 125 |
119 uint32 max_vertex_attribs_; | 126 uint32 max_vertex_attribs_; |
120 uint32 max_texture_units_; | 127 uint32 max_texture_units_; |
121 uint32 max_texture_image_units_; | 128 uint32 max_texture_image_units_; |
122 uint32 max_vertex_texture_image_units_; | 129 uint32 max_vertex_texture_image_units_; |
123 uint32 max_fragment_uniform_vectors_; | 130 uint32 max_fragment_uniform_vectors_; |
124 uint32 max_varying_vectors_; | 131 uint32 max_varying_vectors_; |
(...skipping 18 matching lines...) Expand all Loading... |
143 | 150 |
144 DISALLOW_COPY_AND_ASSIGN(ContextGroup); | 151 DISALLOW_COPY_AND_ASSIGN(ContextGroup); |
145 }; | 152 }; |
146 | 153 |
147 } // namespace gles2 | 154 } // namespace gles2 |
148 } // namespace gpu | 155 } // namespace gpu |
149 | 156 |
150 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 157 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
151 | 158 |
152 | 159 |
OLD | NEW |