OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/gfx/gl/gl_context_wgl.h" | 7 #include "ui/gfx/gl/gl_context_wgl.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/gfx/gl/gl_bindings.h" | 10 #include "ui/gfx/gl/gl_bindings.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 const char* extensions = wglGetExtensionsStringARB( | 30 const char* extensions = wglGetExtensionsStringARB( |
31 GLSurfaceWGL::GetDisplay()); | 31 GLSurfaceWGL::GetDisplay()); |
32 if (extensions) { | 32 if (extensions) { |
33 return GLContext::GetExtensions() + " " + extensions; | 33 return GLContext::GetExtensions() + " " + extensions; |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 return GLContext::GetExtensions(); | 37 return GLContext::GetExtensions(); |
38 } | 38 } |
39 | 39 |
40 bool GLContextWGL::Initialize(GLSurface* compatible_surface) { | 40 bool GLContextWGL::Initialize( |
| 41 GLSurface* compatible_surface, GpuPreference gpu_preference) { |
41 GLSurfaceWGL* surface_wgl = static_cast<GLSurfaceWGL*>(compatible_surface); | 42 GLSurfaceWGL* surface_wgl = static_cast<GLSurfaceWGL*>(compatible_surface); |
42 | 43 |
43 // TODO(apatrick): When contexts and surfaces are separated, we won't be | 44 // TODO(apatrick): When contexts and surfaces are separated, we won't be |
44 // able to use surface_ here. Either use a display device context or a | 45 // able to use surface_ here. Either use a display device context or a |
45 // surface that the context is compatible with not necessarily limited to | 46 // surface that the context is compatible with not necessarily limited to |
46 // rendering to. | 47 // rendering to. |
47 context_ = wglCreateContext(static_cast<HDC>(surface_wgl->GetHandle())); | 48 context_ = wglCreateContext(static_cast<HDC>(surface_wgl->GetHandle())); |
48 if (!context_) { | 49 if (!context_) { |
49 LOG(ERROR) << "Failed to create GL context."; | 50 LOG(ERROR) << "Failed to create GL context."; |
50 Destroy(); | 51 Destroy(); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 if (HasExtension("WGL_EXT_swap_control") && wglSwapIntervalEXT) { | 125 if (HasExtension("WGL_EXT_swap_control") && wglSwapIntervalEXT) { |
125 wglSwapIntervalEXT(interval); | 126 wglSwapIntervalEXT(interval); |
126 } else { | 127 } else { |
127 LOG(WARNING) << | 128 LOG(WARNING) << |
128 "Could not disable vsync: driver does not " | 129 "Could not disable vsync: driver does not " |
129 "support WGL_EXT_swap_control"; | 130 "support WGL_EXT_swap_control"; |
130 } | 131 } |
131 } | 132 } |
132 | 133 |
133 } // namespace gfx | 134 } // namespace gfx |
OLD | NEW |