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