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" |
11 #include "base/trace_event/trace_event.h" | 11 #include "base/trace_event/trace_event.h" |
12 #include "ui/gl/gl_bindings.h" | 12 #include "ui/gl/gl_bindings.h" |
13 #include "ui/gl/gl_implementation.h" | 13 #include "ui/gl/gl_implementation.h" |
14 #include "ui/gl/gl_surface_wgl.h" | 14 #include "ui/gl/gl_surface_wgl.h" |
15 | 15 |
16 namespace gl { | 16 namespace gl { |
17 | 17 |
18 GLContextWGL::GLContextWGL(GLShareGroup* share_group) | 18 GLContextWGL::GLContextWGL(GLShareGroup* share_group) |
19 : GLContextReal(share_group), context_(nullptr) { | 19 : GLContextReal(share_group), context_(nullptr) { |
20 } | 20 } |
21 | 21 |
22 bool GLContextWGL::Initialize( | 22 bool GLContextWGL::Initialize(GLSurface* compatible_surface, |
23 GLSurface* compatible_surface, GpuPreference gpu_preference) { | 23 const GLContextAttribs& attribs) { |
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 && |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 return GLContext::GetExtensions() + " " + extensions; | 168 return GLContext::GetExtensions() + " " + extensions; |
169 | 169 |
170 return GLContext::GetExtensions(); | 170 return GLContext::GetExtensions(); |
171 } | 171 } |
172 | 172 |
173 GLContextWGL::~GLContextWGL() { | 173 GLContextWGL::~GLContextWGL() { |
174 Destroy(); | 174 Destroy(); |
175 } | 175 } |
176 | 176 |
177 } // namespace gl | 177 } // namespace gl |
OLD | NEW |