| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 } | 221 } |
| 222 return eglDisplay; | 222 return eglDisplay; |
| 223 } | 223 } |
| 224 | 224 |
| 225 // Return an EGLConfig, or die trying. | 225 // Return an EGLConfig, or die trying. |
| 226 private static EGLConfig getEglConfig(EGLDisplay eglDisplay, int[] configAttri
butes) { | 226 private static EGLConfig getEglConfig(EGLDisplay eglDisplay, int[] configAttri
butes) { |
| 227 EGLConfig[] configs = new EGLConfig[1]; | 227 EGLConfig[] configs = new EGLConfig[1]; |
| 228 int[] numConfigs = new int[1]; | 228 int[] numConfigs = new int[1]; |
| 229 if (!EGL14.eglChooseConfig( | 229 if (!EGL14.eglChooseConfig( |
| 230 eglDisplay, configAttributes, 0, configs, 0, configs.length, numConfigs,
0)) { | 230 eglDisplay, configAttributes, 0, configs, 0, configs.length, numConfigs,
0)) { |
| 231 throw new RuntimeException("eglChooseConfig failed"); |
| 232 } |
| 233 if (numConfigs[0] <= 0) { |
| 231 throw new RuntimeException("Unable to find any matching EGL config"); | 234 throw new RuntimeException("Unable to find any matching EGL config"); |
| 232 } | 235 } |
| 233 return configs[0]; | 236 final EGLConfig eglConfig = configs[0]; |
| 237 if (eglConfig == null) { |
| 238 throw new RuntimeException("eglChooseConfig returned null"); |
| 239 } |
| 240 return eglConfig; |
| 234 } | 241 } |
| 235 | 242 |
| 236 // Return an EGLConfig, or die trying. | 243 // Return an EGLConfig, or die trying. |
| 237 private static EGLContext createEglContext( | 244 private static EGLContext createEglContext( |
| 238 EglBase14.Context sharedContext, EGLDisplay eglDisplay, EGLConfig eglConfi
g) { | 245 EglBase14.Context sharedContext, EGLDisplay eglDisplay, EGLConfig eglConfi
g) { |
| 239 if (sharedContext != null && sharedContext.egl14Context == EGL14.EGL_NO_CONT
EXT) { | 246 if (sharedContext != null && sharedContext.egl14Context == EGL14.EGL_NO_CONT
EXT) { |
| 240 throw new RuntimeException("Invalid sharedContext"); | 247 throw new RuntimeException("Invalid sharedContext"); |
| 241 } | 248 } |
| 242 int[] contextAttributes = {EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NO
NE}; | 249 int[] contextAttributes = {EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NO
NE}; |
| 243 EGLContext rootContext = | 250 EGLContext rootContext = |
| 244 sharedContext == null ? EGL14.EGL_NO_CONTEXT : sharedContext.egl14Contex
t; | 251 sharedContext == null ? EGL14.EGL_NO_CONTEXT : sharedContext.egl14Contex
t; |
| 245 EGLContext eglContext = | 252 EGLContext eglContext = |
| 246 EGL14.eglCreateContext(eglDisplay, eglConfig, rootContext, contextAttrib
utes, 0); | 253 EGL14.eglCreateContext(eglDisplay, eglConfig, rootContext, contextAttrib
utes, 0); |
| 247 if (eglContext == EGL14.EGL_NO_CONTEXT) { | 254 if (eglContext == EGL14.EGL_NO_CONTEXT) { |
| 248 throw new RuntimeException("Failed to create EGL context"); | 255 throw new RuntimeException("Failed to create EGL context"); |
| 249 } | 256 } |
| 250 return eglContext; | 257 return eglContext; |
| 251 } | 258 } |
| 252 } | 259 } |
| OLD | NEW |