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 <vector> | 9 #include <vector> |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/containers/hash_tables.h" | 11 #include "base/containers/hash_tables.h" |
12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 16 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
17 #include "gpu/command_buffer/service/feature_info.h" | 17 #include "gpu/command_buffer/service/feature_info.h" |
18 #include "gpu/command_buffer/service/gles2_cmd_validation.h" | 18 #include "gpu/command_buffer/service/gles2_cmd_validation.h" |
19 #include "gpu/command_buffer/service/shader_translator_cache.h" | 19 #include "gpu/command_buffer/service/shader_translator_cache.h" |
20 #include "gpu/gpu_export.h" | 20 #include "gpu/gpu_export.h" |
21 | 21 |
22 namespace gpu { | 22 namespace gpu { |
23 | 23 |
24 class TransferBufferManagerInterface; | 24 class TransferBufferManagerInterface; |
| 25 class ValueStateMap; |
25 | 26 |
26 namespace gles2 { | 27 namespace gles2 { |
27 | 28 |
28 class ProgramCache; | 29 class ProgramCache; |
29 class BufferManager; | 30 class BufferManager; |
30 class GLES2Decoder; | 31 class GLES2Decoder; |
31 class FramebufferManager; | 32 class FramebufferManager; |
32 class MailboxManager; | 33 class MailboxManager; |
33 class RenderbufferManager; | 34 class RenderbufferManager; |
34 class ProgramManager; | 35 class ProgramManager; |
35 class ShaderManager; | 36 class ShaderManager; |
36 class TextureManager; | 37 class TextureManager; |
37 class ValuebufferManager; | 38 class ValuebufferManager; |
38 class MemoryTracker; | 39 class MemoryTracker; |
39 struct DisallowedFeatures; | 40 struct DisallowedFeatures; |
40 | 41 |
41 // A Context Group helps manage multiple GLES2Decoders that share | 42 // A Context Group helps manage multiple GLES2Decoders that share |
42 // resources. | 43 // resources. |
43 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { | 44 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { |
44 public: | 45 public: |
45 ContextGroup( | 46 ContextGroup( |
46 const scoped_refptr<MailboxManager>& mailbox_manager, | 47 const scoped_refptr<MailboxManager>& mailbox_manager, |
47 const scoped_refptr<MemoryTracker>& memory_tracker, | 48 const scoped_refptr<MemoryTracker>& memory_tracker, |
48 const scoped_refptr<ShaderTranslatorCache>& shader_translator_cache, | 49 const scoped_refptr<ShaderTranslatorCache>& shader_translator_cache, |
49 const scoped_refptr<FeatureInfo>& feature_info, | 50 const scoped_refptr<FeatureInfo>& feature_info, |
| 51 const scoped_refptr<ValueStateMap>& pending_valuebuffer_state, |
50 bool bind_generates_resource); | 52 bool bind_generates_resource); |
51 | 53 |
52 // This should only be called by GLES2Decoder. This must be paired with a | 54 // This should only be called by GLES2Decoder. This must be paired with a |
53 // call to destroy if it succeeds. | 55 // call to destroy if it succeeds. |
54 bool Initialize( | 56 bool Initialize( |
55 GLES2Decoder* decoder, | 57 GLES2Decoder* decoder, |
56 const DisallowedFeatures& disallowed_features); | 58 const DisallowedFeatures& disallowed_features); |
57 | 59 |
58 // Destroys all the resources when called for the last context in the group. | 60 // Destroys all the resources when called for the last context in the group. |
59 // It should only be called by GLES2Decoder. | 61 // It should only be called by GLES2Decoder. |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 126 } |
125 | 127 |
126 RenderbufferManager* renderbuffer_manager() const { | 128 RenderbufferManager* renderbuffer_manager() const { |
127 return renderbuffer_manager_.get(); | 129 return renderbuffer_manager_.get(); |
128 } | 130 } |
129 | 131 |
130 ValuebufferManager* valuebuffer_manager() const { | 132 ValuebufferManager* valuebuffer_manager() const { |
131 return valuebuffer_manager_.get(); | 133 return valuebuffer_manager_.get(); |
132 } | 134 } |
133 | 135 |
| 136 ValueStateMap* pending_valuebuffer_state() const { |
| 137 return pending_valuebuffer_state_.get(); |
| 138 } |
| 139 |
134 TextureManager* texture_manager() const { | 140 TextureManager* texture_manager() const { |
135 return texture_manager_.get(); | 141 return texture_manager_.get(); |
136 } | 142 } |
137 | 143 |
138 ProgramManager* program_manager() const { | 144 ProgramManager* program_manager() const { |
139 return program_manager_.get(); | 145 return program_manager_.get(); |
140 } | 146 } |
141 | 147 |
142 bool has_program_cache() const { | 148 bool has_program_cache() const { |
143 return program_cache_ != NULL; | 149 return program_cache_ != NULL; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 bool CheckGLFeature(GLint min_required, GLint* v); | 181 bool CheckGLFeature(GLint min_required, GLint* v); |
176 bool CheckGLFeatureU(GLint min_required, uint32* v); | 182 bool CheckGLFeatureU(GLint min_required, uint32* v); |
177 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); | 183 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); |
178 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v); | 184 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32* v); |
179 bool HaveContexts(); | 185 bool HaveContexts(); |
180 | 186 |
181 scoped_refptr<MailboxManager> mailbox_manager_; | 187 scoped_refptr<MailboxManager> mailbox_manager_; |
182 scoped_refptr<MemoryTracker> memory_tracker_; | 188 scoped_refptr<MemoryTracker> memory_tracker_; |
183 scoped_refptr<ShaderTranslatorCache> shader_translator_cache_; | 189 scoped_refptr<ShaderTranslatorCache> shader_translator_cache_; |
184 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; | 190 scoped_ptr<TransferBufferManagerInterface> transfer_buffer_manager_; |
| 191 scoped_refptr<gpu::ValueStateMap> pending_valuebuffer_state_; |
185 | 192 |
186 bool enforce_gl_minimums_; | 193 bool enforce_gl_minimums_; |
187 bool bind_generates_resource_; | 194 bool bind_generates_resource_; |
188 | 195 |
189 uint32 max_vertex_attribs_; | 196 uint32 max_vertex_attribs_; |
190 uint32 max_texture_units_; | 197 uint32 max_texture_units_; |
191 uint32 max_texture_image_units_; | 198 uint32 max_texture_image_units_; |
192 uint32 max_vertex_texture_image_units_; | 199 uint32 max_vertex_texture_image_units_; |
193 uint32 max_fragment_uniform_vectors_; | 200 uint32 max_fragment_uniform_vectors_; |
194 uint32 max_varying_vectors_; | 201 uint32 max_varying_vectors_; |
195 uint32 max_vertex_uniform_vectors_; | 202 uint32 max_vertex_uniform_vectors_; |
196 uint32 max_color_attachments_; | 203 uint32 max_color_attachments_; |
197 uint32 max_draw_buffers_; | 204 uint32 max_draw_buffers_; |
198 | 205 |
199 ProgramCache* program_cache_; | 206 ProgramCache* program_cache_; |
200 | 207 |
201 scoped_ptr<BufferManager> buffer_manager_; | 208 scoped_ptr<BufferManager> buffer_manager_; |
202 | 209 |
203 scoped_ptr<FramebufferManager> framebuffer_manager_; | 210 scoped_ptr<FramebufferManager> framebuffer_manager_; |
204 | 211 |
205 scoped_ptr<RenderbufferManager> renderbuffer_manager_; | 212 scoped_ptr<RenderbufferManager> renderbuffer_manager_; |
206 | 213 |
207 scoped_ptr<ValuebufferManager> valuebuffer_manager_; | |
208 | |
209 scoped_ptr<TextureManager> texture_manager_; | 214 scoped_ptr<TextureManager> texture_manager_; |
210 | 215 |
211 scoped_ptr<ProgramManager> program_manager_; | 216 scoped_ptr<ProgramManager> program_manager_; |
212 | 217 |
213 scoped_ptr<ShaderManager> shader_manager_; | 218 scoped_ptr<ShaderManager> shader_manager_; |
214 | 219 |
| 220 scoped_ptr<ValuebufferManager> valuebuffer_manager_; |
| 221 |
215 scoped_refptr<FeatureInfo> feature_info_; | 222 scoped_refptr<FeatureInfo> feature_info_; |
216 | 223 |
217 std::vector<base::WeakPtr<gles2::GLES2Decoder> > decoders_; | 224 std::vector<base::WeakPtr<gles2::GLES2Decoder> > decoders_; |
218 | 225 |
219 GLenum draw_buffer_; | 226 GLenum draw_buffer_; |
220 | 227 |
221 DISALLOW_COPY_AND_ASSIGN(ContextGroup); | 228 DISALLOW_COPY_AND_ASSIGN(ContextGroup); |
222 }; | 229 }; |
223 | 230 |
224 } // namespace gles2 | 231 } // namespace gles2 |
225 } // namespace gpu | 232 } // namespace gpu |
226 | 233 |
227 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 234 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
228 | 235 |
229 | 236 |
OLD | NEW |