16b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* 26b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer** Copyright 2012, The Android Open Source Project 36b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer** 46b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer** Licensed under the Apache License, Version 2.0 (the "License"); 56b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer** you may not use this file except in compliance with the License. 66b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer** You may obtain a copy of the License at 76b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer** 86b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer** http://www.apache.org/licenses/LICENSE-2.0 96b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer** 106b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer** Unless required by applicable law or agreed to in writing, software 116b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer** distributed under the License is distributed on an "AS IS" BASIS, 126b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 136b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer** See the License for the specific language governing permissions and 146b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer** limitations under the License. 156b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer*/ 166b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 176b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer// This source file is automatically generated 186b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 196b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer#include "jni.h" 206b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer#include "JNIHelp.h" 216b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer#include <android_runtime/AndroidRuntime.h> 226b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer#include <android_runtime/android_view_Surface.h> 236b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer#include <android_runtime/android_graphics_SurfaceTexture.h> 246b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer#include <utils/misc.h> 256b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 266b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer#include <assert.h> 276b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer#include <EGL/egl.h> 286b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 296b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer#include <gui/Surface.h> 30d47f7d8b5fe3a3861d7cbdc5f912235407823c8eAndy McFadden#include <gui/GLConsumer.h> 3152800617946c456e78ed010c82d0ec4358368164Mathias Agopian#include <gui/Surface.h> 326b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 336b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer#include <ui/ANativeObjectBase.h> 346b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 356b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic int initialized = 0; 366b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 376b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jclass egldisplayClass; 386b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jclass eglcontextClass; 396b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jclass eglsurfaceClass; 406b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jclass eglconfigClass; 416b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 426b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jmethodID egldisplayGetHandleID; 436b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jmethodID eglcontextGetHandleID; 446b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jmethodID eglsurfaceGetHandleID; 456b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jmethodID eglconfigGetHandleID; 466b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 476b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jmethodID egldisplayConstructor; 486b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jmethodID eglcontextConstructor; 496b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jmethodID eglsurfaceConstructor; 506b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jmethodID eglconfigConstructor; 516b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 526b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jobject eglNoContextObject; 536b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jobject eglNoDisplayObject; 546b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jobject eglNoSurfaceObject; 556b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 566b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 576b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 586b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* Cache method IDs each time the class is loaded. */ 596b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 606b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic void 616b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas TafertshofernativeClassInit(JNIEnv *_env, jclass glImplClass) 626b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{ 636b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jclass egldisplayClassLocal = _env->FindClass("android/opengl/EGLDisplay"); 646b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer egldisplayClass = (jclass) _env->NewGlobalRef(egldisplayClassLocal); 656b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jclass eglcontextClassLocal = _env->FindClass("android/opengl/EGLContext"); 666b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer eglcontextClass = (jclass) _env->NewGlobalRef(eglcontextClassLocal); 676b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jclass eglsurfaceClassLocal = _env->FindClass("android/opengl/EGLSurface"); 686b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer eglsurfaceClass = (jclass) _env->NewGlobalRef(eglsurfaceClassLocal); 696b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jclass eglconfigClassLocal = _env->FindClass("android/opengl/EGLConfig"); 706b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer eglconfigClass = (jclass) _env->NewGlobalRef(eglconfigClassLocal); 716b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 7284bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat egldisplayGetHandleID = _env->GetMethodID(egldisplayClass, "getNativeHandle", "()J"); 7384bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat eglcontextGetHandleID = _env->GetMethodID(eglcontextClass, "getNativeHandle", "()J"); 7484bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat eglsurfaceGetHandleID = _env->GetMethodID(eglsurfaceClass, "getNativeHandle", "()J"); 7584bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat eglconfigGetHandleID = _env->GetMethodID(eglconfigClass, "getNativeHandle", "()J"); 766b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 776b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 7884bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat egldisplayConstructor = _env->GetMethodID(egldisplayClass, "<init>", "(J)V"); 7984bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat eglcontextConstructor = _env->GetMethodID(eglcontextClass, "<init>", "(J)V"); 8084bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat eglsurfaceConstructor = _env->GetMethodID(eglsurfaceClass, "<init>", "(J)V"); 8184bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat eglconfigConstructor = _env->GetMethodID(eglconfigClass, "<init>", "(J)V"); 826b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 8384bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat jobject localeglNoContextObject = _env->NewObject(eglcontextClass, eglcontextConstructor, reinterpret_cast<jlong>(EGL_NO_CONTEXT)); 846b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer eglNoContextObject = _env->NewGlobalRef(localeglNoContextObject); 8584bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat jobject localeglNoDisplayObject = _env->NewObject(egldisplayClass, egldisplayConstructor, reinterpret_cast<jlong>(EGL_NO_DISPLAY)); 866b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer eglNoDisplayObject = _env->NewGlobalRef(localeglNoDisplayObject); 8784bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat jobject localeglNoSurfaceObject = _env->NewObject(eglsurfaceClass, eglsurfaceConstructor, reinterpret_cast<jlong>(EGL_NO_SURFACE)); 886b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer eglNoSurfaceObject = _env->NewGlobalRef(localeglNoSurfaceObject); 896b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 906b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 916b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jclass eglClass = _env->FindClass("android/opengl/EGL14"); 926b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jfieldID noContextFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_CONTEXT", "Landroid/opengl/EGLContext;"); 936b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->SetStaticObjectField(eglClass, noContextFieldID, eglNoContextObject); 946b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 956b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jfieldID noDisplayFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_DISPLAY", "Landroid/opengl/EGLDisplay;"); 966b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->SetStaticObjectField(eglClass, noDisplayFieldID, eglNoDisplayObject); 976b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 986b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jfieldID noSurfaceFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_SURFACE", "Landroid/opengl/EGLSurface;"); 996b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->SetStaticObjectField(eglClass, noSurfaceFieldID, eglNoSurfaceObject); 1006b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 1016b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 1026b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic void * 1036b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas TafertshoferfromEGLHandle(JNIEnv *_env, jmethodID mid, jobject obj) { 1046b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (obj == NULL){ 1056b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jniThrowException(_env, "java/lang/IllegalArgumentException", 1066b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer "Object is set to null."); 1076b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 1086b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 10984bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat jlong handle = _env->CallLongMethod(obj, mid); 11084bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat return reinterpret_cast<void*>(handle); 1116b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 1126b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 1136b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jobject 1146b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas TafertshofertoEGLHandle(JNIEnv *_env, jclass cls, jmethodID con, void * handle) { 1156b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (cls == eglcontextClass && 1166b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLContext)handle == EGL_NO_CONTEXT) { 1176b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer return eglNoContextObject; 1186b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 1196b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 1206b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (cls == egldisplayClass && 1216b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)handle == EGL_NO_DISPLAY) { 1226b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer return eglNoDisplayObject; 1236b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 1246b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 1256b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (cls == eglsurfaceClass && 1266b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLSurface)handle == EGL_NO_SURFACE) { 1276b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer return eglNoSurfaceObject; 1286b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 1296b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 13084bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat return _env->NewObject(cls, con, reinterpret_cast<jlong>(handle)); 1316b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 1326b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 1336b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer// -------------------------------------------------------------------------- 1346b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLint eglGetError ( void ) */ 1356b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jint 1366b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglGetError 1376b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this) { 1386b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint _returnValue = (EGLint) 0; 1396b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglGetError(); 140cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jint)_returnValue; 1416b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 1426b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 1436b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLDisplay eglGetDisplay ( EGLNativeDisplayType display_id ) */ 1446b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jobject 1456b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglGetDisplay 14684bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat (JNIEnv *_env, jobject _this, jlong display_id) { 1476b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay _returnValue = (EGLDisplay) 0; 1486b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglGetDisplay( 14984bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat reinterpret_cast<EGLNativeDisplayType>(display_id) 1506b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 1516b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer return toEGLHandle(_env, egldisplayClass, egldisplayConstructor, _returnValue); 1526b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 1536b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 15484bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat/* EGLDisplay eglGetDisplay ( EGLNativeDisplayType display_id ) */ 15584bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhatstatic jobject 15684bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhatandroid_eglGetDisplayInt 15784bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat (JNIEnv *_env, jobject _this, jint display_id) { 15884bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat 15964d38d9f4863f6e9434e6820b924eb958e8a2230Ashok Bhat if ((EGLNativeDisplayType)display_id != EGL_DEFAULT_DISPLAY) { 16084bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat jniThrowException(_env, "java/lang/UnsupportedOperationException", "eglGetDisplay"); 16184bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat return 0; 16284bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat } 16384bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat return android_eglGetDisplay(_env, _this, display_id); 16484bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat} 16584bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat 1666b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglInitialize ( EGLDisplay dpy, EGLint *major, EGLint *minor ) */ 1676b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 1686b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglInitialize 1696b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy, jintArray major_ref, jint majorOffset, jintArray minor_ref, jint minorOffset) { 1706b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _exception = 0; 17115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian const char * _exceptionType = NULL; 17215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian const char * _exceptionMessage = NULL; 1736b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLBoolean _returnValue = (EGLBoolean) 0; 1746b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); 1756b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *major_base = (EGLint *) 0; 1766b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _majorRemaining; 1776b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *major = (EGLint *) 0; 1786b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *minor_base = (EGLint *) 0; 1796b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _minorRemaining; 1806b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *minor = (EGLint *) 0; 1816b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 1826b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (!major_ref) { 1836b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 1846b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 1856b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "major == null"; 1866b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 1876b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 1886b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (majorOffset < 0) { 1896b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 1906b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 1916b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "majorOffset < 0"; 1926b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 1936b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 1946b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _majorRemaining = _env->GetArrayLength(major_ref) - majorOffset; 1956b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (_majorRemaining < 1) { 1966b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 1976b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 1986b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "length - majorOffset < 1 < needed"; 1996b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 2006b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 2016b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer major_base = (EGLint *) 2026b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->GetPrimitiveArrayCritical(major_ref, (jboolean *)0); 2036b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer major = major_base + majorOffset; 2046b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 2056b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (!minor_ref) { 2066b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 2076b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 2086b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "minor == null"; 2096b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 2106b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 2116b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (minorOffset < 0) { 2126b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 2136b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 2146b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "minorOffset < 0"; 2156b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 2166b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 2176b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _minorRemaining = _env->GetArrayLength(minor_ref) - minorOffset; 2186b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (_minorRemaining < 1) { 2196b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 2206b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 2216b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "length - minorOffset < 1 < needed"; 2226b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 2236b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 2246b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer minor_base = (EGLint *) 2256b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->GetPrimitiveArrayCritical(minor_ref, (jboolean *)0); 2266b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer minor = minor_base + minorOffset; 2276b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 2286b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglInitialize( 2296b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)dpy_native, 2306b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint *)major, 2316b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint *)minor 2326b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 2336b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 2346b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferexit: 2356b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (minor_base) { 2366b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->ReleasePrimitiveArrayCritical(minor_ref, minor_base, 2376b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception ? JNI_ABORT: 0); 2386b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 2396b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (major_base) { 2406b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->ReleasePrimitiveArrayCritical(major_ref, major_base, 2416b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception ? JNI_ABORT: 0); 2426b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 2436b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (_exception) { 2446b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jniThrowException(_env, _exceptionType, _exceptionMessage); 2456b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 246cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jboolean)_returnValue; 2476b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 2486b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 2496b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglTerminate ( EGLDisplay dpy ) */ 2506b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 2516b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglTerminate 2526b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy) { 2536b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLBoolean _returnValue = (EGLBoolean) 0; 2546b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); 2556b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 2566b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglTerminate( 2576b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)dpy_native 2586b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 259cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jboolean)_returnValue; 2606b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 2616b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 2626b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* const char * eglQueryString ( EGLDisplay dpy, EGLint name ) */ 2636b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jstring 2646b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglQueryString__Landroind_opengl_EGLDisplay_2I 2656b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy, jint name) { 2666b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer const char* chars = (const char*) eglQueryString( 2676b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)fromEGLHandle(_env, egldisplayGetHandleID, dpy), 2686b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint)name 2696b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 2706b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer return _env->NewStringUTF(chars); 2716b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 2726b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglGetConfigs ( EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config ) */ 2736b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 2746b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglGetConfigs 2756b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy, jobjectArray configs_ref, jint configsOffset, jint config_size, jintArray num_config_ref, jint num_configOffset) { 2766b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _exception = 0; 27715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian const char * _exceptionType = NULL; 27815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian const char * _exceptionMessage = NULL; 2796b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLBoolean _returnValue = (EGLBoolean) 0; 2806b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); 2816b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _configsRemaining; 2826b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLConfig *configs = (EGLConfig *) 0; 2836b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *num_config_base = (EGLint *) 0; 2846b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _num_configRemaining; 2856b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *num_config = (EGLint *) 0; 2866b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 2876b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (!configs_ref) { 2886b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 2896b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 2906b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "configs == null"; 2916b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 2926b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 2936b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (configsOffset < 0) { 2946b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 2956b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 2966b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "configsOffset < 0"; 2976b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 2986b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 2996b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _configsRemaining = _env->GetArrayLength(configs_ref) - configsOffset; 3006b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (_configsRemaining < config_size) { 3016b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 3026b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 3036b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "length - configsOffset < config_size < needed"; 3046b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 3056b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 3066b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer configs = new EGLConfig[_configsRemaining]; 3076b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 3086b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (!num_config_ref) { 3096b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 3106b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 3116b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "num_config == null"; 3126b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 3136b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 3146b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (num_configOffset < 0) { 3156b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 3166b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 3176b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "num_configOffset < 0"; 3186b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 3196b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 3206b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _num_configRemaining = _env->GetArrayLength(num_config_ref) - num_configOffset; 3216b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer num_config_base = (EGLint *) 3226b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->GetPrimitiveArrayCritical(num_config_ref, (jboolean *)0); 3236b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer num_config = num_config_base + num_configOffset; 3246b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 3256b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglGetConfigs( 3266b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)dpy_native, 3276b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLConfig *)configs, 3286b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint)config_size, 3296b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint *)num_config 3306b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 3316b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 3326b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferexit: 3336b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (num_config_base) { 3346b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->ReleasePrimitiveArrayCritical(num_config_ref, num_config_base, 3356b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception ? JNI_ABORT: 0); 3366b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 3376b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (configs) { 3386b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer for (int i = 0; i < _configsRemaining; i++) { 3396b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jobject configs_new = toEGLHandle(_env, eglconfigClass, eglconfigConstructor, configs[i]); 3406b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->SetObjectArrayElement(configs_ref, i + configsOffset, configs_new); 3416b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 3426b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer delete[] configs; 3436b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 3446b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (_exception) { 3456b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jniThrowException(_env, _exceptionType, _exceptionMessage); 3466b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 347cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jboolean)_returnValue; 3486b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 3496b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 3506b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglChooseConfig ( EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config ) */ 3516b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 3526b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglChooseConfig 3536b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (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) { 3546b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _exception = 0; 35515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian const char * _exceptionType = NULL; 35615284dee8efe6b4d1441ab040962077614b5061aMathias Agopian const char * _exceptionMessage = NULL; 3576b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLBoolean _returnValue = (EGLBoolean) 0; 3586b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); 3596b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer bool attrib_list_sentinel = false; 3606b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *attrib_list_base = (EGLint *) 0; 3616b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _attrib_listRemaining; 3626b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *attrib_list = (EGLint *) 0; 3636b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _configsRemaining; 3646b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLConfig *configs = (EGLConfig *) 0; 3656b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *num_config_base = (EGLint *) 0; 3666b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _num_configRemaining; 3676b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *num_config = (EGLint *) 0; 3686b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 3696b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (!attrib_list_ref) { 3706b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 3716b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 3726b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "attrib_list == null"; 3736b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 3746b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 3756b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (attrib_listOffset < 0) { 3766b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 3776b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 3786b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "attrib_listOffset < 0"; 3796b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 3806b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 3816b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _attrib_listRemaining = _env->GetArrayLength(attrib_list_ref) - attrib_listOffset; 3826b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list_base = (EGLint *) 3836b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0); 3846b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list = attrib_list_base + attrib_listOffset; 3856b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list_sentinel = false; 3866b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer for (int i = _attrib_listRemaining - 1; i >= 0; i--) { 3876b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (attrib_list[i] == EGL_NONE){ 3886b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list_sentinel = true; 3896b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer break; 3906b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 3916b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 3926b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (attrib_list_sentinel == false) { 3936b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 3946b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 3956b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "attrib_list must contain EGL_NONE!"; 3966b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 3976b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 3986b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 3996b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (!configs_ref) { 4006b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 4016b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 4026b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "configs == null"; 4036b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 4046b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 4056b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (configsOffset < 0) { 4066b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 4076b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 4086b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "configsOffset < 0"; 4096b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 4106b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 4116b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _configsRemaining = _env->GetArrayLength(configs_ref) - configsOffset; 4126b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (_configsRemaining < config_size) { 4136b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 4146b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 4156b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "length - configsOffset < config_size < needed"; 4166b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 4176b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 4186b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer configs = new EGLConfig[_configsRemaining]; 4196b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 4206b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (!num_config_ref) { 4216b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 4226b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 4236b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "num_config == null"; 4246b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 4256b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 4266b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (num_configOffset < 0) { 4276b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 4286b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 4296b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "num_configOffset < 0"; 4306b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 4316b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 4326b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _num_configRemaining = _env->GetArrayLength(num_config_ref) - num_configOffset; 4336b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (_num_configRemaining < 1) { 4346b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 4356b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 4366b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "length - num_configOffset < 1 < needed"; 4376b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 4386b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 4396b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer num_config_base = (EGLint *) 4406b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->GetPrimitiveArrayCritical(num_config_ref, (jboolean *)0); 4416b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer num_config = num_config_base + num_configOffset; 4426b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 4436b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglChooseConfig( 4446b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)dpy_native, 4456b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint *)attrib_list, 4466b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLConfig *)configs, 4476b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint)config_size, 4486b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint *)num_config 4496b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 4506b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 4516b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferexit: 4526b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (num_config_base) { 4536b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->ReleasePrimitiveArrayCritical(num_config_ref, num_config_base, 4546b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception ? JNI_ABORT: 0); 4556b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 4566b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (attrib_list_base) { 4576b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base, 4586b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer JNI_ABORT); 4596b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 4606b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (configs) { 4616b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer for (int i = 0; i < _configsRemaining; i++) { 4626b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jobject configs_new = toEGLHandle(_env, eglconfigClass, eglconfigConstructor, configs[i]); 4636b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->SetObjectArrayElement(configs_ref, i + configsOffset, configs_new); 4646b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 4656b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer delete[] configs; 4666b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 4676b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (_exception) { 4686b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jniThrowException(_env, _exceptionType, _exceptionMessage); 4696b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 470cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jboolean)_returnValue; 4716b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 4726b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 4736b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglGetConfigAttrib ( EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value ) */ 4746b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 4756b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglGetConfigAttrib 4766b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jint attribute, jintArray value_ref, jint offset) { 4776b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _exception = 0; 47815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian const char * _exceptionType = NULL; 47915284dee8efe6b4d1441ab040962077614b5061aMathias Agopian const char * _exceptionMessage = NULL; 4806b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLBoolean _returnValue = (EGLBoolean) 0; 4816b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); 4826b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config); 4836b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *value_base = (EGLint *) 0; 4846b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _remaining; 4856b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *value = (EGLint *) 0; 4866b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 4876b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (!value_ref) { 4886b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 4896b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 4906b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "value == null"; 4916b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 4926b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 4936b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (offset < 0) { 4946b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 4956b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 4966b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "offset < 0"; 4976b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 4986b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 4996b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _remaining = _env->GetArrayLength(value_ref) - offset; 5006b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (_remaining < 1) { 5016b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 5026b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 5036b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "length - offset < 1 < needed"; 5046b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 5056b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 5066b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer value_base = (EGLint *) 5076b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0); 5086b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer value = value_base + offset; 5096b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 5106b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglGetConfigAttrib( 5116b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)dpy_native, 5126b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLConfig)config_native, 5136b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint)attribute, 5146b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint *)value 5156b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 5166b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 5176b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferexit: 5186b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (value_base) { 5196b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->ReleasePrimitiveArrayCritical(value_ref, value_base, 5206b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception ? JNI_ABORT: 0); 5216b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 5226b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (_exception) { 5236b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jniThrowException(_env, _exceptionType, _exceptionMessage); 5246b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 525cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jboolean)_returnValue; 5266b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 5276b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 5286b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLSurface eglCreateWindowSurface ( EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list ) */ 5296b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jobject 5306b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglCreateWindowSurface 5316b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jobject win, jintArray attrib_list_ref, jint offset) { 5326b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _exception = 0; 5336b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer const char * _exceptionType = ""; 5346b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer const char * _exceptionMessage = ""; 5356b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLSurface _returnValue = (EGLSurface) 0; 5366b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); 5376b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config); 5386b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer int attrib_list_sentinel = 0; 5396b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *attrib_list_base = (EGLint *) 0; 5406b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _remaining; 5416b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *attrib_list = (EGLint *) 0; 5426b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer android::sp<ANativeWindow> window; 5436b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 5446b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (!attrib_list_ref) { 5456b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 5466b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 5476b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "attrib_list == null"; 5486b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 5496b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 5506b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (offset < 0) { 5516b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 5526b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 5536b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "offset < 0"; 5546b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 5556b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 5566b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (win == NULL) { 5576b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofernot_valid_surface: 5586b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 5596b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 5606b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "Make sure the SurfaceView or associated SurfaceHolder has a valid Surface"; 5616b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 5626b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 5636b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 56464a55af0ac700baecb0877235eb42caac59a3560Jeff Brown window = android::android_view_Surface_getNativeWindow(_env, win); 5656b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 5666b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (window == NULL) 5676b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto not_valid_surface; 5686b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 5696b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _remaining = _env->GetArrayLength(attrib_list_ref) - offset; 5706b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list_base = (EGLint *) 5716b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0); 5726b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list = attrib_list_base + offset; 5736b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list_sentinel = 0; 5746b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer for (int i = _remaining - 1; i >= 0; i--) { 5756b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (*((EGLint*)(attrib_list + i)) == EGL_NONE){ 5766b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list_sentinel = 1; 5776b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer break; 5786b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 5796b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 5806b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (attrib_list_sentinel == 0) { 5816b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 5826b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 5836b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "attrib_list must contain EGL_NONE!"; 5846b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 5856b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 5866b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 5876b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglCreateWindowSurface( 5886b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)dpy_native, 5896b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLConfig)config_native, 5906b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLNativeWindowType)window.get(), 5916b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint *)attrib_list 5926b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 5936b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 5946b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferexit: 5956b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (attrib_list_base) { 5966b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base, 5976b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer JNI_ABORT); 5986b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 5996b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (_exception) { 6006b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jniThrowException(_env, _exceptionType, _exceptionMessage); 6016b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 6026b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue); 6036b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 6046b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 6056b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLSurface eglCreateWindowSurface ( EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list ) */ 6066b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jobject 6076b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglCreateWindowSurfaceTexture 6086b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jobject win, jintArray attrib_list_ref, jint offset) { 6096b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _exception = 0; 6106b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer const char * _exceptionType = ""; 6116b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer const char * _exceptionMessage = ""; 6126b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLSurface _returnValue = (EGLSurface) 0; 6136b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); 6146b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config); 6156b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer int attrib_list_sentinel = 0; 6166b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *attrib_list_base = (EGLint *) 0; 6176b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _remaining; 6186b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *attrib_list = (EGLint *) 0; 6196b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer android::sp<ANativeWindow> window; 62052a9a10b6b8c7b7a9f97777541841b94d4fd9754Mathias Agopian android::sp<android::IGraphicBufferProducer> producer; 6216b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 6226b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (!attrib_list_ref) { 6236b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 6246b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 6256b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "attrib_list == null"; 6266b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 6276b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 6286b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (offset < 0) { 6296b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 6306b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 6316b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "offset < 0"; 6326b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 6336b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 6346b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (win == NULL) { 6356b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofernot_valid_surface: 6366b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 6376b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 6386b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "Make sure the SurfaceView or associated SurfaceHolder has a valid Surface"; 6396b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 6406b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 64152a9a10b6b8c7b7a9f97777541841b94d4fd9754Mathias Agopian producer = android::SurfaceTexture_getProducer(_env, win); 64282bb813f112d9565faa990e32dbe833f96461892Jamie Gennis 64352a9a10b6b8c7b7a9f97777541841b94d4fd9754Mathias Agopian if (producer == NULL) 64482bb813f112d9565faa990e32dbe833f96461892Jamie Gennis goto not_valid_surface; 64582bb813f112d9565faa990e32dbe833f96461892Jamie Gennis 646f933737784bea4e27b70522cfd34ddaa45481d12Takahiro Aizawa window = new android::Surface(producer, true); 6476b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 6486b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (window == NULL) 6496b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto not_valid_surface; 6506b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 6516b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _remaining = _env->GetArrayLength(attrib_list_ref) - offset; 6526b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list_base = (EGLint *) 6536b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0); 6546b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list = attrib_list_base + offset; 6556b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list_sentinel = 0; 6566b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer for (int i = _remaining - 1; i >= 0; i--) { 6576b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (*((EGLint*)(attrib_list + i)) == EGL_NONE){ 6586b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list_sentinel = 1; 6596b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer break; 6606b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 6616b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 6626b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (attrib_list_sentinel == 0) { 6636b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 6646b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 6656b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "attrib_list must contain EGL_NONE!"; 6666b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 6676b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 6686b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 6696b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglCreateWindowSurface( 6706b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)dpy_native, 6716b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLConfig)config_native, 6726b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLNativeWindowType)window.get(), 6736b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint *)attrib_list 6746b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 6756b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 6766b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferexit: 6776b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (attrib_list_base) { 6786b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base, 6796b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer JNI_ABORT); 6806b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 6816b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (_exception) { 6826b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jniThrowException(_env, _exceptionType, _exceptionMessage); 6836b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 6846b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue); 6856b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 6866b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLSurface eglCreatePbufferSurface ( EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list ) */ 6876b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jobject 6886b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglCreatePbufferSurface 6896b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jintArray attrib_list_ref, jint offset) { 6906b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _exception = 0; 69115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian const char * _exceptionType = NULL; 69215284dee8efe6b4d1441ab040962077614b5061aMathias Agopian const char * _exceptionMessage = NULL; 6936b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLSurface _returnValue = (EGLSurface) 0; 6946b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); 6956b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config); 6966b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer bool attrib_list_sentinel = false; 6976b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *attrib_list_base = (EGLint *) 0; 6986b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _remaining; 6996b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *attrib_list = (EGLint *) 0; 7006b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 7016b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (!attrib_list_ref) { 7026b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 7036b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 7046b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "attrib_list == null"; 7056b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 7066b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 7076b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (offset < 0) { 7086b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 7096b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 7106b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "offset < 0"; 7116b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 7126b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 7136b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _remaining = _env->GetArrayLength(attrib_list_ref) - offset; 7146b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list_base = (EGLint *) 7156b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0); 7166b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list = attrib_list_base + offset; 7176b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list_sentinel = false; 7186b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer for (int i = _remaining - 1; i >= 0; i--) { 7196b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (attrib_list[i] == EGL_NONE){ 7206b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list_sentinel = true; 7216b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer break; 7226b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 7236b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 7246b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (attrib_list_sentinel == false) { 7256b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 7266b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 7276b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "attrib_list must contain EGL_NONE!"; 7286b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 7296b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 7306b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 7316b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglCreatePbufferSurface( 7326b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)dpy_native, 7336b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLConfig)config_native, 7346b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint *)attrib_list 7356b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 7366b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 7376b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferexit: 7386b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (attrib_list_base) { 7396b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base, 7406b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer JNI_ABORT); 7416b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 7426b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (_exception) { 7436b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jniThrowException(_env, _exceptionType, _exceptionMessage); 7446b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 7456b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue); 7466b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 7476b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 7486b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLSurface eglCreatePixmapSurface ( EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list ) */ 7496b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jobject 7506b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglCreatePixmapSurface 7516b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jint pixmap, jintArray attrib_list_ref, jint offset) { 7526b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jniThrowException(_env, "java/lang/UnsupportedOperationException", 7536b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer "eglCreatePixmapSurface"); 7546b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, (EGLSurface) 0); 7556b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 7566b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 7576b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglDestroySurface ( EGLDisplay dpy, EGLSurface surface ) */ 7586b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 7596b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglDestroySurface 7606b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy, jobject surface) { 7616b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLBoolean _returnValue = (EGLBoolean) 0; 7626b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); 7636b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface); 7646b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 7656b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglDestroySurface( 7666b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)dpy_native, 7676b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLSurface)surface_native 7686b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 769cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jboolean)_returnValue; 7706b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 7716b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 7726b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglQuerySurface ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value ) */ 7736b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 7746b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglQuerySurface 7756b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy, jobject surface, jint attribute, jintArray value_ref, jint offset) { 7766b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _exception = 0; 77715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian const char * _exceptionType = NULL; 77815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian const char * _exceptionMessage = NULL; 7796b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLBoolean _returnValue = (EGLBoolean) 0; 7806b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); 7816b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface); 7826b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *value_base = (EGLint *) 0; 7836b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _remaining; 7846b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *value = (EGLint *) 0; 7856b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 7866b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (!value_ref) { 7876b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 7886b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 7896b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "value == null"; 7906b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 7916b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 7926b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (offset < 0) { 7936b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 7946b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 7956b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "offset < 0"; 7966b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 7976b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 7986b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _remaining = _env->GetArrayLength(value_ref) - offset; 7996b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (_remaining < 1) { 8006b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 8016b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 8026b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "length - offset < 1 < needed"; 8036b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 8046b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 8056b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer value_base = (EGLint *) 8066b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0); 8076b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer value = value_base + offset; 8086b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 8096b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglQuerySurface( 8106b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)dpy_native, 8116b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLSurface)surface_native, 8126b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint)attribute, 8136b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint *)value 8146b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 8156b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 8166b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferexit: 8176b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (value_base) { 8186b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->ReleasePrimitiveArrayCritical(value_ref, value_base, 8196b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception ? JNI_ABORT: 0); 8206b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 8216b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (_exception) { 8226b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jniThrowException(_env, _exceptionType, _exceptionMessage); 8236b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 824cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jboolean)_returnValue; 8256b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 8266b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 8276b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglBindAPI ( EGLenum api ) */ 8286b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 8296b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglBindAPI 8306b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jint api) { 8316b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLBoolean _returnValue = (EGLBoolean) 0; 8326b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglBindAPI( 8336b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLenum)api 8346b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 835cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jboolean)_returnValue; 8366b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 8376b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 8386b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLenum eglQueryAPI ( void ) */ 8396b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jint 8406b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglQueryAPI 8416b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this) { 8426b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLenum _returnValue = (EGLenum) 0; 8436b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglQueryAPI(); 844cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jint)_returnValue; 8456b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 8466b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 8476b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglWaitClient ( void ) */ 8486b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 8496b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglWaitClient 8506b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this) { 8516b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLBoolean _returnValue = (EGLBoolean) 0; 8526b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglWaitClient(); 853cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jboolean)_returnValue; 8546b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 8556b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 8566b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglReleaseThread ( void ) */ 8576b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 8586b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglReleaseThread 8596b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this) { 8606b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLBoolean _returnValue = (EGLBoolean) 0; 8616b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglReleaseThread(); 862cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jboolean)_returnValue; 8636b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 8646b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 8656b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLSurface eglCreatePbufferFromClientBuffer ( EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list ) */ 8666b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jobject 8676b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglCreatePbufferFromClientBuffer 86884bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat (JNIEnv *_env, jobject _this, jobject dpy, jint buftype, jlong buffer, jobject config, jintArray attrib_list_ref, jint offset) { 8696b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _exception = 0; 87015284dee8efe6b4d1441ab040962077614b5061aMathias Agopian const char * _exceptionType = NULL; 87115284dee8efe6b4d1441ab040962077614b5061aMathias Agopian const char * _exceptionMessage = NULL; 8726b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLSurface _returnValue = (EGLSurface) 0; 8736b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); 8746b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config); 8756b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer bool attrib_list_sentinel = false; 8766b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *attrib_list_base = (EGLint *) 0; 8776b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _remaining; 8786b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *attrib_list = (EGLint *) 0; 8796b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 8806b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (!attrib_list_ref) { 8816b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 8826b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 8836b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "attrib_list == null"; 8846b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 8856b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 8866b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (offset < 0) { 8876b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 8886b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 8896b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "offset < 0"; 8906b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 8916b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 8926b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _remaining = _env->GetArrayLength(attrib_list_ref) - offset; 8936b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list_base = (EGLint *) 8946b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0); 8956b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list = attrib_list_base + offset; 8966b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list_sentinel = false; 8976b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer for (int i = _remaining - 1; i >= 0; i--) { 8986b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (attrib_list[i] == EGL_NONE){ 8996b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list_sentinel = true; 9006b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer break; 9016b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 9026b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 9036b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (attrib_list_sentinel == false) { 9046b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 9056b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 9066b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "attrib_list must contain EGL_NONE!"; 9076b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 9086b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 9096b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 9106b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglCreatePbufferFromClientBuffer( 9116b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)dpy_native, 9126b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLenum)buftype, 91384bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat reinterpret_cast<EGLClientBuffer>(buffer), 9146b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLConfig)config_native, 9156b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint *)attrib_list 9166b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 9176b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 9186b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferexit: 9196b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (attrib_list_base) { 9206b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base, 9216b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer JNI_ABORT); 9226b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 9236b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (_exception) { 9246b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jniThrowException(_env, _exceptionType, _exceptionMessage); 9256b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 9266b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue); 9276b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 9286b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 92984bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhatstatic jobject 93084bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhatandroid_eglCreatePbufferFromClientBufferInt 93184bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat (JNIEnv *_env, jobject _this, jobject dpy, jint buftype, jint buffer, jobject config, jintArray attrib_list_ref, jint offset) { 93284bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat if(sizeof(void*) != sizeof(uint32_t)) { 93384bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat jniThrowException(_env, "java/lang/UnsupportedOperationException", "eglCreatePbufferFromClientBuffer"); 93484bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat return 0; 93584bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat } 93684bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat return android_eglCreatePbufferFromClientBuffer(_env, _this, dpy, buftype, buffer, config, attrib_list_ref, offset); 93784bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat} 93884bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat 9396b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglSurfaceAttrib ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value ) */ 9406b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 9416b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglSurfaceAttrib 9426b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy, jobject surface, jint attribute, jint value) { 9436b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLBoolean _returnValue = (EGLBoolean) 0; 9446b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); 9456b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface); 9466b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 9476b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglSurfaceAttrib( 9486b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)dpy_native, 9496b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLSurface)surface_native, 9506b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint)attribute, 9516b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint)value 9526b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 953cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jboolean)_returnValue; 9546b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 9556b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 9566b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglBindTexImage ( EGLDisplay dpy, EGLSurface surface, EGLint buffer ) */ 9576b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 9586b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglBindTexImage 9596b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy, jobject surface, jint buffer) { 9606b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLBoolean _returnValue = (EGLBoolean) 0; 9616b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); 9626b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface); 9636b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 9646b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglBindTexImage( 9656b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)dpy_native, 9666b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLSurface)surface_native, 9676b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint)buffer 9686b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 969cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jboolean)_returnValue; 9706b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 9716b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 9726b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglReleaseTexImage ( EGLDisplay dpy, EGLSurface surface, EGLint buffer ) */ 9736b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 9746b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglReleaseTexImage 9756b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy, jobject surface, jint buffer) { 9766b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLBoolean _returnValue = (EGLBoolean) 0; 9776b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); 9786b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface); 9796b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 9806b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglReleaseTexImage( 9816b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)dpy_native, 9826b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLSurface)surface_native, 9836b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint)buffer 9846b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 985cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jboolean)_returnValue; 9866b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 9876b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 9886b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglSwapInterval ( EGLDisplay dpy, EGLint interval ) */ 9896b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 9906b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglSwapInterval 9916b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy, jint interval) { 9926b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLBoolean _returnValue = (EGLBoolean) 0; 9936b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); 9946b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 9956b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglSwapInterval( 9966b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)dpy_native, 9976b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint)interval 9986b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 999cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jboolean)_returnValue; 10006b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 10016b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 10026b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLContext eglCreateContext ( EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list ) */ 10036b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jobject 10046b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglCreateContext 10056b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jobject share_context, jintArray attrib_list_ref, jint offset) { 10066b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _exception = 0; 100715284dee8efe6b4d1441ab040962077614b5061aMathias Agopian const char * _exceptionType = NULL; 100815284dee8efe6b4d1441ab040962077614b5061aMathias Agopian const char * _exceptionMessage = NULL; 10096b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLContext _returnValue = (EGLContext) 0; 10106b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); 10116b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config); 10126b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLContext share_context_native = (EGLContext) fromEGLHandle(_env, eglcontextGetHandleID, share_context); 10136b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer bool attrib_list_sentinel = false; 10146b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *attrib_list_base = (EGLint *) 0; 10156b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _remaining; 10166b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *attrib_list = (EGLint *) 0; 10176b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 10186b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (!attrib_list_ref) { 10196b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 10206b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 10216b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "attrib_list == null"; 10226b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 10236b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 10246b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (offset < 0) { 10256b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 10266b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 10276b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "offset < 0"; 10286b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 10296b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 10306b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _remaining = _env->GetArrayLength(attrib_list_ref) - offset; 10316b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list_base = (EGLint *) 10326b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0); 10336b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list = attrib_list_base + offset; 10346b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list_sentinel = false; 10356b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer for (int i = _remaining - 1; i >= 0; i--) { 10366b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (attrib_list[i] == EGL_NONE){ 10376b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer attrib_list_sentinel = true; 10386b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer break; 10396b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 10406b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 10416b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (attrib_list_sentinel == false) { 10426b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 10436b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 10446b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "attrib_list must contain EGL_NONE!"; 10456b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 10466b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 10476b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 10486b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglCreateContext( 10496b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)dpy_native, 10506b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLConfig)config_native, 10516b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLContext)share_context_native, 10526b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint *)attrib_list 10536b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 10546b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 10556b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferexit: 10566b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (attrib_list_base) { 10576b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base, 10586b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer JNI_ABORT); 10596b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 10606b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (_exception) { 10616b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jniThrowException(_env, _exceptionType, _exceptionMessage); 10626b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 10636b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer return toEGLHandle(_env, eglcontextClass, eglcontextConstructor, _returnValue); 10646b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 10656b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 10666b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglDestroyContext ( EGLDisplay dpy, EGLContext ctx ) */ 10676b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 10686b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglDestroyContext 10696b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy, jobject ctx) { 10706b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLBoolean _returnValue = (EGLBoolean) 0; 10716b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); 10726b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLContext ctx_native = (EGLContext) fromEGLHandle(_env, eglcontextGetHandleID, ctx); 10736b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 10746b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglDestroyContext( 10756b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)dpy_native, 10766b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLContext)ctx_native 10776b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 1078cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jboolean)_returnValue; 10796b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 10806b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 10816b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglMakeCurrent ( EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx ) */ 10826b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 10836b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglMakeCurrent 10846b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy, jobject draw, jobject read, jobject ctx) { 10856b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLBoolean _returnValue = (EGLBoolean) 0; 10866b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); 10876b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLSurface draw_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, draw); 10886b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLSurface read_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, read); 10896b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLContext ctx_native = (EGLContext) fromEGLHandle(_env, eglcontextGetHandleID, ctx); 10906b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 10916b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglMakeCurrent( 10926b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)dpy_native, 10936b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLSurface)draw_native, 10946b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLSurface)read_native, 10956b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLContext)ctx_native 10966b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 1097cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jboolean)_returnValue; 10986b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 10996b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 11006b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLContext eglGetCurrentContext ( void ) */ 11016b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jobject 11026b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglGetCurrentContext 11036b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this) { 11046b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLContext _returnValue = (EGLContext) 0; 11056b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglGetCurrentContext(); 11066b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer return toEGLHandle(_env, eglcontextClass, eglcontextConstructor, _returnValue); 11076b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 11086b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 11096b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLSurface eglGetCurrentSurface ( EGLint readdraw ) */ 11106b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jobject 11116b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglGetCurrentSurface 11126b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jint readdraw) { 11136b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLSurface _returnValue = (EGLSurface) 0; 11146b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglGetCurrentSurface( 11156b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint)readdraw 11166b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 11176b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue); 11186b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 11196b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 11206b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLDisplay eglGetCurrentDisplay ( void ) */ 11216b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jobject 11226b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglGetCurrentDisplay 11236b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this) { 11246b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay _returnValue = (EGLDisplay) 0; 11256b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglGetCurrentDisplay(); 11266b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer return toEGLHandle(_env, egldisplayClass, egldisplayConstructor, _returnValue); 11276b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 11286b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 11296b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglQueryContext ( EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value ) */ 11306b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 11316b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglQueryContext 11326b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy, jobject ctx, jint attribute, jintArray value_ref, jint offset) { 11336b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _exception = 0; 113415284dee8efe6b4d1441ab040962077614b5061aMathias Agopian const char * _exceptionType = NULL; 113515284dee8efe6b4d1441ab040962077614b5061aMathias Agopian const char * _exceptionMessage = NULL; 11366b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLBoolean _returnValue = (EGLBoolean) 0; 11376b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); 11386b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLContext ctx_native = (EGLContext) fromEGLHandle(_env, eglcontextGetHandleID, ctx); 11396b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *value_base = (EGLint *) 0; 11406b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jint _remaining; 11416b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLint *value = (EGLint *) 0; 11426b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 11436b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (!value_ref) { 11446b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 11456b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 11466b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "value == null"; 11476b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 11486b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 11496b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (offset < 0) { 11506b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 11516b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 11526b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "offset < 0"; 11536b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 11546b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 11556b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _remaining = _env->GetArrayLength(value_ref) - offset; 11566b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (_remaining < 1) { 11576b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception = 1; 11586b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionType = "java/lang/IllegalArgumentException"; 11596b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exceptionMessage = "length - offset < 1 < needed"; 11606b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer goto exit; 11616b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 11626b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer value_base = (EGLint *) 11636b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0); 11646b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer value = value_base + offset; 11656b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 11666b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglQueryContext( 11676b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)dpy_native, 11686b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLContext)ctx_native, 11696b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint)attribute, 11706b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint *)value 11716b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 11726b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 11736b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferexit: 11746b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (value_base) { 11756b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _env->ReleasePrimitiveArrayCritical(value_ref, value_base, 11766b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _exception ? JNI_ABORT: 0); 11776b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 11786b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer if (_exception) { 11796b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jniThrowException(_env, _exceptionType, _exceptionMessage); 11806b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer } 1181cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jboolean)_returnValue; 11826b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 11836b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 11846b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglWaitGL ( void ) */ 11856b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 11866b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglWaitGL 11876b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this) { 11886b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLBoolean _returnValue = (EGLBoolean) 0; 11896b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglWaitGL(); 1190cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jboolean)_returnValue; 11916b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 11926b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 11936b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglWaitNative ( EGLint engine ) */ 11946b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 11956b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglWaitNative 11966b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jint engine) { 11976b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLBoolean _returnValue = (EGLBoolean) 0; 11986b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglWaitNative( 11996b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLint)engine 12006b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 1201cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jboolean)_returnValue; 12026b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 12036b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 12046b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglSwapBuffers ( EGLDisplay dpy, EGLSurface surface ) */ 12056b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 12066b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglSwapBuffers 12076b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy, jobject surface) { 12086b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLBoolean _returnValue = (EGLBoolean) 0; 12096b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); 12106b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface); 12116b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 12126b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer _returnValue = eglSwapBuffers( 12136b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLDisplay)dpy_native, 12146b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (EGLSurface)surface_native 12156b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer ); 1216cee5198e7199fcbb131ff0d30165fb1d5c0107cfAndy McFadden return (jboolean)_returnValue; 12176b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 12186b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 12196b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer/* EGLBoolean eglCopyBuffers ( EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target ) */ 12206b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic jboolean 12216b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferandroid_eglCopyBuffers 12226b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer (JNIEnv *_env, jobject _this, jobject dpy, jobject surface, jint target) { 12236b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer jniThrowException(_env, "java/lang/UnsupportedOperationException", 12246b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer "eglCopyBuffers"); 12256b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer return (EGLBoolean) 0; 12266b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 12276b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 12286b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic const char *classPathName = "android/opengl/EGL14"; 12296b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 12306b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferstatic JNINativeMethod methods[] = { 12316b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"_nativeClassInit", "()V", (void*)nativeClassInit }, 12326b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglGetError", "()I", (void *) android_eglGetError }, 123384bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat{"eglGetDisplay", "(I)Landroid/opengl/EGLDisplay;", (void *) android_eglGetDisplayInt }, 123484bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat{"eglGetDisplay", "(J)Landroid/opengl/EGLDisplay;", (void *) android_eglGetDisplay }, 12356b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglInitialize", "(Landroid/opengl/EGLDisplay;[II[II)Z", (void *) android_eglInitialize }, 12366b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglTerminate", "(Landroid/opengl/EGLDisplay;)Z", (void *) android_eglTerminate }, 12376b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglQueryString", "(Landroid/opengl/EGLDisplay;I)Ljava/lang/String;", (void *) android_eglQueryString__Landroind_opengl_EGLDisplay_2I }, 12386b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglGetConfigs", "(Landroid/opengl/EGLDisplay;[Landroid/opengl/EGLConfig;II[II)Z", (void *) android_eglGetConfigs }, 12396b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglChooseConfig", "(Landroid/opengl/EGLDisplay;[II[Landroid/opengl/EGLConfig;II[II)Z", (void *) android_eglChooseConfig }, 12406b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglGetConfigAttrib", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;I[II)Z", (void *) android_eglGetConfigAttrib }, 12416b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"_eglCreateWindowSurface", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;Ljava/lang/Object;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreateWindowSurface }, 12426b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"_eglCreateWindowSurfaceTexture", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;Ljava/lang/Object;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreateWindowSurfaceTexture }, 12436b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglCreatePbufferSurface", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreatePbufferSurface }, 12446b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglCreatePixmapSurface", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;I[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreatePixmapSurface }, 12456b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglDestroySurface", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;)Z", (void *) android_eglDestroySurface }, 12466b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglQuerySurface", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;I[II)Z", (void *) android_eglQuerySurface }, 12476b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglBindAPI", "(I)Z", (void *) android_eglBindAPI }, 12486b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglQueryAPI", "()I", (void *) android_eglQueryAPI }, 12496b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglWaitClient", "()Z", (void *) android_eglWaitClient }, 12506b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglReleaseThread", "()Z", (void *) android_eglReleaseThread }, 125184bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat{"eglCreatePbufferFromClientBuffer", "(Landroid/opengl/EGLDisplay;IILandroid/opengl/EGLConfig;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreatePbufferFromClientBufferInt }, 125284bbeb9e0c9c185a22d4882b79e0bc8a598642abAshok Bhat{"eglCreatePbufferFromClientBuffer", "(Landroid/opengl/EGLDisplay;IJLandroid/opengl/EGLConfig;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreatePbufferFromClientBuffer }, 12536b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglSurfaceAttrib", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;II)Z", (void *) android_eglSurfaceAttrib }, 12546b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglBindTexImage", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;I)Z", (void *) android_eglBindTexImage }, 12556b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglReleaseTexImage", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;I)Z", (void *) android_eglReleaseTexImage }, 12566b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglSwapInterval", "(Landroid/opengl/EGLDisplay;I)Z", (void *) android_eglSwapInterval }, 12576b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglCreateContext", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;Landroid/opengl/EGLContext;[II)Landroid/opengl/EGLContext;", (void *) android_eglCreateContext }, 12586b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglDestroyContext", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLContext;)Z", (void *) android_eglDestroyContext }, 12596b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglMakeCurrent", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;Landroid/opengl/EGLSurface;Landroid/opengl/EGLContext;)Z", (void *) android_eglMakeCurrent }, 12606b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglGetCurrentContext", "()Landroid/opengl/EGLContext;", (void *) android_eglGetCurrentContext }, 12616b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglGetCurrentSurface", "(I)Landroid/opengl/EGLSurface;", (void *) android_eglGetCurrentSurface }, 12626b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglGetCurrentDisplay", "()Landroid/opengl/EGLDisplay;", (void *) android_eglGetCurrentDisplay }, 12636b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglQueryContext", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLContext;I[II)Z", (void *) android_eglQueryContext }, 12646b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglWaitGL", "()Z", (void *) android_eglWaitGL }, 12656b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglWaitNative", "(I)Z", (void *) android_eglWaitNative }, 12666b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglSwapBuffers", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;)Z", (void *) android_eglSwapBuffers }, 12676b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{"eglCopyBuffers", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSurface;I)Z", (void *) android_eglCopyBuffers }, 12686b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer}; 12696b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer 12706b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshoferint register_android_opengl_jni_EGL14(JNIEnv *_env) 12716b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer{ 12726b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer int err; 12736b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods)); 12746b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer return err; 12756b1e838fc16d397359f82c3a4f5700f1ed7dd910Thomas Tafertshofer} 1276