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/logging.h" | 9 #include "base/logging.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
11 #include "ui/gl/gl_bindings.h" | 11 #include "ui/gl/gl_bindings.h" |
12 #include "ui/gl/gl_implementation.h" | 12 #include "ui/gl/gl_implementation.h" |
13 #include "ui/gl/gl_surface_wgl.h" | 13 #include "ui/gl/gl_surface_wgl.h" |
14 | 14 |
15 namespace gfx { | 15 namespace gl { |
16 | 16 |
17 GLContextWGL::GLContextWGL(GLShareGroup* share_group) | 17 GLContextWGL::GLContextWGL(GLShareGroup* share_group) |
18 : GLContextReal(share_group), context_(nullptr) { | 18 : GLContextReal(share_group), context_(nullptr) { |
19 } | 19 } |
20 | 20 |
21 bool GLContextWGL::Initialize( | 21 bool GLContextWGL::Initialize( |
22 GLSurface* compatible_surface, GpuPreference gpu_preference) { | 22 GLSurface* compatible_surface, GpuPreference gpu_preference) { |
23 // Get the handle of another initialized context in the share group _before_ | 23 // Get the handle of another initialized context in the share group _before_ |
24 // setting context_. Otherwise this context will be considered initialized | 24 // setting context_. Otherwise this context will be considered initialized |
25 // and could potentially be returned by GetHandle. | 25 // and could potentially be returned by GetHandle. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 return true; | 109 return true; |
110 } | 110 } |
111 | 111 |
112 void* GLContextWGL::GetHandle() { | 112 void* GLContextWGL::GetHandle() { |
113 return context_; | 113 return context_; |
114 } | 114 } |
115 | 115 |
116 void GLContextWGL::OnSetSwapInterval(int interval) { | 116 void GLContextWGL::OnSetSwapInterval(int interval) { |
117 DCHECK(IsCurrent(nullptr)); | 117 DCHECK(IsCurrent(nullptr)); |
118 if (gfx::g_driver_wgl.ext.b_WGL_EXT_swap_control) { | 118 if (gl::g_driver_wgl.ext.b_WGL_EXT_swap_control) { |
119 wglSwapIntervalEXT(interval); | 119 wglSwapIntervalEXT(interval); |
120 } else { | 120 } else { |
121 LOG(WARNING) << | 121 LOG(WARNING) << |
122 "Could not disable vsync: driver does not " | 122 "Could not disable vsync: driver does not " |
123 "support WGL_EXT_swap_control"; | 123 "support WGL_EXT_swap_control"; |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 std::string GLContextWGL::GetExtensions() { | 127 std::string GLContextWGL::GetExtensions() { |
128 const char* extensions = nullptr; | 128 const char* extensions = nullptr; |
129 if (g_driver_wgl.fn.wglGetExtensionsStringARBFn) | 129 if (g_driver_wgl.fn.wglGetExtensionsStringARBFn) |
130 extensions = wglGetExtensionsStringARB(GLSurfaceWGL::GetDisplayDC()); | 130 extensions = wglGetExtensionsStringARB(GLSurfaceWGL::GetDisplayDC()); |
131 else if (g_driver_wgl.fn.wglGetExtensionsStringEXTFn) | 131 else if (g_driver_wgl.fn.wglGetExtensionsStringEXTFn) |
132 extensions = wglGetExtensionsStringEXT(); | 132 extensions = wglGetExtensionsStringEXT(); |
133 | 133 |
134 if (extensions) | 134 if (extensions) |
135 return GLContext::GetExtensions() + " " + extensions; | 135 return GLContext::GetExtensions() + " " + extensions; |
136 | 136 |
137 return GLContext::GetExtensions(); | 137 return GLContext::GetExtensions(); |
138 } | 138 } |
139 | 139 |
140 GLContextWGL::~GLContextWGL() { | 140 GLContextWGL::~GLContextWGL() { |
141 Destroy(); | 141 Destroy(); |
142 } | 142 } |
143 | 143 |
144 } // namespace gfx | 144 } // namespace gl |
OLD | NEW |