/* EGLSurface eglCreatePbufferSurface ( EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list ) */ static jobject android_eglCreatePbufferSurface (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jintArray attrib_list_ref, jint offset) { jint _exception = 0; const char * _exceptionType = NULL; const char * _exceptionMessage = NULL; EGLSurface _returnValue = (EGLSurface) 0; EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config); bool attrib_list_sentinel = false; EGLint *attrib_list_base = (EGLint *) 0; jint _remaining; EGLint *attrib_list = (EGLint *) 0; if (!attrib_list_ref) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "attrib_list == null"; goto exit; } if (offset < 0) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(attrib_list_ref) - offset; attrib_list_base = (EGLint *) _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0); attrib_list = attrib_list_base + offset; attrib_list_sentinel = false; for (int i = _remaining - 1; i >= 0; i--) { if (attrib_list[i] == EGL_NONE){ attrib_list_sentinel = true; break; } } if (attrib_list_sentinel == false) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "attrib_list must contain EGL_NONE!"; goto exit; } _returnValue = eglCreatePbufferSurface( (EGLDisplay)dpy_native, (EGLConfig)config_native, (EGLint *)attrib_list ); exit: if (attrib_list_base) { _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base, JNI_ABORT); } if (_exception) { jniThrowException(_env, _exceptionType, _exceptionMessage); } return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue); }
/* EGLBoolean eglQuerySurface ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value ) */ static jboolean android_eglQuerySurface (JNIEnv *_env, jobject _this, jobject dpy, jobject surface, jint attribute, jintArray value_ref, jint offset) { jint _exception = 0; const char * _exceptionType = NULL; const char * _exceptionMessage = NULL; EGLBoolean _returnValue = (EGLBoolean) 0; EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface); EGLint *value_base = (EGLint *) 0; jint _remaining; EGLint *value = (EGLint *) 0; if (!value_ref) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "value == null"; goto exit; } if (offset < 0) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "offset < 0"; goto exit; } _remaining = _env->GetArrayLength(value_ref) - offset; if (_remaining < 1) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "length - offset < 1 < needed"; goto exit; } value_base = (EGLint *) _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0); value = value_base + offset; _returnValue = eglQuerySurface( (EGLDisplay)dpy_native, (EGLSurface)surface_native, (EGLint)attribute, (EGLint *)value ); exit: if (value_base) { _env->ReleasePrimitiveArrayCritical(value_ref, value_base, _exception ? JNI_ABORT: 0); } if (_exception) { jniThrowException(_env, _exceptionType, _exceptionMessage); } return (jboolean)_returnValue; }
/* EGLBoolean eglDestroySurface ( EGLDisplay dpy, EGLSurface surface ) */ static jboolean android_eglDestroySurface (JNIEnv *_env, jobject _this, jobject dpy, jobject surface) { EGLBoolean _returnValue = (EGLBoolean) 0; EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface); _returnValue = eglDestroySurface( (EGLDisplay)dpy_native, (EGLSurface)surface_native ); return (jboolean)_returnValue; }
/* EGLBoolean eglDestroyContext ( EGLDisplay dpy, EGLContext ctx ) */ static jboolean android_eglDestroyContext (JNIEnv *_env, jobject _this, jobject dpy, jobject ctx) { EGLBoolean _returnValue = (EGLBoolean) 0; EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); EGLContext ctx_native = (EGLContext) fromEGLHandle(_env, eglcontextGetHandleID, ctx); _returnValue = eglDestroyContext( (EGLDisplay)dpy_native, (EGLContext)ctx_native ); return (jboolean)_returnValue; }
/* EGLBoolean eglPresentationTimeANDROID ( EGLDisplay dpy, EGLSurface sur, EGLnsecsANDROID time ) */ static jboolean android_eglPresentationTimeANDROID (JNIEnv *_env, jobject _this, jobject dpy, jobject sur, jlong time) { EGLBoolean _returnValue = (EGLBoolean) 0; EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); EGLSurface sur_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, sur); _returnValue = eglPresentationTimeANDROID( (EGLDisplay)dpy_native, (EGLSurface)sur_native, (EGLnsecsANDROID)time ); return (jboolean)_returnValue; }
/* EGLBoolean eglReleaseTexImage ( EGLDisplay dpy, EGLSurface surface, EGLint buffer ) */ static jboolean android_eglReleaseTexImage (JNIEnv *_env, jobject _this, jobject dpy, jobject surface, jint buffer) { EGLBoolean _returnValue = (EGLBoolean) 0; EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface); _returnValue = eglReleaseTexImage( (EGLDisplay)dpy_native, (EGLSurface)surface_native, (EGLint)buffer ); return (jboolean)_returnValue; }
/* EGLBoolean eglSurfaceAttrib ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value ) */ static jboolean android_eglSurfaceAttrib (JNIEnv *_env, jobject _this, jobject dpy, jobject surface, jint attribute, jint value) { EGLBoolean _returnValue = (EGLBoolean) 0; EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); EGLSurface surface_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, surface); _returnValue = eglSurfaceAttrib( (EGLDisplay)dpy_native, (EGLSurface)surface_native, (EGLint)attribute, (EGLint)value ); return (jboolean)_returnValue; }
/* EGLBoolean eglMakeCurrent ( EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx ) */ static jboolean android_eglMakeCurrent (JNIEnv *_env, jobject _this, jobject dpy, jobject draw, jobject read, jobject ctx) { EGLBoolean _returnValue = (EGLBoolean) 0; EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); EGLSurface draw_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, draw); EGLSurface read_native = (EGLSurface) fromEGLHandle(_env, eglsurfaceGetHandleID, read); EGLContext ctx_native = (EGLContext) fromEGLHandle(_env, eglcontextGetHandleID, ctx); _returnValue = eglMakeCurrent( (EGLDisplay)dpy_native, (EGLSurface)draw_native, (EGLSurface)read_native, (EGLContext)ctx_native ); return (jboolean)_returnValue; }
/* const char * eglQueryString ( EGLDisplay dpy, EGLint name ) */ static jstring android_eglQueryString__Landroind_opengl_EGLDisplay_2I (JNIEnv *_env, jobject _this, jobject dpy, jint name) { const char* chars = (const char*) eglQueryString( (EGLDisplay)fromEGLHandle(_env, egldisplayGetHandleID, dpy), (EGLint)name ); return _env->NewStringUTF(chars); }
/* EGLBoolean eglTerminate ( EGLDisplay dpy ) */ static jboolean android_eglTerminate (JNIEnv *_env, jobject _this, jobject dpy) { EGLBoolean _returnValue = (EGLBoolean) 0; EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); _returnValue = eglTerminate( (EGLDisplay)dpy_native ); return (jboolean)_returnValue; }
/* EGLBoolean eglSwapInterval ( EGLDisplay dpy, EGLint interval ) */ static jboolean android_eglSwapInterval (JNIEnv *_env, jobject _this, jobject dpy, jint interval) { EGLBoolean _returnValue = (EGLBoolean) 0; EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); _returnValue = eglSwapInterval( (EGLDisplay)dpy_native, (EGLint)interval ); return (jboolean)_returnValue; }
/* EGLSurface eglCreateWindowSurface ( EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list ) */ static jobject android_eglCreateWindowSurfaceTexture (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jobject win, jintArray attrib_list_ref, jint offset) { jint _exception = 0; const char * _exceptionType = ""; const char * _exceptionMessage = ""; EGLSurface _returnValue = (EGLSurface) 0; EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config); int attrib_list_sentinel = 0; EGLint *attrib_list_base = (EGLint *) 0; jint _remaining; EGLint *attrib_list = (EGLint *) 0; android::sp<ANativeWindow> window; android::sp<android::IGraphicBufferProducer> producer; if (!attrib_list_ref) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "attrib_list == null"; goto exit; } if (offset < 0) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "offset < 0"; goto exit; } if (win == NULL) { not_valid_surface: _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "Make sure the SurfaceView or associated SurfaceHolder has a valid Surface"; goto exit; } producer = android::SurfaceTexture_getProducer(_env, win); if (producer == NULL) goto not_valid_surface; window = new android::Surface(producer, true); if (window == NULL) goto not_valid_surface; _remaining = _env->GetArrayLength(attrib_list_ref) - offset; attrib_list_base = (EGLint *) _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0); attrib_list = attrib_list_base + offset; attrib_list_sentinel = 0; for (int i = _remaining - 1; i >= 0; i--) { if (*((EGLint*)(attrib_list + i)) == EGL_NONE){ attrib_list_sentinel = 1; break; } } if (attrib_list_sentinel == 0) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "attrib_list must contain EGL_NONE!"; goto exit; } _returnValue = eglCreateWindowSurface( (EGLDisplay)dpy_native, (EGLConfig)config_native, (EGLNativeWindowType)window.get(), (EGLint *)attrib_list ); exit: if (attrib_list_base) { _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base, JNI_ABORT); } if (_exception) { jniThrowException(_env, _exceptionType, _exceptionMessage); } return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue); }
/* EGLBoolean eglChooseConfig ( EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config ) */ static jboolean android_eglChooseConfig (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) { jint _exception = 0; const char * _exceptionType = NULL; const char * _exceptionMessage = NULL; EGLBoolean _returnValue = (EGLBoolean) 0; EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); bool attrib_list_sentinel = false; EGLint *attrib_list_base = (EGLint *) 0; jint _attrib_listRemaining; EGLint *attrib_list = (EGLint *) 0; jint _configsRemaining; EGLConfig *configs = (EGLConfig *) 0; EGLint *num_config_base = (EGLint *) 0; jint _num_configRemaining; EGLint *num_config = (EGLint *) 0; if (!attrib_list_ref) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "attrib_list == null"; goto exit; } if (attrib_listOffset < 0) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "attrib_listOffset < 0"; goto exit; } _attrib_listRemaining = _env->GetArrayLength(attrib_list_ref) - attrib_listOffset; attrib_list_base = (EGLint *) _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0); attrib_list = attrib_list_base + attrib_listOffset; attrib_list_sentinel = false; for (int i = _attrib_listRemaining - 1; i >= 0; i--) { if (attrib_list[i] == EGL_NONE){ attrib_list_sentinel = true; break; } } if (attrib_list_sentinel == false) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "attrib_list must contain EGL_NONE!"; goto exit; } if (!configs_ref) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "configs == null"; goto exit; } if (configsOffset < 0) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "configsOffset < 0"; goto exit; } _configsRemaining = _env->GetArrayLength(configs_ref) - configsOffset; if (_configsRemaining < config_size) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "length - configsOffset < config_size < needed"; goto exit; } configs = new EGLConfig[_configsRemaining]; if (!num_config_ref) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "num_config == null"; goto exit; } if (num_configOffset < 0) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "num_configOffset < 0"; goto exit; } _num_configRemaining = _env->GetArrayLength(num_config_ref) - num_configOffset; if (_num_configRemaining < 1) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "length - num_configOffset < 1 < needed"; goto exit; } num_config_base = (EGLint *) _env->GetPrimitiveArrayCritical(num_config_ref, (jboolean *)0); num_config = num_config_base + num_configOffset; _returnValue = eglChooseConfig( (EGLDisplay)dpy_native, (EGLint *)attrib_list, (EGLConfig *)configs, (EGLint)config_size, (EGLint *)num_config ); exit: if (num_config_base) { _env->ReleasePrimitiveArrayCritical(num_config_ref, num_config_base, _exception ? JNI_ABORT: 0); } if (attrib_list_base) { _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base, JNI_ABORT); } if (configs) { for (int i = 0; i < _configsRemaining; i++) { jobject configs_new = toEGLHandle(_env, eglconfigClass, eglconfigConstructor, configs[i]); _env->SetObjectArrayElement(configs_ref, i + configsOffset, configs_new); } delete[] configs; } if (_exception) { jniThrowException(_env, _exceptionType, _exceptionMessage); } return (jboolean)_returnValue; }
/* EGLBoolean eglGetConfigs ( EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config ) */ static jboolean android_eglGetConfigs (JNIEnv *_env, jobject _this, jobject dpy, jobjectArray configs_ref, jint configsOffset, jint config_size, jintArray num_config_ref, jint num_configOffset) { jint _exception = 0; const char * _exceptionType = NULL; const char * _exceptionMessage = NULL; EGLBoolean _returnValue = (EGLBoolean) 0; EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); jint _configsRemaining; EGLConfig *configs = (EGLConfig *) 0; EGLint *num_config_base = (EGLint *) 0; jint _num_configRemaining; EGLint *num_config = (EGLint *) 0; if (!configs_ref) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "configs == null"; goto exit; } if (configsOffset < 0) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "configsOffset < 0"; goto exit; } _configsRemaining = _env->GetArrayLength(configs_ref) - configsOffset; if (_configsRemaining < config_size) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "length - configsOffset < config_size < needed"; goto exit; } configs = new EGLConfig[_configsRemaining]; if (!num_config_ref) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "num_config == null"; goto exit; } if (num_configOffset < 0) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "num_configOffset < 0"; goto exit; } _num_configRemaining = _env->GetArrayLength(num_config_ref) - num_configOffset; num_config_base = (EGLint *) _env->GetPrimitiveArrayCritical(num_config_ref, (jboolean *)0); num_config = num_config_base + num_configOffset; _returnValue = eglGetConfigs( (EGLDisplay)dpy_native, (EGLConfig *)configs, (EGLint)config_size, (EGLint *)num_config ); exit: if (num_config_base) { _env->ReleasePrimitiveArrayCritical(num_config_ref, num_config_base, _exception ? JNI_ABORT: 0); } if (configs) { for (int i = 0; i < _configsRemaining; i++) { jobject configs_new = toEGLHandle(_env, eglconfigClass, eglconfigConstructor, configs[i]); _env->SetObjectArrayElement(configs_ref, i + configsOffset, configs_new); } delete[] configs; } if (_exception) { jniThrowException(_env, _exceptionType, _exceptionMessage); } return (jboolean)_returnValue; }
/* EGLBoolean eglInitialize ( EGLDisplay dpy, EGLint *major, EGLint *minor ) */ static jboolean android_eglInitialize (JNIEnv *_env, jobject _this, jobject dpy, jintArray major_ref, jint majorOffset, jintArray minor_ref, jint minorOffset) { jint _exception = 0; const char * _exceptionType = NULL; const char * _exceptionMessage = NULL; EGLBoolean _returnValue = (EGLBoolean) 0; EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); EGLint *major_base = (EGLint *) 0; jint _majorRemaining; EGLint *major = (EGLint *) 0; EGLint *minor_base = (EGLint *) 0; jint _minorRemaining; EGLint *minor = (EGLint *) 0; if (!major_ref) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "major == null"; goto exit; } if (majorOffset < 0) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "majorOffset < 0"; goto exit; } _majorRemaining = _env->GetArrayLength(major_ref) - majorOffset; if (_majorRemaining < 1) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "length - majorOffset < 1 < needed"; goto exit; } major_base = (EGLint *) _env->GetPrimitiveArrayCritical(major_ref, (jboolean *)0); major = major_base + majorOffset; if (!minor_ref) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "minor == null"; goto exit; } if (minorOffset < 0) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "minorOffset < 0"; goto exit; } _minorRemaining = _env->GetArrayLength(minor_ref) - minorOffset; if (_minorRemaining < 1) { _exception = 1; _exceptionType = "java/lang/IllegalArgumentException"; _exceptionMessage = "length - minorOffset < 1 < needed"; goto exit; } minor_base = (EGLint *) _env->GetPrimitiveArrayCritical(minor_ref, (jboolean *)0); minor = minor_base + minorOffset; _returnValue = eglInitialize( (EGLDisplay)dpy_native, (EGLint *)major, (EGLint *)minor ); exit: if (minor_base) { _env->ReleasePrimitiveArrayCritical(minor_ref, minor_base, _exception ? JNI_ABORT: 0); } if (major_base) { _env->ReleasePrimitiveArrayCritical(major_ref, major_base, _exception ? JNI_ABORT: 0); } if (_exception) { jniThrowException(_env, _exceptionType, _exceptionMessage); } return (jboolean)_returnValue; }