summaryrefslogtreecommitdiffstats
path: root/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'opengl')
-rw-r--r--opengl/include/EGL/eglext.h5
-rw-r--r--opengl/libagl/egl.cpp35
-rw-r--r--opengl/libs/Android.mk6
-rw-r--r--opengl/libs/EGL/egl.cpp38
-rw-r--r--opengl/libs/EGL/eglApi.cpp249
-rw-r--r--opengl/libs/EGL/egl_entries.in24
-rw-r--r--opengl/libs/EGL/egl_object.cpp11
-rw-r--r--opengl/libs/EGL/egl_object.h2
-rw-r--r--opengl/libs/GLES2/gl2.cpp78
-rw-r--r--opengl/libs/GLES2/gl2_api.in10
-rw-r--r--opengl/libs/egl_impl.h3
-rw-r--r--opengl/tools/glgen/src/JType.java78
-rw-r--r--opengl/tools/glgen/src/JniCodeEmitter.java76
-rwxr-xr-xopengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp5
-rw-r--r--opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp8
-rw-r--r--opengl/tools/glgen/stubs/gles11/common.cpp134
-rw-r--r--opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp1
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp64
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp64
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp9
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetBooleanv.cpp6
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetFloatv.cpp6
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetIntegerv.cpp7
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp16
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp64
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetUniformIndices.cpp18
-rwxr-xr-xopengl/tools/glgen2/glgen.py28
27 files changed, 852 insertions, 193 deletions
diff --git a/opengl/include/EGL/eglext.h b/opengl/include/EGL/eglext.h
index 25f7607..b2abdb1 100644
--- a/opengl/include/EGL/eglext.h
+++ b/opengl/include/EGL/eglext.h
@@ -444,6 +444,11 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC)(EGLDisplay dpy, E
#define EGL_OPENGL_ES3_BIT_KHR 0x00000040
#endif
+#ifndef EGL_KHR_create_context_no_error
+#define EGL_KHR_create_context_no_error 1
+#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31B3
+#endif /* EGL_KHR_create_context_no_error */
+
#ifndef EGL_KHR_surfaceless_context
#define EGL_KHR_surfaceless_context 1
/* No tokens/entry points, just relaxes an error condition */
diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp
index 1feac8b..593d0c2 100644
--- a/opengl/libagl/egl.cpp
+++ b/opengl/libagl/egl.cpp
@@ -394,7 +394,13 @@ EGLBoolean egl_window_surface_v2_t::connect()
depth.width = width;
depth.height = height;
depth.stride = depth.width; // use the width here
- depth.data = (GGLubyte*)malloc(depth.stride*depth.height*2);
+ uint64_t allocSize = static_cast<uint64_t>(depth.stride) *
+ static_cast<uint64_t>(depth.height) * 2;
+ if (depth.stride < 0 || depth.height > INT_MAX ||
+ allocSize > UINT32_MAX) {
+ return setError(EGL_BAD_ALLOC, EGL_FALSE);
+ }
+ depth.data = (GGLubyte*)malloc(allocSize);
if (depth.data == 0) {
return setError(EGL_BAD_ALLOC, EGL_FALSE);
}
@@ -548,7 +554,14 @@ EGLBoolean egl_window_surface_v2_t::swapBuffers()
depth.width = width;
depth.height = height;
depth.stride = buffer->stride;
- depth.data = (GGLubyte*)malloc(depth.stride*depth.height*2);
+ uint64_t allocSize = static_cast<uint64_t>(depth.stride) *
+ static_cast<uint64_t>(depth.height) * 2;
+ if (depth.stride < 0 || depth.height > INT_MAX ||
+ allocSize > UINT32_MAX) {
+ setError(EGL_BAD_ALLOC, EGL_FALSE);
+ return EGL_FALSE;
+ }
+ depth.data = (GGLubyte*)malloc(allocSize);
if (depth.data == 0) {
setError(EGL_BAD_ALLOC, EGL_FALSE);
return EGL_FALSE;
@@ -666,7 +679,14 @@ egl_pixmap_surface_t::egl_pixmap_surface_t(EGLDisplay dpy,
depth.width = pixmap->width;
depth.height = pixmap->height;
depth.stride = depth.width; // use the width here
- depth.data = (GGLubyte*)malloc(depth.stride*depth.height*2);
+ uint64_t allocSize = static_cast<uint64_t>(depth.stride) *
+ static_cast<uint64_t>(depth.height) * 2;
+ if (depth.stride < 0 || depth.height > INT_MAX ||
+ allocSize > UINT32_MAX) {
+ setError(EGL_BAD_ALLOC, EGL_NO_SURFACE);
+ return;
+ }
+ depth.data = (GGLubyte*)malloc(allocSize);
if (depth.data == 0) {
setError(EGL_BAD_ALLOC, EGL_NO_SURFACE);
}
@@ -746,7 +766,14 @@ egl_pbuffer_surface_t::egl_pbuffer_surface_t(EGLDisplay dpy,
depth.width = pbuffer.width;
depth.height = pbuffer.height;
depth.stride = depth.width; // use the width here
- depth.data = (GGLubyte*)malloc(depth.stride*depth.height*2);
+ uint64_t allocSize = static_cast<uint64_t>(depth.stride) *
+ static_cast<uint64_t>(depth.height) * 2;
+ if (depth.stride < 0 || depth.height > INT_MAX ||
+ allocSize > UINT32_MAX) {
+ setError(EGL_BAD_ALLOC, EGL_NO_SURFACE);
+ return;
+ }
+ depth.data = (GGLubyte*)malloc(allocSize);
if (depth.data == 0) {
setError(EGL_BAD_ALLOC, EGL_NO_SURFACE);
return;
diff --git a/opengl/libs/Android.mk b/opengl/libs/Android.mk
index 4da9f92..18ad300 100644
--- a/opengl/libs/Android.mk
+++ b/opengl/libs/Android.mk
@@ -86,6 +86,9 @@ LOCAL_CFLAGS += -DLOG_TAG=\"libGLESv1\"
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
LOCAL_CFLAGS += -fvisibility=hidden
+# TODO: This is to work around b/20093774. Remove after root cause is fixed
+LOCAL_LDFLAGS_arm += -Wl,--hash-style,both
+
include $(BUILD_SHARED_LIBRARY)
@@ -111,6 +114,9 @@ LOCAL_CFLAGS += -DLOG_TAG=\"libGLESv2\"
LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
LOCAL_CFLAGS += -fvisibility=hidden
+# TODO: This is to work around b/20093774. Remove after root cause is fixed
+LOCAL_LDFLAGS_arm += -Wl,--hash-style,both
+
# Symlink libGLESv3.so -> libGLESv2.so
# Platform modules should link against libGLESv2.so (-lGLESv2), but NDK apps
# will be linked against libGLESv3.so.
diff --git a/opengl/libs/EGL/egl.cpp b/opengl/libs/EGL/egl.cpp
index 7c70fa0..4e0e5bc 100644
--- a/opengl/libs/EGL/egl.cpp
+++ b/opengl/libs/EGL/egl.cpp
@@ -292,6 +292,44 @@ const GLubyte * egl_get_string_for_current_context(GLenum name) {
return (const GLubyte *)c->gl_extensions.string();
}
+const GLubyte * egl_get_string_for_current_context(GLenum name, GLuint index) {
+ // NOTE: returning NULL here will fall-back to the default
+ // implementation.
+
+ EGLContext context = egl_tls_t::getContext();
+ if (context == EGL_NO_CONTEXT)
+ return NULL;
+
+ egl_context_t const * const c = get_context(context);
+ if (c == NULL) // this should never happen, by construction
+ return NULL;
+
+ if (name != GL_EXTENSIONS)
+ return NULL;
+
+ // if index is out of bounds, assume it will be in the default
+ // implementation too, so we don't have to generate a GL error here
+ if (index >= c->tokenized_gl_extensions.size())
+ return NULL;
+
+ return (const GLubyte *)c->tokenized_gl_extensions.itemAt(index).string();
+}
+
+GLint egl_get_num_extensions_for_current_context() {
+ // NOTE: returning -1 here will fall-back to the default
+ // implementation.
+
+ EGLContext context = egl_tls_t::getContext();
+ if (context == EGL_NO_CONTEXT)
+ return -1;
+
+ egl_context_t const * const c = get_context(context);
+ if (c == NULL) // this should never happen, by construction
+ return -1;
+
+ return (GLint)c->tokenized_gl_extensions.size();
+}
+
// ----------------------------------------------------------------------------
// this mutex protects:
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index f5b90dd..8378907 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -91,11 +91,19 @@ extern char const * const gExtensionString =
"EGL_KHR_gl_colorspace "
#endif
"EGL_KHR_gl_texture_2D_image "
+ "EGL_KHR_gl_texture_3D_image "
"EGL_KHR_gl_texture_cubemap_image "
"EGL_KHR_gl_renderbuffer_image "
"EGL_KHR_reusable_sync "
"EGL_KHR_fence_sync "
"EGL_KHR_create_context "
+ "EGL_KHR_config_attribs "
+ "EGL_KHR_surfaceless_context "
+ "EGL_KHR_stream "
+ "EGL_KHR_stream_fifo "
+ "EGL_KHR_stream_producer_eglsurface "
+ "EGL_KHR_stream_consumer_gltexture "
+ "EGL_KHR_stream_cross_process_fd "
"EGL_EXT_create_context_robustness "
"EGL_NV_system_time "
"EGL_ANDROID_image_native_buffer " // mandatory
@@ -103,6 +111,7 @@ extern char const * const gExtensionString =
"EGL_ANDROID_recordable " // mandatory
"EGL_KHR_partial_update " // strongly recommended
"EGL_EXT_buffer_age " // strongly recommended with partial_update
+ "EGL_KHR_create_context_no_error "
;
// extensions not exposed to applications but used by the ANDROID system
@@ -163,6 +172,31 @@ static const extention_map_t sExtensionMap[] = {
// EGL_KHR_partial_update
{ "eglSetDamageRegionKHR",
(__eglMustCastToProperFunctionPointerType)&eglSetDamageRegionKHR },
+
+ { "eglCreateStreamKHR",
+ (__eglMustCastToProperFunctionPointerType)&eglCreateStreamKHR },
+ { "eglDestroyStreamKHR",
+ (__eglMustCastToProperFunctionPointerType)&eglDestroyStreamKHR },
+ { "eglStreamAttribKHR",
+ (__eglMustCastToProperFunctionPointerType)&eglStreamAttribKHR },
+ { "eglQueryStreamKHR",
+ (__eglMustCastToProperFunctionPointerType)&eglQueryStreamKHR },
+ { "eglQueryStreamu64KHR",
+ (__eglMustCastToProperFunctionPointerType)&eglQueryStreamu64KHR },
+ { "eglQueryStreamTimeKHR",
+ (__eglMustCastToProperFunctionPointerType)&eglQueryStreamTimeKHR },
+ { "eglCreateStreamProducerSurfaceKHR",
+ (__eglMustCastToProperFunctionPointerType)&eglCreateStreamProducerSurfaceKHR },
+ { "eglStreamConsumerGLTextureExternalKHR",
+ (__eglMustCastToProperFunctionPointerType)&eglStreamConsumerGLTextureExternalKHR },
+ { "eglStreamConsumerAcquireKHR",
+ (__eglMustCastToProperFunctionPointerType)&eglStreamConsumerAcquireKHR },
+ { "eglStreamConsumerReleaseKHR",
+ (__eglMustCastToProperFunctionPointerType)&eglStreamConsumerReleaseKHR },
+ { "eglGetStreamFileDescriptorKHR",
+ (__eglMustCastToProperFunctionPointerType)&eglGetStreamFileDescriptorKHR },
+ { "eglCreateStreamFromFileDescriptorKHR",
+ (__eglMustCastToProperFunctionPointerType)&eglCreateStreamFromFileDescriptorKHR },
};
/*
@@ -561,6 +595,15 @@ EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
return setError(EGL_BAD_SURFACE, EGL_FALSE);
egl_surface_t * const s = get_surface(surface);
+ ANativeWindow* window = s->win.get();
+ if (window) {
+ int result = native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL);
+ if (result != OK) {
+ ALOGE("eglDestroySurface: native_window_api_disconnect (win=%p) "
+ "failed (%#x)",
+ window, result);
+ }
+ }
EGLBoolean result = s->cnx->egl.eglDestroySurface(dp->disp.dpy, s->surface);
if (result == EGL_TRUE) {
_s.terminate();
@@ -1517,6 +1560,212 @@ EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync,
return result;
}
+EGLStreamKHR eglCreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list)
+{
+ clearError();
+
+ const egl_display_ptr dp = validate_display(dpy);
+ if (!dp) return EGL_NO_STREAM_KHR;
+
+ EGLStreamKHR result = EGL_NO_STREAM_KHR;
+ egl_connection_t* const cnx = &gEGLImpl;
+ if (cnx->dso && cnx->egl.eglCreateStreamKHR) {
+ result = cnx->egl.eglCreateStreamKHR(
+ dp->disp.dpy, attrib_list);
+ }
+ return result;
+}
+
+EGLBoolean eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream)
+{
+ clearError();
+
+ const egl_display_ptr dp = validate_display(dpy);
+ if (!dp) return EGL_FALSE;
+
+ EGLBoolean result = EGL_FALSE;
+ egl_connection_t* const cnx = &gEGLImpl;
+ if (cnx->dso && cnx->egl.eglDestroyStreamKHR) {
+ result = cnx->egl.eglDestroyStreamKHR(
+ dp->disp.dpy, stream);
+ }
+ return result;
+}
+
+EGLBoolean eglStreamAttribKHR(EGLDisplay dpy, EGLStreamKHR stream,
+ EGLenum attribute, EGLint value)
+{
+ clearError();
+
+ const egl_display_ptr dp = validate_display(dpy);
+ if (!dp) return EGL_FALSE;
+
+ EGLBoolean result = EGL_FALSE;
+ egl_connection_t* const cnx = &gEGLImpl;
+ if (cnx->dso && cnx->egl.eglStreamAttribKHR) {
+ result = cnx->egl.eglStreamAttribKHR(
+ dp->disp.dpy, stream, attribute, value);
+ }
+ return result;
+}
+
+EGLBoolean eglQueryStreamKHR(EGLDisplay dpy, EGLStreamKHR stream,
+ EGLenum attribute, EGLint *value)
+{
+ clearError();
+
+ const egl_display_ptr dp = validate_display(dpy);
+ if (!dp) return EGL_FALSE;
+
+ EGLBoolean result = EGL_FALSE;
+ egl_connection_t* const cnx = &gEGLImpl;
+ if (cnx->dso && cnx->egl.eglQueryStreamKHR) {
+ result = cnx->egl.eglQueryStreamKHR(
+ dp->disp.dpy, stream, attribute, value);
+ }
+ return result;
+}
+
+EGLBoolean eglQueryStreamu64KHR(EGLDisplay dpy, EGLStreamKHR stream,
+ EGLenum attribute, EGLuint64KHR *value)
+{
+ clearError();
+
+ const egl_display_ptr dp = validate_display(dpy);
+ if (!dp) return EGL_FALSE;
+
+ EGLBoolean result = EGL_FALSE;
+ egl_connection_t* const cnx = &gEGLImpl;
+ if (cnx->dso && cnx->egl.eglQueryStreamu64KHR) {
+ result = cnx->egl.eglQueryStreamu64KHR(
+ dp->disp.dpy, stream, attribute, value);
+ }
+ return result;
+}
+
+EGLBoolean eglQueryStreamTimeKHR(EGLDisplay dpy, EGLStreamKHR stream,
+ EGLenum attribute, EGLTimeKHR *value)
+{
+ clearError();
+
+ const egl_display_ptr dp = validate_display(dpy);
+ if (!dp) return EGL_FALSE;
+
+ EGLBoolean result = EGL_FALSE;
+ egl_connection_t* const cnx = &gEGLImpl;
+ if (cnx->dso && cnx->egl.eglQueryStreamTimeKHR) {
+ result = cnx->egl.eglQueryStreamTimeKHR(
+ dp->disp.dpy, stream, attribute, value);
+ }
+ return result;
+}
+
+EGLSurface eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy, EGLConfig config,
+ EGLStreamKHR stream, const EGLint *attrib_list)
+{
+ clearError();
+
+ egl_display_ptr dp = validate_display(dpy);
+ if (!dp) return EGL_NO_SURFACE;
+
+ egl_connection_t* const cnx = &gEGLImpl;
+ if (cnx->dso && cnx->egl.eglCreateStreamProducerSurfaceKHR) {
+ EGLSurface surface = cnx->egl.eglCreateStreamProducerSurfaceKHR(
+ dp->disp.dpy, config, stream, attrib_list);
+ if (surface != EGL_NO_SURFACE) {
+ egl_surface_t* s = new egl_surface_t(dp.get(), config, NULL,
+ surface, cnx);
+ return s;
+ }
+ }
+ return EGL_NO_SURFACE;
+}
+
+EGLBoolean eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy,
+ EGLStreamKHR stream)
+{
+ clearError();
+
+ const egl_display_ptr dp = validate_display(dpy);
+ if (!dp) return EGL_FALSE;
+
+ EGLBoolean result = EGL_FALSE;
+ egl_connection_t* const cnx = &gEGLImpl;
+ if (cnx->dso && cnx->egl.eglStreamConsumerGLTextureExternalKHR) {
+ result = cnx->egl.eglStreamConsumerGLTextureExternalKHR(
+ dp->disp.dpy, stream);
+ }
+ return result;
+}
+
+EGLBoolean eglStreamConsumerAcquireKHR(EGLDisplay dpy,
+ EGLStreamKHR stream)
+{
+ clearError();
+
+ const egl_display_ptr dp = validate_display(dpy);
+ if (!dp) return EGL_FALSE;
+
+ EGLBoolean result = EGL_FALSE;
+ egl_connection_t* const cnx = &gEGLImpl;
+ if (cnx->dso && cnx->egl.eglStreamConsumerAcquireKHR) {
+ result = cnx->egl.eglStreamConsumerAcquireKHR(
+ dp->disp.dpy, stream);
+ }
+ return result;
+}
+
+EGLBoolean eglStreamConsumerReleaseKHR(EGLDisplay dpy,
+ EGLStreamKHR stream)
+{
+ clearError();
+
+ const egl_display_ptr dp = validate_display(dpy);
+ if (!dp) return EGL_FALSE;
+
+ EGLBoolean result = EGL_FALSE;
+ egl_connection_t* const cnx = &gEGLImpl;
+ if (cnx->dso && cnx->egl.eglStreamConsumerReleaseKHR) {
+ result = cnx->egl.eglStreamConsumerReleaseKHR(
+ dp->disp.dpy, stream);
+ }
+ return result;
+}
+
+EGLNativeFileDescriptorKHR eglGetStreamFileDescriptorKHR(
+ EGLDisplay dpy, EGLStreamKHR stream)
+{
+ clearError();
+
+ const egl_display_ptr dp = validate_display(dpy);
+ if (!dp) return EGL_NO_FILE_DESCRIPTOR_KHR;
+
+ EGLNativeFileDescriptorKHR result = EGL_NO_FILE_DESCRIPTOR_KHR;
+ egl_connection_t* const cnx = &gEGLImpl;
+ if (cnx->dso && cnx->egl.eglGetStreamFileDescriptorKHR) {
+ result = cnx->egl.eglGetStreamFileDescriptorKHR(
+ dp->disp.dpy, stream);
+ }
+ return result;
+}
+
+EGLStreamKHR eglCreateStreamFromFileDescriptorKHR(
+ EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor)
+{
+ clearError();
+
+ const egl_display_ptr dp = validate_display(dpy);
+ if (!dp) return EGL_NO_STREAM_KHR;
+
+ EGLStreamKHR result = EGL_NO_STREAM_KHR;
+ egl_connection_t* const cnx = &gEGLImpl;
+ if (cnx->dso && cnx->egl.eglCreateStreamFromFileDescriptorKHR) {
+ result = cnx->egl.eglCreateStreamFromFileDescriptorKHR(
+ dp->disp.dpy, file_descriptor);
+ }
+ return result;
+}
+
// ----------------------------------------------------------------------------
// EGL_EGLEXT_VERSION 15
// ----------------------------------------------------------------------------
diff --git a/opengl/libs/EGL/egl_entries.in b/opengl/libs/EGL/egl_entries.in
index 1e27cb6..498b2fc 100644
--- a/opengl/libs/EGL/egl_entries.in
+++ b/opengl/libs/EGL/egl_entries.in
@@ -61,18 +61,18 @@ EGL_ENTRY(EGLBoolean, eglGetSyncAttribKHR, EGLDisplay, EGLSyncKHR, EGLint,
/* EGL_EGLEXT_VERSION 15 */
-// EGL_ENTRY(EGLStreamKHR, eglCreateStreamKHR, EGLDisplay, const EGLint *)
-// EGL_ENTRY(EGLBoolean, eglDestroyStreamKHR, EGLDisplay, EGLStreamKHR)
-// EGL_ENTRY(EGLBoolean, eglStreamAttribKHR, EGLDisplay, EGLStreamKHR, EGLenum, EGLint)
-// EGL_ENTRY(EGLBoolean, eglQueryStreamKHR, EGLDisplay, EGLStreamKHR, EGLenum, EGLint *)
-// EGL_ENTRY(EGLBoolean, eglQueryStreamu64KHR, EGLDisplay, EGLStreamKHR, EGLenum, EGLuint64KHR *)
-// EGL_ENTRY(EGLBoolean, eglStreamConsumerGLTextureExternalKHR, EGLDisplay, EGLStreamKHR)
-// EGL_ENTRY(EGLBoolean, eglStreamConsumerAcquireKHR, EGLDisplay, EGLStreamKHR)
-// EGL_ENTRY(EGLBoolean, eglStreamConsumerReleaseKHR, EGLDisplay, EGLStreamKHR)
-// EGL_ENTRY(EGLSurface, eglCreateStreamProducerSurfaceKHR, EGLDisplay, EGLConfig, EGLStreamKHR, const EGLint *)
-// EGL_ENTRY(EGLBoolean, eglQueryStreamTimeKHR, EGLDisplay, EGLStreamKHR, EGLenum, EGLTimeKHR*)
-// EGL_ENTRY(EGLNativeFileDescriptorKHR, eglGetStreamFileDescriptorKHR, EGLDisplay, EGLStreamKHR)
-// EGL_ENTRY(EGLStreamKHR, eglCreateStreamFromFileDescriptorKHR, EGLDisplay, EGLNativeFileDescriptorKHR)
+EGL_ENTRY(EGLStreamKHR, eglCreateStreamKHR, EGLDisplay, const EGLint *)
+EGL_ENTRY(EGLBoolean, eglDestroyStreamKHR, EGLDisplay, EGLStreamKHR)
+EGL_ENTRY(EGLBoolean, eglStreamAttribKHR, EGLDisplay, EGLStreamKHR, EGLenum, EGLint)
+EGL_ENTRY(EGLBoolean, eglQueryStreamKHR, EGLDisplay, EGLStreamKHR, EGLenum, EGLint *)
+EGL_ENTRY(EGLBoolean, eglQueryStreamu64KHR, EGLDisplay, EGLStreamKHR, EGLenum, EGLuint64KHR *)
+EGL_ENTRY(EGLBoolean, eglStreamConsumerGLTextureExternalKHR, EGLDisplay, EGLStreamKHR)
+EGL_ENTRY(EGLBoolean, eglStreamConsumerAcquireKHR, EGLDisplay, EGLStreamKHR)
+EGL_ENTRY(EGLBoolean, eglStreamConsumerReleaseKHR, EGLDisplay, EGLStreamKHR)
+EGL_ENTRY(EGLSurface, eglCreateStreamProducerSurfaceKHR, EGLDisplay, EGLConfig, EGLStreamKHR, const EGLint *)
+EGL_ENTRY(EGLBoolean, eglQueryStreamTimeKHR, EGLDisplay, EGLStreamKHR, EGLenum, EGLTimeKHR*)
+EGL_ENTRY(EGLNativeFileDescriptorKHR, eglGetStreamFileDescriptorKHR, EGLDisplay, EGLStreamKHR)
+EGL_ENTRY(EGLStreamKHR, eglCreateStreamFromFileDescriptorKHR, EGLDisplay, EGLNativeFileDescriptorKHR)
EGL_ENTRY(EGLint, eglWaitSyncKHR, EGLDisplay, EGLSyncKHR, EGLint)
/* ANDROID extensions */
diff --git a/opengl/libs/EGL/egl_object.cpp b/opengl/libs/EGL/egl_object.cpp
index d3ee76d..918faa8 100644
--- a/opengl/libs/EGL/egl_object.cpp
+++ b/opengl/libs/EGL/egl_object.cpp
@@ -14,6 +14,9 @@
** limitations under the License.
*/
+#include <string>
+#include <sstream>
+
#include <ctype.h>
#include <stdint.h>
#include <stdlib.h>
@@ -113,6 +116,14 @@ void egl_context_t::onMakeCurrent(EGLSurface draw, EGLSurface read) {
temp.append(gl_extensions);
gl_extensions.setTo(temp);
}
+
+ // tokenize the supported extensions for the glGetStringi() wrapper
+ std::stringstream ss;
+ std::string str;
+ ss << gl_extensions.string();
+ while (ss >> str) {
+ tokenized_gl_extensions.push(String8(str.c_str()));
+ }
}
}
diff --git a/opengl/libs/EGL/egl_object.h b/opengl/libs/EGL/egl_object.h
index 518fdec..f5a9f58 100644
--- a/opengl/libs/EGL/egl_object.h
+++ b/opengl/libs/EGL/egl_object.h
@@ -27,6 +27,7 @@
#include <utils/threads.h>
#include <utils/String8.h>
+#include <utils/Vector.h>
#include <system/window.h>
@@ -159,6 +160,7 @@ public:
egl_connection_t const* cnx;
int version;
String8 gl_extensions;
+ Vector<String8> tokenized_gl_extensions;
};
// ----------------------------------------------------------------------------
diff --git a/opengl/libs/GLES2/gl2.cpp b/opengl/libs/GLES2/gl2.cpp
index d5dc012..6034a8e 100644
--- a/opengl/libs/GLES2/gl2.cpp
+++ b/opengl/libs/GLES2/gl2.cpp
@@ -205,13 +205,22 @@ extern "C" {
#undef CALL_GL_API_RETURN
/*
- * glGetString() is special because we expose some extensions in the wrapper
+ * glGetString() and glGetStringi() are special because we expose some
+ * extensions in the wrapper. Also, wrapping glGetXXX() is required because
+ * the value returned for GL_NUM_EXTENSIONS may have been altered by the
+ * injection of the additional extensions.
*/
-extern "C" const GLubyte * __glGetString(GLenum name);
+extern "C" {
+ const GLubyte * __glGetString(GLenum name);
+ const GLubyte * __glGetStringi(GLenum name, GLuint index);
+ void __glGetBooleanv(GLenum pname, GLboolean * data);
+ void __glGetFloatv(GLenum pname, GLfloat * data);
+ void __glGetIntegerv(GLenum pname, GLint * data);
+ void __glGetInteger64v(GLenum pname, GLint64 * data);
+}
-const GLubyte * glGetString(GLenum name)
-{
+const GLubyte * glGetString(GLenum name) {
const GLubyte * ret = egl_get_string_for_current_context(name);
if (ret == NULL) {
gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl;
@@ -219,3 +228,64 @@ const GLubyte * glGetString(GLenum name)
}
return ret;
}
+
+const GLubyte * glGetStringi(GLenum name, GLuint index) {
+ const GLubyte * ret = egl_get_string_for_current_context(name, index);
+ if (ret == NULL) {
+ gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl;
+ if(_c) ret = _c->glGetStringi(name, index);
+ }
+ return ret;
+}
+
+void glGetBooleanv(GLenum pname, GLboolean * data) {
+ if (pname == GL_NUM_EXTENSIONS) {
+ int num_exts = egl_get_num_extensions_for_current_context();
+ if (num_exts >= 0) {
+ *data = num_exts > 0 ? GL_TRUE : GL_FALSE;
+ return;
+ }
+ }
+
+ gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl;
+ if (_c) _c->glGetBooleanv(pname, data);
+}
+
+void glGetFloatv(GLenum pname, GLfloat * data) {
+ if (pname == GL_NUM_EXTENSIONS) {
+ int num_exts = egl_get_num_extensions_for_current_context();
+ if (num_exts >= 0) {
+ *data = (GLfloat)num_exts;
+ return;
+ }
+ }
+
+ gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl;
+ if (_c) _c->glGetFloatv(pname, data);
+}
+
+void glGetIntegerv(GLenum pname, GLint * data) {
+ if (pname == GL_NUM_EXTENSIONS) {
+ int num_exts = egl_get_num_extensions_for_current_context();
+ if (num_exts >= 0) {
+ *data = (GLint)num_exts;
+ return;
+ }
+ }
+
+ gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl;
+ if (_c) _c->glGetIntegerv(pname, data);
+}
+
+void glGetInteger64v(GLenum pname, GLint64 * data) {
+ if (pname == GL_NUM_EXTENSIONS) {
+ int num_exts = egl_get_num_extensions_for_current_context();
+ if (num_exts >= 0) {
+ *data = (GLint64)num_exts;
+ return;
+ }
+ }
+
+ gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl;
+ if (_c) _c->glGetInteger64v(pname, data);
+}
diff --git a/opengl/libs/GLES2/gl2_api.in b/opengl/libs/GLES2/gl2_api.in
index 8363960..09d8b00 100644
--- a/opengl/libs/GLES2/gl2_api.in
+++ b/opengl/libs/GLES2/gl2_api.in
@@ -172,7 +172,7 @@ void API_ENTRY(glGetAttachedShaders)(GLuint program, GLsizei maxCount, GLsizei *
GLint API_ENTRY(glGetAttribLocation)(GLuint program, const GLchar * name) {
CALL_GL_API_RETURN(glGetAttribLocation, program, name);
}
-void API_ENTRY(glGetBooleanv)(GLenum pname, GLboolean * data) {
+void API_ENTRY(__glGetBooleanv)(GLenum pname, GLboolean * data) {
CALL_GL_API(glGetBooleanv, pname, data);
}
void API_ENTRY(glGetBufferParameteriv)(GLenum target, GLenum pname, GLint * params) {
@@ -181,13 +181,13 @@ void API_ENTRY(glGetBufferParameteriv)(GLenum target, GLenum pname, GLint * para
GLenum API_ENTRY(glGetError)(void) {
CALL_GL_API_RETURN(glGetError);
}
-void API_ENTRY(glGetFloatv)(GLenum pname, GLfloat * data) {
+void API_ENTRY(__glGetFloatv)(GLenum pname, GLfloat * data) {
CALL_GL_API(glGetFloatv, pname, data);
}
void API_ENTRY(glGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint * params) {
CALL_GL_API(glGetFramebufferAttachmentParameteriv, target, attachment, pname, params);
}
-void API_ENTRY(glGetIntegerv)(GLenum pname, GLint * data) {
+void API_ENTRY(__glGetIntegerv)(GLenum pname, GLint * data) {
CALL_GL_API(glGetIntegerv, pname, data);
}
void API_ENTRY(glGetProgramiv)(GLuint program, GLenum pname, GLint * params) {
@@ -604,7 +604,7 @@ void API_ENTRY(glClearBufferfv)(GLenum buffer, GLint drawbuffer, const GLfloat *
void API_ENTRY(glClearBufferfi)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) {
CALL_GL_API(glClearBufferfi, buffer, drawbuffer, depth, stencil);
}
-const GLubyte * API_ENTRY(glGetStringi)(GLenum name, GLuint index) {
+const GLubyte * API_ENTRY(__glGetStringi)(GLenum name, GLuint index) {
CALL_GL_API_RETURN(glGetStringi, name, index);
}
void API_ENTRY(glCopyBufferSubData)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) {
@@ -649,7 +649,7 @@ GLenum API_ENTRY(glClientWaitSync)(GLsync sync, GLbitfield flags, GLuint64 timeo
void API_ENTRY(glWaitSync)(GLsync sync, GLbitfield flags, GLuint64 timeout) {
CALL_GL_API(glWaitSync, sync, flags, timeout);
}
-void API_ENTRY(glGetInteger64v)(GLenum pname, GLint64 * data) {
+void API_ENTRY(__glGetInteger64v)(GLenum pname, GLint64 * data) {
CALL_GL_API(glGetInteger64v, pname, data);
}
void API_ENTRY(glGetSynciv)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * values) {
diff --git a/opengl/libs/egl_impl.h b/opengl/libs/egl_impl.h
index cb0e908..c0990ec 100644
--- a/opengl/libs/egl_impl.h
+++ b/opengl/libs/egl_impl.h
@@ -30,6 +30,9 @@ namespace android {
// ----------------------------------------------------------------------------
EGLAPI const GLubyte * egl_get_string_for_current_context(GLenum name);
+EGLAPI const GLubyte * egl_get_string_for_current_context(GLenum name,
+ GLuint index);
+EGLAPI GLint egl_get_num_extensions_for_current_context();
// ----------------------------------------------------------------------------
}; // namespace android
diff --git a/opengl/tools/glgen/src/JType.java b/opengl/tools/glgen/src/JType.java
index c6e227e..5803a44 100644
--- a/opengl/tools/glgen/src/JType.java
+++ b/opengl/tools/glgen/src/JType.java
@@ -191,6 +191,84 @@ public class JType {
(baseType.indexOf("Buffer") != -1);
}
+ public JType getArrayTypeForTypedBuffer() {
+ if (!isTypedBuffer()) {
+ throw new RuntimeException("Not typed buffer type " + this);
+ }
+ switch (baseType) {
+ case "java.nio.ByteBuffer":
+ return new JType("byte", false, true);
+ case "java.nio.BooleanBuffer":
+ return new JType("boolean", false, true);
+ case "java.nio.ShortBuffer":
+ return new JType("short", false, true);
+ case "java.nio.CharBuffer":
+ return new JType("char", false, true);
+ case "java.nio.IntBuffer":
+ return new JType("int", false, true);
+ case "java.nio.LongBuffer":
+ return new JType("long", false, true);
+ case "java.nio.FloatBuffer":
+ return new JType("float", false, true);
+ case "java.nio.DoubleBuffer":
+ return new JType("double", false, true);
+ default:
+ throw new RuntimeException("Unknown typed buffer type " + this);
+ }
+ }
+
+ public String getArrayGetterForPrimitiveArray() {
+ if (!isArray() || isClass()) {
+ throw new RuntimeException("Not array type " + this);
+ }
+ switch (baseType) {
+ case "byte":
+ return "GetByteArrayElements";
+ case "boolean":
+ return "GetBooleanArrayElements";
+ case "short":
+ return "GetShortArrayElements";
+ case "char":
+ return "GetCharArrayElements";
+ case "int":
+ return "GetIntArrayElements";
+ case "long":
+ return "GetLongArrayElements";
+ case "float":
+ return "GetFloatArrayElements";
+ case "double":
+ return "GetDoubleArrayElements";
+ default:
+ throw new RuntimeException("Unknown array type " + this);
+ }
+ }
+
+ public String getArrayReleaserForPrimitiveArray() {
+ if (!isArray() || isClass()) {
+ throw new RuntimeException("Not array type " + this);
+ }
+ switch (baseType) {
+ case "byte":
+ return "ReleaseByteArrayElements";
+ case "boolean":
+ return "ReleaseBooleanArrayElements";
+ case "short":
+ return "ReleaseShortArrayElements";
+ case "char":
+ return "ReleaseCharArrayElements";
+ case "int":
+ return "ReleaseIntArrayElements";
+ case "long":
+ return "ReleaseLongArrayElements";
+ case "float":
+ return "ReleaseFloatArrayElements";
+ case "double":
+ return "ReleaseDoubleArrayElements";
+ default:
+ throw new RuntimeException("Unknown array type " + this);
+ }
+ }
+
public boolean isEGLHandle() {
return !isPrimitive() &&
(baseType.startsWith("EGL"));
diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java
index e51b7a2..1bed05b 100644
--- a/opengl/tools/glgen/src/JniCodeEmitter.java
+++ b/opengl/tools/glgen/src/JniCodeEmitter.java
@@ -812,6 +812,7 @@ public class JniCodeEmitter {
List<Integer> stringArgs = new ArrayList<Integer>();
int numBufferArgs = 0;
List<String> bufferArgNames = new ArrayList<String>();
+ List<JType> bufferArgTypes = new ArrayList<JType>();
// Emit JNI signature (arguments)
//
@@ -835,6 +836,7 @@ public class JniCodeEmitter {
int cIndex = jfunc.getArgCIndex(i);
String cname = cfunc.getArgName(cIndex);
bufferArgNames.add(cname);
+ bufferArgTypes.add(jfunc.getArgType(i));
numBufferArgs++;
}
}
@@ -948,12 +950,25 @@ public class JniCodeEmitter {
// Emit a single _array or multiple _XXXArray variables
if (numBufferArgs == 1) {
+ JType bufferType = bufferArgTypes.get(0);
+ if (bufferType.isTypedBuffer()) {
+ String typedArrayType = getJniType(bufferType.getArrayTypeForTypedBuffer());
+ out.println(indent + typedArrayType + " _array = (" + typedArrayType + ") 0;");
+ } else {
out.println(indent + "jarray _array = (jarray) 0;");
- out.println(indent + "jint _bufferOffset = (jint) 0;");
+ }
+ out.println(indent + "jint _bufferOffset = (jint) 0;");
} else {
for (int i = 0; i < numBufferArgs; i++) {
- out.println(indent + "jarray _" + bufferArgNames.get(i) +
- "Array = (jarray) 0;");
+ JType bufferType = bufferArgTypes.get(0);
+ if (bufferType.isTypedBuffer()) {
+ String typedArrayType = getJniType(bufferType.getArrayTypeForTypedBuffer());
+ out.println(indent + typedArrayType + " _" + bufferArgNames.get(i) +
+ "Array = (" + typedArrayType + ") 0;");
+ } else {
+ out.println(indent + "jarray _" + bufferArgNames.get(i) +
+ "Array = (jarray) 0;");
+ }
out.println(indent + "jint _" + bufferArgNames.get(i) +
"BufferOffset = (jint) 0;");
}
@@ -1135,9 +1150,10 @@ public class JniCodeEmitter {
"_base = (" +
cfunc.getArgType(cIndex).getDeclaration() +
")");
+ String arrayGetter = jfunc.getArgType(idx).getArrayGetterForPrimitiveArray();
out.println(indent + " " +
(mUseCPlusPlus ? "_env" : "(*_env)") +
- "->GetPrimitiveArrayCritical(" +
+ "->" + arrayGetter + "(" +
(mUseCPlusPlus ? "" : "_env, ") +
jfunc.getArgName(idx) +
"_ref, (jboolean *)0);");
@@ -1209,7 +1225,7 @@ public class JniCodeEmitter {
cfunc.getArgType(cIndex).getDeclaration() +
")getPointer(_env, " +
cname +
- "_buf, &" + array + ", &" + remaining + ", &" + bufferOffset +
+ "_buf, (jarray*)&" + array + ", &" + remaining + ", &" + bufferOffset +
");");
}
@@ -1244,9 +1260,17 @@ public class JniCodeEmitter {
} else {
out.println(indent + "if (" + cname +" == NULL) {");
}
- out.println(indent + indent + "char * _" + cname + "Base = (char *)_env->GetPrimitiveArrayCritical(" + array + ", (jboolean *) 0);");
- out.println(indent + indent + cname + " = (" +cfunc.getArgType(cIndex).getDeclaration() +") (_" + cname + "Base + " + bufferOffset + ");");
- out.println(indent + "}");
+ JType argType = jfunc.getArgType(idx);
+ if (argType.isTypedBuffer()) {
+ String arrayGetter = argType.getArrayTypeForTypedBuffer().getArrayGetterForPrimitiveArray();
+ out.println(indent + indent + "char * _" + cname + "Base = (char *)_env->" + arrayGetter + "(" + array + ", (jboolean *) 0);");
+ out.println(indent + indent + cname + " = (" +cfunc.getArgType(cIndex).getDeclaration() +") (_" + cname + "Base + " + bufferOffset + ");");
+ out.println(indent + "}");
+ } else {
+ out.println(indent + indent + "char * _" + cname + "Base = (char *)_env->GetPrimitiveArrayCritical(" + array + ", (jboolean *) 0);");
+ out.println(indent + indent + cname + " = (" +cfunc.getArgType(cIndex).getDeclaration() +") (_" + cname + "Base + " + bufferOffset + ");");
+ out.println(indent + "}");
+ }
}
}
@@ -1336,12 +1360,13 @@ public class JniCodeEmitter {
// the need to write back to the Java array
out.println(indent +
"if (" + jfunc.getArgName(idx) + "_base) {");
+ String arrayReleaser = jfunc.getArgType(idx).getArrayReleaserForPrimitiveArray();
out.println(indent + indent +
(mUseCPlusPlus ? "_env" : "(*_env)") +
- "->ReleasePrimitiveArrayCritical(" +
+ "->" + arrayReleaser + "(" +
(mUseCPlusPlus ? "" : "_env, ") +
jfunc.getArgName(idx) + "_ref, " +
- cfunc.getArgName(cIndex) +
+ "(j" + jfunc.getArgType(idx).getBaseType() + "*)" + cfunc.getArgName(cIndex) +
"_base,");
out.println(indent + indent + indent +
(cfunc.getArgType(cIndex).isConst() ?
@@ -1350,17 +1375,32 @@ public class JniCodeEmitter {
out.println(indent + "}");
} else if (jfunc.getArgType(idx).isBuffer()) {
if (! isPointerFunc) {
+ JType argType = jfunc.getArgType(idx);
String array = numBufferArgs <= 1 ? "_array" :
"_" + cfunc.getArgName(cIndex) + "Array";
out.println(indent + "if (" + array + ") {");
- out.println(indent + indent +
- "releasePointer(_env, " + array + ", " +
- cfunc.getArgName(cIndex) +
- ", " +
- (cfunc.getArgType(cIndex).isConst() ?
- "JNI_FALSE" : (emitExceptionCheck ?
- "_exception ? JNI_FALSE : JNI_TRUE" : "JNI_TRUE")) +
- ");");
+ if (argType.isTypedBuffer()) {
+ String arrayReleaser =
+ argType.getArrayTypeForTypedBuffer().getArrayReleaserForPrimitiveArray();
+ out.println(indent + indent +
+ "_env->" + arrayReleaser + "(" + array + ", " +
+ "(j" + argType.getArrayTypeForTypedBuffer().getBaseType() + "*)" +
+ cfunc.getArgName(cIndex) +
+ ", " +
+ (cfunc.getArgType(cIndex).isConst() ?
+ "JNI_ABORT" : (emitExceptionCheck ?
+ "_exception ? JNI_ABORT : 0" : "0")) +
+ ");");
+ } else {
+ out.println(indent + indent +
+ "releasePointer(_env, " + array + ", " +
+ cfunc.getArgName(cIndex) +
+ ", " +
+ (cfunc.getArgType(cIndex).isConst() ?
+ "JNI_FALSE" : (emitExceptionCheck ?
+ "_exception ? JNI_FALSE : JNI_TRUE" : "JNI_TRUE")) +
+ ");");
+ }
out.println(indent + "}");
}
}
diff --git a/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp b/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp
index f09c171..6199637 100755
--- a/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp
+++ b/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp
@@ -27,7 +27,7 @@ android_eglCreatePbufferFromClientBuffer
}
_remaining = _env->GetArrayLength(attrib_list_ref) - offset;
attrib_list_base = (EGLint *)
- _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0);
+ _env->GetIntArrayElements(attrib_list_ref, (jboolean *)0);
attrib_list = attrib_list_base + offset;
attrib_list_sentinel = false;
for (int i = _remaining - 1; i >= 0; i--) {
@@ -53,7 +53,7 @@ android_eglCreatePbufferFromClientBuffer
exit:
if (attrib_list_base) {
- _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base,
+ _env->ReleaseIntArrayElements(attrib_list_ref, attrib_list_base,
JNI_ABORT);
}
if (_exception) {
@@ -71,4 +71,3 @@ android_eglCreatePbufferFromClientBufferInt
}
return android_eglCreatePbufferFromClientBuffer(_env, _this, dpy, buftype, buffer, config, attrib_list_ref, offset);
}
-
diff --git a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp
index 0b6bf58..cc7b85d 100644
--- a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp
+++ b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp
@@ -41,7 +41,7 @@ not_valid_surface:
_remaining = _env->GetArrayLength(attrib_list_ref) - offset;
attrib_list_base = (EGLint *)
- _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0);
+ _env->GetIntArrayElements(attrib_list_ref, (jboolean *)0);
attrib_list = attrib_list_base + offset;
attrib_list_sentinel = 0;
for (int i = _remaining - 1; i >= 0; i--) {
@@ -66,7 +66,7 @@ not_valid_surface:
exit:
if (attrib_list_base) {
- _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base,
+ _env->ReleaseIntArrayElements(attrib_list_ref, attrib_list_base,
JNI_ABORT);
}
if (_exception) {
@@ -123,7 +123,7 @@ not_valid_surface:
_remaining = _env->GetArrayLength(attrib_list_ref) - offset;
attrib_list_base = (EGLint *)
- _env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0);
+ _env->GetIntArrayElements(attrib_list_ref, (jboolean *)0);
attrib_list = attrib_list_base + offset;
attrib_list_sentinel = 0;
for (int i = _remaining - 1; i >= 0; i--) {
@@ -148,7 +148,7 @@ not_valid_surface:
exit:
if (attrib_list_base) {
- _env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base,
+ _env->ReleaseIntArrayElements(attrib_list_ref, attrib_list_base,
JNI_ABORT);
}
if (_exception) {
diff --git a/opengl/tools/glgen/stubs/gles11/common.cpp b/opengl/tools/glgen/stubs/gles11/common.cpp
index f7bcb9d..18ec5e3 100644
--- a/opengl/tools/glgen/stubs/gles11/common.cpp
+++ b/opengl/tools/glgen/stubs/gles11/common.cpp
@@ -100,6 +100,116 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *o
return NULL;
}
+class ByteArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
+ return _env->GetByteArrayElements(array, is_copy);
+ }
+};
+class BooleanArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
+ return _env->GetBooleanArrayElements(array, is_copy);
+ }
+};
+class CharArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
+ return _env->GetCharArrayElements(array, is_copy);
+ }
+};
+class ShortArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
+ return _env->GetShortArrayElements(array, is_copy);
+ }
+};
+class IntArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
+ return _env->GetIntArrayElements(array, is_copy);
+ }
+};
+class LongArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
+ return _env->GetLongArrayElements(array, is_copy);
+ }
+};
+class FloatArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
+ return _env->GetFloatArrayElements(array, is_copy);
+ }
+};
+class DoubleArrayGetter {
+public:
+ static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
+ return _env->GetDoubleArrayElements(array, is_copy);
+ }
+};
+
+template<typename JTYPEARRAY, typename ARRAYGETTER>
+static void*
+getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
+ return ARRAYGETTER::Get(_env, array, is_copy);
+}
+
+class ByteArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
+ _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class BooleanArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
+ _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class CharArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
+ _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class ShortArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
+ _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class IntArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
+ _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class LongArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
+ _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class FloatArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
+ _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+class DoubleArrayReleaser {
+public:
+ static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
+ _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
+ }
+};
+
+template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
+static void
+releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
+ ARRAYRELEASER::Release(_env, array, data, commit);
+}
+
static void
releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
{
@@ -203,7 +313,8 @@ static int getNeededCount(GLint pname) {
return needed;
}
-template <typename JTYPEARRAY, typename CTYPE, void GET(GLenum, CTYPE*)>
+template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
+ typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
static void
get
(JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
@@ -238,8 +349,8 @@ get
_exceptionMessage = "length - offset < needed";
goto exit;
}
- params_base = (CTYPE *)
- _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
+ params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
+ _env, params_ref, (jboolean *)0);
params = params_base + offset;
GET(
@@ -249,8 +360,8 @@ get
exit:
if (params_base) {
- _env->ReleasePrimitiveArrayCritical(params_ref, params_base,
- _exception ? JNI_ABORT: 0);
+ releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
+ _env, params_ref, params_base, !_exception);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
@@ -258,20 +369,21 @@ exit:
}
-template <typename CTYPE, void GET(GLenum, CTYPE*)>
+template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
+ typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
static void
getarray
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
jint _exception = 0;
const char * _exceptionType;
const char * _exceptionMessage;
- jarray _array = (jarray) 0;
+ JTYPEARRAY _array = (JTYPEARRAY) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
CTYPE *params = (CTYPE *) 0;
int _needed = 0;
- params = (CTYPE *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
+ params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
_remaining /= sizeof(CTYPE); // convert from bytes to item count
_needed = getNeededCount(pname);
// if we didn't find this pname, we just assume the user passed
@@ -284,7 +396,8 @@ getarray
goto exit;
}
if (params == NULL) {
- char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
+ _env, _array, (jboolean *) 0);
params = (CTYPE *) (_paramsBase + _bufferOffset);
}
GET(
@@ -294,7 +407,8 @@ getarray
exit:
if (_array) {
- releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
+ releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
+ _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
}
if (_exception) {
jniThrowException(_env, _exceptionType, _exceptionMessage);
diff --git a/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp b/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp
index d844152..86decfb 100644
--- a/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp
@@ -36,4 +36,3 @@ android_glDrawElementsInstanced__IIIII
(GLsizei)instanceCount
);
}
-
diff --git a/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp b/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp
index 7d414d8..a8d63d9 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp
@@ -32,7 +32,7 @@ android_glGetActiveAttrib__III_3II_3II_3II_3BI
}
_lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
length_base = (GLsizei *)
- _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
+ _env->GetIntArrayElements(length_ref, (jboolean *)0);
length = length_base + lengthOffset;
if (!size_ref) {
@@ -49,7 +49,7 @@ android_glGetActiveAttrib__III_3II_3II_3II_3BI
}
_sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
size_base = (GLint *)
- _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
+ _env->GetIntArrayElements(size_ref, (jboolean *)0);
size = size_base + sizeOffset;
if (!type_ref) {
@@ -66,7 +66,7 @@ android_glGetActiveAttrib__III_3II_3II_3II_3BI
}
_typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
type_base = (GLenum *)
- _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
+ _env->GetIntArrayElements(type_ref, (jboolean *)0);
type = type_base + typeOffset;
if (!name_ref) {
@@ -83,7 +83,7 @@ android_glGetActiveAttrib__III_3II_3II_3II_3BI
}
_nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
name_base = (char *)
- _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0);
+ _env->GetByteArrayElements(name_ref, (jboolean *)0);
name = name_base + nameOffset;
glGetActiveAttrib(
@@ -98,19 +98,19 @@ android_glGetActiveAttrib__III_3II_3II_3II_3BI
exit:
if (name_base) {
- _env->ReleasePrimitiveArrayCritical(name_ref, name_base,
+ _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
_exception ? JNI_ABORT: 0);
}
if (type_base) {
- _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
+ _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
_exception ? JNI_ABORT: 0);
}
if (size_base) {
- _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
+ _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
_exception ? JNI_ABORT: 0);
}
if (length_base) {
- _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
+ _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -122,11 +122,11 @@ exit:
static void
android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
(JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
- jarray _lengthArray = (jarray) 0;
+ jintArray _lengthArray = (jintArray) 0;
jint _lengthBufferOffset = (jint) 0;
- jarray _sizeArray = (jarray) 0;
+ jintArray _sizeArray = (jintArray) 0;
jint _sizeBufferOffset = (jint) 0;
- jarray _typeArray = (jarray) 0;
+ jintArray _typeArray = (jintArray) 0;
jint _typeBufferOffset = (jint) 0;
jint _lengthRemaining;
GLsizei *length = (GLsizei *) 0;
@@ -135,19 +135,19 @@ android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_ni
jint _typeRemaining;
GLenum *type = (GLenum *) 0;
- length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
- size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
- type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
+ length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
+ size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
+ type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
if (length == NULL) {
- char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0);
+ char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
}
if (size == NULL) {
- char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
+ char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
size = (GLint *) (_sizeBase + _sizeBufferOffset);
}
if (type == NULL) {
- char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
+ char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
type = (GLenum *) (_typeBase + _typeBufferOffset);
}
glGetActiveAttrib(
@@ -160,13 +160,13 @@ android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_ni
reinterpret_cast<char *>(name)
);
if (_typeArray) {
- releasePointer(_env, _typeArray, type, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
}
if (_sizeArray) {
- releasePointer(_env, _sizeArray, size, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
}
if (_lengthArray) {
- releasePointer(_env, _lengthArray, length, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
}
}
@@ -211,7 +211,7 @@ android_glGetActiveAttrib1
}
_sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
size_base = (GLint *)
- _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
+ _env->GetIntArrayElements(size_ref, (jboolean *)0);
size = size_base + sizeOffset;
if (!type_ref) {
@@ -228,7 +228,7 @@ android_glGetActiveAttrib1
}
_typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
type_base = (GLenum *)
- _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
+ _env->GetIntArrayElements(type_ref, (jboolean *)0);
type = type_base + typeOffset;
glGetActiveAttrib(
@@ -242,11 +242,11 @@ android_glGetActiveAttrib1
);
exit:
if (type_base) {
- _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
+ _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
_exception ? JNI_ABORT: 0);
}
if (size_base) {
- _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
+ _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
_exception ? JNI_ABORT: 0);
}
if (_exception != 1) {
@@ -269,9 +269,9 @@ exit:
static jstring
android_glGetActiveAttrib2
(JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
- jarray _sizeArray = (jarray) 0;
+ jintArray _sizeArray = (jintArray) 0;
jint _sizeBufferOffset = (jint) 0;
- jarray _typeArray = (jarray) 0;
+ jintArray _typeArray = (jintArray) 0;
jint _typeBufferOffset = (jint) 0;
jint _lengthRemaining;
GLsizei *length = (GLsizei *) 0;
@@ -294,14 +294,14 @@ android_glGetActiveAttrib2
return NULL;
}
- size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
- type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
+ size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
+ type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
if (size == NULL) {
- char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
+ char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
size = (GLint *) (_sizeBase + _sizeBufferOffset);
}
if (type == NULL) {
- char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
+ char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
type = (GLenum *) (_typeBase + _typeBufferOffset);
}
glGetActiveAttrib(
@@ -315,10 +315,10 @@ android_glGetActiveAttrib2
);
if (_typeArray) {
- releasePointer(_env, _typeArray, type, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
}
if (_sizeArray) {
- releasePointer(_env, _sizeArray, size, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
}
result = _env->NewStringUTF(buf);
if (buf) {
diff --git a/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp b/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp
index a7376ba..68e8389 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp
@@ -32,7 +32,7 @@ android_glGetActiveUniform__III_3II_3II_3II_3BI
}
_lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
length_base = (GLsizei *)
- _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
+ _env->GetIntArrayElements(length_ref, (jboolean *)0);
length = length_base + lengthOffset;
if (!size_ref) {
@@ -49,7 +49,7 @@ android_glGetActiveUniform__III_3II_3II_3II_3BI
}
_sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
size_base = (GLint *)
- _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
+ _env->GetIntArrayElements(size_ref, (jboolean *)0);
size = size_base + sizeOffset;
if (!type_ref) {
@@ -66,7 +66,7 @@ android_glGetActiveUniform__III_3II_3II_3II_3BI
}
_typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
type_base = (GLenum *)
- _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
+ _env->GetIntArrayElements(type_ref, (jboolean *)0);
type = type_base + typeOffset;
if (!name_ref) {
@@ -83,7 +83,7 @@ android_glGetActiveUniform__III_3II_3II_3II_3BI
}
_nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
name_base = (char *)
- _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0);
+ _env->GetByteArrayElements(name_ref, (jboolean *)0);
name = name_base + nameOffset;
glGetActiveUniform(
@@ -98,19 +98,19 @@ android_glGetActiveUniform__III_3II_3II_3II_3BI
exit:
if (name_base) {
- _env->ReleasePrimitiveArrayCritical(name_ref, name_base,
+ _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
_exception ? JNI_ABORT: 0);
}
if (type_base) {
- _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
+ _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
_exception ? JNI_ABORT: 0);
}
if (size_base) {
- _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
+ _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
_exception ? JNI_ABORT: 0);
}
if (length_base) {
- _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
+ _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -122,11 +122,11 @@ exit:
static void
android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
(JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
- jarray _lengthArray = (jarray) 0;
+ jintArray _lengthArray = (jintArray) 0;
jint _lengthBufferOffset = (jint) 0;
- jarray _sizeArray = (jarray) 0;
+ jintArray _sizeArray = (jintArray) 0;
jint _sizeBufferOffset = (jint) 0;
- jarray _typeArray = (jarray) 0;
+ jintArray _typeArray = (jintArray) 0;
jint _typeBufferOffset = (jint) 0;
jint _lengthRemaining;
GLsizei *length = (GLsizei *) 0;
@@ -135,19 +135,19 @@ android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_n
jint _typeRemaining;
GLenum *type = (GLenum *) 0;
- length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
- size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
- type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
+ length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
+ size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
+ type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
if (length == NULL) {
- char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0);
+ char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
}
if (size == NULL) {
- char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
+ char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
size = (GLint *) (_sizeBase + _sizeBufferOffset);
}
if (type == NULL) {
- char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
+ char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
type = (GLenum *) (_typeBase + _typeBufferOffset);
}
glGetActiveUniform(
@@ -160,13 +160,13 @@ android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_n
reinterpret_cast<char *>(name)
);
if (_typeArray) {
- releasePointer(_env, _typeArray, type, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
}
if (_sizeArray) {
- releasePointer(_env, _sizeArray, size, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
}
if (_lengthArray) {
- releasePointer(_env, _lengthArray, length, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
}
}
@@ -214,7 +214,7 @@ android_glGetActiveUniform1
}
_sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
size_base = (GLint *)
- _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
+ _env->GetIntArrayElements(size_ref, (jboolean *)0);
size = size_base + sizeOffset;
if (!type_ref) {
@@ -231,7 +231,7 @@ android_glGetActiveUniform1
}
_typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
type_base = (GLenum *)
- _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
+ _env->GetIntArrayElements(type_ref, (jboolean *)0);
type = type_base + typeOffset;
glGetActiveUniform(
@@ -246,11 +246,11 @@ android_glGetActiveUniform1
exit:
if (type_base) {
- _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
+ _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
_exception ? JNI_ABORT: 0);
}
if (size_base) {
- _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
+ _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
_exception ? JNI_ABORT: 0);
}
if (_exception != 1) {
@@ -272,9 +272,9 @@ exit:
static jstring
android_glGetActiveUniform2
(JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
- jarray _sizeArray = (jarray) 0;
+ jintArray _sizeArray = (jintArray) 0;
jint _sizeBufferOffset = (jint) 0;
- jarray _typeArray = (jarray) 0;
+ jintArray _typeArray = (jintArray) 0;
jint _typeBufferOffset = (jint) 0;
jint _sizeRemaining;
GLint *size = (GLint *) 0;
@@ -294,15 +294,15 @@ android_glGetActiveUniform2
return NULL;
}
- size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
- type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
+ size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
+ type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
if (size == NULL) {
- char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
+ char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
size = (GLint *) (_sizeBase + _sizeBufferOffset);
}
if (type == NULL) {
- char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
+ char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
type = (GLenum *) (_typeBase + _typeBufferOffset);
}
glGetActiveUniform(
@@ -316,10 +316,10 @@ android_glGetActiveUniform2
);
if (_typeArray) {
- releasePointer(_env, _typeArray, type, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
}
if (_sizeArray) {
- releasePointer(_env, _sizeArray, size, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
}
result = _env->NewStringUTF(buf);
if (buf) {
diff --git a/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp b/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp
index bb6ae7c..6104c84 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp
@@ -25,7 +25,7 @@ android_glGetActiveUniformBlockName_III_3II_3BI
goto exit;
}
_lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
- _length_base = (GLsizei*)_env->GetPrimitiveArrayCritical(
+ _length_base = (GLsizei*)_env->GetIntArrayElements(
length_ref, (jboolean*)0);
_length = _length_base + lengthOffset;
@@ -42,7 +42,7 @@ android_glGetActiveUniformBlockName_III_3II_3BI
goto exit;
}
_nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
- _name_base = (GLchar*)_env->GetPrimitiveArrayCritical(
+ _name_base = (GLchar*)_env->GetByteArrayElements(
name_ref, (jboolean*)0);
_name = _name_base + nameOffset;
@@ -56,11 +56,11 @@ android_glGetActiveUniformBlockName_III_3II_3BI
exit:
if (_name_base) {
- _env->ReleasePrimitiveArrayCritical(name_ref, _name_base,
+ _env->ReleaseByteArrayElements(name_ref, (jbyte*)_name_base,
_exception ? JNI_ABORT: 0);
}
if (_length_base) {
- _env->ReleasePrimitiveArrayCritical(length_ref, _length_base,
+ _env->ReleaseIntArrayElements(length_ref, (jint*)_length_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -124,4 +124,3 @@ android_glGetActiveUniformBlockName_II
free(name);
return result;
}
-
diff --git a/opengl/tools/glgen/stubs/gles11/glGetBooleanv.cpp b/opengl/tools/glgen/stubs/gles11/glGetBooleanv.cpp
index 00c52af..7874bd8 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetBooleanv.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetBooleanv.cpp
@@ -2,12 +2,14 @@
static void
android_glGetBooleanv__I_3ZI
(JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
- get<jbooleanArray, GLboolean, glGetBooleanv>(_env, _this, pname, params_ref, offset);
+ get<jbooleanArray, BooleanArrayGetter, jboolean*, BooleanArrayReleaser, GLboolean, glGetBooleanv>(
+ _env, _this, pname, params_ref, offset);
}
/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
static void
android_glGetBooleanv__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
- getarray<GLboolean, glGetBooleanv>(_env, _this, pname, params_buf);
+ getarray<GLboolean, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetBooleanv>(
+ _env, _this, pname, params_buf);
}
diff --git a/opengl/tools/glgen/stubs/gles11/glGetFloatv.cpp b/opengl/tools/glgen/stubs/gles11/glGetFloatv.cpp
index 71c399d..2f41fd1 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetFloatv.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetFloatv.cpp
@@ -2,12 +2,14 @@
static void
android_glGetFloatv__I_3FI
(JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
- get<jfloatArray, GLfloat, glGetFloatv>(_env, _this, pname, params_ref, offset);
+ get<jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, GLfloat, glGetFloatv>(
+ _env, _this, pname, params_ref, offset);
}
/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
static void
android_glGetFloatv__ILjava_nio_FloatBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
- getarray<GLfloat, glGetFloatv>(_env, _this, pname, params_buf);
+ getarray<GLfloat, jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, glGetFloatv>(
+ _env, _this, pname, params_buf);
}
diff --git a/opengl/tools/glgen/stubs/gles11/glGetIntegerv.cpp b/opengl/tools/glgen/stubs/gles11/glGetIntegerv.cpp
index 9000ece..c960f31 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetIntegerv.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetIntegerv.cpp
@@ -2,13 +2,14 @@
static void
android_glGetIntegerv__I_3II
(JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
- get<jintArray, GLint, glGetIntegerv>(_env, _this, pname, params_ref, offset);
+ get<jintArray, IntArrayGetter, jint*, IntArrayReleaser, GLint, glGetIntegerv>(
+ _env, _this, pname, params_ref, offset);
}
/* void glGetIntegerv ( GLenum pname, GLint *params ) */
static void
android_glGetIntegerv__ILjava_nio_IntBuffer_2
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
- getarray<GLint, glGetIntegerv>(_env, _this, pname, params_buf);
+ getarray<GLint, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetIntegerv>(
+ _env, _this, pname, params_buf);
}
-
diff --git a/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp b/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp
index c995d9c..d9808ef 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp
@@ -26,7 +26,7 @@ android_glGetShaderSource__II_3II_3BI
}
_lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
length_base = (GLsizei *)
- _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
+ _env->GetIntArrayElements(length_ref, (jboolean *)0);
length = length_base + lengthOffset;
if (!source_ref) {
@@ -43,7 +43,7 @@ android_glGetShaderSource__II_3II_3BI
}
_sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset;
source_base = (char *)
- _env->GetPrimitiveArrayCritical(source_ref, (jboolean *)0);
+ _env->GetByteArrayElements(source_ref, (jboolean *)0);
source = source_base + sourceOffset;
glGetShaderSource(
@@ -55,11 +55,11 @@ android_glGetShaderSource__II_3II_3BI
exit:
if (source_base) {
- _env->ReleasePrimitiveArrayCritical(source_ref, source_base,
+ _env->ReleaseByteArrayElements(source_ref, (jbyte*)source_base,
_exception ? JNI_ABORT: 0);
}
if (length_base) {
- _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
+ _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -71,14 +71,14 @@ exit:
static void
android_glGetShaderSource__IILjava_nio_IntBuffer_2B
(JNIEnv *_env, jobject _this, jint shader, jint bufsize, jobject length_buf, jbyte source) {
- jarray _array = (jarray) 0;
+ jintArray _array = (jintArray) 0;
jint _bufferOffset = (jint) 0;
jint _remaining;
GLsizei *length = (GLsizei *) 0;
- length = (GLsizei *)getPointer(_env, length_buf, &_array, &_remaining, &_bufferOffset);
+ length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
if (length == NULL) {
- char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ char * _lengthBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
length = (GLsizei *) (_lengthBase + _bufferOffset);
}
glGetShaderSource(
@@ -88,7 +88,7 @@ android_glGetShaderSource__IILjava_nio_IntBuffer_2B
reinterpret_cast<char *>(source)
);
if (_array) {
- releasePointer(_env, _array, length, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _array, (jint*)length, JNI_TRUE);
}
}
diff --git a/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp b/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp
index a977693..cb656c8 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp
@@ -32,7 +32,7 @@ android_glGetTransformFeedbackVarying__III_3II_3II_3II_3BI
}
_lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
length_base = (GLsizei *)
- _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
+ _env->GetIntArrayElements(length_ref, (jboolean *)0);
length = length_base + lengthOffset;
if (!size_ref) {
@@ -49,7 +49,7 @@ android_glGetTransformFeedbackVarying__III_3II_3II_3II_3BI
}
_sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
size_base = (GLint *)
- _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
+ _env->GetIntArrayElements(size_ref, (jboolean *)0);
size = size_base + sizeOffset;
if (!type_ref) {
@@ -66,7 +66,7 @@ android_glGetTransformFeedbackVarying__III_3II_3II_3II_3BI
}
_typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
type_base = (GLenum *)
- _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
+ _env->GetIntArrayElements(type_ref, (jboolean *)0);
type = type_base + typeOffset;
if (!name_ref) {
@@ -83,7 +83,7 @@ android_glGetTransformFeedbackVarying__III_3II_3II_3II_3BI
}
_nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
name_base = (char *)
- _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0);
+ _env->GetByteArrayElements(name_ref, (jboolean *)0);
name = name_base + nameOffset;
glGetTransformFeedbackVarying(
@@ -98,19 +98,19 @@ android_glGetTransformFeedbackVarying__III_3II_3II_3II_3BI
exit:
if (name_base) {
- _env->ReleasePrimitiveArrayCritical(name_ref, name_base,
+ _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
_exception ? JNI_ABORT: 0);
}
if (type_base) {
- _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
+ _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
_exception ? JNI_ABORT: 0);
}
if (size_base) {
- _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
+ _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
_exception ? JNI_ABORT: 0);
}
if (length_base) {
- _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
+ _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
_exception ? JNI_ABORT: 0);
}
if (_exception) {
@@ -122,11 +122,11 @@ exit:
static void
android_glGetTransformFeedbackVarying__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
(JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
- jarray _lengthArray = (jarray) 0;
+ jintArray _lengthArray = (jintArray) 0;
jint _lengthBufferOffset = (jint) 0;
- jarray _sizeArray = (jarray) 0;
+ jintArray _sizeArray = (jintArray) 0;
jint _sizeBufferOffset = (jint) 0;
- jarray _typeArray = (jarray) 0;
+ jintArray _typeArray = (jintArray) 0;
jint _typeBufferOffset = (jint) 0;
jint _lengthRemaining;
GLsizei *length = (GLsizei *) 0;
@@ -135,19 +135,19 @@ android_glGetTransformFeedbackVarying__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuff
jint _typeRemaining;
GLenum *type = (GLenum *) 0;
- length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
- size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
- type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
+ length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
+ size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
+ type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
if (length == NULL) {
- char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0);
+ char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
}
if (size == NULL) {
- char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
+ char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
size = (GLint *) (_sizeBase + _sizeBufferOffset);
}
if (type == NULL) {
- char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
+ char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
type = (GLenum *) (_typeBase + _typeBufferOffset);
}
glGetTransformFeedbackVarying(
@@ -164,13 +164,13 @@ android_glGetTransformFeedbackVarying__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuff
(char *)static_cast<uintptr_t>(name)
);
if (_typeArray) {
- releasePointer(_env, _typeArray, type, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
}
if (_sizeArray) {
- releasePointer(_env, _sizeArray, size, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
}
if (_lengthArray) {
- releasePointer(_env, _lengthArray, length, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
}
}
@@ -215,7 +215,7 @@ android_glGetTransformFeedbackVarying1
}
_sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
size_base = (GLint *)
- _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
+ _env->GetIntArrayElements(size_ref, (jboolean *)0);
size = size_base + sizeOffset;
if (!type_ref) {
@@ -232,7 +232,7 @@ android_glGetTransformFeedbackVarying1
}
_typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
type_base = (GLenum *)
- _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
+ _env->GetIntArrayElements(type_ref, (jboolean *)0);
type = type_base + typeOffset;
glGetTransformFeedbackVarying(
@@ -246,11 +246,11 @@ android_glGetTransformFeedbackVarying1
);
exit:
if (type_base) {
- _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
+ _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
_exception ? JNI_ABORT: 0);
}
if (size_base) {
- _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
+ _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
_exception ? JNI_ABORT: 0);
}
if (_exception != 1) {
@@ -273,9 +273,9 @@ exit:
static jstring
android_glGetTransformFeedbackVarying2
(JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
- jarray _sizeArray = (jarray) 0;
+ jintArray _sizeArray = (jintArray) 0;
jint _sizeBufferOffset = (jint) 0;
- jarray _typeArray = (jarray) 0;
+ jintArray _typeArray = (jintArray) 0;
jint _typeBufferOffset = (jint) 0;
jint _lengthRemaining;
GLsizei *length = (GLsizei *) 0;
@@ -298,14 +298,14 @@ android_glGetTransformFeedbackVarying2
return NULL;
}
- size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
- type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
+ size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
+ type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
if (size == NULL) {
- char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
+ char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
size = (GLint *) (_sizeBase + _sizeBufferOffset);
}
if (type == NULL) {
- char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
+ char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
type = (GLenum *) (_typeBase + _typeBufferOffset);
}
glGetTransformFeedbackVarying(
@@ -319,10 +319,10 @@ android_glGetTransformFeedbackVarying2
);
if (_typeArray) {
- releasePointer(_env, _typeArray, type, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
}
if (_sizeArray) {
- releasePointer(_env, _sizeArray, size, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
}
result = _env->NewStringUTF(buf);
if (buf) {
diff --git a/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.cpp b/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.cpp
index fb137ab..13ef01e 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.cpp
@@ -49,7 +49,7 @@ android_glGetUniformIndices_array
_exceptionMessage = "not enough space in uniformIndices";
goto exit;
}
- _indices_base = (GLuint*)_env->GetPrimitiveArrayCritical(
+ _indices_base = (GLuint*)_env->GetIntArrayElements(
uniformIndices_ref, 0);
_indices = _indices_base + uniformIndicesOffset;
@@ -57,8 +57,8 @@ android_glGetUniformIndices_array
exit:
if (_indices_base) {
- _env->ReleasePrimitiveArrayCritical(uniformIndices_ref, _indices_base,
- _exception ? JNI_ABORT : 0);
+ _env->ReleaseIntArrayElements(uniformIndices_ref, (jint*)_indices_base,
+ _exception ? JNI_ABORT : 0);
}
for (_i = _count - 1; _i >= 0; _i--) {
if (_names[_i]) {
@@ -85,7 +85,7 @@ android_glGetUniformIndices_buffer
jint _count = 0;
jint _i;
const char** _names = NULL;
- jarray _uniformIndicesArray = (jarray)0;
+ jintArray _uniformIndicesArray = (jintArray)0;
jint _uniformIndicesRemaining;
jint _uniformIndicesOffset = 0;
GLuint* _indices = NULL;
@@ -118,11 +118,11 @@ android_glGetUniformIndices_buffer
}
_indices = (GLuint*)getPointer(_env, uniformIndices_buf,
- &_uniformIndicesArray, &_uniformIndicesRemaining,
+ (jarray*)&_uniformIndicesArray, &_uniformIndicesRemaining,
&_uniformIndicesOffset);
if (!_indices) {
- _indicesBase = (char*)_env->GetPrimitiveArrayCritical(
- _uniformIndicesArray, 0);
+ _indicesBase = (char*)_env->GetIntArrayElements(
+ _uniformIndicesArray, 0);
_indices = (GLuint*)(_indicesBase + _uniformIndicesOffset);
}
if (_uniformIndicesRemaining < _count) {
@@ -136,7 +136,8 @@ android_glGetUniformIndices_buffer
exit:
if (_uniformIndicesArray) {
- releasePointer(_env, _uniformIndicesArray, _indicesBase, JNI_TRUE);
+ releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(
+ _env, _uniformIndicesArray, (jint*)_indicesBase, JNI_TRUE);
}
for (_i = _count - 1; _i >= 0; _i--) {
if (_names[_i]) {
@@ -151,4 +152,3 @@ exit:
jniThrowException(_env, _exceptionType, _exceptionMessage);
}
}
-
diff --git a/opengl/tools/glgen2/glgen.py b/opengl/tools/glgen2/glgen.py
index ed6b451..9b30fd1 100755
--- a/opengl/tools/glgen2/glgen.py
+++ b/opengl/tools/glgen2/glgen.py
@@ -86,11 +86,25 @@ def fmtTypeNameList(params):
return ', '.join(['"%s", %s' % (p[0], p[1]) for p in params])
-def overrideSymbolName(sym):
- # The wrapper intercepts glGetString and (sometimes) calls the generated
- # __glGetString thunk which dispatches to the driver's glGetString
- if sym == 'glGetString':
- return '__glGetString'
+def overrideSymbolName(sym, apiname):
+ # The wrapper intercepts various glGet and glGetString functions and
+ # (sometimes) calls the generated thunk which dispatches to the
+ # driver's implementation
+ wrapped_get_syms = {
+ 'gles1' : [
+ 'glGetString'
+ ],
+ 'gles2' : [
+ 'glGetString',
+ 'glGetStringi',
+ 'glGetBooleanv',
+ 'glGetFloatv',
+ 'glGetIntegerv',
+ 'glGetInteger64v',
+ ],
+ }
+ if sym in wrapped_get_syms.get(apiname):
+ return '__' + sym
else:
return sym
@@ -115,8 +129,8 @@ class TrampolineGen(reg.OutputGenerator):
print('%s API_ENTRY(%s)(%s) {\n'
' %s(%s%s%s);\n'
'}'
- % (rtype, overrideSymbolName(fname), fmtParams(params),
- call, fname,
+ % (rtype, overrideSymbolName(fname, self.genOpts.apiname),
+ fmtParams(params), call, fname,
', ' if len(params) > 0 else '',
fmtArgs(params)),
file=self.outFile)