diff options
Diffstat (limited to 'opengl/tools/glgen/stubs')
57 files changed, 1844 insertions, 568 deletions
diff --git a/opengl/tools/glgen/stubs/egl/EGL14Header.java-if b/opengl/tools/glgen/stubs/egl/EGL14Header.java-if index 0c29d5c..f3bf220 100644 --- a/opengl/tools/glgen/stubs/egl/EGL14Header.java-if +++ b/opengl/tools/glgen/stubs/egl/EGL14Header.java-if @@ -1,4 +1,4 @@ -** +/* ** Copyright 2012, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp b/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp index 7904ac7..54de1e7 100644 --- a/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp +++ b/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp @@ -1,4 +1,4 @@ -** +/* ** Copyright 2012, The Android Open Source Project ** ** Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,8 +27,8 @@ #include <EGL/egl.h> #include <gui/Surface.h> -#include <gui/SurfaceTexture.h> -#include <gui/SurfaceTextureClient.h> +#include <gui/GLConsumer.h> +#include <gui/Surface.h> #include <ui/ANativeObjectBase.h> diff --git a/opengl/tools/glgen/stubs/egl/EGLExtHeader.java-if b/opengl/tools/glgen/stubs/egl/EGLExtHeader.java-if new file mode 100644 index 0000000..a5a8968 --- /dev/null +++ b/opengl/tools/glgen/stubs/egl/EGLExtHeader.java-if @@ -0,0 +1,36 @@ +/* +** Copyright 2013, 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; + +/** + * EGL Extensions + */ +public class EGLExt { + + // EGL_KHR_create_context + public static final int EGL_CONTEXT_MAJOR_VERSION_KHR = 0x3098; + public static final int EGL_CONTEXT_MINOR_VERSION_KHR = 0x30FB; + public static final int EGL_CONTEXT_FLAGS_KHR = 0x30FC; + public static final int EGL_OPENGL_ES3_BIT_KHR = 0x0040; + + native private static void _nativeClassInit(); + static { + _nativeClassInit(); + } + diff --git a/opengl/tools/glgen/stubs/egl/EGLExtcHeader.cpp b/opengl/tools/glgen/stubs/egl/EGLExtcHeader.cpp new file mode 100644 index 0000000..5e1ffa1 --- /dev/null +++ b/opengl/tools/glgen/stubs/egl/EGLExtcHeader.cpp @@ -0,0 +1,133 @@ +/* +** Copyright 2013, 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 <EGL/eglext.h> + +#include <gui/Surface.h> +#include <gui/GLConsumer.h> +#include <gui/Surface.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 index 610cde5..906cd80 100644 --- a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp +++ b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp @@ -34,7 +34,7 @@ not_valid_surface: goto exit; } - window = android::android_Surface_getNativeWindow(_env, win); + window = android::android_view_Surface_getNativeWindow(_env, win); if (window == NULL) goto not_valid_surface; @@ -90,7 +90,7 @@ android_eglCreateWindowSurfaceTexture jint _remaining; EGLint *attrib_list = (EGLint *) 0; android::sp<ANativeWindow> window; - android::sp<android::SurfaceTexture> surfaceTexture; + android::sp<android::GLConsumer> glConsumer; if (!attrib_list_ref) { _exception = 1; @@ -111,8 +111,12 @@ not_valid_surface: _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); + glConsumer = android::SurfaceTexture_getSurfaceTexture(_env, win); + + if (glConsumer == NULL) + goto not_valid_surface; + + window = new android::Surface(glConsumer->getBufferQueue()); if (window == NULL) goto not_valid_surface; diff --git a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.java b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.java index e42334e..5d088bd 100644 --- a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.java +++ b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.java @@ -29,6 +29,8 @@ } else if (win instanceof SurfaceHolder) { SurfaceHolder holder = (SurfaceHolder)win; sur = holder.getSurface(); + } else if (win instanceof Surface) { + sur = (Surface) win; } EGLSurface surface; @@ -40,7 +42,7 @@ } else { throw new java.lang.UnsupportedOperationException( "eglCreateWindowSurface() can only be called with an instance of " + - "SurfaceView, SurfaceTexture or SurfaceHolder at the moment, " + + "Surface, SurfaceView, SurfaceTexture or SurfaceHolder at the moment, " + "this will be fixed later."); } diff --git a/opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if b/opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if index 42891ea..146d883 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if +++ b/opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if @@ -1,3 +1,4 @@ +/* ** ** Copyright 2009, The Android Open Source Project ** diff --git a/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp index 172c0e7..8a1d5ed 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp +++ b/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp @@ -1,3 +1,4 @@ +/* ** ** Copyright 2009, The Android Open Source Project ** @@ -16,84 +17,6 @@ // This source file is automatically generated -#include "jni.h" -#include "JNIHelp.h" -#include <android_runtime/AndroidRuntime.h> -#include <utils/misc.h> - -#include <assert.h> #include <GLES/gl.h> #include <GLES/glext.h> -static int initialized = 0; - -static jclass nioAccessClass; -static jclass bufferClass; -static jmethodID getBasePointerID; -static jmethodID getBaseArrayID; -static jmethodID getBaseArrayOffsetID; -static jfieldID positionID; -static jfieldID limitID; -static jfieldID elementSizeShiftID; - -/* Cache method IDs each time the class is loaded. */ - -static void -nativeClassInit(JNIEnv *_env, jclass glImplClass) -{ - jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); - nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); - - jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); - bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); - - getBasePointerID = _env->GetStaticMethodID(nioAccessClass, - "getBasePointer", "(Ljava/nio/Buffer;)J"); - getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, - "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); - getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, - "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); - - positionID = _env->GetFieldID(bufferClass, "position", "I"); - limitID = _env->GetFieldID(bufferClass, "limit", "I"); - elementSizeShiftID = - _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); -} - - -static void * -getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset) -{ - jint position; - jint limit; - jint elementSizeShift; - jlong pointer; - - position = _env->GetIntField(buffer, positionID); - limit = _env->GetIntField(buffer, limitID); - elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); - *remaining = (limit - position) << elementSizeShift; - pointer = _env->CallStaticLongMethod(nioAccessClass, - getBasePointerID, buffer); - if (pointer != 0L) { - *array = NULL; - return (void *) (jint) pointer; - } - - *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, - getBaseArrayID, buffer); - *offset = _env->CallStaticIntMethod(nioAccessClass, - getBaseArrayOffsetID, buffer); - - return NULL; -} - - -static void -releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) -{ - _env->ReleasePrimitiveArrayCritical(array, data, - commit ? 0 : JNI_ABORT); -} - -// -------------------------------------------------------------------------- diff --git a/opengl/tools/glgen/stubs/gles11/GLES10Header.java-if b/opengl/tools/glgen/stubs/gles11/GLES10Header.java-if index 4b2a831..16cab04 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES10Header.java-if +++ b/opengl/tools/glgen/stubs/gles11/GLES10Header.java-if @@ -1,3 +1,4 @@ +/* ** ** Copyright 2009, The Android Open Source Project ** diff --git a/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp index 4ef815b..8a1d5ed 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp +++ b/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp @@ -1,3 +1,4 @@ +/* ** ** Copyright 2009, The Android Open Source Project ** @@ -16,116 +17,6 @@ // This source file is automatically generated -#include "jni.h" -#include "JNIHelp.h" -#include <android_runtime/AndroidRuntime.h> -#include <utils/misc.h> - -#include <assert.h> #include <GLES/gl.h> #include <GLES/glext.h> -/* special calls implemented in Android's GLES wrapper used to more - * efficiently bound-check passed arrays */ -extern "C" { -GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride, - const GLvoid *ptr, GLsizei count); -GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride, - const GLvoid *pointer, GLsizei count); -GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer, GLsizei count); -GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer, GLsizei count); -} - -static int initialized = 0; - -static jclass nioAccessClass; -static jclass bufferClass; -static jmethodID getBasePointerID; -static jmethodID getBaseArrayID; -static jmethodID getBaseArrayOffsetID; -static jfieldID positionID; -static jfieldID limitID; -static jfieldID elementSizeShiftID; - -/* Cache method IDs each time the class is loaded. */ - -static void -nativeClassInit(JNIEnv *_env, jclass glImplClass) -{ - jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); - nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); - - jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); - bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); - - getBasePointerID = _env->GetStaticMethodID(nioAccessClass, - "getBasePointer", "(Ljava/nio/Buffer;)J"); - getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, - "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); - getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, - "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); - - positionID = _env->GetFieldID(bufferClass, "position", "I"); - limitID = _env->GetFieldID(bufferClass, "limit", "I"); - elementSizeShiftID = - _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); -} - -static void * -getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset) -{ - jint position; - jint limit; - jint elementSizeShift; - jlong pointer; - - position = _env->GetIntField(buffer, positionID); - limit = _env->GetIntField(buffer, limitID); - elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); - *remaining = (limit - position) << elementSizeShift; - pointer = _env->CallStaticLongMethod(nioAccessClass, - getBasePointerID, buffer); - if (pointer != 0L) { - *array = NULL; - return (void *) (jint) pointer; - } - - *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, - getBaseArrayID, buffer); - *offset = _env->CallStaticIntMethod(nioAccessClass, - getBaseArrayOffsetID, buffer); - - return NULL; -} - -static void -releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) -{ - _env->ReleasePrimitiveArrayCritical(array, data, - commit ? 0 : JNI_ABORT); -} - -static void * -getDirectBufferPointer(JNIEnv *_env, jobject buffer) { - char* buf = (char*) _env->GetDirectBufferAddress(buffer); - if (buf) { - jint position = _env->GetIntField(buffer, positionID); - jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); - buf += position << elementSizeShift; - } else { - jniThrowException(_env, "java/lang/IllegalArgumentException", - "Must use a native order direct Buffer"); - } - return (void*) buf; -} - -static int -getNumCompressedTextureFormats() { - int numCompressedTextureFormats = 0; - glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats); - return numCompressedTextureFormats; -} - -// -------------------------------------------------------------------------- diff --git a/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if b/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if index 0c5fa04..efaf867 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if +++ b/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if @@ -1,3 +1,4 @@ +/* ** ** Copyright 2009, The Android Open Source Project ** diff --git a/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp index 0df95f4..8a1d5ed 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp +++ b/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp @@ -1,3 +1,4 @@ +/* ** ** Copyright 2009, The Android Open Source Project ** @@ -16,105 +17,6 @@ // This source file is automatically generated -#include "jni.h" -#include "JNIHelp.h" -#include <android_runtime/AndroidRuntime.h> -#include <utils/misc.h> - -#include <assert.h> #include <GLES/gl.h> #include <GLES/glext.h> -/* special calls implemented in Android's GLES wrapper used to more - * efficiently bound-check passed arrays */ -extern "C" { -GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, GLsizei stride, - const GLvoid *ptr, GLsizei count); -GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, GLsizei stride, - const GLvoid *ptr, GLsizei count); -} - -static int initialized = 0; - -static jclass nioAccessClass; -static jclass bufferClass; -static jmethodID getBasePointerID; -static jmethodID getBaseArrayID; -static jmethodID getBaseArrayOffsetID; -static jfieldID positionID; -static jfieldID limitID; -static jfieldID elementSizeShiftID; - -/* Cache method IDs each time the class is loaded. */ - -static void -nativeClassInit(JNIEnv *_env, jclass glImplClass) -{ - jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); - nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); - - jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); - bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); - - getBasePointerID = _env->GetStaticMethodID(nioAccessClass, - "getBasePointer", "(Ljava/nio/Buffer;)J"); - getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, - "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); - getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, - "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); - - positionID = _env->GetFieldID(bufferClass, "position", "I"); - limitID = _env->GetFieldID(bufferClass, "limit", "I"); - elementSizeShiftID = - _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); -} - - -static void * -getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset) -{ - jint position; - jint limit; - jint elementSizeShift; - jlong pointer; - - position = _env->GetIntField(buffer, positionID); - limit = _env->GetIntField(buffer, limitID); - elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); - *remaining = (limit - position) << elementSizeShift; - pointer = _env->CallStaticLongMethod(nioAccessClass, - getBasePointerID, buffer); - if (pointer != 0L) { - *array = NULL; - return (void *) (jint) pointer; - } - - *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, - getBaseArrayID, buffer); - *offset = _env->CallStaticIntMethod(nioAccessClass, - getBaseArrayOffsetID, buffer); - return NULL; -} - - -static void -releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) -{ - _env->ReleasePrimitiveArrayCritical(array, data, - commit ? 0 : JNI_ABORT); -} - -static void * -getDirectBufferPointer(JNIEnv *_env, jobject buffer) { - char* buf = (char*) _env->GetDirectBufferAddress(buffer); - if (buf) { - jint position = _env->GetIntField(buffer, positionID); - jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); - buf += position << elementSizeShift; - } else { - jniThrowException(_env, "java/lang/IllegalArgumentException", - "Must use a native order direct Buffer"); - } - return (void*) buf; -} -// -------------------------------------------------------------------------- diff --git a/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if b/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if index 81572d2..e63d470 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if +++ b/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if @@ -1,3 +1,4 @@ +/* ** ** Copyright 2009, The Android Open Source Project ** diff --git a/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp index dd860d5..8a1d5ed 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp +++ b/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp @@ -1,3 +1,4 @@ +/* ** ** Copyright 2009, The Android Open Source Project ** @@ -16,105 +17,6 @@ // This source file is automatically generated -#include "jni.h" -#include "JNIHelp.h" -#include <android_runtime/AndroidRuntime.h> -#include <utils/misc.h> - -#include <assert.h> #include <GLES/gl.h> #include <GLES/glext.h> -/* special calls implemented in Android's GLES wrapper used to more - * efficiently bound-check passed arrays */ -extern "C" { -GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, GLsizei stride, - const GLvoid *ptr, GLsizei count); -} - -static int initialized = 0; - -static jclass nioAccessClass; -static jclass bufferClass; -static jmethodID getBasePointerID; -static jmethodID getBaseArrayID; -static jmethodID getBaseArrayOffsetID; -static jfieldID positionID; -static jfieldID limitID; -static jfieldID elementSizeShiftID; - -/* Cache method IDs each time the class is loaded. */ - -static void -nativeClassInit(JNIEnv *_env, jclass glImplClass) -{ - jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); - nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); - - jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); - bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); - - getBasePointerID = _env->GetStaticMethodID(nioAccessClass, - "getBasePointer", "(Ljava/nio/Buffer;)J"); - getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, - "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); - getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, - "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); - - positionID = _env->GetFieldID(bufferClass, "position", "I"); - limitID = _env->GetFieldID(bufferClass, "limit", "I"); - elementSizeShiftID = - _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); -} - - -static void * -getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset) -{ - jint position; - jint limit; - jint elementSizeShift; - jlong pointer; - - position = _env->GetIntField(buffer, positionID); - limit = _env->GetIntField(buffer, limitID); - elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); - *remaining = (limit - position) << elementSizeShift; - pointer = _env->CallStaticLongMethod(nioAccessClass, - getBasePointerID, buffer); - if (pointer != 0L) { - *array = NULL; - return (void *) (jint) pointer; - } - - *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, - getBaseArrayID, buffer); - *offset = _env->CallStaticIntMethod(nioAccessClass, - getBaseArrayOffsetID, buffer); - - return NULL; -} - - -static void -releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) -{ - _env->ReleasePrimitiveArrayCritical(array, data, - commit ? 0 : JNI_ABORT); -} - -static void * -getDirectBufferPointer(JNIEnv *_env, jobject buffer) { - char* buf = (char*) _env->GetDirectBufferAddress(buffer); - if (buf) { - jint position = _env->GetIntField(buffer, positionID); - jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); - buf += position << elementSizeShift; - } else { - jniThrowException(_env, "java/lang/IllegalArgumentException", - "Must use a native order direct Buffer"); - } - return (void*) buf; -} - -// -------------------------------------------------------------------------- diff --git a/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if b/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if index b615e0a..9ce6728 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if +++ b/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if @@ -1,3 +1,4 @@ +/* ** ** Copyright 2009, The Android Open Source Project ** @@ -295,6 +296,10 @@ public class GLES20 { public static final int GL_RGB5_A1 = 0x8057; public static final int GL_RGB565 = 0x8D62; public static final int GL_DEPTH_COMPONENT16 = 0x81A5; + // GL_STENCIL_INDEX does not appear in gl2.h or gl2ext.h, and there is no + // token with value 0x1901. + // + @Deprecated public static final int GL_STENCIL_INDEX = 0x1901; public static final int GL_STENCIL_INDEX8 = 0x8D48; public static final int GL_RENDERBUFFER_WIDTH = 0x8D42; @@ -326,5 +331,5 @@ public class GLES20 { native private static void _nativeClassInit(); static { - _nativeClassInit(); + _nativeClassInit(); } diff --git a/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp index 996f441..2389563 100644 --- a/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp +++ b/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp @@ -1,3 +1,4 @@ +/* ** ** Copyright 2009, The Android Open Source Project ** @@ -16,110 +17,6 @@ // This source file is automatically generated -#include "jni.h" -#include "JNIHelp.h" -#include <android_runtime/AndroidRuntime.h> -#include <utils/misc.h> - -#include <assert.h> #include <GLES2/gl2.h> #include <GLES2/gl2ext.h> -static int initialized = 0; - -static jclass nioAccessClass; -static jclass bufferClass; -static jmethodID getBasePointerID; -static jmethodID getBaseArrayID; -static jmethodID getBaseArrayOffsetID; -static jfieldID positionID; -static jfieldID limitID; -static jfieldID elementSizeShiftID; - -/* Cache method IDs each time the class is loaded. */ - -static void -nativeClassInit(JNIEnv *_env, jclass glImplClass) -{ - jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); - nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); - - jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); - bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); - - getBasePointerID = _env->GetStaticMethodID(nioAccessClass, - "getBasePointer", "(Ljava/nio/Buffer;)J"); - getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, - "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); - getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, - "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); - - positionID = _env->GetFieldID(bufferClass, "position", "I"); - limitID = _env->GetFieldID(bufferClass, "limit", "I"); - elementSizeShiftID = - _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); -} - - -static void * -getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset) -{ - jint position; - jint limit; - jint elementSizeShift; - jlong pointer; - - position = _env->GetIntField(buffer, positionID); - limit = _env->GetIntField(buffer, limitID); - elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); - *remaining = (limit - position) << elementSizeShift; - pointer = _env->CallStaticLongMethod(nioAccessClass, - getBasePointerID, buffer); - if (pointer != 0L) { - *array = NULL; - return (void *) (jint) pointer; - } - - *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, - getBaseArrayID, buffer); - *offset = _env->CallStaticIntMethod(nioAccessClass, - getBaseArrayOffsetID, buffer); - - return NULL; -} - - -static void -releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) -{ - _env->ReleasePrimitiveArrayCritical(array, data, - commit ? 0 : JNI_ABORT); -} - -static void * -getDirectBufferPointer(JNIEnv *_env, jobject buffer) { - char* buf = (char*) _env->GetDirectBufferAddress(buffer); - if (buf) { - jint position = _env->GetIntField(buffer, positionID); - jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); - buf += position << elementSizeShift; - } else { - jniThrowException(_env, "java/lang/IllegalArgumentException", - "Must use a native order direct Buffer"); - } - return (void*) buf; -} - -static int -getNumCompressedTextureFormats() { - int numCompressedTextureFormats = 0; - glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats); - return numCompressedTextureFormats; -} - -static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type, - GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) { - glVertexAttribPointer(indx, size, type, normalized, stride, pointer); -} - -// -------------------------------------------------------------------------- diff --git a/opengl/tools/glgen/stubs/gles11/GLES30Header.java-if b/opengl/tools/glgen/stubs/gles11/GLES30Header.java-if new file mode 100644 index 0000000..747dbd3 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/GLES30Header.java-if @@ -0,0 +1,337 @@ +/* +** +** Copyright 2013, 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; + +/** OpenGL ES 3.0 + */ +public class GLES30 extends GLES20 { + public static final int GL_READ_BUFFER = 0x0C02; + public static final int GL_UNPACK_ROW_LENGTH = 0x0CF2; + public static final int GL_UNPACK_SKIP_ROWS = 0x0CF3; + public static final int GL_UNPACK_SKIP_PIXELS = 0x0CF4; + public static final int GL_PACK_ROW_LENGTH = 0x0D02; + public static final int GL_PACK_SKIP_ROWS = 0x0D03; + public static final int GL_PACK_SKIP_PIXELS = 0x0D04; + public static final int GL_COLOR = 0x1800; + public static final int GL_DEPTH = 0x1801; + public static final int GL_STENCIL = 0x1802; + public static final int GL_RED = 0x1903; + public static final int GL_RGB8 = 0x8051; + public static final int GL_RGBA8 = 0x8058; + public static final int GL_RGB10_A2 = 0x8059; + public static final int GL_TEXTURE_BINDING_3D = 0x806A; + public static final int GL_UNPACK_SKIP_IMAGES = 0x806D; + public static final int GL_UNPACK_IMAGE_HEIGHT = 0x806E; + public static final int GL_TEXTURE_3D = 0x806F; + public static final int GL_TEXTURE_WRAP_R = 0x8072; + public static final int GL_MAX_3D_TEXTURE_SIZE = 0x8073; + public static final int GL_UNSIGNED_INT_2_10_10_10_REV = 0x8368; + public static final int GL_MAX_ELEMENTS_VERTICES = 0x80E8; + public static final int GL_MAX_ELEMENTS_INDICES = 0x80E9; + public static final int GL_TEXTURE_MIN_LOD = 0x813A; + public static final int GL_TEXTURE_MAX_LOD = 0x813B; + public static final int GL_TEXTURE_BASE_LEVEL = 0x813C; + public static final int GL_TEXTURE_MAX_LEVEL = 0x813D; + public static final int GL_MIN = 0x8007; + public static final int GL_MAX = 0x8008; + public static final int GL_DEPTH_COMPONENT24 = 0x81A6; + public static final int GL_MAX_TEXTURE_LOD_BIAS = 0x84FD; + public static final int GL_TEXTURE_COMPARE_MODE = 0x884C; + public static final int GL_TEXTURE_COMPARE_FUNC = 0x884D; + public static final int GL_CURRENT_QUERY = 0x8865; + public static final int GL_QUERY_RESULT = 0x8866; + public static final int GL_QUERY_RESULT_AVAILABLE = 0x8867; + public static final int GL_BUFFER_MAPPED = 0x88BC; + public static final int GL_BUFFER_MAP_POINTER = 0x88BD; + public static final int GL_STREAM_READ = 0x88E1; + public static final int GL_STREAM_COPY = 0x88E2; + public static final int GL_STATIC_READ = 0x88E5; + public static final int GL_STATIC_COPY = 0x88E6; + public static final int GL_DYNAMIC_READ = 0x88E9; + public static final int GL_DYNAMIC_COPY = 0x88EA; + public static final int GL_MAX_DRAW_BUFFERS = 0x8824; + public static final int GL_DRAW_BUFFER0 = 0x8825; + public static final int GL_DRAW_BUFFER1 = 0x8826; + public static final int GL_DRAW_BUFFER2 = 0x8827; + public static final int GL_DRAW_BUFFER3 = 0x8828; + public static final int GL_DRAW_BUFFER4 = 0x8829; + public static final int GL_DRAW_BUFFER5 = 0x882A; + public static final int GL_DRAW_BUFFER6 = 0x882B; + public static final int GL_DRAW_BUFFER7 = 0x882C; + public static final int GL_DRAW_BUFFER8 = 0x882D; + public static final int GL_DRAW_BUFFER9 = 0x882E; + public static final int GL_DRAW_BUFFER10 = 0x882F; + public static final int GL_DRAW_BUFFER11 = 0x8830; + public static final int GL_DRAW_BUFFER12 = 0x8831; + public static final int GL_DRAW_BUFFER13 = 0x8832; + public static final int GL_DRAW_BUFFER14 = 0x8833; + public static final int GL_DRAW_BUFFER15 = 0x8834; + public static final int GL_MAX_FRAGMENT_UNIFORM_COMPONENTS = 0x8B49; + public static final int GL_MAX_VERTEX_UNIFORM_COMPONENTS = 0x8B4A; + public static final int GL_SAMPLER_3D = 0x8B5F; + public static final int GL_SAMPLER_2D_SHADOW = 0x8B62; + public static final int GL_FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8B8B; + public static final int GL_PIXEL_PACK_BUFFER = 0x88EB; + public static final int GL_PIXEL_UNPACK_BUFFER = 0x88EC; + public static final int GL_PIXEL_PACK_BUFFER_BINDING = 0x88ED; + public static final int GL_PIXEL_UNPACK_BUFFER_BINDING = 0x88EF; + public static final int GL_FLOAT_MAT2x3 = 0x8B65; + public static final int GL_FLOAT_MAT2x4 = 0x8B66; + public static final int GL_FLOAT_MAT3x2 = 0x8B67; + public static final int GL_FLOAT_MAT3x4 = 0x8B68; + public static final int GL_FLOAT_MAT4x2 = 0x8B69; + public static final int GL_FLOAT_MAT4x3 = 0x8B6A; + public static final int GL_SRGB = 0x8C40; + public static final int GL_SRGB8 = 0x8C41; + public static final int GL_SRGB8_ALPHA8 = 0x8C43; + public static final int GL_COMPARE_REF_TO_TEXTURE = 0x884E; + public static final int GL_MAJOR_VERSION = 0x821B; + public static final int GL_MINOR_VERSION = 0x821C; + public static final int GL_NUM_EXTENSIONS = 0x821D; + public static final int GL_RGBA32F = 0x8814; + public static final int GL_RGB32F = 0x8815; + public static final int GL_RGBA16F = 0x881A; + public static final int GL_RGB16F = 0x881B; + public static final int GL_VERTEX_ATTRIB_ARRAY_INTEGER = 0x88FD; + public static final int GL_MAX_ARRAY_TEXTURE_LAYERS = 0x88FF; + public static final int GL_MIN_PROGRAM_TEXEL_OFFSET = 0x8904; + public static final int GL_MAX_PROGRAM_TEXEL_OFFSET = 0x8905; + public static final int GL_MAX_VARYING_COMPONENTS = 0x8B4B; + public static final int GL_TEXTURE_2D_ARRAY = 0x8C1A; + public static final int GL_TEXTURE_BINDING_2D_ARRAY = 0x8C1D; + public static final int GL_R11F_G11F_B10F = 0x8C3A; + public static final int GL_UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B; + public static final int GL_RGB9_E5 = 0x8C3D; + public static final int GL_UNSIGNED_INT_5_9_9_9_REV = 0x8C3E; + public static final int GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH = 0x8C76; + public static final int GL_TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8C7F; + public static final int GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 0x8C80; + public static final int GL_TRANSFORM_FEEDBACK_VARYINGS = 0x8C83; + public static final int GL_TRANSFORM_FEEDBACK_BUFFER_START = 0x8C84; + public static final int GL_TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8C85; + public static final int GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88; + public static final int GL_RASTERIZER_DISCARD = 0x8C89; + public static final int GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 0x8C8A; + public static final int GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B; + public static final int GL_INTERLEAVED_ATTRIBS = 0x8C8C; + public static final int GL_SEPARATE_ATTRIBS = 0x8C8D; + public static final int GL_TRANSFORM_FEEDBACK_BUFFER = 0x8C8E; + public static final int GL_TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8C8F; + public static final int GL_RGBA32UI = 0x8D70; + public static final int GL_RGB32UI = 0x8D71; + public static final int GL_RGBA16UI = 0x8D76; + public static final int GL_RGB16UI = 0x8D77; + public static final int GL_RGBA8UI = 0x8D7C; + public static final int GL_RGB8UI = 0x8D7D; + public static final int GL_RGBA32I = 0x8D82; + public static final int GL_RGB32I = 0x8D83; + public static final int GL_RGBA16I = 0x8D88; + public static final int GL_RGB16I = 0x8D89; + public static final int GL_RGBA8I = 0x8D8E; + public static final int GL_RGB8I = 0x8D8F; + public static final int GL_RED_INTEGER = 0x8D94; + public static final int GL_RGB_INTEGER = 0x8D98; + public static final int GL_RGBA_INTEGER = 0x8D99; + public static final int GL_SAMPLER_2D_ARRAY = 0x8DC1; + public static final int GL_SAMPLER_2D_ARRAY_SHADOW = 0x8DC4; + public static final int GL_SAMPLER_CUBE_SHADOW = 0x8DC5; + public static final int GL_UNSIGNED_INT_VEC2 = 0x8DC6; + public static final int GL_UNSIGNED_INT_VEC3 = 0x8DC7; + public static final int GL_UNSIGNED_INT_VEC4 = 0x8DC8; + public static final int GL_INT_SAMPLER_2D = 0x8DCA; + public static final int GL_INT_SAMPLER_3D = 0x8DCB; + public static final int GL_INT_SAMPLER_CUBE = 0x8DCC; + public static final int GL_INT_SAMPLER_2D_ARRAY = 0x8DCF; + public static final int GL_UNSIGNED_INT_SAMPLER_2D = 0x8DD2; + public static final int GL_UNSIGNED_INT_SAMPLER_3D = 0x8DD3; + public static final int GL_UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4; + public static final int GL_UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7; + public static final int GL_BUFFER_ACCESS_FLAGS = 0x911F; + public static final int GL_BUFFER_MAP_LENGTH = 0x9120; + public static final int GL_BUFFER_MAP_OFFSET = 0x9121; + public static final int GL_DEPTH_COMPONENT32F = 0x8CAC; + public static final int GL_DEPTH32F_STENCIL8 = 0x8CAD; + public static final int GL_FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD; + public static final int GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210; + public static final int GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211; + public static final int GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212; + public static final int GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213; + public static final int GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214; + public static final int GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215; + public static final int GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216; + public static final int GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217; + public static final int GL_FRAMEBUFFER_DEFAULT = 0x8218; + public static final int GL_FRAMEBUFFER_UNDEFINED = 0x8219; + public static final int GL_DEPTH_STENCIL_ATTACHMENT = 0x821A; + public static final int GL_DEPTH_STENCIL = 0x84F9; + public static final int GL_UNSIGNED_INT_24_8 = 0x84FA; + public static final int GL_DEPTH24_STENCIL8 = 0x88F0; + public static final int GL_UNSIGNED_NORMALIZED = 0x8C17; + public static final int GL_DRAW_FRAMEBUFFER_BINDING = GL_FRAMEBUFFER_BINDING; + public static final int GL_READ_FRAMEBUFFER = 0x8CA8; + public static final int GL_DRAW_FRAMEBUFFER = 0x8CA9; + public static final int GL_READ_FRAMEBUFFER_BINDING = 0x8CAA; + public static final int GL_RENDERBUFFER_SAMPLES = 0x8CAB; + public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4; + public static final int GL_MAX_COLOR_ATTACHMENTS = 0x8CDF; + public static final int GL_COLOR_ATTACHMENT1 = 0x8CE1; + public static final int GL_COLOR_ATTACHMENT2 = 0x8CE2; + public static final int GL_COLOR_ATTACHMENT3 = 0x8CE3; + public static final int GL_COLOR_ATTACHMENT4 = 0x8CE4; + public static final int GL_COLOR_ATTACHMENT5 = 0x8CE5; + public static final int GL_COLOR_ATTACHMENT6 = 0x8CE6; + public static final int GL_COLOR_ATTACHMENT7 = 0x8CE7; + public static final int GL_COLOR_ATTACHMENT8 = 0x8CE8; + public static final int GL_COLOR_ATTACHMENT9 = 0x8CE9; + public static final int GL_COLOR_ATTACHMENT10 = 0x8CEA; + public static final int GL_COLOR_ATTACHMENT11 = 0x8CEB; + public static final int GL_COLOR_ATTACHMENT12 = 0x8CEC; + public static final int GL_COLOR_ATTACHMENT13 = 0x8CED; + public static final int GL_COLOR_ATTACHMENT14 = 0x8CEE; + public static final int GL_COLOR_ATTACHMENT15 = 0x8CEF; + public static final int GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8D56; + public static final int GL_MAX_SAMPLES = 0x8D57; + public static final int GL_HALF_FLOAT = 0x140B; + public static final int GL_MAP_READ_BIT = 0x0001; + public static final int GL_MAP_WRITE_BIT = 0x0002; + public static final int GL_MAP_INVALIDATE_RANGE_BIT = 0x0004; + public static final int GL_MAP_INVALIDATE_BUFFER_BIT = 0x0008; + public static final int GL_MAP_FLUSH_EXPLICIT_BIT = 0x0010; + public static final int GL_MAP_UNSYNCHRONIZED_BIT = 0x0020; + public static final int GL_RG = 0x8227; + public static final int GL_RG_INTEGER = 0x8228; + public static final int GL_R8 = 0x8229; + public static final int GL_RG8 = 0x822B; + public static final int GL_R16F = 0x822D; + public static final int GL_R32F = 0x822E; + public static final int GL_RG16F = 0x822F; + public static final int GL_RG32F = 0x8230; + public static final int GL_R8I = 0x8231; + public static final int GL_R8UI = 0x8232; + public static final int GL_R16I = 0x8233; + public static final int GL_R16UI = 0x8234; + public static final int GL_R32I = 0x8235; + public static final int GL_R32UI = 0x8236; + public static final int GL_RG8I = 0x8237; + public static final int GL_RG8UI = 0x8238; + public static final int GL_RG16I = 0x8239; + public static final int GL_RG16UI = 0x823A; + public static final int GL_RG32I = 0x823B; + public static final int GL_RG32UI = 0x823C; + public static final int GL_VERTEX_ARRAY_BINDING = 0x85B5; + public static final int GL_R8_SNORM = 0x8F94; + public static final int GL_RG8_SNORM = 0x8F95; + public static final int GL_RGB8_SNORM = 0x8F96; + public static final int GL_RGBA8_SNORM = 0x8F97; + public static final int GL_SIGNED_NORMALIZED = 0x8F9C; + public static final int GL_PRIMITIVE_RESTART_FIXED_INDEX = 0x8D69; + public static final int GL_COPY_READ_BUFFER = 0x8F36; + public static final int GL_COPY_WRITE_BUFFER = 0x8F37; + public static final int GL_COPY_READ_BUFFER_BINDING = GL_COPY_READ_BUFFER; + public static final int GL_COPY_WRITE_BUFFER_BINDING = GL_COPY_WRITE_BUFFER; + public static final int GL_UNIFORM_BUFFER = 0x8A11; + public static final int GL_UNIFORM_BUFFER_BINDING = 0x8A28; + public static final int GL_UNIFORM_BUFFER_START = 0x8A29; + public static final int GL_UNIFORM_BUFFER_SIZE = 0x8A2A; + public static final int GL_MAX_VERTEX_UNIFORM_BLOCKS = 0x8A2B; + public static final int GL_MAX_FRAGMENT_UNIFORM_BLOCKS = 0x8A2D; + public static final int GL_MAX_COMBINED_UNIFORM_BLOCKS = 0x8A2E; + public static final int GL_MAX_UNIFORM_BUFFER_BINDINGS = 0x8A2F; + public static final int GL_MAX_UNIFORM_BLOCK_SIZE = 0x8A30; + public static final int GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 0x8A31; + public static final int GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 0x8A33; + public static final int GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT = 0x8A34; + public static final int GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH = 0x8A35; + public static final int GL_ACTIVE_UNIFORM_BLOCKS = 0x8A36; + public static final int GL_UNIFORM_TYPE = 0x8A37; + public static final int GL_UNIFORM_SIZE = 0x8A38; + public static final int GL_UNIFORM_NAME_LENGTH = 0x8A39; + public static final int GL_UNIFORM_BLOCK_INDEX = 0x8A3A; + public static final int GL_UNIFORM_OFFSET = 0x8A3B; + public static final int GL_UNIFORM_ARRAY_STRIDE = 0x8A3C; + public static final int GL_UNIFORM_MATRIX_STRIDE = 0x8A3D; + public static final int GL_UNIFORM_IS_ROW_MAJOR = 0x8A3E; + public static final int GL_UNIFORM_BLOCK_BINDING = 0x8A3F; + public static final int GL_UNIFORM_BLOCK_DATA_SIZE = 0x8A40; + public static final int GL_UNIFORM_BLOCK_NAME_LENGTH = 0x8A41; + public static final int GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS = 0x8A42; + public static final int GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 0x8A43; + public static final int GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 0x8A44; + public static final int GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 0x8A46; + // GL_INVALID_INDEX is defined as 0xFFFFFFFFu in C. + public static final int GL_INVALID_INDEX = -1; + public static final int GL_MAX_VERTEX_OUTPUT_COMPONENTS = 0x9122; + public static final int GL_MAX_FRAGMENT_INPUT_COMPONENTS = 0x9125; + public static final int GL_MAX_SERVER_WAIT_TIMEOUT = 0x9111; + public static final int GL_OBJECT_TYPE = 0x9112; + public static final int GL_SYNC_CONDITION = 0x9113; + public static final int GL_SYNC_STATUS = 0x9114; + public static final int GL_SYNC_FLAGS = 0x9115; + public static final int GL_SYNC_FENCE = 0x9116; + public static final int GL_SYNC_GPU_COMMANDS_COMPLETE = 0x9117; + public static final int GL_UNSIGNALED = 0x9118; + public static final int GL_SIGNALED = 0x9119; + public static final int GL_ALREADY_SIGNALED = 0x911A; + public static final int GL_TIMEOUT_EXPIRED = 0x911B; + public static final int GL_CONDITION_SATISFIED = 0x911C; + public static final int GL_WAIT_FAILED = 0x911D; + public static final int GL_SYNC_FLUSH_COMMANDS_BIT = 0x00000001; + // GL_TIMEOUT_IGNORED is defined as 0xFFFFFFFFFFFFFFFFull in C. + public static final long GL_TIMEOUT_IGNORED = -1; + public static final int GL_VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88FE; + public static final int GL_ANY_SAMPLES_PASSED = 0x8C2F; + public static final int GL_ANY_SAMPLES_PASSED_CONSERVATIVE = 0x8D6A; + public static final int GL_SAMPLER_BINDING = 0x8919; + public static final int GL_RGB10_A2UI = 0x906F; + public static final int GL_TEXTURE_SWIZZLE_R = 0x8E42; + public static final int GL_TEXTURE_SWIZZLE_G = 0x8E43; + public static final int GL_TEXTURE_SWIZZLE_B = 0x8E44; + public static final int GL_TEXTURE_SWIZZLE_A = 0x8E45; + public static final int GL_GREEN = 0x1904; + public static final int GL_BLUE = 0x1905; + public static final int GL_INT_2_10_10_10_REV = 0x8D9F; + public static final int GL_TRANSFORM_FEEDBACK = 0x8E22; + public static final int GL_TRANSFORM_FEEDBACK_PAUSED = 0x8E23; + public static final int GL_TRANSFORM_FEEDBACK_ACTIVE = 0x8E24; + public static final int GL_TRANSFORM_FEEDBACK_BINDING = 0x8E25; + public static final int GL_PROGRAM_BINARY_RETRIEVABLE_HINT = 0x8257; + public static final int GL_PROGRAM_BINARY_LENGTH = 0x8741; + public static final int GL_NUM_PROGRAM_BINARY_FORMATS = 0x87FE; + public static final int GL_PROGRAM_BINARY_FORMATS = 0x87FF; + public static final int GL_COMPRESSED_R11_EAC = 0x9270; + public static final int GL_COMPRESSED_SIGNED_R11_EAC = 0x9271; + public static final int GL_COMPRESSED_RG11_EAC = 0x9272; + public static final int GL_COMPRESSED_SIGNED_RG11_EAC = 0x9273; + public static final int GL_COMPRESSED_RGB8_ETC2 = 0x9274; + public static final int GL_COMPRESSED_SRGB8_ETC2 = 0x9275; + public static final int GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9276; + public static final int GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277; + public static final int GL_COMPRESSED_RGBA8_ETC2_EAC = 0x9278; + public static final int GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279; + public static final int GL_TEXTURE_IMMUTABLE_FORMAT = 0x912F; + public static final int GL_MAX_ELEMENT_INDEX = 0x8D6B; + public static final int GL_NUM_SAMPLE_COUNTS = 0x9380; + public static final int GL_TEXTURE_IMMUTABLE_LEVELS = 0x82DF; + + native private static void _nativeClassInit(); + static { + _nativeClassInit(); + } + diff --git a/opengl/tools/glgen/stubs/gles11/GLES30cHeader.cpp b/opengl/tools/glgen/stubs/gles11/GLES30cHeader.cpp new file mode 100644 index 0000000..f5ec455 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/GLES30cHeader.cpp @@ -0,0 +1,22 @@ +/* +** +** Copyright 2013, 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 <GLES3/gl3.h> +#include <GLES3/gl3ext.h> + diff --git a/opengl/tools/glgen/stubs/gles11/common.cpp b/opengl/tools/glgen/stubs/gles11/common.cpp new file mode 100644 index 0000000..579d573 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/common.cpp @@ -0,0 +1,303 @@ +#include "jni.h" +#include "JNIHelp.h" +#include <android_runtime/AndroidRuntime.h> +#include <utils/misc.h> +#include <assert.h> + +static int initialized = 0; + +static jclass nioAccessClass; +static jclass bufferClass; +static jmethodID getBasePointerID; +static jmethodID getBaseArrayID; +static jmethodID getBaseArrayOffsetID; +static jfieldID positionID; +static jfieldID limitID; +static jfieldID elementSizeShiftID; + + +/* special calls implemented in Android's GLES wrapper used to more + * efficiently bound-check passed arrays */ +extern "C" { +#ifdef GL_VERSION_ES_CM_1_1 +GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride, + const GLvoid *ptr, GLsizei count); +GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride, + const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); +#endif +#ifdef GL_ES_VERSION_2_0 +static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type, + GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) { + glVertexAttribPointer(indx, size, type, normalized, stride, pointer); +} +#endif +#ifdef GL_ES_VERSION_3_0 +static void glVertexAttribIPointerBounds(GLuint indx, GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count) { + glVertexAttribIPointer(indx, size, type, stride, pointer); +} +#endif +} + +/* Cache method IDs each time the class is loaded. */ + +static void +nativeClassInit(JNIEnv *_env, jclass glImplClass) +{ + jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); + nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); + + jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); + bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); + + getBasePointerID = _env->GetStaticMethodID(nioAccessClass, + "getBasePointer", "(Ljava/nio/Buffer;)J"); + getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); + getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); + + positionID = _env->GetFieldID(bufferClass, "position", "I"); + limitID = _env->GetFieldID(bufferClass, "limit", "I"); + elementSizeShiftID = + _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); +} + +static void * +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset) +{ + jint position; + jint limit; + jint elementSizeShift; + jlong pointer; + + position = _env->GetIntField(buffer, positionID); + limit = _env->GetIntField(buffer, limitID); + elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + *remaining = (limit - position) << elementSizeShift; + pointer = _env->CallStaticLongMethod(nioAccessClass, + getBasePointerID, buffer); + if (pointer != 0L) { + *array = NULL; + return (void *) (jint) pointer; + } + + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, + getBaseArrayID, buffer); + *offset = _env->CallStaticIntMethod(nioAccessClass, + getBaseArrayOffsetID, buffer); + + return NULL; +} + +static void +releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) +{ + _env->ReleasePrimitiveArrayCritical(array, data, + commit ? 0 : JNI_ABORT); +} + +static void * +getDirectBufferPointer(JNIEnv *_env, jobject buffer) { + char* buf = (char*) _env->GetDirectBufferAddress(buffer); + if (buf) { + jint position = _env->GetIntField(buffer, positionID); + jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + buf += position << elementSizeShift; + } else { + jniThrowException(_env, "java/lang/IllegalArgumentException", + "Must use a native order direct Buffer"); + } + return (void*) buf; +} + +// -------------------------------------------------------------------------- + +/* + * returns the number of values glGet returns for a given pname. + * + * The code below is written such that pnames requiring only one values + * are the default (and are not explicitely tested for). This makes the + * checking code much shorter/readable/efficient. + * + * This means that unknown pnames (e.g.: extensions) will default to 1. If + * that unknown pname needs more than 1 value, then the validation check + * is incomplete and the app may crash if it passed the wrong number params. + */ +static int getNeededCount(GLint pname) { + int needed = 1; +#ifdef GL_ES_VERSION_2_0 + // GLES 2.x pnames + switch (pname) { + case GL_ALIASED_LINE_WIDTH_RANGE: + case GL_ALIASED_POINT_SIZE_RANGE: + needed = 2; + break; + + case GL_BLEND_COLOR: + case GL_COLOR_CLEAR_VALUE: + case GL_COLOR_WRITEMASK: + case GL_SCISSOR_BOX: + case GL_VIEWPORT: + needed = 4; + break; + + case GL_COMPRESSED_TEXTURE_FORMATS: + glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed); + break; + + case GL_SHADER_BINARY_FORMATS: + glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed); + break; + } +#endif + +#ifdef GL_VERSION_ES_CM_1_1 + // GLES 1.x pnames + switch (pname) { + case GL_ALIASED_LINE_WIDTH_RANGE: + case GL_ALIASED_POINT_SIZE_RANGE: + case GL_DEPTH_RANGE: + case GL_SMOOTH_LINE_WIDTH_RANGE: + case GL_SMOOTH_POINT_SIZE_RANGE: + needed = 2; + break; + + case GL_CURRENT_NORMAL: + case GL_POINT_DISTANCE_ATTENUATION: + needed = 3; + break; + + case GL_COLOR_CLEAR_VALUE: + case GL_COLOR_WRITEMASK: + case GL_CURRENT_COLOR: + case GL_CURRENT_TEXTURE_COORDS: + case GL_FOG_COLOR: + case GL_LIGHT_MODEL_AMBIENT: + case GL_SCISSOR_BOX: + case GL_VIEWPORT: + needed = 4; + break; + + case GL_MODELVIEW_MATRIX: + case GL_PROJECTION_MATRIX: + case GL_TEXTURE_MATRIX: + needed = 16; + break; + + case GL_COMPRESSED_TEXTURE_FORMATS: + glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed); + break; + } +#endif + return needed; +} + +template <typename JTYPEARRAY, typename CTYPE, void GET(GLenum, CTYPE*)> +static void +get + (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) { + jint _exception = 0; + const char * _exceptionType; + const char * _exceptionMessage; + CTYPE *params_base = (CTYPE *) 0; + jint _remaining; + CTYPE *params = (CTYPE *) 0; + int _needed = 0; + + if (!params_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "params == null"; + goto exit; + } + if (offset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "offset < 0"; + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + _needed = getNeededCount(pname); + // if we didn't find this pname, we just assume the user passed + // an array of the right size -- this might happen with extensions + // or if we forget an enum here. + if (_remaining < _needed) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "length - offset < needed"; + goto exit; + } + params_base = (CTYPE *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + GET( + (GLenum)pname, + (CTYPE *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } +} + + +template <typename CTYPE, 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; + jint _bufferOffset = (jint) 0; + jint _remaining; + CTYPE *params = (CTYPE *) 0; + int _needed = 0; + + params = (CTYPE *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); + _needed = getNeededCount(pname); + // if we didn't find this pname, we just assume the user passed + // an array of the right size -- this might happen with extensions + // or if we forget an enum here. + if (_needed>0 && _remaining < _needed) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "remaining() < needed"; + goto exit; + } + if (params == NULL) { + char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + params = (CTYPE *) (_paramsBase + _bufferOffset); + } + GET( + (GLenum)pname, + (CTYPE *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, 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 new file mode 100644 index 0000000..41df486 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp @@ -0,0 +1,39 @@ +/* void glDrawElementsInstanced ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount ) */ +static void +android_glDrawElementsInstanced__IIILjava_nio_Buffer_2I + (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf, jint instanceCount) { + jarray _array = (jarray) 0; + jint _bufferOffset = (jint) 0; + jint _remaining; + GLvoid *indices = (GLvoid *) 0; + + indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining, &_bufferOffset); + if (indices == NULL) { + char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); + indices = (GLvoid *) (_indicesBase + _bufferOffset); + } + glDrawElementsInstanced( + (GLenum)mode, + (GLsizei)count, + (GLenum)type, + (GLvoid *)indices, + (GLsizei)instanceCount + ); + if (_array) { + releasePointer(_env, _array, indices, JNI_FALSE); + } +} + +/* void glDrawElementsInstanced ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount ) */ +static void +android_glDrawElementsInstanced__IIIII + (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint indicesOffset, jint instanceCount) { + glDrawElementsInstanced( + (GLenum)mode, + (GLsizei)count, + (GLenum)type, + (GLvoid *)indicesOffset, + (GLsizei)instanceCount + ); +} + diff --git a/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.java b/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.java new file mode 100644 index 0000000..53651ce --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.java @@ -0,0 +1,20 @@ + // C function void glDrawElementsInstanced ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount ) + + public static native void glDrawElementsInstanced( + int mode, + int count, + int type, + java.nio.Buffer indices, + int instanceCount + ); + + // C function void glDrawElementsInstanced ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount ) + + public static native void glDrawElementsInstanced( + int mode, + int count, + int type, + int indicesOffset, + int instanceCount + ); + diff --git a/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.nativeReg b/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.nativeReg new file mode 100644 index 0000000..3b7424c --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.nativeReg @@ -0,0 +1,2 @@ +{"glDrawElementsInstanced", "(IIILjava/nio/Buffer;I)V", (void *) android_glDrawElementsInstanced__IIILjava_nio_Buffer_2I }, +{"glDrawElementsInstanced", "(IIIII)V", (void *) android_glDrawElementsInstanced__IIIII }, diff --git a/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp b/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp new file mode 100644 index 0000000..bb6ae7c --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp @@ -0,0 +1,127 @@ +/* void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName ) */ +static void +android_glGetActiveUniformBlockName_III_3II_3BI + (JNIEnv* _env, jobject _this, jint program, jint uniformBlockIndex, int bufSize, jintArray length_ref, jint lengthOffset, 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; + GLchar* _name_base = (GLchar*)0; + jint _nameRemaining; + GLchar* _name = (GLchar*)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 (!name_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "uniformBlockName == null"; + goto exit; + } + if (nameOffset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "uniformBlockNameOffset < 0"; + goto exit; + } + _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset; + _name_base = (GLchar*)_env->GetPrimitiveArrayCritical( + name_ref, (jboolean*)0); + _name = _name_base + nameOffset; + + glGetActiveUniformBlockName( + (GLuint)program, + (GLuint)uniformBlockIndex, + (GLsizei)bufSize, + (GLsizei*)_length, + (GLchar*)_name + ); + +exit: + if (_name_base) { + _env->ReleasePrimitiveArrayCritical(name_ref, _name_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 glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName ) */ +static void +android_glGetActiveUniformBlockName_IILjava_nio_Buffer_2Ljava_nio_Buffer_2 + (JNIEnv* _env, jobject _this, jint program, jint uniformBlockIndex, jobject length_buf, jobject uniformBlockName_buf) { + jint _exception = 0; + const char* _exceptionType; + const char* _exceptionMessage; + jarray _lengthArray = (jarray)0; + jint _lengthBufferOffset = (jint)0; + GLsizei* _length = (GLsizei*)0; + jint _lengthRemaining; + jarray _nameArray = (jarray)0; + jint _nameBufferOffset = (jint)0; + GLchar* _name = (GLchar*)0; + jint _nameRemaining; + + _length = (GLsizei*)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset); + if (_length == NULL) { + GLsizei* _lengthBase = (GLsizei*)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean*)0); + _length = (GLsizei*)(_lengthBase + _lengthBufferOffset); + } + + _name = (GLchar*)getPointer(_env, uniformBlockName_buf, &_nameArray, &_nameRemaining, &_nameBufferOffset); + if (_name == NULL) { + GLchar* _nameBase = (GLchar*)_env->GetPrimitiveArrayCritical(_nameArray, (jboolean*)0); + _name = (GLchar*)(_nameBase + _nameBufferOffset); + } + + glGetActiveUniformBlockName( + (GLuint)program, + (GLuint)uniformBlockIndex, + (GLsizei)_nameRemaining, + _length, _name + ); + if (_nameArray) { + releasePointer(_env, _nameArray, _name, JNI_TRUE); + } + if (_lengthArray) { + releasePointer(_env, _lengthArray, _length, JNI_TRUE); + } +} + +/* void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName ) */ +static jstring +android_glGetActiveUniformBlockName_II + (JNIEnv *_env, jobject _this, jint program, jint uniformBlockIndex) { + GLint len = 0; + glGetActiveUniformBlockiv((GLuint)program, (GLuint)uniformBlockIndex, + GL_UNIFORM_BLOCK_NAME_LENGTH, &len); + GLchar* name = (GLchar*)malloc(len); + glGetActiveUniformBlockName((GLuint)program, (GLuint)uniformBlockIndex, + len, NULL, name); + jstring result = _env->NewStringUTF(name); + free(name); + return result; +} + diff --git a/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.java b/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.java new file mode 100644 index 0000000..3d9ed0f --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.java @@ -0,0 +1,28 @@ + // C function void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName ) + + public static native void glGetActiveUniformBlockName( + int program, + int uniformBlockIndex, + int bufSize, + int[] length, + int lengthOffset, + byte[] uniformBlockName, + int uniformBlockNameOffset + ); + + // C function void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName ) + + public static native void glGetActiveUniformBlockName( + int program, + int uniformBlockIndex, + java.nio.Buffer length, + java.nio.Buffer uniformBlockName + ); + + // C function void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName ) + + public static native String glGetActiveUniformBlockName( + int program, + int uniformBlockIndex + ); + diff --git a/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.nativeReg b/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.nativeReg new file mode 100644 index 0000000..fb37689 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.nativeReg @@ -0,0 +1,3 @@ +{"glGetActiveUniformBlockName", "(III[II[BI)V", (void *) android_glGetActiveUniformBlockName_III_3II_3BI }, +{"glGetActiveUniformBlockName", "(IILjava/nio/Buffer;Ljava/nio/Buffer;)V", (void *) android_glGetActiveUniformBlockName_IILjava_nio_Buffer_2Ljava_nio_Buffer_2 }, +{"glGetActiveUniformBlockName", "(II)Ljava/lang/String;", (void *) android_glGetActiveUniformBlockName_II },
\ No newline at end of file diff --git a/opengl/tools/glgen/stubs/gles11/glGetBooleanv.cpp b/opengl/tools/glgen/stubs/gles11/glGetBooleanv.cpp new file mode 100644 index 0000000..00c52af --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetBooleanv.cpp @@ -0,0 +1,13 @@ +/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ +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); +} + +/* 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); +} diff --git a/opengl/tools/glgen/stubs/gles11/glGetBooleanv.java b/opengl/tools/glgen/stubs/gles11/glGetBooleanv.java new file mode 100644 index 0000000..3ec9b24 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetBooleanv.java @@ -0,0 +1,15 @@ + // C function void glGetBooleanv ( GLenum pname, GLboolean *params ) + + public static native void glGetBooleanv( + int pname, + boolean[] params, + int offset + ); + + // C function void glGetBooleanv ( GLenum pname, GLboolean *params ) + + public static native void glGetBooleanv( + int pname, + java.nio.IntBuffer params + ); + diff --git a/opengl/tools/glgen/stubs/gles11/glGetBooleanv.nativeReg b/opengl/tools/glgen/stubs/gles11/glGetBooleanv.nativeReg new file mode 100644 index 0000000..d0bc8b8 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetBooleanv.nativeReg @@ -0,0 +1,2 @@ +{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI }, +{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 }, diff --git a/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.cpp b/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.cpp new file mode 100644 index 0000000..7016c4b --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.cpp @@ -0,0 +1,11 @@ +/* void glGetBufferPointerv ( GLenum target, GLenum pname, GLvoid** params ) */ +static jobject +android_glGetBufferPointerv__II + (JNIEnv *_env, jobject _this, jint target, jint pname) { + GLint64 _mapLength; + GLvoid* _p; + glGetBufferParameteri64v((GLenum)target, GL_BUFFER_MAP_LENGTH, &_mapLength); + glGetBufferPointerv((GLenum)target, (GLenum)pname, &_p); + return _env->NewDirectByteBuffer(_p, _mapLength); +} + diff --git a/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.java b/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.java new file mode 100644 index 0000000..c966e11 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.java @@ -0,0 +1,7 @@ + // C function void glGetBufferPointerv ( GLenum target, GLenum pname, GLvoid** params ) + + public static native java.nio.Buffer glGetBufferPointerv( + int target, + int pname + ); + diff --git a/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.nativeReg b/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.nativeReg new file mode 100644 index 0000000..7886451 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.nativeReg @@ -0,0 +1 @@ +{"glGetBufferPointerv", "(II)Ljava/nio/Buffer;", (void *) android_glGetBufferPointerv__II },
\ No newline at end of file diff --git a/opengl/tools/glgen/stubs/gles11/glGetFloatv.cpp b/opengl/tools/glgen/stubs/gles11/glGetFloatv.cpp new file mode 100644 index 0000000..71c399d --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetFloatv.cpp @@ -0,0 +1,13 @@ +/* void glGetFloatv ( GLenum pname, GLfloat *params ) */ +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); +} + +/* 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); +} diff --git a/opengl/tools/glgen/stubs/gles11/glGetFloatv.java b/opengl/tools/glgen/stubs/gles11/glGetFloatv.java new file mode 100644 index 0000000..53b5c01 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetFloatv.java @@ -0,0 +1,15 @@ + // C function void glGetFloatv ( GLenum pname, GLfloat *params ) + + public static native void glGetFloatv( + int pname, + float[] params, + int offset + ); + + // C function void glGetFloatv ( GLenum pname, GLfloat *params ) + + public static native void glGetFloatv( + int pname, + java.nio.FloatBuffer params + ); + diff --git a/opengl/tools/glgen/stubs/gles11/glGetFloatv.nativeReg b/opengl/tools/glgen/stubs/gles11/glGetFloatv.nativeReg new file mode 100644 index 0000000..93058c6 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetFloatv.nativeReg @@ -0,0 +1,2 @@ +{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI }, +{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 }, diff --git a/opengl/tools/glgen/stubs/gles11/glGetIntegerv.cpp b/opengl/tools/glgen/stubs/gles11/glGetIntegerv.cpp new file mode 100644 index 0000000..9000ece --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetIntegerv.cpp @@ -0,0 +1,14 @@ +/* void glGetIntegerv ( GLenum pname, GLint *params ) */ +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); +} + +/* 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); +} + diff --git a/opengl/tools/glgen/stubs/gles11/glGetIntegerv.java b/opengl/tools/glgen/stubs/gles11/glGetIntegerv.java new file mode 100644 index 0000000..e8b42c9 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetIntegerv.java @@ -0,0 +1,15 @@ + // C function void glGetIntegerv ( GLenum pname, GLint *params ) + + public static native void glGetIntegerv( + int pname, + int[] params, + int offset + ); + + // C function void glGetIntegerv ( GLenum pname, GLint *params ) + + public static native void glGetIntegerv( + int pname, + java.nio.IntBuffer params + ); + diff --git a/opengl/tools/glgen/stubs/gles11/glGetIntegerv.nativeReg b/opengl/tools/glgen/stubs/gles11/glGetIntegerv.nativeReg new file mode 100644 index 0000000..c39cd92 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetIntegerv.nativeReg @@ -0,0 +1,2 @@ +{"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II }, +{"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 }, diff --git a/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.java b/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.java index 762df39..da0a1fd 100644 --- a/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.java +++ b/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.java @@ -1,21 +1,5 @@ -/* - * Copyright (C) 2009 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. - */ - // C function void glGetProgramInfoLog( GLuint program, GLsizei maxLength, GLsizei * length, - // GLchar * infoLog); + // GLchar * infoLog); public static native String glGetProgramInfoLog( int program diff --git a/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.java b/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.java index af529c0..dc1db5b 100644 --- a/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.java +++ b/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.java @@ -1,21 +1,5 @@ -/* - * Copyright (C) 2009 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. - */ - // C function void glGetShaderInfoLog( GLuint shader, GLsizei maxLength, GLsizei * length, - // GLchar * infoLog); + // GLchar * infoLog); public static native String glGetShaderInfoLog( int shader diff --git a/opengl/tools/glgen/stubs/gles11/glGetString.java b/opengl/tools/glgen/stubs/gles11/glGetString.java index b02a0d1..3d4fe5b 100644 --- a/opengl/tools/glgen/stubs/gles11/glGetString.java +++ b/opengl/tools/glgen/stubs/gles11/glGetString.java @@ -1,19 +1,3 @@ -/* - * Copyright (C) 2009 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. - */ - // C function const GLubyte * glGetString ( GLenum name ) public static native String glGetString( diff --git a/opengl/tools/glgen/stubs/gles11/glGetStringi.cpp b/opengl/tools/glgen/stubs/gles11/glGetStringi.cpp new file mode 100644 index 0000000..1611539 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetStringi.cpp @@ -0,0 +1,8 @@ +/* const GLubyte * glGetStringi ( GLenum name, GLuint index ) */ +static jstring +android_glGetStringi__II + (JNIEnv *_env, jobject _this, jint name, jint index) { + const GLubyte* _chars = glGetStringi((GLenum)name, (GLuint)index); + return _env->NewStringUTF((const char*)_chars); +} + diff --git a/opengl/tools/glgen/stubs/gles11/glGetStringi.java b/opengl/tools/glgen/stubs/gles11/glGetStringi.java new file mode 100644 index 0000000..523d4c7 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetStringi.java @@ -0,0 +1,7 @@ + // C function const GLubyte * glGetStringi ( GLenum name, GLuint index ) + + public static native String glGetStringi( + int name, + int index + ); + diff --git a/opengl/tools/glgen/stubs/gles11/glGetStringi.nativeReg b/opengl/tools/glgen/stubs/gles11/glGetStringi.nativeReg new file mode 100644 index 0000000..e7ee353 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetStringi.nativeReg @@ -0,0 +1 @@ +{"glGetStringi", "(II)Ljava/lang/String;", (void *) android_glGetStringi__II },
\ No newline at end of file diff --git a/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp b/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp new file mode 100644 index 0000000..0514fe9 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp @@ -0,0 +1,328 @@ +/* void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */ +static void +android_glGetTransformFeedbackVarying__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; + + glGetTransformFeedbackVarying( + (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 glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */ +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; + 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); + } + glGetTransformFeedbackVarying( + (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 glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */ +static jstring +android_glGetTransformFeedbackVarying1 + (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; + + glGetTransformFeedbackVarying( + (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 glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */ +static jstring +android_glGetTransformFeedbackVarying2 + (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); + } + glGetTransformFeedbackVarying( + (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/glGetTransformFeedbackVarying.java b/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.java new file mode 100644 index 0000000..f73bbfe --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.java @@ -0,0 +1,48 @@ + // C function void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) + + public static native void glGetTransformFeedbackVarying( + 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 glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) + + public static native void glGetTransformFeedbackVarying( + int program, + int index, + int bufsize, + java.nio.IntBuffer length, + java.nio.IntBuffer size, + java.nio.IntBuffer type, + byte name + ); + + // C function void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) + + public static native String glGetTransformFeedbackVarying( + int program, + int index, + int[] size, + int sizeOffset, + int[] type, + int typeOffset + ); + + // C function void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) + + public static native String glGetTransformFeedbackVarying( + int program, + int index, + java.nio.IntBuffer size, + java.nio.IntBuffer type + ); + diff --git a/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.nativeReg b/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.nativeReg new file mode 100644 index 0000000..412d04c --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.nativeReg @@ -0,0 +1,4 @@ +{"glGetTransformFeedbackVarying", "(III[II[II[II[BI)V", (void *) android_glGetTransformFeedbackVarying__III_3II_3II_3II_3BI }, +{"glGetTransformFeedbackVarying", "(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V", (void *) android_glGetTransformFeedbackVarying__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B }, +{"glGetTransformFeedbackVarying", "(II[II[II)Ljava/lang/String;", (void *) android_glGetTransformFeedbackVarying1 }, +{"glGetTransformFeedbackVarying", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetTransformFeedbackVarying2 }, diff --git a/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.cpp b/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.cpp new file mode 100644 index 0000000..fb137ab --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.cpp @@ -0,0 +1,154 @@ +/* void glGetUniformIndices ( GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices ) */ +static +void +android_glGetUniformIndices_array + (JNIEnv *_env, jobject _this, jint program, jobjectArray uniformNames_ref, jintArray uniformIndices_ref, jint uniformIndicesOffset) { + jint _exception = 0; + const char* _exceptionType = NULL; + const char* _exceptionMessage = NULL; + jint _count = 0; + jint _i; + const char** _names = NULL; + GLuint* _indices_base = NULL; + GLuint* _indices = NULL; + + if (!uniformNames_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "uniformNames == null"; + goto exit; + } + _count = _env->GetArrayLength(uniformNames_ref); + _names = (const char**)calloc(_count, sizeof(const char*)); + for (_i = 0; _i < _count; _i++) { + jstring _name = (jstring)_env->GetObjectArrayElement(uniformNames_ref, _i); + if (!_name) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "null uniformNames element"; + goto exit; + } + _names[_i] = _env->GetStringUTFChars(_name, 0); + } + + if (!uniformIndices_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "uniformIndices == null"; + goto exit; + } + if (uniformIndicesOffset < 0) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "uniformIndicesOffset < 0"; + goto exit; + } + if (_env->GetArrayLength(uniformIndices_ref) - uniformIndicesOffset < _count) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "not enough space in uniformIndices"; + goto exit; + } + _indices_base = (GLuint*)_env->GetPrimitiveArrayCritical( + uniformIndices_ref, 0); + _indices = _indices_base + uniformIndicesOffset; + + glGetUniformIndices(program, _count, _names, _indices); + +exit: + if (_indices_base) { + _env->ReleasePrimitiveArrayCritical(uniformIndices_ref, _indices_base, + _exception ? JNI_ABORT : 0); + } + for (_i = _count - 1; _i >= 0; _i--) { + if (_names[_i]) { + jstring _name = (jstring)_env->GetObjectArrayElement(uniformNames_ref, _i); + if (_name) { + _env->ReleaseStringUTFChars(_name, _names[_i]); + } + } + } + free(_names); + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } +} + +/* void glGetUniformIndices ( GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices ) */ +static +void +android_glGetUniformIndices_buffer + (JNIEnv *_env, jobject _this, jint program, jobjectArray uniformNames_ref, jobject uniformIndices_buf) { + jint _exception = 0; + const char* _exceptionType = NULL; + const char* _exceptionMessage = NULL; + jint _count = 0; + jint _i; + const char** _names = NULL; + jarray _uniformIndicesArray = (jarray)0; + jint _uniformIndicesRemaining; + jint _uniformIndicesOffset = 0; + GLuint* _indices = NULL; + char* _indicesBase = NULL; + + if (!uniformNames_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "uniformNames == null"; + goto exit; + } + if (!uniformIndices_buf) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "uniformIndices == null"; + goto exit; + } + + _count = _env->GetArrayLength(uniformNames_ref); + _names = (const char**)calloc(_count, sizeof(const char*)); + for (_i = 0; _i < _count; _i++) { + jstring _name = (jstring)_env->GetObjectArrayElement(uniformNames_ref, _i); + if (!_name) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "null uniformNames element"; + goto exit; + } + _names[_i] = _env->GetStringUTFChars(_name, 0); + } + + _indices = (GLuint*)getPointer(_env, uniformIndices_buf, + &_uniformIndicesArray, &_uniformIndicesRemaining, + &_uniformIndicesOffset); + if (!_indices) { + _indicesBase = (char*)_env->GetPrimitiveArrayCritical( + _uniformIndicesArray, 0); + _indices = (GLuint*)(_indicesBase + _uniformIndicesOffset); + } + if (_uniformIndicesRemaining < _count) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "not enough space in uniformIndices"; + goto exit; + } + + glGetUniformIndices(program, _count, _names, _indices); + +exit: + if (_uniformIndicesArray) { + releasePointer(_env, _uniformIndicesArray, _indicesBase, JNI_TRUE); + } + for (_i = _count - 1; _i >= 0; _i--) { + if (_names[_i]) { + jstring _name = (jstring)_env->GetObjectArrayElement(uniformNames_ref, _i); + if (_name) { + _env->ReleaseStringUTFChars(_name, _names[_i]); + } + } + } + free(_names); + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } +} + diff --git a/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.java b/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.java new file mode 100644 index 0000000..719429b --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.java @@ -0,0 +1,17 @@ + // C function void glGetUniformIndices ( GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices ) + + public static native void glGetUniformIndices( + int program, + String[] uniformNames, + int[] uniformIndices, + int uniformIndicesOffset + ); + + // C function void glGetUniformIndices ( GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices ) + + public static native void glGetUniformIndices( + int program, + String[] uniformNames, + java.nio.IntBuffer uniformIndices + ); + diff --git a/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.nativeReg b/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.nativeReg new file mode 100644 index 0000000..6e72c31 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.nativeReg @@ -0,0 +1,2 @@ +{"glGetUniformIndices", "(I[Ljava/lang/String;[II)V", (void *) android_glGetUniformIndices_array }, +{"glGetUniformIndices", "(I[Ljava/lang/String;Ljava/nio/IntBuffer;)V", (void *) android_glGetUniformIndices_buffer }, diff --git a/opengl/tools/glgen/stubs/gles11/glMapBufferRange.cpp b/opengl/tools/glgen/stubs/gles11/glMapBufferRange.cpp new file mode 100644 index 0000000..2485642 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glMapBufferRange.cpp @@ -0,0 +1,13 @@ +/* GLvoid * glMapBufferRange ( GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access ) */ +static jobject +android_glMapBufferRange__IIII + (JNIEnv *_env, jobject _this, jint target, jint offset, jint length, jint access) { + GLvoid* _p = glMapBufferRange((GLenum)target, + (GLintptr)offset, (GLsizeiptr)length, (GLbitfield)access); + jobject _buf = (jobject)0; + if (_p) { + _buf = _env->NewDirectByteBuffer(_p, length); + } + return _buf; +} + diff --git a/opengl/tools/glgen/stubs/gles11/glMapBufferRange.java b/opengl/tools/glgen/stubs/gles11/glMapBufferRange.java new file mode 100644 index 0000000..482ea99 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glMapBufferRange.java @@ -0,0 +1,9 @@ + // C function GLvoid * glMapBufferRange ( GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access ) + + public static native java.nio.Buffer glMapBufferRange( + int target, + int offset, + int length, + int access + ); + diff --git a/opengl/tools/glgen/stubs/gles11/glMapBufferRange.nativeReg b/opengl/tools/glgen/stubs/gles11/glMapBufferRange.nativeReg new file mode 100644 index 0000000..ad5c077 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glMapBufferRange.nativeReg @@ -0,0 +1 @@ +{"glMapBufferRange", "(IIII)Ljava/nio/Buffer;", (void *) android_glMapBufferRange__IIII },
\ No newline at end of file diff --git a/opengl/tools/glgen/stubs/gles11/glShaderSource.java b/opengl/tools/glgen/stubs/gles11/glShaderSource.java index e9fcef3..a9c338a 100644 --- a/opengl/tools/glgen/stubs/gles11/glShaderSource.java +++ b/opengl/tools/glgen/stubs/gles11/glShaderSource.java @@ -1,19 +1,3 @@ -/* - * Copyright (C) 2009 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. - */ - // C function void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint* length ) public static native void glShaderSource( diff --git a/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.cpp b/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.cpp new file mode 100644 index 0000000..0dedd0f --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.cpp @@ -0,0 +1,49 @@ +/* void glTransformFeedbackVaryings ( GLuint program, GLsizei count, const GLchar *varyings, GLenum bufferMode ) */ +static +void +android_glTransformFeedbackVaryings + (JNIEnv *_env, jobject _this, jint program, jobjectArray varyings_ref, jint bufferMode) { + jint _exception = 0; + const char* _exceptionType = NULL; + const char* _exceptionMessage = NULL; + jint _count = 0, _i; + const char** _varyings = NULL; + const char* _varying = NULL; + + if (!varyings_ref) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "varyings == null"; + goto exit; + } + + _count = _env->GetArrayLength(varyings_ref); + _varyings = (const char**)calloc(_count, sizeof(const char*)); + for (_i = 0; _i < _count; _i++) { + jstring _varying = (jstring)_env->GetObjectArrayElement(varyings_ref, _i); + if (!_varying) { + _exception = 1; + _exceptionType = "java/lang/IllegalArgumentException"; + _exceptionMessage = "null varyings element"; + goto exit; + } + _varyings[_i] = _env->GetStringUTFChars(_varying, 0); + } + + glTransformFeedbackVaryings(program, _count, _varyings, bufferMode); + +exit: + for (_i = _count - 1; _i >= 0; _i--) { + if (_varyings[_i]) { + jstring _varying = (jstring)_env->GetObjectArrayElement(varyings_ref, _i); + if (_varying) { + _env->ReleaseStringUTFChars(_varying, _varyings[_i]); + } + } + } + free(_varyings); + if (_exception) { + jniThrowException(_env, _exceptionType, _exceptionMessage); + } +} + diff --git a/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.java b/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.java new file mode 100644 index 0000000..c824344 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.java @@ -0,0 +1,8 @@ + // C function void glTransformFeedbackVaryings ( GLuint program, GLsizei count, const GLchar *varyings, GLenum bufferMode ) + + public static native void glTransformFeedbackVaryings( + int program, + String[] varyings, + int bufferMode + ); + diff --git a/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.nativeReg b/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.nativeReg new file mode 100644 index 0000000..24f2b77 --- /dev/null +++ b/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.nativeReg @@ -0,0 +1 @@ +{"glTransformFeedbackVaryings", "(I[Ljava/lang/String;I)V", (void *) android_glTransformFeedbackVaryings }, diff --git a/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl b/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl index e3aea76..9740235 100644 --- a/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl +++ b/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl @@ -22,7 +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.os.UserHandle; import android.util.Log; import java.nio.Buffer; @@ -67,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, UserId.myUserId()); + ApplicationInfo applicationInfo = pm.getApplicationInfo(appName, 0, UserHandle.myUserId()); if (applicationInfo != null) { version = applicationInfo.targetSdkVersion; } |