Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: gpu/command_buffer/service/context_group.h

Issue 1716813002: Use GpuPreferences to avoid directly accessing switches in gpu related code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <vector> 10 #include <vector>
11 #include "base/containers/hash_tables.h" 11 #include "base/containers/hash_tables.h"
12 #include "base/macros.h" 12 #include "base/macros.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/constants.h" 16 #include "gpu/command_buffer/common/constants.h"
17 #include "gpu/command_buffer/common/gles2_cmd_format.h" 17 #include "gpu/command_buffer/common/gles2_cmd_format.h"
18 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 18 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
19 #include "gpu/command_buffer/service/feature_info.h" 19 #include "gpu/command_buffer/service/feature_info.h"
20 #include "gpu/command_buffer/service/framebuffer_completeness_cache.h" 20 #include "gpu/command_buffer/service/framebuffer_completeness_cache.h"
21 #include "gpu/command_buffer/service/gpu_preferences.h"
21 #include "gpu/command_buffer/service/shader_translator_cache.h" 22 #include "gpu/command_buffer/service/shader_translator_cache.h"
22 #include "gpu/gpu_export.h" 23 #include "gpu/gpu_export.h"
23 24
24 namespace gpu { 25 namespace gpu {
25 26
27 struct GpuPreferences;
26 class TransferBufferManager; 28 class TransferBufferManager;
27 class ValueStateMap; 29 class ValueStateMap;
28 30
29 namespace gles2 { 31 namespace gles2 {
30 32
31 class ProgramCache; 33 class ProgramCache;
32 class BufferManager; 34 class BufferManager;
33 class GLES2Decoder; 35 class GLES2Decoder;
34 class FramebufferManager; 36 class FramebufferManager;
35 class MailboxManager; 37 class MailboxManager;
36 class RenderbufferManager; 38 class RenderbufferManager;
37 class PathManager; 39 class PathManager;
38 class ProgramManager; 40 class ProgramManager;
39 class SamplerManager; 41 class SamplerManager;
40 class ShaderManager; 42 class ShaderManager;
41 class TextureManager; 43 class TextureManager;
42 class SubscriptionRefSet; 44 class SubscriptionRefSet;
43 class ValuebufferManager; 45 class ValuebufferManager;
44 class MemoryTracker; 46 class MemoryTracker;
45 struct DisallowedFeatures; 47 struct DisallowedFeatures;
46 48
47 // A Context Group helps manage multiple GLES2Decoders that share 49 // A Context Group helps manage multiple GLES2Decoders that share
48 // resources. 50 // resources.
49 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> { 51 class GPU_EXPORT ContextGroup : public base::RefCounted<ContextGroup> {
50 public: 52 public:
51 ContextGroup( 53 ContextGroup(
54 const GpuPreferences& gpu_preferences,
52 const scoped_refptr<MailboxManager>& mailbox_manager, 55 const scoped_refptr<MailboxManager>& mailbox_manager,
53 const scoped_refptr<MemoryTracker>& memory_tracker, 56 const scoped_refptr<MemoryTracker>& memory_tracker,
54 const scoped_refptr<ShaderTranslatorCache>& shader_translator_cache, 57 const scoped_refptr<ShaderTranslatorCache>& shader_translator_cache,
55 const scoped_refptr<FramebufferCompletenessCache>& 58 const scoped_refptr<FramebufferCompletenessCache>&
56 framebuffer_completeness_cache, 59 framebuffer_completeness_cache,
57 const scoped_refptr<FeatureInfo>& feature_info, 60 const scoped_refptr<FeatureInfo>& feature_info,
58 const scoped_refptr<SubscriptionRefSet>& subscription_ref_set, 61 const scoped_refptr<SubscriptionRefSet>& subscription_ref_set,
59 const scoped_refptr<ValueStateMap>& pending_valuebuffer_state, 62 const scoped_refptr<ValueStateMap>& pending_valuebuffer_state,
60 bool bind_generates_resource); 63 bool bind_generates_resource);
61 64
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 uint32_t max_draw_buffers() const { return max_draw_buffers_; } 118 uint32_t max_draw_buffers() const { return max_draw_buffers_; }
116 119
117 uint32_t max_dual_source_draw_buffers() const { 120 uint32_t max_dual_source_draw_buffers() const {
118 return max_dual_source_draw_buffers_; 121 return max_dual_source_draw_buffers_;
119 } 122 }
120 123
121 FeatureInfo* feature_info() { 124 FeatureInfo* feature_info() {
122 return feature_info_.get(); 125 return feature_info_.get();
123 } 126 }
124 127
128 const GpuPreferences& gpu_preferences() const {
129 return gpu_preferences_;
130 }
131
125 BufferManager* buffer_manager() const { 132 BufferManager* buffer_manager() const {
126 return buffer_manager_.get(); 133 return buffer_manager_.get();
127 } 134 }
128 135
129 FramebufferManager* framebuffer_manager() const { 136 FramebufferManager* framebuffer_manager() const {
130 return framebuffer_manager_.get(); 137 return framebuffer_manager_.get();
131 } 138 }
132 139
133 RenderbufferManager* renderbuffer_manager() const { 140 RenderbufferManager* renderbuffer_manager() const {
134 return renderbuffer_manager_.get(); 141 return renderbuffer_manager_.get();
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 private: 232 private:
226 friend class base::RefCounted<ContextGroup>; 233 friend class base::RefCounted<ContextGroup>;
227 ~ContextGroup(); 234 ~ContextGroup();
228 235
229 bool CheckGLFeature(GLint min_required, GLint* v); 236 bool CheckGLFeature(GLint min_required, GLint* v);
230 bool CheckGLFeatureU(GLint min_required, uint32_t* v); 237 bool CheckGLFeatureU(GLint min_required, uint32_t* v);
231 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v); 238 bool QueryGLFeature(GLenum pname, GLint min_required, GLint* v);
232 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32_t* v); 239 bool QueryGLFeatureU(GLenum pname, GLint min_required, uint32_t* v);
233 bool HaveContexts(); 240 bool HaveContexts();
234 241
242 const GpuPreferences& gpu_preferences_;
235 scoped_refptr<MailboxManager> mailbox_manager_; 243 scoped_refptr<MailboxManager> mailbox_manager_;
236 scoped_refptr<MemoryTracker> memory_tracker_; 244 scoped_refptr<MemoryTracker> memory_tracker_;
237 scoped_refptr<ShaderTranslatorCache> shader_translator_cache_; 245 scoped_refptr<ShaderTranslatorCache> shader_translator_cache_;
238 scoped_refptr<FramebufferCompletenessCache> framebuffer_completeness_cache_; 246 scoped_refptr<FramebufferCompletenessCache> framebuffer_completeness_cache_;
239 scoped_refptr<TransferBufferManager> transfer_buffer_manager_; 247 scoped_refptr<TransferBufferManager> transfer_buffer_manager_;
240 scoped_refptr<SubscriptionRefSet> subscription_ref_set_; 248 scoped_refptr<SubscriptionRefSet> subscription_ref_set_;
241 scoped_refptr<ValueStateMap> pending_valuebuffer_state_; 249 scoped_refptr<ValueStateMap> pending_valuebuffer_state_;
242 250
243 bool enforce_gl_minimums_; 251 bool enforce_gl_minimums_;
244 bool bind_generates_resource_; 252 bool bind_generates_resource_;
(...skipping 24 matching lines...) Expand all
269 scoped_ptr<ProgramManager> program_manager_; 277 scoped_ptr<ProgramManager> program_manager_;
270 278
271 scoped_ptr<ShaderManager> shader_manager_; 279 scoped_ptr<ShaderManager> shader_manager_;
272 280
273 scoped_ptr<SamplerManager> sampler_manager_; 281 scoped_ptr<SamplerManager> sampler_manager_;
274 282
275 scoped_ptr<ValuebufferManager> valuebuffer_manager_; 283 scoped_ptr<ValuebufferManager> valuebuffer_manager_;
276 284
277 scoped_refptr<FeatureInfo> feature_info_; 285 scoped_refptr<FeatureInfo> feature_info_;
278 286
287
Fady Samuel 2016/02/25 16:26:33 nit: remove this extra line.
Peng 2016/02/25 17:13:22 Done.
279 std::vector<base::WeakPtr<gles2::GLES2Decoder> > decoders_; 288 std::vector<base::WeakPtr<gles2::GLES2Decoder> > decoders_;
280 289
281 // Mappings from client side IDs to service side IDs. 290 // Mappings from client side IDs to service side IDs.
282 base::hash_map<GLuint, GLuint> transformfeedbacks_id_map_; 291 base::hash_map<GLuint, GLuint> transformfeedbacks_id_map_;
283 base::hash_map<GLuint, GLsync> syncs_id_map_; 292 base::hash_map<GLuint, GLsync> syncs_id_map_;
284 293
285 DISALLOW_COPY_AND_ASSIGN(ContextGroup); 294 DISALLOW_COPY_AND_ASSIGN(ContextGroup);
286 }; 295 };
287 296
288 } // namespace gles2 297 } // namespace gles2
289 } // namespace gpu 298 } // namespace gpu
290 299
291 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_ 300 #endif // GPU_COMMAND_BUFFER_SERVICE_CONTEXT_GROUP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698