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> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "gpu/command_buffer/common/constants.h" | 17 #include "gpu/command_buffer/common/constants.h" |
18 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 18 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
19 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 19 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
20 #include "gpu/command_buffer/service/feature_info.h" | 20 #include "gpu/command_buffer/service/feature_info.h" |
21 #include "gpu/command_buffer/service/framebuffer_completeness_cache.h" | 21 #include "gpu/command_buffer/service/framebuffer_completeness_cache.h" |
22 #include "gpu/command_buffer/service/gpu_preferences.h" | 22 #include "gpu/command_buffer/service/gpu_preferences.h" |
23 #include "gpu/command_buffer/service/shader_translator_cache.h" | 23 #include "gpu/command_buffer/service/shader_translator_cache.h" |
| 24 #include "gpu/config/gpu_feature_info.h" |
24 #include "gpu/gpu_export.h" | 25 #include "gpu/gpu_export.h" |
25 | 26 |
26 namespace gpu { | 27 namespace gpu { |
27 | 28 |
28 class ImageFactory; | 29 class ImageFactory; |
29 struct GpuPreferences; | 30 struct GpuPreferences; |
30 class TransferBufferManager; | 31 class TransferBufferManager; |
31 | 32 |
32 namespace gles2 { | 33 namespace gles2 { |
33 | 34 |
(...skipping 20 matching lines...) Expand all Loading... |
54 ContextGroup( | 55 ContextGroup( |
55 const GpuPreferences& gpu_preferences, | 56 const GpuPreferences& gpu_preferences, |
56 const scoped_refptr<MailboxManager>& mailbox_manager, | 57 const scoped_refptr<MailboxManager>& mailbox_manager, |
57 const scoped_refptr<MemoryTracker>& memory_tracker, | 58 const scoped_refptr<MemoryTracker>& memory_tracker, |
58 const scoped_refptr<ShaderTranslatorCache>& shader_translator_cache, | 59 const scoped_refptr<ShaderTranslatorCache>& shader_translator_cache, |
59 const scoped_refptr<FramebufferCompletenessCache>& | 60 const scoped_refptr<FramebufferCompletenessCache>& |
60 framebuffer_completeness_cache, | 61 framebuffer_completeness_cache, |
61 const scoped_refptr<FeatureInfo>& feature_info, | 62 const scoped_refptr<FeatureInfo>& feature_info, |
62 bool bind_generates_resource, | 63 bool bind_generates_resource, |
63 gpu::ImageFactory* image_factory, | 64 gpu::ImageFactory* image_factory, |
64 ProgressReporter* progress_reporter); | 65 ProgressReporter* progress_reporter, |
| 66 const GpuFeatureInfo& gpu_feature_info); |
65 | 67 |
66 // This should only be called by GLES2Decoder. This must be paired with a | 68 // This should only be called by GLES2Decoder. This must be paired with a |
67 // call to destroy if it succeeds. | 69 // call to destroy if it succeeds. |
68 bool Initialize( | 70 bool Initialize( |
69 GLES2Decoder* decoder, | 71 GLES2Decoder* decoder, |
70 ContextType context_type, | 72 ContextType context_type, |
71 const DisallowedFeatures& disallowed_features); | 73 const DisallowedFeatures& disallowed_features); |
72 | 74 |
73 // Destroys all the resources when called for the last context in the group. | 75 // Destroys all the resources when called for the last context in the group. |
74 // It should only be called by GLES2Decoder. | 76 // It should only be called by GLES2Decoder. |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 } | 222 } |
221 | 223 |
222 void RemoveSyncId(GLuint client_id) { | 224 void RemoveSyncId(GLuint client_id) { |
223 syncs_id_map_.erase(client_id); | 225 syncs_id_map_.erase(client_id); |
224 } | 226 } |
225 | 227 |
226 PassthroughResources* passthrough_resources() const { | 228 PassthroughResources* passthrough_resources() const { |
227 return passthrough_resources_.get(); | 229 return passthrough_resources_.get(); |
228 } | 230 } |
229 | 231 |
| 232 const GpuFeatureInfo& gpu_feature_info() const { return gpu_feature_info_; } |
| 233 |
230 private: | 234 private: |
231 friend class base::RefCounted<ContextGroup>; | 235 friend class base::RefCounted<ContextGroup>; |
232 ~ContextGroup(); | 236 ~ContextGroup(); |
233 | 237 |
234 bool CheckGLFeature(GLint min_required, GLint* v); | 238 bool CheckGLFeature(GLint min_required, GLint* v); |
235 bool CheckGLFeatureU(GLint min_required, uint32_t* v); | 239 bool CheckGLFeatureU(GLint min_required, uint32_t* v); |
236 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); | 240 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); |
237 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32_t* v); | 241 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32_t* v); |
238 bool HaveContexts(); | 242 bool HaveContexts(); |
239 void ReportProgress(); | 243 void ReportProgress(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 // Mappings from client side IDs to service side IDs. | 299 // Mappings from client side IDs to service side IDs. |
296 base::hash_map<GLuint, GLsync> syncs_id_map_; | 300 base::hash_map<GLuint, GLsync> syncs_id_map_; |
297 | 301 |
298 std::unique_ptr<PassthroughResources> passthrough_resources_; | 302 std::unique_ptr<PassthroughResources> passthrough_resources_; |
299 | 303 |
300 // Used to notify the watchdog thread of progress during destruction, | 304 // Used to notify the watchdog thread of progress during destruction, |
301 // preventing time-outs when destruction takes a long time. May be null when | 305 // preventing time-outs when destruction takes a long time. May be null when |
302 // using in-process command buffer. | 306 // using in-process command buffer. |
303 ProgressReporter* progress_reporter_; | 307 ProgressReporter* progress_reporter_; |
304 | 308 |
| 309 GpuFeatureInfo gpu_feature_info_; |
| 310 |
305 DISALLOW_COPY_AND_ASSIGN(ContextGroup); | 311 DISALLOW_COPY_AND_ASSIGN(ContextGroup); |
306 }; | 312 }; |
307 | 313 |
308 } // namespace gles2 | 314 } // namespace gles2 |
309 } // namespace gpu | 315 } // namespace gpu |
310 | 316 |
311 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ | 317 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ |
OLD | NEW |