OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 /** | 41 /** |
42 * Holds EGL state and utility methods for handling an EGL14 EGLContext, an EGLD
isplay, | 42 * Holds EGL state and utility methods for handling an EGL14 EGLContext, an EGLD
isplay, |
43 * and an EGLSurface. | 43 * and an EGLSurface. |
44 */ | 44 */ |
45 @TargetApi(17) | 45 @TargetApi(17) |
46 final class EglBase14 extends EglBase { | 46 final class EglBase14 extends EglBase { |
47 private static final String TAG = "EglBase14"; | 47 private static final String TAG = "EglBase14"; |
48 private static final int EGL14_SDK_VERSION = android.os.Build.VERSION_CODES.JE
LLY_BEAN_MR1; | 48 private static final int EGL14_SDK_VERSION = android.os.Build.VERSION_CODES.JE
LLY_BEAN_MR1; |
49 private static final int CURRENT_SDK_VERSION = android.os.Build.VERSION.SDK_IN
T; | 49 private static final int CURRENT_SDK_VERSION = android.os.Build.VERSION.SDK_IN
T; |
| 50 // Android-specific extension. |
| 51 private static final int EGL_RECORDABLE_ANDROID = 0x3142; |
| 52 |
50 private EGLContext eglContext; | 53 private EGLContext eglContext; |
51 private EGLConfig eglConfig; | 54 private EGLConfig eglConfig; |
52 private EGLDisplay eglDisplay; | 55 private EGLDisplay eglDisplay; |
53 private EGLSurface eglSurface = EGL14.EGL_NO_SURFACE; | 56 private EGLSurface eglSurface = EGL14.EGL_NO_SURFACE; |
54 | 57 |
55 public static boolean isEGL14Supported() { | 58 public static boolean isEGL14Supported() { |
56 Logging.d(TAG, "SDK version: " + CURRENT_SDK_VERSION | 59 Logging.d(TAG, "SDK version: " + CURRENT_SDK_VERSION |
57 + ". isEGL14Supported: " + (CURRENT_SDK_VERSION >= EGL14_SDK_VERSION)); | 60 + ". isEGL14Supported: " + (CURRENT_SDK_VERSION >= EGL14_SDK_VERSION)); |
58 return (CURRENT_SDK_VERSION >= EGL14_SDK_VERSION); | 61 return (CURRENT_SDK_VERSION >= EGL14_SDK_VERSION); |
59 } | 62 } |
60 | 63 |
61 public static class Context extends EglBase.Context { | 64 public static class Context extends EglBase.Context { |
62 private final android.opengl.EGLContext egl14Context; | 65 private final android.opengl.EGLContext egl14Context; |
63 | 66 |
64 Context(android.opengl.EGLContext eglContext) { | 67 Context(android.opengl.EGLContext eglContext) { |
| 68 super(null); |
65 this.egl14Context = eglContext; | 69 this.egl14Context = eglContext; |
66 } | 70 } |
67 } | 71 } |
68 | 72 |
69 // Create a new context with the specified config type, sharing data with shar
edContext. | 73 // Create a new context with the specified config type, sharing data with shar
edContext. |
70 // |sharedContext| may be null. | 74 // |sharedContext| may be null. |
71 EglBase14(EglBase14.Context sharedContext, int[] configAttributes) { | 75 EglBase14(EglBase14.Context sharedContext, int[] configAttributes) { |
| 76 super(true /* dummy */); |
72 eglDisplay = getEglDisplay(); | 77 eglDisplay = getEglDisplay(); |
73 eglConfig = getEglConfig(eglDisplay, configAttributes); | 78 eglConfig = getEglConfig(eglDisplay, configAttributes); |
74 eglContext = createEglContext(sharedContext, eglDisplay, eglConfig); | 79 eglContext = createEglContext(sharedContext, eglDisplay, eglConfig); |
75 } | 80 } |
76 | 81 |
77 // Create EGLSurface from the Android Surface. | 82 // Create EGLSurface from the Android Surface. |
78 @Override | 83 @Override |
79 public void createSurface(Surface surface) { | 84 public void createSurface(Surface surface) { |
80 createSurfaceInternal(surface); | 85 createSurfaceInternal(surface); |
81 } | 86 } |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 EGLContext rootContext = | 237 EGLContext rootContext = |
233 sharedContext == null ? EGL14.EGL_NO_CONTEXT : sharedContext.egl14Contex
t; | 238 sharedContext == null ? EGL14.EGL_NO_CONTEXT : sharedContext.egl14Contex
t; |
234 EGLContext eglContext = | 239 EGLContext eglContext = |
235 EGL14.eglCreateContext(eglDisplay, eglConfig, rootContext, contextAttrib
utes, 0); | 240 EGL14.eglCreateContext(eglDisplay, eglConfig, rootContext, contextAttrib
utes, 0); |
236 if (eglContext == EGL14.EGL_NO_CONTEXT) { | 241 if (eglContext == EGL14.EGL_NO_CONTEXT) { |
237 throw new RuntimeException("Failed to create EGL context"); | 242 throw new RuntimeException("Failed to create EGL context"); |
238 } | 243 } |
239 return eglContext; | 244 return eglContext; |
240 } | 245 } |
241 } | 246 } |
OLD | NEW |