blob: de5e3a52a0c1cbc670fc4943bb3fe92ada3a179a [file] [log] [blame]
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -07001/*
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -07002** Copyright 2012, The Android Open Source Project
3**
4** Licensed under the Apache License, Version 2.0 (the "License");
5** you may not use this file except in compliance with the License.
6** You may obtain a copy of the License at
7**
8** http://www.apache.org/licenses/LICENSE-2.0
9**
10** Unless required by applicable law or agreed to in writing, software
11** distributed under the License is distributed on an "AS IS" BASIS,
12** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13** See the License for the specific language governing permissions and
14** limitations under the License.
15*/
16
17// This source file is automatically generated
18
Andreas Gampebfe63332014-11-12 14:12:45 -080019#pragma GCC diagnostic ignored "-Wunused-variable"
Andreas Gampebfe63332014-11-12 14:12:45 -080020#pragma GCC diagnostic ignored "-Wunused-function"
21
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -070022#include "jni.h"
Steven Moreland2279b252017-07-19 09:50:45 -070023#include <nativehelper/JNIHelp.h>
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -070024#include <android_runtime/AndroidRuntime.h>
25#include <android_runtime/android_view_Surface.h>
26#include <android_runtime/android_graphics_SurfaceTexture.h>
27#include <utils/misc.h>
28
29#include <assert.h>
30#include <EGL/egl.h>
31
32#include <gui/Surface.h>
Andy McFaddend47f7d82012-12-18 09:48:38 -080033#include <gui/GLConsumer.h>
Mathias Agopian52800612013-02-14 17:11:20 -080034#include <gui/Surface.h>
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -070035
36#include <ui/ANativeObjectBase.h>
37
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -070038static jclass egldisplayClass;
39static jclass eglcontextClass;
40static jclass eglsurfaceClass;
41static jclass eglconfigClass;
42
43static jmethodID egldisplayGetHandleID;
44static jmethodID eglcontextGetHandleID;
45static jmethodID eglsurfaceGetHandleID;
46static jmethodID eglconfigGetHandleID;
47
48static jmethodID egldisplayConstructor;
49static jmethodID eglcontextConstructor;
50static jmethodID eglsurfaceConstructor;
51static jmethodID eglconfigConstructor;
52
53static jobject eglNoContextObject;
54static jobject eglNoDisplayObject;
55static jobject eglNoSurfaceObject;
56
57
58
59/* Cache method IDs each time the class is loaded. */
60
61static void
62nativeClassInit(JNIEnv *_env, jclass glImplClass)
63{
64 jclass egldisplayClassLocal = _env->FindClass("android/opengl/EGLDisplay");
65 egldisplayClass = (jclass) _env->NewGlobalRef(egldisplayClassLocal);
66 jclass eglcontextClassLocal = _env->FindClass("android/opengl/EGLContext");
67 eglcontextClass = (jclass) _env->NewGlobalRef(eglcontextClassLocal);
68 jclass eglsurfaceClassLocal = _env->FindClass("android/opengl/EGLSurface");
69 eglsurfaceClass = (jclass) _env->NewGlobalRef(eglsurfaceClassLocal);
70 jclass eglconfigClassLocal = _env->FindClass("android/opengl/EGLConfig");
71 eglconfigClass = (jclass) _env->NewGlobalRef(eglconfigClassLocal);
72
Ashok Bhat84bbeb92014-02-24 10:06:55 +000073 egldisplayGetHandleID = _env->GetMethodID(egldisplayClass, "getNativeHandle", "()J");
74 eglcontextGetHandleID = _env->GetMethodID(eglcontextClass, "getNativeHandle", "()J");
75 eglsurfaceGetHandleID = _env->GetMethodID(eglsurfaceClass, "getNativeHandle", "()J");
76 eglconfigGetHandleID = _env->GetMethodID(eglconfigClass, "getNativeHandle", "()J");
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -070077
78
Ashok Bhat84bbeb92014-02-24 10:06:55 +000079 egldisplayConstructor = _env->GetMethodID(egldisplayClass, "<init>", "(J)V");
80 eglcontextConstructor = _env->GetMethodID(eglcontextClass, "<init>", "(J)V");
81 eglsurfaceConstructor = _env->GetMethodID(eglsurfaceClass, "<init>", "(J)V");
82 eglconfigConstructor = _env->GetMethodID(eglconfigClass, "<init>", "(J)V");
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -070083
Ashok Bhat84bbeb92014-02-24 10:06:55 +000084 jobject localeglNoContextObject = _env->NewObject(eglcontextClass, eglcontextConstructor, reinterpret_cast<jlong>(EGL_NO_CONTEXT));
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -070085 eglNoContextObject = _env->NewGlobalRef(localeglNoContextObject);
Ashok Bhat84bbeb92014-02-24 10:06:55 +000086 jobject localeglNoDisplayObject = _env->NewObject(egldisplayClass, egldisplayConstructor, reinterpret_cast<jlong>(EGL_NO_DISPLAY));
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -070087 eglNoDisplayObject = _env->NewGlobalRef(localeglNoDisplayObject);
Ashok Bhat84bbeb92014-02-24 10:06:55 +000088 jobject localeglNoSurfaceObject = _env->NewObject(eglsurfaceClass, eglsurfaceConstructor, reinterpret_cast<jlong>(EGL_NO_SURFACE));
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -070089 eglNoSurfaceObject = _env->NewGlobalRef(localeglNoSurfaceObject);
90
91
92 jclass eglClass = _env->FindClass("android/opengl/EGL14");
93 jfieldID noContextFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_CONTEXT", "Landroid/opengl/EGLContext;");
94 _env->SetStaticObjectField(eglClass, noContextFieldID, eglNoContextObject);
95
96 jfieldID noDisplayFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_DISPLAY", "Landroid/opengl/EGLDisplay;");
97 _env->SetStaticObjectField(eglClass, noDisplayFieldID, eglNoDisplayObject);
98
99 jfieldID noSurfaceFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_SURFACE", "Landroid/opengl/EGLSurface;");
100 _env->SetStaticObjectField(eglClass, noSurfaceFieldID, eglNoSurfaceObject);
101}
102
103static void *
104fromEGLHandle(JNIEnv *_env, jmethodID mid, jobject obj) {
105 if (obj == NULL){
106 jniThrowException(_env, "java/lang/IllegalArgumentException",
107 "Object is set to null.");
Courtney Goeltzenleuchter9e82c382019-02-11 11:24:58 -0700108 return nullptr;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700109 }
110
Ashok Bhat84bbeb92014-02-24 10:06:55 +0000111 jlong handle = _env->CallLongMethod(obj, mid);
112 return reinterpret_cast<void*>(handle);
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700113}
114
115static jobject
116toEGLHandle(JNIEnv *_env, jclass cls, jmethodID con, void * handle) {
117 if (cls == eglcontextClass &&
118 (EGLContext)handle == EGL_NO_CONTEXT) {
119 return eglNoContextObject;
120 }
121
122 if (cls == egldisplayClass &&
123 (EGLDisplay)handle == EGL_NO_DISPLAY) {
124 return eglNoDisplayObject;
125 }
126
127 if (cls == eglsurfaceClass &&
128 (EGLSurface)handle == EGL_NO_SURFACE) {
129 return eglNoSurfaceObject;
130 }
131
Ashok Bhat84bbeb92014-02-24 10:06:55 +0000132 return _env->NewObject(cls, con, reinterpret_cast<jlong>(handle));
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700133}
134
135// --------------------------------------------------------------------------
136/* EGLint eglGetError ( void ) */
137static jint
138android_eglGetError
139 (JNIEnv *_env, jobject _this) {
140 EGLint _returnValue = (EGLint) 0;
141 _returnValue = eglGetError();
Andy McFaddencee51982013-04-25 16:08:31 -0700142 return (jint)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700143}
144
145/* EGLDisplay eglGetDisplay ( EGLNativeDisplayType display_id ) */
146static jobject
147android_eglGetDisplay
Ashok Bhat84bbeb92014-02-24 10:06:55 +0000148 (JNIEnv *_env, jobject _this, jlong display_id) {
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700149 EGLDisplay _returnValue = (EGLDisplay) 0;
150 _returnValue = eglGetDisplay(
Ashok Bhat84bbeb92014-02-24 10:06:55 +0000151 reinterpret_cast<EGLNativeDisplayType>(display_id)
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700152 );
153 return toEGLHandle(_env, egldisplayClass, egldisplayConstructor, _returnValue);
154}
155
Ashok Bhat84bbeb92014-02-24 10:06:55 +0000156/* EGLDisplay eglGetDisplay ( EGLNativeDisplayType display_id ) */
157static jobject
158android_eglGetDisplayInt
159 (JNIEnv *_env, jobject _this, jint display_id) {
160
Dan Albert10caf032015-02-23 10:41:10 -0800161 if (static_cast<uintptr_t>(display_id) !=
162 reinterpret_cast<uintptr_t>(EGL_DEFAULT_DISPLAY)) {
Ashok Bhat84bbeb92014-02-24 10:06:55 +0000163 jniThrowException(_env, "java/lang/UnsupportedOperationException", "eglGetDisplay");
164 return 0;
165 }
166 return android_eglGetDisplay(_env, _this, display_id);
167}
168
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700169/* EGLBoolean eglInitialize ( EGLDisplay dpy, EGLint *major, EGLint *minor ) */
170static jboolean
171android_eglInitialize
172 (JNIEnv *_env, jobject _this, jobject dpy, jintArray major_ref, jint majorOffset, jintArray minor_ref, jint minorOffset) {
173 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800174 const char * _exceptionType = NULL;
175 const char * _exceptionMessage = NULL;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700176 EGLBoolean _returnValue = (EGLBoolean) 0;
177 EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
178 EGLint *major_base = (EGLint *) 0;
179 jint _majorRemaining;
180 EGLint *major = (EGLint *) 0;
181 EGLint *minor_base = (EGLint *) 0;
182 jint _minorRemaining;
183 EGLint *minor = (EGLint *) 0;
184
Pablo Ceballos6aff9062015-10-01 18:35:39 -0700185 if (major_ref) {
186 if (majorOffset < 0) {
187 _exception = 1;
188 _exceptionType = "java/lang/IllegalArgumentException";
189 _exceptionMessage = "majorOffset < 0";
190 goto exit;
191 }
192 _majorRemaining = _env->GetArrayLength(major_ref) - majorOffset;
193 if (_majorRemaining < 1) {
194 _exception = 1;
195 _exceptionType = "java/lang/IllegalArgumentException";
196 _exceptionMessage = "length - majorOffset < 1 < needed";
197 goto exit;
198 }
199 major_base = (EGLint *)
200 _env->GetIntArrayElements(major_ref, (jboolean *)0);
201 major = major_base + majorOffset;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700202 }
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700203
Pablo Ceballos6aff9062015-10-01 18:35:39 -0700204 if (minor_ref) {
205 if (minorOffset < 0) {
206 _exception = 1;
207 _exceptionType = "java/lang/IllegalArgumentException";
208 _exceptionMessage = "minorOffset < 0";
209 goto exit;
210 }
211 _minorRemaining = _env->GetArrayLength(minor_ref) - minorOffset;
212 if (_minorRemaining < 1) {
213 _exception = 1;
214 _exceptionType = "java/lang/IllegalArgumentException";
215 _exceptionMessage = "length - minorOffset < 1 < needed";
216 goto exit;
217 }
218 minor_base = (EGLint *)
219 _env->GetIntArrayElements(minor_ref, (jboolean *)0);
220 minor = minor_base + minorOffset;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700221 }
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700222
223 _returnValue = eglInitialize(
224 (EGLDisplay)dpy_native,
225 (EGLint *)major,
226 (EGLint *)minor
227 );
228
229exit:
230 if (minor_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700231 _env->ReleaseIntArrayElements(minor_ref, (jint*)minor_base,
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700232 _exception ? JNI_ABORT: 0);
233 }
234 if (major_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700235 _env->ReleaseIntArrayElements(major_ref, (jint*)major_base,
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700236 _exception ? JNI_ABORT: 0);
237 }
238 if (_exception) {
239 jniThrowException(_env, _exceptionType, _exceptionMessage);
Orion Hodsonc240f222019-02-26 18:05:03 +0000240 return JNI_FALSE;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700241 }
Andy McFaddencee51982013-04-25 16:08:31 -0700242 return (jboolean)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700243}
244
245/* EGLBoolean eglTerminate ( EGLDisplay dpy ) */
246static jboolean
247android_eglTerminate
248 (JNIEnv *_env, jobject _this, jobject dpy) {
249 EGLBoolean _returnValue = (EGLBoolean) 0;
250 EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
251
252 _returnValue = eglTerminate(
253 (EGLDisplay)dpy_native
254 );
Andy McFaddencee51982013-04-25 16:08:31 -0700255 return (jboolean)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700256}
257
258/* const char * eglQueryString ( EGLDisplay dpy, EGLint name ) */
259static jstring
260android_eglQueryString__Landroind_opengl_EGLDisplay_2I
261 (JNIEnv *_env, jobject _this, jobject dpy, jint name) {
262 const char* chars = (const char*) eglQueryString(
263 (EGLDisplay)fromEGLHandle(_env, egldisplayGetHandleID, dpy),
264 (EGLint)name
265 );
266 return _env->NewStringUTF(chars);
267}
268/* EGLBoolean eglGetConfigs ( EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config ) */
269static jboolean
270android_eglGetConfigs
271 (JNIEnv *_env, jobject _this, jobject dpy, jobjectArray configs_ref, jint configsOffset, jint config_size, jintArray num_config_ref, jint num_configOffset) {
272 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800273 const char * _exceptionType = NULL;
274 const char * _exceptionMessage = NULL;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700275 EGLBoolean _returnValue = (EGLBoolean) 0;
276 EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
277 jint _configsRemaining;
278 EGLConfig *configs = (EGLConfig *) 0;
279 EGLint *num_config_base = (EGLint *) 0;
280 jint _num_configRemaining;
281 EGLint *num_config = (EGLint *) 0;
282
Pablo Ceballos6aff9062015-10-01 18:35:39 -0700283 if (configs_ref) {
284 if (configsOffset < 0) {
285 _exception = 1;
286 _exceptionType = "java/lang/IllegalArgumentException";
287 _exceptionMessage = "configsOffset < 0";
288 goto exit;
289 }
290 _configsRemaining = _env->GetArrayLength(configs_ref) - configsOffset;
291 if (_configsRemaining < config_size) {
292 _exception = 1;
293 _exceptionType = "java/lang/IllegalArgumentException";
294 _exceptionMessage = "length - configsOffset < config_size < needed";
295 goto exit;
296 }
297 configs = new EGLConfig[_configsRemaining];
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700298 }
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700299
300 if (!num_config_ref) {
301 _exception = 1;
302 _exceptionType = "java/lang/IllegalArgumentException";
303 _exceptionMessage = "num_config == null";
304 goto exit;
305 }
306 if (num_configOffset < 0) {
307 _exception = 1;
308 _exceptionType = "java/lang/IllegalArgumentException";
309 _exceptionMessage = "num_configOffset < 0";
310 goto exit;
311 }
312 _num_configRemaining = _env->GetArrayLength(num_config_ref) - num_configOffset;
313 num_config_base = (EGLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700314 _env->GetIntArrayElements(num_config_ref, (jboolean *)0);
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700315 num_config = num_config_base + num_configOffset;
316
317 _returnValue = eglGetConfigs(
318 (EGLDisplay)dpy_native,
319 (EGLConfig *)configs,
320 (EGLint)config_size,
321 (EGLint *)num_config
322 );
323
324exit:
325 if (num_config_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700326 _env->ReleaseIntArrayElements(num_config_ref, (jint*)num_config_base,
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700327 _exception ? JNI_ABORT: 0);
328 }
329 if (configs) {
330 for (int i = 0; i < _configsRemaining; i++) {
331 jobject configs_new = toEGLHandle(_env, eglconfigClass, eglconfigConstructor, configs[i]);
332 _env->SetObjectArrayElement(configs_ref, i + configsOffset, configs_new);
333 }
334 delete[] configs;
335 }
336 if (_exception) {
337 jniThrowException(_env, _exceptionType, _exceptionMessage);
Orion Hodsonc240f222019-02-26 18:05:03 +0000338 return JNI_FALSE;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700339 }
Andy McFaddencee51982013-04-25 16:08:31 -0700340 return (jboolean)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700341}
342
343/* EGLBoolean eglChooseConfig ( EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config ) */
344static jboolean
345android_eglChooseConfig
346 (JNIEnv *_env, jobject _this, jobject dpy, jintArray attrib_list_ref, jint attrib_listOffset, jobjectArray configs_ref, jint configsOffset, jint config_size, jintArray num_config_ref, jint num_configOffset) {
347 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800348 const char * _exceptionType = NULL;
349 const char * _exceptionMessage = NULL;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700350 EGLBoolean _returnValue = (EGLBoolean) 0;
351 EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
352 bool attrib_list_sentinel = false;
353 EGLint *attrib_list_base = (EGLint *) 0;
354 jint _attrib_listRemaining;
355 EGLint *attrib_list = (EGLint *) 0;
356 jint _configsRemaining;
357 EGLConfig *configs = (EGLConfig *) 0;
358 EGLint *num_config_base = (EGLint *) 0;
359 jint _num_configRemaining;
360 EGLint *num_config = (EGLint *) 0;
361
362 if (!attrib_list_ref) {
363 _exception = 1;
364 _exceptionType = "java/lang/IllegalArgumentException";
365 _exceptionMessage = "attrib_list == null";
366 goto exit;
367 }
368 if (attrib_listOffset < 0) {
369 _exception = 1;
370 _exceptionType = "java/lang/IllegalArgumentException";
371 _exceptionMessage = "attrib_listOffset < 0";
372 goto exit;
373 }
374 _attrib_listRemaining = _env->GetArrayLength(attrib_list_ref) - attrib_listOffset;
375 attrib_list_base = (EGLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700376 _env->GetIntArrayElements(attrib_list_ref, (jboolean *)0);
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700377 attrib_list = attrib_list_base + attrib_listOffset;
378 attrib_list_sentinel = false;
379 for (int i = _attrib_listRemaining - 1; i >= 0; i--) {
380 if (attrib_list[i] == EGL_NONE){
381 attrib_list_sentinel = true;
382 break;
383 }
384 }
385 if (attrib_list_sentinel == false) {
386 _exception = 1;
387 _exceptionType = "java/lang/IllegalArgumentException";
388 _exceptionMessage = "attrib_list must contain EGL_NONE!";
389 goto exit;
390 }
391
Pablo Ceballos6aff9062015-10-01 18:35:39 -0700392 if (configs_ref) {
393 if (configsOffset < 0) {
394 _exception = 1;
395 _exceptionType = "java/lang/IllegalArgumentException";
396 _exceptionMessage = "configsOffset < 0";
397 goto exit;
398 }
399 _configsRemaining = _env->GetArrayLength(configs_ref) - configsOffset;
400 if (_configsRemaining < config_size) {
401 _exception = 1;
402 _exceptionType = "java/lang/IllegalArgumentException";
403 _exceptionMessage = "length - configsOffset < config_size < needed";
404 goto exit;
405 }
406 configs = new EGLConfig[_configsRemaining];
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700407 }
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700408
409 if (!num_config_ref) {
410 _exception = 1;
411 _exceptionType = "java/lang/IllegalArgumentException";
412 _exceptionMessage = "num_config == null";
413 goto exit;
414 }
415 if (num_configOffset < 0) {
416 _exception = 1;
417 _exceptionType = "java/lang/IllegalArgumentException";
418 _exceptionMessage = "num_configOffset < 0";
419 goto exit;
420 }
421 _num_configRemaining = _env->GetArrayLength(num_config_ref) - num_configOffset;
422 if (_num_configRemaining < 1) {
423 _exception = 1;
424 _exceptionType = "java/lang/IllegalArgumentException";
425 _exceptionMessage = "length - num_configOffset < 1 < needed";
426 goto exit;
427 }
428 num_config_base = (EGLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700429 _env->GetIntArrayElements(num_config_ref, (jboolean *)0);
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700430 num_config = num_config_base + num_configOffset;
431
432 _returnValue = eglChooseConfig(
433 (EGLDisplay)dpy_native,
434 (EGLint *)attrib_list,
435 (EGLConfig *)configs,
436 (EGLint)config_size,
437 (EGLint *)num_config
438 );
439
440exit:
441 if (num_config_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700442 _env->ReleaseIntArrayElements(num_config_ref, (jint*)num_config_base,
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700443 _exception ? JNI_ABORT: 0);
444 }
445 if (attrib_list_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700446 _env->ReleaseIntArrayElements(attrib_list_ref, (jint*)attrib_list_base,
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700447 JNI_ABORT);
448 }
449 if (configs) {
450 for (int i = 0; i < _configsRemaining; i++) {
451 jobject configs_new = toEGLHandle(_env, eglconfigClass, eglconfigConstructor, configs[i]);
452 _env->SetObjectArrayElement(configs_ref, i + configsOffset, configs_new);
453 }
454 delete[] configs;
455 }
456 if (_exception) {
457 jniThrowException(_env, _exceptionType, _exceptionMessage);
Orion Hodsonc240f222019-02-26 18:05:03 +0000458 return JNI_FALSE;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700459 }
Andy McFaddencee51982013-04-25 16:08:31 -0700460 return (jboolean)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700461}
462
463/* EGLBoolean eglGetConfigAttrib ( EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value ) */
464static jboolean
465android_eglGetConfigAttrib
466 (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jint attribute, jintArray value_ref, jint offset) {
467 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800468 const char * _exceptionType = NULL;
469 const char * _exceptionMessage = NULL;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700470 EGLBoolean _returnValue = (EGLBoolean) 0;
471 EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
472 EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config);
473 EGLint *value_base = (EGLint *) 0;
474 jint _remaining;
475 EGLint *value = (EGLint *) 0;
476
477 if (!value_ref) {
478 _exception = 1;
479 _exceptionType = "java/lang/IllegalArgumentException";
480 _exceptionMessage = "value == null";
481 goto exit;
482 }
483 if (offset < 0) {
484 _exception = 1;
485 _exceptionType = "java/lang/IllegalArgumentException";
486 _exceptionMessage = "offset < 0";
487 goto exit;
488 }
489 _remaining = _env->GetArrayLength(value_ref) - offset;
490 if (_remaining < 1) {
491 _exception = 1;
492 _exceptionType = "java/lang/IllegalArgumentException";
493 _exceptionMessage = "length - offset < 1 < needed";
494 goto exit;
495 }
496 value_base = (EGLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700497 _env->GetIntArrayElements(value_ref, (jboolean *)0);
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700498 value = value_base + offset;
499
500 _returnValue = eglGetConfigAttrib(
501 (EGLDisplay)dpy_native,
502 (EGLConfig)config_native,
503 (EGLint)attribute,
504 (EGLint *)value
505 );
506
507exit:
508 if (value_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700509 _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700510 _exception ? JNI_ABORT: 0);
511 }
512 if (_exception) {
513 jniThrowException(_env, _exceptionType, _exceptionMessage);
Orion Hodsonc240f222019-02-26 18:05:03 +0000514 return JNI_FALSE;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700515 }
Andy McFaddencee51982013-04-25 16:08:31 -0700516 return (jboolean)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700517}
518
519/* EGLSurface eglCreateWindowSurface ( EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list ) */
520static jobject
521android_eglCreateWindowSurface
522 (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jobject win, jintArray attrib_list_ref, jint offset) {
523 jint _exception = 0;
524 const char * _exceptionType = "";
525 const char * _exceptionMessage = "";
526 EGLSurface _returnValue = (EGLSurface) 0;
527 EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
528 EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config);
529 int attrib_list_sentinel = 0;
530 EGLint *attrib_list_base = (EGLint *) 0;
531 jint _remaining;
532 EGLint *attrib_list = (EGLint *) 0;
533 android::sp<ANativeWindow> window;
534
Pablo Ceballos6aff9062015-10-01 18:35:39 -0700535 if (attrib_list_ref) {
536 if (offset < 0) {
537 _exception = 1;
538 _exceptionType = "java/lang/IllegalArgumentException";
539 _exceptionMessage = "offset < 0";
540 goto exit;
541 }
542 _remaining = _env->GetArrayLength(attrib_list_ref) - offset;
543 attrib_list_base = (EGLint *)
544 _env->GetIntArrayElements(attrib_list_ref, (jboolean *)0);
545 attrib_list = attrib_list_base + offset;
546 attrib_list_sentinel = 0;
547 for (int i = _remaining - 1; i >= 0; i--) {
548 if (*((EGLint*)(attrib_list + i)) == EGL_NONE){
549 attrib_list_sentinel = 1;
550 break;
551 }
552 }
553 if (attrib_list_sentinel == 0) {
554 _exception = 1;
555 _exceptionType = "java/lang/IllegalArgumentException";
556 _exceptionMessage = "attrib_list must contain EGL_NONE!";
557 goto exit;
558 }
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700559 }
Pablo Ceballos6aff9062015-10-01 18:35:39 -0700560
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700561 if (win == NULL) {
562not_valid_surface:
563 _exception = 1;
564 _exceptionType = "java/lang/IllegalArgumentException";
565 _exceptionMessage = "Make sure the SurfaceView or associated SurfaceHolder has a valid Surface";
566 goto exit;
567 }
568
Jeff Brown64a55af2012-08-26 02:47:39 -0700569 window = android::android_view_Surface_getNativeWindow(_env, win);
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700570
571 if (window == NULL)
572 goto not_valid_surface;
573
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700574 _returnValue = eglCreateWindowSurface(
575 (EGLDisplay)dpy_native,
576 (EGLConfig)config_native,
577 (EGLNativeWindowType)window.get(),
578 (EGLint *)attrib_list
579 );
580
581exit:
582 if (attrib_list_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700583 _env->ReleaseIntArrayElements(attrib_list_ref, attrib_list_base,
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700584 JNI_ABORT);
585 }
586 if (_exception) {
587 jniThrowException(_env, _exceptionType, _exceptionMessage);
Courtney Goeltzenleuchter9e82c382019-02-11 11:24:58 -0700588 return nullptr;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700589 }
590 return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue);
591}
592
593/* EGLSurface eglCreateWindowSurface ( EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list ) */
594static jobject
595android_eglCreateWindowSurfaceTexture
596 (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jobject win, jintArray attrib_list_ref, jint offset) {
597 jint _exception = 0;
598 const char * _exceptionType = "";
599 const char * _exceptionMessage = "";
600 EGLSurface _returnValue = (EGLSurface) 0;
601 EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
602 EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config);
603 int attrib_list_sentinel = 0;
604 EGLint *attrib_list_base = (EGLint *) 0;
605 jint _remaining;
606 EGLint *attrib_list = (EGLint *) 0;
607 android::sp<ANativeWindow> window;
Mathias Agopian52a9a102013-08-02 01:38:38 -0700608 android::sp<android::IGraphicBufferProducer> producer;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700609
610 if (!attrib_list_ref) {
611 _exception = 1;
612 _exceptionType = "java/lang/IllegalArgumentException";
613 _exceptionMessage = "attrib_list == null";
614 goto exit;
615 }
616 if (offset < 0) {
617 _exception = 1;
618 _exceptionType = "java/lang/IllegalArgumentException";
619 _exceptionMessage = "offset < 0";
620 goto exit;
621 }
622 if (win == NULL) {
623not_valid_surface:
624 _exception = 1;
625 _exceptionType = "java/lang/IllegalArgumentException";
626 _exceptionMessage = "Make sure the SurfaceView or associated SurfaceHolder has a valid Surface";
627 goto exit;
628 }
Mathias Agopian52a9a102013-08-02 01:38:38 -0700629 producer = android::SurfaceTexture_getProducer(_env, win);
Jamie Gennis82bb8132012-12-11 17:00:29 -0800630
Mathias Agopian52a9a102013-08-02 01:38:38 -0700631 if (producer == NULL)
Jamie Gennis82bb8132012-12-11 17:00:29 -0800632 goto not_valid_surface;
633
Takahiro Aizawaf9337372013-12-11 19:22:26 +0900634 window = new android::Surface(producer, true);
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700635
636 if (window == NULL)
637 goto not_valid_surface;
638
639 _remaining = _env->GetArrayLength(attrib_list_ref) - offset;
640 attrib_list_base = (EGLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700641 _env->GetIntArrayElements(attrib_list_ref, (jboolean *)0);
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700642 attrib_list = attrib_list_base + offset;
643 attrib_list_sentinel = 0;
644 for (int i = _remaining - 1; i >= 0; i--) {
645 if (*((EGLint*)(attrib_list + i)) == EGL_NONE){
646 attrib_list_sentinel = 1;
647 break;
648 }
649 }
650 if (attrib_list_sentinel == 0) {
651 _exception = 1;
652 _exceptionType = "java/lang/IllegalArgumentException";
653 _exceptionMessage = "attrib_list must contain EGL_NONE!";
654 goto exit;
655 }
656
657 _returnValue = eglCreateWindowSurface(
658 (EGLDisplay)dpy_native,
659 (EGLConfig)config_native,
660 (EGLNativeWindowType)window.get(),
661 (EGLint *)attrib_list
662 );
663
664exit:
665 if (attrib_list_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700666 _env->ReleaseIntArrayElements(attrib_list_ref, attrib_list_base,
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700667 JNI_ABORT);
668 }
669 if (_exception) {
670 jniThrowException(_env, _exceptionType, _exceptionMessage);
Courtney Goeltzenleuchter9e82c382019-02-11 11:24:58 -0700671 return nullptr;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700672 }
673 return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue);
674}
675/* EGLSurface eglCreatePbufferSurface ( EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list ) */
676static jobject
677android_eglCreatePbufferSurface
678 (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jintArray attrib_list_ref, jint offset) {
679 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800680 const char * _exceptionType = NULL;
681 const char * _exceptionMessage = NULL;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700682 EGLSurface _returnValue = (EGLSurface) 0;
683 EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
684 EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config);
685 bool attrib_list_sentinel = false;
686 EGLint *attrib_list_base = (EGLint *) 0;
687 jint _remaining;
688 EGLint *attrib_list = (EGLint *) 0;
689
Pablo Ceballos6aff9062015-10-01 18:35:39 -0700690 if (attrib_list_ref) {
691 if (offset < 0) {
692 _exception = 1;
693 _exceptionType = "java/lang/IllegalArgumentException";
694 _exceptionMessage = "offset < 0";
695 goto exit;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700696 }
Pablo Ceballos6aff9062015-10-01 18:35:39 -0700697 _remaining = _env->GetArrayLength(attrib_list_ref) - offset;
698 attrib_list_base = (EGLint *)
699 _env->GetIntArrayElements(attrib_list_ref, (jboolean *)0);
700 attrib_list = attrib_list_base + offset;
701 attrib_list_sentinel = false;
702 for (int i = _remaining - 1; i >= 0; i--) {
703 if (attrib_list[i] == EGL_NONE){
704 attrib_list_sentinel = true;
705 break;
706 }
707 }
708 if (attrib_list_sentinel == false) {
709 _exception = 1;
710 _exceptionType = "java/lang/IllegalArgumentException";
711 _exceptionMessage = "attrib_list must contain EGL_NONE!";
712 goto exit;
713 }
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700714 }
715
716 _returnValue = eglCreatePbufferSurface(
717 (EGLDisplay)dpy_native,
718 (EGLConfig)config_native,
719 (EGLint *)attrib_list
720 );
721
722exit:
723 if (attrib_list_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700724 _env->ReleaseIntArrayElements(attrib_list_ref, (jint*)attrib_list_base,
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700725 JNI_ABORT);
726 }
727 if (_exception) {
728 jniThrowException(_env, _exceptionType, _exceptionMessage);
Courtney Goeltzenleuchter9e82c382019-02-11 11:24:58 -0700729 return nullptr;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700730 }
731 return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue);
732}
733
734/* EGLSurface eglCreatePixmapSurface ( EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list ) */
735static jobject
736android_eglCreatePixmapSurface
737 (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jint pixmap, jintArray attrib_list_ref, jint offset) {
738 jniThrowException(_env, "java/lang/UnsupportedOperationException",
739 "eglCreatePixmapSurface");
Courtney Goeltzenleuchter9e82c382019-02-11 11:24:58 -0700740 return nullptr;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700741}
742
743/* EGLBoolean eglDestroySurface ( EGLDisplay dpy, EGLSurface surface ) */
744static jboolean
745android_eglDestroySurface
746 (JNIEnv *_env, jobject _this, jobject dpy, jobject surface) {
747 EGLBoolean _returnValue = (EGLBoolean) 0;
748 EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
749 EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface);
750
751 _returnValue = eglDestroySurface(
752 (EGLDisplay)dpy_native,
753 (EGLSurface)surface_native
754 );
Andy McFaddencee51982013-04-25 16:08:31 -0700755 return (jboolean)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700756}
757
758/* EGLBoolean eglQuerySurface ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value ) */
759static jboolean
760android_eglQuerySurface
761 (JNIEnv *_env, jobject _this, jobject dpy, jobject surface, jint attribute, jintArray value_ref, jint offset) {
762 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800763 const char * _exceptionType = NULL;
764 const char * _exceptionMessage = NULL;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700765 EGLBoolean _returnValue = (EGLBoolean) 0;
766 EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
767 EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface);
768 EGLint *value_base = (EGLint *) 0;
769 jint _remaining;
770 EGLint *value = (EGLint *) 0;
771
772 if (!value_ref) {
773 _exception = 1;
774 _exceptionType = "java/lang/IllegalArgumentException";
775 _exceptionMessage = "value == null";
776 goto exit;
777 }
778 if (offset < 0) {
779 _exception = 1;
780 _exceptionType = "java/lang/IllegalArgumentException";
781 _exceptionMessage = "offset < 0";
782 goto exit;
783 }
784 _remaining = _env->GetArrayLength(value_ref) - offset;
785 if (_remaining < 1) {
786 _exception = 1;
787 _exceptionType = "java/lang/IllegalArgumentException";
788 _exceptionMessage = "length - offset < 1 < needed";
789 goto exit;
790 }
791 value_base = (EGLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700792 _env->GetIntArrayElements(value_ref, (jboolean *)0);
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700793 value = value_base + offset;
794
795 _returnValue = eglQuerySurface(
796 (EGLDisplay)dpy_native,
797 (EGLSurface)surface_native,
798 (EGLint)attribute,
799 (EGLint *)value
800 );
801
802exit:
803 if (value_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700804 _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700805 _exception ? JNI_ABORT: 0);
806 }
807 if (_exception) {
808 jniThrowException(_env, _exceptionType, _exceptionMessage);
Orion Hodsonc240f222019-02-26 18:05:03 +0000809 return JNI_FALSE;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700810 }
Andy McFaddencee51982013-04-25 16:08:31 -0700811 return (jboolean)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700812}
813
814/* EGLBoolean eglBindAPI ( EGLenum api ) */
815static jboolean
816android_eglBindAPI
817 (JNIEnv *_env, jobject _this, jint api) {
818 EGLBoolean _returnValue = (EGLBoolean) 0;
819 _returnValue = eglBindAPI(
820 (EGLenum)api
821 );
Andy McFaddencee51982013-04-25 16:08:31 -0700822 return (jboolean)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700823}
824
825/* EGLenum eglQueryAPI ( void ) */
826static jint
827android_eglQueryAPI
828 (JNIEnv *_env, jobject _this) {
829 EGLenum _returnValue = (EGLenum) 0;
830 _returnValue = eglQueryAPI();
Andy McFaddencee51982013-04-25 16:08:31 -0700831 return (jint)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700832}
833
834/* EGLBoolean eglWaitClient ( void ) */
835static jboolean
836android_eglWaitClient
837 (JNIEnv *_env, jobject _this) {
838 EGLBoolean _returnValue = (EGLBoolean) 0;
839 _returnValue = eglWaitClient();
Andy McFaddencee51982013-04-25 16:08:31 -0700840 return (jboolean)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700841}
842
843/* EGLBoolean eglReleaseThread ( void ) */
844static jboolean
845android_eglReleaseThread
846 (JNIEnv *_env, jobject _this) {
847 EGLBoolean _returnValue = (EGLBoolean) 0;
848 _returnValue = eglReleaseThread();
Andy McFaddencee51982013-04-25 16:08:31 -0700849 return (jboolean)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700850}
851
852/* EGLSurface eglCreatePbufferFromClientBuffer ( EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list ) */
853static jobject
854android_eglCreatePbufferFromClientBuffer
Ashok Bhat84bbeb92014-02-24 10:06:55 +0000855 (JNIEnv *_env, jobject _this, jobject dpy, jint buftype, jlong buffer, jobject config, jintArray attrib_list_ref, jint offset) {
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700856 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800857 const char * _exceptionType = NULL;
858 const char * _exceptionMessage = NULL;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700859 EGLSurface _returnValue = (EGLSurface) 0;
860 EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
861 EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config);
862 bool attrib_list_sentinel = false;
863 EGLint *attrib_list_base = (EGLint *) 0;
864 jint _remaining;
865 EGLint *attrib_list = (EGLint *) 0;
866
Pablo Ceballos6aff9062015-10-01 18:35:39 -0700867 if (attrib_list_ref) {
868 if (offset < 0) {
869 _exception = 1;
870 _exceptionType = "java/lang/IllegalArgumentException";
871 _exceptionMessage = "offset < 0";
872 goto exit;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700873 }
Pablo Ceballos6aff9062015-10-01 18:35:39 -0700874 _remaining = _env->GetArrayLength(attrib_list_ref) - offset;
875 attrib_list_base = (EGLint *)
876 _env->GetIntArrayElements(attrib_list_ref, (jboolean *)0);
877 attrib_list = attrib_list_base + offset;
878 attrib_list_sentinel = false;
879 for (int i = _remaining - 1; i >= 0; i--) {
880 if (attrib_list[i] == EGL_NONE){
881 attrib_list_sentinel = true;
882 break;
883 }
884 }
885 if (attrib_list_sentinel == false) {
886 _exception = 1;
887 _exceptionType = "java/lang/IllegalArgumentException";
888 _exceptionMessage = "attrib_list must contain EGL_NONE!";
889 goto exit;
890 }
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700891 }
892
893 _returnValue = eglCreatePbufferFromClientBuffer(
894 (EGLDisplay)dpy_native,
895 (EGLenum)buftype,
Ashok Bhat84bbeb92014-02-24 10:06:55 +0000896 reinterpret_cast<EGLClientBuffer>(buffer),
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700897 (EGLConfig)config_native,
898 (EGLint *)attrib_list
899 );
900
901exit:
902 if (attrib_list_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700903 _env->ReleaseIntArrayElements(attrib_list_ref, attrib_list_base,
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700904 JNI_ABORT);
905 }
906 if (_exception) {
907 jniThrowException(_env, _exceptionType, _exceptionMessage);
Courtney Goeltzenleuchter9e82c382019-02-11 11:24:58 -0700908 return nullptr;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700909 }
910 return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue);
911}
912
Ashok Bhat84bbeb92014-02-24 10:06:55 +0000913static jobject
914android_eglCreatePbufferFromClientBufferInt
915 (JNIEnv *_env, jobject _this, jobject dpy, jint buftype, jint buffer, jobject config, jintArray attrib_list_ref, jint offset) {
916 if(sizeof(void*) != sizeof(uint32_t)) {
917 jniThrowException(_env, "java/lang/UnsupportedOperationException", "eglCreatePbufferFromClientBuffer");
918 return 0;
919 }
920 return android_eglCreatePbufferFromClientBuffer(_env, _this, dpy, buftype, buffer, config, attrib_list_ref, offset);
921}
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700922/* EGLBoolean eglSurfaceAttrib ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value ) */
923static jboolean
924android_eglSurfaceAttrib
925 (JNIEnv *_env, jobject _this, jobject dpy, jobject surface, jint attribute, jint value) {
926 EGLBoolean _returnValue = (EGLBoolean) 0;
927 EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
928 EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface);
929
930 _returnValue = eglSurfaceAttrib(
931 (EGLDisplay)dpy_native,
932 (EGLSurface)surface_native,
933 (EGLint)attribute,
934 (EGLint)value
935 );
Andy McFaddencee51982013-04-25 16:08:31 -0700936 return (jboolean)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700937}
938
939/* EGLBoolean eglBindTexImage ( EGLDisplay dpy, EGLSurface surface, EGLint buffer ) */
940static jboolean
941android_eglBindTexImage
942 (JNIEnv *_env, jobject _this, jobject dpy, jobject surface, jint buffer) {
943 EGLBoolean _returnValue = (EGLBoolean) 0;
944 EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
945 EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface);
946
947 _returnValue = eglBindTexImage(
948 (EGLDisplay)dpy_native,
949 (EGLSurface)surface_native,
950 (EGLint)buffer
951 );
Andy McFaddencee51982013-04-25 16:08:31 -0700952 return (jboolean)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700953}
954
955/* EGLBoolean eglReleaseTexImage ( EGLDisplay dpy, EGLSurface surface, EGLint buffer ) */
956static jboolean
957android_eglReleaseTexImage
958 (JNIEnv *_env, jobject _this, jobject dpy, jobject surface, jint buffer) {
959 EGLBoolean _returnValue = (EGLBoolean) 0;
960 EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
961 EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface);
962
963 _returnValue = eglReleaseTexImage(
964 (EGLDisplay)dpy_native,
965 (EGLSurface)surface_native,
966 (EGLint)buffer
967 );
Andy McFaddencee51982013-04-25 16:08:31 -0700968 return (jboolean)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700969}
970
971/* EGLBoolean eglSwapInterval ( EGLDisplay dpy, EGLint interval ) */
972static jboolean
973android_eglSwapInterval
974 (JNIEnv *_env, jobject _this, jobject dpy, jint interval) {
975 EGLBoolean _returnValue = (EGLBoolean) 0;
976 EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
977
978 _returnValue = eglSwapInterval(
979 (EGLDisplay)dpy_native,
980 (EGLint)interval
981 );
Andy McFaddencee51982013-04-25 16:08:31 -0700982 return (jboolean)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700983}
984
985/* EGLContext eglCreateContext ( EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list ) */
986static jobject
987android_eglCreateContext
988 (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jobject share_context, jintArray attrib_list_ref, jint offset) {
989 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -0800990 const char * _exceptionType = NULL;
991 const char * _exceptionMessage = NULL;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -0700992 EGLContext _returnValue = (EGLContext) 0;
993 EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
994 EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config);
995 EGLContext share_context_native = (EGLContext) fromEGLHandle(_env, eglcontextGetHandleID, share_context);
996 bool attrib_list_sentinel = false;
997 EGLint *attrib_list_base = (EGLint *) 0;
998 jint _remaining;
999 EGLint *attrib_list = (EGLint *) 0;
1000
1001 if (!attrib_list_ref) {
1002 _exception = 1;
1003 _exceptionType = "java/lang/IllegalArgumentException";
1004 _exceptionMessage = "attrib_list == null";
1005 goto exit;
1006 }
1007 if (offset < 0) {
1008 _exception = 1;
1009 _exceptionType = "java/lang/IllegalArgumentException";
1010 _exceptionMessage = "offset < 0";
1011 goto exit;
1012 }
1013 _remaining = _env->GetArrayLength(attrib_list_ref) - offset;
1014 attrib_list_base = (EGLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001015 _env->GetIntArrayElements(attrib_list_ref, (jboolean *)0);
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -07001016 attrib_list = attrib_list_base + offset;
1017 attrib_list_sentinel = false;
1018 for (int i = _remaining - 1; i >= 0; i--) {
1019 if (attrib_list[i] == EGL_NONE){
1020 attrib_list_sentinel = true;
1021 break;
1022 }
1023 }
1024 if (attrib_list_sentinel == false) {
1025 _exception = 1;
1026 _exceptionType = "java/lang/IllegalArgumentException";
1027 _exceptionMessage = "attrib_list must contain EGL_NONE!";
1028 goto exit;
1029 }
1030
1031 _returnValue = eglCreateContext(
1032 (EGLDisplay)dpy_native,
1033 (EGLConfig)config_native,
1034 (EGLContext)share_context_native,
1035 (EGLint *)attrib_list
1036 );
1037
1038exit:
1039 if (attrib_list_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001040 _env->ReleaseIntArrayElements(attrib_list_ref, (jint*)attrib_list_base,
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -07001041 JNI_ABORT);
1042 }
1043 if (_exception) {
1044 jniThrowException(_env, _exceptionType, _exceptionMessage);
Courtney Goeltzenleuchter9e82c382019-02-11 11:24:58 -07001045 return nullptr;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -07001046 }
1047 return toEGLHandle(_env, eglcontextClass, eglcontextConstructor, _returnValue);
1048}
1049
1050/* EGLBoolean eglDestroyContext ( EGLDisplay dpy, EGLContext ctx ) */
1051static jboolean
1052android_eglDestroyContext
1053 (JNIEnv *_env, jobject _this, jobject dpy, jobject ctx) {
1054 EGLBoolean _returnValue = (EGLBoolean) 0;
1055 EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
1056 EGLContext ctx_native = (EGLContext) fromEGLHandle(_env, eglcontextGetHandleID, ctx);
1057
1058 _returnValue = eglDestroyContext(
1059 (EGLDisplay)dpy_native,
1060 (EGLContext)ctx_native
1061 );
Andy McFaddencee51982013-04-25 16:08:31 -07001062 return (jboolean)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -07001063}
1064
1065/* EGLBoolean eglMakeCurrent ( EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx ) */
1066static jboolean
1067android_eglMakeCurrent
1068 (JNIEnv *_env, jobject _this, jobject dpy, jobject draw, jobject read, jobject ctx) {
1069 EGLBoolean _returnValue = (EGLBoolean) 0;
1070 EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
1071 EGLSurface draw_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, draw);
1072 EGLSurface read_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, read);
1073 EGLContext ctx_native = (EGLContext) fromEGLHandle(_env, eglcontextGetHandleID, ctx);
1074
1075 _returnValue = eglMakeCurrent(
1076 (EGLDisplay)dpy_native,
1077 (EGLSurface)draw_native,
1078 (EGLSurface)read_native,
1079 (EGLContext)ctx_native
1080 );
Andy McFaddencee51982013-04-25 16:08:31 -07001081 return (jboolean)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -07001082}
1083
1084/* EGLContext eglGetCurrentContext ( void ) */
1085static jobject
1086android_eglGetCurrentContext
1087 (JNIEnv *_env, jobject _this) {
1088 EGLContext _returnValue = (EGLContext) 0;
1089 _returnValue = eglGetCurrentContext();
1090 return toEGLHandle(_env, eglcontextClass, eglcontextConstructor, _returnValue);
1091}
1092
1093/* EGLSurface eglGetCurrentSurface ( EGLint readdraw ) */
1094static jobject
1095android_eglGetCurrentSurface
1096 (JNIEnv *_env, jobject _this, jint readdraw) {
1097 EGLSurface _returnValue = (EGLSurface) 0;
1098 _returnValue = eglGetCurrentSurface(
1099 (EGLint)readdraw
1100 );
1101 return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue);
1102}
1103
1104/* EGLDisplay eglGetCurrentDisplay ( void ) */
1105static jobject
1106android_eglGetCurrentDisplay
1107 (JNIEnv *_env, jobject _this) {
1108 EGLDisplay _returnValue = (EGLDisplay) 0;
1109 _returnValue = eglGetCurrentDisplay();
1110 return toEGLHandle(_env, egldisplayClass, egldisplayConstructor, _returnValue);
1111}
1112
1113/* EGLBoolean eglQueryContext ( EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value ) */
1114static jboolean
1115android_eglQueryContext
1116 (JNIEnv *_env, jobject _this, jobject dpy, jobject ctx, jint attribute, jintArray value_ref, jint offset) {
1117 jint _exception = 0;
Mathias Agopian15284de2013-02-23 03:12:30 -08001118 const char * _exceptionType = NULL;
1119 const char * _exceptionMessage = NULL;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -07001120 EGLBoolean _returnValue = (EGLBoolean) 0;
1121 EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
1122 EGLContext ctx_native = (EGLContext) fromEGLHandle(_env, eglcontextGetHandleID, ctx);
1123 EGLint *value_base = (EGLint *) 0;
1124 jint _remaining;
1125 EGLint *value = (EGLint *) 0;
1126
1127 if (!value_ref) {
1128 _exception = 1;
1129 _exceptionType = "java/lang/IllegalArgumentException";
1130 _exceptionMessage = "value == null";
1131 goto exit;
1132 }
1133 if (offset < 0) {
1134 _exception = 1;
1135 _exceptionType = "java/lang/IllegalArgumentException";
1136 _exceptionMessage = "offset < 0";
1137 goto exit;
1138 }
1139 _remaining = _env->GetArrayLength(value_ref) - offset;
1140 if (_remaining < 1) {
1141 _exception = 1;
1142 _exceptionType = "java/lang/IllegalArgumentException";
1143 _exceptionMessage = "length - offset < 1 < needed";
1144 goto exit;
1145 }
1146 value_base = (EGLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001147 _env->GetIntArrayElements(value_ref, (jboolean *)0);
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -07001148 value = value_base + offset;
1149
1150 _returnValue = eglQueryContext(
1151 (EGLDisplay)dpy_native,
1152 (EGLContext)ctx_native,
1153 (EGLint)attribute,
1154 (EGLint *)value
1155 );
1156
1157exit:
1158 if (value_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001159 _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -07001160 _exception ? JNI_ABORT: 0);
1161 }
1162 if (_exception) {
1163 jniThrowException(_env, _exceptionType, _exceptionMessage);
Orion Hodsonc240f222019-02-26 18:05:03 +00001164 return JNI_FALSE;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -07001165 }
Andy McFaddencee51982013-04-25 16:08:31 -07001166 return (jboolean)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -07001167}
1168
1169/* EGLBoolean eglWaitGL ( void ) */
1170static jboolean
1171android_eglWaitGL
1172 (JNIEnv *_env, jobject _this) {
1173 EGLBoolean _returnValue = (EGLBoolean) 0;
1174 _returnValue = eglWaitGL();
Andy McFaddencee51982013-04-25 16:08:31 -07001175 return (jboolean)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -07001176}
1177
1178/* EGLBoolean eglWaitNative ( EGLint engine ) */
1179static jboolean
1180android_eglWaitNative
1181 (JNIEnv *_env, jobject _this, jint engine) {
1182 EGLBoolean _returnValue = (EGLBoolean) 0;
1183 _returnValue = eglWaitNative(
1184 (EGLint)engine
1185 );
Andy McFaddencee51982013-04-25 16:08:31 -07001186 return (jboolean)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -07001187}
1188
1189/* EGLBoolean eglSwapBuffers ( EGLDisplay dpy, EGLSurface surface ) */
1190static jboolean
1191android_eglSwapBuffers
1192 (JNIEnv *_env, jobject _this, jobject dpy, jobject surface) {
1193 EGLBoolean _returnValue = (EGLBoolean) 0;
1194 EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
1195 EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface);
1196
1197 _returnValue = eglSwapBuffers(
1198 (EGLDisplay)dpy_native,
1199 (EGLSurface)surface_native
1200 );
Andy McFaddencee51982013-04-25 16:08:31 -07001201 return (jboolean)_returnValue;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -07001202}
1203
1204/* EGLBoolean eglCopyBuffers ( EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target ) */
1205static jboolean
1206android_eglCopyBuffers
1207 (JNIEnv *_env, jobject _this, jobject dpy, jobject surface, jint target) {
1208 jniThrowException(_env, "java/lang/UnsupportedOperationException",
1209 "eglCopyBuffers");
Orion Hodsonc240f222019-02-26 18:05:03 +00001210 return JNI_FALSE;
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -07001211}
1212
1213static const char *classPathName = "android/opengl/EGL14";
1214
Daniel Micay76f6a862015-09-19 17:31:01 -04001215static const JNINativeMethod methods[] = {
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -07001216{"_nativeClassInit", "()V", (void*)nativeClassInit },
1217{"eglGetError", "()I", (void *) android_eglGetError },
Ashok Bhat84bbeb92014-02-24 10:06:55 +00001218{"eglGetDisplay", "(I)Landroid/opengl/EGLDisplay;", (void *) android_eglGetDisplayInt },
1219{"eglGetDisplay", "(J)Landroid/opengl/EGLDisplay;", (void *) android_eglGetDisplay },
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -07001220{"eglInitialize", "(Landroid/opengl/EGLDisplay;[II[II)Z", (void *) android_eglInitialize },
1221{"eglTerminate", "(Landroid/opengl/EGLDisplay;)Z", (void *) android_eglTerminate },
1222{"eglQueryString", "(Landroid/opengl/EGLDisplay;I)Ljava/lang/String;", (void *) android_eglQueryString__Landroind_opengl_EGLDisplay_2I },
1223{"eglGetConfigs", "(Landroid/opengl/EGLDisplay;[Landroid/opengl/EGLConfig;II[II)Z", (void *) android_eglGetConfigs },
1224{"eglChooseConfig", "(Landroid/opengl/EGLDisplay;[II[Landroid/opengl/EGLConfig;II[II)Z", (void *) android_eglChooseConfig },
1225{"eglGetConfigAttrib", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;I[II)Z", (void *) android_eglGetConfigAttrib },
1226{"_eglCreateWindowSurface", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;Ljava/lang/Object;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreateWindowSurface },
1227{"_eglCreateWindowSurfaceTexture", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;Ljava/lang/Object;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreateWindowSurfaceTexture },
1228{"eglCreatePbufferSurface", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreatePbufferSurface },
1229{"eglCreatePixmapSurface", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;I[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreatePixmapSurface },
1230{"eglDestroySurface", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;)Z", (void *) android_eglDestroySurface },
1231{"eglQuerySurface", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;I[II)Z", (void *) android_eglQuerySurface },
1232{"eglBindAPI", "(I)Z", (void *) android_eglBindAPI },
1233{"eglQueryAPI", "()I", (void *) android_eglQueryAPI },
1234{"eglWaitClient", "()Z", (void *) android_eglWaitClient },
1235{"eglReleaseThread", "()Z", (void *) android_eglReleaseThread },
Ashok Bhat84bbeb92014-02-24 10:06:55 +00001236{"eglCreatePbufferFromClientBuffer", "(Landroid/opengl/EGLDisplay;IILandroid/opengl/EGLConfig;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreatePbufferFromClientBufferInt },
1237{"eglCreatePbufferFromClientBuffer", "(Landroid/opengl/EGLDisplay;IJLandroid/opengl/EGLConfig;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreatePbufferFromClientBuffer },
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -07001238{"eglSurfaceAttrib", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;II)Z", (void *) android_eglSurfaceAttrib },
1239{"eglBindTexImage", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;I)Z", (void *) android_eglBindTexImage },
1240{"eglReleaseTexImage", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;I)Z", (void *) android_eglReleaseTexImage },
1241{"eglSwapInterval", "(Landroid/opengl/EGLDisplay;I)Z", (void *) android_eglSwapInterval },
1242{"eglCreateContext", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;Landroid/opengl/EGLContext;[II)Landroid/opengl/EGLContext;", (void *) android_eglCreateContext },
1243{"eglDestroyContext", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLContext;)Z", (void *) android_eglDestroyContext },
1244{"eglMakeCurrent", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;Landroid/opengl/EGLSurface;Landroid/opengl/EGLContext;)Z", (void *) android_eglMakeCurrent },
1245{"eglGetCurrentContext", "()Landroid/opengl/EGLContext;", (void *) android_eglGetCurrentContext },
1246{"eglGetCurrentSurface", "(I)Landroid/opengl/EGLSurface;", (void *) android_eglGetCurrentSurface },
1247{"eglGetCurrentDisplay", "()Landroid/opengl/EGLDisplay;", (void *) android_eglGetCurrentDisplay },
1248{"eglQueryContext", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLContext;I[II)Z", (void *) android_eglQueryContext },
1249{"eglWaitGL", "()Z", (void *) android_eglWaitGL },
1250{"eglWaitNative", "(I)Z", (void *) android_eglWaitNative },
1251{"eglSwapBuffers", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;)Z", (void *) android_eglSwapBuffers },
1252{"eglCopyBuffers", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;I)Z", (void *) android_eglCopyBuffers },
Thomas Tafertshofer6b1e8382012-07-03 13:37:35 -07001253};
1254
1255int register_android_opengl_jni_EGL14(JNIEnv *_env)
1256{
1257 int err;
1258 err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
1259 return err;
1260}