Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 2427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2438 const gfx::Size& size, | 2438 const gfx::Size& size, |
| 2439 const DisallowedFeatures& disallowed_features, | 2439 const DisallowedFeatures& disallowed_features, |
| 2440 const std::vector<int32>& attribs) { | 2440 const std::vector<int32>& attribs) { |
| 2441 TRACE_EVENT0("gpu", "GLES2DecoderImpl::Initialize"); | 2441 TRACE_EVENT0("gpu", "GLES2DecoderImpl::Initialize"); |
| 2442 DCHECK(context->IsCurrent(surface.get())); | 2442 DCHECK(context->IsCurrent(surface.get())); |
| 2443 DCHECK(!context_.get()); | 2443 DCHECK(!context_.get()); |
| 2444 | 2444 |
| 2445 surfaceless_ = surface->IsSurfaceless() && !offscreen; | 2445 surfaceless_ = surface->IsSurfaceless() && !offscreen; |
| 2446 | 2446 |
| 2447 set_initialized(); | 2447 set_initialized(); |
| 2448 gpu_tracer_.reset(new GPUTracer(this)); | |
| 2449 gpu_state_tracer_ = GPUStateTracer::Create(&state_); | |
| 2450 | 2448 |
| 2451 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 2449 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 2452 switches::kEnableGPUDebugging)) { | 2450 switches::kEnableGPUDebugging)) { |
| 2453 set_debug(true); | 2451 set_debug(true); |
| 2454 } | 2452 } |
| 2455 | 2453 |
| 2456 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 2454 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 2457 switches::kEnableGPUCommandLogging)) { | 2455 switches::kEnableGPUCommandLogging)) { |
| 2458 set_log_commands(true); | 2456 set_log_commands(true); |
| 2459 } | 2457 } |
| 2460 | 2458 |
| 2461 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 2459 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 2462 switches::kEnableUnsafeES3APIs)) { | 2460 switches::kEnableUnsafeES3APIs)) { |
| 2463 set_unsafe_es3_apis_enabled(true); | 2461 set_unsafe_es3_apis_enabled(true); |
| 2464 } | 2462 } |
| 2465 | 2463 |
| 2466 compile_shader_always_succeeds_ = | 2464 compile_shader_always_succeeds_ = |
| 2467 base::CommandLine::ForCurrentProcess()->HasSwitch( | 2465 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 2468 switches::kCompileShaderAlwaysSucceeds); | 2466 switches::kCompileShaderAlwaysSucceeds); |
| 2469 | 2467 |
| 2470 // Take ownership of the context and surface. The surface can be replaced with | 2468 // Take ownership of the context and surface. The surface can be replaced with |
| 2471 // SetSurface. | 2469 // SetSurface. |
| 2472 context_ = context; | 2470 context_ = context; |
| 2473 surface_ = surface; | 2471 surface_ = surface; |
| 2474 | 2472 |
| 2475 ContextCreationAttribHelper attrib_parser; | 2473 ContextCreationAttribHelper attrib_parser; |
| 2476 if (!attrib_parser.Parse(attribs)) | 2474 if (!attrib_parser.Parse(attribs)) |
| 2477 return false; | 2475 return false; |
| 2478 | 2476 |
| 2477 // Create GPU Tracer for timing values. | |
| 2478 gpu_tracer_.reset(new GPUTracer(this)); | |
| 2479 gpu_state_tracer_ = GPUStateTracer::Create(&state_); | |
|
vmiura
2015/02/24 23:57:58
nit: I think GPUStateTracer is not related to GPUT
David Yen
2015/02/25 01:47:35
Done.
| |
| 2480 | |
| 2479 // Save the loseContextWhenOutOfMemory context creation attribute. | 2481 // Save the loseContextWhenOutOfMemory context creation attribute. |
| 2480 lose_context_when_out_of_memory_ = | 2482 lose_context_when_out_of_memory_ = |
| 2481 attrib_parser.lose_context_when_out_of_memory; | 2483 attrib_parser.lose_context_when_out_of_memory; |
| 2482 | 2484 |
| 2483 // If the failIfMajorPerformanceCaveat context creation attribute was true | 2485 // If the failIfMajorPerformanceCaveat context creation attribute was true |
| 2484 // and we are using a software renderer, fail. | 2486 // and we are using a software renderer, fail. |
| 2485 if (attrib_parser.fail_if_major_perf_caveat && | 2487 if (attrib_parser.fail_if_major_perf_caveat && |
| 2486 feature_info_->feature_flags().is_swiftshader) { | 2488 feature_info_->feature_flags().is_swiftshader) { |
| 2487 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. | 2489 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. |
| 2488 Destroy(true); | 2490 Destroy(true); |
| (...skipping 9632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12121 } | 12123 } |
| 12122 } | 12124 } |
| 12123 | 12125 |
| 12124 // Include the auto-generated part of this file. We split this because it means | 12126 // Include the auto-generated part of this file. We split this because it means |
| 12125 // we can easily edit the non-auto generated parts right here in this file | 12127 // we can easily edit the non-auto generated parts right here in this file |
| 12126 // instead of having to edit some template or the code generator. | 12128 // instead of having to edit some template or the code generator. |
| 12127 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 12129 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 12128 | 12130 |
| 12129 } // namespace gles2 | 12131 } // namespace gles2 |
| 12130 } // namespace gpu | 12132 } // namespace gpu |
| OLD | NEW |