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

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

Issue 817653003: Update from https://crrev.com/309717 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 <stdio.h> 7 #include <stdio.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <list> 10 #include <list>
(...skipping 2367 matching lines...) Expand 10 before | Expand all | Expand 10 after
2378 reset_status_(GL_NO_ERROR), 2378 reset_status_(GL_NO_ERROR),
2379 reset_by_robustness_extension_(false), 2379 reset_by_robustness_extension_(false),
2380 supports_post_sub_buffer_(false), 2380 supports_post_sub_buffer_(false),
2381 force_webgl_glsl_validation_(false), 2381 force_webgl_glsl_validation_(false),
2382 derivatives_explicitly_enabled_(false), 2382 derivatives_explicitly_enabled_(false),
2383 frag_depth_explicitly_enabled_(false), 2383 frag_depth_explicitly_enabled_(false),
2384 draw_buffers_explicitly_enabled_(false), 2384 draw_buffers_explicitly_enabled_(false),
2385 shader_texture_lod_explicitly_enabled_(false), 2385 shader_texture_lod_explicitly_enabled_(false),
2386 compile_shader_always_succeeds_(false), 2386 compile_shader_always_succeeds_(false),
2387 lose_context_when_out_of_memory_(false), 2387 lose_context_when_out_of_memory_(false),
2388 service_logging_(CommandLine::ForCurrentProcess()->HasSwitch( 2388 service_logging_(base::CommandLine::ForCurrentProcess()->HasSwitch(
2389 switches::kEnableGPUServiceLoggingGPU)), 2389 switches::kEnableGPUServiceLoggingGPU)),
2390 viewport_max_width_(0), 2390 viewport_max_width_(0),
2391 viewport_max_height_(0), 2391 viewport_max_height_(0),
2392 texture_state_(group_->feature_info() 2392 texture_state_(group_->feature_info()
2393 ->workarounds() 2393 ->workarounds()
2394 .texsubimage2d_faster_than_teximage2d), 2394 .texsubimage2d_faster_than_teximage2d),
2395 cb_command_trace_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( 2395 cb_command_trace_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(
2396 TRACE_DISABLED_BY_DEFAULT("cb_command"))), 2396 TRACE_DISABLED_BY_DEFAULT("cb_command"))),
2397 gpu_decoder_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED( 2397 gpu_decoder_category_(TRACE_EVENT_API_GET_CATEGORY_GROUP_ENABLED(
2398 TRACE_DISABLED_BY_DEFAULT("gpu_decoder"))), 2398 TRACE_DISABLED_BY_DEFAULT("gpu_decoder"))),
(...skipping 11 matching lines...) Expand all
2410 attrib_0_value_.v[1] = 0.0f; 2410 attrib_0_value_.v[1] = 0.0f;
2411 attrib_0_value_.v[2] = 0.0f; 2411 attrib_0_value_.v[2] = 0.0f;
2412 attrib_0_value_.v[3] = 1.0f; 2412 attrib_0_value_.v[3] = 1.0f;
2413 2413
2414 // The shader translator is used for WebGL even when running on EGL 2414 // The shader translator is used for WebGL even when running on EGL
2415 // because additional restrictions are needed (like only enabling 2415 // because additional restrictions are needed (like only enabling
2416 // GL_OES_standard_derivatives on demand). It is used for the unit 2416 // GL_OES_standard_derivatives on demand). It is used for the unit
2417 // tests because GLES2DecoderWithShaderTest.GetShaderInfoLogValidArgs passes 2417 // tests because GLES2DecoderWithShaderTest.GetShaderInfoLogValidArgs passes
2418 // the empty string to CompileShader and this is not a valid shader. 2418 // the empty string to CompileShader and this is not a valid shader.
2419 if (gfx::GetGLImplementation() == gfx::kGLImplementationMockGL || 2419 if (gfx::GetGLImplementation() == gfx::kGLImplementationMockGL ||
2420 CommandLine::ForCurrentProcess()->HasSwitch( 2420 base::CommandLine::ForCurrentProcess()->HasSwitch(
2421 switches::kDisableGLSLTranslator)) { 2421 switches::kDisableGLSLTranslator)) {
2422 use_shader_translator_ = false; 2422 use_shader_translator_ = false;
2423 } 2423 }
2424 } 2424 }
2425 2425
2426 GLES2DecoderImpl::~GLES2DecoderImpl() { 2426 GLES2DecoderImpl::~GLES2DecoderImpl() {
2427 } 2427 }
2428 2428
2429 bool GLES2DecoderImpl::Initialize( 2429 bool GLES2DecoderImpl::Initialize(
2430 const scoped_refptr<gfx::GLSurface>& surface, 2430 const scoped_refptr<gfx::GLSurface>& surface,
2431 const scoped_refptr<gfx::GLContext>& context, 2431 const scoped_refptr<gfx::GLContext>& context,
2432 bool offscreen, 2432 bool offscreen,
2433 const gfx::Size& size, 2433 const gfx::Size& size,
2434 const DisallowedFeatures& disallowed_features, 2434 const DisallowedFeatures& disallowed_features,
2435 const std::vector<int32>& attribs) { 2435 const std::vector<int32>& attribs) {
2436 TRACE_EVENT0("gpu", "GLES2DecoderImpl::Initialize"); 2436 TRACE_EVENT0("gpu", "GLES2DecoderImpl::Initialize");
2437 DCHECK(context->IsCurrent(surface.get())); 2437 DCHECK(context->IsCurrent(surface.get()));
2438 DCHECK(!context_.get()); 2438 DCHECK(!context_.get());
2439 2439
2440 surfaceless_ = surface->IsSurfaceless() && !offscreen; 2440 surfaceless_ = surface->IsSurfaceless() && !offscreen;
2441 2441
2442 set_initialized(); 2442 set_initialized();
2443 gpu_tracer_.reset(new GPUTracer(this)); 2443 gpu_tracer_.reset(new GPUTracer(this));
2444 gpu_state_tracer_ = GPUStateTracer::Create(&state_); 2444 gpu_state_tracer_ = GPUStateTracer::Create(&state_);
2445 2445
2446 if (CommandLine::ForCurrentProcess()->HasSwitch( 2446 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
2447 switches::kEnableGPUDebugging)) { 2447 switches::kEnableGPUDebugging)) {
2448 set_debug(true); 2448 set_debug(true);
2449 } 2449 }
2450 2450
2451 if (CommandLine::ForCurrentProcess()->HasSwitch( 2451 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
2452 switches::kEnableGPUCommandLogging)) { 2452 switches::kEnableGPUCommandLogging)) {
2453 set_log_commands(true); 2453 set_log_commands(true);
2454 } 2454 }
2455 2455
2456 if (CommandLine::ForCurrentProcess()->HasSwitch( 2456 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
2457 switches::kEnableUnsafeES3APIs)) { 2457 switches::kEnableUnsafeES3APIs)) {
2458 set_unsafe_es3_apis_enabled(true); 2458 set_unsafe_es3_apis_enabled(true);
2459 } 2459 }
2460 2460
2461 compile_shader_always_succeeds_ = CommandLine::ForCurrentProcess()->HasSwitch( 2461 compile_shader_always_succeeds_ =
2462 switches::kCompileShaderAlwaysSucceeds); 2462 base::CommandLine::ForCurrentProcess()->HasSwitch(
2463 switches::kCompileShaderAlwaysSucceeds);
2463 2464
2464 // Take ownership of the context and surface. The surface can be replaced with 2465 // Take ownership of the context and surface. The surface can be replaced with
2465 // SetSurface. 2466 // SetSurface.
2466 context_ = context; 2467 context_ = context;
2467 surface_ = surface; 2468 surface_ = surface;
2468 2469
2469 ContextCreationAttribHelper attrib_parser; 2470 ContextCreationAttribHelper attrib_parser;
2470 if (!attrib_parser.Parse(attribs)) 2471 if (!attrib_parser.Parse(attribs))
2471 return false; 2472 return false;
2472 2473
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
2953 driver_bug_workarounds |= SH_UNFOLD_SHORT_CIRCUIT; 2954 driver_bug_workarounds |= SH_UNFOLD_SHORT_CIRCUIT;
2954 if (workarounds().init_varyings_without_static_use) 2955 if (workarounds().init_varyings_without_static_use)
2955 driver_bug_workarounds |= SH_INIT_VARYINGS_WITHOUT_STATIC_USE; 2956 driver_bug_workarounds |= SH_INIT_VARYINGS_WITHOUT_STATIC_USE;
2956 if (workarounds().unroll_for_loop_with_sampler_array_index) 2957 if (workarounds().unroll_for_loop_with_sampler_array_index)
2957 driver_bug_workarounds |= SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX; 2958 driver_bug_workarounds |= SH_UNROLL_FOR_LOOP_WITH_SAMPLER_ARRAY_INDEX;
2958 if (workarounds().scalarize_vec_and_mat_constructor_args) 2959 if (workarounds().scalarize_vec_and_mat_constructor_args)
2959 driver_bug_workarounds |= SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS; 2960 driver_bug_workarounds |= SH_SCALARIZE_VEC_AND_MAT_CONSTRUCTOR_ARGS;
2960 if (workarounds().regenerate_struct_names) 2961 if (workarounds().regenerate_struct_names)
2961 driver_bug_workarounds |= SH_REGENERATE_STRUCT_NAMES; 2962 driver_bug_workarounds |= SH_REGENERATE_STRUCT_NAMES;
2962 2963
2963 if (CommandLine::ForCurrentProcess()->HasSwitch( 2964 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
2964 switches::kEmulateShaderPrecision)) 2965 switches::kEmulateShaderPrecision))
2965 resources.WEBGL_debug_shader_precision = true; 2966 resources.WEBGL_debug_shader_precision = true;
2966 2967
2967 vertex_translator_ = shader_translator_cache()->GetTranslator( 2968 vertex_translator_ = shader_translator_cache()->GetTranslator(
2968 GL_VERTEX_SHADER, 2969 GL_VERTEX_SHADER,
2969 shader_spec, 2970 shader_spec,
2970 &resources, 2971 &resources,
2971 implementation_type, 2972 implementation_type,
2972 static_cast<ShCompileOptions>(driver_bug_workarounds)); 2973 static_cast<ShCompileOptions>(driver_bug_workarounds));
2973 if (!vertex_translator_.get()) { 2974 if (!vertex_translator_.get()) {
2974 LOG(ERROR) << "Could not initialize vertex shader translator."; 2975 LOG(ERROR) << "Could not initialize vertex shader translator.";
(...skipping 8586 matching lines...) Expand 10 before | Expand all | Expand 10 after
11561 } 11562 }
11562 } 11563 }
11563 11564
11564 // Include the auto-generated part of this file. We split this because it means 11565 // Include the auto-generated part of this file. We split this because it means
11565 // we can easily edit the non-auto generated parts right here in this file 11566 // we can easily edit the non-auto generated parts right here in this file
11566 // instead of having to edit some template or the code generator. 11567 // instead of having to edit some template or the code generator.
11567 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" 11568 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h"
11568 11569
11569 } // namespace gles2 11570 } // namespace gles2
11570 } // namespace gpu 11571 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/feature_info_unittest.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698