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

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

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, 10 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 #include "gpu/command_buffer/service/context_group.h" 5 #include "gpu/command_buffer/service/context_group.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 #include <string> 11 #include <string>
12 12
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "gpu/command_buffer/common/value_state.h" 14 #include "gpu/command_buffer/common/value_state.h"
15 #include "gpu/command_buffer/service/buffer_manager.h" 15 #include "gpu/command_buffer/service/buffer_manager.h"
16 #include "gpu/command_buffer/service/framebuffer_manager.h" 16 #include "gpu/command_buffer/service/framebuffer_manager.h"
17 #include "gpu/command_buffer/service/gpu_switches.h" 17 #include "gpu/command_buffer/service/gpu_preferences.h"
18 #include "gpu/command_buffer/service/mailbox_manager_impl.h" 18 #include "gpu/command_buffer/service/mailbox_manager_impl.h"
19 #include "gpu/command_buffer/service/path_manager.h" 19 #include "gpu/command_buffer/service/path_manager.h"
20 #include "gpu/command_buffer/service/program_manager.h" 20 #include "gpu/command_buffer/service/program_manager.h"
21 #include "gpu/command_buffer/service/renderbuffer_manager.h" 21 #include "gpu/command_buffer/service/renderbuffer_manager.h"
22 #include "gpu/command_buffer/service/sampler_manager.h" 22 #include "gpu/command_buffer/service/sampler_manager.h"
23 #include "gpu/command_buffer/service/shader_manager.h" 23 #include "gpu/command_buffer/service/shader_manager.h"
24 #include "gpu/command_buffer/service/texture_manager.h" 24 #include "gpu/command_buffer/service/texture_manager.h"
25 #include "gpu/command_buffer/service/transfer_buffer_manager.h" 25 #include "gpu/command_buffer/service/transfer_buffer_manager.h"
26 #include "gpu/command_buffer/service/valuebuffer_manager.h" 26 #include "gpu/command_buffer/service/valuebuffer_manager.h"
27 #include "ui/gl/gl_bindings.h" 27 #include "ui/gl/gl_bindings.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // http://crbug.com/180876 76 // http://crbug.com/180876
77 // TODO(tobiasjs): determine whether GPU switching is possible 77 // TODO(tobiasjs): determine whether GPU switching is possible
78 // programmatically, rather than just hardcoding this behaviour 78 // programmatically, rather than just hardcoding this behaviour
79 // for OS X. 79 // for OS X.
80 framebuffer_completeness_cache_(NULL), 80 framebuffer_completeness_cache_(NULL),
81 #else 81 #else
82 framebuffer_completeness_cache_(framebuffer_completeness_cache), 82 framebuffer_completeness_cache_(framebuffer_completeness_cache),
83 #endif 83 #endif
84 subscription_ref_set_(subscription_ref_set), 84 subscription_ref_set_(subscription_ref_set),
85 pending_valuebuffer_state_(pending_valuebuffer_state), 85 pending_valuebuffer_state_(pending_valuebuffer_state),
86 enforce_gl_minimums_( 86 enforce_gl_minimums_(GpuPreferences::GetInstance()->enforce_gl_minimums),
87 base::CommandLine::InitializedForCurrentProcess()
88 ? base::CommandLine::ForCurrentProcess()->HasSwitch(
89 switches::kEnforceGLMinimums)
90 : false),
91 bind_generates_resource_(bind_generates_resource), 87 bind_generates_resource_(bind_generates_resource),
92 max_vertex_attribs_(0u), 88 max_vertex_attribs_(0u),
93 max_texture_units_(0u), 89 max_texture_units_(0u),
94 max_texture_image_units_(0u), 90 max_texture_image_units_(0u),
95 max_vertex_texture_image_units_(0u), 91 max_vertex_texture_image_units_(0u),
96 max_fragment_uniform_vectors_(0u), 92 max_fragment_uniform_vectors_(0u),
97 max_varying_vectors_(0u), 93 max_varying_vectors_(0u),
98 max_vertex_uniform_vectors_(0u), 94 max_vertex_uniform_vectors_(0u),
99 max_color_attachments_(1u), 95 max_color_attachments_(1u),
100 max_draw_buffers_(1u), 96 max_draw_buffers_(1u),
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 GLuint client_id, GLuint* service_id) const { 504 GLuint client_id, GLuint* service_id) const {
509 Buffer* buffer = buffer_manager_->GetBuffer(client_id); 505 Buffer* buffer = buffer_manager_->GetBuffer(client_id);
510 if (!buffer) 506 if (!buffer)
511 return false; 507 return false;
512 *service_id = buffer->service_id(); 508 *service_id = buffer->service_id();
513 return true; 509 return true;
514 } 510 }
515 511
516 } // namespace gles2 512 } // namespace gles2
517 } // namespace gpu 513 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698