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 "ui/gl/gl_gl_api_implementation.h" | 5 #include "ui/gl/gl_gl_api_implementation.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 | 485 |
486 // Filter out extensions from the command line. | 486 // Filter out extensions from the command line. |
487 for (const std::string& disabled_ext : disabled_exts_) { | 487 for (const std::string& disabled_ext : disabled_exts_) { |
488 filtered_exts_.erase(std::remove(filtered_exts_.begin(), | 488 filtered_exts_.erase(std::remove(filtered_exts_.begin(), |
489 filtered_exts_.end(), | 489 filtered_exts_.end(), |
490 disabled_ext), | 490 disabled_ext), |
491 filtered_exts_.end()); | 491 filtered_exts_.end()); |
492 } | 492 } |
493 | 493 |
494 // Construct filtered extensions string for GL_EXTENSIONS string lookups. | 494 // Construct filtered extensions string for GL_EXTENSIONS string lookups. |
495 filtered_exts_str_ = JoinString(filtered_exts_, " "); | 495 filtered_exts_str_ = base::JoinString(filtered_exts_, " "); |
496 } | 496 } |
497 } | 497 } |
498 | 498 |
499 TraceGLApi::~TraceGLApi() { | 499 TraceGLApi::~TraceGLApi() { |
500 } | 500 } |
501 | 501 |
502 NoContextGLApi::NoContextGLApi() { | 502 NoContextGLApi::NoContextGLApi() { |
503 } | 503 } |
504 | 504 |
505 NoContextGLApi::~NoContextGLApi() { | 505 NoContextGLApi::~NoContextGLApi() { |
(...skipping 17 matching lines...) Expand all Loading... |
523 ext_string, " ", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); | 523 ext_string, " ", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY); |
524 | 524 |
525 std::vector<std::string>::iterator it; | 525 std::vector<std::string>::iterator it; |
526 // We can't support GL_EXT_occlusion_query_boolean which is | 526 // We can't support GL_EXT_occlusion_query_boolean which is |
527 // based on GL_ARB_occlusion_query without a lot of work virtualizing | 527 // based on GL_ARB_occlusion_query without a lot of work virtualizing |
528 // queries. | 528 // queries. |
529 it = std::find(ext.begin(), ext.end(), "GL_EXT_occlusion_query_boolean"); | 529 it = std::find(ext.begin(), ext.end(), "GL_EXT_occlusion_query_boolean"); |
530 if (it != ext.end()) | 530 if (it != ext.end()) |
531 ext.erase(it); | 531 ext.erase(it); |
532 | 532 |
533 extensions_ = JoinString(ext, " "); | 533 extensions_ = base::JoinString(ext, " "); |
534 } | 534 } |
535 | 535 |
536 bool VirtualGLApi::MakeCurrent(GLContext* virtual_context, GLSurface* surface) { | 536 bool VirtualGLApi::MakeCurrent(GLContext* virtual_context, GLSurface* surface) { |
537 bool switched_contexts = g_current_gl_context_tls->Get() != this; | 537 bool switched_contexts = g_current_gl_context_tls->Get() != this; |
538 GLSurface* current_surface = GLSurface::GetCurrent(); | 538 GLSurface* current_surface = GLSurface::GetCurrent(); |
539 if (switched_contexts || surface != current_surface) { | 539 if (switched_contexts || surface != current_surface) { |
540 // MakeCurrent 'lite' path that avoids potentially expensive MakeCurrent() | 540 // MakeCurrent 'lite' path that avoids potentially expensive MakeCurrent() |
541 // calls if the GLSurface uses the same underlying surface or renders to | 541 // calls if the GLSurface uses the same underlying surface or renders to |
542 // an FBO. | 542 // an FBO. |
543 if (switched_contexts || !current_surface || | 543 if (switched_contexts || !current_surface || |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 ScopedSetGLToRealGLApi::ScopedSetGLToRealGLApi() | 613 ScopedSetGLToRealGLApi::ScopedSetGLToRealGLApi() |
614 : old_gl_api_(GetCurrentGLApi()) { | 614 : old_gl_api_(GetCurrentGLApi()) { |
615 SetGLToRealGLApi(); | 615 SetGLToRealGLApi(); |
616 } | 616 } |
617 | 617 |
618 ScopedSetGLToRealGLApi::~ScopedSetGLToRealGLApi() { | 618 ScopedSetGLToRealGLApi::~ScopedSetGLToRealGLApi() { |
619 SetGLApi(old_gl_api_); | 619 SetGLApi(old_gl_api_); |
620 } | 620 } |
621 | 621 |
622 } // namespace gfx | 622 } // namespace gfx |
OLD | NEW |