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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder.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/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <stdio.h> 10 #include <stdio.h>
(...skipping 23 matching lines...) Expand all
34 #include "gpu/command_buffer/service/buffer_manager.h" 34 #include "gpu/command_buffer/service/buffer_manager.h"
35 #include "gpu/command_buffer/service/context_group.h" 35 #include "gpu/command_buffer/service/context_group.h"
36 #include "gpu/command_buffer/service/context_state.h" 36 #include "gpu/command_buffer/service/context_state.h"
37 #include "gpu/command_buffer/service/error_state.h" 37 #include "gpu/command_buffer/service/error_state.h"
38 #include "gpu/command_buffer/service/feature_info.h" 38 #include "gpu/command_buffer/service/feature_info.h"
39 #include "gpu/command_buffer/service/framebuffer_manager.h" 39 #include "gpu/command_buffer/service/framebuffer_manager.h"
40 #include "gpu/command_buffer/service/gl_utils.h" 40 #include "gpu/command_buffer/service/gl_utils.h"
41 #include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h" 41 #include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h"
42 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" 42 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h"
43 #include "gpu/command_buffer/service/gles2_cmd_validation.h" 43 #include "gpu/command_buffer/service/gles2_cmd_validation.h"
44 #include "gpu/command_buffer/service/gpu_preferences.h"
44 #include "gpu/command_buffer/service/gpu_state_tracer.h" 45 #include "gpu/command_buffer/service/gpu_state_tracer.h"
45 #include "gpu/command_buffer/service/gpu_switches.h" 46 #include "gpu/command_buffer/service/gpu_switches.h"
46 #include "gpu/command_buffer/service/gpu_tracer.h" 47 #include "gpu/command_buffer/service/gpu_tracer.h"
47 #include "gpu/command_buffer/service/image_manager.h" 48 #include "gpu/command_buffer/service/image_manager.h"
48 #include "gpu/command_buffer/service/logger.h" 49 #include "gpu/command_buffer/service/logger.h"
49 #include "gpu/command_buffer/service/mailbox_manager.h" 50 #include "gpu/command_buffer/service/mailbox_manager.h"
50 #include "gpu/command_buffer/service/memory_tracking.h" 51 #include "gpu/command_buffer/service/memory_tracking.h"
51 #include "gpu/command_buffer/service/path_manager.h" 52 #include "gpu/command_buffer/service/path_manager.h"
52 #include "gpu/command_buffer/service/program_manager.h" 53 #include "gpu/command_buffer/service/program_manager.h"
53 #include "gpu/command_buffer/service/query_manager.h" 54 #include "gpu/command_buffer/service/query_manager.h"
(...skipping 2483 matching lines...) Expand 10 before | Expand all | Expand 10 after
2537 supports_post_sub_buffer_(false), 2538 supports_post_sub_buffer_(false),
2538 supports_commit_overlay_planes_(false), 2539 supports_commit_overlay_planes_(false),
2539 supports_async_swap_(false), 2540 supports_async_swap_(false),
2540 context_type_(CONTEXT_TYPE_OPENGLES2), 2541 context_type_(CONTEXT_TYPE_OPENGLES2),
2541 derivatives_explicitly_enabled_(false), 2542 derivatives_explicitly_enabled_(false),
2542 frag_depth_explicitly_enabled_(false), 2543 frag_depth_explicitly_enabled_(false),
2543 draw_buffers_explicitly_enabled_(false), 2544 draw_buffers_explicitly_enabled_(false),
2544 shader_texture_lod_explicitly_enabled_(false), 2545 shader_texture_lod_explicitly_enabled_(false),
2545 compile_shader_always_succeeds_(false), 2546 compile_shader_always_succeeds_(false),
2546 lose_context_when_out_of_memory_(false), 2547 lose_context_when_out_of_memory_(false),
2547 service_logging_(base::CommandLine::InitializedForCurrentProcess() 2548 service_logging_(
2548 ? base::CommandLine::ForCurrentProcess()->HasSwitch( 2549 GpuPreferences::GetInstance()->enable_gpu_service_logging_gpu),
2549 switches::kEnableGPUServiceLoggingGPU)
2550 : false),
2551 viewport_max_width_(0), 2550 viewport_max_width_(0),
2552 viewport_max_height_(0), 2551 viewport_max_height_(0),
2553 texture_state_(group_->feature_info()->workarounds()), 2552 texture_state_(group_->feature_info()->workarounds()),
2554 gpu_decoder_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( 2553 gpu_decoder_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(
2555 TRACE_DISABLED_BY_DEFAULT("gpu_decoder"))), 2554 TRACE_DISABLED_BY_DEFAULT("gpu_decoder"))),
2556 gpu_trace_level_(2), 2555 gpu_trace_level_(2),
2557 gpu_trace_commands_(false), 2556 gpu_trace_commands_(false),
2558 gpu_debug_commands_(false), 2557 gpu_debug_commands_(false),
2559 validation_texture_(0), 2558 validation_texture_(0),
2560 validation_fbo_multisample_(0), 2559 validation_fbo_multisample_(0),
(...skipping 19 matching lines...) Expand all
2580 2579
2581 ContextCreationAttribHelper attrib_parser; 2580 ContextCreationAttribHelper attrib_parser;
2582 if (!attrib_parser.Parse(attribs)) 2581 if (!attrib_parser.Parse(attribs))
2583 return false; 2582 return false;
2584 2583
2585 surfaceless_ = surface->IsSurfaceless() && !offscreen; 2584 surfaceless_ = surface->IsSurfaceless() && !offscreen;
2586 2585
2587 set_initialized(); 2586 set_initialized();
2588 gpu_state_tracer_ = GPUStateTracer::Create(&state_); 2587 gpu_state_tracer_ = GPUStateTracer::Create(&state_);
2589 2588
2590 if (base::CommandLine::InitializedForCurrentProcess()) { 2589 if (GpuPreferences::GetInstance()->enable_gpu_debugging)
2591 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 2590 set_debug(true);
2592 switches::kEnableGPUDebugging)) {
2593 set_debug(true);
2594 }
2595 2591
2596 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 2592 if (GpuPreferences::GetInstance()->enable_gpu_command_logging)
2597 switches::kEnableGPUCommandLogging)) { 2593 set_log_commands(true);
2598 set_log_commands(true);
2599 }
2600 2594
2601 compile_shader_always_succeeds_ = 2595 compile_shader_always_succeeds_ =
2602 base::CommandLine::ForCurrentProcess()->HasSwitch( 2596 GpuPreferences::GetInstance()->compile_shader_always_succeeds;
2603 switches::kCompileShaderAlwaysSucceeds);
2604 }
2605 2597
2606 // Take ownership of the context and surface. The surface can be replaced with 2598 // Take ownership of the context and surface. The surface can be replaced with
2607 // SetSurface. 2599 // SetSurface.
2608 context_ = context; 2600 context_ = context;
2609 surface_ = surface; 2601 surface_ = surface;
2610 2602
2611 // Create GPU Tracer for timing values. 2603 // Create GPU Tracer for timing values.
2612 gpu_tracer_.reset(new GPUTracer(this)); 2604 gpu_tracer_.reset(new GPUTracer(this));
2613 2605
2614 if (feature_info_->workarounds().disable_timestamp_queries) { 2606 if (feature_info_->workarounds().disable_timestamp_queries) {
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
3265 driver_bug_workarounds |= SH_INIT_VARYINGS_WITHOUT_STATIC_USE; 3257 driver_bug_workarounds |= SH_INIT_VARYINGS_WITHOUT_STATIC_USE;
3266 if (workarounds().unroll_for_loop_with_sampler_array_index) 3258 if (workarounds().unroll_for_loop_with_sampler_array_index)
3267 driver_bug_workarounds |= SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX; 3259 driver_bug_workarounds |= SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX;
3268 if (workarounds().scalarize_vec_and_mat_constructor_args) 3260 if (workarounds().scalarize_vec_and_mat_constructor_args)
3269 driver_bug_workarounds |= SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS; 3261 driver_bug_workarounds |= SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS;
3270 if (workarounds().regenerate_struct_names) 3262 if (workarounds().regenerate_struct_names)
3271 driver_bug_workarounds |= SH_REGENERATE_STRUCT_NAMES; 3263 driver_bug_workarounds |= SH_REGENERATE_STRUCT_NAMES;
3272 if (workarounds().remove_pow_with_constant_exponent) 3264 if (workarounds().remove_pow_with_constant_exponent)
3273 driver_bug_workarounds |= SH_REMOVE_POW_WITH_CONSTANT_EXPONENT; 3265 driver_bug_workarounds |= SH_REMOVE_POW_WITH_CONSTANT_EXPONENT;
3274 3266
3275 if (base::CommandLine::InitializedForCurrentProcess() && 3267 resources.WEBGL_debug_shader_precision =
3276 base::CommandLine::ForCurrentProcess()->HasSwitch( 3268 GpuPreferences::GetInstance()->emulate_shader_precision;
3277 switches::kEmulateShaderPrecision))
3278 resources.WEBGL_debug_shader_precision = true;
3279 3269
3280 ShShaderOutput shader_output_language = 3270 ShShaderOutput shader_output_language =
3281 ShaderTranslator::GetShaderOutputLanguageForContext( 3271 ShaderTranslator::GetShaderOutputLanguageForContext(
3282 feature_info_->gl_version_info()); 3272 feature_info_->gl_version_info());
3283 3273
3284 vertex_translator_ = shader_translator_cache()->GetTranslator( 3274 vertex_translator_ = shader_translator_cache()->GetTranslator(
3285 GL_VERTEX_SHADER, shader_spec, &resources, shader_output_language, 3275 GL_VERTEX_SHADER, shader_spec, &resources, shader_output_language,
3286 static_cast<ShCompileOptions>(driver_bug_workarounds)); 3276 static_cast<ShCompileOptions>(driver_bug_workarounds));
3287 if (!vertex_translator_.get()) { 3277 if (!vertex_translator_.get()) {
3288 LOG(ERROR) << "Could not initialize vertex shader translator."; 3278 LOG(ERROR) << "Could not initialize vertex shader translator.";
(...skipping 12458 matching lines...) Expand 10 before | Expand all | Expand 10 after
15747 } 15737 }
15748 15738
15749 // Include the auto-generated part of this file. We split this because it means 15739 // Include the auto-generated part of this file. We split this because it means
15750 // we can easily edit the non-auto generated parts right here in this file 15740 // we can easily edit the non-auto generated parts right here in this file
15751 // instead of having to edit some template or the code generator. 15741 // instead of having to edit some template or the code generator.
15752 #include "base/macros.h" 15742 #include "base/macros.h"
15753 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 15743 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
15754 15744
15755 } // namespace gles2 15745 } // namespace gles2
15756 } // namespace gpu 15746 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698