diff options
Diffstat (limited to 'core/jni')
24 files changed, 5858 insertions, 440 deletions
diff --git a/core/jni/Android.mk b/core/jni/Android.mk index 015268b..67a0bda 100644 --- a/core/jni/Android.mk +++ b/core/jni/Android.mk @@ -32,7 +32,9 @@ LOCAL_SRC_FILES:= \ android_opengl_GLES10Ext.cpp \ android_opengl_GLES11.cpp \ android_opengl_GLES11Ext.cpp \ + android_opengl_GLES20.cpp \ android_database_CursorWindow.cpp \ + android_database_SQLiteCompiledSql.cpp \ android_database_SQLiteDebug.cpp \ android_database_SQLiteDatabase.cpp \ android_database_SQLiteProgram.cpp \ @@ -53,7 +55,6 @@ LOCAL_SRC_FILES:= \ android_os_SystemClock.cpp \ android_os_SystemProperties.cpp \ android_os_UEventObserver.cpp \ - android_os_Hardware.cpp \ android_net_LocalSocketImpl.cpp \ android_net_NetUtils.cpp \ android_net_wifi_Wifi.cpp \ @@ -163,6 +164,8 @@ LOCAL_SHARED_LIBRARIES := \ libdvm \ libEGL \ libGLESv1_CM \ + libGLESv2 \ + libETC1 \ libhardware \ libhardware_legacy \ libsonivox \ diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp index f61e247..8364838 100644 --- a/core/jni/AndroidRuntime.cpp +++ b/core/jni/AndroidRuntime.cpp @@ -71,6 +71,7 @@ extern int register_android_opengl_jni_GLES10(JNIEnv* env); extern int register_android_opengl_jni_GLES10Ext(JNIEnv* env); extern int register_android_opengl_jni_GLES11(JNIEnv* env); extern int register_android_opengl_jni_GLES11Ext(JNIEnv* env); +extern int register_android_opengl_jni_GLES20(JNIEnv* env); extern int register_android_hardware_Camera(JNIEnv *env); @@ -115,6 +116,7 @@ extern int register_android_view_Display(JNIEnv* env); extern int register_android_view_Surface(JNIEnv* env); extern int register_android_view_ViewRoot(JNIEnv* env); extern int register_android_database_CursorWindow(JNIEnv* env); +extern int register_android_database_SQLiteCompiledSql(JNIEnv* env); extern int register_android_database_SQLiteDatabase(JNIEnv* env); extern int register_android_database_SQLiteDebug(JNIEnv* env); extern int register_android_database_SQLiteProgram(JNIEnv* env); @@ -129,7 +131,6 @@ extern int register_android_os_ParcelFileDescriptor(JNIEnv *env); extern int register_android_os_Power(JNIEnv *env); extern int register_android_os_StatFs(JNIEnv *env); extern int register_android_os_SystemProperties(JNIEnv *env); -extern int register_android_os_Hardware(JNIEnv* env); extern int register_android_os_SystemClock(JNIEnv* env); extern int register_android_os_FileObserver(JNIEnv *env); extern int register_android_os_FileUtils(JNIEnv *env); @@ -750,6 +751,18 @@ int AndroidRuntime::startVm(JavaVM** pJavaVM, JNIEnv** pEnv) opt.optionString = "-Xjitprofile"; mOptions.add(opt); } + + /* + * Disable optimizations by setting the corresponding bit to 1. + */ + char jitOptBuf[sizeof("-Xjitdisableopt:") + PROPERTY_VALUE_MAX]; + property_get("dalvik.vm.jit.disableopt", propBuf, ""); + if (strlen(propBuf) > 0) { + strcpy(jitOptBuf, "-Xjitdisableopt:"); + strcat(jitOptBuf, propBuf); + opt.optionString = jitOptBuf; + mOptions.add(opt); + } #endif if (executionMode == kEMIntPortable) { @@ -1165,7 +1178,6 @@ static const RegJNIRec gRegJNI[] = { REG_JNI(register_android_text_KeyCharacterMap), REG_JNI(register_android_os_Process), REG_JNI(register_android_os_Binder), - REG_JNI(register_android_os_Hardware), REG_JNI(register_android_view_Display), REG_JNI(register_android_nio_utils), REG_JNI(register_android_graphics_PixelFormat), @@ -1178,6 +1190,7 @@ static const RegJNIRec gRegJNI[] = { REG_JNI(register_android_opengl_jni_GLES10Ext), REG_JNI(register_android_opengl_jni_GLES11), REG_JNI(register_android_opengl_jni_GLES11Ext), + REG_JNI(register_android_opengl_jni_GLES20), REG_JNI(register_android_graphics_Bitmap), REG_JNI(register_android_graphics_BitmapFactory), @@ -1205,6 +1218,7 @@ static const RegJNIRec gRegJNI[] = { REG_JNI(register_com_android_internal_graphics_NativeUtils), REG_JNI(register_android_database_CursorWindow), + REG_JNI(register_android_database_SQLiteCompiledSql), REG_JNI(register_android_database_SQLiteDatabase), REG_JNI(register_android_database_SQLiteDebug), REG_JNI(register_android_database_SQLiteProgram), diff --git a/core/jni/android/graphics/Canvas.cpp b/core/jni/android/graphics/Canvas.cpp index dc72008..e1e9536 100644 --- a/core/jni/android/graphics/Canvas.cpp +++ b/core/jni/android/graphics/Canvas.cpp @@ -27,6 +27,9 @@ #include "SkShader.h" #include "SkTemplates.h" +#include "SkBoundaryPatch.h" +#include "SkMeshUtils.h" + #define TIME_DRAWx static uint32_t get_thread_msec() { @@ -861,8 +864,6 @@ public: *matrix = canvas->getTotalMatrix(); } }; - -/////////////////////////////////////////////////////////////////////////////// static JNINativeMethod gCanvasMethods[] = { {"finalizer", "(I)V", (void*) SkCanvasGlue::finalizer}, @@ -965,6 +966,42 @@ static JNINativeMethod gCanvasMethods[] = { {"freeCaches", "()V", (void*) SkCanvasGlue::freeCaches} }; +/////////////////////////////////////////////////////////////////////////////// + +static void BoundaryPatch_computeCubic(JNIEnv* env, jobject, jfloatArray jpts, + int texW, int texH, int rows, int cols, + jfloatArray jverts, jshortArray jidx) { + AutoJavaFloatArray ptsArray(env, jpts, 24, kRO_JNIAccess); + + int vertCount = rows * cols; + AutoJavaFloatArray vertsArray(env, jverts, vertCount * 4, kRW_JNIAccess); + SkPoint* verts = (SkPoint*)vertsArray.ptr(); + SkPoint* texs = verts + vertCount; + + int idxCount = (rows - 1) * (cols - 1) * 6; + AutoJavaShortArray idxArray(env, jidx, idxCount, kRW_JNIAccess); + uint16_t* idx = (uint16_t*)idxArray.ptr(); // cast from int16_t* + + SkCubicBoundary cubic; + memcpy(cubic.fPts, ptsArray.ptr(), 12 * sizeof(SkPoint)); + + SkBoundaryPatch patch; + patch.setBoundary(&cubic); + // generate our verts + patch.evalPatch(verts, rows, cols); + + SkMeshIndices mesh; + // generate our texs and idx + mesh.init(texs, idx, texW, texH, rows, cols); +} + +static JNINativeMethod gBoundaryPatchMethods[] = { + {"nativeComputeCubicPatch", "([FIIII[F[S)V", + (void*)BoundaryPatch_computeCubic }, +}; + +/////////////////////////////////////////////////////////////////////////////// + #include <android_runtime/AndroidRuntime.h> #define REG(env, name, array) \ @@ -976,6 +1013,7 @@ int register_android_graphics_Canvas(JNIEnv* env) { int result; REG(env, "android/graphics/Canvas", gCanvasMethods); + REG(env, "android/graphics/utils/BoundaryPatch", gBoundaryPatchMethods); return result; } diff --git a/core/jni/android/graphics/Graphics.cpp b/core/jni/android/graphics/Graphics.cpp index 2e0caed..01aad93 100644 --- a/core/jni/android/graphics/Graphics.cpp +++ b/core/jni/android/graphics/Graphics.cpp @@ -56,7 +56,7 @@ bool GraphicsJNI::hasException(JNIEnv *env) { /////////////////////////////////////////////////////////////////////////////// AutoJavaFloatArray::AutoJavaFloatArray(JNIEnv* env, jfloatArray array, - int minLength) + int minLength, JNIAccess access) : fEnv(env), fArray(array), fPtr(NULL), fLen(0) { SkASSERT(env); if (array) { @@ -66,11 +66,12 @@ AutoJavaFloatArray::AutoJavaFloatArray(JNIEnv* env, jfloatArray array, } fPtr = env->GetFloatArrayElements(array, NULL); } + fReleaseMode = (access == kRO_JNIAccess) ? JNI_ABORT : 0; } AutoJavaFloatArray::~AutoJavaFloatArray() { if (fPtr) { - fEnv->ReleaseFloatArrayElements(fArray, fPtr, 0); + fEnv->ReleaseFloatArrayElements(fArray, fPtr, fReleaseMode); } } @@ -94,7 +95,7 @@ AutoJavaIntArray::~AutoJavaIntArray() { } AutoJavaShortArray::AutoJavaShortArray(JNIEnv* env, jshortArray array, - int minLength) + int minLength, JNIAccess access) : fEnv(env), fArray(array), fPtr(NULL), fLen(0) { SkASSERT(env); if (array) { @@ -104,11 +105,12 @@ AutoJavaShortArray::AutoJavaShortArray(JNIEnv* env, jshortArray array, } fPtr = env->GetShortArrayElements(array, NULL); } + fReleaseMode = (access == kRO_JNIAccess) ? JNI_ABORT : 0; } AutoJavaShortArray::~AutoJavaShortArray() { if (fPtr) { - fEnv->ReleaseShortArrayElements(fArray, fPtr, 0); + fEnv->ReleaseShortArrayElements(fArray, fPtr, fReleaseMode); } } diff --git a/core/jni/android/graphics/GraphicsJNI.h b/core/jni/android/graphics/GraphicsJNI.h index 7adadbc..fe24b05 100644 --- a/core/jni/android/graphics/GraphicsJNI.h +++ b/core/jni/android/graphics/GraphicsJNI.h @@ -80,9 +80,15 @@ private: bool fReportSizeToVM; }; +enum JNIAccess { + kRO_JNIAccess, + kRW_JNIAccess +}; + class AutoJavaFloatArray { public: - AutoJavaFloatArray(JNIEnv* env, jfloatArray array, int minLength = 0); + AutoJavaFloatArray(JNIEnv* env, jfloatArray array, + int minLength = 0, JNIAccess = kRW_JNIAccess); ~AutoJavaFloatArray(); float* ptr() const { return fPtr; } @@ -93,6 +99,7 @@ private: jfloatArray fArray; float* fPtr; int fLen; + int fReleaseMode; }; class AutoJavaIntArray { @@ -112,7 +119,8 @@ private: class AutoJavaShortArray { public: - AutoJavaShortArray(JNIEnv* env, jshortArray array, int minLength = 0); + AutoJavaShortArray(JNIEnv* env, jshortArray array, + int minLength = 0, JNIAccess = kRW_JNIAccess); ~AutoJavaShortArray(); jshort* ptr() const { return fPtr; } @@ -123,6 +131,7 @@ private: jshortArray fArray; jshort* fPtr; int fLen; + int fReleaseMode; }; class AutoJavaByteArray { diff --git a/core/jni/android/graphics/Typeface.cpp b/core/jni/android/graphics/Typeface.cpp index 238ece1..7c7bfeb 100644 --- a/core/jni/android/graphics/Typeface.cpp +++ b/core/jni/android/graphics/Typeface.cpp @@ -46,7 +46,7 @@ static SkTypeface* Typeface_createFromTypeface(JNIEnv* env, jobject, SkTypeface* } static void Typeface_unref(JNIEnv* env, jobject obj, SkTypeface* face) { - face->unref(); + SkSafeUnref(face); } static int Typeface_getStyle(JNIEnv* env, jobject obj, SkTypeface* face) { diff --git a/core/jni/android/opengl/util.cpp b/core/jni/android/opengl/util.cpp index 4041346..589b255 100644 --- a/core/jni/android/opengl/util.cpp +++ b/core/jni/android/opengl/util.cpp @@ -23,6 +23,7 @@ #include <dlfcn.h> #include <GLES/gl.h> +#include <ETC1/etc1.h> #include <core/SkBitmap.h> @@ -39,6 +40,7 @@ namespace android { static jclass gIAEClass; static jclass gUOEClass; +static jclass gAIOOBEClass; static inline void mx4transform(float x, float y, float z, float w, const float* pM, float* pDest) { @@ -712,6 +714,297 @@ static jint util_texSubImage2D(JNIEnv *env, jclass clazz, } /* + * ETC1 methods. + */ + +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 +nativeClassInitBuffer(JNIEnv *_env) +{ + 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, jint *remaining) +{ + jint position; + jint limit; + jint elementSizeShift; + jlong pointer; + jint offset; + void *data; + + 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) { + return (void *) (jint) pointer; + } + return NULL; +} + +class BufferHelper { +public: + BufferHelper(JNIEnv *env, jobject buffer) { + mEnv = env; + mBuffer = buffer; + mData = NULL; + mRemaining = 0; + } + + bool checkPointer(const char* errorMessage) { + if (mBuffer) { + mData = getPointer(mEnv, mBuffer, &mRemaining); + if (mData == NULL) { + mEnv->ThrowNew(gIAEClass, errorMessage); + } + return mData != NULL; + } else { + mEnv->ThrowNew(gIAEClass, errorMessage); + return false; + } + } + + inline void* getData() { + return mData; + } + + inline jint remaining() { + return mRemaining; + } + +private: + JNIEnv* mEnv; + jobject mBuffer; + void* mData; + jint mRemaining; +}; + +/** + * Encode a block of pixels. + * + * @param in a pointer to a ETC1_DECODED_BLOCK_SIZE array of bytes that represent a + * 4 x 4 square of 3-byte pixels in form R, G, B. Byte (3 * (x + 4 * y) is the R + * value of pixel (x, y). + * + * @param validPixelMask is a 16-bit mask where bit (1 << (x + y * 4)) indicates whether + * the corresponding (x,y) pixel is valid. Invalid pixel color values are ignored when compressing. + * + * @param out an ETC1 compressed version of the data. + * + */ +static void etc1_encodeBlock(JNIEnv *env, jclass clazz, + jobject in, jint validPixelMask, jobject out) { + if (validPixelMask < 0 || validPixelMask > 15) { + env->ThrowNew(gIAEClass, "validPixelMask"); + return; + } + BufferHelper inB(env, in); + BufferHelper outB(env, out); + if (inB.checkPointer("in") && outB.checkPointer("out")) { + if (inB.remaining() < ETC1_DECODED_BLOCK_SIZE) { + env->ThrowNew(gIAEClass, "in's remaining data < DECODED_BLOCK_SIZE"); + } else if (outB.remaining() < ETC1_ENCODED_BLOCK_SIZE) { + env->ThrowNew(gIAEClass, "out's remaining data < ENCODED_BLOCK_SIZE"); + } else { + etc1_encode_block((etc1_byte*) inB.getData(), validPixelMask, + (etc1_byte*) outB.getData()); + } + } +} + +/** + * Decode a block of pixels. + * + * @param in an ETC1 compressed version of the data. + * + * @param out a pointer to a ETC_DECODED_BLOCK_SIZE array of bytes that represent a + * 4 x 4 square of 3-byte pixels in form R, G, B. Byte (3 * (x + 4 * y) is the R + * value of pixel (x, y). + */ +static void etc1_decodeBlock(JNIEnv *env, jclass clazz, + jobject in, jobject out){ + BufferHelper inB(env, in); + BufferHelper outB(env, out); + if (inB.checkPointer("in") && outB.checkPointer("out")) { + if (inB.remaining() < ETC1_ENCODED_BLOCK_SIZE) { + env->ThrowNew(gIAEClass, "in's remaining data < ENCODED_BLOCK_SIZE"); + } else if (outB.remaining() < ETC1_DECODED_BLOCK_SIZE) { + env->ThrowNew(gIAEClass, "out's remaining data < DECODED_BLOCK_SIZE"); + } else { + etc1_decode_block((etc1_byte*) inB.getData(), + (etc1_byte*) outB.getData()); + } + } +} + +/** + * Return the size of the encoded image data (does not include size of PKM header). + */ +static jint etc1_getEncodedDataSize(JNIEnv *env, jclass clazz, + jint width, jint height) { + return etc1_get_encoded_data_size(width, height); +} + +/** + * Encode an entire image. + * @param in pointer to the image data. Formatted such that + * pixel (x,y) is at pIn + pixelSize * x + stride * y + redOffset; + * @param out pointer to encoded data. Must be large enough to store entire encoded image. + */ +static void etc1_encodeImage(JNIEnv *env, jclass clazz, + jobject in, jint width, jint height, + jint pixelSize, jint stride, jobject out) { + if (pixelSize < 2 || pixelSize > 3) { + env->ThrowNew(gIAEClass, "pixelSize must be 2 or 3"); + return; + } + BufferHelper inB(env, in); + BufferHelper outB(env, out); + if (inB.checkPointer("in") && outB.checkPointer("out")) { + jint imageSize = stride * height; + jint encodedImageSize = etc1_get_encoded_data_size(width, height); + if (inB.remaining() < imageSize) { + env->ThrowNew(gIAEClass, "in's remaining data < image size"); + } else if (outB.remaining() < encodedImageSize) { + env->ThrowNew(gIAEClass, "out's remaining data < encoded image size"); + } else { + int result = etc1_encode_image((etc1_byte*) inB.getData(), + width, height, pixelSize, + stride, + (etc1_byte*) outB.getData()); + } + } +} + +/** + * Decode an entire image. + * @param in the encoded data. + * @param out pointer to the image data. Will be written such that + * pixel (x,y) is at pIn + pixelSize * x + stride * y. Must be + * large enough to store entire image. + */ +static void etc1_decodeImage(JNIEnv *env, jclass clazz, + jobject in, jobject out, + jint width, jint height, + jint pixelSize, jint stride) { + if (pixelSize < 2 || pixelSize > 3) { + env->ThrowNew(gIAEClass, "pixelSize must be 2 or 3"); + return; + } + BufferHelper inB(env, in); + BufferHelper outB(env, out); + if (inB.checkPointer("in") && outB.checkPointer("out")) { + jint imageSize = stride * height; + jint encodedImageSize = etc1_get_encoded_data_size(width, height); + if (inB.remaining() < encodedImageSize) { + env->ThrowNew(gIAEClass, "in's remaining data < encoded image size"); + } else if (outB.remaining() < imageSize) { + env->ThrowNew(gIAEClass, "out's remaining data < image size"); + } else { + int result = etc1_decode_image((etc1_byte*) inB.getData(), + (etc1_byte*) outB.getData(), + width, height, pixelSize, + stride); + } + } +} + +/** + * Format a PKM header + */ +static void etc1_formatHeader(JNIEnv *env, jclass clazz, + jobject header, jint width, jint height) { + BufferHelper headerB(env, header); + if (headerB.checkPointer("header") ){ + if (headerB.remaining() < ETC_PKM_HEADER_SIZE) { + env->ThrowNew(gIAEClass, "header's remaining data < ETC_PKM_HEADER_SIZE"); + } else { + etc1_pkm_format_header((etc1_byte*) headerB.getData(), width, height); + } + } +} + +/** + * Check if a PKM header is correctly formatted. + */ +static jboolean etc1_isValid(JNIEnv *env, jclass clazz, + jobject header) { + jboolean result = false; + BufferHelper headerB(env, header); + if (headerB.checkPointer("header") ){ + if (headerB.remaining() < ETC_PKM_HEADER_SIZE) { + env->ThrowNew(gIAEClass, "header's remaining data < ETC_PKM_HEADER_SIZE"); + } else { + result = etc1_pkm_is_valid((etc1_byte*) headerB.getData()); + } + } + return result; +} + +/** + * Read the image width from a PKM header + */ +static jint etc1_getWidth(JNIEnv *env, jclass clazz, + jobject header) { + jint result = 0; + BufferHelper headerB(env, header); + if (headerB.checkPointer("header") ){ + if (headerB.remaining() < ETC_PKM_HEADER_SIZE) { + env->ThrowNew(gIAEClass, "header's remaining data < ETC_PKM_HEADER_SIZE"); + } else { + result = etc1_pkm_get_width((etc1_byte*) headerB.getData()); + } + } + return result; +} + +/** + * Read the image height from a PKM header + */ +static int etc1_getHeight(JNIEnv *env, jclass clazz, + jobject header) { + jint result = 0; + BufferHelper headerB(env, header); + if (headerB.checkPointer("header") ){ + if (headerB.remaining() < ETC_PKM_HEADER_SIZE) { + env->ThrowNew(gIAEClass, "header's remaining data < ETC_PKM_HEADER_SIZE"); + } else { + result = etc1_pkm_get_height((etc1_byte*) headerB.getData()); + } + } + return result; +} + +/* * JNI registration */ @@ -721,6 +1014,8 @@ lookupClasses(JNIEnv* env) { env->FindClass("java/lang/IllegalArgumentException")); gUOEClass = (jclass) env->NewGlobalRef( env->FindClass("java/lang/UnsupportedOperationException")); + gAIOOBEClass = (jclass) env->NewGlobalRef( + env->FindClass("java/lang/ArrayIndexOutOfBoundsException")); } static JNINativeMethod gMatrixMethods[] = { @@ -742,6 +1037,18 @@ static JNINativeMethod gUtilsMethods[] = { { "native_texSubImage2D", "(IIIILandroid/graphics/Bitmap;II)I", (void*)util_texSubImage2D }, }; +static JNINativeMethod gEtc1Methods[] = { + { "encodeBlock", "(Ljava/nio/Buffer;ILjava/nio/Buffer;)V", (void*) etc1_encodeBlock }, + { "decodeBlock", "(Ljava/nio/Buffer;Ljava/nio/Buffer;)V", (void*) etc1_decodeBlock }, + { "getEncodedDataSize", "(II)I", (void*) etc1_getEncodedDataSize }, + { "encodeImage", "(Ljava/nio/Buffer;IIIILjava/nio/Buffer;)V", (void*) etc1_encodeImage }, + { "decodeImage", "(Ljava/nio/Buffer;Ljava/nio/Buffer;IIII)V", (void*) etc1_decodeImage }, + { "formatHeader", "(Ljava/nio/Buffer;II)V", (void*) etc1_formatHeader }, + { "isValid", "(Ljava/nio/Buffer;)Z", (void*) etc1_isValid }, + { "getWidth", "(Ljava/nio/Buffer;)I", (void*) etc1_getWidth }, + { "getHeight", "(Ljava/nio/Buffer;)I", (void*) etc1_getHeight }, +}; + typedef struct _ClassRegistrationInfo { const char* classPath; JNINativeMethod* methods; @@ -752,11 +1059,13 @@ static ClassRegistrationInfo gClasses[] = { {"android/opengl/Matrix", gMatrixMethods, NELEM(gMatrixMethods)}, {"android/opengl/Visibility", gVisiblityMethods, NELEM(gVisiblityMethods)}, {"android/opengl/GLUtils", gUtilsMethods, NELEM(gUtilsMethods)}, + {"android/opengl/ETC1", gEtc1Methods, NELEM(gEtc1Methods)}, }; int register_android_opengl_classes(JNIEnv* env) { lookupClasses(env); + nativeClassInitBuffer(env); int result = 0; for (int i = 0; i < NELEM(gClasses); i++) { ClassRegistrationInfo* cri = &gClasses[i]; diff --git a/core/jni/android_database_SQLiteCompiledSql.cpp b/core/jni/android_database_SQLiteCompiledSql.cpp new file mode 100644 index 0000000..8d1c39e --- /dev/null +++ b/core/jni/android_database_SQLiteCompiledSql.cpp @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2006-2008 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. + */ + +#undef LOG_TAG +#define LOG_TAG "Cursor" + +#include <jni.h> +#include <JNIHelp.h> +#include <android_runtime/AndroidRuntime.h> + +#include <sqlite3.h> + +#include <utils/Log.h> + +#include <stdio.h> +#include <string.h> +#include <unistd.h> + +#include "sqlite3_exception.h" + + +namespace android { + +static jfieldID gHandleField; +static jfieldID gStatementField; + + +#define GET_STATEMENT(env, object) \ + (sqlite3_stmt *)env->GetIntField(object, gStatementField) +#define GET_HANDLE(env, object) \ + (sqlite3 *)env->GetIntField(object, gHandleField) + + +sqlite3_stmt * compile(JNIEnv* env, jobject object, + sqlite3 * handle, jstring sqlString) +{ + int err; + jchar const * sql; + jsize sqlLen; + sqlite3_stmt * statement = GET_STATEMENT(env, object); + + // Make sure not to leak the statement if it already exists + if (statement != NULL) { + sqlite3_finalize(statement); + env->SetIntField(object, gStatementField, 0); + } + + // Compile the SQL + sql = env->GetStringChars(sqlString, NULL); + sqlLen = env->GetStringLength(sqlString); + err = sqlite3_prepare16_v2(handle, sql, sqlLen * 2, &statement, NULL); + env->ReleaseStringChars(sqlString, sql); + + if (err == SQLITE_OK) { + // Store the statement in the Java object for future calls + LOGV("Prepared statement %p on %p", statement, handle); + env->SetIntField(object, gStatementField, (int)statement); + return statement; + } else { + // Error messages like 'near ")": syntax error' are not + // always helpful enough, so construct an error string that + // includes the query itself. + const char *query = env->GetStringUTFChars(sqlString, NULL); + char *message = (char*) malloc(strlen(query) + 50); + if (message) { + strcpy(message, ", while compiling: "); // less than 50 chars + strcat(message, query); + } + env->ReleaseStringUTFChars(sqlString, query); + throw_sqlite3_exception(env, handle, message); + free(message); + return NULL; + } +} + +static void native_compile(JNIEnv* env, jobject object, jstring sqlString) +{ + compile(env, object, GET_HANDLE(env, object), sqlString); +} + +static void native_finalize(JNIEnv* env, jobject object) +{ + int err; + sqlite3_stmt * statement = GET_STATEMENT(env, object); + + if (statement != NULL) { + sqlite3_finalize(statement); + env->SetIntField(object, gStatementField, 0); + } +} + +static JNINativeMethod sMethods[] = +{ + /* name, signature, funcPtr */ + {"native_compile", "(Ljava/lang/String;)V", (void *)native_compile}, + {"native_finalize", "()V", (void *)native_finalize}, +}; + +int register_android_database_SQLiteCompiledSql(JNIEnv * env) +{ + jclass clazz; + + clazz = env->FindClass("android/database/sqlite/SQLiteCompiledSql"); + if (clazz == NULL) { + LOGE("Can't find android/database/sqlite/SQLiteCompiledSql"); + return -1; + } + + gHandleField = env->GetFieldID(clazz, "nHandle", "I"); + gStatementField = env->GetFieldID(clazz, "nStatement", "I"); + + if (gHandleField == NULL || gStatementField == NULL) { + LOGE("Error locating fields"); + return -1; + } + + return AndroidRuntime::registerNativeMethods(env, + "android/database/sqlite/SQLiteCompiledSql", sMethods, NELEM(sMethods)); +} + +} // namespace android diff --git a/core/jni/android_database_SQLiteProgram.cpp b/core/jni/android_database_SQLiteProgram.cpp index 7bda004..32018eb 100644 --- a/core/jni/android_database_SQLiteProgram.cpp +++ b/core/jni/android_database_SQLiteProgram.cpp @@ -43,52 +43,12 @@ static jfieldID gStatementField; #define GET_HANDLE(env, object) \ (sqlite3 *)env->GetIntField(object, gHandleField) - -sqlite3_stmt * compile(JNIEnv* env, jobject object, - sqlite3 * handle, jstring sqlString) -{ - int err; - jchar const * sql; - jsize sqlLen; - sqlite3_stmt * statement = GET_STATEMENT(env, object); - - // Make sure not to leak the statement if it already exists - if (statement != NULL) { - sqlite3_finalize(statement); - env->SetIntField(object, gStatementField, 0); - } - - // Compile the SQL - sql = env->GetStringChars(sqlString, NULL); - sqlLen = env->GetStringLength(sqlString); - err = sqlite3_prepare16_v2(handle, sql, sqlLen * 2, &statement, NULL); - env->ReleaseStringChars(sqlString, sql); - - if (err == SQLITE_OK) { - // Store the statement in the Java object for future calls - LOGV("Prepared statement %p on %p", statement, handle); - env->SetIntField(object, gStatementField, (int)statement); - return statement; - } else { - // Error messages like 'near ")": syntax error' are not - // always helpful enough, so construct an error string that - // includes the query itself. - const char *query = env->GetStringUTFChars(sqlString, NULL); - char *message = (char*) malloc(strlen(query) + 50); - if (message) { - strcpy(message, ", while compiling: "); // less than 50 chars - strcat(message, query); - } - env->ReleaseStringUTFChars(sqlString, query); - throw_sqlite3_exception(env, handle, message); - free(message); - return NULL; - } -} - static void native_compile(JNIEnv* env, jobject object, jstring sqlString) { - compile(env, object, GET_HANDLE(env, object), sqlString); + char buf[32]; + sprintf(buf, "android_database_SQLiteProgram->native_compile() not implemented"); + throw_sqlite3_exception(env, GET_HANDLE(env, object), buf); + return; } static void native_bind_null(JNIEnv* env, jobject object, @@ -164,7 +124,7 @@ static void native_bind_blob(JNIEnv* env, jobject object, jsize sqlLen; sqlite3_stmt * statement= GET_STATEMENT(env, object); - jint len = env->GetArrayLength(value); + jint len = env->GetArrayLength(value); jbyte * bytes = env->GetByteArrayElements(value, NULL); err = sqlite3_bind_blob(statement, index, bytes, len, SQLITE_TRANSIENT); @@ -192,27 +152,22 @@ static void native_clear_bindings(JNIEnv* env, jobject object) static void native_finalize(JNIEnv* env, jobject object) { - int err; - sqlite3_stmt * statement = GET_STATEMENT(env, object); - - if (statement != NULL) { - sqlite3_finalize(statement); - env->SetIntField(object, gStatementField, 0); - } + char buf[32]; + sprintf(buf, "android_database_SQLiteProgram->native_finalize() not implemented"); + throw_sqlite3_exception(env, GET_HANDLE(env, object), buf); + return; } static JNINativeMethod sMethods[] = { /* name, signature, funcPtr */ - {"native_compile", "(Ljava/lang/String;)V", (void *)native_compile}, {"native_bind_null", "(I)V", (void *)native_bind_null}, {"native_bind_long", "(IJ)V", (void *)native_bind_long}, {"native_bind_double", "(ID)V", (void *)native_bind_double}, {"native_bind_string", "(ILjava/lang/String;)V", (void *)native_bind_string}, - {"native_bind_blob", "(I[B)V", (void *)native_bind_blob}, + {"native_bind_blob", "(I[B)V", (void *)native_bind_blob}, {"native_clear_bindings", "()V", (void *)native_clear_bindings}, - {"native_finalize", "()V", (void *)native_finalize}, }; int register_android_database_SQLiteProgram(JNIEnv * env) diff --git a/core/jni/android_hardware_Camera.cpp b/core/jni/android_hardware_Camera.cpp index d57e526..64ee4f0 100644 --- a/core/jni/android_hardware_Camera.cpp +++ b/core/jni/android_hardware_Camera.cpp @@ -220,7 +220,7 @@ void JNICameraContext::postData(int32_t msgType, const sp<IMemory>& dataPtr) break; default: // TODO: Change to LOGV - LOGD("dataCallback(%d, %p)", msgType, dataPtr.get()); + LOGV("dataCallback(%d, %p)", msgType, dataPtr.get()); copyAndPost(env, dataPtr, msgType); break; } @@ -328,7 +328,7 @@ static void android_hardware_Camera_native_setup(JNIEnv *env, jobject thiz, jobj static void android_hardware_Camera_release(JNIEnv *env, jobject thiz) { // TODO: Change to LOGV - LOGD("release camera"); + LOGV("release camera"); JNICameraContext* context = NULL; sp<Camera> camera; { @@ -526,7 +526,7 @@ static void android_hardware_Camera_unlock(JNIEnv *env, jobject thiz) static void android_hardware_Camera_startSmoothZoom(JNIEnv *env, jobject thiz, jint value) { - LOGD("startSmoothZoom"); + LOGV("startSmoothZoom"); sp<Camera> camera = get_native_camera(env, thiz, NULL); if (camera == 0) return; @@ -537,7 +537,7 @@ static void android_hardware_Camera_startSmoothZoom(JNIEnv *env, jobject thiz, j static void android_hardware_Camera_stopSmoothZoom(JNIEnv *env, jobject thiz) { - LOGD("stopSmoothZoom"); + LOGV("stopSmoothZoom"); sp<Camera> camera = get_native_camera(env, thiz, NULL); if (camera == 0) return; diff --git a/core/jni/android_hardware_SensorManager.cpp b/core/jni/android_hardware_SensorManager.cpp index 3e27978..9a90b72 100644 --- a/core/jni/android_hardware_SensorManager.cpp +++ b/core/jni/android_hardware_SensorManager.cpp @@ -16,7 +16,6 @@ #define LOG_TAG "SensorManager" -#define LOG_NDEBUG 0 #include "utils/Log.h" #include <hardware/sensors.h> diff --git a/core/jni/android_net_LocalSocketImpl.cpp b/core/jni/android_net_LocalSocketImpl.cpp index f14b9fa..e58794b 100644 --- a/core/jni/android_net_LocalSocketImpl.cpp +++ b/core/jni/android_net_LocalSocketImpl.cpp @@ -35,8 +35,6 @@ #include <cutils/sockets.h> #include <netinet/tcp.h> -#include <cutils/properties.h> -#include <cutils/adb_networking.h> namespace android { diff --git a/core/jni/android_net_wifi_Wifi.cpp b/core/jni/android_net_wifi_Wifi.cpp index 38f3fda..46000c9 100644 --- a/core/jni/android_net_wifi_Wifi.cpp +++ b/core/jni/android_net_wifi_Wifi.cpp @@ -20,6 +20,7 @@ #include <utils/misc.h> #include <android_runtime/AndroidRuntime.h> #include <utils/Log.h> +#include <utils/String16.h> #include "wifi.h" @@ -92,7 +93,8 @@ static jstring doStringCommand(JNIEnv *env, const char *cmd) if (doCommand(cmd, reply, sizeof(reply)) != 0) { return env->NewStringUTF(NULL); } else { - return env->NewStringUTF(reply); + String16 str((char *)reply); + return env->NewString((const jchar *)str.string(), str.size()); } } diff --git a/core/jni/android_opengl_GLES11.cpp b/core/jni/android_opengl_GLES11.cpp index 44213ed..0f71b9f 100644 --- a/core/jni/android_opengl_GLES11.cpp +++ b/core/jni/android_opengl_GLES11.cpp @@ -24,6 +24,13 @@ #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; @@ -122,6 +129,19 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) 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 { + _env->ThrowNew(IAEClass, "Must use a native order direct Buffer"); + } + return (void*) buf; +} + // -------------------------------------------------------------------------- /* void glBindBuffer ( GLenum target, GLuint buffer ) */ @@ -2035,21 +2055,24 @@ exit: /* void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) */ static void -android_glPointSizePointerOES__IILjava_nio_Buffer_2 - (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf) { +android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I + (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) { jarray _array = (jarray) 0; jint _remaining; GLvoid *pointer = (GLvoid *) 0; - pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining); - glPointSizePointerOES( + if (pointer_buf) { + pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf); + if ( ! pointer ) { + return; + } + } + glPointSizePointerOESBounds( (GLenum)type, (GLsizei)stride, - (GLvoid *)pointer + (GLvoid *)pointer, + (GLsizei)remaining ); - if (_array) { - releasePointer(_env, _array, pointer, JNI_FALSE); - } } /* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */ @@ -2454,7 +2477,7 @@ static JNINativeMethod methods[] = { {"glPointParameterx", "(II)V", (void *) android_glPointParameterx__II }, {"glPointParameterxv", "(I[II)V", (void *) android_glPointParameterxv__I_3II }, {"glPointParameterxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glPointParameterxv__ILjava_nio_IntBuffer_2 }, -{"glPointSizePointerOES", "(IILjava/nio/Buffer;)V", (void *) android_glPointSizePointerOES__IILjava_nio_Buffer_2 }, +{"glPointSizePointerOESBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I }, {"glTexCoordPointer", "(IIII)V", (void *) android_glTexCoordPointer__IIII }, {"glTexEnvi", "(III)V", (void *) android_glTexEnvi__III }, {"glTexEnviv", "(II[II)V", (void *) android_glTexEnviv__II_3II }, diff --git a/core/jni/android_opengl_GLES11Ext.cpp b/core/jni/android_opengl_GLES11Ext.cpp index 6f3495c..942a0d9 100644 --- a/core/jni/android_opengl_GLES11Ext.cpp +++ b/core/jni/android_opengl_GLES11Ext.cpp @@ -24,6 +24,15 @@ #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; @@ -122,6 +131,18 @@ releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) 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 { + _env->ThrowNew(IAEClass, "Must use a native order direct Buffer"); + } + return (void*) buf; +} // -------------------------------------------------------------------------- /* void glBlendEquationSeparateOES ( GLenum modeRGB, GLenum modeAlpha ) */ @@ -1771,32 +1792,62 @@ android_glGenerateMipmapOES__I static void android_glCurrentPaletteMatrixOES__I (JNIEnv *_env, jobject _this, jint matrixpaletteindex) { - _env->ThrowNew(UOEClass, - "glCurrentPaletteMatrixOES"); + glCurrentPaletteMatrixOES( + (GLuint)matrixpaletteindex + ); } /* void glLoadPaletteFromModelViewMatrixOES ( void ) */ static void android_glLoadPaletteFromModelViewMatrixOES__ (JNIEnv *_env, jobject _this) { - _env->ThrowNew(UOEClass, - "glLoadPaletteFromModelViewMatrixOES"); + glLoadPaletteFromModelViewMatrixOES(); } /* void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */ static void -android_glMatrixIndexPointerOES__IIILjava_nio_Buffer_2 - (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf) { - _env->ThrowNew(UOEClass, - "glMatrixIndexPointerOES"); +android_glMatrixIndexPointerOESBounds__IIILjava_nio_Buffer_2I + (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *pointer = (GLvoid *) 0; + + if (pointer_buf) { + pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf); + if ( ! pointer ) { + return; + } + } + glMatrixIndexPointerOESBounds( + (GLint)size, + (GLenum)type, + (GLsizei)stride, + (GLvoid *)pointer, + (GLsizei)remaining + ); } /* void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */ static void -android_glWeightPointerOES__IIILjava_nio_Buffer_2 - (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf) { - _env->ThrowNew(UOEClass, - "glWeightPointerOES"); +android_glWeightPointerOESBounds__IIILjava_nio_Buffer_2I + (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *pointer = (GLvoid *) 0; + + if (pointer_buf) { + pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf); + if ( ! pointer ) { + return; + } + } + glWeightPointerOESBounds( + (GLint)size, + (GLenum)type, + (GLsizei)stride, + (GLvoid *)pointer, + (GLsizei)remaining + ); } /* void glDepthRangefOES ( GLclampf zNear, GLclampf zFar ) */ @@ -2426,8 +2477,8 @@ static JNINativeMethod methods[] = { {"glGenerateMipmapOES", "(I)V", (void *) android_glGenerateMipmapOES__I }, {"glCurrentPaletteMatrixOES", "(I)V", (void *) android_glCurrentPaletteMatrixOES__I }, {"glLoadPaletteFromModelViewMatrixOES", "()V", (void *) android_glLoadPaletteFromModelViewMatrixOES__ }, -{"glMatrixIndexPointerOES", "(IIILjava/nio/Buffer;)V", (void *) android_glMatrixIndexPointerOES__IIILjava_nio_Buffer_2 }, -{"glWeightPointerOES", "(IIILjava/nio/Buffer;)V", (void *) android_glWeightPointerOES__IIILjava_nio_Buffer_2 }, +{"glMatrixIndexPointerOESBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glMatrixIndexPointerOESBounds__IIILjava_nio_Buffer_2I }, +{"glWeightPointerOESBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glWeightPointerOESBounds__IIILjava_nio_Buffer_2I }, {"glDepthRangefOES", "(FF)V", (void *) android_glDepthRangefOES__FF }, {"glFrustumfOES", "(FFFFFF)V", (void *) android_glFrustumfOES__FFFFFF }, {"glOrthofOES", "(FFFFFF)V", (void *) android_glOrthofOES__FFFFFF }, diff --git a/core/jni/android_opengl_GLES20.cpp b/core/jni/android_opengl_GLES20.cpp new file mode 100644 index 0000000..fd1c8fd --- /dev/null +++ b/core/jni/android_opengl_GLES20.cpp @@ -0,0 +1,5023 @@ +/* +** +** Copyright 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. +*/ + +// This source file is automatically generated + +#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 jclass OOMEClass; +static jclass UOEClass; +static jclass IAEClass; +static jclass AIOOBEClass; +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 +nativeClassInitBuffer(JNIEnv *_env) +{ + 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 +nativeClassInit(JNIEnv *_env, jclass glImplClass) +{ + nativeClassInitBuffer(_env); + + jclass IAEClassLocal = + _env->FindClass("java/lang/IllegalArgumentException"); + jclass OOMEClassLocal = + _env->FindClass("java/lang/OutOfMemoryError"); + jclass UOEClassLocal = + _env->FindClass("java/lang/UnsupportedOperationException"); + jclass AIOOBEClassLocal = + _env->FindClass("java/lang/ArrayIndexOutOfBoundsException"); + + IAEClass = (jclass) _env->NewGlobalRef(IAEClassLocal); + OOMEClass = (jclass) _env->NewGlobalRef(OOMEClassLocal); + UOEClass = (jclass) _env->NewGlobalRef(UOEClassLocal); + AIOOBEClass = (jclass) _env->NewGlobalRef(AIOOBEClassLocal); +} + +static void * +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +{ + jint position; + jint limit; + jint elementSizeShift; + jlong pointer; + jint offset; + void *data; + + 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); + data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); + + return (void *) ((char *) data + offset); +} + + +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 { + _env->ThrowNew(IAEClass, "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); +} + +// -------------------------------------------------------------------------- + +/* void glActiveTexture ( GLenum texture ) */ +static void +android_glActiveTexture__I + (JNIEnv *_env, jobject _this, jint texture) { + glActiveTexture( + (GLenum)texture + ); +} + +/* void glAttachShader ( GLuint program, GLuint shader ) */ +static void +android_glAttachShader__II + (JNIEnv *_env, jobject _this, jint program, jint shader) { + glAttachShader( + (GLuint)program, + (GLuint)shader + ); +} + +/* void glBindAttribLocation ( GLuint program, GLuint index, const char *name ) */ +static void +android_glBindAttribLocation__IILjava_lang_String_2 + (JNIEnv *_env, jobject _this, jint program, jint index, jstring name) { + const char* _nativename = 0; + + if (!name) { + _env->ThrowNew(IAEClass, "name == null"); + goto exit; + } + _nativename = _env->GetStringUTFChars(name, 0); + + glBindAttribLocation( + (GLuint)program, + (GLuint)index, + (char *)_nativename + ); + +exit: + if (_nativename) { + _env->ReleaseStringUTFChars(name, _nativename); + } + +} + +/* void glBindBuffer ( GLenum target, GLuint buffer ) */ +static void +android_glBindBuffer__II + (JNIEnv *_env, jobject _this, jint target, jint buffer) { + glBindBuffer( + (GLenum)target, + (GLuint)buffer + ); +} + +/* void glBindFramebuffer ( GLenum target, GLuint framebuffer ) */ +static void +android_glBindFramebuffer__II + (JNIEnv *_env, jobject _this, jint target, jint framebuffer) { + glBindFramebuffer( + (GLenum)target, + (GLuint)framebuffer + ); +} + +/* void glBindRenderbuffer ( GLenum target, GLuint renderbuffer ) */ +static void +android_glBindRenderbuffer__II + (JNIEnv *_env, jobject _this, jint target, jint renderbuffer) { + glBindRenderbuffer( + (GLenum)target, + (GLuint)renderbuffer + ); +} + +/* void glBindTexture ( GLenum target, GLuint texture ) */ +static void +android_glBindTexture__II + (JNIEnv *_env, jobject _this, jint target, jint texture) { + glBindTexture( + (GLenum)target, + (GLuint)texture + ); +} + +/* void glBlendColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */ +static void +android_glBlendColor__FFFF + (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) { + glBlendColor( + (GLclampf)red, + (GLclampf)green, + (GLclampf)blue, + (GLclampf)alpha + ); +} + +/* void glBlendEquation ( GLenum mode ) */ +static void +android_glBlendEquation__I + (JNIEnv *_env, jobject _this, jint mode) { + _env->ThrowNew(UOEClass, + "glBlendEquation"); +} + +/* void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha ) */ +static void +android_glBlendEquationSeparate__II + (JNIEnv *_env, jobject _this, jint modeRGB, jint modeAlpha) { + _env->ThrowNew(UOEClass, + "glBlendEquationSeparate"); +} + +/* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */ +static void +android_glBlendFunc__II + (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) { + glBlendFunc( + (GLenum)sfactor, + (GLenum)dfactor + ); +} + +/* void glBlendFuncSeparate ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) */ +static void +android_glBlendFuncSeparate__IIII + (JNIEnv *_env, jobject _this, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) { + _env->ThrowNew(UOEClass, + "glBlendFuncSeparate"); +} + +/* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */ +static void +android_glBufferData__IILjava_nio_Buffer_2I + (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *data = (GLvoid *) 0; + + if (data_buf) { + data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); + if (_remaining < size) { + _env->ThrowNew(IAEClass, "remaining() < size"); + goto exit; + } + } + glBufferData( + (GLenum)target, + (GLsizeiptr)size, + (GLvoid *)data, + (GLenum)usage + ); + +exit: + if (_array) { + releasePointer(_env, _array, data, JNI_FALSE); + } +} + +/* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */ +static void +android_glBufferSubData__IIILjava_nio_Buffer_2 + (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *data = (GLvoid *) 0; + + data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); + if (_remaining < size) { + _env->ThrowNew(IAEClass, "remaining() < size"); + goto exit; + } + glBufferSubData( + (GLenum)target, + (GLintptr)offset, + (GLsizeiptr)size, + (GLvoid *)data + ); + +exit: + if (_array) { + releasePointer(_env, _array, data, JNI_FALSE); + } +} + +/* GLenum glCheckFramebufferStatus ( GLenum target ) */ +static jint +android_glCheckFramebufferStatus__I + (JNIEnv *_env, jobject _this, jint target) { + GLenum _returnValue; + _returnValue = glCheckFramebufferStatus( + (GLenum)target + ); + return _returnValue; +} + +/* void glClear ( GLbitfield mask ) */ +static void +android_glClear__I + (JNIEnv *_env, jobject _this, jint mask) { + glClear( + (GLbitfield)mask + ); +} + +/* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */ +static void +android_glClearColor__FFFF + (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) { + glClearColor( + (GLclampf)red, + (GLclampf)green, + (GLclampf)blue, + (GLclampf)alpha + ); +} + +/* void glClearDepthf ( GLclampf depth ) */ +static void +android_glClearDepthf__F + (JNIEnv *_env, jobject _this, jfloat depth) { + glClearDepthf( + (GLclampf)depth + ); +} + +/* void glClearStencil ( GLint s ) */ +static void +android_glClearStencil__I + (JNIEnv *_env, jobject _this, jint s) { + glClearStencil( + (GLint)s + ); +} + +/* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */ +static void +android_glColorMask__ZZZZ + (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) { + glColorMask( + (GLboolean)red, + (GLboolean)green, + (GLboolean)blue, + (GLboolean)alpha + ); +} + +/* void glCompileShader ( GLuint shader ) */ +static void +android_glCompileShader__I + (JNIEnv *_env, jobject _this, jint shader) { + glCompileShader( + (GLuint)shader + ); +} + +/* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */ +static void +android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 + (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *data = (GLvoid *) 0; + + data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); + glCompressedTexImage2D( + (GLenum)target, + (GLint)level, + (GLenum)internalformat, + (GLsizei)width, + (GLsizei)height, + (GLint)border, + (GLsizei)imageSize, + (GLvoid *)data + ); + if (_array) { + releasePointer(_env, _array, data, JNI_FALSE); + } +} + +/* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */ +static void +android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 + (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *data = (GLvoid *) 0; + + data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining); + glCompressedTexSubImage2D( + (GLenum)target, + (GLint)level, + (GLint)xoffset, + (GLint)yoffset, + (GLsizei)width, + (GLsizei)height, + (GLenum)format, + (GLsizei)imageSize, + (GLvoid *)data + ); + if (_array) { + releasePointer(_env, _array, data, JNI_FALSE); + } +} + +/* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */ +static void +android_glCopyTexImage2D__IIIIIIII + (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) { + glCopyTexImage2D( + (GLenum)target, + (GLint)level, + (GLenum)internalformat, + (GLint)x, + (GLint)y, + (GLsizei)width, + (GLsizei)height, + (GLint)border + ); +} + +/* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */ +static void +android_glCopyTexSubImage2D__IIIIIIII + (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) { + glCopyTexSubImage2D( + (GLenum)target, + (GLint)level, + (GLint)xoffset, + (GLint)yoffset, + (GLint)x, + (GLint)y, + (GLsizei)width, + (GLsizei)height + ); +} + +/* GLuint glCreateProgram ( void ) */ +static jint +android_glCreateProgram__ + (JNIEnv *_env, jobject _this) { + GLuint _returnValue; + _returnValue = glCreateProgram(); + return _returnValue; +} + +/* GLuint glCreateShader ( GLenum type ) */ +static jint +android_glCreateShader__I + (JNIEnv *_env, jobject _this, jint type) { + GLuint _returnValue; + _returnValue = glCreateShader( + (GLenum)type + ); + return _returnValue; +} + +/* void glCullFace ( GLenum mode ) */ +static void +android_glCullFace__I + (JNIEnv *_env, jobject _this, jint mode) { + glCullFace( + (GLenum)mode + ); +} + +/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */ +static void +android_glDeleteBuffers__I_3II + (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) { + GLuint *buffers_base = (GLuint *) 0; + jint _remaining; + GLuint *buffers = (GLuint *) 0; + + if (!buffers_ref) { + _env->ThrowNew(IAEClass, "buffers == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(buffers_ref) - offset; + if (_remaining < n) { + _env->ThrowNew(IAEClass, "length - offset < n"); + goto exit; + } + buffers_base = (GLuint *) + _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0); + buffers = buffers_base + offset; + + glDeleteBuffers( + (GLsizei)n, + (GLuint *)buffers + ); + +exit: + if (buffers_base) { + _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base, + JNI_ABORT); + } +} + +/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */ +static void +android_glDeleteBuffers__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLuint *buffers = (GLuint *) 0; + + buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining); + if (_remaining < n) { + _env->ThrowNew(IAEClass, "remaining() < n"); + goto exit; + } + glDeleteBuffers( + (GLsizei)n, + (GLuint *)buffers + ); + +exit: + if (_array) { + releasePointer(_env, _array, buffers, JNI_FALSE); + } +} + +/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */ +static void +android_glDeleteFramebuffers__I_3II + (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) { + GLuint *framebuffers_base = (GLuint *) 0; + jint _remaining; + GLuint *framebuffers = (GLuint *) 0; + + if (!framebuffers_ref) { + _env->ThrowNew(IAEClass, "framebuffers == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(framebuffers_ref) - offset; + framebuffers_base = (GLuint *) + _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0); + framebuffers = framebuffers_base + offset; + + glDeleteFramebuffers( + (GLsizei)n, + (GLuint *)framebuffers + ); + +exit: + if (framebuffers_base) { + _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base, + JNI_ABORT); + } +} + +/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */ +static void +android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLuint *framebuffers = (GLuint *) 0; + + framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining); + glDeleteFramebuffers( + (GLsizei)n, + (GLuint *)framebuffers + ); + if (_array) { + releasePointer(_env, _array, framebuffers, JNI_FALSE); + } +} + +/* void glDeleteProgram ( GLuint program ) */ +static void +android_glDeleteProgram__I + (JNIEnv *_env, jobject _this, jint program) { + glDeleteProgram( + (GLuint)program + ); +} + +/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */ +static void +android_glDeleteRenderbuffers__I_3II + (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) { + GLuint *renderbuffers_base = (GLuint *) 0; + jint _remaining; + GLuint *renderbuffers = (GLuint *) 0; + + if (!renderbuffers_ref) { + _env->ThrowNew(IAEClass, "renderbuffers == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(renderbuffers_ref) - offset; + renderbuffers_base = (GLuint *) + _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0); + renderbuffers = renderbuffers_base + offset; + + glDeleteRenderbuffers( + (GLsizei)n, + (GLuint *)renderbuffers + ); + +exit: + if (renderbuffers_base) { + _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base, + JNI_ABORT); + } +} + +/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */ +static void +android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLuint *renderbuffers = (GLuint *) 0; + + renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining); + glDeleteRenderbuffers( + (GLsizei)n, + (GLuint *)renderbuffers + ); + if (_array) { + releasePointer(_env, _array, renderbuffers, JNI_FALSE); + } +} + +/* void glDeleteShader ( GLuint shader ) */ +static void +android_glDeleteShader__I + (JNIEnv *_env, jobject _this, jint shader) { + glDeleteShader( + (GLuint)shader + ); +} + +/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */ +static void +android_glDeleteTextures__I_3II + (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) { + GLuint *textures_base = (GLuint *) 0; + jint _remaining; + GLuint *textures = (GLuint *) 0; + + if (!textures_ref) { + _env->ThrowNew(IAEClass, "textures == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(textures_ref) - offset; + if (_remaining < n) { + _env->ThrowNew(IAEClass, "length - offset < n"); + goto exit; + } + textures_base = (GLuint *) + _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0); + textures = textures_base + offset; + + glDeleteTextures( + (GLsizei)n, + (GLuint *)textures + ); + +exit: + if (textures_base) { + _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base, + JNI_ABORT); + } +} + +/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */ +static void +android_glDeleteTextures__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLuint *textures = (GLuint *) 0; + + textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining); + if (_remaining < n) { + _env->ThrowNew(IAEClass, "remaining() < n"); + goto exit; + } + glDeleteTextures( + (GLsizei)n, + (GLuint *)textures + ); + +exit: + if (_array) { + releasePointer(_env, _array, textures, JNI_FALSE); + } +} + +/* void glDepthFunc ( GLenum func ) */ +static void +android_glDepthFunc__I + (JNIEnv *_env, jobject _this, jint func) { + glDepthFunc( + (GLenum)func + ); +} + +/* void glDepthMask ( GLboolean flag ) */ +static void +android_glDepthMask__Z + (JNIEnv *_env, jobject _this, jboolean flag) { + glDepthMask( + (GLboolean)flag + ); +} + +/* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */ +static void +android_glDepthRangef__FF + (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) { + glDepthRangef( + (GLclampf)zNear, + (GLclampf)zFar + ); +} + +/* void glDetachShader ( GLuint program, GLuint shader ) */ +static void +android_glDetachShader__II + (JNIEnv *_env, jobject _this, jint program, jint shader) { + glDetachShader( + (GLuint)program, + (GLuint)shader + ); +} + +/* void glDisable ( GLenum cap ) */ +static void +android_glDisable__I + (JNIEnv *_env, jobject _this, jint cap) { + glDisable( + (GLenum)cap + ); +} + +/* void glDisableVertexAttribArray ( GLuint index ) */ +static void +android_glDisableVertexAttribArray__I + (JNIEnv *_env, jobject _this, jint index) { + glDisableVertexAttribArray( + (GLuint)index + ); +} + +/* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */ +static void +android_glDrawArrays__III + (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) { + glDrawArrays( + (GLenum)mode, + (GLint)first, + (GLsizei)count + ); +} + +/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */ +static void +android_glDrawElements__IIILjava_nio_Buffer_2 + (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *indices = (GLvoid *) 0; + + indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining); + if (_remaining < count) { + _env->ThrowNew(AIOOBEClass, "remaining() < count"); + goto exit; + } + glDrawElements( + (GLenum)mode, + (GLsizei)count, + (GLenum)type, + (GLvoid *)indices + ); + +exit: + if (_array) { + releasePointer(_env, _array, indices, JNI_FALSE); + } +} + +/* void glEnable ( GLenum cap ) */ +static void +android_glEnable__I + (JNIEnv *_env, jobject _this, jint cap) { + glEnable( + (GLenum)cap + ); +} + +/* void glEnableVertexAttribArray ( GLuint index ) */ +static void +android_glEnableVertexAttribArray__I + (JNIEnv *_env, jobject _this, jint index) { + glEnableVertexAttribArray( + (GLuint)index + ); +} + +/* void glFinish ( void ) */ +static void +android_glFinish__ + (JNIEnv *_env, jobject _this) { + glFinish(); +} + +/* void glFlush ( void ) */ +static void +android_glFlush__ + (JNIEnv *_env, jobject _this) { + glFlush(); +} + +/* void glFramebufferRenderbuffer ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) */ +static void +android_glFramebufferRenderbuffer__IIII + (JNIEnv *_env, jobject _this, jint target, jint attachment, jint renderbuffertarget, jint renderbuffer) { + glFramebufferRenderbuffer( + (GLenum)target, + (GLenum)attachment, + (GLenum)renderbuffertarget, + (GLuint)renderbuffer + ); +} + +/* void glFramebufferTexture2D ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) */ +static void +android_glFramebufferTexture2D__IIIII + (JNIEnv *_env, jobject _this, jint target, jint attachment, jint textarget, jint texture, jint level) { + glFramebufferTexture2D( + (GLenum)target, + (GLenum)attachment, + (GLenum)textarget, + (GLuint)texture, + (GLint)level + ); +} + +/* void glFrontFace ( GLenum mode ) */ +static void +android_glFrontFace__I + (JNIEnv *_env, jobject _this, jint mode) { + glFrontFace( + (GLenum)mode + ); +} + +/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */ +static void +android_glGenBuffers__I_3II + (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) { + jint _exception = 0; + GLuint *buffers_base = (GLuint *) 0; + jint _remaining; + GLuint *buffers = (GLuint *) 0; + + if (!buffers_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "buffers == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(buffers_ref) - offset; + if (_remaining < n) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - offset < n"); + goto exit; + } + buffers_base = (GLuint *) + _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0); + buffers = buffers_base + offset; + + glGenBuffers( + (GLsizei)n, + (GLuint *)buffers + ); + +exit: + if (buffers_base) { + _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */ +static void +android_glGenBuffers__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLuint *buffers = (GLuint *) 0; + + buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining); + if (_remaining < n) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < n"); + goto exit; + } + glGenBuffers( + (GLsizei)n, + (GLuint *)buffers + ); + +exit: + if (_array) { + releasePointer(_env, _array, buffers, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGenerateMipmap ( GLenum target ) */ +static void +android_glGenerateMipmap__I + (JNIEnv *_env, jobject _this, jint target) { + glGenerateMipmap( + (GLenum)target + ); +} + +/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */ +static void +android_glGenFramebuffers__I_3II + (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) { + jint _exception = 0; + GLuint *framebuffers_base = (GLuint *) 0; + jint _remaining; + GLuint *framebuffers = (GLuint *) 0; + + if (!framebuffers_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "framebuffers == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(framebuffers_ref) - offset; + framebuffers_base = (GLuint *) + _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0); + framebuffers = framebuffers_base + offset; + + glGenFramebuffers( + (GLsizei)n, + (GLuint *)framebuffers + ); + +exit: + if (framebuffers_base) { + _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */ +static void +android_glGenFramebuffers__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLuint *framebuffers = (GLuint *) 0; + + framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining); + glGenFramebuffers( + (GLsizei)n, + (GLuint *)framebuffers + ); + if (_array) { + releasePointer(_env, _array, framebuffers, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */ +static void +android_glGenRenderbuffers__I_3II + (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) { + jint _exception = 0; + GLuint *renderbuffers_base = (GLuint *) 0; + jint _remaining; + GLuint *renderbuffers = (GLuint *) 0; + + if (!renderbuffers_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "renderbuffers == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(renderbuffers_ref) - offset; + renderbuffers_base = (GLuint *) + _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0); + renderbuffers = renderbuffers_base + offset; + + glGenRenderbuffers( + (GLsizei)n, + (GLuint *)renderbuffers + ); + +exit: + if (renderbuffers_base) { + _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */ +static void +android_glGenRenderbuffers__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLuint *renderbuffers = (GLuint *) 0; + + renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining); + glGenRenderbuffers( + (GLsizei)n, + (GLuint *)renderbuffers + ); + if (_array) { + releasePointer(_env, _array, renderbuffers, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGenTextures ( GLsizei n, GLuint *textures ) */ +static void +android_glGenTextures__I_3II + (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) { + jint _exception = 0; + GLuint *textures_base = (GLuint *) 0; + jint _remaining; + GLuint *textures = (GLuint *) 0; + + if (!textures_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "textures == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(textures_ref) - offset; + if (_remaining < n) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - offset < n"); + goto exit; + } + textures_base = (GLuint *) + _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0); + textures = textures_base + offset; + + glGenTextures( + (GLsizei)n, + (GLuint *)textures + ); + +exit: + if (textures_base) { + _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGenTextures ( GLsizei n, GLuint *textures ) */ +static void +android_glGenTextures__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLuint *textures = (GLuint *) 0; + + textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining); + if (_remaining < n) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < n"); + goto exit; + } + glGenTextures( + (GLsizei)n, + (GLuint *)textures + ); + +exit: + if (_array) { + releasePointer(_env, _array, textures, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ +static void +android_glGetActiveAttrib__III_3II_3II_3II_3BI + (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) { + jint _exception = 0; + 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; + _env->ThrowNew(IAEClass, "length == null"); + goto exit; + } + if (lengthOffset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "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; + _env->ThrowNew(IAEClass, "size == null"); + goto exit; + } + if (sizeOffset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "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; + _env->ThrowNew(IAEClass, "type == null"); + goto exit; + } + if (typeOffset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "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; + _env->ThrowNew(IAEClass, "name == null"); + goto exit; + } + if (nameOffset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "nameOffset < 0"); + goto exit; + } + _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset; + name_base = (char *) + _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0); + name = name_base + nameOffset; + + glGetActiveAttrib( + (GLuint)program, + (GLuint)index, + (GLsizei)bufsize, + (GLsizei *)length, + (GLint *)size, + (GLenum *)type, + (char *)name + ); + +exit: + if (name_base) { + _env->ReleasePrimitiveArrayCritical(name_ref, name_base, + _exception ? JNI_ABORT: 0); + } + if (type_base) { + _env->ReleasePrimitiveArrayCritical(type_ref, type_base, + _exception ? JNI_ABORT: 0); + } + if (size_base) { + _env->ReleasePrimitiveArrayCritical(size_ref, size_base, + _exception ? JNI_ABORT: 0); + } + if (length_base) { + _env->ReleasePrimitiveArrayCritical(length_ref, length_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ +static void +android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B + (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) { + jint _exception = 0; + jarray _lengthArray = (jarray) 0; + jarray _sizeArray = (jarray) 0; + jarray _typeArray = (jarray) 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); + size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining); + type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining); + glGetActiveAttrib( + (GLuint)program, + (GLuint)index, + (GLsizei)bufsize, + (GLsizei *)length, + (GLint *)size, + (GLenum *)type, + (char *)name + ); + if (_lengthArray) { + releasePointer(_env, _lengthArray, type, _exception ? JNI_FALSE : JNI_TRUE); + } + if (_sizeArray) { + releasePointer(_env, _sizeArray, size, _exception ? JNI_FALSE : JNI_TRUE); + } + if (_typeArray) { + releasePointer(_env, _typeArray, length, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ +static void +android_glGetActiveUniform__III_3II_3II_3II_3BI + (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) { + jint _exception = 0; + 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; + _env->ThrowNew(IAEClass, "length == null"); + goto exit; + } + if (lengthOffset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "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; + _env->ThrowNew(IAEClass, "size == null"); + goto exit; + } + if (sizeOffset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "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; + _env->ThrowNew(IAEClass, "type == null"); + goto exit; + } + if (typeOffset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "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; + _env->ThrowNew(IAEClass, "name == null"); + goto exit; + } + if (nameOffset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "nameOffset < 0"); + goto exit; + } + _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset; + name_base = (char *) + _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0); + name = name_base + nameOffset; + + glGetActiveUniform( + (GLuint)program, + (GLuint)index, + (GLsizei)bufsize, + (GLsizei *)length, + (GLint *)size, + (GLenum *)type, + (char *)name + ); + +exit: + if (name_base) { + _env->ReleasePrimitiveArrayCritical(name_ref, name_base, + _exception ? JNI_ABORT: 0); + } + if (type_base) { + _env->ReleasePrimitiveArrayCritical(type_ref, type_base, + _exception ? JNI_ABORT: 0); + } + if (size_base) { + _env->ReleasePrimitiveArrayCritical(size_ref, size_base, + _exception ? JNI_ABORT: 0); + } + if (length_base) { + _env->ReleasePrimitiveArrayCritical(length_ref, length_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ +static void +android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B + (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) { + jint _exception = 0; + jarray _lengthArray = (jarray) 0; + jarray _sizeArray = (jarray) 0; + jarray _typeArray = (jarray) 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); + size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining); + type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining); + glGetActiveUniform( + (GLuint)program, + (GLuint)index, + (GLsizei)bufsize, + (GLsizei *)length, + (GLint *)size, + (GLenum *)type, + (char *)name + ); + if (_lengthArray) { + releasePointer(_env, _lengthArray, type, _exception ? JNI_FALSE : JNI_TRUE); + } + if (_sizeArray) { + releasePointer(_env, _sizeArray, size, _exception ? JNI_FALSE : JNI_TRUE); + } + if (_typeArray) { + releasePointer(_env, _typeArray, length, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */ +static void +android_glGetAttachedShaders__II_3II_3II + (JNIEnv *_env, jobject _this, jint program, jint maxcount, jintArray count_ref, jint countOffset, jintArray shaders_ref, jint shadersOffset) { + jint _exception = 0; + GLsizei *count_base = (GLsizei *) 0; + jint _countRemaining; + GLsizei *count = (GLsizei *) 0; + GLuint *shaders_base = (GLuint *) 0; + jint _shadersRemaining; + GLuint *shaders = (GLuint *) 0; + + if (!count_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "count == null"); + goto exit; + } + if (countOffset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "countOffset < 0"); + goto exit; + } + _countRemaining = _env->GetArrayLength(count_ref) - countOffset; + count_base = (GLsizei *) + _env->GetPrimitiveArrayCritical(count_ref, (jboolean *)0); + count = count_base + countOffset; + + if (!shaders_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "shaders == null"); + goto exit; + } + if (shadersOffset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "shadersOffset < 0"); + goto exit; + } + _shadersRemaining = _env->GetArrayLength(shaders_ref) - shadersOffset; + shaders_base = (GLuint *) + _env->GetPrimitiveArrayCritical(shaders_ref, (jboolean *)0); + shaders = shaders_base + shadersOffset; + + glGetAttachedShaders( + (GLuint)program, + (GLsizei)maxcount, + (GLsizei *)count, + (GLuint *)shaders + ); + +exit: + if (shaders_base) { + _env->ReleasePrimitiveArrayCritical(shaders_ref, shaders_base, + _exception ? JNI_ABORT: 0); + } + if (count_base) { + _env->ReleasePrimitiveArrayCritical(count_ref, count_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */ +static void +android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint program, jint maxcount, jobject count_buf, jobject shaders_buf) { + jint _exception = 0; + jarray _countArray = (jarray) 0; + jarray _shadersArray = (jarray) 0; + jint _countRemaining; + GLsizei *count = (GLsizei *) 0; + jint _shadersRemaining; + GLuint *shaders = (GLuint *) 0; + + count = (GLsizei *)getPointer(_env, count_buf, &_countArray, &_countRemaining); + shaders = (GLuint *)getPointer(_env, shaders_buf, &_shadersArray, &_shadersRemaining); + glGetAttachedShaders( + (GLuint)program, + (GLsizei)maxcount, + (GLsizei *)count, + (GLuint *)shaders + ); + if (_countArray) { + releasePointer(_env, _countArray, shaders, _exception ? JNI_FALSE : JNI_TRUE); + } + if (_shadersArray) { + releasePointer(_env, _shadersArray, count, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* int glGetAttribLocation ( GLuint program, const char *name ) */ +static jint +android_glGetAttribLocation__ILjava_lang_String_2 + (JNIEnv *_env, jobject _this, jint program, jstring name) { + int _returnValue = 0; + const char* _nativename = 0; + + if (!name) { + _env->ThrowNew(IAEClass, "name == null"); + goto exit; + } + _nativename = _env->GetStringUTFChars(name, 0); + + _returnValue = glGetAttribLocation( + (GLuint)program, + (char *)_nativename + ); + +exit: + if (_nativename) { + _env->ReleaseStringUTFChars(name, _nativename); + } + + return _returnValue; +} + +/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ +static void +android_glGetBooleanv__I_3ZI + (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) { + jint _exception = 0; + GLboolean *params_base = (GLboolean *) 0; + jint _remaining; + GLboolean *params = (GLboolean *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLboolean *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetBooleanv( + (GLenum)pname, + (GLboolean *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ +static void +android_glGetBooleanv__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLboolean *params = (GLboolean *) 0; + + params = (GLboolean *)getPointer(_env, params_buf, &_array, &_remaining); + glGetBooleanv( + (GLenum)pname, + (GLboolean *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ +static void +android_glGetBufferParameteriv__II_3II + (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + _env->ThrowNew(UOEClass, + "glGetBufferParameteriv"); +} + +/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ +static void +android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + _env->ThrowNew(UOEClass, + "glGetBufferParameteriv"); +} + +/* GLenum glGetError ( void ) */ +static jint +android_glGetError__ + (JNIEnv *_env, jobject _this) { + GLenum _returnValue; + _returnValue = glGetError(); + return _returnValue; +} + +/* void glGetFloatv ( GLenum pname, GLfloat *params ) */ +static void +android_glGetFloatv__I_3FI + (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + GLfloat *params_base = (GLfloat *) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetFloatv( + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetFloatv ( GLenum pname, GLfloat *params ) */ +static void +android_glGetFloatv__ILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + glGetFloatv( + (GLenum)pname, + (GLfloat *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */ +static void +android_glGetFramebufferAttachmentParameteriv__III_3II + (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLint *params_base = (GLint *) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLint *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetFramebufferAttachmentParameteriv( + (GLenum)target, + (GLenum)attachment, + (GLenum)pname, + (GLint *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */ +static void +android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + glGetFramebufferAttachmentParameteriv( + (GLenum)target, + (GLenum)attachment, + (GLenum)pname, + (GLint *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetIntegerv ( GLenum pname, GLint *params ) */ +static void +android_glGetIntegerv__I_3II + (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLint *params_base = (GLint *) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + int _needed; + switch (pname) { +#if defined(GL_ALPHA_BITS) + case GL_ALPHA_BITS: +#endif // defined(GL_ALPHA_BITS) +#if defined(GL_ALPHA_TEST_FUNC) + case GL_ALPHA_TEST_FUNC: +#endif // defined(GL_ALPHA_TEST_FUNC) +#if defined(GL_ALPHA_TEST_REF) + case GL_ALPHA_TEST_REF: +#endif // defined(GL_ALPHA_TEST_REF) +#if defined(GL_BLEND_DST) + case GL_BLEND_DST: +#endif // defined(GL_BLEND_DST) +#if defined(GL_BLUE_BITS) + case GL_BLUE_BITS: +#endif // defined(GL_BLUE_BITS) +#if defined(GL_COLOR_ARRAY_BUFFER_BINDING) + case GL_COLOR_ARRAY_BUFFER_BINDING: +#endif // defined(GL_COLOR_ARRAY_BUFFER_BINDING) +#if defined(GL_COLOR_ARRAY_SIZE) + case GL_COLOR_ARRAY_SIZE: +#endif // defined(GL_COLOR_ARRAY_SIZE) +#if defined(GL_COLOR_ARRAY_STRIDE) + case GL_COLOR_ARRAY_STRIDE: +#endif // defined(GL_COLOR_ARRAY_STRIDE) +#if defined(GL_COLOR_ARRAY_TYPE) + case GL_COLOR_ARRAY_TYPE: +#endif // defined(GL_COLOR_ARRAY_TYPE) +#if defined(GL_CULL_FACE) + case GL_CULL_FACE: +#endif // defined(GL_CULL_FACE) +#if defined(GL_DEPTH_BITS) + case GL_DEPTH_BITS: +#endif // defined(GL_DEPTH_BITS) +#if defined(GL_DEPTH_CLEAR_VALUE) + case GL_DEPTH_CLEAR_VALUE: +#endif // defined(GL_DEPTH_CLEAR_VALUE) +#if defined(GL_DEPTH_FUNC) + case GL_DEPTH_FUNC: +#endif // defined(GL_DEPTH_FUNC) +#if defined(GL_DEPTH_WRITEMASK) + case GL_DEPTH_WRITEMASK: +#endif // defined(GL_DEPTH_WRITEMASK) +#if defined(GL_FOG_DENSITY) + case GL_FOG_DENSITY: +#endif // defined(GL_FOG_DENSITY) +#if defined(GL_FOG_END) + case GL_FOG_END: +#endif // defined(GL_FOG_END) +#if defined(GL_FOG_MODE) + case GL_FOG_MODE: +#endif // defined(GL_FOG_MODE) +#if defined(GL_FOG_START) + case GL_FOG_START: +#endif // defined(GL_FOG_START) +#if defined(GL_FRONT_FACE) + case GL_FRONT_FACE: +#endif // defined(GL_FRONT_FACE) +#if defined(GL_GREEN_BITS) + case GL_GREEN_BITS: +#endif // defined(GL_GREEN_BITS) +#if defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES) + case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: +#endif // defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES) +#if defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES) + case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: +#endif // defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES) +#if defined(GL_LIGHT_MODEL_COLOR_CONTROL) + case GL_LIGHT_MODEL_COLOR_CONTROL: +#endif // defined(GL_LIGHT_MODEL_COLOR_CONTROL) +#if defined(GL_LIGHT_MODEL_LOCAL_VIEWER) + case GL_LIGHT_MODEL_LOCAL_VIEWER: +#endif // defined(GL_LIGHT_MODEL_LOCAL_VIEWER) +#if defined(GL_LIGHT_MODEL_TWO_SIDE) + case GL_LIGHT_MODEL_TWO_SIDE: +#endif // defined(GL_LIGHT_MODEL_TWO_SIDE) +#if defined(GL_LINE_SMOOTH_HINT) + case GL_LINE_SMOOTH_HINT: +#endif // defined(GL_LINE_SMOOTH_HINT) +#if defined(GL_LINE_WIDTH) + case GL_LINE_WIDTH: +#endif // defined(GL_LINE_WIDTH) +#if defined(GL_LOGIC_OP_MODE) + case GL_LOGIC_OP_MODE: +#endif // defined(GL_LOGIC_OP_MODE) +#if defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES) + case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES: +#endif // defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES) +#if defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES) + case GL_MATRIX_INDEX_ARRAY_SIZE_OES: +#endif // defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES) +#if defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES) + case GL_MATRIX_INDEX_ARRAY_STRIDE_OES: +#endif // defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES) +#if defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES) + case GL_MATRIX_INDEX_ARRAY_TYPE_OES: +#endif // defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES) +#if defined(GL_MATRIX_MODE) + case GL_MATRIX_MODE: +#endif // defined(GL_MATRIX_MODE) +#if defined(GL_MAX_CLIP_PLANES) + case GL_MAX_CLIP_PLANES: +#endif // defined(GL_MAX_CLIP_PLANES) +#if defined(GL_MAX_ELEMENTS_INDICES) + case GL_MAX_ELEMENTS_INDICES: +#endif // defined(GL_MAX_ELEMENTS_INDICES) +#if defined(GL_MAX_ELEMENTS_VERTICES) + case GL_MAX_ELEMENTS_VERTICES: +#endif // defined(GL_MAX_ELEMENTS_VERTICES) +#if defined(GL_MAX_LIGHTS) + case GL_MAX_LIGHTS: +#endif // defined(GL_MAX_LIGHTS) +#if defined(GL_MAX_MODELVIEW_STACK_DEPTH) + case GL_MAX_MODELVIEW_STACK_DEPTH: +#endif // defined(GL_MAX_MODELVIEW_STACK_DEPTH) +#if defined(GL_MAX_PALETTE_MATRICES_OES) + case GL_MAX_PALETTE_MATRICES_OES: +#endif // defined(GL_MAX_PALETTE_MATRICES_OES) +#if defined(GL_MAX_PROJECTION_STACK_DEPTH) + case GL_MAX_PROJECTION_STACK_DEPTH: +#endif // defined(GL_MAX_PROJECTION_STACK_DEPTH) +#if defined(GL_MAX_TEXTURE_SIZE) + case GL_MAX_TEXTURE_SIZE: +#endif // defined(GL_MAX_TEXTURE_SIZE) +#if defined(GL_MAX_TEXTURE_STACK_DEPTH) + case GL_MAX_TEXTURE_STACK_DEPTH: +#endif // defined(GL_MAX_TEXTURE_STACK_DEPTH) +#if defined(GL_MAX_TEXTURE_UNITS) + case GL_MAX_TEXTURE_UNITS: +#endif // defined(GL_MAX_TEXTURE_UNITS) +#if defined(GL_MAX_VERTEX_UNITS_OES) + case GL_MAX_VERTEX_UNITS_OES: +#endif // defined(GL_MAX_VERTEX_UNITS_OES) +#if defined(GL_MODELVIEW_STACK_DEPTH) + case GL_MODELVIEW_STACK_DEPTH: +#endif // defined(GL_MODELVIEW_STACK_DEPTH) +#if defined(GL_NORMAL_ARRAY_BUFFER_BINDING) + case GL_NORMAL_ARRAY_BUFFER_BINDING: +#endif // defined(GL_NORMAL_ARRAY_BUFFER_BINDING) +#if defined(GL_NORMAL_ARRAY_STRIDE) + case GL_NORMAL_ARRAY_STRIDE: +#endif // defined(GL_NORMAL_ARRAY_STRIDE) +#if defined(GL_NORMAL_ARRAY_TYPE) + case GL_NORMAL_ARRAY_TYPE: +#endif // defined(GL_NORMAL_ARRAY_TYPE) +#if defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS) + case GL_NUM_COMPRESSED_TEXTURE_FORMATS: +#endif // defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS) +#if defined(GL_PACK_ALIGNMENT) + case GL_PACK_ALIGNMENT: +#endif // defined(GL_PACK_ALIGNMENT) +#if defined(GL_PERSPECTIVE_CORRECTION_HINT) + case GL_PERSPECTIVE_CORRECTION_HINT: +#endif // defined(GL_PERSPECTIVE_CORRECTION_HINT) +#if defined(GL_POINT_SIZE) + case GL_POINT_SIZE: +#endif // defined(GL_POINT_SIZE) +#if defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES) + case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES: +#endif // defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES) +#if defined(GL_POINT_SIZE_ARRAY_STRIDE_OES) + case GL_POINT_SIZE_ARRAY_STRIDE_OES: +#endif // defined(GL_POINT_SIZE_ARRAY_STRIDE_OES) +#if defined(GL_POINT_SIZE_ARRAY_TYPE_OES) + case GL_POINT_SIZE_ARRAY_TYPE_OES: +#endif // defined(GL_POINT_SIZE_ARRAY_TYPE_OES) +#if defined(GL_POINT_SMOOTH_HINT) + case GL_POINT_SMOOTH_HINT: +#endif // defined(GL_POINT_SMOOTH_HINT) +#if defined(GL_POLYGON_OFFSET_FACTOR) + case GL_POLYGON_OFFSET_FACTOR: +#endif // defined(GL_POLYGON_OFFSET_FACTOR) +#if defined(GL_POLYGON_OFFSET_UNITS) + case GL_POLYGON_OFFSET_UNITS: +#endif // defined(GL_POLYGON_OFFSET_UNITS) +#if defined(GL_PROJECTION_STACK_DEPTH) + case GL_PROJECTION_STACK_DEPTH: +#endif // defined(GL_PROJECTION_STACK_DEPTH) +#if defined(GL_RED_BITS) + case GL_RED_BITS: +#endif // defined(GL_RED_BITS) +#if defined(GL_SHADE_MODEL) + case GL_SHADE_MODEL: +#endif // defined(GL_SHADE_MODEL) +#if defined(GL_STENCIL_BITS) + case GL_STENCIL_BITS: +#endif // defined(GL_STENCIL_BITS) +#if defined(GL_STENCIL_CLEAR_VALUE) + case GL_STENCIL_CLEAR_VALUE: +#endif // defined(GL_STENCIL_CLEAR_VALUE) +#if defined(GL_STENCIL_FAIL) + case GL_STENCIL_FAIL: +#endif // defined(GL_STENCIL_FAIL) +#if defined(GL_STENCIL_FUNC) + case GL_STENCIL_FUNC: +#endif // defined(GL_STENCIL_FUNC) +#if defined(GL_STENCIL_PASS_DEPTH_FAIL) + case GL_STENCIL_PASS_DEPTH_FAIL: +#endif // defined(GL_STENCIL_PASS_DEPTH_FAIL) +#if defined(GL_STENCIL_PASS_DEPTH_PASS) + case GL_STENCIL_PASS_DEPTH_PASS: +#endif // defined(GL_STENCIL_PASS_DEPTH_PASS) +#if defined(GL_STENCIL_REF) + case GL_STENCIL_REF: +#endif // defined(GL_STENCIL_REF) +#if defined(GL_STENCIL_VALUE_MASK) + case GL_STENCIL_VALUE_MASK: +#endif // defined(GL_STENCIL_VALUE_MASK) +#if defined(GL_STENCIL_WRITEMASK) + case GL_STENCIL_WRITEMASK: +#endif // defined(GL_STENCIL_WRITEMASK) +#if defined(GL_SUBPIXEL_BITS) + case GL_SUBPIXEL_BITS: +#endif // defined(GL_SUBPIXEL_BITS) +#if defined(GL_TEXTURE_BINDING_2D) + case GL_TEXTURE_BINDING_2D: +#endif // defined(GL_TEXTURE_BINDING_2D) +#if defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING) + case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING: +#endif // defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING) +#if defined(GL_TEXTURE_COORD_ARRAY_SIZE) + case GL_TEXTURE_COORD_ARRAY_SIZE: +#endif // defined(GL_TEXTURE_COORD_ARRAY_SIZE) +#if defined(GL_TEXTURE_COORD_ARRAY_STRIDE) + case GL_TEXTURE_COORD_ARRAY_STRIDE: +#endif // defined(GL_TEXTURE_COORD_ARRAY_STRIDE) +#if defined(GL_TEXTURE_COORD_ARRAY_TYPE) + case GL_TEXTURE_COORD_ARRAY_TYPE: +#endif // defined(GL_TEXTURE_COORD_ARRAY_TYPE) +#if defined(GL_TEXTURE_STACK_DEPTH) + case GL_TEXTURE_STACK_DEPTH: +#endif // defined(GL_TEXTURE_STACK_DEPTH) +#if defined(GL_UNPACK_ALIGNMENT) + case GL_UNPACK_ALIGNMENT: +#endif // defined(GL_UNPACK_ALIGNMENT) +#if defined(GL_VERTEX_ARRAY_BUFFER_BINDING) + case GL_VERTEX_ARRAY_BUFFER_BINDING: +#endif // defined(GL_VERTEX_ARRAY_BUFFER_BINDING) +#if defined(GL_VERTEX_ARRAY_SIZE) + case GL_VERTEX_ARRAY_SIZE: +#endif // defined(GL_VERTEX_ARRAY_SIZE) +#if defined(GL_VERTEX_ARRAY_STRIDE) + case GL_VERTEX_ARRAY_STRIDE: +#endif // defined(GL_VERTEX_ARRAY_STRIDE) +#if defined(GL_VERTEX_ARRAY_TYPE) + case GL_VERTEX_ARRAY_TYPE: +#endif // defined(GL_VERTEX_ARRAY_TYPE) +#if defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES) + case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES: +#endif // defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES) +#if defined(GL_WEIGHT_ARRAY_SIZE_OES) + case GL_WEIGHT_ARRAY_SIZE_OES: +#endif // defined(GL_WEIGHT_ARRAY_SIZE_OES) +#if defined(GL_WEIGHT_ARRAY_STRIDE_OES) + case GL_WEIGHT_ARRAY_STRIDE_OES: +#endif // defined(GL_WEIGHT_ARRAY_STRIDE_OES) +#if defined(GL_WEIGHT_ARRAY_TYPE_OES) + case GL_WEIGHT_ARRAY_TYPE_OES: +#endif // defined(GL_WEIGHT_ARRAY_TYPE_OES) + _needed = 1; + break; +#if defined(GL_ALIASED_POINT_SIZE_RANGE) + case GL_ALIASED_POINT_SIZE_RANGE: +#endif // defined(GL_ALIASED_POINT_SIZE_RANGE) +#if defined(GL_ALIASED_LINE_WIDTH_RANGE) + case GL_ALIASED_LINE_WIDTH_RANGE: +#endif // defined(GL_ALIASED_LINE_WIDTH_RANGE) +#if defined(GL_DEPTH_RANGE) + case GL_DEPTH_RANGE: +#endif // defined(GL_DEPTH_RANGE) +#if defined(GL_MAX_VIEWPORT_DIMS) + case GL_MAX_VIEWPORT_DIMS: +#endif // defined(GL_MAX_VIEWPORT_DIMS) +#if defined(GL_SMOOTH_LINE_WIDTH_RANGE) + case GL_SMOOTH_LINE_WIDTH_RANGE: +#endif // defined(GL_SMOOTH_LINE_WIDTH_RANGE) +#if defined(GL_SMOOTH_POINT_SIZE_RANGE) + case GL_SMOOTH_POINT_SIZE_RANGE: +#endif // defined(GL_SMOOTH_POINT_SIZE_RANGE) + _needed = 2; + break; +#if defined(GL_COLOR_CLEAR_VALUE) + case GL_COLOR_CLEAR_VALUE: +#endif // defined(GL_COLOR_CLEAR_VALUE) +#if defined(GL_COLOR_WRITEMASK) + case GL_COLOR_WRITEMASK: +#endif // defined(GL_COLOR_WRITEMASK) +#if defined(GL_FOG_COLOR) + case GL_FOG_COLOR: +#endif // defined(GL_FOG_COLOR) +#if defined(GL_LIGHT_MODEL_AMBIENT) + case GL_LIGHT_MODEL_AMBIENT: +#endif // defined(GL_LIGHT_MODEL_AMBIENT) +#if defined(GL_SCISSOR_BOX) + case GL_SCISSOR_BOX: +#endif // defined(GL_SCISSOR_BOX) +#if defined(GL_VIEWPORT) + case GL_VIEWPORT: +#endif // defined(GL_VIEWPORT) + _needed = 4; + break; +#if defined(GL_MODELVIEW_MATRIX) + case GL_MODELVIEW_MATRIX: +#endif // defined(GL_MODELVIEW_MATRIX) +#if defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES) + case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES: +#endif // defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES) +#if defined(GL_PROJECTION_MATRIX) + case GL_PROJECTION_MATRIX: +#endif // defined(GL_PROJECTION_MATRIX) +#if defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES) + case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES: +#endif // defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES) +#if defined(GL_TEXTURE_MATRIX) + case GL_TEXTURE_MATRIX: +#endif // defined(GL_TEXTURE_MATRIX) +#if defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES) + case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES: +#endif // defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES) + _needed = 16; + break; +#if defined(GL_COMPRESSED_TEXTURE_FORMATS) + case GL_COMPRESSED_TEXTURE_FORMATS: +#endif // defined(GL_COMPRESSED_TEXTURE_FORMATS) + _needed = getNumCompressedTextureFormats(); + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - offset < needed"); + goto exit; + } + params_base = (GLint *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetIntegerv( + (GLenum)pname, + (GLint *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetIntegerv ( GLenum pname, GLint *params ) */ +static void +android_glGetIntegerv__ILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + int _needed; + switch (pname) { +#if defined(GL_ALPHA_BITS) + case GL_ALPHA_BITS: +#endif // defined(GL_ALPHA_BITS) +#if defined(GL_ALPHA_TEST_FUNC) + case GL_ALPHA_TEST_FUNC: +#endif // defined(GL_ALPHA_TEST_FUNC) +#if defined(GL_ALPHA_TEST_REF) + case GL_ALPHA_TEST_REF: +#endif // defined(GL_ALPHA_TEST_REF) +#if defined(GL_BLEND_DST) + case GL_BLEND_DST: +#endif // defined(GL_BLEND_DST) +#if defined(GL_BLUE_BITS) + case GL_BLUE_BITS: +#endif // defined(GL_BLUE_BITS) +#if defined(GL_COLOR_ARRAY_BUFFER_BINDING) + case GL_COLOR_ARRAY_BUFFER_BINDING: +#endif // defined(GL_COLOR_ARRAY_BUFFER_BINDING) +#if defined(GL_COLOR_ARRAY_SIZE) + case GL_COLOR_ARRAY_SIZE: +#endif // defined(GL_COLOR_ARRAY_SIZE) +#if defined(GL_COLOR_ARRAY_STRIDE) + case GL_COLOR_ARRAY_STRIDE: +#endif // defined(GL_COLOR_ARRAY_STRIDE) +#if defined(GL_COLOR_ARRAY_TYPE) + case GL_COLOR_ARRAY_TYPE: +#endif // defined(GL_COLOR_ARRAY_TYPE) +#if defined(GL_CULL_FACE) + case GL_CULL_FACE: +#endif // defined(GL_CULL_FACE) +#if defined(GL_DEPTH_BITS) + case GL_DEPTH_BITS: +#endif // defined(GL_DEPTH_BITS) +#if defined(GL_DEPTH_CLEAR_VALUE) + case GL_DEPTH_CLEAR_VALUE: +#endif // defined(GL_DEPTH_CLEAR_VALUE) +#if defined(GL_DEPTH_FUNC) + case GL_DEPTH_FUNC: +#endif // defined(GL_DEPTH_FUNC) +#if defined(GL_DEPTH_WRITEMASK) + case GL_DEPTH_WRITEMASK: +#endif // defined(GL_DEPTH_WRITEMASK) +#if defined(GL_FOG_DENSITY) + case GL_FOG_DENSITY: +#endif // defined(GL_FOG_DENSITY) +#if defined(GL_FOG_END) + case GL_FOG_END: +#endif // defined(GL_FOG_END) +#if defined(GL_FOG_MODE) + case GL_FOG_MODE: +#endif // defined(GL_FOG_MODE) +#if defined(GL_FOG_START) + case GL_FOG_START: +#endif // defined(GL_FOG_START) +#if defined(GL_FRONT_FACE) + case GL_FRONT_FACE: +#endif // defined(GL_FRONT_FACE) +#if defined(GL_GREEN_BITS) + case GL_GREEN_BITS: +#endif // defined(GL_GREEN_BITS) +#if defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES) + case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: +#endif // defined(GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES) +#if defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES) + case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: +#endif // defined(GL_IMPLEMENTATION_COLOR_READ_TYPE_OES) +#if defined(GL_LIGHT_MODEL_COLOR_CONTROL) + case GL_LIGHT_MODEL_COLOR_CONTROL: +#endif // defined(GL_LIGHT_MODEL_COLOR_CONTROL) +#if defined(GL_LIGHT_MODEL_LOCAL_VIEWER) + case GL_LIGHT_MODEL_LOCAL_VIEWER: +#endif // defined(GL_LIGHT_MODEL_LOCAL_VIEWER) +#if defined(GL_LIGHT_MODEL_TWO_SIDE) + case GL_LIGHT_MODEL_TWO_SIDE: +#endif // defined(GL_LIGHT_MODEL_TWO_SIDE) +#if defined(GL_LINE_SMOOTH_HINT) + case GL_LINE_SMOOTH_HINT: +#endif // defined(GL_LINE_SMOOTH_HINT) +#if defined(GL_LINE_WIDTH) + case GL_LINE_WIDTH: +#endif // defined(GL_LINE_WIDTH) +#if defined(GL_LOGIC_OP_MODE) + case GL_LOGIC_OP_MODE: +#endif // defined(GL_LOGIC_OP_MODE) +#if defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES) + case GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES: +#endif // defined(GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES) +#if defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES) + case GL_MATRIX_INDEX_ARRAY_SIZE_OES: +#endif // defined(GL_MATRIX_INDEX_ARRAY_SIZE_OES) +#if defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES) + case GL_MATRIX_INDEX_ARRAY_STRIDE_OES: +#endif // defined(GL_MATRIX_INDEX_ARRAY_STRIDE_OES) +#if defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES) + case GL_MATRIX_INDEX_ARRAY_TYPE_OES: +#endif // defined(GL_MATRIX_INDEX_ARRAY_TYPE_OES) +#if defined(GL_MATRIX_MODE) + case GL_MATRIX_MODE: +#endif // defined(GL_MATRIX_MODE) +#if defined(GL_MAX_CLIP_PLANES) + case GL_MAX_CLIP_PLANES: +#endif // defined(GL_MAX_CLIP_PLANES) +#if defined(GL_MAX_ELEMENTS_INDICES) + case GL_MAX_ELEMENTS_INDICES: +#endif // defined(GL_MAX_ELEMENTS_INDICES) +#if defined(GL_MAX_ELEMENTS_VERTICES) + case GL_MAX_ELEMENTS_VERTICES: +#endif // defined(GL_MAX_ELEMENTS_VERTICES) +#if defined(GL_MAX_LIGHTS) + case GL_MAX_LIGHTS: +#endif // defined(GL_MAX_LIGHTS) +#if defined(GL_MAX_MODELVIEW_STACK_DEPTH) + case GL_MAX_MODELVIEW_STACK_DEPTH: +#endif // defined(GL_MAX_MODELVIEW_STACK_DEPTH) +#if defined(GL_MAX_PALETTE_MATRICES_OES) + case GL_MAX_PALETTE_MATRICES_OES: +#endif // defined(GL_MAX_PALETTE_MATRICES_OES) +#if defined(GL_MAX_PROJECTION_STACK_DEPTH) + case GL_MAX_PROJECTION_STACK_DEPTH: +#endif // defined(GL_MAX_PROJECTION_STACK_DEPTH) +#if defined(GL_MAX_TEXTURE_SIZE) + case GL_MAX_TEXTURE_SIZE: +#endif // defined(GL_MAX_TEXTURE_SIZE) +#if defined(GL_MAX_TEXTURE_STACK_DEPTH) + case GL_MAX_TEXTURE_STACK_DEPTH: +#endif // defined(GL_MAX_TEXTURE_STACK_DEPTH) +#if defined(GL_MAX_TEXTURE_UNITS) + case GL_MAX_TEXTURE_UNITS: +#endif // defined(GL_MAX_TEXTURE_UNITS) +#if defined(GL_MAX_VERTEX_UNITS_OES) + case GL_MAX_VERTEX_UNITS_OES: +#endif // defined(GL_MAX_VERTEX_UNITS_OES) +#if defined(GL_MODELVIEW_STACK_DEPTH) + case GL_MODELVIEW_STACK_DEPTH: +#endif // defined(GL_MODELVIEW_STACK_DEPTH) +#if defined(GL_NORMAL_ARRAY_BUFFER_BINDING) + case GL_NORMAL_ARRAY_BUFFER_BINDING: +#endif // defined(GL_NORMAL_ARRAY_BUFFER_BINDING) +#if defined(GL_NORMAL_ARRAY_STRIDE) + case GL_NORMAL_ARRAY_STRIDE: +#endif // defined(GL_NORMAL_ARRAY_STRIDE) +#if defined(GL_NORMAL_ARRAY_TYPE) + case GL_NORMAL_ARRAY_TYPE: +#endif // defined(GL_NORMAL_ARRAY_TYPE) +#if defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS) + case GL_NUM_COMPRESSED_TEXTURE_FORMATS: +#endif // defined(GL_NUM_COMPRESSED_TEXTURE_FORMATS) +#if defined(GL_PACK_ALIGNMENT) + case GL_PACK_ALIGNMENT: +#endif // defined(GL_PACK_ALIGNMENT) +#if defined(GL_PERSPECTIVE_CORRECTION_HINT) + case GL_PERSPECTIVE_CORRECTION_HINT: +#endif // defined(GL_PERSPECTIVE_CORRECTION_HINT) +#if defined(GL_POINT_SIZE) + case GL_POINT_SIZE: +#endif // defined(GL_POINT_SIZE) +#if defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES) + case GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES: +#endif // defined(GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES) +#if defined(GL_POINT_SIZE_ARRAY_STRIDE_OES) + case GL_POINT_SIZE_ARRAY_STRIDE_OES: +#endif // defined(GL_POINT_SIZE_ARRAY_STRIDE_OES) +#if defined(GL_POINT_SIZE_ARRAY_TYPE_OES) + case GL_POINT_SIZE_ARRAY_TYPE_OES: +#endif // defined(GL_POINT_SIZE_ARRAY_TYPE_OES) +#if defined(GL_POINT_SMOOTH_HINT) + case GL_POINT_SMOOTH_HINT: +#endif // defined(GL_POINT_SMOOTH_HINT) +#if defined(GL_POLYGON_OFFSET_FACTOR) + case GL_POLYGON_OFFSET_FACTOR: +#endif // defined(GL_POLYGON_OFFSET_FACTOR) +#if defined(GL_POLYGON_OFFSET_UNITS) + case GL_POLYGON_OFFSET_UNITS: +#endif // defined(GL_POLYGON_OFFSET_UNITS) +#if defined(GL_PROJECTION_STACK_DEPTH) + case GL_PROJECTION_STACK_DEPTH: +#endif // defined(GL_PROJECTION_STACK_DEPTH) +#if defined(GL_RED_BITS) + case GL_RED_BITS: +#endif // defined(GL_RED_BITS) +#if defined(GL_SHADE_MODEL) + case GL_SHADE_MODEL: +#endif // defined(GL_SHADE_MODEL) +#if defined(GL_STENCIL_BITS) + case GL_STENCIL_BITS: +#endif // defined(GL_STENCIL_BITS) +#if defined(GL_STENCIL_CLEAR_VALUE) + case GL_STENCIL_CLEAR_VALUE: +#endif // defined(GL_STENCIL_CLEAR_VALUE) +#if defined(GL_STENCIL_FAIL) + case GL_STENCIL_FAIL: +#endif // defined(GL_STENCIL_FAIL) +#if defined(GL_STENCIL_FUNC) + case GL_STENCIL_FUNC: +#endif // defined(GL_STENCIL_FUNC) +#if defined(GL_STENCIL_PASS_DEPTH_FAIL) + case GL_STENCIL_PASS_DEPTH_FAIL: +#endif // defined(GL_STENCIL_PASS_DEPTH_FAIL) +#if defined(GL_STENCIL_PASS_DEPTH_PASS) + case GL_STENCIL_PASS_DEPTH_PASS: +#endif // defined(GL_STENCIL_PASS_DEPTH_PASS) +#if defined(GL_STENCIL_REF) + case GL_STENCIL_REF: +#endif // defined(GL_STENCIL_REF) +#if defined(GL_STENCIL_VALUE_MASK) + case GL_STENCIL_VALUE_MASK: +#endif // defined(GL_STENCIL_VALUE_MASK) +#if defined(GL_STENCIL_WRITEMASK) + case GL_STENCIL_WRITEMASK: +#endif // defined(GL_STENCIL_WRITEMASK) +#if defined(GL_SUBPIXEL_BITS) + case GL_SUBPIXEL_BITS: +#endif // defined(GL_SUBPIXEL_BITS) +#if defined(GL_TEXTURE_BINDING_2D) + case GL_TEXTURE_BINDING_2D: +#endif // defined(GL_TEXTURE_BINDING_2D) +#if defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING) + case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING: +#endif // defined(GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING) +#if defined(GL_TEXTURE_COORD_ARRAY_SIZE) + case GL_TEXTURE_COORD_ARRAY_SIZE: +#endif // defined(GL_TEXTURE_COORD_ARRAY_SIZE) +#if defined(GL_TEXTURE_COORD_ARRAY_STRIDE) + case GL_TEXTURE_COORD_ARRAY_STRIDE: +#endif // defined(GL_TEXTURE_COORD_ARRAY_STRIDE) +#if defined(GL_TEXTURE_COORD_ARRAY_TYPE) + case GL_TEXTURE_COORD_ARRAY_TYPE: +#endif // defined(GL_TEXTURE_COORD_ARRAY_TYPE) +#if defined(GL_TEXTURE_STACK_DEPTH) + case GL_TEXTURE_STACK_DEPTH: +#endif // defined(GL_TEXTURE_STACK_DEPTH) +#if defined(GL_UNPACK_ALIGNMENT) + case GL_UNPACK_ALIGNMENT: +#endif // defined(GL_UNPACK_ALIGNMENT) +#if defined(GL_VERTEX_ARRAY_BUFFER_BINDING) + case GL_VERTEX_ARRAY_BUFFER_BINDING: +#endif // defined(GL_VERTEX_ARRAY_BUFFER_BINDING) +#if defined(GL_VERTEX_ARRAY_SIZE) + case GL_VERTEX_ARRAY_SIZE: +#endif // defined(GL_VERTEX_ARRAY_SIZE) +#if defined(GL_VERTEX_ARRAY_STRIDE) + case GL_VERTEX_ARRAY_STRIDE: +#endif // defined(GL_VERTEX_ARRAY_STRIDE) +#if defined(GL_VERTEX_ARRAY_TYPE) + case GL_VERTEX_ARRAY_TYPE: +#endif // defined(GL_VERTEX_ARRAY_TYPE) +#if defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES) + case GL_WEIGHT_ARRAY_BUFFER_BINDING_OES: +#endif // defined(GL_WEIGHT_ARRAY_BUFFER_BINDING_OES) +#if defined(GL_WEIGHT_ARRAY_SIZE_OES) + case GL_WEIGHT_ARRAY_SIZE_OES: +#endif // defined(GL_WEIGHT_ARRAY_SIZE_OES) +#if defined(GL_WEIGHT_ARRAY_STRIDE_OES) + case GL_WEIGHT_ARRAY_STRIDE_OES: +#endif // defined(GL_WEIGHT_ARRAY_STRIDE_OES) +#if defined(GL_WEIGHT_ARRAY_TYPE_OES) + case GL_WEIGHT_ARRAY_TYPE_OES: +#endif // defined(GL_WEIGHT_ARRAY_TYPE_OES) + _needed = 1; + break; +#if defined(GL_ALIASED_POINT_SIZE_RANGE) + case GL_ALIASED_POINT_SIZE_RANGE: +#endif // defined(GL_ALIASED_POINT_SIZE_RANGE) +#if defined(GL_ALIASED_LINE_WIDTH_RANGE) + case GL_ALIASED_LINE_WIDTH_RANGE: +#endif // defined(GL_ALIASED_LINE_WIDTH_RANGE) +#if defined(GL_DEPTH_RANGE) + case GL_DEPTH_RANGE: +#endif // defined(GL_DEPTH_RANGE) +#if defined(GL_MAX_VIEWPORT_DIMS) + case GL_MAX_VIEWPORT_DIMS: +#endif // defined(GL_MAX_VIEWPORT_DIMS) +#if defined(GL_SMOOTH_LINE_WIDTH_RANGE) + case GL_SMOOTH_LINE_WIDTH_RANGE: +#endif // defined(GL_SMOOTH_LINE_WIDTH_RANGE) +#if defined(GL_SMOOTH_POINT_SIZE_RANGE) + case GL_SMOOTH_POINT_SIZE_RANGE: +#endif // defined(GL_SMOOTH_POINT_SIZE_RANGE) + _needed = 2; + break; +#if defined(GL_COLOR_CLEAR_VALUE) + case GL_COLOR_CLEAR_VALUE: +#endif // defined(GL_COLOR_CLEAR_VALUE) +#if defined(GL_COLOR_WRITEMASK) + case GL_COLOR_WRITEMASK: +#endif // defined(GL_COLOR_WRITEMASK) +#if defined(GL_FOG_COLOR) + case GL_FOG_COLOR: +#endif // defined(GL_FOG_COLOR) +#if defined(GL_LIGHT_MODEL_AMBIENT) + case GL_LIGHT_MODEL_AMBIENT: +#endif // defined(GL_LIGHT_MODEL_AMBIENT) +#if defined(GL_SCISSOR_BOX) + case GL_SCISSOR_BOX: +#endif // defined(GL_SCISSOR_BOX) +#if defined(GL_VIEWPORT) + case GL_VIEWPORT: +#endif // defined(GL_VIEWPORT) + _needed = 4; + break; +#if defined(GL_MODELVIEW_MATRIX) + case GL_MODELVIEW_MATRIX: +#endif // defined(GL_MODELVIEW_MATRIX) +#if defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES) + case GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES: +#endif // defined(GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES) +#if defined(GL_PROJECTION_MATRIX) + case GL_PROJECTION_MATRIX: +#endif // defined(GL_PROJECTION_MATRIX) +#if defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES) + case GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES: +#endif // defined(GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES) +#if defined(GL_TEXTURE_MATRIX) + case GL_TEXTURE_MATRIX: +#endif // defined(GL_TEXTURE_MATRIX) +#if defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES) + case GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES: +#endif // defined(GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES) + _needed = 16; + break; +#if defined(GL_COMPRESSED_TEXTURE_FORMATS) + case GL_COMPRESSED_TEXTURE_FORMATS: +#endif // defined(GL_COMPRESSED_TEXTURE_FORMATS) + _needed = getNumCompressedTextureFormats(); + break; + default: + _needed = 0; + break; + } + if (_remaining < _needed) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < needed"); + goto exit; + } + glGetIntegerv( + (GLenum)pname, + (GLint *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */ +static void +android_glGetProgramiv__II_3II + (JNIEnv *_env, jobject _this, jint program, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLint *params_base = (GLint *) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLint *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetProgramiv( + (GLuint)program, + (GLenum)pname, + (GLint *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */ +static void +android_glGetProgramiv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint program, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + glGetProgramiv( + (GLuint)program, + (GLenum)pname, + (GLint *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +#include <string.h> + +/* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */ +static +jstring +android_glGetProgramInfoLog (JNIEnv *_env, jobject _this, jint shader) { + GLint infoLen = 0; + jstring _result = 0; + char* buf = 0; + glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen); + if (infoLen) { + char* buf = (char*) malloc(infoLen); + if (buf == 0) { + _env->ThrowNew(IAEClass, "out of memory"); + goto exit; + } + glGetProgramInfoLog(shader, infoLen, NULL, buf); + _result = _env->NewStringUTF(buf); + } else { + _result = _env->NewStringUTF(""); + } +exit: + if (buf) { + free(buf); + } + return _result; +} +/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ +static void +android_glGetRenderbufferParameteriv__II_3II + (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLint *params_base = (GLint *) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLint *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetRenderbufferParameteriv( + (GLenum)target, + (GLenum)pname, + (GLint *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ +static void +android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + glGetRenderbufferParameteriv( + (GLenum)target, + (GLenum)pname, + (GLint *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */ +static void +android_glGetShaderiv__II_3II + (JNIEnv *_env, jobject _this, jint shader, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLint *params_base = (GLint *) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLint *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetShaderiv( + (GLuint)shader, + (GLenum)pname, + (GLint *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */ +static void +android_glGetShaderiv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint shader, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + glGetShaderiv( + (GLuint)shader, + (GLenum)pname, + (GLint *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +#include <string.h> + +/* void glGetShaderInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */ +static +jstring +android_glGetShaderInfoLog (JNIEnv *_env, jobject _this, jint shader) { + GLint infoLen = 0; + jstring _result = 0; + char* buf = 0; + glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen); + if (infoLen) { + char* buf = (char*) malloc(infoLen); + if (buf == 0) { + _env->ThrowNew(IAEClass, "out of memory"); + goto exit; + } + glGetShaderInfoLog(shader, infoLen, NULL, buf); + _result = _env->NewStringUTF(buf); + } else { + _result = _env->NewStringUTF(""); + } +exit: + if (buf) { + free(buf); + } + return _result; +} +/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */ +static void +android_glGetShaderPrecisionFormat__II_3II_3II + (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jintArray range_ref, jint rangeOffset, jintArray precision_ref, jint precisionOffset) { + jint _exception = 0; + GLint *range_base = (GLint *) 0; + jint _rangeRemaining; + GLint *range = (GLint *) 0; + GLint *precision_base = (GLint *) 0; + jint _precisionRemaining; + GLint *precision = (GLint *) 0; + + if (!range_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "range == null"); + goto exit; + } + if (rangeOffset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "rangeOffset < 0"); + goto exit; + } + _rangeRemaining = _env->GetArrayLength(range_ref) - rangeOffset; + range_base = (GLint *) + _env->GetPrimitiveArrayCritical(range_ref, (jboolean *)0); + range = range_base + rangeOffset; + + if (!precision_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "precision == null"); + goto exit; + } + if (precisionOffset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "precisionOffset < 0"); + goto exit; + } + _precisionRemaining = _env->GetArrayLength(precision_ref) - precisionOffset; + precision_base = (GLint *) + _env->GetPrimitiveArrayCritical(precision_ref, (jboolean *)0); + precision = precision_base + precisionOffset; + + glGetShaderPrecisionFormat( + (GLenum)shadertype, + (GLenum)precisiontype, + (GLint *)range, + (GLint *)precision + ); + +exit: + if (precision_base) { + _env->ReleasePrimitiveArrayCritical(precision_ref, precision_base, + _exception ? JNI_ABORT: 0); + } + if (range_base) { + _env->ReleasePrimitiveArrayCritical(range_ref, range_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */ +static void +android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jobject range_buf, jobject precision_buf) { + jint _exception = 0; + jarray _rangeArray = (jarray) 0; + jarray _precisionArray = (jarray) 0; + jint _rangeRemaining; + GLint *range = (GLint *) 0; + jint _precisionRemaining; + GLint *precision = (GLint *) 0; + + range = (GLint *)getPointer(_env, range_buf, &_rangeArray, &_rangeRemaining); + precision = (GLint *)getPointer(_env, precision_buf, &_precisionArray, &_precisionRemaining); + glGetShaderPrecisionFormat( + (GLenum)shadertype, + (GLenum)precisiontype, + (GLint *)range, + (GLint *)precision + ); + if (_rangeArray) { + releasePointer(_env, _rangeArray, precision, _exception ? JNI_FALSE : JNI_TRUE); + } + if (_precisionArray) { + releasePointer(_env, _precisionArray, range, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */ +static void +android_glGetShaderSource__II_3II_3BI + (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jintArray length_ref, jint lengthOffset, jbyteArray source_ref, jint sourceOffset) { + jint _exception = 0; + GLsizei *length_base = (GLsizei *) 0; + jint _lengthRemaining; + GLsizei *length = (GLsizei *) 0; + char *source_base = (char *) 0; + jint _sourceRemaining; + char *source = (char *) 0; + + if (!length_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "length == null"); + goto exit; + } + if (lengthOffset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "lengthOffset < 0"); + goto exit; + } + _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; + length_base = (GLsizei *) + _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0); + length = length_base + lengthOffset; + + if (!source_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "source == null"); + goto exit; + } + if (sourceOffset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "sourceOffset < 0"); + goto exit; + } + _sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset; + source_base = (char *) + _env->GetPrimitiveArrayCritical(source_ref, (jboolean *)0); + source = source_base + sourceOffset; + + glGetShaderSource( + (GLuint)shader, + (GLsizei)bufsize, + (GLsizei *)length, + (char *)source + ); + +exit: + if (source_base) { + _env->ReleasePrimitiveArrayCritical(source_ref, source_base, + _exception ? JNI_ABORT: 0); + } + if (length_base) { + _env->ReleasePrimitiveArrayCritical(length_ref, length_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */ +static void +android_glGetShaderSource__IILjava_nio_IntBuffer_2B + (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jobject length_buf, jbyte source) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLsizei *length = (GLsizei *) 0; + + length = (GLsizei *)getPointer(_env, length_buf, &_array, &_remaining); + glGetShaderSource( + (GLuint)shader, + (GLsizei)bufsize, + (GLsizei *)length, + (char *)source + ); + if (_array) { + releasePointer(_env, _array, length, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +#include <string.h> + +/* const GLubyte * glGetString ( GLenum name ) */ +static +jstring +android_glGetString + (JNIEnv *_env, jobject _this, jint name) { + const char * chars = (const char *)glGetString((GLenum)name); + jstring output = _env->NewStringUTF(chars); + return output; +} +/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */ +static void +android_glGetTexParameterfv__II_3FI + (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + GLfloat *params_base = (GLfloat *) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + if (_remaining < 1) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - offset < 1"); + goto exit; + } + params_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetTexParameterfv( + (GLenum)target, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */ +static void +android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + if (_remaining < 1) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < 1"); + goto exit; + } + glGetTexParameterfv( + (GLenum)target, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */ +static void +android_glGetTexParameteriv__II_3II + (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLint *params_base = (GLint *) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + if (_remaining < 1) { + _exception = 1; + _env->ThrowNew(IAEClass, "length - offset < 1"); + goto exit; + } + params_base = (GLint *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetTexParameteriv( + (GLenum)target, + (GLenum)pname, + (GLint *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */ +static void +android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + if (_remaining < 1) { + _exception = 1; + _env->ThrowNew(IAEClass, "remaining() < 1"); + goto exit; + } + glGetTexParameteriv( + (GLenum)target, + (GLenum)pname, + (GLint *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */ +static void +android_glGetUniformfv__II_3FI + (JNIEnv *_env, jobject _this, jint program, jint location, jfloatArray params_ref, jint offset) { + jint _exception = 0; + GLfloat *params_base = (GLfloat *) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetUniformfv( + (GLuint)program, + (GLint)location, + (GLfloat *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */ +static void +android_glGetUniformfv__IILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + glGetUniformfv( + (GLuint)program, + (GLint)location, + (GLfloat *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */ +static void +android_glGetUniformiv__II_3II + (JNIEnv *_env, jobject _this, jint program, jint location, jintArray params_ref, jint offset) { + jint _exception = 0; + GLint *params_base = (GLint *) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLint *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetUniformiv( + (GLuint)program, + (GLint)location, + (GLint *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */ +static void +android_glGetUniformiv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + glGetUniformiv( + (GLuint)program, + (GLint)location, + (GLint *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* int glGetUniformLocation ( GLuint program, const char *name ) */ +static jint +android_glGetUniformLocation__ILjava_lang_String_2 + (JNIEnv *_env, jobject _this, jint program, jstring name) { + int _returnValue = 0; + const char* _nativename = 0; + + if (!name) { + _env->ThrowNew(IAEClass, "name == null"); + goto exit; + } + _nativename = _env->GetStringUTFChars(name, 0); + + _returnValue = glGetUniformLocation( + (GLuint)program, + (char *)_nativename + ); + +exit: + if (_nativename) { + _env->ReleaseStringUTFChars(name, _nativename); + } + + return _returnValue; +} + +/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */ +static void +android_glGetVertexAttribfv__II_3FI + (JNIEnv *_env, jobject _this, jint index, jint pname, jfloatArray params_ref, jint offset) { + jint _exception = 0; + GLfloat *params_base = (GLfloat *) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetVertexAttribfv( + (GLuint)index, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */ +static void +android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + glGetVertexAttribfv( + (GLuint)index, + (GLenum)pname, + (GLfloat *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */ +static void +android_glGetVertexAttribiv__II_3II + (JNIEnv *_env, jobject _this, jint index, jint pname, jintArray params_ref, jint offset) { + jint _exception = 0; + GLint *params_base = (GLint *) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + if (!params_ref) { + _exception = 1; + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _exception = 1; + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + params_base = (GLint *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glGetVertexAttribiv( + (GLuint)index, + (GLenum)pname, + (GLint *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + _exception ? JNI_ABORT: 0); + } +} + +/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */ +static void +android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + glGetVertexAttribiv( + (GLuint)index, + (GLenum)pname, + (GLint *)params + ); + if (_array) { + releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glHint ( GLenum target, GLenum mode ) */ +static void +android_glHint__II + (JNIEnv *_env, jobject _this, jint target, jint mode) { + glHint( + (GLenum)target, + (GLenum)mode + ); +} + +/* GLboolean glIsBuffer ( GLuint buffer ) */ +static jboolean +android_glIsBuffer__I + (JNIEnv *_env, jobject _this, jint buffer) { + GLboolean _returnValue; + _returnValue = glIsBuffer( + (GLuint)buffer + ); + return _returnValue; +} + +/* GLboolean glIsEnabled ( GLenum cap ) */ +static jboolean +android_glIsEnabled__I + (JNIEnv *_env, jobject _this, jint cap) { + GLboolean _returnValue; + _returnValue = glIsEnabled( + (GLenum)cap + ); + return _returnValue; +} + +/* GLboolean glIsFramebuffer ( GLuint framebuffer ) */ +static jboolean +android_glIsFramebuffer__I + (JNIEnv *_env, jobject _this, jint framebuffer) { + GLboolean _returnValue; + _returnValue = glIsFramebuffer( + (GLuint)framebuffer + ); + return _returnValue; +} + +/* GLboolean glIsProgram ( GLuint program ) */ +static jboolean +android_glIsProgram__I + (JNIEnv *_env, jobject _this, jint program) { + GLboolean _returnValue; + _returnValue = glIsProgram( + (GLuint)program + ); + return _returnValue; +} + +/* GLboolean glIsRenderbuffer ( GLuint renderbuffer ) */ +static jboolean +android_glIsRenderbuffer__I + (JNIEnv *_env, jobject _this, jint renderbuffer) { + GLboolean _returnValue; + _returnValue = glIsRenderbuffer( + (GLuint)renderbuffer + ); + return _returnValue; +} + +/* GLboolean glIsShader ( GLuint shader ) */ +static jboolean +android_glIsShader__I + (JNIEnv *_env, jobject _this, jint shader) { + GLboolean _returnValue; + _returnValue = glIsShader( + (GLuint)shader + ); + return _returnValue; +} + +/* GLboolean glIsTexture ( GLuint texture ) */ +static jboolean +android_glIsTexture__I + (JNIEnv *_env, jobject _this, jint texture) { + GLboolean _returnValue; + _returnValue = glIsTexture( + (GLuint)texture + ); + return _returnValue; +} + +/* void glLineWidth ( GLfloat width ) */ +static void +android_glLineWidth__F + (JNIEnv *_env, jobject _this, jfloat width) { + glLineWidth( + (GLfloat)width + ); +} + +/* void glLinkProgram ( GLuint program ) */ +static void +android_glLinkProgram__I + (JNIEnv *_env, jobject _this, jint program) { + glLinkProgram( + (GLuint)program + ); +} + +/* void glPixelStorei ( GLenum pname, GLint param ) */ +static void +android_glPixelStorei__II + (JNIEnv *_env, jobject _this, jint pname, jint param) { + glPixelStorei( + (GLenum)pname, + (GLint)param + ); +} + +/* void glPolygonOffset ( GLfloat factor, GLfloat units ) */ +static void +android_glPolygonOffset__FF + (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) { + glPolygonOffset( + (GLfloat)factor, + (GLfloat)units + ); +} + +/* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */ +static void +android_glReadPixels__IIIIIILjava_nio_Buffer_2 + (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) { + jint _exception = 0; + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *pixels = (GLvoid *) 0; + + pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining); + glReadPixels( + (GLint)x, + (GLint)y, + (GLsizei)width, + (GLsizei)height, + (GLenum)format, + (GLenum)type, + (GLvoid *)pixels + ); + if (_array) { + releasePointer(_env, _array, pixels, _exception ? JNI_FALSE : JNI_TRUE); + } +} + +/* void glReleaseShaderCompiler ( void ) */ +static void +android_glReleaseShaderCompiler__ + (JNIEnv *_env, jobject _this) { + glReleaseShaderCompiler(); +} + +/* void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) */ +static void +android_glRenderbufferStorage__IIII + (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint width, jint height) { + glRenderbufferStorage( + (GLenum)target, + (GLenum)internalformat, + (GLsizei)width, + (GLsizei)height + ); +} + +/* void glSampleCoverage ( GLclampf value, GLboolean invert ) */ +static void +android_glSampleCoverage__FZ + (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) { + glSampleCoverage( + (GLclampf)value, + (GLboolean)invert + ); +} + +/* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */ +static void +android_glScissor__IIII + (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) { + glScissor( + (GLint)x, + (GLint)y, + (GLsizei)width, + (GLsizei)height + ); +} + +/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */ +static void +android_glShaderBinary__I_3IIILjava_nio_Buffer_2I + (JNIEnv *_env, jobject _this, jint n, jintArray shaders_ref, jint offset, jint binaryformat, jobject binary_buf, jint length) { + jarray _array = (jarray) 0; + GLuint *shaders_base = (GLuint *) 0; + jint _shadersRemaining; + GLuint *shaders = (GLuint *) 0; + jint _binaryRemaining; + GLvoid *binary = (GLvoid *) 0; + + if (!shaders_ref) { + _env->ThrowNew(IAEClass, "shaders == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _shadersRemaining = _env->GetArrayLength(shaders_ref) - offset; + shaders_base = (GLuint *) + _env->GetPrimitiveArrayCritical(shaders_ref, (jboolean *)0); + shaders = shaders_base + offset; + + binary = (GLvoid *)getPointer(_env, binary_buf, &_array, &_binaryRemaining); + glShaderBinary( + (GLsizei)n, + (GLuint *)shaders, + (GLenum)binaryformat, + (GLvoid *)binary, + (GLsizei)length + ); + +exit: + if (_array) { + releasePointer(_env, _array, binary, JNI_FALSE); + } + if (shaders_base) { + _env->ReleasePrimitiveArrayCritical(shaders_ref, shaders_base, + JNI_ABORT); + } +} + +/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */ +static void +android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I + (JNIEnv *_env, jobject _this, jint n, jobject shaders_buf, jint binaryformat, jobject binary_buf, jint length) { + jarray _shadersArray = (jarray) 0; + jarray _binaryArray = (jarray) 0; + jint _shadersRemaining; + GLuint *shaders = (GLuint *) 0; + jint _binaryRemaining; + GLvoid *binary = (GLvoid *) 0; + + shaders = (GLuint *)getPointer(_env, shaders_buf, &_shadersArray, &_shadersRemaining); + binary = (GLvoid *)getPointer(_env, binary_buf, &_binaryArray, &_binaryRemaining); + glShaderBinary( + (GLsizei)n, + (GLuint *)shaders, + (GLenum)binaryformat, + (GLvoid *)binary, + (GLsizei)length + ); + if (_shadersArray) { + releasePointer(_env, _shadersArray, binary, JNI_FALSE); + } + if (_binaryArray) { + releasePointer(_env, _binaryArray, shaders, JNI_FALSE); + } +} + + +/* void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint * length ) */ +static +void +android_glShaderSource + (JNIEnv *_env, jobject _this, jint shader, jstring string) { + + if (!string) { + _env->ThrowNew(IAEClass, "string == null"); + return; + } + + const char* nativeString = _env->GetStringUTFChars(string, 0); + const char* strings[] = {nativeString}; + glShaderSource(shader, 1, strings, 0); + _env->ReleaseStringUTFChars(string, nativeString); +} +/* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */ +static void +android_glStencilFunc__III + (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) { + glStencilFunc( + (GLenum)func, + (GLint)ref, + (GLuint)mask + ); +} + +/* void glStencilFuncSeparate ( GLenum face, GLenum func, GLint ref, GLuint mask ) */ +static void +android_glStencilFuncSeparate__IIII + (JNIEnv *_env, jobject _this, jint face, jint func, jint ref, jint mask) { + glStencilFuncSeparate( + (GLenum)face, + (GLenum)func, + (GLint)ref, + (GLuint)mask + ); +} + +/* void glStencilMask ( GLuint mask ) */ +static void +android_glStencilMask__I + (JNIEnv *_env, jobject _this, jint mask) { + glStencilMask( + (GLuint)mask + ); +} + +/* void glStencilMaskSeparate ( GLenum face, GLuint mask ) */ +static void +android_glStencilMaskSeparate__II + (JNIEnv *_env, jobject _this, jint face, jint mask) { + glStencilMaskSeparate( + (GLenum)face, + (GLuint)mask + ); +} + +/* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */ +static void +android_glStencilOp__III + (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) { + glStencilOp( + (GLenum)fail, + (GLenum)zfail, + (GLenum)zpass + ); +} + +/* void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) */ +static void +android_glStencilOpSeparate__IIII + (JNIEnv *_env, jobject _this, jint face, jint fail, jint zfail, jint zpass) { + glStencilOpSeparate( + (GLenum)face, + (GLenum)fail, + (GLenum)zfail, + (GLenum)zpass + ); +} + +/* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */ +static void +android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 + (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *pixels = (GLvoid *) 0; + + if (pixels_buf) { + pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining); + } + glTexImage2D( + (GLenum)target, + (GLint)level, + (GLint)internalformat, + (GLsizei)width, + (GLsizei)height, + (GLint)border, + (GLenum)format, + (GLenum)type, + (GLvoid *)pixels + ); + if (_array) { + releasePointer(_env, _array, pixels, JNI_FALSE); + } +} + +/* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */ +static void +android_glTexParameterf__IIF + (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) { + glTexParameterf( + (GLenum)target, + (GLenum)pname, + (GLfloat)param + ); +} + +/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */ +static void +android_glTexParameterfv__II_3FI + (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) { + GLfloat *params_base = (GLfloat *) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + if (_remaining < 1) { + _env->ThrowNew(IAEClass, "length - offset < 1"); + goto exit; + } + params_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glTexParameterfv( + (GLenum)target, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */ +static void +android_glTexParameterfv__IILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *params = (GLfloat *) 0; + + params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining); + if (_remaining < 1) { + _env->ThrowNew(IAEClass, "remaining() < 1"); + goto exit; + } + glTexParameterfv( + (GLenum)target, + (GLenum)pname, + (GLfloat *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */ +static void +android_glTexParameteri__III + (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) { + glTexParameteri( + (GLenum)target, + (GLenum)pname, + (GLint)param + ); +} + +/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */ +static void +android_glTexParameteriv__II_3II + (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { + GLint *params_base = (GLint *) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + if (!params_ref) { + _env->ThrowNew(IAEClass, "params == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(params_ref) - offset; + if (_remaining < 1) { + _env->ThrowNew(IAEClass, "length - offset < 1"); + goto exit; + } + params_base = (GLint *) + _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); + params = params_base + offset; + + glTexParameteriv( + (GLenum)target, + (GLenum)pname, + (GLint *)params + ); + +exit: + if (params_base) { + _env->ReleasePrimitiveArrayCritical(params_ref, params_base, + JNI_ABORT); + } +} + +/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */ +static void +android_glTexParameteriv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLint *params = (GLint *) 0; + + params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining); + if (_remaining < 1) { + _env->ThrowNew(IAEClass, "remaining() < 1"); + goto exit; + } + glTexParameteriv( + (GLenum)target, + (GLenum)pname, + (GLint *)params + ); + +exit: + if (_array) { + releasePointer(_env, _array, params, JNI_FALSE); + } +} + +/* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */ +static void +android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 + (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *pixels = (GLvoid *) 0; + + if (pixels_buf) { + pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining); + } + glTexSubImage2D( + (GLenum)target, + (GLint)level, + (GLint)xoffset, + (GLint)yoffset, + (GLsizei)width, + (GLsizei)height, + (GLenum)format, + (GLenum)type, + (GLvoid *)pixels + ); + if (_array) { + releasePointer(_env, _array, pixels, JNI_FALSE); + } +} + +/* void glUniform1f ( GLint location, GLfloat x ) */ +static void +android_glUniform1f__IF + (JNIEnv *_env, jobject _this, jint location, jfloat x) { + glUniform1f( + (GLint)location, + (GLfloat)x + ); +} + +/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */ +static void +android_glUniform1fv__II_3FI + (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) { + GLfloat *v_base = (GLfloat *) 0; + jint _remaining; + GLfloat *v = (GLfloat *) 0; + + if (!v_ref) { + _env->ThrowNew(IAEClass, "v == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(v_ref) - offset; + v_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0); + v = v_base + offset; + + glUniform1fv( + (GLint)location, + (GLsizei)count, + (GLfloat *)v + ); + +exit: + if (v_base) { + _env->ReleasePrimitiveArrayCritical(v_ref, v_base, + JNI_ABORT); + } +} + +/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */ +static void +android_glUniform1fv__IILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *v = (GLfloat *) 0; + + v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining); + glUniform1fv( + (GLint)location, + (GLsizei)count, + (GLfloat *)v + ); + if (_array) { + releasePointer(_env, _array, v, JNI_FALSE); + } +} + +/* void glUniform1i ( GLint location, GLint x ) */ +static void +android_glUniform1i__II + (JNIEnv *_env, jobject _this, jint location, jint x) { + glUniform1i( + (GLint)location, + (GLint)x + ); +} + +/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */ +static void +android_glUniform1iv__II_3II + (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) { + GLint *v_base = (GLint *) 0; + jint _remaining; + GLint *v = (GLint *) 0; + + if (!v_ref) { + _env->ThrowNew(IAEClass, "v == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(v_ref) - offset; + v_base = (GLint *) + _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0); + v = v_base + offset; + + glUniform1iv( + (GLint)location, + (GLsizei)count, + (GLint *)v + ); + +exit: + if (v_base) { + _env->ReleasePrimitiveArrayCritical(v_ref, v_base, + JNI_ABORT); + } +} + +/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */ +static void +android_glUniform1iv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLint *v = (GLint *) 0; + + v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining); + glUniform1iv( + (GLint)location, + (GLsizei)count, + (GLint *)v + ); + if (_array) { + releasePointer(_env, _array, v, JNI_FALSE); + } +} + +/* void glUniform2f ( GLint location, GLfloat x, GLfloat y ) */ +static void +android_glUniform2f__IFF + (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y) { + glUniform2f( + (GLint)location, + (GLfloat)x, + (GLfloat)y + ); +} + +/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */ +static void +android_glUniform2fv__II_3FI + (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) { + GLfloat *v_base = (GLfloat *) 0; + jint _remaining; + GLfloat *v = (GLfloat *) 0; + + if (!v_ref) { + _env->ThrowNew(IAEClass, "v == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(v_ref) - offset; + v_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0); + v = v_base + offset; + + glUniform2fv( + (GLint)location, + (GLsizei)count, + (GLfloat *)v + ); + +exit: + if (v_base) { + _env->ReleasePrimitiveArrayCritical(v_ref, v_base, + JNI_ABORT); + } +} + +/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */ +static void +android_glUniform2fv__IILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *v = (GLfloat *) 0; + + v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining); + glUniform2fv( + (GLint)location, + (GLsizei)count, + (GLfloat *)v + ); + if (_array) { + releasePointer(_env, _array, v, JNI_FALSE); + } +} + +/* void glUniform2i ( GLint location, GLint x, GLint y ) */ +static void +android_glUniform2i__III + (JNIEnv *_env, jobject _this, jint location, jint x, jint y) { + glUniform2i( + (GLint)location, + (GLint)x, + (GLint)y + ); +} + +/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */ +static void +android_glUniform2iv__II_3II + (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) { + GLint *v_base = (GLint *) 0; + jint _remaining; + GLint *v = (GLint *) 0; + + if (!v_ref) { + _env->ThrowNew(IAEClass, "v == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(v_ref) - offset; + v_base = (GLint *) + _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0); + v = v_base + offset; + + glUniform2iv( + (GLint)location, + (GLsizei)count, + (GLint *)v + ); + +exit: + if (v_base) { + _env->ReleasePrimitiveArrayCritical(v_ref, v_base, + JNI_ABORT); + } +} + +/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */ +static void +android_glUniform2iv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLint *v = (GLint *) 0; + + v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining); + glUniform2iv( + (GLint)location, + (GLsizei)count, + (GLint *)v + ); + if (_array) { + releasePointer(_env, _array, v, JNI_FALSE); + } +} + +/* void glUniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z ) */ +static void +android_glUniform3f__IFFF + (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z) { + glUniform3f( + (GLint)location, + (GLfloat)x, + (GLfloat)y, + (GLfloat)z + ); +} + +/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */ +static void +android_glUniform3fv__II_3FI + (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) { + GLfloat *v_base = (GLfloat *) 0; + jint _remaining; + GLfloat *v = (GLfloat *) 0; + + if (!v_ref) { + _env->ThrowNew(IAEClass, "v == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(v_ref) - offset; + v_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0); + v = v_base + offset; + + glUniform3fv( + (GLint)location, + (GLsizei)count, + (GLfloat *)v + ); + +exit: + if (v_base) { + _env->ReleasePrimitiveArrayCritical(v_ref, v_base, + JNI_ABORT); + } +} + +/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */ +static void +android_glUniform3fv__IILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *v = (GLfloat *) 0; + + v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining); + glUniform3fv( + (GLint)location, + (GLsizei)count, + (GLfloat *)v + ); + if (_array) { + releasePointer(_env, _array, v, JNI_FALSE); + } +} + +/* void glUniform3i ( GLint location, GLint x, GLint y, GLint z ) */ +static void +android_glUniform3i__IIII + (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z) { + glUniform3i( + (GLint)location, + (GLint)x, + (GLint)y, + (GLint)z + ); +} + +/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */ +static void +android_glUniform3iv__II_3II + (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) { + GLint *v_base = (GLint *) 0; + jint _remaining; + GLint *v = (GLint *) 0; + + if (!v_ref) { + _env->ThrowNew(IAEClass, "v == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(v_ref) - offset; + v_base = (GLint *) + _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0); + v = v_base + offset; + + glUniform3iv( + (GLint)location, + (GLsizei)count, + (GLint *)v + ); + +exit: + if (v_base) { + _env->ReleasePrimitiveArrayCritical(v_ref, v_base, + JNI_ABORT); + } +} + +/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */ +static void +android_glUniform3iv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLint *v = (GLint *) 0; + + v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining); + glUniform3iv( + (GLint)location, + (GLsizei)count, + (GLint *)v + ); + if (_array) { + releasePointer(_env, _array, v, JNI_FALSE); + } +} + +/* void glUniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */ +static void +android_glUniform4f__IFFFF + (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z, jfloat w) { + glUniform4f( + (GLint)location, + (GLfloat)x, + (GLfloat)y, + (GLfloat)z, + (GLfloat)w + ); +} + +/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */ +static void +android_glUniform4fv__II_3FI + (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) { + GLfloat *v_base = (GLfloat *) 0; + jint _remaining; + GLfloat *v = (GLfloat *) 0; + + if (!v_ref) { + _env->ThrowNew(IAEClass, "v == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(v_ref) - offset; + v_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0); + v = v_base + offset; + + glUniform4fv( + (GLint)location, + (GLsizei)count, + (GLfloat *)v + ); + +exit: + if (v_base) { + _env->ReleasePrimitiveArrayCritical(v_ref, v_base, + JNI_ABORT); + } +} + +/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */ +static void +android_glUniform4fv__IILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *v = (GLfloat *) 0; + + v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining); + glUniform4fv( + (GLint)location, + (GLsizei)count, + (GLfloat *)v + ); + if (_array) { + releasePointer(_env, _array, v, JNI_FALSE); + } +} + +/* void glUniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w ) */ +static void +android_glUniform4i__IIIII + (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z, jint w) { + glUniform4i( + (GLint)location, + (GLint)x, + (GLint)y, + (GLint)z, + (GLint)w + ); +} + +/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */ +static void +android_glUniform4iv__II_3II + (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) { + GLint *v_base = (GLint *) 0; + jint _remaining; + GLint *v = (GLint *) 0; + + if (!v_ref) { + _env->ThrowNew(IAEClass, "v == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(v_ref) - offset; + v_base = (GLint *) + _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0); + v = v_base + offset; + + glUniform4iv( + (GLint)location, + (GLsizei)count, + (GLint *)v + ); + +exit: + if (v_base) { + _env->ReleasePrimitiveArrayCritical(v_ref, v_base, + JNI_ABORT); + } +} + +/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */ +static void +android_glUniform4iv__IILjava_nio_IntBuffer_2 + (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLint *v = (GLint *) 0; + + v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining); + glUniform4iv( + (GLint)location, + (GLsizei)count, + (GLint *)v + ); + if (_array) { + releasePointer(_env, _array, v, JNI_FALSE); + } +} + +/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ +static void +android_glUniformMatrix2fv__IIZ_3FI + (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) { + GLfloat *value_base = (GLfloat *) 0; + jint _remaining; + GLfloat *value = (GLfloat *) 0; + + if (!value_ref) { + _env->ThrowNew(IAEClass, "value == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(value_ref) - offset; + value_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0); + value = value_base + offset; + + glUniformMatrix2fv( + (GLint)location, + (GLsizei)count, + (GLboolean)transpose, + (GLfloat *)value + ); + +exit: + if (value_base) { + _env->ReleasePrimitiveArrayCritical(value_ref, value_base, + JNI_ABORT); + } +} + +/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ +static void +android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *value = (GLfloat *) 0; + + value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining); + glUniformMatrix2fv( + (GLint)location, + (GLsizei)count, + (GLboolean)transpose, + (GLfloat *)value + ); + if (_array) { + releasePointer(_env, _array, value, JNI_FALSE); + } +} + +/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ +static void +android_glUniformMatrix3fv__IIZ_3FI + (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) { + GLfloat *value_base = (GLfloat *) 0; + jint _remaining; + GLfloat *value = (GLfloat *) 0; + + if (!value_ref) { + _env->ThrowNew(IAEClass, "value == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(value_ref) - offset; + value_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0); + value = value_base + offset; + + glUniformMatrix3fv( + (GLint)location, + (GLsizei)count, + (GLboolean)transpose, + (GLfloat *)value + ); + +exit: + if (value_base) { + _env->ReleasePrimitiveArrayCritical(value_ref, value_base, + JNI_ABORT); + } +} + +/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ +static void +android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *value = (GLfloat *) 0; + + value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining); + glUniformMatrix3fv( + (GLint)location, + (GLsizei)count, + (GLboolean)transpose, + (GLfloat *)value + ); + if (_array) { + releasePointer(_env, _array, value, JNI_FALSE); + } +} + +/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ +static void +android_glUniformMatrix4fv__IIZ_3FI + (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) { + GLfloat *value_base = (GLfloat *) 0; + jint _remaining; + GLfloat *value = (GLfloat *) 0; + + if (!value_ref) { + _env->ThrowNew(IAEClass, "value == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(value_ref) - offset; + value_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0); + value = value_base + offset; + + glUniformMatrix4fv( + (GLint)location, + (GLsizei)count, + (GLboolean)transpose, + (GLfloat *)value + ); + +exit: + if (value_base) { + _env->ReleasePrimitiveArrayCritical(value_ref, value_base, + JNI_ABORT); + } +} + +/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ +static void +android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *value = (GLfloat *) 0; + + value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining); + glUniformMatrix4fv( + (GLint)location, + (GLsizei)count, + (GLboolean)transpose, + (GLfloat *)value + ); + if (_array) { + releasePointer(_env, _array, value, JNI_FALSE); + } +} + +/* void glUseProgram ( GLuint program ) */ +static void +android_glUseProgram__I + (JNIEnv *_env, jobject _this, jint program) { + glUseProgram( + (GLuint)program + ); +} + +/* void glValidateProgram ( GLuint program ) */ +static void +android_glValidateProgram__I + (JNIEnv *_env, jobject _this, jint program) { + glValidateProgram( + (GLuint)program + ); +} + +/* void glVertexAttrib1f ( GLuint indx, GLfloat x ) */ +static void +android_glVertexAttrib1f__IF + (JNIEnv *_env, jobject _this, jint indx, jfloat x) { + glVertexAttrib1f( + (GLuint)indx, + (GLfloat)x + ); +} + +/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */ +static void +android_glVertexAttrib1fv__I_3FI + (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) { + GLfloat *values_base = (GLfloat *) 0; + jint _remaining; + GLfloat *values = (GLfloat *) 0; + + if (!values_ref) { + _env->ThrowNew(IAEClass, "values == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(values_ref) - offset; + values_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0); + values = values_base + offset; + + glVertexAttrib1fv( + (GLuint)indx, + (GLfloat *)values + ); + +exit: + if (values_base) { + _env->ReleasePrimitiveArrayCritical(values_ref, values_base, + JNI_ABORT); + } +} + +/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */ +static void +android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *values = (GLfloat *) 0; + + values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining); + glVertexAttrib1fv( + (GLuint)indx, + (GLfloat *)values + ); + if (_array) { + releasePointer(_env, _array, values, JNI_FALSE); + } +} + +/* void glVertexAttrib2f ( GLuint indx, GLfloat x, GLfloat y ) */ +static void +android_glVertexAttrib2f__IFF + (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y) { + glVertexAttrib2f( + (GLuint)indx, + (GLfloat)x, + (GLfloat)y + ); +} + +/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */ +static void +android_glVertexAttrib2fv__I_3FI + (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) { + GLfloat *values_base = (GLfloat *) 0; + jint _remaining; + GLfloat *values = (GLfloat *) 0; + + if (!values_ref) { + _env->ThrowNew(IAEClass, "values == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(values_ref) - offset; + values_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0); + values = values_base + offset; + + glVertexAttrib2fv( + (GLuint)indx, + (GLfloat *)values + ); + +exit: + if (values_base) { + _env->ReleasePrimitiveArrayCritical(values_ref, values_base, + JNI_ABORT); + } +} + +/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */ +static void +android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *values = (GLfloat *) 0; + + values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining); + glVertexAttrib2fv( + (GLuint)indx, + (GLfloat *)values + ); + if (_array) { + releasePointer(_env, _array, values, JNI_FALSE); + } +} + +/* void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z ) */ +static void +android_glVertexAttrib3f__IFFF + (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z) { + glVertexAttrib3f( + (GLuint)indx, + (GLfloat)x, + (GLfloat)y, + (GLfloat)z + ); +} + +/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */ +static void +android_glVertexAttrib3fv__I_3FI + (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) { + GLfloat *values_base = (GLfloat *) 0; + jint _remaining; + GLfloat *values = (GLfloat *) 0; + + if (!values_ref) { + _env->ThrowNew(IAEClass, "values == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(values_ref) - offset; + values_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0); + values = values_base + offset; + + glVertexAttrib3fv( + (GLuint)indx, + (GLfloat *)values + ); + +exit: + if (values_base) { + _env->ReleasePrimitiveArrayCritical(values_ref, values_base, + JNI_ABORT); + } +} + +/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */ +static void +android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *values = (GLfloat *) 0; + + values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining); + glVertexAttrib3fv( + (GLuint)indx, + (GLfloat *)values + ); + if (_array) { + releasePointer(_env, _array, values, JNI_FALSE); + } +} + +/* void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */ +static void +android_glVertexAttrib4f__IFFFF + (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z, jfloat w) { + glVertexAttrib4f( + (GLuint)indx, + (GLfloat)x, + (GLfloat)y, + (GLfloat)z, + (GLfloat)w + ); +} + +/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */ +static void +android_glVertexAttrib4fv__I_3FI + (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) { + GLfloat *values_base = (GLfloat *) 0; + jint _remaining; + GLfloat *values = (GLfloat *) 0; + + if (!values_ref) { + _env->ThrowNew(IAEClass, "values == null"); + goto exit; + } + if (offset < 0) { + _env->ThrowNew(IAEClass, "offset < 0"); + goto exit; + } + _remaining = _env->GetArrayLength(values_ref) - offset; + values_base = (GLfloat *) + _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0); + values = values_base + offset; + + glVertexAttrib4fv( + (GLuint)indx, + (GLfloat *)values + ); + +exit: + if (values_base) { + _env->ReleasePrimitiveArrayCritical(values_ref, values_base, + JNI_ABORT); + } +} + +/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */ +static void +android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 + (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) { + jarray _array = (jarray) 0; + jint _remaining; + GLfloat *values = (GLfloat *) 0; + + values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining); + glVertexAttrib4fv( + (GLuint)indx, + (GLfloat *)values + ); + if (_array) { + releasePointer(_env, _array, values, JNI_FALSE); + } +} + +/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr ) */ +static void +android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I + (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jobject ptr_buf, jint remaining) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *ptr = (GLvoid *) 0; + + if (ptr_buf) { + ptr = (GLvoid *) getDirectBufferPointer(_env, ptr_buf); + if ( ! ptr ) { + return; + } + } + glVertexAttribPointerBounds( + (GLuint)indx, + (GLint)size, + (GLenum)type, + (GLboolean)normalized, + (GLsizei)stride, + (GLvoid *)ptr, + (GLsizei)remaining + ); +} + +/* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */ +static void +android_glViewport__IIII + (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) { + glViewport( + (GLint)x, + (GLint)y, + (GLsizei)width, + (GLsizei)height + ); +} + +static const char *classPathName = "android/opengl/GLES20"; + +static JNINativeMethod methods[] = { +{"_nativeClassInit", "()V", (void*)nativeClassInit }, +{"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I }, +{"glAttachShader", "(II)V", (void *) android_glAttachShader__II }, +{"glBindAttribLocation", "(IILjava/lang/String;)V", (void *) android_glBindAttribLocation__IILjava_lang_String_2 }, +{"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II }, +{"glBindFramebuffer", "(II)V", (void *) android_glBindFramebuffer__II }, +{"glBindRenderbuffer", "(II)V", (void *) android_glBindRenderbuffer__II }, +{"glBindTexture", "(II)V", (void *) android_glBindTexture__II }, +{"glBlendColor", "(FFFF)V", (void *) android_glBlendColor__FFFF }, +{"glBlendEquation", "(I)V", (void *) android_glBlendEquation__I }, +{"glBlendEquationSeparate", "(II)V", (void *) android_glBlendEquationSeparate__II }, +{"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II }, +{"glBlendFuncSeparate", "(IIII)V", (void *) android_glBlendFuncSeparate__IIII }, +{"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I }, +{"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 }, +{"glCheckFramebufferStatus", "(I)I", (void *) android_glCheckFramebufferStatus__I }, +{"glClear", "(I)V", (void *) android_glClear__I }, +{"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF }, +{"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F }, +{"glClearStencil", "(I)V", (void *) android_glClearStencil__I }, +{"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ }, +{"glCompileShader", "(I)V", (void *) android_glCompileShader__I }, +{"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 }, +{"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 }, +{"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII }, +{"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII }, +{"glCreateProgram", "()I", (void *) android_glCreateProgram__ }, +{"glCreateShader", "(I)I", (void *) android_glCreateShader__I }, +{"glCullFace", "(I)V", (void *) android_glCullFace__I }, +{"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II }, +{"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 }, +{"glDeleteFramebuffers", "(I[II)V", (void *) android_glDeleteFramebuffers__I_3II }, +{"glDeleteFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2 }, +{"glDeleteProgram", "(I)V", (void *) android_glDeleteProgram__I }, +{"glDeleteRenderbuffers", "(I[II)V", (void *) android_glDeleteRenderbuffers__I_3II }, +{"glDeleteRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2 }, +{"glDeleteShader", "(I)V", (void *) android_glDeleteShader__I }, +{"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II }, +{"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 }, +{"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I }, +{"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z }, +{"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF }, +{"glDetachShader", "(II)V", (void *) android_glDetachShader__II }, +{"glDisable", "(I)V", (void *) android_glDisable__I }, +{"glDisableVertexAttribArray", "(I)V", (void *) android_glDisableVertexAttribArray__I }, +{"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III }, +{"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 }, +{"glEnable", "(I)V", (void *) android_glEnable__I }, +{"glEnableVertexAttribArray", "(I)V", (void *) android_glEnableVertexAttribArray__I }, +{"glFinish", "()V", (void *) android_glFinish__ }, +{"glFlush", "()V", (void *) android_glFlush__ }, +{"glFramebufferRenderbuffer", "(IIII)V", (void *) android_glFramebufferRenderbuffer__IIII }, +{"glFramebufferTexture2D", "(IIIII)V", (void *) android_glFramebufferTexture2D__IIIII }, +{"glFrontFace", "(I)V", (void *) android_glFrontFace__I }, +{"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II }, +{"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 }, +{"glGenerateMipmap", "(I)V", (void *) android_glGenerateMipmap__I }, +{"glGenFramebuffers", "(I[II)V", (void *) android_glGenFramebuffers__I_3II }, +{"glGenFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenFramebuffers__ILjava_nio_IntBuffer_2 }, +{"glGenRenderbuffers", "(I[II)V", (void *) android_glGenRenderbuffers__I_3II }, +{"glGenRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenRenderbuffers__ILjava_nio_IntBuffer_2 }, +{"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II }, +{"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 }, +{"glGetActiveAttrib", "(III[II[II[II[BI)V", (void *) android_glGetActiveAttrib__III_3II_3II_3II_3BI }, +{"glGetActiveAttrib", "(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V", (void *) android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B }, +{"glGetActiveUniform", "(III[II[II[II[BI)V", (void *) android_glGetActiveUniform__III_3II_3II_3II_3BI }, +{"glGetActiveUniform", "(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V", (void *) android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B }, +{"glGetAttachedShaders", "(II[II[II)V", (void *) android_glGetAttachedShaders__II_3II_3II }, +{"glGetAttachedShaders", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 }, +{"glGetAttribLocation", "(ILjava/lang/String;)I", (void *) android_glGetAttribLocation__ILjava_lang_String_2 }, +{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI }, +{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 }, +{"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II }, +{"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 }, +{"glGetError", "()I", (void *) android_glGetError__ }, +{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI }, +{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 }, +{"glGetFramebufferAttachmentParameteriv", "(III[II)V", (void *) android_glGetFramebufferAttachmentParameteriv__III_3II }, +{"glGetFramebufferAttachmentParameteriv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 }, +{"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II }, +{"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 }, +{"glGetProgramiv", "(II[II)V", (void *) android_glGetProgramiv__II_3II }, +{"glGetProgramiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetProgramiv__IILjava_nio_IntBuffer_2 }, +{"glGetProgramInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetProgramInfoLog }, +{"glGetRenderbufferParameteriv", "(II[II)V", (void *) android_glGetRenderbufferParameteriv__II_3II }, +{"glGetRenderbufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2 }, +{"glGetShaderiv", "(II[II)V", (void *) android_glGetShaderiv__II_3II }, +{"glGetShaderiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetShaderiv__IILjava_nio_IntBuffer_2 }, +{"glGetShaderInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetShaderInfoLog }, +{"glGetShaderPrecisionFormat", "(II[II[II)V", (void *) android_glGetShaderPrecisionFormat__II_3II_3II }, +{"glGetShaderPrecisionFormat", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 }, +{"glGetShaderSource", "(II[II[BI)V", (void *) android_glGetShaderSource__II_3II_3BI }, +{"glGetShaderSource", "(IILjava/nio/IntBuffer;B)V", (void *) android_glGetShaderSource__IILjava_nio_IntBuffer_2B }, +{"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString }, +{"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI }, +{"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 }, +{"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II }, +{"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 }, +{"glGetUniformfv", "(II[FI)V", (void *) android_glGetUniformfv__II_3FI }, +{"glGetUniformfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetUniformfv__IILjava_nio_FloatBuffer_2 }, +{"glGetUniformiv", "(II[II)V", (void *) android_glGetUniformiv__II_3II }, +{"glGetUniformiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetUniformiv__IILjava_nio_IntBuffer_2 }, +{"glGetUniformLocation", "(ILjava/lang/String;)I", (void *) android_glGetUniformLocation__ILjava_lang_String_2 }, +{"glGetVertexAttribfv", "(II[FI)V", (void *) android_glGetVertexAttribfv__II_3FI }, +{"glGetVertexAttribfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2 }, +{"glGetVertexAttribiv", "(II[II)V", (void *) android_glGetVertexAttribiv__II_3II }, +{"glGetVertexAttribiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2 }, +{"glHint", "(II)V", (void *) android_glHint__II }, +{"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I }, +{"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I }, +{"glIsFramebuffer", "(I)Z", (void *) android_glIsFramebuffer__I }, +{"glIsProgram", "(I)Z", (void *) android_glIsProgram__I }, +{"glIsRenderbuffer", "(I)Z", (void *) android_glIsRenderbuffer__I }, +{"glIsShader", "(I)Z", (void *) android_glIsShader__I }, +{"glIsTexture", "(I)Z", (void *) android_glIsTexture__I }, +{"glLineWidth", "(F)V", (void *) android_glLineWidth__F }, +{"glLinkProgram", "(I)V", (void *) android_glLinkProgram__I }, +{"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II }, +{"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF }, +{"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 }, +{"glReleaseShaderCompiler", "()V", (void *) android_glReleaseShaderCompiler__ }, +{"glRenderbufferStorage", "(IIII)V", (void *) android_glRenderbufferStorage__IIII }, +{"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ }, +{"glScissor", "(IIII)V", (void *) android_glScissor__IIII }, +{"glShaderBinary", "(I[IIILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__I_3IIILjava_nio_Buffer_2I }, +{"glShaderBinary", "(ILjava/nio/IntBuffer;ILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I }, +{"glShaderSource", "(ILjava/lang/String;)V", (void *) android_glShaderSource }, +{"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III }, +{"glStencilFuncSeparate", "(IIII)V", (void *) android_glStencilFuncSeparate__IIII }, +{"glStencilMask", "(I)V", (void *) android_glStencilMask__I }, +{"glStencilMaskSeparate", "(II)V", (void *) android_glStencilMaskSeparate__II }, +{"glStencilOp", "(III)V", (void *) android_glStencilOp__III }, +{"glStencilOpSeparate", "(IIII)V", (void *) android_glStencilOpSeparate__IIII }, +{"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 }, +{"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF }, +{"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI }, +{"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 }, +{"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III }, +{"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II }, +{"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 }, +{"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 }, +{"glUniform1f", "(IF)V", (void *) android_glUniform1f__IF }, +{"glUniform1fv", "(II[FI)V", (void *) android_glUniform1fv__II_3FI }, +{"glUniform1fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform1fv__IILjava_nio_FloatBuffer_2 }, +{"glUniform1i", "(II)V", (void *) android_glUniform1i__II }, +{"glUniform1iv", "(II[II)V", (void *) android_glUniform1iv__II_3II }, +{"glUniform1iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform1iv__IILjava_nio_IntBuffer_2 }, +{"glUniform2f", "(IFF)V", (void *) android_glUniform2f__IFF }, +{"glUniform2fv", "(II[FI)V", (void *) android_glUniform2fv__II_3FI }, +{"glUniform2fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform2fv__IILjava_nio_FloatBuffer_2 }, +{"glUniform2i", "(III)V", (void *) android_glUniform2i__III }, +{"glUniform2iv", "(II[II)V", (void *) android_glUniform2iv__II_3II }, +{"glUniform2iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform2iv__IILjava_nio_IntBuffer_2 }, +{"glUniform3f", "(IFFF)V", (void *) android_glUniform3f__IFFF }, +{"glUniform3fv", "(II[FI)V", (void *) android_glUniform3fv__II_3FI }, +{"glUniform3fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform3fv__IILjava_nio_FloatBuffer_2 }, +{"glUniform3i", "(IIII)V", (void *) android_glUniform3i__IIII }, +{"glUniform3iv", "(II[II)V", (void *) android_glUniform3iv__II_3II }, +{"glUniform3iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform3iv__IILjava_nio_IntBuffer_2 }, +{"glUniform4f", "(IFFFF)V", (void *) android_glUniform4f__IFFFF }, +{"glUniform4fv", "(II[FI)V", (void *) android_glUniform4fv__II_3FI }, +{"glUniform4fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform4fv__IILjava_nio_FloatBuffer_2 }, +{"glUniform4i", "(IIIII)V", (void *) android_glUniform4i__IIIII }, +{"glUniform4iv", "(II[II)V", (void *) android_glUniform4iv__II_3II }, +{"glUniform4iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform4iv__IILjava_nio_IntBuffer_2 }, +{"glUniformMatrix2fv", "(IIZ[FI)V", (void *) android_glUniformMatrix2fv__IIZ_3FI }, +{"glUniformMatrix2fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 }, +{"glUniformMatrix3fv", "(IIZ[FI)V", (void *) android_glUniformMatrix3fv__IIZ_3FI }, +{"glUniformMatrix3fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 }, +{"glUniformMatrix4fv", "(IIZ[FI)V", (void *) android_glUniformMatrix4fv__IIZ_3FI }, +{"glUniformMatrix4fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2 }, +{"glUseProgram", "(I)V", (void *) android_glUseProgram__I }, +{"glValidateProgram", "(I)V", (void *) android_glValidateProgram__I }, +{"glVertexAttrib1f", "(IF)V", (void *) android_glVertexAttrib1f__IF }, +{"glVertexAttrib1fv", "(I[FI)V", (void *) android_glVertexAttrib1fv__I_3FI }, +{"glVertexAttrib1fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2 }, +{"glVertexAttrib2f", "(IFF)V", (void *) android_glVertexAttrib2f__IFF }, +{"glVertexAttrib2fv", "(I[FI)V", (void *) android_glVertexAttrib2fv__I_3FI }, +{"glVertexAttrib2fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2 }, +{"glVertexAttrib3f", "(IFFF)V", (void *) android_glVertexAttrib3f__IFFF }, +{"glVertexAttrib3fv", "(I[FI)V", (void *) android_glVertexAttrib3fv__I_3FI }, +{"glVertexAttrib3fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2 }, +{"glVertexAttrib4f", "(IFFFF)V", (void *) android_glVertexAttrib4f__IFFFF }, +{"glVertexAttrib4fv", "(I[FI)V", (void *) android_glVertexAttrib4fv__I_3FI }, +{"glVertexAttrib4fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 }, +{"glVertexAttribPointerBounds", "(IIIZILjava/nio/Buffer;I)V", (void *) android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I }, +{"glViewport", "(IIII)V", (void *) android_glViewport__IIII }, +}; + +int register_android_opengl_jni_GLES20(JNIEnv *_env) +{ + int err; + err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods)); + return err; +} diff --git a/core/jni/android_os_Hardware.cpp b/core/jni/android_os_Hardware.cpp deleted file mode 100644 index 8007662..0000000 --- a/core/jni/android_os_Hardware.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2006, 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. -*/ - -#include <hardware_legacy/flashlight.h> -#include <hardware_legacy/power.h> - -#include <nativehelper/jni.h> -#include <android_runtime/AndroidRuntime.h> -#include <nativehelper/JNIHelp.h> - -namespace android { - -static jint -getFlashlightEnabled(JNIEnv *env, jobject clazz) -{ - return get_flashlight_enabled(); -} - -static void -setFlashlightEnabled(JNIEnv *env, jobject clazz, jboolean on) -{ - set_flashlight_enabled(on); -} - -static void -enableCameraFlash(JNIEnv *env, jobject clazz, jint milliseconds) -{ - enable_camera_flash(milliseconds); -} - -// ============================================================================ -/* - * JNI registration. - */ - -static JNINativeMethod g_methods[] = { - /* name, signature, funcPtr */ - { "getFlashlightEnabled", "()Z", (void*)getFlashlightEnabled }, - { "setFlashlightEnabled", "(Z)V", (void*)setFlashlightEnabled }, - { "enableCameraFlash", "(I)V", (void*)enableCameraFlash }, -}; - -int register_android_os_Hardware(JNIEnv* env) -{ - return AndroidRuntime::registerNativeMethods(env, - "android/os/Hardware", g_methods, NELEM(g_methods)); -} - -}; // namespace android diff --git a/core/jni/android_os_MemoryFile.cpp b/core/jni/android_os_MemoryFile.cpp index 1ae3ec7..ee8d836 100644 --- a/core/jni/android_os_MemoryFile.cpp +++ b/core/jni/android_os_MemoryFile.cpp @@ -30,8 +30,6 @@ static jobject android_os_MemoryFile_open(JNIEnv* env, jobject clazz, jstring na { const char* namestr = (name ? env->GetStringUTFChars(name, NULL) : NULL); - // round up length to page boundary - length = (((length - 1) / getpagesize()) + 1) * getpagesize(); int result = ashmem_create_region(namestr, length); if (name) @@ -118,7 +116,7 @@ static void android_os_MemoryFile_pin(JNIEnv* env, jobject clazz, jobject fileDe } } -static jint android_os_MemoryFile_get_mapped_size(JNIEnv* env, jobject clazz, +static jint android_os_MemoryFile_get_size(JNIEnv* env, jobject clazz, jobject fileDescriptor) { int fd = jniGetFDFromFileDescriptor(env, fileDescriptor); // Use ASHMEM_GET_SIZE to find out if the fd refers to an ashmem region. @@ -146,8 +144,8 @@ static const JNINativeMethod methods[] = { {"native_read", "(Ljava/io/FileDescriptor;I[BIIIZ)I", (void*)android_os_MemoryFile_read}, {"native_write", "(Ljava/io/FileDescriptor;I[BIIIZ)V", (void*)android_os_MemoryFile_write}, {"native_pin", "(Ljava/io/FileDescriptor;Z)V", (void*)android_os_MemoryFile_pin}, - {"native_get_mapped_size", "(Ljava/io/FileDescriptor;)I", - (void*)android_os_MemoryFile_get_mapped_size} + {"native_get_size", "(Ljava/io/FileDescriptor;)I", + (void*)android_os_MemoryFile_get_size} }; static const char* const kClassPathName = "android/os/MemoryFile"; diff --git a/core/jni/android_server_BluetoothA2dpService.cpp b/core/jni/android_server_BluetoothA2dpService.cpp index 7a3bbbb..4eab4b3 100644 --- a/core/jni/android_server_BluetoothA2dpService.cpp +++ b/core/jni/android_server_BluetoothA2dpService.cpp @@ -38,6 +38,7 @@ namespace android { #ifdef HAVE_BLUETOOTH static jmethodID method_onSinkPropertyChanged; +static jmethodID method_onConnectSinkResult; typedef struct { JavaVM *vm; @@ -47,6 +48,7 @@ typedef struct { } native_data_t; static native_data_t *nat = NULL; // global native data +static void onConnectSinkResult(DBusMessage *msg, void *user, void *n); static Properties sink_properties[] = { {"State", DBUS_TYPE_STRING}, @@ -133,9 +135,12 @@ static jboolean connectSinkNative(JNIEnv *env, jobject object, jstring path) { LOGV(__FUNCTION__); if (nat) { const char *c_path = env->GetStringUTFChars(path, NULL); + int len = env->GetStringLength(path) + 1; + char *context_path = (char *)calloc(len, sizeof(char)); + strlcpy(context_path, c_path, len); // for callback - bool ret = dbus_func_args_async(env, nat->conn, -1, NULL, NULL, nat, - c_path, "org.bluez.AudioSink", "Connect", + bool ret = dbus_func_args_async(env, nat->conn, -1, onConnectSinkResult, context_path, + nat, c_path, "org.bluez.AudioSink", "Connect", DBUS_TYPE_INVALID); env->ReleaseStringUTFChars(path, c_path); @@ -237,6 +242,31 @@ DBusHandlerResult a2dp_event_filter(DBusMessage *msg, JNIEnv *env) { return result; } + +void onConnectSinkResult(DBusMessage *msg, void *user, void *n) { + LOGV(__FUNCTION__); + + native_data_t *nat = (native_data_t *)n; + const char *path = (const char *)user; + DBusError err; + dbus_error_init(&err); + JNIEnv *env; + nat->vm->GetEnv((void**)&env, nat->envVer); + + + bool result = JNI_TRUE; + if (dbus_set_error_from_message(&err, msg)) { + LOG_AND_FREE_DBUS_ERROR(&err); + result = JNI_FALSE; + } + LOGV("... Device Path = %s, result = %d", path, result); + env->CallVoidMethod(nat->me, + method_onConnectSinkResult, + env->NewStringUTF(path), + result); + free(user); +} + #endif @@ -244,7 +274,7 @@ static JNINativeMethod sMethods[] = { {"initNative", "()Z", (void *)initNative}, {"cleanupNative", "()V", (void *)cleanupNative}, - /* Bluez audio 4.40 API */ + /* Bluez audio 4.47 API */ {"connectSinkNative", "(Ljava/lang/String;)Z", (void *)connectSinkNative}, {"disconnectSinkNative", "(Ljava/lang/String;)Z", (void *)disconnectSinkNative}, {"suspendSinkNative", "(Ljava/lang/String;)Z", (void*)suspendSinkNative}, @@ -263,6 +293,8 @@ int register_android_server_BluetoothA2dpService(JNIEnv *env) { #ifdef HAVE_BLUETOOTH method_onSinkPropertyChanged = env->GetMethodID(clazz, "onSinkPropertyChanged", "(Ljava/lang/String;[Ljava/lang/String;)V"); + method_onConnectSinkResult = env->GetMethodID(clazz, "onConnectSinkResult", + "(Ljava/lang/String;Z)V"); #endif return AndroidRuntime::registerNativeMethods(env, diff --git a/core/jni/android_util_AssetManager.cpp b/core/jni/android_util_AssetManager.cpp index e83d2e2..2fff727 100644 --- a/core/jni/android_util_AssetManager.cpp +++ b/core/jni/android_util_AssetManager.cpp @@ -524,7 +524,6 @@ static jobjectArray android_content_AssetManager_getLocales(JNIEnv* env, jobject } for (int i=0; i<N; i++) { - LOGD("locale %2d: '%s'", i, locales[i].string()); env->SetObjectArrayElement(result, i, env->NewStringUTF(locales[i].string())); } diff --git a/core/jni/android_util_Binder.cpp b/core/jni/android_util_Binder.cpp index f0885fd..627fcbf 100644 --- a/core/jni/android_util_Binder.cpp +++ b/core/jni/android_util_Binder.cpp @@ -670,6 +670,12 @@ static void android_os_BinderInternal_joinThreadPool(JNIEnv* env, jobject clazz) android::IPCThreadState::self()->joinThreadPool(); } +static void android_os_BinderInternal_disableBackgroundScheduling(JNIEnv* env, + jobject clazz, jboolean disable) +{ + IPCThreadState::disableBackgroundScheduling(disable ? true : false); +} + static void android_os_BinderInternal_handleGc(JNIEnv* env, jobject clazz) { LOGV("Gc has executed, clearing binder ops"); @@ -682,6 +688,7 @@ static const JNINativeMethod gBinderInternalMethods[] = { /* name, signature, funcPtr */ { "getContextObject", "()Landroid/os/IBinder;", (void*)android_os_BinderInternal_getContextObject }, { "joinThreadPool", "()V", (void*)android_os_BinderInternal_joinThreadPool }, + { "disableBackgroundScheduling", "(Z)V", (void*)android_os_BinderInternal_disableBackgroundScheduling }, { "handleGc", "()V", (void*)android_os_BinderInternal_handleGc } }; diff --git a/core/jni/android_util_EventLog.cpp b/core/jni/android_util_EventLog.cpp index 34b7c89..75f6cb2 100644 --- a/core/jni/android_util_EventLog.cpp +++ b/core/jni/android_util_EventLog.cpp @@ -21,12 +21,8 @@ #include "jni.h" #include "cutils/logger.h" -#define END_DELIMITER '\n' -#define INT_BUFFER_SIZE (sizeof(jbyte)+sizeof(jint)+sizeof(END_DELIMITER)) -#define LONG_BUFFER_SIZE (sizeof(jbyte)+sizeof(jlong)+sizeof(END_DELIMITER)) -#define INITAL_BUFFER_CAPACITY 256 - -#define MAX(a,b) ((a>b)?a:b) +// The size of the tag number comes out of the payload size. +#define MAX_EVENT_PAYLOAD (LOGGER_ENTRY_MAX_PAYLOAD - sizeof(int32_t)) namespace android { @@ -47,107 +43,6 @@ static jfieldID gLongValueID; static jclass gStringClass; -struct ByteBuf { - size_t len; - size_t capacity; - uint8_t* buf; - - ByteBuf(size_t initSize) { - buf = (uint8_t*)malloc(initSize); - len = 0; - capacity = initSize; - } - - ~ByteBuf() { - free(buf); - } - - bool ensureExtraCapacity(size_t extra) { - size_t spaceNeeded = len + extra; - if (spaceNeeded > capacity) { - size_t newCapacity = MAX(spaceNeeded, 2 * capacity); - void* newBuf = realloc(buf, newCapacity); - if (newBuf == NULL) { - return false; - } - capacity = newCapacity; - buf = (uint8_t*)newBuf; - return true; - } else { - return true; - } - } - - void putIntEvent(jint value) { - bool succeeded = ensureExtraCapacity(INT_BUFFER_SIZE); - buf[len++] = EVENT_TYPE_INT; - memcpy(buf+len, &value, sizeof(jint)); - len += sizeof(jint); - } - - void putByte(uint8_t value) { - bool succeeded = ensureExtraCapacity(sizeof(uint8_t)); - buf[len++] = value; - } - - void putLongEvent(jlong value) { - bool succeeded = ensureExtraCapacity(LONG_BUFFER_SIZE); - buf[len++] = EVENT_TYPE_LONG; - memcpy(buf+len, &value, sizeof(jlong)); - len += sizeof(jlong); - } - - - void putStringEvent(JNIEnv* env, jstring value) { - const char* strValue = env->GetStringUTFChars(value, NULL); - uint32_t strLen = strlen(strValue); //env->GetStringUTFLength(value); - bool succeeded = ensureExtraCapacity(1 + sizeof(uint32_t) + strLen); - buf[len++] = EVENT_TYPE_STRING; - memcpy(buf+len, &strLen, sizeof(uint32_t)); - len += sizeof(uint32_t); - memcpy(buf+len, strValue, strLen); - env->ReleaseStringUTFChars(value, strValue); - len += strLen; - } - - void putList(JNIEnv* env, jobject list) { - jobjectArray items = (jobjectArray) env->GetObjectField(list, gListItemsID); - if (items == NULL) { - jniThrowException(env, "java/lang/NullPointerException", NULL); - return; - } - - jsize numItems = env->GetArrayLength(items); - putByte(EVENT_TYPE_LIST); - putByte(numItems); - // We'd like to call GetPrimitveArrayCritical() but that might - // not be safe since we're going to be doing some I/O - for (int i = 0; i < numItems; i++) { - jobject item = env->GetObjectArrayElement(items, i); - if (env->IsInstanceOf(item, gIntegerClass)) { - jint intVal = env->GetIntField(item, gIntegerValueID); - putIntEvent(intVal); - } else if (env->IsInstanceOf(item, gLongClass)) { - jlong longVal = env->GetLongField(item, gLongValueID); - putLongEvent(longVal); - } else if (env->IsInstanceOf(item, gStringClass)) { - putStringEvent(env, (jstring)item); - } else if (env->IsInstanceOf(item, gListClass)) { - putList(env, item); - } else { - jniThrowException( - env, - "java/lang/IllegalArgumentException", - "Attempt to log an illegal item type."); - return; - } - env->DeleteLocalRef(item); - } - - env->DeleteLocalRef(items); - } -}; - /* * In class android.util.EventLog: * static native int writeEvent(int tag, int value) @@ -170,41 +65,80 @@ static jint android_util_EventLog_writeEvent_Long(JNIEnv* env, jobject clazz, /* * In class android.util.EventLog: - * static native int writeEvent(long tag, List value) + * static native int writeEvent(int tag, String value) */ -static jint android_util_EventLog_writeEvent_List(JNIEnv* env, jobject clazz, - jint tag, jobject value) { - if (value == NULL) { - jclass clazz = env->FindClass("java/lang/IllegalArgumentException"); - env->ThrowNew(clazz, "writeEvent needs a value."); - return -1; - } - ByteBuf byteBuf(INITAL_BUFFER_CAPACITY); - byteBuf.putList(env, value); - byteBuf.putByte((uint8_t)END_DELIMITER); - int numBytesPut = byteBuf.len; - int bytesWritten = android_bWriteLog(tag, byteBuf.buf, numBytesPut); - return bytesWritten; +static jint android_util_EventLog_writeEvent_String(JNIEnv* env, jobject clazz, + jint tag, jstring value) { + uint8_t buf[MAX_EVENT_PAYLOAD]; + + // Don't throw NPE -- I feel like it's sort of mean for a logging function + // to be all crashy if you pass in NULL -- but make the NULL value explicit. + const char *str = value != NULL ? env->GetStringUTFChars(value, NULL) : "NULL"; + jint len = strlen(str); + const int max = sizeof(buf) - sizeof(len) - 2; // Type byte, final newline + if (len > max) len = max; + + buf[0] = EVENT_TYPE_STRING; + memcpy(&buf[1], &len, sizeof(len)); + memcpy(&buf[1 + sizeof(len)], str, len); + buf[1 + sizeof(len) + len] = '\n'; + + if (value != NULL) env->ReleaseStringUTFChars(value, str); + return android_bWriteLog(tag, buf, 2 + sizeof(len) + len); } /* * In class android.util.EventLog: - * static native int writeEvent(int tag, String value) + * static native int writeEvent(long tag, Object... value) */ -static jint android_util_EventLog_writeEvent_String(JNIEnv* env, jobject clazz, - jint tag, jstring value) { +static jint android_util_EventLog_writeEvent_Array(JNIEnv* env, jobject clazz, + jint tag, jobjectArray value) { if (value == NULL) { - jclass clazz = env->FindClass("java/lang/IllegalArgumentException"); - env->ThrowNew(clazz, "logEvent needs a value."); - return -1; + return android_util_EventLog_writeEvent_String(env, clazz, tag, NULL); + } + + uint8_t buf[MAX_EVENT_PAYLOAD]; + const size_t max = sizeof(buf) - 1; // leave room for final newline + size_t pos = 2; // Save room for type tag & array count + + jsize copied = 0, num = env->GetArrayLength(value); + for (; copied < num && copied < 255; ++copied) { + jobject item = env->GetObjectArrayElement(value, copied); + if (item == NULL || env->IsInstanceOf(item, gStringClass)) { + if (pos + 1 + sizeof(jint) > max) break; + const char *str = item != NULL ? env->GetStringUTFChars((jstring) item, NULL) : "NULL"; + jint len = strlen(str); + if (pos + 1 + sizeof(len) + len > max) len = max - pos - 1 - sizeof(len); + buf[pos++] = EVENT_TYPE_STRING; + memcpy(&buf[pos], &len, sizeof(len)); + memcpy(&buf[pos + sizeof(len)], str, len); + pos += sizeof(len) + len; + if (item != NULL) env->ReleaseStringUTFChars((jstring) item, str); + } else if (env->IsInstanceOf(item, gIntegerClass)) { + jint intVal = env->GetIntField(item, gIntegerValueID); + if (pos + 1 + sizeof(intVal) > max) break; + buf[pos++] = EVENT_TYPE_INT; + memcpy(&buf[pos], &intVal, sizeof(intVal)); + pos += sizeof(intVal); + } else if (env->IsInstanceOf(item, gLongClass)) { + jlong longVal = env->GetLongField(item, gLongValueID); + if (pos + 1 + sizeof(longVal) > max) break; + buf[pos++] = EVENT_TYPE_LONG; + memcpy(&buf[pos], &longVal, sizeof(longVal)); + pos += sizeof(longVal); + } else { + jniThrowException(env, + "java/lang/IllegalArgumentException", + "Invalid payload item type"); + return -1; + } + env->DeleteLocalRef(item); } - ByteBuf byteBuf(INITAL_BUFFER_CAPACITY); - byteBuf.putStringEvent(env, value); - byteBuf.putByte((uint8_t)END_DELIMITER); - int numBytesPut = byteBuf.len; - int bytesWritten = android_bWriteLog(tag, byteBuf.buf, numBytesPut); - return bytesWritten; + buf[0] = EVENT_TYPE_LIST; + buf[1] = copied; + buf[pos++] = '\n'; + return android_bWriteLog(tag, buf, pos); } /* @@ -276,81 +210,6 @@ static void android_util_EventLog_readEvents(JNIEnv* env, jobject clazz, } /* - * In class android.util.EventLog: - * static native void readEvents(String path, Collection<Event> output) - * - * Reads events from a file (See Checkin.Aggregation). Events are stored in - * native raw format (logger_entry + payload). - */ -static void android_util_EventLog_readEventsFile(JNIEnv* env, jobject clazz, jstring path, - jobject out) { - if (path == NULL || out == NULL) { - jniThrowException(env, "java/lang/NullPointerException", NULL); - return; - } - - const char *pathString = env->GetStringUTFChars(path, 0); - int fd = open(pathString, O_RDONLY | O_NONBLOCK); - env->ReleaseStringUTFChars(path, pathString); - - if (fd < 0) { - jniThrowIOException(env, errno); - return; - } - - uint8_t buf[LOGGER_ENTRY_MAX_LEN]; - for (;;) { - // read log entry structure from file - int len = read(fd, buf, sizeof(logger_entry)); - if (len == 0) { - break; // end of file - } else if (len < 0) { - jniThrowIOException(env, errno); - } else if ((size_t) len < sizeof(logger_entry)) { - jniThrowException(env, "java/io/IOException", "Event header too short"); - break; - } - - // read event payload - logger_entry* entry = (logger_entry*) buf; - if (entry->len > LOGGER_ENTRY_MAX_PAYLOAD) { - jniThrowException(env, - "java/lang/IllegalArgumentException", - "Too much data for event payload. Corrupt file?"); - break; - } - - len = read(fd, buf + sizeof(logger_entry), entry->len); - if (len == 0) { - break; // end of file - } else if (len < 0) { - jniThrowIOException(env, errno); - } else if ((size_t) len < entry->len) { - jniThrowException(env, "java/io/IOException", "Event payload too short"); - break; - } - - // create EventLog$Event and add it to the collection - int buffer_size = sizeof(logger_entry) + entry->len; - jbyteArray array = env->NewByteArray(buffer_size); - if (array == NULL) break; - - jbyte *bytes = env->GetByteArrayElements(array, NULL); - memcpy(bytes, buf, buffer_size); - env->ReleaseByteArrayElements(array, bytes, 0); - - jobject event = env->NewObject(gEventClass, gEventInitID, array); - if (event == NULL) break; - - env->CallBooleanMethod(out, gCollectionAddID, event); - env->DeleteLocalRef(event); - env->DeleteLocalRef(array); - } - - close(fd); -} - -/* * JNI registration. */ static JNINativeMethod gRegisterMethods[] = { @@ -362,22 +221,17 @@ static JNINativeMethod gRegisterMethods[] = { (void*) android_util_EventLog_writeEvent_String }, { "writeEvent", - "(ILandroid/util/EventLog$List;)I", - (void*) android_util_EventLog_writeEvent_List + "(I[Ljava/lang/Object;)I", + (void*) android_util_EventLog_writeEvent_Array }, { "readEvents", "([ILjava/util/Collection;)V", (void*) android_util_EventLog_readEvents }, - { "readEvents", - "(Ljava/lang/String;Ljava/util/Collection;)V", - (void*) android_util_EventLog_readEventsFile - } }; static struct { const char *name; jclass *clazz; } gClasses[] = { { "android/util/EventLog$Event", &gEventClass }, - { "android/util/EventLog$List", &gListClass }, { "java/lang/Integer", &gIntegerClass }, { "java/lang/Long", &gLongClass }, { "java/lang/String", &gStringClass }, @@ -386,7 +240,6 @@ static struct { const char *name; jclass *clazz; } gClasses[] = { static struct { jclass *c; const char *name, *ft; jfieldID *id; } gFields[] = { { &gIntegerClass, "value", "I", &gIntegerValueID }, - { &gListClass, "mItems", "[Ljava/lang/Object;", &gListItemsID }, { &gLongClass, "value", "J", &gLongValueID }, }; @@ -430,4 +283,3 @@ int register_android_util_EventLog(JNIEnv* env) { } }; // namespace android - diff --git a/core/jni/android_util_Process.cpp b/core/jni/android_util_Process.cpp index 094b02d..e84f2e5 100644 --- a/core/jni/android_util_Process.cpp +++ b/core/jni/android_util_Process.cpp @@ -120,11 +120,7 @@ jint android_os_Process_myUid(JNIEnv* env, jobject clazz) jint android_os_Process_myTid(JNIEnv* env, jobject clazz) { -#ifdef HAVE_GETTID - return gettid(); -#else - return getpid(); -#endif + return androidGetTid(); } jint android_os_Process_getUidForName(JNIEnv* env, jobject clazz, jstring name) @@ -191,15 +187,11 @@ jint android_os_Process_getGidForName(JNIEnv* env, jobject clazz, jstring name) void android_os_Process_setThreadGroup(JNIEnv* env, jobject clazz, int pid, jint grp) { - if (grp > ANDROID_TGROUP_MAX || grp < 0) { - signalExceptionForGroupError(env, clazz, EINVAL); + int res = androidSetThreadSchedulingGroup(pid, grp); + if (res != NO_ERROR) { + signalExceptionForGroupError(env, clazz, res == BAD_VALUE ? EINVAL : errno); return; } - - if (set_sched_policy(pid, (grp == ANDROID_TGROUP_BG_NONINTERACT) ? - SP_BACKGROUND : SP_FOREGROUND)) { - signalExceptionForGroupError(env, clazz, errno); - } } void android_os_Process_setProcessGroup(JNIEnv* env, jobject clazz, int pid, jint grp) @@ -275,22 +267,15 @@ void android_os_Process_setProcessGroup(JNIEnv* env, jobject clazz, int pid, jin void android_os_Process_setThreadPriority(JNIEnv* env, jobject clazz, jint pid, jint pri) { - int rc = 0; - - if (pri >= ANDROID_PRIORITY_BACKGROUND) { - rc = set_sched_policy(pid, SP_BACKGROUND); - } else if (getpriority(PRIO_PROCESS, pid) >= ANDROID_PRIORITY_BACKGROUND) { - rc = set_sched_policy(pid, SP_FOREGROUND); - } - - if (rc) { - signalExceptionForGroupError(env, clazz, errno); - return; - } - - if (setpriority(PRIO_PROCESS, pid, pri) < 0) { - signalExceptionForPriorityError(env, clazz, errno); + int rc = androidSetThreadPriority(pid, pri); + if (rc != 0) { + if (rc == INVALID_OPERATION) { + signalExceptionForPriorityError(env, clazz, errno); + } else { + signalExceptionForGroupError(env, clazz, errno); + } } + //LOGI("Setting priority of %d: %d, getpriority returns %d\n", // pid, pri, getpriority(PRIO_PROCESS, pid)); } diff --git a/core/jni/com_google_android_gles_jni_GLImpl.cpp b/core/jni/com_google_android_gles_jni_GLImpl.cpp index 3e0aea5..93e4d2b 100644 --- a/core/jni/com_google_android_gles_jni_GLImpl.cpp +++ b/core/jni/com_google_android_gles_jni_GLImpl.cpp @@ -35,6 +35,12 @@ 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); } static int initialized = 0; @@ -5391,21 +5397,24 @@ exit: /* void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) */ static void -android_glPointSizePointerOES__IILjava_nio_Buffer_2 - (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf) { +android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I + (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) { jarray _array = (jarray) 0; jint _remaining; GLvoid *pointer = (GLvoid *) 0; - pointer = (GLvoid *)getPointer(_env, pointer_buf, &_array, &_remaining); - glPointSizePointerOES( + if (pointer_buf) { + pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf); + if ( ! pointer ) { + return; + } + } + glPointSizePointerOESBounds( (GLenum)type, (GLsizei)stride, - (GLvoid *)pointer + (GLvoid *)pointer, + (GLsizei)remaining ); - if (_array) { - releasePointer(_env, _array, pointer, JNI_FALSE); - } } /* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */ @@ -5754,8 +5763,9 @@ android_glVertexPointer__IIII static void android_glCurrentPaletteMatrixOES__I (JNIEnv *_env, jobject _this, jint matrixpaletteindex) { - _env->ThrowNew(UOEClass, - "glCurrentPaletteMatrixOES"); + glCurrentPaletteMatrixOES( + (GLuint)matrixpaletteindex + ); } /* void glDrawTexfOES ( GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height ) */ @@ -6050,40 +6060,77 @@ exit: static void android_glLoadPaletteFromModelViewMatrixOES__ (JNIEnv *_env, jobject _this) { - _env->ThrowNew(UOEClass, - "glLoadPaletteFromModelViewMatrixOES"); + glLoadPaletteFromModelViewMatrixOES(); } /* void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */ static void -android_glMatrixIndexPointerOES__IIILjava_nio_Buffer_2 - (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf) { - _env->ThrowNew(UOEClass, - "glMatrixIndexPointerOES"); +android_glMatrixIndexPointerOESBounds__IIILjava_nio_Buffer_2I + (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *pointer = (GLvoid *) 0; + + if (pointer_buf) { + pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf); + if ( ! pointer ) { + return; + } + } + glMatrixIndexPointerOESBounds( + (GLint)size, + (GLenum)type, + (GLsizei)stride, + (GLvoid *)pointer, + (GLsizei)remaining + ); } /* void glMatrixIndexPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset ) */ static void android_glMatrixIndexPointerOES__IIII (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) { - _env->ThrowNew(UOEClass, - "glMatrixIndexPointerOES"); + glMatrixIndexPointerOES( + (GLint)size, + (GLenum)type, + (GLsizei)stride, + (const GLvoid *)offset + ); } /* void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */ static void -android_glWeightPointerOES__IIILjava_nio_Buffer_2 - (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf) { - _env->ThrowNew(UOEClass, - "glWeightPointerOES"); +android_glWeightPointerOESBounds__IIILjava_nio_Buffer_2I + (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) { + jarray _array = (jarray) 0; + jint _remaining; + GLvoid *pointer = (GLvoid *) 0; + + if (pointer_buf) { + pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf); + if ( ! pointer ) { + return; + } + } + glWeightPointerOESBounds( + (GLint)size, + (GLenum)type, + (GLsizei)stride, + (GLvoid *)pointer, + (GLsizei)remaining + ); } /* void glWeightPointerOES ( GLint size, GLenum type, GLsizei stride, GLint offset ) */ static void android_glWeightPointerOES__IIII (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) { - _env->ThrowNew(UOEClass, - "glWeightPointerOES"); + glWeightPointerOES( + (GLint)size, + (GLenum)type, + (GLsizei)stride, + (const GLvoid *)offset + ); } /* void glBindFramebufferOES ( GLint target, GLint framebuffer ) */ @@ -6584,7 +6631,7 @@ static JNINativeMethod methods[] = { {"glPointParameterx", "(II)V", (void *) android_glPointParameterx__II }, {"glPointParameterxv", "(I[II)V", (void *) android_glPointParameterxv__I_3II }, {"glPointParameterxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glPointParameterxv__ILjava_nio_IntBuffer_2 }, -{"glPointSizePointerOES", "(IILjava/nio/Buffer;)V", (void *) android_glPointSizePointerOES__IILjava_nio_Buffer_2 }, +{"glPointSizePointerOESBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I }, {"glTexCoordPointer", "(IIII)V", (void *) android_glTexCoordPointer__IIII }, {"glTexEnvi", "(III)V", (void *) android_glTexEnvi__III }, {"glTexEnviv", "(II[II)V", (void *) android_glTexEnviv__II_3II }, @@ -6611,9 +6658,9 @@ static JNINativeMethod methods[] = { {"glDrawTexxvOES", "([II)V", (void *) android_glDrawTexxvOES___3II }, {"glDrawTexxvOES", "(Ljava/nio/IntBuffer;)V", (void *) android_glDrawTexxvOES__Ljava_nio_IntBuffer_2 }, {"glLoadPaletteFromModelViewMatrixOES", "()V", (void *) android_glLoadPaletteFromModelViewMatrixOES__ }, -{"glMatrixIndexPointerOES", "(IIILjava/nio/Buffer;)V", (void *) android_glMatrixIndexPointerOES__IIILjava_nio_Buffer_2 }, +{"glMatrixIndexPointerOESBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glMatrixIndexPointerOESBounds__IIILjava_nio_Buffer_2I }, {"glMatrixIndexPointerOES", "(IIII)V", (void *) android_glMatrixIndexPointerOES__IIII }, -{"glWeightPointerOES", "(IIILjava/nio/Buffer;)V", (void *) android_glWeightPointerOES__IIILjava_nio_Buffer_2 }, +{"glWeightPointerOESBounds", "(IIILjava/nio/Buffer;I)V", (void *) android_glWeightPointerOESBounds__IIILjava_nio_Buffer_2I }, {"glWeightPointerOES", "(IIII)V", (void *) android_glWeightPointerOES__IIII }, {"glBindFramebufferOES", "(II)V", (void *) android_glBindFramebufferOES__II }, {"glBindRenderbufferOES", "(II)V", (void *) android_glBindRenderbufferOES__II }, |