| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include <EGL/egl.h> | 5 #include <EGL/egl.h> |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 #if defined(OS_LINUX) | 8 #if defined(OS_LINUX) |
| 9 #include "app/x11_util.h" | 9 #include "app/x11_util.h" |
| 10 #define EGL_HAS_PBUFFERS 1 | 10 #define EGL_HAS_PBUFFERS 1 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 reinterpret_cast<EGLNativeWindowType>(window_); | 159 reinterpret_cast<EGLNativeWindowType>(window_); |
| 160 surface_ = eglCreateWindowSurface(g_display, g_config, native_window, NULL); | 160 surface_ = eglCreateWindowSurface(g_display, g_config, native_window, NULL); |
| 161 | 161 |
| 162 if (!surface_) { | 162 if (!surface_) { |
| 163 LOG(ERROR) << "eglCreateWindowSurface failed with error " | 163 LOG(ERROR) << "eglCreateWindowSurface failed with error " |
| 164 << GetLastEGLErrorString(); | 164 << GetLastEGLErrorString(); |
| 165 Destroy(); | 165 Destroy(); |
| 166 return false; | 166 return false; |
| 167 } | 167 } |
| 168 | 168 |
| 169 // Create a context. | 169 static const EGLint kContextAttributes[] = { |
| 170 context_ = eglCreateContext(g_display, g_config, NULL, NULL); | 170 EGL_CONTEXT_CLIENT_VERSION, 2, |
| 171 EGL_NONE |
| 172 }; |
| 173 |
| 174 context_ = eglCreateContext(g_display, g_config, NULL, kContextAttributes); |
| 171 if (!context_) { | 175 if (!context_) { |
| 172 LOG(ERROR) << "eglCreateContext failed with error " | 176 LOG(ERROR) << "eglCreateContext failed with error " |
| 173 << GetLastEGLErrorString(); | 177 << GetLastEGLErrorString(); |
| 174 Destroy(); | 178 Destroy(); |
| 175 return false; | 179 return false; |
| 176 } | 180 } |
| 177 | 181 |
| 178 if (!MakeCurrent()) { | 182 if (!MakeCurrent()) { |
| 179 LOG(ERROR) << "MakeCurrent failed."; | 183 LOG(ERROR) << "MakeCurrent failed."; |
| 180 Destroy(); | 184 Destroy(); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 void SecondaryEGLContext::SetSwapInterval(int interval) { | 407 void SecondaryEGLContext::SetSwapInterval(int interval) { |
| 404 DCHECK(IsCurrent()); | 408 DCHECK(IsCurrent()); |
| 405 NOTREACHED() << "Attempt to call SetSwapInterval on a SecondaryEGLContext."; | 409 NOTREACHED() << "Attempt to call SetSwapInterval on a SecondaryEGLContext."; |
| 406 } | 410 } |
| 407 | 411 |
| 408 EGLSurface SecondaryEGLContext::GetSurface() { | 412 EGLSurface SecondaryEGLContext::GetSurface() { |
| 409 return surface_; | 413 return surface_; |
| 410 } | 414 } |
| 411 | 415 |
| 412 } // namespace gfx | 416 } // namespace gfx |
| OLD | NEW |