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

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 24 matching lines...) Expand all
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_stream_texture_image.h" 40 #include "gpu/command_buffer/service/gl_stream_texture_image.h"
41 #include "gpu/command_buffer/service/gl_utils.h" 41 #include "gpu/command_buffer/service/gl_utils.h"
42 #include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h" 42 #include "gpu/command_buffer/service/gles2_cmd_clear_framebuffer.h"
43 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h" 43 #include "gpu/command_buffer/service/gles2_cmd_copy_texture_chromium.h"
44 #include "gpu/command_buffer/service/gles2_cmd_validation.h" 44 #include "gpu/command_buffer/service/gles2_cmd_validation.h"
45 #include "gpu/command_buffer/service/gpu_preferences.h"
45 #include "gpu/command_buffer/service/gpu_state_tracer.h" 46 #include "gpu/command_buffer/service/gpu_state_tracer.h"
46 #include "gpu/command_buffer/service/gpu_switches.h" 47 #include "gpu/command_buffer/service/gpu_switches.h"
47 #include "gpu/command_buffer/service/gpu_tracer.h" 48 #include "gpu/command_buffer/service/gpu_tracer.h"
48 #include "gpu/command_buffer/service/image_manager.h" 49 #include "gpu/command_buffer/service/image_manager.h"
49 #include "gpu/command_buffer/service/logger.h" 50 #include "gpu/command_buffer/service/logger.h"
50 #include "gpu/command_buffer/service/mailbox_manager.h" 51 #include "gpu/command_buffer/service/mailbox_manager.h"
51 #include "gpu/command_buffer/service/memory_tracking.h" 52 #include "gpu/command_buffer/service/memory_tracking.h"
52 #include "gpu/command_buffer/service/path_manager.h" 53 #include "gpu/command_buffer/service/path_manager.h"
53 #include "gpu/command_buffer/service/program_manager.h" 54 #include "gpu/command_buffer/service/program_manager.h"
54 #include "gpu/command_buffer/service/query_manager.h" 55 #include "gpu/command_buffer/service/query_manager.h"
(...skipping 2515 matching lines...) Expand 10 before | Expand all | Expand 10 after
2570 supports_post_sub_buffer_(false), 2571 supports_post_sub_buffer_(false),
2571 supports_commit_overlay_planes_(false), 2572 supports_commit_overlay_planes_(false),
2572 supports_async_swap_(false), 2573 supports_async_swap_(false),
2573 context_type_(CONTEXT_TYPE_OPENGLES2), 2574 context_type_(CONTEXT_TYPE_OPENGLES2),
2574 derivatives_explicitly_enabled_(false), 2575 derivatives_explicitly_enabled_(false),
2575 frag_depth_explicitly_enabled_(false), 2576 frag_depth_explicitly_enabled_(false),
2576 draw_buffers_explicitly_enabled_(false), 2577 draw_buffers_explicitly_enabled_(false),
2577 shader_texture_lod_explicitly_enabled_(false), 2578 shader_texture_lod_explicitly_enabled_(false),
2578 compile_shader_always_succeeds_(false), 2579 compile_shader_always_succeeds_(false),
2579 lose_context_when_out_of_memory_(false), 2580 lose_context_when_out_of_memory_(false),
2580 service_logging_(base::CommandLine::InitializedForCurrentProcess() 2581 service_logging_(
2581 ? base::CommandLine::ForCurrentProcess()->HasSwitch( 2582 group_->gpu_preferences().enable_gpu_service_logging_gpu),
2582 switches::kEnableGPUServiceLoggingGPU)
2583 : false),
2584 viewport_max_width_(0), 2583 viewport_max_width_(0),
2585 viewport_max_height_(0), 2584 viewport_max_height_(0),
2586 texture_state_(group_->feature_info()->workarounds()), 2585 texture_state_(group_->feature_info()->workarounds()),
2587 gpu_decoder_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( 2586 gpu_decoder_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(
2588 TRACE_DISABLED_BY_DEFAULT("gpu_decoder"))), 2587 TRACE_DISABLED_BY_DEFAULT("gpu_decoder"))),
2589 gpu_trace_level_(2), 2588 gpu_trace_level_(2),
2590 gpu_trace_commands_(false), 2589 gpu_trace_commands_(false),
2591 gpu_debug_commands_(false), 2590 gpu_debug_commands_(false),
2592 validation_texture_(0), 2591 validation_texture_(0),
2593 validation_fbo_multisample_(0), 2592 validation_fbo_multisample_(0),
(...skipping 19 matching lines...) Expand all
2613 2612
2614 ContextCreationAttribHelper attrib_parser; 2613 ContextCreationAttribHelper attrib_parser;
2615 if (!attrib_parser.Parse(attribs)) 2614 if (!attrib_parser.Parse(attribs))
2616 return false; 2615 return false;
2617 2616
2618 surfaceless_ = surface->IsSurfaceless() && !offscreen; 2617 surfaceless_ = surface->IsSurfaceless() && !offscreen;
2619 2618
2620 set_initialized(); 2619 set_initialized();
2621 gpu_state_tracer_ = GPUStateTracer::Create(&state_); 2620 gpu_state_tracer_ = GPUStateTracer::Create(&state_);
2622 2621
2623 if (base::CommandLine::InitializedForCurrentProcess()) { 2622 if (group_->gpu_preferences().enable_gpu_debugging)
2624 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 2623 set_debug(true);
2625 switches::kEnableGPUDebugging)) {
2626 set_debug(true);
2627 }
2628 2624
2629 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 2625 if (group_->gpu_preferences().enable_gpu_command_logging)
2630 switches::kEnableGPUCommandLogging)) { 2626 set_log_commands(true);
2631 set_log_commands(true);
2632 }
2633 2627
2634 compile_shader_always_succeeds_ = 2628 compile_shader_always_succeeds_ =
2635 base::CommandLine::ForCurrentProcess()->HasSwitch( 2629 group_->gpu_preferences().compile_shader_always_succeeds;
2636 switches::kCompileShaderAlwaysSucceeds);
2637 }
2638 2630
2639 // Take ownership of the context and surface. The surface can be replaced with 2631 // Take ownership of the context and surface. The surface can be replaced with
2640 // SetSurface. 2632 // SetSurface.
2641 context_ = context; 2633 context_ = context;
2642 surface_ = surface; 2634 surface_ = surface;
2643 2635
2644 // Create GPU Tracer for timing values. 2636 // Create GPU Tracer for timing values.
2645 gpu_tracer_.reset(new GPUTracer(this)); 2637 gpu_tracer_.reset(new GPUTracer(this));
2646 2638
2647 if (feature_info_->workarounds().disable_timestamp_queries) { 2639 if (feature_info_->workarounds().disable_timestamp_queries) {
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
3298 driver_bug_workarounds |= SH_INIT_VARYINGS_WITHOUT_STATIC_USE; 3290 driver_bug_workarounds |= SH_INIT_VARYINGS_WITHOUT_STATIC_USE;
3299 if (workarounds().unroll_for_loop_with_sampler_array_index) 3291 if (workarounds().unroll_for_loop_with_sampler_array_index)
3300 driver_bug_workarounds |= SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX; 3292 driver_bug_workarounds |= SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX;
3301 if (workarounds().scalarize_vec_and_mat_constructor_args) 3293 if (workarounds().scalarize_vec_and_mat_constructor_args)
3302 driver_bug_workarounds |= SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS; 3294 driver_bug_workarounds |= SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS;
3303 if (workarounds().regenerate_struct_names) 3295 if (workarounds().regenerate_struct_names)
3304 driver_bug_workarounds |= SH_REGENERATE_STRUCT_NAMES; 3296 driver_bug_workarounds |= SH_REGENERATE_STRUCT_NAMES;
3305 if (workarounds().remove_pow_with_constant_exponent) 3297 if (workarounds().remove_pow_with_constant_exponent)
3306 driver_bug_workarounds |= SH_REMOVE_POW_WITH_CONSTANT_EXPONENT; 3298 driver_bug_workarounds |= SH_REMOVE_POW_WITH_CONSTANT_EXPONENT;
3307 3299
3308 if (base::CommandLine::InitializedForCurrentProcess() && 3300 resources.WEBGL_debug_shader_precision =
3309 base::CommandLine::ForCurrentProcess()->HasSwitch( 3301 group_->gpu_preferences().emulate_shader_precision;
3310 switches::kEmulateShaderPrecision))
3311 resources.WEBGL_debug_shader_precision = true;
3312 3302
3313 ShShaderOutput shader_output_language = 3303 ShShaderOutput shader_output_language =
3314 ShaderTranslator::GetShaderOutputLanguageForContext( 3304 ShaderTranslator::GetShaderOutputLanguageForContext(
3315 feature_info_->gl_version_info()); 3305 feature_info_->gl_version_info());
3316 3306
3317 vertex_translator_ = shader_translator_cache()->GetTranslator( 3307 vertex_translator_ = shader_translator_cache()->GetTranslator(
3318 GL_VERTEX_SHADER, shader_spec, &resources, shader_output_language, 3308 GL_VERTEX_SHADER, shader_spec, &resources, shader_output_language,
3319 static_cast<ShCompileOptions>(driver_bug_workarounds)); 3309 static_cast<ShCompileOptions>(driver_bug_workarounds));
3320 if (!vertex_translator_.get()) { 3310 if (!vertex_translator_.get()) {
3321 LOG(ERROR) << "Could not initialize vertex shader translator."; 3311 LOG(ERROR) << "Could not initialize vertex shader translator.";
(...skipping 12628 matching lines...) Expand 10 before | Expand all | Expand 10 after
15950 } 15940 }
15951 15941
15952 // Include the auto-generated part of this file. We split this because it means 15942 // Include the auto-generated part of this file. We split this because it means
15953 // we can easily edit the non-auto generated parts right here in this file 15943 // we can easily edit the non-auto generated parts right here in this file
15954 // instead of having to edit some template or the code generator. 15944 // instead of having to edit some template or the code generator.
15955 #include "base/macros.h" 15945 #include "base/macros.h"
15956 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 15946 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
15957 15947
15958 } // namespace gles2 15948 } // namespace gles2
15959 } // namespace gpu 15949 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698