Home | History | Annotate | Download | only in jni
      1 /*
      2  * Copyright 2014 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 // This source file is automatically generated
     18 
     19 #pragma GCC diagnostic ignored "-Wunused-variable"
     20 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
     21 #pragma GCC diagnostic ignored "-Wunused-function"
     22 
     23 #include <GLES3/gl31.h>
     24 #include <GLES2/gl2ext.h>
     25 
     26 #include <jni.h>
     27 #include <JNIHelp.h>
     28 #include <android_runtime/AndroidRuntime.h>
     29 #include <utils/misc.h>
     30 #include <assert.h>
     31 
     32 static int initialized = 0;
     33 
     34 static jclass nioAccessClass;
     35 static jclass bufferClass;
     36 static jmethodID getBasePointerID;
     37 static jmethodID getBaseArrayID;
     38 static jmethodID getBaseArrayOffsetID;
     39 static jfieldID positionID;
     40 static jfieldID limitID;
     41 static jfieldID elementSizeShiftID;
     42 
     43 
     44 /* special calls implemented in Android's GLES wrapper used to more
     45  * efficiently bound-check passed arrays */
     46 extern "C" {
     47 #ifdef GL_VERSION_ES_CM_1_1
     48 GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
     49         const GLvoid *ptr, GLsizei count);
     50 GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
     51         const GLvoid *pointer, GLsizei count);
     52 GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
     53         GLsizei stride, const GLvoid *pointer, GLsizei count);
     54 GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
     55         GLsizei stride, const GLvoid *pointer, GLsizei count);
     56 GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
     57         GLsizei stride, const GLvoid *pointer, GLsizei count);
     58 GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
     59         GLsizei stride, const GLvoid *pointer, GLsizei count);
     60 GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
     61         GLsizei stride, const GLvoid *pointer, GLsizei count);
     62 #endif
     63 #ifdef GL_ES_VERSION_2_0
     64 static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type,
     65         GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) {
     66     glVertexAttribPointer(indx, size, type, normalized, stride, pointer);
     67 }
     68 #endif
     69 #ifdef GL_ES_VERSION_3_0
     70 static void glVertexAttribIPointerBounds(GLuint indx, GLint size, GLenum type,
     71         GLsizei stride, const GLvoid *pointer, GLsizei count) {
     72     glVertexAttribIPointer(indx, size, type, stride, pointer);
     73 }
     74 #endif
     75 }
     76 
     77 /* Cache method IDs each time the class is loaded. */
     78 
     79 static void
     80 nativeClassInit(JNIEnv *_env, jclass glImplClass)
     81 {
     82     jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
     83     nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
     84 
     85     jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
     86     bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
     87 
     88     getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
     89             "getBasePointer", "(Ljava/nio/Buffer;)J");
     90     getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
     91             "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
     92     getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
     93             "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
     94 
     95     positionID = _env->GetFieldID(bufferClass, "position", "I");
     96     limitID = _env->GetFieldID(bufferClass, "limit", "I");
     97     elementSizeShiftID =
     98         _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
     99 }
    100 
    101 static void *
    102 getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
    103 {
    104     jint position;
    105     jint limit;
    106     jint elementSizeShift;
    107     jlong pointer;
    108 
    109     position = _env->GetIntField(buffer, positionID);
    110     limit = _env->GetIntField(buffer, limitID);
    111     elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
    112     *remaining = (limit - position) << elementSizeShift;
    113     pointer = _env->CallStaticLongMethod(nioAccessClass,
    114             getBasePointerID, buffer);
    115     if (pointer != 0L) {
    116         *array = NULL;
    117         return reinterpret_cast<void*>(pointer);
    118     }
    119 
    120     *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
    121             getBaseArrayID, buffer);
    122     *offset = _env->CallStaticIntMethod(nioAccessClass,
    123             getBaseArrayOffsetID, buffer);
    124 
    125     return NULL;
    126 }
    127 
    128 class ByteArrayGetter {
    129 public:
    130     static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
    131         return _env->GetByteArrayElements(array, is_copy);
    132     }
    133 };
    134 class BooleanArrayGetter {
    135 public:
    136     static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
    137         return _env->GetBooleanArrayElements(array, is_copy);
    138     }
    139 };
    140 class CharArrayGetter {
    141 public:
    142     static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
    143         return _env->GetCharArrayElements(array, is_copy);
    144     }
    145 };
    146 class ShortArrayGetter {
    147 public:
    148     static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
    149         return _env->GetShortArrayElements(array, is_copy);
    150     }
    151 };
    152 class IntArrayGetter {
    153 public:
    154     static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
    155         return _env->GetIntArrayElements(array, is_copy);
    156     }
    157 };
    158 class LongArrayGetter {
    159 public:
    160     static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
    161         return _env->GetLongArrayElements(array, is_copy);
    162     }
    163 };
    164 class FloatArrayGetter {
    165 public:
    166     static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
    167         return _env->GetFloatArrayElements(array, is_copy);
    168     }
    169 };
    170 class DoubleArrayGetter {
    171 public:
    172     static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
    173         return _env->GetDoubleArrayElements(array, is_copy);
    174     }
    175 };
    176 
    177 template<typename JTYPEARRAY, typename ARRAYGETTER>
    178 static void*
    179 getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
    180     return ARRAYGETTER::Get(_env, array, is_copy);
    181 }
    182 
    183 class ByteArrayReleaser {
    184 public:
    185     static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
    186         _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
    187     }
    188 };
    189 class BooleanArrayReleaser {
    190 public:
    191     static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
    192         _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
    193     }
    194 };
    195 class CharArrayReleaser {
    196 public:
    197     static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
    198         _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
    199     }
    200 };
    201 class ShortArrayReleaser {
    202 public:
    203     static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
    204         _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
    205     }
    206 };
    207 class IntArrayReleaser {
    208 public:
    209     static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
    210         _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
    211     }
    212 };
    213 class LongArrayReleaser {
    214 public:
    215     static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
    216         _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
    217     }
    218 };
    219 class FloatArrayReleaser {
    220 public:
    221     static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
    222         _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
    223     }
    224 };
    225 class DoubleArrayReleaser {
    226 public:
    227     static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
    228         _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
    229     }
    230 };
    231 
    232 template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
    233 static void
    234 releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
    235     ARRAYRELEASER::Release(_env, array, data, commit);
    236 }
    237 
    238 static void
    239 releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
    240 {
    241     _env->ReleasePrimitiveArrayCritical(array, data,
    242                        commit ? 0 : JNI_ABORT);
    243 }
    244 
    245 static void *
    246 getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
    247     char* buf = (char*) _env->GetDirectBufferAddress(buffer);
    248     if (buf) {
    249         jint position = _env->GetIntField(buffer, positionID);
    250         jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
    251         buf += position << elementSizeShift;
    252     } else {
    253         jniThrowException(_env, "java/lang/IllegalArgumentException",
    254                           "Must use a native order direct Buffer");
    255     }
    256     return (void*) buf;
    257 }
    258 
    259 // --------------------------------------------------------------------------
    260 
    261 /*
    262  * returns the number of values glGet returns for a given pname.
    263  *
    264  * The code below is written such that pnames requiring only one values
    265  * are the default (and are not explicitely tested for). This makes the
    266  * checking code much shorter/readable/efficient.
    267  *
    268  * This means that unknown pnames (e.g.: extensions) will default to 1. If
    269  * that unknown pname needs more than 1 value, then the validation check
    270  * is incomplete and the app may crash if it passed the wrong number params.
    271  */
    272 static int getNeededCount(GLint pname) {
    273     int needed = 1;
    274 #ifdef GL_ES_VERSION_2_0
    275     // GLES 2.x pnames
    276     switch (pname) {
    277         case GL_ALIASED_LINE_WIDTH_RANGE:
    278         case GL_ALIASED_POINT_SIZE_RANGE:
    279             needed = 2;
    280             break;
    281 
    282         case GL_BLEND_COLOR:
    283         case GL_COLOR_CLEAR_VALUE:
    284         case GL_COLOR_WRITEMASK:
    285         case GL_SCISSOR_BOX:
    286         case GL_VIEWPORT:
    287             needed = 4;
    288             break;
    289 
    290         case GL_COMPRESSED_TEXTURE_FORMATS:
    291             glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
    292             break;
    293 
    294         case GL_SHADER_BINARY_FORMATS:
    295             glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed);
    296             break;
    297     }
    298 #endif
    299 
    300 #ifdef GL_VERSION_ES_CM_1_1
    301     // GLES 1.x pnames
    302     switch (pname) {
    303         case GL_ALIASED_LINE_WIDTH_RANGE:
    304         case GL_ALIASED_POINT_SIZE_RANGE:
    305         case GL_DEPTH_RANGE:
    306         case GL_SMOOTH_LINE_WIDTH_RANGE:
    307         case GL_SMOOTH_POINT_SIZE_RANGE:
    308             needed = 2;
    309             break;
    310 
    311         case GL_CURRENT_NORMAL:
    312         case GL_POINT_DISTANCE_ATTENUATION:
    313             needed = 3;
    314             break;
    315 
    316         case GL_COLOR_CLEAR_VALUE:
    317         case GL_COLOR_WRITEMASK:
    318         case GL_CURRENT_COLOR:
    319         case GL_CURRENT_TEXTURE_COORDS:
    320         case GL_FOG_COLOR:
    321         case GL_LIGHT_MODEL_AMBIENT:
    322         case GL_SCISSOR_BOX:
    323         case GL_VIEWPORT:
    324             needed = 4;
    325             break;
    326 
    327         case GL_MODELVIEW_MATRIX:
    328         case GL_PROJECTION_MATRIX:
    329         case GL_TEXTURE_MATRIX:
    330             needed = 16;
    331             break;
    332 
    333         case GL_COMPRESSED_TEXTURE_FORMATS:
    334             glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
    335             break;
    336     }
    337 #endif
    338     return needed;
    339 }
    340 
    341 template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
    342           typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
    343 static void
    344 get
    345   (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
    346     jint _exception = 0;
    347     const char * _exceptionType;
    348     const char * _exceptionMessage;
    349     CTYPE *params_base = (CTYPE *) 0;
    350     jint _remaining;
    351     CTYPE *params = (CTYPE *) 0;
    352     int _needed = 0;
    353 
    354     if (!params_ref) {
    355         _exception = 1;
    356         _exceptionType = "java/lang/IllegalArgumentException";
    357         _exceptionMessage = "params == null";
    358         goto exit;
    359     }
    360     if (offset < 0) {
    361         _exception = 1;
    362         _exceptionType = "java/lang/IllegalArgumentException";
    363         _exceptionMessage = "offset < 0";
    364         goto exit;
    365     }
    366     _remaining = _env->GetArrayLength(params_ref) - offset;
    367     _needed = getNeededCount(pname);
    368     // if we didn't find this pname, we just assume the user passed
    369     // an array of the right size -- this might happen with extensions
    370     // or if we forget an enum here.
    371     if (_remaining < _needed) {
    372         _exception = 1;
    373         _exceptionType = "java/lang/IllegalArgumentException";
    374         _exceptionMessage = "length - offset < needed";
    375         goto exit;
    376     }
    377     params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
    378         _env, params_ref, (jboolean *)0);
    379     params = params_base + offset;
    380 
    381     GET(
    382         (GLenum)pname,
    383         (CTYPE *)params
    384     );
    385 
    386 exit:
    387     if (params_base) {
    388         releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
    389             _env, params_ref, params_base, !_exception);
    390     }
    391     if (_exception) {
    392         jniThrowException(_env, _exceptionType, _exceptionMessage);
    393     }
    394 }
    395 
    396 
    397 template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
    398           typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
    399 static void
    400 getarray
    401   (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
    402     jint _exception = 0;
    403     const char * _exceptionType;
    404     const char * _exceptionMessage;
    405     JTYPEARRAY _array = (JTYPEARRAY) 0;
    406     jint _bufferOffset = (jint) 0;
    407     jint _remaining;
    408     CTYPE *params = (CTYPE *) 0;
    409     int _needed = 0;
    410 
    411     params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
    412     _remaining /= sizeof(CTYPE);    // convert from bytes to item count
    413     _needed = getNeededCount(pname);
    414     // if we didn't find this pname, we just assume the user passed
    415     // an array of the right size -- this might happen with extensions
    416     // or if we forget an enum here.
    417     if (_needed>0 && _remaining < _needed) {
    418         _exception = 1;
    419         _exceptionType = "java/lang/IllegalArgumentException";
    420         _exceptionMessage = "remaining() < needed";
    421         goto exit;
    422     }
    423     if (params == NULL) {
    424         char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
    425             _env, _array, (jboolean *) 0);
    426         params = (CTYPE *) (_paramsBase + _bufferOffset);
    427     }
    428     GET(
    429         (GLenum)pname,
    430         (CTYPE *)params
    431     );
    432 
    433 exit:
    434     if (_array) {
    435         releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
    436             _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
    437     }
    438     if (_exception) {
    439         jniThrowException(_env, _exceptionType, _exceptionMessage);
    440     }
    441 }
    442 
    443 // --------------------------------------------------------------------------
    444 /* void glBlendBarrierKHR ( void ) */
    445 static void
    446 android_glBlendBarrierKHR__
    447   (JNIEnv *_env, jobject _this) {
    448     glBlendBarrierKHR();
    449 }
    450 
    451 /* void glDebugMessageControlKHR ( GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled ) */
    452 static void
    453 android_glDebugMessageControlKHR__IIII_3IIZ
    454   (JNIEnv *_env, jobject _this, jint source, jint type, jint severity, jint count, jintArray ids_ref, jint offset, jboolean enabled) {
    455     jint _exception = 0;
    456     const char * _exceptionType = NULL;
    457     const char * _exceptionMessage = NULL;
    458     GLuint *ids_base = (GLuint *) 0;
    459     jint _remaining;
    460     GLuint *ids = (GLuint *) 0;
    461 
    462     if (!ids_ref) {
    463         _exception = 1;
    464         _exceptionType = "java/lang/IllegalArgumentException";
    465         _exceptionMessage = "ids == null";
    466         goto exit;
    467     }
    468     if (offset < 0) {
    469         _exception = 1;
    470         _exceptionType = "java/lang/IllegalArgumentException";
    471         _exceptionMessage = "offset < 0";
    472         goto exit;
    473     }
    474     _remaining = _env->GetArrayLength(ids_ref) - offset;
    475     ids_base = (GLuint *)
    476         _env->GetIntArrayElements(ids_ref, (jboolean *)0);
    477     ids = ids_base + offset;
    478 
    479     glDebugMessageControlKHR(
    480         (GLenum)source,
    481         (GLenum)type,
    482         (GLenum)severity,
    483         (GLsizei)count,
    484         (GLuint *)ids,
    485         (GLboolean)enabled
    486     );
    487 
    488 exit:
    489     if (ids_base) {
    490         _env->ReleaseIntArrayElements(ids_ref, (jint*)ids_base,
    491             JNI_ABORT);
    492     }
    493     if (_exception) {
    494         jniThrowException(_env, _exceptionType, _exceptionMessage);
    495     }
    496 }
    497 
    498 /* void glDebugMessageControlKHR ( GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled ) */
    499 static void
    500 android_glDebugMessageControlKHR__IIIILjava_nio_IntBuffer_2Z
    501   (JNIEnv *_env, jobject _this, jint source, jint type, jint severity, jint count, jobject ids_buf, jboolean enabled) {
    502     jintArray _array = (jintArray) 0;
    503     jint _bufferOffset = (jint) 0;
    504     jint _remaining;
    505     GLuint *ids = (GLuint *) 0;
    506 
    507     ids = (GLuint *)getPointer(_env, ids_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
    508     if (ids == NULL) {
    509         char * _idsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
    510         ids = (GLuint *) (_idsBase + _bufferOffset);
    511     }
    512     glDebugMessageControlKHR(
    513         (GLenum)source,
    514         (GLenum)type,
    515         (GLenum)severity,
    516         (GLsizei)count,
    517         (GLuint *)ids,
    518         (GLboolean)enabled
    519     );
    520     if (_array) {
    521         _env->ReleaseIntArrayElements(_array, (jint*)ids, JNI_ABORT);
    522     }
    523 }
    524 
    525 /* void glDebugMessageInsertKHR ( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf ) */
    526 static void
    527 android_glDebugMessageInsertKHR__IIIILjava_lang_String_2
    528   (JNIEnv *_env, jobject _this, jint source, jint type, jint id, jint severity, jstring buf) {
    529     jint _exception = 0;
    530     const char * _exceptionType = NULL;
    531     const char * _exceptionMessage = NULL;
    532     const char* _nativebuf = 0;
    533     jint _length = 0;
    534 
    535     if (!buf) {
    536         _exception = 1;
    537         _exceptionType = "java/lang/IllegalArgumentException";
    538         _exceptionMessage = "buf == null";
    539         goto exit;
    540     }
    541     _nativebuf = _env->GetStringUTFChars(buf, 0);
    542     _length = _env->GetStringUTFLength(buf);
    543 
    544     glDebugMessageInsertKHR(
    545         (GLenum)source,
    546         (GLenum)type,
    547         (GLuint)id,
    548         (GLenum)severity,
    549         (GLsizei)_length,
    550         (GLchar *)_nativebuf
    551     );
    552 
    553 exit:
    554     if (_nativebuf) {
    555         _env->ReleaseStringUTFChars(buf, _nativebuf);
    556     }
    557 
    558     if (_exception) {
    559         jniThrowException(_env, _exceptionType, _exceptionMessage);
    560     }
    561 }
    562 
    563 /* void glDebugMessageCallbackKHR ( GLDEBUGPROCKHR callback, const void *userParam ) */
    564 static void
    565 android_glDebugMessageCallbackKHR(JNIEnv *_env, jobject _this, jobject callback) {
    566     jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
    567 }
    568 /* GLuint glGetDebugMessageLogKHR ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog ) */
    569 static jint
    570 android_glGetDebugMessageLogKHR__II_3II_3II_3II_3II_3II_3BI
    571   (JNIEnv *_env, jobject _this, jint count, jint bufSize, jintArray sources_ref, jint sourcesOffset, jintArray types_ref, jint typesOffset, jintArray ids_ref, jint idsOffset, jintArray severities_ref, jint severitiesOffset, jintArray lengths_ref, jint lengthsOffset, jbyteArray messageLog_ref, jint messageLogOffset) {
    572     jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
    573     return 0;
    574 }
    575 
    576 /* GLuint glGetDebugMessageLogKHR ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog ) */
    577 static uint
    578 android_glGetDebugMessageLogKHR__ILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_ByteBuffer_2
    579   (JNIEnv *_env, jobject _this, jint count, jobject sources_ref, jobject types_ref, jobject ids_ref, jobject severities_ref, jobject lengths_ref, jobject messageLog_ref) {
    580     jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
    581     return 0;
    582 }
    583 
    584 /* GLuint glGetDebugMessageLogKHR ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog ) */
    585 static jobjectArray
    586 android_glGetDebugMessageLogKHR__I_3II_3II_3II_3II
    587   (JNIEnv *_env, jobject _this, jint count, jintArray sources_ref, jint sourcesOffset, jintArray types_ref, jint typesOffset, jintArray ids_ref, jint idsOffset, jintArray severities_ref, jint severitiesOffset) {
    588     jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
    589     return 0;
    590 }
    591 
    592 /* GLuint glGetDebugMessageLogKHR ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog ) */
    593 static jobjectArray
    594 android_glGetDebugMessageLogKHR__ILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
    595   (JNIEnv *_env, jobject _this, jint count, jobject sources_ref, jobject types_ref, jobject ids_ref, jobject severities_ref) {
    596     jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
    597     return 0;
    598 }
    599 /* void glPushDebugGroupKHR ( GLenum source, GLuint id, GLsizei length, const GLchar *message ) */
    600 static void
    601 android_glPushDebugGroupKHR__IIILjava_lang_String_2
    602   (JNIEnv *_env, jobject _this, jint source, jint id, jint length, jstring message) {
    603     jint _exception = 0;
    604     const char * _exceptionType = NULL;
    605     const char * _exceptionMessage = NULL;
    606     const char* _nativemessage = 0;
    607 
    608     if (!message) {
    609         _exception = 1;
    610         _exceptionType = "java/lang/IllegalArgumentException";
    611         _exceptionMessage = "message == null";
    612         goto exit;
    613     }
    614     _nativemessage = _env->GetStringUTFChars(message, 0);
    615 
    616     glPushDebugGroupKHR(
    617         (GLenum)source,
    618         (GLuint)id,
    619         (GLsizei)length,
    620         (GLchar *)_nativemessage
    621     );
    622 
    623 exit:
    624     if (_nativemessage) {
    625         _env->ReleaseStringUTFChars(message, _nativemessage);
    626     }
    627 
    628     if (_exception) {
    629         jniThrowException(_env, _exceptionType, _exceptionMessage);
    630     }
    631 }
    632 
    633 /* void glPopDebugGroupKHR ( void ) */
    634 static void
    635 android_glPopDebugGroupKHR__
    636   (JNIEnv *_env, jobject _this) {
    637     glPopDebugGroupKHR();
    638 }
    639 
    640 /* void glObjectLabelKHR ( GLenum identifier, GLuint name, GLsizei length, const GLchar *label ) */
    641 static void
    642 android_glObjectLabelKHR__IIILjava_lang_String_2
    643   (JNIEnv *_env, jobject _this, jint identifier, jint name, jint length, jstring label) {
    644     jint _exception = 0;
    645     const char * _exceptionType = NULL;
    646     const char * _exceptionMessage = NULL;
    647     const char* _nativelabel = 0;
    648 
    649     if (label) {
    650         _nativelabel = _env->GetStringUTFChars(label, 0);
    651     }
    652 
    653     glObjectLabelKHR(
    654         (GLenum)identifier,
    655         (GLuint)name,
    656         (GLsizei)length,
    657         (GLchar *)_nativelabel
    658     );
    659     if (_nativelabel) {
    660         _env->ReleaseStringUTFChars(label, _nativelabel);
    661     }
    662 
    663     if (_exception) {
    664         jniThrowException(_env, _exceptionType, _exceptionMessage);
    665     }
    666 }
    667 
    668 /* void glGetObjectLabelKHR ( GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label ) */
    669 static jstring
    670 android_glGetObjectLabelKHR(JNIEnv *_env, jobject _this, jint identifier, jint name) {
    671     jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
    672     return NULL;
    673 }
    674 
    675 /* void glObjectPtrLabelKHR ( const void *ptr, GLsizei length, const GLchar *label ) */
    676 static void
    677 android_glObjectPtrLabelKHR(JNIEnv *_env, jobject _this, jlong ptr, jstring label) {
    678     jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
    679 }
    680 
    681 /* void glGetObjectPtrLabelKHR ( const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label ) */
    682 static jstring
    683 android_glGetObjectPtrLabelKHR(JNIEnv *_env, jobject _this, jlong ptr) {
    684     jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
    685     return NULL;
    686 }
    687 
    688 /* void glGetPointervKHR ( GLenum pname, void **params ) */
    689 static jobject
    690 android_glGetDebugMessageCallbackKHR(JNIEnv *_env, jobject _this) {
    691     jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
    692     return NULL;
    693 }
    694 
    695 /* void glMinSampleShadingOES ( GLfloat value ) */
    696 static void
    697 android_glMinSampleShadingOES__F
    698   (JNIEnv *_env, jobject _this, jfloat value) {
    699     glMinSampleShadingOES(
    700         (GLfloat)value
    701     );
    702 }
    703 
    704 /* void glTexStorage3DMultisampleOES ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations ) */
    705 static void
    706 android_glTexStorage3DMultisampleOES__IIIIIIZ
    707   (JNIEnv *_env, jobject _this, jint target, jint samples, jint internalformat, jint width, jint height, jint depth, jboolean fixedsamplelocations) {
    708     glTexStorage3DMultisampleOES(
    709         (GLenum)target,
    710         (GLsizei)samples,
    711         (GLenum)internalformat,
    712         (GLsizei)width,
    713         (GLsizei)height,
    714         (GLsizei)depth,
    715         (GLboolean)fixedsamplelocations
    716     );
    717 }
    718 
    719 /* void glCopyImageSubDataEXT ( GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth ) */
    720 static void
    721 android_glCopyImageSubDataEXT__IIIIIIIIIIIIIII
    722   (JNIEnv *_env, jobject _this, jint srcName, jint srcTarget, jint srcLevel, jint srcX, jint srcY, jint srcZ, jint dstName, jint dstTarget, jint dstLevel, jint dstX, jint dstY, jint dstZ, jint srcWidth, jint srcHeight, jint srcDepth) {
    723     glCopyImageSubDataEXT(
    724         (GLuint)srcName,
    725         (GLenum)srcTarget,
    726         (GLint)srcLevel,
    727         (GLint)srcX,
    728         (GLint)srcY,
    729         (GLint)srcZ,
    730         (GLuint)dstName,
    731         (GLenum)dstTarget,
    732         (GLint)dstLevel,
    733         (GLint)dstX,
    734         (GLint)dstY,
    735         (GLint)dstZ,
    736         (GLsizei)srcWidth,
    737         (GLsizei)srcHeight,
    738         (GLsizei)srcDepth
    739     );
    740 }
    741 
    742 /* void glEnableiEXT ( GLenum target, GLuint index ) */
    743 static void
    744 android_glEnableiEXT__II
    745   (JNIEnv *_env, jobject _this, jint target, jint index) {
    746     glEnableiEXT(
    747         (GLenum)target,
    748         (GLuint)index
    749     );
    750 }
    751 
    752 /* void glDisableiEXT ( GLenum target, GLuint index ) */
    753 static void
    754 android_glDisableiEXT__II
    755   (JNIEnv *_env, jobject _this, jint target, jint index) {
    756     glDisableiEXT(
    757         (GLenum)target,
    758         (GLuint)index
    759     );
    760 }
    761 
    762 /* void glBlendEquationiEXT ( GLuint buf, GLenum mode ) */
    763 static void
    764 android_glBlendEquationiEXT__II
    765   (JNIEnv *_env, jobject _this, jint buf, jint mode) {
    766     glBlendEquationiEXT(
    767         (GLuint)buf,
    768         (GLenum)mode
    769     );
    770 }
    771 
    772 /* void glBlendEquationSeparateiEXT ( GLuint buf, GLenum modeRGB, GLenum modeAlpha ) */
    773 static void
    774 android_glBlendEquationSeparateiEXT__III
    775   (JNIEnv *_env, jobject _this, jint buf, jint modeRGB, jint modeAlpha) {
    776     glBlendEquationSeparateiEXT(
    777         (GLuint)buf,
    778         (GLenum)modeRGB,
    779         (GLenum)modeAlpha
    780     );
    781 }
    782 
    783 /* void glBlendFunciEXT ( GLuint buf, GLenum src, GLenum dst ) */
    784 static void
    785 android_glBlendFunciEXT__III
    786   (JNIEnv *_env, jobject _this, jint buf, jint src, jint dst) {
    787     glBlendFunciEXT(
    788         (GLuint)buf,
    789         (GLenum)src,
    790         (GLenum)dst
    791     );
    792 }
    793 
    794 /* void glBlendFuncSeparateiEXT ( GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) */
    795 static void
    796 android_glBlendFuncSeparateiEXT__IIIII
    797   (JNIEnv *_env, jobject _this, jint buf, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) {
    798     glBlendFuncSeparateiEXT(
    799         (GLuint)buf,
    800         (GLenum)srcRGB,
    801         (GLenum)dstRGB,
    802         (GLenum)srcAlpha,
    803         (GLenum)dstAlpha
    804     );
    805 }
    806 
    807 /* void glColorMaskiEXT ( GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) */
    808 static void
    809 android_glColorMaskiEXT__IZZZZ
    810   (JNIEnv *_env, jobject _this, jint index, jboolean r, jboolean g, jboolean b, jboolean a) {
    811     glColorMaskiEXT(
    812         (GLuint)index,
    813         (GLboolean)r,
    814         (GLboolean)g,
    815         (GLboolean)b,
    816         (GLboolean)a
    817     );
    818 }
    819 
    820 /* GLboolean glIsEnablediEXT ( GLenum target, GLuint index ) */
    821 static jboolean
    822 android_glIsEnablediEXT__II
    823   (JNIEnv *_env, jobject _this, jint target, jint index) {
    824     GLboolean _returnValue;
    825     _returnValue = glIsEnablediEXT(
    826         (GLenum)target,
    827         (GLuint)index
    828     );
    829     return (jboolean)_returnValue;
    830 }
    831 
    832 /* void glFramebufferTextureEXT ( GLenum target, GLenum attachment, GLuint texture, GLint level ) */
    833 static void
    834 android_glFramebufferTextureEXT__IIII
    835   (JNIEnv *_env, jobject _this, jint target, jint attachment, jint texture, jint level) {
    836     glFramebufferTextureEXT(
    837         (GLenum)target,
    838         (GLenum)attachment,
    839         (GLuint)texture,
    840         (GLint)level
    841     );
    842 }
    843 
    844 /* void glPrimitiveBoundingBoxEXT ( GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW ) */
    845 static void
    846 android_glPrimitiveBoundingBoxEXT__FFFFFFFF
    847   (JNIEnv *_env, jobject _this, jfloat minX, jfloat minY, jfloat minZ, jfloat minW, jfloat maxX, jfloat maxY, jfloat maxZ, jfloat maxW) {
    848     glPrimitiveBoundingBoxEXT(
    849         (GLfloat)minX,
    850         (GLfloat)minY,
    851         (GLfloat)minZ,
    852         (GLfloat)minW,
    853         (GLfloat)maxX,
    854         (GLfloat)maxY,
    855         (GLfloat)maxZ,
    856         (GLfloat)maxW
    857     );
    858 }
    859 
    860 /* void glPatchParameteriEXT ( GLenum pname, GLint value ) */
    861 static void
    862 android_glPatchParameteriEXT__II
    863   (JNIEnv *_env, jobject _this, jint pname, jint value) {
    864     glPatchParameteriEXT(
    865         (GLenum)pname,
    866         (GLint)value
    867     );
    868 }
    869 
    870 /* void glTexParameterIivEXT ( GLenum target, GLenum pname, const GLint *params ) */
    871 static void
    872 android_glTexParameterIivEXT__II_3II
    873   (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
    874     jint _exception = 0;
    875     const char * _exceptionType = NULL;
    876     const char * _exceptionMessage = NULL;
    877     GLint *params_base = (GLint *) 0;
    878     jint _remaining;
    879     GLint *params = (GLint *) 0;
    880 
    881     if (!params_ref) {
    882         _exception = 1;
    883         _exceptionType = "java/lang/IllegalArgumentException";
    884         _exceptionMessage = "params == null";
    885         goto exit;
    886     }
    887     if (offset < 0) {
    888         _exception = 1;
    889         _exceptionType = "java/lang/IllegalArgumentException";
    890         _exceptionMessage = "offset < 0";
    891         goto exit;
    892     }
    893     _remaining = _env->GetArrayLength(params_ref) - offset;
    894     params_base = (GLint *)
    895         _env->GetIntArrayElements(params_ref, (jboolean *)0);
    896     params = params_base + offset;
    897 
    898     glTexParameterIivEXT(
    899         (GLenum)target,
    900         (GLenum)pname,
    901         (GLint *)params
    902     );
    903 
    904 exit:
    905     if (params_base) {
    906         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
    907             JNI_ABORT);
    908     }
    909     if (_exception) {
    910         jniThrowException(_env, _exceptionType, _exceptionMessage);
    911     }
    912 }
    913 
    914 /* void glTexParameterIivEXT ( GLenum target, GLenum pname, const GLint *params ) */
    915 static void
    916 android_glTexParameterIivEXT__IILjava_nio_IntBuffer_2
    917   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
    918     jintArray _array = (jintArray) 0;
    919     jint _bufferOffset = (jint) 0;
    920     jint _remaining;
    921     GLint *params = (GLint *) 0;
    922 
    923     params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
    924     if (params == NULL) {
    925         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
    926         params = (GLint *) (_paramsBase + _bufferOffset);
    927     }
    928     glTexParameterIivEXT(
    929         (GLenum)target,
    930         (GLenum)pname,
    931         (GLint *)params
    932     );
    933     if (_array) {
    934         _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
    935     }
    936 }
    937 
    938 /* void glTexParameterIuivEXT ( GLenum target, GLenum pname, const GLuint *params ) */
    939 static void
    940 android_glTexParameterIuivEXT__II_3II
    941   (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
    942     jint _exception = 0;
    943     const char * _exceptionType = NULL;
    944     const char * _exceptionMessage = NULL;
    945     GLuint *params_base = (GLuint *) 0;
    946     jint _remaining;
    947     GLuint *params = (GLuint *) 0;
    948 
    949     if (!params_ref) {
    950         _exception = 1;
    951         _exceptionType = "java/lang/IllegalArgumentException";
    952         _exceptionMessage = "params == null";
    953         goto exit;
    954     }
    955     if (offset < 0) {
    956         _exception = 1;
    957         _exceptionType = "java/lang/IllegalArgumentException";
    958         _exceptionMessage = "offset < 0";
    959         goto exit;
    960     }
    961     _remaining = _env->GetArrayLength(params_ref) - offset;
    962     params_base = (GLuint *)
    963         _env->GetIntArrayElements(params_ref, (jboolean *)0);
    964     params = params_base + offset;
    965 
    966     glTexParameterIuivEXT(
    967         (GLenum)target,
    968         (GLenum)pname,
    969         (GLuint *)params
    970     );
    971 
    972 exit:
    973     if (params_base) {
    974         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
    975             JNI_ABORT);
    976     }
    977     if (_exception) {
    978         jniThrowException(_env, _exceptionType, _exceptionMessage);
    979     }
    980 }
    981 
    982 /* void glTexParameterIuivEXT ( GLenum target, GLenum pname, const GLuint *params ) */
    983 static void
    984 android_glTexParameterIuivEXT__IILjava_nio_IntBuffer_2
    985   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
    986     jintArray _array = (jintArray) 0;
    987     jint _bufferOffset = (jint) 0;
    988     jint _remaining;
    989     GLuint *params = (GLuint *) 0;
    990 
    991     params = (GLuint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
    992     if (params == NULL) {
    993         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
    994         params = (GLuint *) (_paramsBase + _bufferOffset);
    995     }
    996     glTexParameterIuivEXT(
    997         (GLenum)target,
    998         (GLenum)pname,
    999         (GLuint *)params
   1000     );
   1001     if (_array) {
   1002         _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
   1003     }
   1004 }
   1005 
   1006 /* void glGetTexParameterIivEXT ( GLenum target, GLenum pname, GLint *params ) */
   1007 static void
   1008 android_glGetTexParameterIivEXT__II_3II
   1009   (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
   1010     jint _exception = 0;
   1011     const char * _exceptionType = NULL;
   1012     const char * _exceptionMessage = NULL;
   1013     GLint *params_base = (GLint *) 0;
   1014     jint _remaining;
   1015     GLint *params = (GLint *) 0;
   1016 
   1017     if (!params_ref) {
   1018         _exception = 1;
   1019         _exceptionType = "java/lang/IllegalArgumentException";
   1020         _exceptionMessage = "params == null";
   1021         goto exit;
   1022     }
   1023     if (offset < 0) {
   1024         _exception = 1;
   1025         _exceptionType = "java/lang/IllegalArgumentException";
   1026         _exceptionMessage = "offset < 0";
   1027         goto exit;
   1028     }
   1029     _remaining = _env->GetArrayLength(params_ref) - offset;
   1030     params_base = (GLint *)
   1031         _env->GetIntArrayElements(params_ref, (jboolean *)0);
   1032     params = params_base + offset;
   1033 
   1034     glGetTexParameterIivEXT(
   1035         (GLenum)target,
   1036         (GLenum)pname,
   1037         (GLint *)params
   1038     );
   1039 
   1040 exit:
   1041     if (params_base) {
   1042         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
   1043             _exception ? JNI_ABORT: 0);
   1044     }
   1045     if (_exception) {
   1046         jniThrowException(_env, _exceptionType, _exceptionMessage);
   1047     }
   1048 }
   1049 
   1050 /* void glGetTexParameterIivEXT ( GLenum target, GLenum pname, GLint *params ) */
   1051 static void
   1052 android_glGetTexParameterIivEXT__IILjava_nio_IntBuffer_2
   1053   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
   1054     jintArray _array = (jintArray) 0;
   1055     jint _bufferOffset = (jint) 0;
   1056     jint _remaining;
   1057     GLint *params = (GLint *) 0;
   1058 
   1059     params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
   1060     if (params == NULL) {
   1061         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
   1062         params = (GLint *) (_paramsBase + _bufferOffset);
   1063     }
   1064     glGetTexParameterIivEXT(
   1065         (GLenum)target,
   1066         (GLenum)pname,
   1067         (GLint *)params
   1068     );
   1069     if (_array) {
   1070         _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
   1071     }
   1072 }
   1073 
   1074 /* void glGetTexParameterIuivEXT ( GLenum target, GLenum pname, GLuint *params ) */
   1075 static void
   1076 android_glGetTexParameterIuivEXT__II_3II
   1077   (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
   1078     jint _exception = 0;
   1079     const char * _exceptionType = NULL;
   1080     const char * _exceptionMessage = NULL;
   1081     GLuint *params_base = (GLuint *) 0;
   1082     jint _remaining;
   1083     GLuint *params = (GLuint *) 0;
   1084 
   1085     if (!params_ref) {
   1086         _exception = 1;
   1087         _exceptionType = "java/lang/IllegalArgumentException";
   1088         _exceptionMessage = "params == null";
   1089         goto exit;
   1090     }
   1091     if (offset < 0) {
   1092         _exception = 1;
   1093         _exceptionType = "java/lang/IllegalArgumentException";
   1094         _exceptionMessage = "offset < 0";
   1095         goto exit;
   1096     }
   1097     _remaining = _env->GetArrayLength(params_ref) - offset;
   1098     params_base = (GLuint *)
   1099         _env->GetIntArrayElements(params_ref, (jboolean *)0);
   1100     params = params_base + offset;
   1101 
   1102     glGetTexParameterIuivEXT(
   1103         (GLenum)target,
   1104         (GLenum)pname,
   1105         (GLuint *)params
   1106     );
   1107 
   1108 exit:
   1109     if (params_base) {
   1110         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
   1111             _exception ? JNI_ABORT: 0);
   1112     }
   1113     if (_exception) {
   1114         jniThrowException(_env, _exceptionType, _exceptionMessage);
   1115     }
   1116 }
   1117 
   1118 /* void glGetTexParameterIuivEXT ( GLenum target, GLenum pname, GLuint *params ) */
   1119 static void
   1120 android_glGetTexParameterIuivEXT__IILjava_nio_IntBuffer_2
   1121   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
   1122     jintArray _array = (jintArray) 0;
   1123     jint _bufferOffset = (jint) 0;
   1124     jint _remaining;
   1125     GLuint *params = (GLuint *) 0;
   1126 
   1127     params = (GLuint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
   1128     if (params == NULL) {
   1129         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
   1130         params = (GLuint *) (_paramsBase + _bufferOffset);
   1131     }
   1132     glGetTexParameterIuivEXT(
   1133         (GLenum)target,
   1134         (GLenum)pname,
   1135         (GLuint *)params
   1136     );
   1137     if (_array) {
   1138         _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
   1139     }
   1140 }
   1141 
   1142 /* void glSamplerParameterIivEXT ( GLuint sampler, GLenum pname, const GLint *param ) */
   1143 static void
   1144 android_glSamplerParameterIivEXT__II_3II
   1145   (JNIEnv *_env, jobject _this, jint sampler, jint pname, jintArray param_ref, jint offset) {
   1146     jint _exception = 0;
   1147     const char * _exceptionType = NULL;
   1148     const char * _exceptionMessage = NULL;
   1149     GLint *param_base = (GLint *) 0;
   1150     jint _remaining;
   1151     GLint *param = (GLint *) 0;
   1152 
   1153     if (!param_ref) {
   1154         _exception = 1;
   1155         _exceptionType = "java/lang/IllegalArgumentException";
   1156         _exceptionMessage = "param == null";
   1157         goto exit;
   1158     }
   1159     if (offset < 0) {
   1160         _exception = 1;
   1161         _exceptionType = "java/lang/IllegalArgumentException";
   1162         _exceptionMessage = "offset < 0";
   1163         goto exit;
   1164     }
   1165     _remaining = _env->GetArrayLength(param_ref) - offset;
   1166     param_base = (GLint *)
   1167         _env->GetIntArrayElements(param_ref, (jboolean *)0);
   1168     param = param_base + offset;
   1169 
   1170     glSamplerParameterIivEXT(
   1171         (GLuint)sampler,
   1172         (GLenum)pname,
   1173         (GLint *)param
   1174     );
   1175 
   1176 exit:
   1177     if (param_base) {
   1178         _env->ReleaseIntArrayElements(param_ref, (jint*)param_base,
   1179             JNI_ABORT);
   1180     }
   1181     if (_exception) {
   1182         jniThrowException(_env, _exceptionType, _exceptionMessage);
   1183     }
   1184 }
   1185 
   1186 /* void glSamplerParameterIivEXT ( GLuint sampler, GLenum pname, const GLint *param ) */
   1187 static void
   1188 android_glSamplerParameterIivEXT__IILjava_nio_IntBuffer_2
   1189   (JNIEnv *_env, jobject _this, jint sampler, jint pname, jobject param_buf) {
   1190     jintArray _array = (jintArray) 0;
   1191     jint _bufferOffset = (jint) 0;
   1192     jint _remaining;
   1193     GLint *param = (GLint *) 0;
   1194 
   1195     param = (GLint *)getPointer(_env, param_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
   1196     if (param == NULL) {
   1197         char * _paramBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
   1198         param = (GLint *) (_paramBase + _bufferOffset);
   1199     }
   1200     glSamplerParameterIivEXT(
   1201         (GLuint)sampler,
   1202         (GLenum)pname,
   1203         (GLint *)param
   1204     );
   1205     if (_array) {
   1206         _env->ReleaseIntArrayElements(_array, (jint*)param, JNI_ABORT);
   1207     }
   1208 }
   1209 
   1210 /* void glSamplerParameterIuivEXT ( GLuint sampler, GLenum pname, const GLuint *param ) */
   1211 static void
   1212 android_glSamplerParameterIuivEXT__II_3II
   1213   (JNIEnv *_env, jobject _this, jint sampler, jint pname, jintArray param_ref, jint offset) {
   1214     jint _exception = 0;
   1215     const char * _exceptionType = NULL;
   1216     const char * _exceptionMessage = NULL;
   1217     GLuint *param_base = (GLuint *) 0;
   1218     jint _remaining;
   1219     GLuint *param = (GLuint *) 0;
   1220 
   1221     if (!param_ref) {
   1222         _exception = 1;
   1223         _exceptionType = "java/lang/IllegalArgumentException";
   1224         _exceptionMessage = "param == null";
   1225         goto exit;
   1226     }
   1227     if (offset < 0) {
   1228         _exception = 1;
   1229         _exceptionType = "java/lang/IllegalArgumentException";
   1230         _exceptionMessage = "offset < 0";
   1231         goto exit;
   1232     }
   1233     _remaining = _env->GetArrayLength(param_ref) - offset;
   1234     param_base = (GLuint *)
   1235         _env->GetIntArrayElements(param_ref, (jboolean *)0);
   1236     param = param_base + offset;
   1237 
   1238     glSamplerParameterIuivEXT(
   1239         (GLuint)sampler,
   1240         (GLenum)pname,
   1241         (GLuint *)param
   1242     );
   1243 
   1244 exit:
   1245     if (param_base) {
   1246         _env->ReleaseIntArrayElements(param_ref, (jint*)param_base,
   1247             JNI_ABORT);
   1248     }
   1249     if (_exception) {
   1250         jniThrowException(_env, _exceptionType, _exceptionMessage);
   1251     }
   1252 }
   1253 
   1254 /* void glSamplerParameterIuivEXT ( GLuint sampler, GLenum pname, const GLuint *param ) */
   1255 static void
   1256 android_glSamplerParameterIuivEXT__IILjava_nio_IntBuffer_2
   1257   (JNIEnv *_env, jobject _this, jint sampler, jint pname, jobject param_buf) {
   1258     jintArray _array = (jintArray) 0;
   1259     jint _bufferOffset = (jint) 0;
   1260     jint _remaining;
   1261     GLuint *param = (GLuint *) 0;
   1262 
   1263     param = (GLuint *)getPointer(_env, param_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
   1264     if (param == NULL) {
   1265         char * _paramBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
   1266         param = (GLuint *) (_paramBase + _bufferOffset);
   1267     }
   1268     glSamplerParameterIuivEXT(
   1269         (GLuint)sampler,
   1270         (GLenum)pname,
   1271         (GLuint *)param
   1272     );
   1273     if (_array) {
   1274         _env->ReleaseIntArrayElements(_array, (jint*)param, JNI_ABORT);
   1275     }
   1276 }
   1277 
   1278 /* void glGetSamplerParameterIivEXT ( GLuint sampler, GLenum pname, GLint *params ) */
   1279 static void
   1280 android_glGetSamplerParameterIivEXT__II_3II
   1281   (JNIEnv *_env, jobject _this, jint sampler, jint pname, jintArray params_ref, jint offset) {
   1282     jint _exception = 0;
   1283     const char * _exceptionType = NULL;
   1284     const char * _exceptionMessage = NULL;
   1285     GLint *params_base = (GLint *) 0;
   1286     jint _remaining;
   1287     GLint *params = (GLint *) 0;
   1288 
   1289     if (!params_ref) {
   1290         _exception = 1;
   1291         _exceptionType = "java/lang/IllegalArgumentException";
   1292         _exceptionMessage = "params == null";
   1293         goto exit;
   1294     }
   1295     if (offset < 0) {
   1296         _exception = 1;
   1297         _exceptionType = "java/lang/IllegalArgumentException";
   1298         _exceptionMessage = "offset < 0";
   1299         goto exit;
   1300     }
   1301     _remaining = _env->GetArrayLength(params_ref) - offset;
   1302     params_base = (GLint *)
   1303         _env->GetIntArrayElements(params_ref, (jboolean *)0);
   1304     params = params_base + offset;
   1305 
   1306     glGetSamplerParameterIivEXT(
   1307         (GLuint)sampler,
   1308         (GLenum)pname,
   1309         (GLint *)params
   1310     );
   1311 
   1312 exit:
   1313     if (params_base) {
   1314         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
   1315             _exception ? JNI_ABORT: 0);
   1316     }
   1317     if (_exception) {
   1318         jniThrowException(_env, _exceptionType, _exceptionMessage);
   1319     }
   1320 }
   1321 
   1322 /* void glGetSamplerParameterIivEXT ( GLuint sampler, GLenum pname, GLint *params ) */
   1323 static void
   1324 android_glGetSamplerParameterIivEXT__IILjava_nio_IntBuffer_2
   1325   (JNIEnv *_env, jobject _this, jint sampler, jint pname, jobject params_buf) {
   1326     jintArray _array = (jintArray) 0;
   1327     jint _bufferOffset = (jint) 0;
   1328     jint _remaining;
   1329     GLint *params = (GLint *) 0;
   1330 
   1331     params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
   1332     if (params == NULL) {
   1333         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
   1334         params = (GLint *) (_paramsBase + _bufferOffset);
   1335     }
   1336     glGetSamplerParameterIivEXT(
   1337         (GLuint)sampler,
   1338         (GLenum)pname,
   1339         (GLint *)params
   1340     );
   1341     if (_array) {
   1342         _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
   1343     }
   1344 }
   1345 
   1346 /* void glGetSamplerParameterIuivEXT ( GLuint sampler, GLenum pname, GLuint *params ) */
   1347 static void
   1348 android_glGetSamplerParameterIuivEXT__II_3II
   1349   (JNIEnv *_env, jobject _this, jint sampler, jint pname, jintArray params_ref, jint offset) {
   1350     jint _exception = 0;
   1351     const char * _exceptionType = NULL;
   1352     const char * _exceptionMessage = NULL;
   1353     GLuint *params_base = (GLuint *) 0;
   1354     jint _remaining;
   1355     GLuint *params = (GLuint *) 0;
   1356 
   1357     if (!params_ref) {
   1358         _exception = 1;
   1359         _exceptionType = "java/lang/IllegalArgumentException";
   1360         _exceptionMessage = "params == null";
   1361         goto exit;
   1362     }
   1363     if (offset < 0) {
   1364         _exception = 1;
   1365         _exceptionType = "java/lang/IllegalArgumentException";
   1366         _exceptionMessage = "offset < 0";
   1367         goto exit;
   1368     }
   1369     _remaining = _env->GetArrayLength(params_ref) - offset;
   1370     params_base = (GLuint *)
   1371         _env->GetIntArrayElements(params_ref, (jboolean *)0);
   1372     params = params_base + offset;
   1373 
   1374     glGetSamplerParameterIuivEXT(
   1375         (GLuint)sampler,
   1376         (GLenum)pname,
   1377         (GLuint *)params
   1378     );
   1379 
   1380 exit:
   1381     if (params_base) {
   1382         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
   1383             _exception ? JNI_ABORT: 0);
   1384     }
   1385     if (_exception) {
   1386         jniThrowException(_env, _exceptionType, _exceptionMessage);
   1387     }
   1388 }
   1389 
   1390 /* void glGetSamplerParameterIuivEXT ( GLuint sampler, GLenum pname, GLuint *params ) */
   1391 static void
   1392 android_glGetSamplerParameterIuivEXT__IILjava_nio_IntBuffer_2
   1393   (JNIEnv *_env, jobject _this, jint sampler, jint pname, jobject params_buf) {
   1394     jintArray _array = (jintArray) 0;
   1395     jint _bufferOffset = (jint) 0;
   1396     jint _remaining;
   1397     GLuint *params = (GLuint *) 0;
   1398 
   1399     params = (GLuint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
   1400     if (params == NULL) {
   1401         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
   1402         params = (GLuint *) (_paramsBase + _bufferOffset);
   1403     }
   1404     glGetSamplerParameterIuivEXT(
   1405         (GLuint)sampler,
   1406         (GLenum)pname,
   1407         (GLuint *)params
   1408     );
   1409     if (_array) {
   1410         _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
   1411     }
   1412 }
   1413 
   1414 /* void glTexBufferEXT ( GLenum target, GLenum internalformat, GLuint buffer ) */
   1415 static void
   1416 android_glTexBufferEXT__III
   1417   (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint buffer) {
   1418     glTexBufferEXT(
   1419         (GLenum)target,
   1420         (GLenum)internalformat,
   1421         (GLuint)buffer
   1422     );
   1423 }
   1424 
   1425 /* void glTexBufferRangeEXT ( GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size ) */
   1426 static void
   1427 android_glTexBufferRangeEXT__IIIII
   1428   (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint buffer, jint offset, jint size) {
   1429     glTexBufferRangeEXT(
   1430         (GLenum)target,
   1431         (GLenum)internalformat,
   1432         (GLuint)buffer,
   1433         (GLintptr)offset,
   1434         (GLsizeiptr)size
   1435     );
   1436 }
   1437 
   1438 static const char *classPathName = "android/opengl/GLES31Ext";
   1439 
   1440 static const JNINativeMethod methods[] = {
   1441 {"_nativeClassInit", "()V", (void*)nativeClassInit },
   1442 {"glBlendBarrierKHR", "()V", (void *) android_glBlendBarrierKHR__ },
   1443 {"glDebugMessageControlKHR", "(IIII[IIZ)V", (void *) android_glDebugMessageControlKHR__IIII_3IIZ },
   1444 {"glDebugMessageControlKHR", "(IIIILjava/nio/IntBuffer;Z)V", (void *) android_glDebugMessageControlKHR__IIIILjava_nio_IntBuffer_2Z },
   1445 {"glDebugMessageInsertKHR", "(IIIILjava/lang/String;)V", (void *) android_glDebugMessageInsertKHR__IIIILjava_lang_String_2 },
   1446 {"glDebugMessageCallbackKHR", "(Landroid/opengl/GLES31Ext$DebugProcKHR;)V", (void *) android_glDebugMessageCallbackKHR },
   1447 {"glGetDebugMessageLogKHR", "(II[II[II[II[II[II[BI)I", (void *) android_glGetDebugMessageLogKHR__II_3II_3II_3II_3II_3II_3BI },
   1448 {"glGetDebugMessageLogKHR", "(ILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/ByteBuffer;)I", (void *) android_glGetDebugMessageLogKHR__ILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_ByteBuffer_2 },
   1449 {"glGetDebugMessageLogKHR", "(I[II[II[II[II)[Ljava/lang/String;", (void *) android_glGetDebugMessageLogKHR__I_3II_3II_3II_3II },
   1450 {"glGetDebugMessageLogKHR", "(ILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;)[Ljava/lang/String;", (void *) android_glGetDebugMessageLogKHR__ILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
   1451 {"glPushDebugGroupKHR", "(IIILjava/lang/String;)V", (void *) android_glPushDebugGroupKHR__IIILjava_lang_String_2 },
   1452 {"glPopDebugGroupKHR", "()V", (void *) android_glPopDebugGroupKHR__ },
   1453 {"glObjectLabelKHR", "(IIILjava/lang/String;)V", (void *) android_glObjectLabelKHR__IIILjava_lang_String_2 },
   1454 {"glGetObjectLabelKHR", "(II)Ljava/lang/String;", (void *) android_glGetObjectLabelKHR },
   1455 {"glObjectPtrLabelKHR", "(JLjava/lang/String;)V", (void *) android_glObjectPtrLabelKHR },
   1456 {"glGetObjectPtrLabelKHR", "(J)Ljava/lang/String;", (void *) android_glGetObjectPtrLabelKHR },
   1457 {"glGetDebugMessageCallbackKHR", "()Landroid/opengl/GLES31Ext$DebugProcKHR;", (void *) android_glGetDebugMessageCallbackKHR },
   1458 {"glMinSampleShadingOES", "(F)V", (void *) android_glMinSampleShadingOES__F },
   1459 {"glTexStorage3DMultisampleOES", "(IIIIIIZ)V", (void *) android_glTexStorage3DMultisampleOES__IIIIIIZ },
   1460 {"glCopyImageSubDataEXT", "(IIIIIIIIIIIIIII)V", (void *) android_glCopyImageSubDataEXT__IIIIIIIIIIIIIII },
   1461 {"glEnableiEXT", "(II)V", (void *) android_glEnableiEXT__II },
   1462 {"glDisableiEXT", "(II)V", (void *) android_glDisableiEXT__II },
   1463 {"glBlendEquationiEXT", "(II)V", (void *) android_glBlendEquationiEXT__II },
   1464 {"glBlendEquationSeparateiEXT", "(III)V", (void *) android_glBlendEquationSeparateiEXT__III },
   1465 {"glBlendFunciEXT", "(III)V", (void *) android_glBlendFunciEXT__III },
   1466 {"glBlendFuncSeparateiEXT", "(IIIII)V", (void *) android_glBlendFuncSeparateiEXT__IIIII },
   1467 {"glColorMaskiEXT", "(IZZZZ)V", (void *) android_glColorMaskiEXT__IZZZZ },
   1468 {"glIsEnablediEXT", "(II)Z", (void *) android_glIsEnablediEXT__II },
   1469 {"glFramebufferTextureEXT", "(IIII)V", (void *) android_glFramebufferTextureEXT__IIII },
   1470 {"glPrimitiveBoundingBoxEXT", "(FFFFFFFF)V", (void *) android_glPrimitiveBoundingBoxEXT__FFFFFFFF },
   1471 {"glPatchParameteriEXT", "(II)V", (void *) android_glPatchParameteriEXT__II },
   1472 {"glTexParameterIivEXT", "(II[II)V", (void *) android_glTexParameterIivEXT__II_3II },
   1473 {"glTexParameterIivEXT", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameterIivEXT__IILjava_nio_IntBuffer_2 },
   1474 {"glTexParameterIuivEXT", "(II[II)V", (void *) android_glTexParameterIuivEXT__II_3II },
   1475 {"glTexParameterIuivEXT", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameterIuivEXT__IILjava_nio_IntBuffer_2 },
   1476 {"glGetTexParameterIivEXT", "(II[II)V", (void *) android_glGetTexParameterIivEXT__II_3II },
   1477 {"glGetTexParameterIivEXT", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameterIivEXT__IILjava_nio_IntBuffer_2 },
   1478 {"glGetTexParameterIuivEXT", "(II[II)V", (void *) android_glGetTexParameterIuivEXT__II_3II },
   1479 {"glGetTexParameterIuivEXT", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameterIuivEXT__IILjava_nio_IntBuffer_2 },
   1480 {"glSamplerParameterIivEXT", "(II[II)V", (void *) android_glSamplerParameterIivEXT__II_3II },
   1481 {"glSamplerParameterIivEXT", "(IILjava/nio/IntBuffer;)V", (void *) android_glSamplerParameterIivEXT__IILjava_nio_IntBuffer_2 },
   1482 {"glSamplerParameterIuivEXT", "(II[II)V", (void *) android_glSamplerParameterIuivEXT__II_3II },
   1483 {"glSamplerParameterIuivEXT", "(IILjava/nio/IntBuffer;)V", (void *) android_glSamplerParameterIuivEXT__IILjava_nio_IntBuffer_2 },
   1484 {"glGetSamplerParameterIivEXT", "(II[II)V", (void *) android_glGetSamplerParameterIivEXT__II_3II },
   1485 {"glGetSamplerParameterIivEXT", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetSamplerParameterIivEXT__IILjava_nio_IntBuffer_2 },
   1486 {"glGetSamplerParameterIuivEXT", "(II[II)V", (void *) android_glGetSamplerParameterIuivEXT__II_3II },
   1487 {"glGetSamplerParameterIuivEXT", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetSamplerParameterIuivEXT__IILjava_nio_IntBuffer_2 },
   1488 {"glTexBufferEXT", "(III)V", (void *) android_glTexBufferEXT__III },
   1489 {"glTexBufferRangeEXT", "(IIIII)V", (void *) android_glTexBufferRangeEXT__IIIII },
   1490 };
   1491 
   1492 int register_android_opengl_jni_GLES31Ext(JNIEnv *_env)
   1493 {
   1494     int err;
   1495     err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
   1496     return err;
   1497 }
   1498