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