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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 21 matching lines...) Expand all Loading... |
32 namespace gles2 { | 32 namespace gles2 { |
33 | 33 |
34 class ProgramCache; | 34 class ProgramCache; |
35 class BufferManager; | 35 class BufferManager; |
36 class GLES2Decoder; | 36 class GLES2Decoder; |
37 class FramebufferManager; | 37 class FramebufferManager; |
38 class MailboxManager; | 38 class MailboxManager; |
39 class RenderbufferManager; | 39 class RenderbufferManager; |
40 class PathManager; | 40 class PathManager; |
41 class ProgramManager; | 41 class ProgramManager; |
| 42 class ProgressReporter; |
42 class SamplerManager; | 43 class SamplerManager; |
43 class ShaderManager; | 44 class ShaderManager; |
44 class TextureManager; | 45 class TextureManager; |
45 class MemoryTracker; | 46 class MemoryTracker; |
46 struct DisallowedFeatures; | 47 struct DisallowedFeatures; |
47 struct PassthroughResources; | 48 struct PassthroughResources; |
48 | 49 |
49 // A Context Group helps manage multiple GLES2Decoders that share | 50 // A Context Group helps manage multiple GLES2Decoders that share |
50 // resources. | 51 // resources. |
51 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { | 52 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { |
52 public: | 53 public: |
53 ContextGroup( | 54 ContextGroup( |
54 const GpuPreferences& gpu_preferences, | 55 const GpuPreferences& gpu_preferences, |
55 const scoped_refptr<MailboxManager>& mailbox_manager, | 56 const scoped_refptr<MailboxManager>& mailbox_manager, |
56 const scoped_refptr<MemoryTracker>& memory_tracker, | 57 const scoped_refptr<MemoryTracker>& memory_tracker, |
57 const scoped_refptr<ShaderTranslatorCache>& shader_translator_cache, | 58 const scoped_refptr<ShaderTranslatorCache>& shader_translator_cache, |
58 const scoped_refptr<FramebufferCompletenessCache>& | 59 const scoped_refptr<FramebufferCompletenessCache>& |
59 framebuffer_completeness_cache, | 60 framebuffer_completeness_cache, |
60 const scoped_refptr<FeatureInfo>& feature_info, | 61 const scoped_refptr<FeatureInfo>& feature_info, |
61 bool bind_generates_resource, | 62 bool bind_generates_resource, |
62 gpu::ImageFactory* image_factory); | 63 gpu::ImageFactory* image_factory, |
| 64 std::unique_ptr<ProgressReporter> progress_reporter); |
63 | 65 |
64 // This should only be called by GLES2Decoder. This must be paired with a | 66 // This should only be called by GLES2Decoder. This must be paired with a |
65 // call to destroy if it succeeds. | 67 // call to destroy if it succeeds. |
66 bool Initialize( | 68 bool Initialize( |
67 GLES2Decoder* decoder, | 69 GLES2Decoder* decoder, |
68 ContextType context_type, | 70 ContextType context_type, |
69 const DisallowedFeatures& disallowed_features); | 71 const DisallowedFeatures& disallowed_features); |
70 | 72 |
71 // Destroys all the resources when called for the last context in the group. | 73 // Destroys all the resources when called for the last context in the group. |
72 // It should only be called by GLES2Decoder. | 74 // It should only be called by GLES2Decoder. |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 | 229 |
228 private: | 230 private: |
229 friend class base::RefCounted<ContextGroup>; | 231 friend class base::RefCounted<ContextGroup>; |
230 ~ContextGroup(); | 232 ~ContextGroup(); |
231 | 233 |
232 bool CheckGLFeature(GLint min_required, GLint* v); | 234 bool CheckGLFeature(GLint min_required, GLint* v); |
233 bool CheckGLFeatureU(GLint min_required, uint32_t* v); | 235 bool CheckGLFeatureU(GLint min_required, uint32_t* v); |
234 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); | 236 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); |
235 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32_t* v); | 237 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32_t* v); |
236 bool HaveContexts(); | 238 bool HaveContexts(); |
| 239 void ReportProgress(); |
237 | 240 |
238 const GpuPreferences& gpu_preferences_; | 241 const GpuPreferences& gpu_preferences_; |
239 scoped_refptr<MailboxManager> mailbox_manager_; | 242 scoped_refptr<MailboxManager> mailbox_manager_; |
240 scoped_refptr<MemoryTracker> memory_tracker_; | 243 scoped_refptr<MemoryTracker> memory_tracker_; |
241 scoped_refptr<ShaderTranslatorCache> shader_translator_cache_; | 244 scoped_refptr<ShaderTranslatorCache> shader_translator_cache_; |
242 scoped_refptr<FramebufferCompletenessCache> framebuffer_completeness_cache_; | 245 scoped_refptr<FramebufferCompletenessCache> framebuffer_completeness_cache_; |
243 scoped_refptr<TransferBufferManager> transfer_buffer_manager_; | 246 scoped_refptr<TransferBufferManager> transfer_buffer_manager_; |
244 | 247 |
245 bool enforce_gl_minimums_; | 248 bool enforce_gl_minimums_; |
246 bool bind_generates_resource_; | 249 bool bind_generates_resource_; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 std::unique_ptr<ProgramManager> program_manager_; | 283 std::unique_ptr<ProgramManager> program_manager_; |
281 | 284 |
282 std::unique_ptr<ShaderManager> shader_manager_; | 285 std::unique_ptr<ShaderManager> shader_manager_; |
283 | 286 |
284 std::unique_ptr<SamplerManager> sampler_manager_; | 287 std::unique_ptr<SamplerManager> sampler_manager_; |
285 | 288 |
286 scoped_refptr<FeatureInfo> feature_info_; | 289 scoped_refptr<FeatureInfo> feature_info_; |
287 | 290 |
288 gpu::ImageFactory* image_factory_; | 291 gpu::ImageFactory* image_factory_; |
289 | 292 |
| 293 std::unique_ptr<ProgressReporter> progress_reporter_; |
| 294 |
290 std::vector<base::WeakPtr<gles2::GLES2Decoder> > decoders_; | 295 std::vector<base::WeakPtr<gles2::GLES2Decoder> > decoders_; |
291 | 296 |
292 // Mappings from client side IDs to service side IDs. | 297 // Mappings from client side IDs to service side IDs. |
293 base::hash_map<GLuint, GLsync> syncs_id_map_; | 298 base::hash_map<GLuint, GLsync> syncs_id_map_; |
294 | 299 |
295 std::unique_ptr<PassthroughResources> passthrough_resources_; | 300 std::unique_ptr<PassthroughResources> passthrough_resources_; |
296 | 301 |
297 DISALLOW_COPY_AND_ASSIGN(ContextGroup); | 302 DISALLOW_COPY_AND_ASSIGN(ContextGroup); |
298 }; | 303 }; |
299 | 304 |
300 } // namespace gles2 | 305 } // namespace gles2 |
301 } // namespace gpu | 306 } // namespace gpu |
302 | 307 |
303 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 308 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
OLD | NEW |