| 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 // This file implements the GLContextWGL and PbufferGLContext classes. | 5 // This file implements the GLContextWGL and PbufferGLContext classes. |
| 6 | 6 |
| 7 #include "ui/gl/gl_context_wgl.h" | 7 #include "ui/gl/gl_context_wgl.h" |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 GLSurface* compatible_surface, GpuPreference gpu_preference) { | 23 GLSurface* compatible_surface, GpuPreference gpu_preference) { |
| 24 // Get the handle of another initialized context in the share group _before_ | 24 // Get the handle of another initialized context in the share group _before_ |
| 25 // setting context_. Otherwise this context will be considered initialized | 25 // setting context_. Otherwise this context will be considered initialized |
| 26 // and could potentially be returned by GetHandle. | 26 // and could potentially be returned by GetHandle. |
| 27 HGLRC share_handle = static_cast<HGLRC>(share_group()->GetHandle()); | 27 HGLRC share_handle = static_cast<HGLRC>(share_group()->GetHandle()); |
| 28 | 28 |
| 29 HDC device_context = static_cast<HDC>(compatible_surface->GetHandle()); | 29 HDC device_context = static_cast<HDC>(compatible_surface->GetHandle()); |
| 30 bool has_wgl_create_context_arb = | 30 bool has_wgl_create_context_arb = |
| 31 strstr(wglGetExtensionsStringARB(device_context), | 31 strstr(wglGetExtensionsStringARB(device_context), |
| 32 "WGL_ARB_create_context") != nullptr; | 32 "WGL_ARB_create_context") != nullptr; |
| 33 bool create_core_profile = has_wgl_create_context_arb && | 33 bool create_core_profile = has_wgl_create_context_arb; |
| 34 base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 35 switches::kEnableUnsafeES3APIs); | |
| 36 | 34 |
| 37 if (create_core_profile) { | 35 if (create_core_profile) { |
| 38 std::pair<int, int> attempt_versions[] = { | 36 std::pair<int, int> attempt_versions[] = { |
| 39 {4, 5}, {4, 4}, {4, 3}, {4, 2}, {4, 1}, {4, 0}, {3, 3}, {3, 2}, | 37 {4, 5}, {4, 4}, {4, 3}, {4, 2}, {4, 1}, {4, 0}, {3, 3}, {3, 2}, |
| 40 }; | 38 }; |
| 41 | 39 |
| 42 for (const auto& version : attempt_versions) { | 40 for (const auto& version : attempt_versions) { |
| 43 const int attribs[] = { | 41 const int attribs[] = { |
| 44 WGL_CONTEXT_MAJOR_VERSION_ARB, | 42 WGL_CONTEXT_MAJOR_VERSION_ARB, |
| 45 version.first, | 43 version.first, |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 return GLContext::GetExtensions() + " " + extensions; | 166 return GLContext::GetExtensions() + " " + extensions; |
| 169 | 167 |
| 170 return GLContext::GetExtensions(); | 168 return GLContext::GetExtensions(); |
| 171 } | 169 } |
| 172 | 170 |
| 173 GLContextWGL::~GLContextWGL() { | 171 GLContextWGL::~GLContextWGL() { |
| 174 Destroy(); | 172 Destroy(); |
| 175 } | 173 } |
| 176 | 174 |
| 177 } // namespace gl | 175 } // namespace gl |
| OLD | NEW |