You've already forked android_translation_layer
mirror of
https://gitlab.com/android_translation_layer/android_translation_layer.git
synced 2025-10-27 11:48:10 -07:00
EGLImpl: eglCreateContext: properly handle shared_context
This commit is contained in:
@@ -12,7 +12,7 @@ static jint* get_int_array_crit(JNIEnv *env, jintArray array) {
|
||||
if (array != NULL) {
|
||||
return (jint *)(*env)->GetPrimitiveArrayCritical(env, array, (jboolean *)0);
|
||||
} else {
|
||||
return(jint*) NULL; // FIXME - do apps expect us to use some default?
|
||||
return (jint *)NULL; // FIXME - do apps expect us to use some default?
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,13 +38,13 @@ static void release_long_array_crit(JNIEnv *env, jlongArray array, jlong* base)
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_com_google_android_gles_1jni_EGLImpl_native_1eglCreateContext(JNIEnv *env, jobject this, jlong egl_display, jlong egl_config, jobject share_context, jintArray attrib_list)
|
||||
JNIEXPORT jlong JNICALL Java_com_google_android_gles_1jni_EGLImpl_native_1eglCreateContext(JNIEnv *env, jobject this, jlong egl_display, jlong egl_config, jlong share_context, jintArray attrib_list)
|
||||
{
|
||||
printf("env: %p, this: %p, egl_display: %p, egl_config: %p, share_context: %p, attrib_list: %p\n", env, this, _PTR(egl_display), _PTR(egl_config), share_context, attrib_list);
|
||||
printf("env: %p, this: %p, egl_display: %p, egl_config: %p, share_context: %p, attrib_list: %p\n", env, this, _PTR(egl_display), _PTR(egl_config), _PTR(share_context), attrib_list);
|
||||
|
||||
jint* attrib_base = get_int_array_crit(env, attrib_list);
|
||||
jint *attrib_base = get_int_array_crit(env, attrib_list);
|
||||
|
||||
EGLContext egl_context = eglCreateContext(_PTR(egl_display), _PTR(egl_config), NULL, attrib_base);
|
||||
EGLContext egl_context = eglCreateContext(_PTR(egl_display), _PTR(egl_config), _PTR(share_context), attrib_base);
|
||||
printf("egl_context: %p\n", egl_context);
|
||||
|
||||
release_int_array_crit(env, attrib_list, attrib_base);
|
||||
|
||||
@@ -10,10 +10,10 @@ extern "C" {
|
||||
/*
|
||||
* Class: com_google_android_gles_jni_EGLImpl
|
||||
* Method: native_eglCreateContext
|
||||
* Signature: (JJLjavax/microedition/khronos/egl/EGLContext;[I)J
|
||||
* Signature: (JJJ[I)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_com_google_android_gles_1jni_EGLImpl_native_1eglCreateContext
|
||||
(JNIEnv *, jobject, jlong, jlong, jobject, jintArray);
|
||||
(JNIEnv *, jobject, jlong, jlong, jlong, jintArray);
|
||||
|
||||
/*
|
||||
* Class: com_google_android_gles_jni_EGLImpl
|
||||
|
||||
@@ -22,10 +22,10 @@ import android.view.SurfaceView;
|
||||
import javax.microedition.khronos.egl.*;
|
||||
|
||||
public class EGLImpl implements EGL10 {
|
||||
private native long native_eglCreateContext(long egl_display, long egl_config, EGLContext share_context, int[] attrib_list);
|
||||
private native long native_eglCreateContext(long egl_display, long egl_config, long share_context, int[] attrib_list);
|
||||
|
||||
public EGLContext eglCreateContext(EGLDisplay display, EGLConfig config, EGLContext share_context, int[] attrib_list) {
|
||||
long native_egl_context = native_eglCreateContext(display.native_egl_display, config.native_egl_config, share_context, attrib_list);
|
||||
long native_egl_context = native_eglCreateContext(display.native_egl_display, config.native_egl_config, (share_context != null) ? share_context.native_egl_context : 0, attrib_list);
|
||||
if (native_egl_context == 0) {
|
||||
return EGL10.EGL_NO_CONTEXT;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user