summaryrefslogtreecommitdiffstats
path: root/opengl/tools/glgen/stubs
diff options
context:
space:
mode:
Diffstat (limited to 'opengl/tools/glgen/stubs')
-rw-r--r--opengl/tools/glgen/stubs/egl/EGL14Header.java-if151
-rw-r--r--opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp132
-rw-r--r--opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp154
-rw-r--r--opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.java48
-rw-r--r--opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.nativeReg2
-rw-r--r--opengl/tools/glgen/stubs/egl/eglQueryString.cpp10
-rw-r--r--opengl/tools/glgen/stubs/egl/eglQueryString.java6
-rw-r--r--opengl/tools/glgen/stubs/egl/eglQueryString.nativeReg1
-rw-r--r--opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp9
-rw-r--r--opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp9
-rw-r--r--opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp10
-rw-r--r--opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp9
-rw-r--r--opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp9
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp328
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.java47
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.nativeReg4
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp329
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetActiveUniform.java46
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetActiveUniform.nativeReg4
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp111
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetShaderSource.java25
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetShaderSource.nativeReg3
-rw-r--r--opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp13
-rw-r--r--opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl3
24 files changed, 1424 insertions, 39 deletions
diff --git a/opengl/tools/glgen/stubs/egl/EGL14Header.java-if b/opengl/tools/glgen/stubs/egl/EGL14Header.java-if
new file mode 100644
index 0000000..0c29d5c
--- /dev/null
+++ b/opengl/tools/glgen/stubs/egl/EGL14Header.java-if
@@ -0,0 +1,151 @@
+**
+** Copyright 2012, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+package android.opengl;
+
+import android.graphics.SurfaceTexture;
+import android.view.Surface;
+import android.view.SurfaceView;
+import android.view.SurfaceHolder;
+
+/**
+ * EGL 1.4
+ *
+ */
+public class EGL14 {
+
+public static final int EGL_DEFAULT_DISPLAY = 0;
+public static EGLContext EGL_NO_CONTEXT = null;
+public static EGLDisplay EGL_NO_DISPLAY = null;
+public static EGLSurface EGL_NO_SURFACE = null;
+
+public static final int EGL_FALSE = 0;
+public static final int EGL_TRUE = 1;
+public static final int EGL_SUCCESS = 0x3000;
+public static final int EGL_NOT_INITIALIZED = 0x3001;
+public static final int EGL_BAD_ACCESS = 0x3002;
+public static final int EGL_BAD_ALLOC = 0x3003;
+public static final int EGL_BAD_ATTRIBUTE = 0x3004;
+public static final int EGL_BAD_CONFIG = 0x3005;
+public static final int EGL_BAD_CONTEXT = 0x3006;
+public static final int EGL_BAD_CURRENT_SURFACE = 0x3007;
+public static final int EGL_BAD_DISPLAY = 0x3008;
+public static final int EGL_BAD_MATCH = 0x3009;
+public static final int EGL_BAD_NATIVE_PIXMAP = 0x300A;
+public static final int EGL_BAD_NATIVE_WINDOW = 0x300B;
+public static final int EGL_BAD_PARAMETER = 0x300C;
+public static final int EGL_BAD_SURFACE = 0x300D;
+public static final int EGL_CONTEXT_LOST = 0x300E;
+public static final int EGL_BUFFER_SIZE = 0x3020;
+public static final int EGL_ALPHA_SIZE = 0x3021;
+public static final int EGL_BLUE_SIZE = 0x3022;
+public static final int EGL_GREEN_SIZE = 0x3023;
+public static final int EGL_RED_SIZE = 0x3024;
+public static final int EGL_DEPTH_SIZE = 0x3025;
+public static final int EGL_STENCIL_SIZE = 0x3026;
+public static final int EGL_CONFIG_CAVEAT = 0x3027;
+public static final int EGL_CONFIG_ID = 0x3028;
+public static final int EGL_LEVEL = 0x3029;
+public static final int EGL_MAX_PBUFFER_HEIGHT = 0x302A;
+public static final int EGL_MAX_PBUFFER_PIXELS = 0x302B;
+public static final int EGL_MAX_PBUFFER_WIDTH = 0x302C;
+public static final int EGL_NATIVE_RENDERABLE = 0x302D;
+public static final int EGL_NATIVE_VISUAL_ID = 0x302E;
+public static final int EGL_NATIVE_VISUAL_TYPE = 0x302F;
+public static final int EGL_SAMPLES = 0x3031;
+public static final int EGL_SAMPLE_BUFFERS = 0x3032;
+public static final int EGL_SURFACE_TYPE = 0x3033;
+public static final int EGL_TRANSPARENT_TYPE = 0x3034;
+public static final int EGL_TRANSPARENT_BLUE_VALUE = 0x3035;
+public static final int EGL_TRANSPARENT_GREEN_VALUE = 0x3036;
+public static final int EGL_TRANSPARENT_RED_VALUE = 0x3037;
+public static final int EGL_NONE = 0x3038;
+public static final int EGL_BIND_TO_TEXTURE_RGB = 0x3039;
+public static final int EGL_BIND_TO_TEXTURE_RGBA = 0x303A;
+public static final int EGL_MIN_SWAP_INTERVAL = 0x303B;
+public static final int EGL_MAX_SWAP_INTERVAL = 0x303C;
+public static final int EGL_LUMINANCE_SIZE = 0x303D;
+public static final int EGL_ALPHA_MASK_SIZE = 0x303E;
+public static final int EGL_COLOR_BUFFER_TYPE = 0x303F;
+public static final int EGL_RENDERABLE_TYPE = 0x3040;
+public static final int EGL_MATCH_NATIVE_PIXMAP = 0x3041;
+public static final int EGL_CONFORMANT = 0x3042;
+public static final int EGL_SLOW_CONFIG = 0x3050;
+public static final int EGL_NON_CONFORMANT_CONFIG = 0x3051;
+public static final int EGL_TRANSPARENT_RGB = 0x3052;
+public static final int EGL_RGB_BUFFER = 0x308E;
+public static final int EGL_LUMINANCE_BUFFER = 0x308F;
+public static final int EGL_NO_TEXTURE = 0x305C;
+public static final int EGL_TEXTURE_RGB = 0x305D;
+public static final int EGL_TEXTURE_RGBA = 0x305E;
+public static final int EGL_TEXTURE_2D = 0x305F;
+public static final int EGL_PBUFFER_BIT = 0x0001;
+public static final int EGL_PIXMAP_BIT = 0x0002;
+public static final int EGL_WINDOW_BIT = 0x0004;
+public static final int EGL_VG_COLORSPACE_LINEAR_BIT = 0x0020;
+public static final int EGL_VG_ALPHA_FORMAT_PRE_BIT = 0x0040;
+public static final int EGL_MULTISAMPLE_RESOLVE_BOX_BIT = 0x0200;
+public static final int EGL_SWAP_BEHAVIOR_PRESERVED_BIT = 0x0400;
+public static final int EGL_OPENGL_ES_BIT = 0x0001;
+public static final int EGL_OPENVG_BIT = 0x0002;
+public static final int EGL_OPENGL_ES2_BIT = 0x0004;
+public static final int EGL_OPENGL_BIT = 0x0008;
+public static final int EGL_VENDOR = 0x3053;
+public static final int EGL_VERSION = 0x3054;
+public static final int EGL_EXTENSIONS = 0x3055;
+public static final int EGL_CLIENT_APIS = 0x308D;
+public static final int EGL_HEIGHT = 0x3056;
+public static final int EGL_WIDTH = 0x3057;
+public static final int EGL_LARGEST_PBUFFER = 0x3058;
+public static final int EGL_TEXTURE_FORMAT = 0x3080;
+public static final int EGL_TEXTURE_TARGET = 0x3081;
+public static final int EGL_MIPMAP_TEXTURE = 0x3082;
+public static final int EGL_MIPMAP_LEVEL = 0x3083;
+public static final int EGL_RENDER_BUFFER = 0x3086;
+public static final int EGL_VG_COLORSPACE = 0x3087;
+public static final int EGL_VG_ALPHA_FORMAT = 0x3088;
+public static final int EGL_HORIZONTAL_RESOLUTION = 0x3090;
+public static final int EGL_VERTICAL_RESOLUTION = 0x3091;
+public static final int EGL_PIXEL_ASPECT_RATIO = 0x3092;
+public static final int EGL_SWAP_BEHAVIOR = 0x3093;
+public static final int EGL_MULTISAMPLE_RESOLVE = 0x3099;
+public static final int EGL_BACK_BUFFER = 0x3084;
+public static final int EGL_SINGLE_BUFFER = 0x3085;
+public static final int EGL_VG_COLORSPACE_sRGB = 0x3089;
+public static final int EGL_VG_COLORSPACE_LINEAR = 0x308A;
+public static final int EGL_VG_ALPHA_FORMAT_NONPRE = 0x308B;
+public static final int EGL_VG_ALPHA_FORMAT_PRE = 0x308C;
+public static final int EGL_DISPLAY_SCALING = 10000;
+public static final int EGL_BUFFER_PRESERVED = 0x3094;
+public static final int EGL_BUFFER_DESTROYED = 0x3095;
+public static final int EGL_OPENVG_IMAGE = 0x3096;
+public static final int EGL_CONTEXT_CLIENT_TYPE = 0x3097;
+public static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
+public static final int EGL_MULTISAMPLE_RESOLVE_DEFAULT = 0x309A;
+public static final int EGL_MULTISAMPLE_RESOLVE_BOX = 0x309B;
+public static final int EGL_OPENGL_ES_API = 0x30A0;
+public static final int EGL_OPENVG_API = 0x30A1;
+public static final int EGL_OPENGL_API = 0x30A2;
+public static final int EGL_DRAW = 0x3059;
+public static final int EGL_READ = 0x305A;
+public static final int EGL_CORE_NATIVE_ENGINE = 0x305B;
+
+ native private static void _nativeClassInit();
+ static {
+ _nativeClassInit();
+ }
diff --git a/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp b/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp
new file mode 100644
index 0000000..7904ac7
--- /dev/null
+++ b/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp
@@ -0,0 +1,132 @@
+**
+** Copyright 2012, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+** http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+
+// This source file is automatically generated
+
+#include "jni.h"
+#include "JNIHelp.h"
+#include <android_runtime/AndroidRuntime.h>
+#include <android_runtime/android_view_Surface.h>
+#include <android_runtime/android_graphics_SurfaceTexture.h>
+#include <utils/misc.h>
+
+#include <assert.h>
+#include <EGL/egl.h>
+
+#include <gui/Surface.h>
+#include <gui/SurfaceTexture.h>
+#include <gui/SurfaceTextureClient.h>
+
+#include <ui/ANativeObjectBase.h>
+
+static int initialized = 0;
+
+static jclass egldisplayClass;
+static jclass eglcontextClass;
+static jclass eglsurfaceClass;
+static jclass eglconfigClass;
+
+static jmethodID egldisplayGetHandleID;
+static jmethodID eglcontextGetHandleID;
+static jmethodID eglsurfaceGetHandleID;
+static jmethodID eglconfigGetHandleID;
+
+static jmethodID egldisplayConstructor;
+static jmethodID eglcontextConstructor;
+static jmethodID eglsurfaceConstructor;
+static jmethodID eglconfigConstructor;
+
+static jobject eglNoContextObject;
+static jobject eglNoDisplayObject;
+static jobject eglNoSurfaceObject;
+
+
+
+/* Cache method IDs each time the class is loaded. */
+
+static void
+nativeClassInit(JNIEnv *_env, jclass glImplClass)
+{
+ jclass egldisplayClassLocal = _env->FindClass("android/opengl/EGLDisplay");
+ egldisplayClass = (jclass) _env->NewGlobalRef(egldisplayClassLocal);
+ jclass eglcontextClassLocal = _env->FindClass("android/opengl/EGLContext");
+ eglcontextClass = (jclass) _env->NewGlobalRef(eglcontextClassLocal);
+ jclass eglsurfaceClassLocal = _env->FindClass("android/opengl/EGLSurface");
+ eglsurfaceClass = (jclass) _env->NewGlobalRef(eglsurfaceClassLocal);
+ jclass eglconfigClassLocal = _env->FindClass("android/opengl/EGLConfig");
+ eglconfigClass = (jclass) _env->NewGlobalRef(eglconfigClassLocal);
+
+ egldisplayGetHandleID = _env->GetMethodID(egldisplayClass, "getHandle", "()I");
+ eglcontextGetHandleID = _env->GetMethodID(eglcontextClass, "getHandle", "()I");
+ eglsurfaceGetHandleID = _env->GetMethodID(eglsurfaceClass, "getHandle", "()I");
+ eglconfigGetHandleID = _env->GetMethodID(eglconfigClass, "getHandle", "()I");
+
+
+ egldisplayConstructor = _env->GetMethodID(egldisplayClass, "<init>", "(I)V");
+ eglcontextConstructor = _env->GetMethodID(eglcontextClass, "<init>", "(I)V");
+ eglsurfaceConstructor = _env->GetMethodID(eglsurfaceClass, "<init>", "(I)V");
+ eglconfigConstructor = _env->GetMethodID(eglconfigClass, "<init>", "(I)V");
+
+ jobject localeglNoContextObject = _env->NewObject(eglcontextClass, eglcontextConstructor, (jint)EGL_NO_CONTEXT);
+ eglNoContextObject = _env->NewGlobalRef(localeglNoContextObject);
+ jobject localeglNoDisplayObject = _env->NewObject(egldisplayClass, egldisplayConstructor, (jint)EGL_NO_DISPLAY);
+ eglNoDisplayObject = _env->NewGlobalRef(localeglNoDisplayObject);
+ jobject localeglNoSurfaceObject = _env->NewObject(eglsurfaceClass, eglsurfaceConstructor, (jint)EGL_NO_SURFACE);
+ eglNoSurfaceObject = _env->NewGlobalRef(localeglNoSurfaceObject);
+
+
+ jclass eglClass = _env->FindClass("android/opengl/EGL14");
+ jfieldID noContextFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_CONTEXT", "Landroid/opengl/EGLContext;");
+ _env->SetStaticObjectField(eglClass, noContextFieldID, eglNoContextObject);
+
+ jfieldID noDisplayFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_DISPLAY", "Landroid/opengl/EGLDisplay;");
+ _env->SetStaticObjectField(eglClass, noDisplayFieldID, eglNoDisplayObject);
+
+ jfieldID noSurfaceFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_SURFACE", "Landroid/opengl/EGLSurface;");
+ _env->SetStaticObjectField(eglClass, noSurfaceFieldID, eglNoSurfaceObject);
+}
+
+static void *
+fromEGLHandle(JNIEnv *_env, jmethodID mid, jobject obj) {
+ if (obj == NULL){
+ jniThrowException(_env, "java/lang/IllegalArgumentException",
+ "Object is set to null.");
+ }
+
+ return (void*) (_env->CallIntMethod(obj, mid));
+}
+
+static jobject
+toEGLHandle(JNIEnv *_env, jclass cls, jmethodID con, void * handle) {
+ if (cls == eglcontextClass &&
+ (EGLContext)handle == EGL_NO_CONTEXT) {
+ return eglNoContextObject;
+ }
+
+ if (cls == egldisplayClass &&
+ (EGLDisplay)handle == EGL_NO_DISPLAY) {
+ return eglNoDisplayObject;
+ }
+
+ if (cls == eglsurfaceClass &&
+ (EGLSurface)handle == EGL_NO_SURFACE) {
+ return eglNoSurfaceObject;
+ }
+
+ return _env->NewObject(cls, con, (jint)handle);
+}
+
+// --------------------------------------------------------------------------
diff --git a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp
new file mode 100644
index 0000000..610cde5
--- /dev/null
+++ b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp
@@ -0,0 +1,154 @@
+/* EGLSurface eglCreateWindowSurface ( EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list ) */
+static jobject
+android_eglCreateWindowSurface
+ (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;
+
+ 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;
+ }
+
+ window = android::android_Surface_getNativeWindow(_env, win);
+
+ 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);
+}
+
+/* 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::SurfaceTexture> surfaceTexture;
+
+ 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;
+ }
+ surfaceTexture = android::SurfaceTexture_getSurfaceTexture(_env, win);
+ window = new android::SurfaceTextureClient(surfaceTexture);
+
+ 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);
+}
diff --git a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.java b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.java
new file mode 100644
index 0000000..e42334e
--- /dev/null
+++ b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.java
@@ -0,0 +1,48 @@
+ // C function EGLSurface eglCreateWindowSurface ( EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list )
+
+ private static native EGLSurface _eglCreateWindowSurface(
+ EGLDisplay dpy,
+ EGLConfig config,
+ Object win,
+ int[] attrib_list,
+ int offset
+ );
+
+ private static native EGLSurface _eglCreateWindowSurfaceTexture(
+ EGLDisplay dpy,
+ EGLConfig config,
+ Object win,
+ int[] attrib_list,
+ int offset
+ );
+
+ public static EGLSurface eglCreateWindowSurface(EGLDisplay dpy,
+ EGLConfig config,
+ Object win,
+ int[] attrib_list,
+ int offset
+ ){
+ Surface sur = null;
+ if (win instanceof SurfaceView) {
+ SurfaceView surfaceView = (SurfaceView)win;
+ sur = surfaceView.getHolder().getSurface();
+ } else if (win instanceof SurfaceHolder) {
+ SurfaceHolder holder = (SurfaceHolder)win;
+ sur = holder.getSurface();
+ }
+
+ EGLSurface surface;
+ if (sur != null) {
+ surface = _eglCreateWindowSurface(dpy, config, sur, attrib_list, offset);
+ } else if (win instanceof SurfaceTexture) {
+ surface = _eglCreateWindowSurfaceTexture(dpy, config,
+ win, attrib_list, offset);
+ } else {
+ throw new java.lang.UnsupportedOperationException(
+ "eglCreateWindowSurface() can only be called with an instance of " +
+ "SurfaceView, SurfaceTexture or SurfaceHolder at the moment, " +
+ "this will be fixed later.");
+ }
+
+ return surface;
+ }
diff --git a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.nativeReg b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.nativeReg
new file mode 100644
index 0000000..c37d05b
--- /dev/null
+++ b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.nativeReg
@@ -0,0 +1,2 @@
+{"_eglCreateWindowSurface", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;Ljava/lang/Object;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreateWindowSurface },
+{"_eglCreateWindowSurfaceTexture", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;Ljava/lang/Object;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreateWindowSurfaceTexture },
diff --git a/opengl/tools/glgen/stubs/egl/eglQueryString.cpp b/opengl/tools/glgen/stubs/egl/eglQueryString.cpp
new file mode 100644
index 0000000..625dad7
--- /dev/null
+++ b/opengl/tools/glgen/stubs/egl/eglQueryString.cpp
@@ -0,0 +1,10 @@
+/* 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);
+}
diff --git a/opengl/tools/glgen/stubs/egl/eglQueryString.java b/opengl/tools/glgen/stubs/egl/eglQueryString.java
new file mode 100644
index 0000000..f5d5a38
--- /dev/null
+++ b/opengl/tools/glgen/stubs/egl/eglQueryString.java
@@ -0,0 +1,6 @@
+ // C function const char * eglQueryString ( EGLDisplay dpy, EGLint name )
+
+ public static native String eglQueryString(
+ EGLDisplay dpy,
+ int name
+ );
diff --git a/opengl/tools/glgen/stubs/egl/eglQueryString.nativeReg b/opengl/tools/glgen/stubs/egl/eglQueryString.nativeReg
new file mode 100644
index 0000000..8276cdb
--- /dev/null
+++ b/opengl/tools/glgen/stubs/egl/eglQueryString.nativeReg
@@ -0,0 +1 @@
+{"eglQueryString", "(Landroid/opengl/EGLDisplay;I)Ljava/lang/String;", (void *) android_eglQueryString__Landroind_opengl_EGLDisplay_2I },
diff --git a/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp
index 5d418d7..172c0e7 100644
--- a/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp
+++ b/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp
@@ -62,14 +62,12 @@ nativeClassInit(JNIEnv *_env, jclass glImplClass)
static void *
-getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
+getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
{
jint position;
jint limit;
jint elementSizeShift;
jlong pointer;
- jint offset;
- void *data;
position = _env->GetIntField(buffer, positionID);
limit = _env->GetIntField(buffer, limitID);
@@ -84,11 +82,10 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
*array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
getBaseArrayID, buffer);
- offset = _env->CallStaticIntMethod(nioAccessClass,
+ *offset = _env->CallStaticIntMethod(nioAccessClass,
getBaseArrayOffsetID, buffer);
- data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0);
- return (void *) ((char *) data + offset);
+ return NULL;
}
diff --git a/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp
index 35a3c33..4ef815b 100644
--- a/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp
+++ b/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp
@@ -74,14 +74,12 @@ nativeClassInit(JNIEnv *_env, jclass glImplClass)
}
static void *
-getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
+getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
{
jint position;
jint limit;
jint elementSizeShift;
jlong pointer;
- jint offset;
- void *data;
position = _env->GetIntField(buffer, positionID);
limit = _env->GetIntField(buffer, limitID);
@@ -96,11 +94,10 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
*array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
getBaseArrayID, buffer);
- offset = _env->CallStaticIntMethod(nioAccessClass,
+ *offset = _env->CallStaticIntMethod(nioAccessClass,
getBaseArrayOffsetID, buffer);
- data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0);
- return (void *) ((char *) data + offset);
+ return NULL;
}
static void
diff --git a/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp
index 9b29a44..0df95f4 100644
--- a/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp
+++ b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp
@@ -71,14 +71,12 @@ nativeClassInit(JNIEnv *_env, jclass glImplClass)
static void *
-getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
+getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
{
jint position;
jint limit;
jint elementSizeShift;
jlong pointer;
- jint offset;
- void *data;
position = _env->GetIntField(buffer, positionID);
limit = _env->GetIntField(buffer, limitID);
@@ -93,11 +91,9 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
*array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
getBaseArrayID, buffer);
- offset = _env->CallStaticIntMethod(nioAccessClass,
+ *offset = _env->CallStaticIntMethod(nioAccessClass,
getBaseArrayOffsetID, buffer);
- data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0);
-
- return (void *) ((char *) data + offset);
+ return NULL;
}
diff --git a/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp
index 823079f..dd860d5 100644
--- a/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp
+++ b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp
@@ -69,14 +69,12 @@ nativeClassInit(JNIEnv *_env, jclass glImplClass)
static void *
-getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
+getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
{
jint position;
jint limit;
jint elementSizeShift;
jlong pointer;
- jint offset;
- void *data;
position = _env->GetIntField(buffer, positionID);
limit = _env->GetIntField(buffer, limitID);
@@ -91,11 +89,10 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
*array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
getBaseArrayID, buffer);
- offset = _env->CallStaticIntMethod(nioAccessClass,
+ *offset = _env->CallStaticIntMethod(nioAccessClass,
getBaseArrayOffsetID, buffer);
- data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0);
- return (void *) ((char *) data + offset);
+ return NULL;
}
diff --git a/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp
index 13a2577..996f441 100644
--- a/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp
+++ b/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp
@@ -62,14 +62,12 @@ nativeClassInit(JNIEnv *_env, jclass glImplClass)
static void *
-getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
+getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
{
jint position;
jint limit;
jint elementSizeShift;
jlong pointer;
- jint offset;
- void *data;
position = _env->GetIntField(buffer, positionID);
limit = _env->GetIntField(buffer, limitID);
@@ -84,11 +82,10 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
*array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
getBaseArrayID, buffer);
- offset = _env->CallStaticIntMethod(nioAccessClass,
+ *offset = _env->CallStaticIntMethod(nioAccessClass,
getBaseArrayOffsetID, buffer);
- data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0);
- return (void *) ((char *) data + offset);
+ return NULL;
}
diff --git a/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp b/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp
new file mode 100644
index 0000000..27b91fc
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp
@@ -0,0 +1,328 @@
+/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
+static void
+android_glGetActiveAttrib__III_3II_3II_3II_3BI
+ (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) {
+ jint _exception = 0;
+ const char * _exceptionType;
+ const char * _exceptionMessage;
+ GLsizei *length_base = (GLsizei *) 0;
+ jint _lengthRemaining;
+ GLsizei *length = (GLsizei *) 0;
+ GLint *size_base = (GLint *) 0;
+ jint _sizeRemaining;
+ GLint *size = (GLint *) 0;
+ GLenum *type_base = (GLenum *) 0;
+ jint _typeRemaining;
+ GLenum *type = (GLenum *) 0;
+ char *name_base = (char *) 0;
+ jint _nameRemaining;
+ char *name = (char *) 0;
+
+ if (!length_ref) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "length == null";
+ goto exit;
+ }
+ if (lengthOffset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "lengthOffset < 0";
+ goto exit;
+ }
+ _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
+ length_base = (GLsizei *)
+ _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
+ length = length_base + lengthOffset;
+
+ if (!size_ref) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "size == null";
+ goto exit;
+ }
+ if (sizeOffset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "sizeOffset < 0";
+ goto exit;
+ }
+ _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
+ size_base = (GLint *)
+ _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
+ size = size_base + sizeOffset;
+
+ if (!type_ref) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "type == null";
+ goto exit;
+ }
+ if (typeOffset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "typeOffset < 0";
+ goto exit;
+ }
+ _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
+ type_base = (GLenum *)
+ _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
+ type = type_base + typeOffset;
+
+ if (!name_ref) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "name == null";
+ goto exit;
+ }
+ if (nameOffset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "nameOffset < 0";
+ goto exit;
+ }
+ _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
+ name_base = (char *)
+ _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0);
+ name = name_base + nameOffset;
+
+ glGetActiveAttrib(
+ (GLuint)program,
+ (GLuint)index,
+ (GLsizei)bufsize,
+ (GLsizei *)length,
+ (GLint *)size,
+ (GLenum *)type,
+ (char *)name
+ );
+
+exit:
+ if (name_base) {
+ _env->ReleasePrimitiveArrayCritical(name_ref, name_base,
+ _exception ? JNI_ABORT: 0);
+ }
+ if (type_base) {
+ _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
+ _exception ? JNI_ABORT: 0);
+ }
+ if (size_base) {
+ _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
+ _exception ? JNI_ABORT: 0);
+ }
+ if (length_base) {
+ _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
+ _exception ? JNI_ABORT: 0);
+ }
+ if (_exception) {
+ jniThrowException(_env, _exceptionType, _exceptionMessage);
+ }
+}
+
+/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
+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;
+ jint _lengthBufferOffset = (jint) 0;
+ jarray _sizeArray = (jarray) 0;
+ jint _sizeBufferOffset = (jint) 0;
+ jarray _typeArray = (jarray) 0;
+ jint _typeBufferOffset = (jint) 0;
+ jint _lengthRemaining;
+ GLsizei *length = (GLsizei *) 0;
+ jint _sizeRemaining;
+ GLint *size = (GLint *) 0;
+ 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);
+ if (length == NULL) {
+ char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0);
+ length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
+ }
+ if (size == NULL) {
+ char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
+ size = (GLint *) (_sizeBase + _sizeBufferOffset);
+ }
+ if (type == NULL) {
+ char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
+ type = (GLenum *) (_typeBase + _typeBufferOffset);
+ }
+ glGetActiveAttrib(
+ (GLuint)program,
+ (GLuint)index,
+ (GLsizei)bufsize,
+ (GLsizei *)length,
+ (GLint *)size,
+ (GLenum *)type,
+ (char *)name
+ );
+ if (_typeArray) {
+ releasePointer(_env, _typeArray, type, JNI_TRUE);
+ }
+ if (_sizeArray) {
+ releasePointer(_env, _sizeArray, size, JNI_TRUE);
+ }
+ if (_lengthArray) {
+ releasePointer(_env, _lengthArray, length, JNI_TRUE);
+ }
+}
+
+/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
+static jstring
+android_glGetActiveAttrib1
+ (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
+ jint _exception = 0;
+ const char * _exceptionType;
+ const char * _exceptionMessage;
+ GLint *size_base = (GLint *) 0;
+ jint _sizeRemaining;
+ GLint *size = (GLint *) 0;
+ GLenum *type_base = (GLenum *) 0;
+ jint _typeRemaining;
+ GLenum *type = (GLenum *) 0;
+
+ jstring result = 0;
+
+ GLint len = 0;
+ glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
+ if (!len) {
+ return _env->NewStringUTF("");
+ }
+ char* buf = (char*) malloc(len);
+
+ if (buf == NULL) {
+ jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
+ return NULL;
+ }
+ if (!size_ref) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "size == null";
+ goto exit;
+ }
+ if (sizeOffset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "sizeOffset < 0";
+ goto exit;
+ }
+ _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
+ size_base = (GLint *)
+ _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
+ size = size_base + sizeOffset;
+
+ if (!type_ref) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "type == null";
+ goto exit;
+ }
+ if (typeOffset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "typeOffset < 0";
+ goto exit;
+ }
+ _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
+ type_base = (GLenum *)
+ _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
+ type = type_base + typeOffset;
+
+ glGetActiveAttrib(
+ (GLuint)program,
+ (GLuint)index,
+ (GLsizei)len,
+ NULL,
+ (GLint *)size,
+ (GLenum *)type,
+ (char *)buf
+ );
+exit:
+ if (type_base) {
+ _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
+ _exception ? JNI_ABORT: 0);
+ }
+ if (size_base) {
+ _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
+ _exception ? JNI_ABORT: 0);
+ }
+ if (_exception != 1) {
+ result = _env->NewStringUTF(buf);
+ }
+ if (buf) {
+ free(buf);
+ }
+ if (_exception) {
+ jniThrowException(_env, _exceptionType, _exceptionMessage);
+ }
+ if (result == 0) {
+ result = _env->NewStringUTF("");
+ }
+
+ return result;
+}
+
+/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
+static jstring
+android_glGetActiveAttrib2
+ (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
+ jarray _sizeArray = (jarray) 0;
+ jint _sizeBufferOffset = (jint) 0;
+ jarray _typeArray = (jarray) 0;
+ jint _typeBufferOffset = (jint) 0;
+ jint _lengthRemaining;
+ GLsizei *length = (GLsizei *) 0;
+ jint _sizeRemaining;
+ GLint *size = (GLint *) 0;
+ jint _typeRemaining;
+ GLenum *type = (GLenum *) 0;
+
+ jstring result = 0;
+
+ GLint len = 0;
+ glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
+ if (!len) {
+ return _env->NewStringUTF("");
+ }
+ char* buf = (char*) malloc(len);
+
+ if (buf == NULL) {
+ jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
+ return NULL;
+ }
+
+ size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
+ type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
+ if (size == NULL) {
+ char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
+ size = (GLint *) (_sizeBase + _sizeBufferOffset);
+ }
+ if (type == NULL) {
+ char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
+ type = (GLenum *) (_typeBase + _typeBufferOffset);
+ }
+ glGetActiveAttrib(
+ (GLuint)program,
+ (GLuint)index,
+ (GLsizei)len,
+ NULL,
+ (GLint *)size,
+ (GLenum *)type,
+ (char *)buf
+ );
+
+ if (_typeArray) {
+ releasePointer(_env, _typeArray, type, JNI_TRUE);
+ }
+ if (_sizeArray) {
+ releasePointer(_env, _sizeArray, size, JNI_TRUE);
+ }
+ result = _env->NewStringUTF(buf);
+ if (buf) {
+ free(buf);
+ }
+ return result;
+}
diff --git a/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.java b/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.java
new file mode 100644
index 0000000..bad2137
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.java
@@ -0,0 +1,47 @@
+ // C function void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
+
+ public static native void glGetActiveAttrib(
+ int program,
+ int index,
+ int bufsize,
+ int[] length,
+ int lengthOffset,
+ int[] size,
+ int sizeOffset,
+ int[] type,
+ int typeOffset,
+ byte[] name,
+ int nameOffset
+ );
+
+ // C function void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
+
+ public static native void glGetActiveAttrib(
+ int program,
+ int index,
+ int bufsize,
+ java.nio.IntBuffer length,
+ java.nio.IntBuffer size,
+ java.nio.IntBuffer type,
+ byte name
+ );
+
+ // C function void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
+
+ public static native String glGetActiveAttrib(
+ int program,
+ int index,
+ int[] size,
+ int sizeOffset,
+ int[] type,
+ int typeOffset
+ );
+
+ // C function void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
+
+ public static native String glGetActiveAttrib(
+ int program,
+ int index,
+ java.nio.IntBuffer size,
+ java.nio.IntBuffer type
+ );
diff --git a/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.nativeReg b/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.nativeReg
new file mode 100644
index 0000000..f54c0a0
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.nativeReg
@@ -0,0 +1,4 @@
+{"glGetActiveAttrib", "(III[II[II[II[BI)V", (void *) android_glGetActiveAttrib__III_3II_3II_3II_3BI },
+{"glGetActiveAttrib", "(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V", (void *) android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B },
+{"glGetActiveAttrib", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveAttrib1 },
+{"glGetActiveAttrib", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveAttrib2 },
diff --git a/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp b/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp
new file mode 100644
index 0000000..58f704c
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp
@@ -0,0 +1,329 @@
+/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
+static void
+android_glGetActiveUniform__III_3II_3II_3II_3BI
+ (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) {
+ jint _exception = 0;
+ const char * _exceptionType;
+ const char * _exceptionMessage;
+ GLsizei *length_base = (GLsizei *) 0;
+ jint _lengthRemaining;
+ GLsizei *length = (GLsizei *) 0;
+ GLint *size_base = (GLint *) 0;
+ jint _sizeRemaining;
+ GLint *size = (GLint *) 0;
+ GLenum *type_base = (GLenum *) 0;
+ jint _typeRemaining;
+ GLenum *type = (GLenum *) 0;
+ char *name_base = (char *) 0;
+ jint _nameRemaining;
+ char *name = (char *) 0;
+
+ if (!length_ref) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "length == null";
+ goto exit;
+ }
+ if (lengthOffset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "lengthOffset < 0";
+ goto exit;
+ }
+ _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
+ length_base = (GLsizei *)
+ _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
+ length = length_base + lengthOffset;
+
+ if (!size_ref) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "size == null";
+ goto exit;
+ }
+ if (sizeOffset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "sizeOffset < 0";
+ goto exit;
+ }
+ _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
+ size_base = (GLint *)
+ _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
+ size = size_base + sizeOffset;
+
+ if (!type_ref) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "type == null";
+ goto exit;
+ }
+ if (typeOffset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "typeOffset < 0";
+ goto exit;
+ }
+ _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
+ type_base = (GLenum *)
+ _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
+ type = type_base + typeOffset;
+
+ if (!name_ref) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "name == null";
+ goto exit;
+ }
+ if (nameOffset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "nameOffset < 0";
+ goto exit;
+ }
+ _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
+ name_base = (char *)
+ _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0);
+ name = name_base + nameOffset;
+
+ glGetActiveUniform(
+ (GLuint)program,
+ (GLuint)index,
+ (GLsizei)bufsize,
+ (GLsizei *)length,
+ (GLint *)size,
+ (GLenum *)type,
+ (char *)name
+ );
+
+exit:
+ if (name_base) {
+ _env->ReleasePrimitiveArrayCritical(name_ref, name_base,
+ _exception ? JNI_ABORT: 0);
+ }
+ if (type_base) {
+ _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
+ _exception ? JNI_ABORT: 0);
+ }
+ if (size_base) {
+ _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
+ _exception ? JNI_ABORT: 0);
+ }
+ if (length_base) {
+ _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
+ _exception ? JNI_ABORT: 0);
+ }
+ if (_exception) {
+ jniThrowException(_env, _exceptionType, _exceptionMessage);
+ }
+}
+
+/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
+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;
+ jint _lengthBufferOffset = (jint) 0;
+ jarray _sizeArray = (jarray) 0;
+ jint _sizeBufferOffset = (jint) 0;
+ jarray _typeArray = (jarray) 0;
+ jint _typeBufferOffset = (jint) 0;
+ jint _lengthRemaining;
+ GLsizei *length = (GLsizei *) 0;
+ jint _sizeRemaining;
+ GLint *size = (GLint *) 0;
+ 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);
+ if (length == NULL) {
+ char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0);
+ length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
+ }
+ if (size == NULL) {
+ char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
+ size = (GLint *) (_sizeBase + _sizeBufferOffset);
+ }
+ if (type == NULL) {
+ char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
+ type = (GLenum *) (_typeBase + _typeBufferOffset);
+ }
+ glGetActiveUniform(
+ (GLuint)program,
+ (GLuint)index,
+ (GLsizei)bufsize,
+ (GLsizei *)length,
+ (GLint *)size,
+ (GLenum *)type,
+ (char *)name
+ );
+ if (_typeArray) {
+ releasePointer(_env, _typeArray, type, JNI_TRUE);
+ }
+ if (_sizeArray) {
+ releasePointer(_env, _sizeArray, size, JNI_TRUE);
+ }
+ if (_lengthArray) {
+ releasePointer(_env, _lengthArray, length, JNI_TRUE);
+ }
+}
+
+/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
+static jstring
+android_glGetActiveUniform1
+ (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
+ jint _exception = 0;
+ const char * _exceptionType;
+ const char * _exceptionMessage;
+
+ GLint *size_base = (GLint *) 0;
+ jint _sizeRemaining;
+ GLint *size = (GLint *) 0;
+
+ GLenum *type_base = (GLenum *) 0;
+ jint _typeRemaining;
+ GLenum *type = (GLenum *) 0;
+
+ jstring result = 0;
+
+ GLint len = 0;
+ glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
+ if (!len) {
+ return _env->NewStringUTF("");
+ }
+ char* buf = (char*) malloc(len);
+
+ if (buf == NULL) {
+ jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
+ return NULL;
+ }
+
+ if (!size_ref) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "size == null";
+ goto exit;
+ }
+ if (sizeOffset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "sizeOffset < 0";
+ goto exit;
+ }
+ _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
+ size_base = (GLint *)
+ _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
+ size = size_base + sizeOffset;
+
+ if (!type_ref) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "type == null";
+ goto exit;
+ }
+ if (typeOffset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "typeOffset < 0";
+ goto exit;
+ }
+ _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
+ type_base = (GLenum *)
+ _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
+ type = type_base + typeOffset;
+
+ glGetActiveUniform(
+ (GLuint)program,
+ (GLuint)index,
+ (GLsizei)len,
+ NULL,
+ (GLint *)size,
+ (GLenum *)type,
+ (char *)buf
+ );
+
+exit:
+ if (type_base) {
+ _env->ReleasePrimitiveArrayCritical(type_ref, type_base,
+ _exception ? JNI_ABORT: 0);
+ }
+ if (size_base) {
+ _env->ReleasePrimitiveArrayCritical(size_ref, size_base,
+ _exception ? JNI_ABORT: 0);
+ }
+ if (_exception != 1) {
+ result = _env->NewStringUTF(buf);
+ }
+ if (buf) {
+ free(buf);
+ }
+ if (_exception) {
+ jniThrowException(_env, _exceptionType, _exceptionMessage);
+ }
+ if (result == 0) {
+ result = _env->NewStringUTF("");
+ }
+ return result;
+}
+
+/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
+static jstring
+android_glGetActiveUniform2
+ (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
+ jarray _sizeArray = (jarray) 0;
+ jint _sizeBufferOffset = (jint) 0;
+ jarray _typeArray = (jarray) 0;
+ jint _typeBufferOffset = (jint) 0;
+ jint _sizeRemaining;
+ GLint *size = (GLint *) 0;
+ jint _typeRemaining;
+ GLenum *type = (GLenum *) 0;
+
+ jstring result = 0;
+ GLint len = 0;
+ glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
+ if (!len) {
+ return _env->NewStringUTF("");
+ }
+ char* buf = (char*) malloc(len);
+
+ if (buf == NULL) {
+ jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
+ return NULL;
+ }
+
+ size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
+ type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
+
+ if (size == NULL) {
+ char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
+ size = (GLint *) (_sizeBase + _sizeBufferOffset);
+ }
+ if (type == NULL) {
+ char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
+ type = (GLenum *) (_typeBase + _typeBufferOffset);
+ }
+ glGetActiveUniform(
+ (GLuint)program,
+ (GLuint)index,
+ len,
+ NULL,
+ (GLint *)size,
+ (GLenum *)type,
+ (char *)buf
+ );
+
+ if (_typeArray) {
+ releasePointer(_env, _typeArray, type, JNI_TRUE);
+ }
+ if (_sizeArray) {
+ releasePointer(_env, _sizeArray, size, JNI_TRUE);
+ }
+ result = _env->NewStringUTF(buf);
+ if (buf) {
+ free(buf);
+ }
+ return result;
+}
diff --git a/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.java b/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.java
new file mode 100644
index 0000000..28aaa78
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.java
@@ -0,0 +1,46 @@
+ // C function void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
+
+ public static native void glGetActiveUniform(
+ int program,
+ int index,
+ int bufsize,
+ int[] length,
+ int lengthOffset,
+ int[] size,
+ int sizeOffset,
+ int[] type,
+ int typeOffset,
+ byte[] name,
+ int nameOffset
+ );
+
+ // C function void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
+
+ public static native void glGetActiveUniform(
+ int program,
+ int index,
+ int bufsize,
+ java.nio.IntBuffer length,
+ java.nio.IntBuffer size,
+ java.nio.IntBuffer type,
+ byte name
+ );
+ // C function void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
+
+ public static native String glGetActiveUniform(
+ int program,
+ int index,
+ int[] size,
+ int sizeOffset,
+ int[] type,
+ int typeOffset
+ );
+
+ // C function void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name )
+
+ public static native String glGetActiveUniform(
+ int program,
+ int index,
+ java.nio.IntBuffer size,
+ java.nio.IntBuffer type
+ );
diff --git a/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.nativeReg b/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.nativeReg
new file mode 100644
index 0000000..f0b5fd9
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.nativeReg
@@ -0,0 +1,4 @@
+{"glGetActiveUniform", "(III[II[II[II[BI)V", (void *) android_glGetActiveUniform__III_3II_3II_3II_3BI },
+{"glGetActiveUniform", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveUniform1 },
+{"glGetActiveUniform", "(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V", (void *) android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B },
+{"glGetActiveUniform", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveUniform2 },
diff --git a/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp b/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp
new file mode 100644
index 0000000..a7e1cd2
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp
@@ -0,0 +1,111 @@
+/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
+static void
+android_glGetShaderSource__II_3II_3BI
+ (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jintArray length_ref, jint lengthOffset, jbyteArray source_ref, jint sourceOffset) {
+ jint _exception = 0;
+ const char * _exceptionType;
+ const char * _exceptionMessage;
+ GLsizei *length_base = (GLsizei *) 0;
+ jint _lengthRemaining;
+ GLsizei *length = (GLsizei *) 0;
+ char *source_base = (char *) 0;
+ jint _sourceRemaining;
+ char *source = (char *) 0;
+
+ if (!length_ref) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "length == null";
+ goto exit;
+ }
+ if (lengthOffset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "lengthOffset < 0";
+ goto exit;
+ }
+ _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
+ length_base = (GLsizei *)
+ _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
+ length = length_base + lengthOffset;
+
+ if (!source_ref) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "source == null";
+ goto exit;
+ }
+ if (sourceOffset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "sourceOffset < 0";
+ goto exit;
+ }
+ _sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset;
+ source_base = (char *)
+ _env->GetPrimitiveArrayCritical(source_ref, (jboolean *)0);
+ source = source_base + sourceOffset;
+
+ glGetShaderSource(
+ (GLuint)shader,
+ (GLsizei)bufsize,
+ (GLsizei *)length,
+ (char *)source
+ );
+
+exit:
+ if (source_base) {
+ _env->ReleasePrimitiveArrayCritical(source_ref, source_base,
+ _exception ? JNI_ABORT: 0);
+ }
+ if (length_base) {
+ _env->ReleasePrimitiveArrayCritical(length_ref, length_base,
+ _exception ? JNI_ABORT: 0);
+ }
+ if (_exception) {
+ jniThrowException(_env, _exceptionType, _exceptionMessage);
+ }
+}
+
+/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
+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;
+ jint _bufferOffset = (jint) 0;
+ jint _remaining;
+ GLsizei *length = (GLsizei *) 0;
+
+ length = (GLsizei *)getPointer(_env, length_buf, &_array, &_remaining, &_bufferOffset);
+ if (length == NULL) {
+ char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
+ length = (GLsizei *) (_lengthBase + _bufferOffset);
+ }
+ glGetShaderSource(
+ (GLuint)shader,
+ (GLsizei)bufsize,
+ (GLsizei *)length,
+ (char *)source
+ );
+ if (_array) {
+ releasePointer(_env, _array, length, JNI_TRUE);
+ }
+}
+
+/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
+static jstring android_glGetShaderSource(JNIEnv *_env, jobject, jint shader) {
+ GLint shaderLen = 0;
+ glGetShaderiv((GLuint)shader, GL_SHADER_SOURCE_LENGTH, &shaderLen);
+ if (!shaderLen) {
+ return _env->NewStringUTF("");
+ }
+ char* buf = (char*) malloc(shaderLen);
+ if (buf == NULL) {
+ jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
+ return NULL;
+ }
+ glGetShaderSource(shader, shaderLen, NULL, buf);
+ jstring result = _env->NewStringUTF(buf);
+ free(buf);
+ return result;
+}
diff --git a/opengl/tools/glgen/stubs/gles11/glGetShaderSource.java b/opengl/tools/glgen/stubs/gles11/glGetShaderSource.java
new file mode 100644
index 0000000..199d93a
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/glGetShaderSource.java
@@ -0,0 +1,25 @@
+ // C function void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source )
+
+ public static native void glGetShaderSource(
+ int shader,
+ int bufsize,
+ int[] length,
+ int lengthOffset,
+ byte[] source,
+ int sourceOffset
+ );
+
+ // C function void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source )
+
+ public static native void glGetShaderSource(
+ int shader,
+ int bufsize,
+ java.nio.IntBuffer length,
+ byte source
+ );
+
+ // C function void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source )
+
+ public static native String glGetShaderSource(
+ int shader
+ );
diff --git a/opengl/tools/glgen/stubs/gles11/glGetShaderSource.nativeReg b/opengl/tools/glgen/stubs/gles11/glGetShaderSource.nativeReg
new file mode 100644
index 0000000..acb47a5
--- /dev/null
+++ b/opengl/tools/glgen/stubs/gles11/glGetShaderSource.nativeReg
@@ -0,0 +1,3 @@
+{"glGetShaderSource", "(II[II[BI)V", (void *) android_glGetShaderSource__II_3II_3BI },
+{"glGetShaderSource", "(IILjava/nio/IntBuffer;B)V", (void *) android_glGetShaderSource__IILjava_nio_IntBuffer_2B },
+{"glGetShaderSource", "(I)Ljava/lang/String;", (void *) android_glGetShaderSource },
diff --git a/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
index f7315ee..cc10336 100644
--- a/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
+++ b/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp
@@ -113,14 +113,12 @@ nativeClassInit(JNIEnv *_env, jclass glImplClass)
}
static void *
-getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
+getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
{
jint position;
jint limit;
jint elementSizeShift;
jlong pointer;
- jint offset;
- void *data;
position = _env->GetIntField(buffer, positionID);
limit = _env->GetIntField(buffer, limitID);
@@ -138,11 +136,10 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining)
if (*array == NULL) {
return (void*) NULL;
}
- offset = _env->CallStaticIntMethod(nioAccessClass,
+ *offset = _env->CallStaticIntMethod(nioAccessClass,
getBaseArrayOffsetID, buffer);
- data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0);
- return (void *) ((char *) data + offset);
+ return NULL;
}
static void
@@ -180,10 +177,12 @@ getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
if (allowIndirectBuffers(_env)) {
jarray array = 0;
jint remaining;
- buf = getPointer(_env, buffer, &array, &remaining);
+ jint offset;
+ buf = getPointer(_env, buffer, &array, &remaining, &offset);
if (array) {
releasePointer(_env, array, buf, 0);
}
+ buf = buf + offset;
} else {
jniThrowException(_env, "java/lang/IllegalArgumentException",
"Must use a native order direct Buffer");
diff --git a/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl b/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl
index cd730aa..e3aea76 100644
--- a/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl
+++ b/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl
@@ -22,6 +22,7 @@ import android.app.AppGlobals;
import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageManager;
import android.os.Build;
+import android.os.UserId;
import android.util.Log;
import java.nio.Buffer;
@@ -66,7 +67,7 @@ public class GLImpl implements GL10, GL10Ext, GL11, GL11Ext, GL11ExtensionPack {
int version = 0;
IPackageManager pm = AppGlobals.getPackageManager();
try {
- ApplicationInfo applicationInfo = pm.getApplicationInfo(appName, 0);
+ ApplicationInfo applicationInfo = pm.getApplicationInfo(appName, 0, UserId.myUserId());
if (applicationInfo != null) {
version = applicationInfo.targetSdkVersion;
}