summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xapi/current.txt2
-rw-r--r--core/jni/android_opengl_EGL15.cpp75
-rw-r--r--opengl/java/android/opengl/EGL15.java18
3 files changed, 62 insertions, 33 deletions
diff --git a/api/current.txt b/api/current.txt
index 51df940866d3..1c3ee82dbba0 100755
--- a/api/current.txt
+++ b/api/current.txt
@@ -29745,9 +29745,11 @@ package android.opengl {
public class EGL15 {
ctor public EGL15();
method public static int eglClientWaitSync(android.opengl.EGLDisplay, android.opengl.EGLSync, int, long);
+ method public static android.opengl.EGLImage eglCreateImage(android.opengl.EGLDisplay, android.opengl.EGLContext, int, long, long[], int);
method public static android.opengl.EGLSurface eglCreatePlatformPixmapSurface(android.opengl.EGLDisplay, android.opengl.EGLConfig, java.nio.Buffer, long[], int);
method public static android.opengl.EGLSurface eglCreatePlatformWindowSurface(android.opengl.EGLDisplay, android.opengl.EGLConfig, java.nio.Buffer, long[], int);
method public static android.opengl.EGLSync eglCreateSync(android.opengl.EGLDisplay, int, long[], int);
+ method public static boolean eglDestroyImage(android.opengl.EGLDisplay, android.opengl.EGLImage);
method public static boolean eglDestroySync(android.opengl.EGLDisplay, android.opengl.EGLSync);
method public static android.opengl.EGLDisplay eglGetPlatformDisplay(int, long, long[], int);
method public static boolean eglGetSyncAttrib(android.opengl.EGLDisplay, android.opengl.EGLSync, int, long[], int);
diff --git a/core/jni/android_opengl_EGL15.cpp b/core/jni/android_opengl_EGL15.cpp
index 4a30babafa49..b52f137da7d6 100644
--- a/core/jni/android_opengl_EGL15.cpp
+++ b/core/jni/android_opengl_EGL15.cpp
@@ -456,27 +456,41 @@ exit:
static jobject
android_eglCreatePlatformPixmapSurface
(JNIEnv *_env, jobject _this, jobject dpy, jobject config, jobject native_pixmap_buf, jlongArray attrib_list_ref, jint offset) {
+ jniThrowException(_env, "java/lang/UnsupportedOperationException",
+ "eglCreatePlatformPixmapSurface");
+ return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, (EGLSurface) 0);
+}
+
+/* EGLBoolean eglWaitSync ( EGLDisplay dpy, EGLSync sync, EGLint flags ) */
+static jboolean
+android_eglWaitSync
+ (JNIEnv *_env, jobject _this, jobject dpy, jobject sync, jint flags) {
+ EGLBoolean _returnValue = (EGLBoolean) 0;
+ EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
+ EGLSync sync_native = (EGLSync) fromEGLHandle(_env, eglsyncGetHandleID, sync);
+
+ _returnValue = eglWaitSync(
+ (EGLDisplay)dpy_native,
+ (EGLSync)sync_native,
+ (EGLint)flags
+ );
+ return (jboolean)_returnValue;
+}
+
+/* EGLImage eglCreateImage ( EGLDisplay dpy, EGLContext context, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list ) */
+static jobject
+android_eglCreateImage
+ (JNIEnv *_env, jobject _this, jobject dpy, jobject context, jint target, jlong buffer, jlongArray attrib_list_ref, jint offset) {
jint _exception = 0;
const char * _exceptionType = NULL;
const char * _exceptionMessage = NULL;
- jarray _array = (jarray) 0;
- jint _bufferOffset = (jint) 0;
- EGLSurface _returnValue = (EGLSurface) 0;
+ EGLImage _returnValue = (EGLImage) 0;
EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
- EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config);
- jint _native_pixmapRemaining;
- void *native_pixmap = (void *) 0;
+ EGLContext context_native = (EGLContext) fromEGLHandle(_env, eglcontextGetHandleID, context);
EGLAttrib *attrib_list_base = (EGLAttrib *) 0;
- jint _attrib_listRemaining;
+ jint _remaining;
EGLAttrib *attrib_list = (EGLAttrib *) 0;
- if (!native_pixmap_buf) {
- _exception = 1;
- _exceptionType = "java/lang/IllegalArgumentException";
- _exceptionMessage = "native_pixmap == null";
- goto exit;
- }
- native_pixmap = (void *)getPointer(_env, native_pixmap_buf, (jarray*)&_array, &_native_pixmapRemaining, &_bufferOffset);
if (!attrib_list_ref) {
_exception = 1;
_exceptionType = "java/lang/IllegalArgumentException";
@@ -489,19 +503,16 @@ android_eglCreatePlatformPixmapSurface
_exceptionMessage = "offset < 0";
goto exit;
}
- _attrib_listRemaining = _env->GetArrayLength(attrib_list_ref) - offset;
+ _remaining = _env->GetArrayLength(attrib_list_ref) - offset;
attrib_list_base = (EGLAttrib *)
_env->GetLongArrayElements(attrib_list_ref, (jboolean *)0);
attrib_list = attrib_list_base + offset;
- if (native_pixmap == NULL) {
- char * _native_pixmapBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
- native_pixmap = (void *) (_native_pixmapBase + _bufferOffset);
- }
- _returnValue = eglCreatePlatformPixmapSurface(
+ _returnValue = eglCreateImage(
(EGLDisplay)dpy_native,
- (EGLConfig)config_native,
- (void *)native_pixmap,
+ (EGLContext)context_native,
+ (EGLenum)target,
+ (EGLClientBuffer)buffer,
(EGLAttrib *)attrib_list
);
@@ -510,27 +521,23 @@ exit:
_env->ReleaseLongArrayElements(attrib_list_ref, (jlong*)attrib_list_base,
JNI_ABORT);
}
- if (_array) {
- releasePointer(_env, _array, native_pixmap, _exception ? JNI_FALSE : JNI_TRUE);
- }
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
}
- return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue);
+ return toEGLHandle(_env, eglimageClass, eglimageConstructor, _returnValue);
}
-/* EGLBoolean eglWaitSync ( EGLDisplay dpy, EGLSync sync, EGLint flags ) */
+/* EGLBoolean eglDestroyImage ( EGLDisplay dpy, EGLImage image ) */
static jboolean
-android_eglWaitSync
- (JNIEnv *_env, jobject _this, jobject dpy, jobject sync, jint flags) {
+android_eglDestroyImage
+ (JNIEnv *_env, jobject _this, jobject dpy, jobject image) {
EGLBoolean _returnValue = (EGLBoolean) 0;
EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy);
- EGLSync sync_native = (EGLSync) fromEGLHandle(_env, eglsyncGetHandleID, sync);
+ EGLImage image_native = (EGLImage) fromEGLHandle(_env, eglimageGetHandleID, image);
- _returnValue = eglWaitSync(
+ _returnValue = eglDestroyImage(
(EGLDisplay)dpy_native,
- (EGLSync)sync_native,
- (EGLint)flags
+ (EGLImage)image_native
);
return (jboolean)_returnValue;
}
@@ -547,6 +554,8 @@ static const JNINativeMethod methods[] = {
{"eglCreatePlatformWindowSurface", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;Ljava/nio/Buffer;[JI)Landroid/opengl/EGLSurface;", (void *) android_eglCreatePlatformWindowSurface },
{"eglCreatePlatformPixmapSurface", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;Ljava/nio/Buffer;[JI)Landroid/opengl/EGLSurface;", (void *) android_eglCreatePlatformPixmapSurface },
{"eglWaitSync", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLSync;I)Z", (void *) android_eglWaitSync },
+{"eglCreateImage", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLContext;IJ[JI)Landroid/opengl/EGLImage;", (void *) android_eglCreateImage },
+{"eglDestroyImage", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLImage;)Z", (void *) android_eglDestroyImage },
};
int register_android_opengl_jni_EGL15(JNIEnv *_env)
diff --git a/opengl/java/android/opengl/EGL15.java b/opengl/java/android/opengl/EGL15.java
index 9aae6ad0f080..f855fe2591e1 100644
--- a/opengl/java/android/opengl/EGL15.java
+++ b/opengl/java/android/opengl/EGL15.java
@@ -146,4 +146,22 @@ public class EGL15 {
int flags
);
+ // C function EGLImage eglCreateImage ( EGLDisplay dpy, EGLContext context, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list )
+
+ public static native EGLImage eglCreateImage(
+ EGLDisplay dpy,
+ EGLContext context,
+ int target,
+ long buffer,
+ long[] attrib_list,
+ int offset
+ );
+
+ // C function EGLBoolean eglDestroyImage ( EGLDisplay dpy, EGLImage image )
+
+ public static native boolean eglDestroyImage(
+ EGLDisplay dpy,
+ EGLImage image
+ );
+
}