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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 DCHECK(context_); | 77 DCHECK(context_); |
78 if (IsCurrent(surface)) | 78 if (IsCurrent(surface)) |
79 return true; | 79 return true; |
80 | 80 |
81 if (!wglMakeCurrent(static_cast<HDC>(surface->GetHandle()), context_)) { | 81 if (!wglMakeCurrent(static_cast<HDC>(surface->GetHandle()), context_)) { |
82 LOG(ERROR) << "Unable to make gl context current."; | 82 LOG(ERROR) << "Unable to make gl context current."; |
83 return false; | 83 return false; |
84 } | 84 } |
85 | 85 |
86 SetCurrent(this, surface); | 86 SetCurrent(this, surface); |
| 87 if (!InitializeExtensionBindings()) { |
| 88 ReleaseCurrent(surface); |
| 89 return false; |
| 90 } |
| 91 |
87 if (!surface->OnMakeCurrent(this)) { | 92 if (!surface->OnMakeCurrent(this)) { |
88 LOG(ERROR) << "Could not make current."; | 93 LOG(ERROR) << "Could not make current."; |
89 return false; | 94 return false; |
90 } | 95 } |
91 | 96 |
92 return true; | 97 return true; |
93 } | 98 } |
94 | 99 |
95 void GLContextWGL::ReleaseCurrent(GLSurface* surface) { | 100 void GLContextWGL::ReleaseCurrent(GLSurface* surface) { |
96 if (!IsCurrent(surface)) | 101 if (!IsCurrent(surface)) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 if (HasExtension("WGL_EXT_swap_control") && wglSwapIntervalEXT) { | 134 if (HasExtension("WGL_EXT_swap_control") && wglSwapIntervalEXT) { |
130 wglSwapIntervalEXT(interval); | 135 wglSwapIntervalEXT(interval); |
131 } else { | 136 } else { |
132 LOG(WARNING) << | 137 LOG(WARNING) << |
133 "Could not disable vsync: driver does not " | 138 "Could not disable vsync: driver does not " |
134 "support WGL_EXT_swap_control"; | 139 "support WGL_EXT_swap_control"; |
135 } | 140 } |
136 } | 141 } |
137 | 142 |
138 } // namespace gfx | 143 } // namespace gfx |
OLD | NEW |