| 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 2456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2467 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 2467 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 2468 switches::kEnableGPUDebugging)) { | 2468 switches::kEnableGPUDebugging)) { |
| 2469 set_debug(true); | 2469 set_debug(true); |
| 2470 } | 2470 } |
| 2471 | 2471 |
| 2472 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 2472 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 2473 switches::kEnableGPUCommandLogging)) { | 2473 switches::kEnableGPUCommandLogging)) { |
| 2474 set_log_commands(true); | 2474 set_log_commands(true); |
| 2475 } | 2475 } |
| 2476 | 2476 |
| 2477 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 2478 switches::kEnableUnsafeES3APIs) && | |
| 2479 attrib_parser.es3_context_required) { | |
| 2480 // TODO(zmo): We need to implement capabilities check to ensure we can | |
| 2481 // actually create ES3 contexts. | |
| 2482 set_unsafe_es3_apis_enabled(true); | |
| 2483 } | |
| 2484 | |
| 2485 compile_shader_always_succeeds_ = | 2477 compile_shader_always_succeeds_ = |
| 2486 base::CommandLine::ForCurrentProcess()->HasSwitch( | 2478 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 2487 switches::kCompileShaderAlwaysSucceeds); | 2479 switches::kCompileShaderAlwaysSucceeds); |
| 2488 | 2480 |
| 2489 // Take ownership of the context and surface. The surface can be replaced with | 2481 // Take ownership of the context and surface. The surface can be replaced with |
| 2490 // SetSurface. | 2482 // SetSurface. |
| 2491 context_ = context; | 2483 context_ = context; |
| 2492 surface_ = surface; | 2484 surface_ = surface; |
| 2493 | 2485 |
| 2494 // Create GPU Tracer for timing values. | 2486 // Create GPU Tracer for timing values. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2509 | 2501 |
| 2510 if (!group_->Initialize(this, disallowed_features)) { | 2502 if (!group_->Initialize(this, disallowed_features)) { |
| 2511 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " | 2503 LOG(ERROR) << "GpuScheduler::InitializeCommon failed because group " |
| 2512 << "failed to initialize."; | 2504 << "failed to initialize."; |
| 2513 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. | 2505 group_ = NULL; // Must not destroy ContextGroup if it is not initialized. |
| 2514 Destroy(true); | 2506 Destroy(true); |
| 2515 return false; | 2507 return false; |
| 2516 } | 2508 } |
| 2517 CHECK_GL_ERROR(); | 2509 CHECK_GL_ERROR(); |
| 2518 | 2510 |
| 2511 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 2512 switches::kEnableUnsafeES3APIs) && |
| 2513 attrib_parser.es3_context_required && |
| 2514 feature_info_->IsES3Capable()) { |
| 2515 feature_info_->EnableES3Validators(); |
| 2516 set_unsafe_es3_apis_enabled(true); |
| 2517 } |
| 2518 |
| 2519 disallowed_features_ = disallowed_features; | 2519 disallowed_features_ = disallowed_features; |
| 2520 | 2520 |
| 2521 state_.attrib_values.resize(group_->max_vertex_attribs()); | 2521 state_.attrib_values.resize(group_->max_vertex_attribs()); |
| 2522 vertex_array_manager_.reset(new VertexArrayManager()); | 2522 vertex_array_manager_.reset(new VertexArrayManager()); |
| 2523 | 2523 |
| 2524 GLuint default_vertex_attrib_service_id = 0; | 2524 GLuint default_vertex_attrib_service_id = 0; |
| 2525 if (features().native_vertex_array_object) { | 2525 if (features().native_vertex_array_object) { |
| 2526 glGenVertexArraysOES(1, &default_vertex_attrib_service_id); | 2526 glGenVertexArraysOES(1, &default_vertex_attrib_service_id); |
| 2527 glBindVertexArrayOES(default_vertex_attrib_service_id); | 2527 glBindVertexArrayOES(default_vertex_attrib_service_id); |
| 2528 } | 2528 } |
| (...skipping 9775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12304 } | 12304 } |
| 12305 } | 12305 } |
| 12306 | 12306 |
| 12307 // Include the auto-generated part of this file. We split this because it means | 12307 // Include the auto-generated part of this file. We split this because it means |
| 12308 // we can easily edit the non-auto generated parts right here in this file | 12308 // we can easily edit the non-auto generated parts right here in this file |
| 12309 // instead of having to edit some template or the code generator. | 12309 // instead of having to edit some template or the code generator. |
| 12310 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" | 12310 #include "gpu/command_buffer/service/gles2_cmd_decoder_autogen.h" |
| 12311 | 12311 |
| 12312 } // namespace gles2 | 12312 } // namespace gles2 |
| 12313 } // namespace gpu | 12313 } // namespace gpu |
| OLD | NEW |