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         _exception = 1;
    651         _exceptionType = "java/lang/IllegalArgumentException";
    652         _exceptionMessage = "label == null";
    653         goto exit;
    654     }
    655     _nativelabel = _env->GetStringUTFChars(label, 0);
    656 
    657     glObjectLabelKHR(
    658         (GLenum)identifier,
    659         (GLuint)name,
    660         (GLsizei)length,
    661         (GLchar *)_nativelabel
    662     );
    663 
    664 exit:
    665     if (_nativelabel) {
    666         _env->ReleaseStringUTFChars(label, _nativelabel);
    667     }
    668 
    669     if (_exception) {
    670         jniThrowException(_env, _exceptionType, _exceptionMessage);
    671     }
    672 }
    673 
    674 /* void glGetObjectLabelKHR ( GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label ) */
    675 static jstring
    676 android_glGetObjectLabelKHR(JNIEnv *_env, jobject _this, jint identifier, jint name) {
    677     jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
    678     return NULL;
    679 }
    680 
    681 /* void glObjectPtrLabelKHR ( const void *ptr, GLsizei length, const GLchar *label ) */
    682 static void
    683 android_glObjectPtrLabelKHR(JNIEnv *_env, jobject _this, jlong ptr, jstring label) {
    684     jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
    685 }
    686 
    687 /* void glGetObjectPtrLabelKHR ( const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label ) */
    688 static jstring
    689 android_glGetObjectPtrLabelKHR(JNIEnv *_env, jobject _this, jlong ptr) {
    690     jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
    691     return NULL;
    692 }
    693 
    694 /* void glGetPointervKHR ( GLenum pname, void **params ) */
    695 static jobject
    696 android_glGetDebugMessageCallbackKHR(JNIEnv *_env, jobject _this) {
    697     jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
    698     return NULL;
    699 }
    700 
    701 /* void glMinSampleShadingOES ( GLfloat value ) */
    702 static void
    703 android_glMinSampleShadingOES__F
    704   (JNIEnv *_env, jobject _this, jfloat value) {
    705     glMinSampleShadingOES(
    706         (GLfloat)value
    707     );
    708 }
    709 
    710 /* void glTexStorage3DMultisampleOES ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations ) */
    711 static void
    712 android_glTexStorage3DMultisampleOES__IIIIIIZ
    713   (JNIEnv *_env, jobject _this, jint target, jint samples, jint internalformat, jint width, jint height, jint depth, jboolean fixedsamplelocations) {
    714     glTexStorage3DMultisampleOES(
    715         (GLenum)target,
    716         (GLsizei)samples,
    717         (GLenum)internalformat,
    718         (GLsizei)width,
    719         (GLsizei)height,
    720         (GLsizei)depth,
    721         (GLboolean)fixedsamplelocations
    722     );
    723 }
    724 
    725 /* 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 ) */
    726 static void
    727 android_glCopyImageSubDataEXT__IIIIIIIIIIIIIII
    728   (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) {
    729     glCopyImageSubDataEXT(
    730         (GLuint)srcName,
    731         (GLenum)srcTarget,
    732         (GLint)srcLevel,
    733         (GLint)srcX,
    734         (GLint)srcY,
    735         (GLint)srcZ,
    736         (GLuint)dstName,
    737         (GLenum)dstTarget,
    738         (GLint)dstLevel,
    739         (GLint)dstX,
    740         (GLint)dstY,
    741         (GLint)dstZ,
    742         (GLsizei)srcWidth,
    743         (GLsizei)srcHeight,
    744         (GLsizei)srcDepth
    745     );
    746 }
    747 
    748 /* void glEnableiEXT ( GLenum target, GLuint index ) */
    749 static void
    750 android_glEnableiEXT__II
    751   (JNIEnv *_env, jobject _this, jint target, jint index) {
    752     glEnableiEXT(
    753         (GLenum)target,
    754         (GLuint)index
    755     );
    756 }
    757 
    758 /* void glDisableiEXT ( GLenum target, GLuint index ) */
    759 static void
    760 android_glDisableiEXT__II
    761   (JNIEnv *_env, jobject _this, jint target, jint index) {
    762     glDisableiEXT(
    763         (GLenum)target,
    764         (GLuint)index
    765     );
    766 }
    767 
    768 /* void glBlendEquationiEXT ( GLuint buf, GLenum mode ) */
    769 static void
    770 android_glBlendEquationiEXT__II
    771   (JNIEnv *_env, jobject _this, jint buf, jint mode) {
    772     glBlendEquationiEXT(
    773         (GLuint)buf,
    774         (GLenum)mode
    775     );
    776 }
    777 
    778 /* void glBlendEquationSeparateiEXT ( GLuint buf, GLenum modeRGB, GLenum modeAlpha ) */
    779 static void
    780 android_glBlendEquationSeparateiEXT__III
    781   (JNIEnv *_env, jobject _this, jint buf, jint modeRGB, jint modeAlpha) {
    782     glBlendEquationSeparateiEXT(
    783         (GLuint)buf,
    784         (GLenum)modeRGB,
    785         (GLenum)modeAlpha
    786     );
    787 }
    788 
    789 /* void glBlendFunciEXT ( GLuint buf, GLenum src, GLenum dst ) */
    790 static void
    791 android_glBlendFunciEXT__III
    792   (JNIEnv *_env, jobject _this, jint buf, jint src, jint dst) {
    793     glBlendFunciEXT(
    794         (GLuint)buf,
    795         (GLenum)src,
    796         (GLenum)dst
    797     );
    798 }
    799 
    800 /* void glBlendFuncSeparateiEXT ( GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) */
    801 static void
    802 android_glBlendFuncSeparateiEXT__IIIII
    803   (JNIEnv *_env, jobject _this, jint buf, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) {
    804     glBlendFuncSeparateiEXT(
    805         (GLuint)buf,
    806         (GLenum)srcRGB,
    807         (GLenum)dstRGB,
    808         (GLenum)srcAlpha,
    809         (GLenum)dstAlpha
    810     );
    811 }
    812 
    813 /* void glColorMaskiEXT ( GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) */
    814 static void
    815 android_glColorMaskiEXT__IZZZZ
    816   (JNIEnv *_env, jobject _this, jint index, jboolean r, jboolean g, jboolean b, jboolean a) {
    817     glColorMaskiEXT(
    818         (GLuint)index,
    819         (GLboolean)r,
    820         (GLboolean)g,
    821         (GLboolean)b,
    822         (GLboolean)a
    823     );
    824 }
    825 
    826 /* GLboolean glIsEnablediEXT ( GLenum target, GLuint index ) */
    827 static jboolean
    828 android_glIsEnablediEXT__II
    829   (JNIEnv *_env, jobject _this, jint target, jint index) {
    830     GLboolean _returnValue;
    831     _returnValue = glIsEnablediEXT(
    832         (GLenum)target,
    833         (GLuint)index
    834     );
    835     return (jboolean)_returnValue;
    836 }
    837 
    838 /* void glFramebufferTextureEXT ( GLenum target, GLenum attachment, GLuint texture, GLint level ) */
    839 static void
    840 android_glFramebufferTextureEXT__IIII
    841   (JNIEnv *_env, jobject _this, jint target, jint attachment, jint texture, jint level) {
    842     glFramebufferTextureEXT(
    843         (GLenum)target,
    844         (GLenum)attachment,
    845         (GLuint)texture,
    846         (GLint)level
    847     );
    848 }
    849 
    850 /* void glPrimitiveBoundingBoxEXT ( GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW ) */
    851 static void
    852 android_glPrimitiveBoundingBoxEXT__FFFFFFFF
    853   (JNIEnv *_env, jobject _this, jfloat minX, jfloat minY, jfloat minZ, jfloat minW, jfloat maxX, jfloat maxY, jfloat maxZ, jfloat maxW) {
    854     glPrimitiveBoundingBoxEXT(
    855         (GLfloat)minX,
    856         (GLfloat)minY,
    857         (GLfloat)minZ,
    858         (GLfloat)minW,
    859         (GLfloat)maxX,
    860         (GLfloat)maxY,
    861         (GLfloat)maxZ,
    862         (GLfloat)maxW
    863     );
    864 }
    865 
    866 /* void glPatchParameteriEXT ( GLenum pname, GLint value ) */
    867 static void
    868 android_glPatchParameteriEXT__II
    869   (JNIEnv *_env, jobject _this, jint pname, jint value) {
    870     glPatchParameteriEXT(
    871         (GLenum)pname,
    872         (GLint)value
    873     );
    874 }
    875 
    876 /* void glTexParameterIivEXT ( GLenum target, GLenum pname, const GLint *params ) */
    877 static void
    878 android_glTexParameterIivEXT__II_3II
    879   (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
    880     jint _exception = 0;
    881     const char * _exceptionType = NULL;
    882     const char * _exceptionMessage = NULL;
    883     GLint *params_base = (GLint *) 0;
    884     jint _remaining;
    885     GLint *params = (GLint *) 0;
    886 
    887     if (!params_ref) {
    888         _exception = 1;
    889         _exceptionType = "java/lang/IllegalArgumentException";
    890         _exceptionMessage = "params == null";
    891         goto exit;
    892     }
    893     if (offset < 0) {
    894         _exception = 1;
    895         _exceptionType = "java/lang/IllegalArgumentException";
    896         _exceptionMessage = "offset < 0";
    897         goto exit;
    898     }
    899     _remaining = _env->GetArrayLength(params_ref) - offset;
    900     params_base = (GLint *)
    901         _env->GetIntArrayElements(params_ref, (jboolean *)0);
    902     params = params_base + offset;
    903 
    904     glTexParameterIivEXT(
    905         (GLenum)target,
    906         (GLenum)pname,
    907         (GLint *)params
    908     );
    909 
    910 exit:
    911     if (params_base) {
    912         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
    913             JNI_ABORT);
    914     }
    915     if (_exception) {
    916         jniThrowException(_env, _exceptionType, _exceptionMessage);
    917     }
    918 }
    919 
    920 /* void glTexParameterIivEXT ( GLenum target, GLenum pname, const GLint *params ) */
    921 static void
    922 android_glTexParameterIivEXT__IILjava_nio_IntBuffer_2
    923   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
    924     jintArray _array = (jintArray) 0;
    925     jint _bufferOffset = (jint) 0;
    926     jint _remaining;
    927     GLint *params = (GLint *) 0;
    928 
    929     params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
    930     if (params == NULL) {
    931         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
    932         params = (GLint *) (_paramsBase + _bufferOffset);
    933     }
    934     glTexParameterIivEXT(
    935         (GLenum)target,
    936         (GLenum)pname,
    937         (GLint *)params
    938     );
    939     if (_array) {
    940         _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
    941     }
    942 }
    943 
    944 /* void glTexParameterIuivEXT ( GLenum target, GLenum pname, const GLuint *params ) */
    945 static void
    946 android_glTexParameterIuivEXT__II_3II
    947   (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
    948     jint _exception = 0;
    949     const char * _exceptionType = NULL;
    950     const char * _exceptionMessage = NULL;
    951     GLuint *params_base = (GLuint *) 0;
    952     jint _remaining;
    953     GLuint *params = (GLuint *) 0;
    954 
    955     if (!params_ref) {
    956         _exception = 1;
    957         _exceptionType = "java/lang/IllegalArgumentException";
    958         _exceptionMessage = "params == null";
    959         goto exit;
    960     }
    961     if (offset < 0) {
    962         _exception = 1;
    963         _exceptionType = "java/lang/IllegalArgumentException";
    964         _exceptionMessage = "offset < 0";
    965         goto exit;
    966     }
    967     _remaining = _env->GetArrayLength(params_ref) - offset;
    968     params_base = (GLuint *)
    969         _env->GetIntArrayElements(params_ref, (jboolean *)0);
    970     params = params_base + offset;
    971 
    972     glTexParameterIuivEXT(
    973         (GLenum)target,
    974         (GLenum)pname,
    975         (GLuint *)params
    976     );
    977 
    978 exit:
    979     if (params_base) {
    980         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
    981             JNI_ABORT);
    982     }
    983     if (_exception) {
    984         jniThrowException(_env, _exceptionType, _exceptionMessage);
    985     }
    986 }
    987 
    988 /* void glTexParameterIuivEXT ( GLenum target, GLenum pname, const GLuint *params ) */
    989 static void
    990 android_glTexParameterIuivEXT__IILjava_nio_IntBuffer_2
    991   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
    992     jintArray _array = (jintArray) 0;
    993     jint _bufferOffset = (jint) 0;
    994     jint _remaining;
    995     GLuint *params = (GLuint *) 0;
    996 
    997     params = (GLuint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
    998     if (params == NULL) {
    999         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
   1000         params = (GLuint *) (_paramsBase + _bufferOffset);
   1001     }
   1002     glTexParameterIuivEXT(
   1003         (GLenum)target,
   1004         (GLenum)pname,
   1005         (GLuint *)params
   1006     );
   1007     if (_array) {
   1008         _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
   1009     }
   1010 }
   1011 
   1012 /* void glGetTexParameterIivEXT ( GLenum target, GLenum pname, GLint *params ) */
   1013 static void
   1014 android_glGetTexParameterIivEXT__II_3II
   1015   (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
   1016     jint _exception = 0;
   1017     const char * _exceptionType = NULL;
   1018     const char * _exceptionMessage = NULL;
   1019     GLint *params_base = (GLint *) 0;
   1020     jint _remaining;
   1021     GLint *params = (GLint *) 0;
   1022 
   1023     if (!params_ref) {
   1024         _exception = 1;
   1025         _exceptionType = "java/lang/IllegalArgumentException";
   1026         _exceptionMessage = "params == null";
   1027         goto exit;
   1028     }
   1029     if (offset < 0) {
   1030         _exception = 1;
   1031         _exceptionType = "java/lang/IllegalArgumentException";
   1032         _exceptionMessage = "offset < 0";
   1033         goto exit;
   1034     }
   1035     _remaining = _env->GetArrayLength(params_ref) - offset;
   1036     params_base = (GLint *)
   1037         _env->GetIntArrayElements(params_ref, (jboolean *)0);
   1038     params = params_base + offset;
   1039 
   1040     glGetTexParameterIivEXT(
   1041         (GLenum)target,
   1042         (GLenum)pname,
   1043         (GLint *)params
   1044     );
   1045 
   1046 exit:
   1047     if (params_base) {
   1048         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
   1049             _exception ? JNI_ABORT: 0);
   1050     }
   1051     if (_exception) {
   1052         jniThrowException(_env, _exceptionType, _exceptionMessage);
   1053     }
   1054 }
   1055 
   1056 /* void glGetTexParameterIivEXT ( GLenum target, GLenum pname, GLint *params ) */
   1057 static void
   1058 android_glGetTexParameterIivEXT__IILjava_nio_IntBuffer_2
   1059   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
   1060     jintArray _array = (jintArray) 0;
   1061     jint _bufferOffset = (jint) 0;
   1062     jint _remaining;
   1063     GLint *params = (GLint *) 0;
   1064 
   1065     params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
   1066     if (params == NULL) {
   1067         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
   1068         params = (GLint *) (_paramsBase + _bufferOffset);
   1069     }
   1070     glGetTexParameterIivEXT(
   1071         (GLenum)target,
   1072         (GLenum)pname,
   1073         (GLint *)params
   1074     );
   1075     if (_array) {
   1076         _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
   1077     }
   1078 }
   1079 
   1080 /* void glGetTexParameterIuivEXT ( GLenum target, GLenum pname, GLuint *params ) */
   1081 static void
   1082 android_glGetTexParameterIuivEXT__II_3II
   1083   (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
   1084     jint _exception = 0;
   1085     const char * _exceptionType = NULL;
   1086     const char * _exceptionMessage = NULL;
   1087     GLuint *params_base = (GLuint *) 0;
   1088     jint _remaining;
   1089     GLuint *params = (GLuint *) 0;
   1090 
   1091     if (!params_ref) {
   1092         _exception = 1;
   1093         _exceptionType = "java/lang/IllegalArgumentException";
   1094         _exceptionMessage = "params == null";
   1095         goto exit;
   1096     }
   1097     if (offset < 0) {
   1098         _exception = 1;
   1099         _exceptionType = "java/lang/IllegalArgumentException";
   1100         _exceptionMessage = "offset < 0";
   1101         goto exit;
   1102     }
   1103     _remaining = _env->GetArrayLength(params_ref) - offset;
   1104     params_base = (GLuint *)
   1105         _env->GetIntArrayElements(params_ref, (jboolean *)0);
   1106     params = params_base + offset;
   1107 
   1108     glGetTexParameterIuivEXT(
   1109         (GLenum)target,
   1110         (GLenum)pname,
   1111         (GLuint *)params
   1112     );
   1113 
   1114 exit:
   1115     if (params_base) {
   1116         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
   1117             _exception ? JNI_ABORT: 0);
   1118     }
   1119     if (_exception) {
   1120         jniThrowException(_env, _exceptionType, _exceptionMessage);
   1121     }
   1122 }
   1123 
   1124 /* void glGetTexParameterIuivEXT ( GLenum target, GLenum pname, GLuint *params ) */
   1125 static void
   1126 android_glGetTexParameterIuivEXT__IILjava_nio_IntBuffer_2
   1127   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
   1128     jintArray _array = (jintArray) 0;
   1129     jint _bufferOffset = (jint) 0;
   1130     jint _remaining;
   1131     GLuint *params = (GLuint *) 0;
   1132 
   1133     params = (GLuint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
   1134     if (params == NULL) {
   1135         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
   1136         params = (GLuint *) (_paramsBase + _bufferOffset);
   1137     }
   1138     glGetTexParameterIuivEXT(
   1139         (GLenum)target,
   1140         (GLenum)pname,
   1141         (GLuint *)params
   1142     );
   1143     if (_array) {
   1144         _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
   1145     }
   1146 }
   1147 
   1148 /* void glSamplerParameterIivEXT ( GLuint sampler, GLenum pname, const GLint *param ) */
   1149 static void
   1150 android_glSamplerParameterIivEXT__II_3II
   1151   (JNIEnv *_env, jobject _this, jint sampler, jint pname, jintArray param_ref, jint offset) {
   1152     jint _exception = 0;
   1153     const char * _exceptionType = NULL;
   1154     const char * _exceptionMessage = NULL;
   1155     GLint *param_base = (GLint *) 0;
   1156     jint _remaining;
   1157     GLint *param = (GLint *) 0;
   1158 
   1159     if (!param_ref) {
   1160         _exception = 1;
   1161         _exceptionType = "java/lang/IllegalArgumentException";
   1162         _exceptionMessage = "param == null";
   1163         goto exit;
   1164     }
   1165     if (offset < 0) {
   1166         _exception = 1;
   1167         _exceptionType = "java/lang/IllegalArgumentException";
   1168         _exceptionMessage = "offset < 0";
   1169         goto exit;
   1170     }
   1171     _remaining = _env->GetArrayLength(param_ref) - offset;
   1172     param_base = (GLint *)
   1173         _env->GetIntArrayElements(param_ref, (jboolean *)0);
   1174     param = param_base + offset;
   1175 
   1176     glSamplerParameterIivEXT(
   1177         (GLuint)sampler,
   1178         (GLenum)pname,
   1179         (GLint *)param
   1180     );
   1181 
   1182 exit:
   1183     if (param_base) {
   1184         _env->ReleaseIntArrayElements(param_ref, (jint*)param_base,
   1185             JNI_ABORT);
   1186     }
   1187     if (_exception) {
   1188         jniThrowException(_env, _exceptionType, _exceptionMessage);
   1189     }
   1190 }
   1191 
   1192 /* void glSamplerParameterIivEXT ( GLuint sampler, GLenum pname, const GLint *param ) */
   1193 static void
   1194 android_glSamplerParameterIivEXT__IILjava_nio_IntBuffer_2
   1195   (JNIEnv *_env, jobject _this, jint sampler, jint pname, jobject param_buf) {
   1196     jintArray _array = (jintArray) 0;
   1197     jint _bufferOffset = (jint) 0;
   1198     jint _remaining;
   1199     GLint *param = (GLint *) 0;
   1200 
   1201     param = (GLint *)getPointer(_env, param_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
   1202     if (param == NULL) {
   1203         char * _paramBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
   1204         param = (GLint *) (_paramBase + _bufferOffset);
   1205     }
   1206     glSamplerParameterIivEXT(
   1207         (GLuint)sampler,
   1208         (GLenum)pname,
   1209         (GLint *)param
   1210     );
   1211     if (_array) {
   1212         _env->ReleaseIntArrayElements(_array, (jint*)param, JNI_ABORT);
   1213     }
   1214 }
   1215 
   1216 /* void glSamplerParameterIuivEXT ( GLuint sampler, GLenum pname, const GLuint *param ) */
   1217 static void
   1218 android_glSamplerParameterIuivEXT__II_3II
   1219   (JNIEnv *_env, jobject _this, jint sampler, jint pname, jintArray param_ref, jint offset) {
   1220     jint _exception = 0;
   1221     const char * _exceptionType = NULL;
   1222     const char * _exceptionMessage = NULL;
   1223     GLuint *param_base = (GLuint *) 0;
   1224     jint _remaining;
   1225     GLuint *param = (GLuint *) 0;
   1226 
   1227     if (!param_ref) {
   1228         _exception = 1;
   1229         _exceptionType = "java/lang/IllegalArgumentException";
   1230         _exceptionMessage = "param == null";
   1231         goto exit;
   1232     }
   1233     if (offset < 0) {
   1234         _exception = 1;
   1235         _exceptionType = "java/lang/IllegalArgumentException";
   1236         _exceptionMessage = "offset < 0";
   1237         goto exit;
   1238     }
   1239     _remaining = _env->GetArrayLength(param_ref) - offset;
   1240     param_base = (GLuint *)
   1241         _env->GetIntArrayElements(param_ref, (jboolean *)0);
   1242     param = param_base + offset;
   1243 
   1244     glSamplerParameterIuivEXT(
   1245         (GLuint)sampler,
   1246         (GLenum)pname,
   1247         (GLuint *)param
   1248     );
   1249 
   1250 exit:
   1251     if (param_base) {
   1252         _env->ReleaseIntArrayElements(param_ref, (jint*)param_base,
   1253             JNI_ABORT);
   1254     }
   1255     if (_exception) {
   1256         jniThrowException(_env, _exceptionType, _exceptionMessage);
   1257     }
   1258 }
   1259 
   1260 /* void glSamplerParameterIuivEXT ( GLuint sampler, GLenum pname, const GLuint *param ) */
   1261 static void
   1262 android_glSamplerParameterIuivEXT__IILjava_nio_IntBuffer_2
   1263   (JNIEnv *_env, jobject _this, jint sampler, jint pname, jobject param_buf) {
   1264     jintArray _array = (jintArray) 0;
   1265     jint _bufferOffset = (jint) 0;
   1266     jint _remaining;
   1267     GLuint *param = (GLuint *) 0;
   1268 
   1269     param = (GLuint *)getPointer(_env, param_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
   1270     if (param == NULL) {
   1271         char * _paramBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
   1272         param = (GLuint *) (_paramBase + _bufferOffset);
   1273     }
   1274     glSamplerParameterIuivEXT(
   1275         (GLuint)sampler,
   1276         (GLenum)pname,
   1277         (GLuint *)param
   1278     );
   1279     if (_array) {
   1280         _env->ReleaseIntArrayElements(_array, (jint*)param, JNI_ABORT);
   1281     }
   1282 }
   1283 
   1284 /* void glGetSamplerParameterIivEXT ( GLuint sampler, GLenum pname, GLint *params ) */
   1285 static void
   1286 android_glGetSamplerParameterIivEXT__II_3II
   1287   (JNIEnv *_env, jobject _this, jint sampler, jint pname, jintArray params_ref, jint offset) {
   1288     jint _exception = 0;
   1289     const char * _exceptionType = NULL;
   1290     const char * _exceptionMessage = NULL;
   1291     GLint *params_base = (GLint *) 0;
   1292     jint _remaining;
   1293     GLint *params = (GLint *) 0;
   1294 
   1295     if (!params_ref) {
   1296         _exception = 1;
   1297         _exceptionType = "java/lang/IllegalArgumentException";
   1298         _exceptionMessage = "params == null";
   1299         goto exit;
   1300     }
   1301     if (offset < 0) {
   1302         _exception = 1;
   1303         _exceptionType = "java/lang/IllegalArgumentException";
   1304         _exceptionMessage = "offset < 0";
   1305         goto exit;
   1306     }
   1307     _remaining = _env->GetArrayLength(params_ref) - offset;
   1308     params_base = (GLint *)
   1309         _env->GetIntArrayElements(params_ref, (jboolean *)0);
   1310     params = params_base + offset;
   1311 
   1312     glGetSamplerParameterIivEXT(
   1313         (GLuint)sampler,
   1314         (GLenum)pname,
   1315         (GLint *)params
   1316     );
   1317 
   1318 exit:
   1319     if (params_base) {
   1320         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
   1321             _exception ? JNI_ABORT: 0);
   1322     }
   1323     if (_exception) {
   1324         jniThrowException(_env, _exceptionType, _exceptionMessage);
   1325     }
   1326 }
   1327 
   1328 /* void glGetSamplerParameterIivEXT ( GLuint sampler, GLenum pname, GLint *params ) */
   1329 static void
   1330 android_glGetSamplerParameterIivEXT__IILjava_nio_IntBuffer_2
   1331   (JNIEnv *_env, jobject _this, jint sampler, jint pname, jobject params_buf) {
   1332     jintArray _array = (jintArray) 0;
   1333     jint _bufferOffset = (jint) 0;
   1334     jint _remaining;
   1335     GLint *params = (GLint *) 0;
   1336 
   1337     params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
   1338     if (params == NULL) {
   1339         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
   1340         params = (GLint *) (_paramsBase + _bufferOffset);
   1341     }
   1342     glGetSamplerParameterIivEXT(
   1343         (GLuint)sampler,
   1344         (GLenum)pname,
   1345         (GLint *)params
   1346     );
   1347     if (_array) {
   1348         _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
   1349     }
   1350 }
   1351 
   1352 /* void glGetSamplerParameterIuivEXT ( GLuint sampler, GLenum pname, GLuint *params ) */
   1353 static void
   1354 android_glGetSamplerParameterIuivEXT__II_3II
   1355   (JNIEnv *_env, jobject _this, jint sampler, jint pname, jintArray params_ref, jint offset) {
   1356     jint _exception = 0;
   1357     const char * _exceptionType = NULL;
   1358     const char * _exceptionMessage = NULL;
   1359     GLuint *params_base = (GLuint *) 0;
   1360     jint _remaining;
   1361     GLuint *params = (GLuint *) 0;
   1362 
   1363     if (!params_ref) {
   1364         _exception = 1;
   1365         _exceptionType = "java/lang/IllegalArgumentException";
   1366         _exceptionMessage = "params == null";
   1367         goto exit;
   1368     }
   1369     if (offset < 0) {
   1370         _exception = 1;
   1371         _exceptionType = "java/lang/IllegalArgumentException";
   1372         _exceptionMessage = "offset < 0";
   1373         goto exit;
   1374     }
   1375     _remaining = _env->GetArrayLength(params_ref) - offset;
   1376     params_base = (GLuint *)
   1377         _env->GetIntArrayElements(params_ref, (jboolean *)0);
   1378     params = params_base + offset;
   1379 
   1380     glGetSamplerParameterIuivEXT(
   1381         (GLuint)sampler,
   1382         (GLenum)pname,
   1383         (GLuint *)params
   1384     );
   1385 
   1386 exit:
   1387     if (params_base) {
   1388         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
   1389             _exception ? JNI_ABORT: 0);
   1390     }
   1391     if (_exception) {
   1392         jniThrowException(_env, _exceptionType, _exceptionMessage);
   1393     }
   1394 }
   1395 
   1396 /* void glGetSamplerParameterIuivEXT ( GLuint sampler, GLenum pname, GLuint *params ) */
   1397 static void
   1398 android_glGetSamplerParameterIuivEXT__IILjava_nio_IntBuffer_2
   1399   (JNIEnv *_env, jobject _this, jint sampler, jint pname, jobject params_buf) {
   1400     jintArray _array = (jintArray) 0;
   1401     jint _bufferOffset = (jint) 0;
   1402     jint _remaining;
   1403     GLuint *params = (GLuint *) 0;
   1404 
   1405     params = (GLuint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
   1406     if (params == NULL) {
   1407         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
   1408         params = (GLuint *) (_paramsBase + _bufferOffset);
   1409     }
   1410     glGetSamplerParameterIuivEXT(
   1411         (GLuint)sampler,
   1412         (GLenum)pname,
   1413         (GLuint *)params
   1414     );
   1415     if (_array) {
   1416         _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
   1417     }
   1418 }
   1419 
   1420 /* void glTexBufferEXT ( GLenum target, GLenum internalformat, GLuint buffer ) */
   1421 static void
   1422 android_glTexBufferEXT__III
   1423   (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint buffer) {
   1424     glTexBufferEXT(
   1425         (GLenum)target,
   1426         (GLenum)internalformat,
   1427         (GLuint)buffer
   1428     );
   1429 }
   1430 
   1431 /* void glTexBufferRangeEXT ( GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size ) */
   1432 static void
   1433 android_glTexBufferRangeEXT__IIIII
   1434   (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint buffer, jint offset, jint size) {
   1435     glTexBufferRangeEXT(
   1436         (GLenum)target,
   1437         (GLenum)internalformat,
   1438         (GLuint)buffer,
   1439         (GLintptr)offset,
   1440         (GLsizeiptr)size
   1441     );
   1442 }
   1443 
   1444 static const char *classPathName = "android/opengl/GLES31Ext";
   1445 
   1446 static JNINativeMethod methods[] = {
   1447 {"_nativeClassInit", "()V", (void*)nativeClassInit },
   1448 {"glBlendBarrierKHR", "()V", (void *) android_glBlendBarrierKHR__ },
   1449 {"glDebugMessageControlKHR", "(IIII[IIZ)V", (void *) android_glDebugMessageControlKHR__IIII_3IIZ },
   1450 {"glDebugMessageControlKHR", "(IIIILjava/nio/IntBuffer;Z)V", (void *) android_glDebugMessageControlKHR__IIIILjava_nio_IntBuffer_2Z },
   1451 {"glDebugMessageInsertKHR", "(IIIILjava/lang/String;)V", (void *) android_glDebugMessageInsertKHR__IIIILjava_lang_String_2 },
   1452 {"glDebugMessageCallbackKHR", "(Landroid/opengl/GLES31Ext$DebugProcKHR;)V", (void *) android_glDebugMessageCallbackKHR },
   1453 {"glGetDebugMessageLogKHR", "(II[II[II[II[II[II[BI)I", (void *) android_glGetDebugMessageLogKHR__II_3II_3II_3II_3II_3II_3BI },
   1454 {"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 },
   1455 {"glGetDebugMessageLogKHR", "(I[II[II[II[II)[Ljava/lang/String;", (void *) android_glGetDebugMessageLogKHR__I_3II_3II_3II_3II },
   1456 {"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 },
   1457 {"glPushDebugGroupKHR", "(IIILjava/lang/String;)V", (void *) android_glPushDebugGroupKHR__IIILjava_lang_String_2 },
   1458 {"glPopDebugGroupKHR", "()V", (void *) android_glPopDebugGroupKHR__ },
   1459 {"glObjectLabelKHR", "(IIILjava/lang/String;)V", (void *) android_glObjectLabelKHR__IIILjava_lang_String_2 },
   1460 {"glGetObjectLabelKHR", "(II)Ljava/lang/String;", (void *) android_glGetObjectLabelKHR },
   1461 {"glObjectPtrLabelKHR", "(JLjava/lang/String;)V", (void *) android_glObjectPtrLabelKHR },
   1462 {"glGetObjectPtrLabelKHR", "(J)Ljava/lang/String;", (void *) android_glGetObjectPtrLabelKHR },
   1463 {"glGetDebugMessageCallbackKHR", "()Landroid/opengl/GLES31Ext$DebugProcKHR;", (void *) android_glGetDebugMessageCallbackKHR },
   1464 {"glMinSampleShadingOES", "(F)V", (void *) android_glMinSampleShadingOES__F },
   1465 {"glTexStorage3DMultisampleOES", "(IIIIIIZ)V", (void *) android_glTexStorage3DMultisampleOES__IIIIIIZ },
   1466 {"glCopyImageSubDataEXT", "(IIIIIIIIIIIIIII)V", (void *) android_glCopyImageSubDataEXT__IIIIIIIIIIIIIII },
   1467 {"glEnableiEXT", "(II)V", (void *) android_glEnableiEXT__II },
   1468 {"glDisableiEXT", "(II)V", (void *) android_glDisableiEXT__II },
   1469 {"glBlendEquationiEXT", "(II)V", (void *) android_glBlendEquationiEXT__II },
   1470 {"glBlendEquationSeparateiEXT", "(III)V", (void *) android_glBlendEquationSeparateiEXT__III },
   1471 {"glBlendFunciEXT", "(III)V", (void *) android_glBlendFunciEXT__III },
   1472 {"glBlendFuncSeparateiEXT", "(IIIII)V", (void *) android_glBlendFuncSeparateiEXT__IIIII },
   1473 {"glColorMaskiEXT", "(IZZZZ)V", (void *) android_glColorMaskiEXT__IZZZZ },
   1474 {"glIsEnablediEXT", "(II)Z", (void *) android_glIsEnablediEXT__II },
   1475 {"glFramebufferTextureEXT", "(IIII)V", (void *) android_glFramebufferTextureEXT__IIII },
   1476 {"glPrimitiveBoundingBoxEXT", "(FFFFFFFF)V", (void *) android_glPrimitiveBoundingBoxEXT__FFFFFFFF },
   1477 {"glPatchParameteriEXT", "(II)V", (void *) android_glPatchParameteriEXT__II },
   1478 {"glTexParameterIivEXT", "(II[II)V", (void *) android_glTexParameterIivEXT__II_3II },
   1479 {"glTexParameterIivEXT", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameterIivEXT__IILjava_nio_IntBuffer_2 },
   1480 {"glTexParameterIuivEXT", "(II[II)V", (void *) android_glTexParameterIuivEXT__II_3II },
   1481 {"glTexParameterIuivEXT", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameterIuivEXT__IILjava_nio_IntBuffer_2 },
   1482 {"glGetTexParameterIivEXT", "(II[II)V", (void *) android_glGetTexParameterIivEXT__II_3II },
   1483 {"glGetTexParameterIivEXT", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameterIivEXT__IILjava_nio_IntBuffer_2 },
   1484 {"glGetTexParameterIuivEXT", "(II[II)V", (void *) android_glGetTexParameterIuivEXT__II_3II },
   1485 {"glGetTexParameterIuivEXT", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameterIuivEXT__IILjava_nio_IntBuffer_2 },
   1486 {"glSamplerParameterIivEXT", "(II[II)V", (void *) android_glSamplerParameterIivEXT__II_3II },
   1487 {"glSamplerParameterIivEXT", "(IILjava/nio/IntBuffer;)V", (void *) android_glSamplerParameterIivEXT__IILjava_nio_IntBuffer_2 },
   1488 {"glSamplerParameterIuivEXT", "(II[II)V", (void *) android_glSamplerParameterIuivEXT__II_3II },
   1489 {"glSamplerParameterIuivEXT", "(IILjava/nio/IntBuffer;)V", (void *) android_glSamplerParameterIuivEXT__IILjava_nio_IntBuffer_2 },
   1490 {"glGetSamplerParameterIivEXT", "(II[II)V", (void *) android_glGetSamplerParameterIivEXT__II_3II },
   1491 {"glGetSamplerParameterIivEXT", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetSamplerParameterIivEXT__IILjava_nio_IntBuffer_2 },
   1492 {"glGetSamplerParameterIuivEXT", "(II[II)V", (void *) android_glGetSamplerParameterIuivEXT__II_3II },
   1493 {"glGetSamplerParameterIuivEXT", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetSamplerParameterIuivEXT__IILjava_nio_IntBuffer_2 },
   1494 {"glTexBufferEXT", "(III)V", (void *) android_glTexBufferEXT__III },
   1495 {"glTexBufferRangeEXT", "(IIIII)V", (void *) android_glTexBufferRangeEXT__IIIII },
   1496 };
   1497 
   1498 int register_android_opengl_jni_GLES31Ext(JNIEnv *_env)
   1499 {
   1500     int err;
   1501     err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
   1502     return err;
   1503 }
   1504