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_); | 2448 gpu_state_tracer_ = GPUStateTracer::Create(&state_); |
2450 | 2449 |
2451 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 2450 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
2452 switches::kEnableGPUDebugging)) { | 2451 switches::kEnableGPUDebugging)) { |
2453 set_debug(true); | 2452 set_debug(true); |
2454 } | 2453 } |
2455 | 2454 |
2456 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 2455 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
2457 switches::kEnableGPUCommandLogging)) { | 2456 switches::kEnableGPUCommandLogging)) { |
2458 set_log_commands(true); | 2457 set_log_commands(true); |
(...skipping 10 matching lines...) Expand all Loading... |
2469 | 2468 |
2470 // Take ownership of the context and surface. The surface can be replaced with | 2469 // Take ownership of the context and surface. The surface can be replaced with |
2471 // SetSurface. | 2470 // SetSurface. |
2472 context_ = context; | 2471 context_ = context; |
2473 surface_ = surface; | 2472 surface_ = surface; |
2474 | 2473 |
2475 ContextCreationAttribHelper attrib_parser; | 2474 ContextCreationAttribHelper attrib_parser; |
2476 if (!attrib_parser.Parse(attribs)) | 2475 if (!attrib_parser.Parse(attribs)) |
2477 return false; | 2476 return false; |
2478 | 2477 |
| 2478 // Create GPU Tracer for timing values. |
| 2479 gpu_tracer_.reset(new GPUTracer(this)); |
| 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 |