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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 public static final int[] CONFIG_RECORDABLE = { | 73 public static final int[] CONFIG_RECORDABLE = { |
74 EGL10.EGL_RED_SIZE, 8, | 74 EGL10.EGL_RED_SIZE, 8, |
75 EGL10.EGL_GREEN_SIZE, 8, | 75 EGL10.EGL_GREEN_SIZE, 8, |
76 EGL10.EGL_BLUE_SIZE, 8, | 76 EGL10.EGL_BLUE_SIZE, 8, |
77 EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, | 77 EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, |
78 EGL_RECORDABLE_ANDROID, 1, | 78 EGL_RECORDABLE_ANDROID, 1, |
79 EGL10.EGL_NONE | 79 EGL10.EGL_NONE |
80 }; | 80 }; |
81 // clang-format on | 81 // clang-format on |
82 | 82 |
83 // Create a new context with the specified config attributes, sharing data wit
h sharedContext. | 83 /** |
84 // |sharedContext| can be null. | 84 * Create a new context with the specified config attributes, sharing data wit
h |sharedContext|. |
| 85 * If |sharedContext| is null, a root context is created. This function will t
ry to create an EGL |
| 86 * 1.4 context if possible, and an EGL 1.0 context otherwise. |
| 87 */ |
85 public static EglBase create(Context sharedContext, int[] configAttributes) { | 88 public static EglBase create(Context sharedContext, int[] configAttributes) { |
86 return (EglBase14.isEGL14Supported() | 89 return (EglBase14.isEGL14Supported() |
87 && (sharedContext == null || sharedContext instanceof EglBase14.C
ontext)) | 90 && (sharedContext == null || sharedContext instanceof EglBase14.C
ontext)) |
88 ? new EglBase14((EglBase14.Context) sharedContext, configAttributes) | 91 ? new EglBase14((EglBase14.Context) sharedContext, configAttributes) |
89 : new EglBase10((EglBase10.Context) sharedContext, configAttributes); | 92 : new EglBase10((EglBase10.Context) sharedContext, configAttributes); |
90 } | 93 } |
91 | 94 |
| 95 /** |
| 96 * Helper function for creating a plain root context. This function will try t
o create an EGL 1.4 |
| 97 * context if possible, and an EGL 1.0 context otherwise. |
| 98 */ |
92 public static EglBase create() { | 99 public static EglBase create() { |
93 return create(null, CONFIG_PLAIN); | 100 return create(null /* shaderContext */, CONFIG_PLAIN); |
94 } | 101 } |
95 | 102 |
| 103 /** |
| 104 * Helper function for creating a plain context, sharing data with |sharedCont
ext|. This function |
| 105 * will try to create an EGL 1.4 context if possible, and an EGL 1.0 context o
therwise. |
| 106 */ |
96 public static EglBase create(Context sharedContext) { | 107 public static EglBase create(Context sharedContext) { |
97 return create(sharedContext, CONFIG_PLAIN); | 108 return create(sharedContext, CONFIG_PLAIN); |
98 } | 109 } |
99 | 110 |
| 111 /** |
| 112 * Explicitly create a root EGl 1.0 context with the specified config attribut
es. |
| 113 */ |
| 114 public static EglBase createEgl10(int[] configAttributes) { |
| 115 return new EglBase10(null /* shaderContext */, configAttributes); |
| 116 } |
| 117 |
| 118 /** |
| 119 * Explicitly create a root EGl 1.4 context with the specified config attribut
es. |
| 120 */ |
| 121 public static EglBase createEgl14(int[] configAttributes) { |
| 122 return new EglBase14(null /* shaderContext */, configAttributes); |
| 123 } |
| 124 |
100 public abstract void createSurface(Surface surface); | 125 public abstract void createSurface(Surface surface); |
101 | 126 |
102 // Create EGLSurface from the Android SurfaceTexture. | 127 // Create EGLSurface from the Android SurfaceTexture. |
103 public abstract void createSurface(SurfaceTexture surfaceTexture); | 128 public abstract void createSurface(SurfaceTexture surfaceTexture); |
104 | 129 |
105 // Create dummy 1x1 pixel buffer surface so the context can be made current. | 130 // Create dummy 1x1 pixel buffer surface so the context can be made current. |
106 public abstract void createDummyPbufferSurface(); | 131 public abstract void createDummyPbufferSurface(); |
107 | 132 |
108 public abstract void createPbufferSurface(int width, int height); | 133 public abstract void createPbufferSurface(int width, int height); |
109 | 134 |
110 public abstract Context getEglBaseContext(); | 135 public abstract Context getEglBaseContext(); |
111 | 136 |
112 public abstract boolean hasSurface(); | 137 public abstract boolean hasSurface(); |
113 | 138 |
114 public abstract int surfaceWidth(); | 139 public abstract int surfaceWidth(); |
115 | 140 |
116 public abstract int surfaceHeight(); | 141 public abstract int surfaceHeight(); |
117 | 142 |
118 public abstract void releaseSurface(); | 143 public abstract void releaseSurface(); |
119 | 144 |
120 public abstract void release(); | 145 public abstract void release(); |
121 | 146 |
122 public abstract void makeCurrent(); | 147 public abstract void makeCurrent(); |
123 | 148 |
124 // Detach the current EGL context, so that it can be made current on another t
hread. | 149 // Detach the current EGL context, so that it can be made current on another t
hread. |
125 public abstract void detachCurrent(); | 150 public abstract void detachCurrent(); |
126 | 151 |
127 public abstract void swapBuffers(); | 152 public abstract void swapBuffers(); |
128 } | 153 } |
OLD | NEW |