1/*
2 * Copyright 2015 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-function"
21
22#include <stdint.h>
23#include <GLES3/gl32.h>
24#include <jni.h>
25#include <nativehelper/JNIHelp.h>
26#include <android_runtime/AndroidRuntime.h>
27#include <utils/misc.h>
28#include <assert.h>
29
30static int initialized = 0;
31
32static jclass nioAccessClass;
33static jclass bufferClass;
34static jmethodID getBasePointerID;
35static jmethodID getBaseArrayID;
36static jmethodID getBaseArrayOffsetID;
37static jfieldID positionID;
38static jfieldID limitID;
39static jfieldID elementSizeShiftID;
40
41
42/* special calls implemented in Android's GLES wrapper used to more
43 * efficiently bound-check passed arrays */
44extern "C" {
45#ifdef GL_VERSION_ES_CM_1_1
46GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
47        const GLvoid *ptr, GLsizei count);
48GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
49        const GLvoid *pointer, GLsizei count);
50GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
51        GLsizei stride, const GLvoid *pointer, GLsizei count);
52GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
53        GLsizei stride, const GLvoid *pointer, GLsizei count);
54GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
55        GLsizei stride, const GLvoid *pointer, GLsizei count);
56GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
57        GLsizei stride, const GLvoid *pointer, GLsizei count);
58GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
59        GLsizei stride, const GLvoid *pointer, GLsizei count);
60#endif
61#ifdef GL_ES_VERSION_2_0
62static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type,
63        GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) {
64    glVertexAttribPointer(indx, size, type, normalized, stride, pointer);
65}
66#endif
67#ifdef GL_ES_VERSION_3_0
68static void glVertexAttribIPointerBounds(GLuint indx, GLint size, GLenum type,
69        GLsizei stride, const GLvoid *pointer, GLsizei count) {
70    glVertexAttribIPointer(indx, size, type, stride, pointer);
71}
72#endif
73}
74
75/* Cache method IDs each time the class is loaded. */
76
77static void
78nativeClassInit(JNIEnv *_env, jclass glImplClass)
79{
80    jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
81    nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
82
83    jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
84    bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
85
86    getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
87            "getBasePointer", "(Ljava/nio/Buffer;)J");
88    getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
89            "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
90    getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
91            "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
92
93    positionID = _env->GetFieldID(bufferClass, "position", "I");
94    limitID = _env->GetFieldID(bufferClass, "limit", "I");
95    elementSizeShiftID =
96        _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
97}
98
99static void *
100getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
101{
102    jint position;
103    jint limit;
104    jint elementSizeShift;
105    jlong pointer;
106
107    position = _env->GetIntField(buffer, positionID);
108    limit = _env->GetIntField(buffer, limitID);
109    elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
110    *remaining = (limit - position) << elementSizeShift;
111    pointer = _env->CallStaticLongMethod(nioAccessClass,
112            getBasePointerID, buffer);
113    if (pointer != 0L) {
114        *array = NULL;
115        return reinterpret_cast<void*>(pointer);
116    }
117
118    *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
119            getBaseArrayID, buffer);
120    *offset = _env->CallStaticIntMethod(nioAccessClass,
121            getBaseArrayOffsetID, buffer);
122
123    return NULL;
124}
125
126class ByteArrayGetter {
127public:
128    static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
129        return _env->GetByteArrayElements(array, is_copy);
130    }
131};
132class BooleanArrayGetter {
133public:
134    static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
135        return _env->GetBooleanArrayElements(array, is_copy);
136    }
137};
138class CharArrayGetter {
139public:
140    static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
141        return _env->GetCharArrayElements(array, is_copy);
142    }
143};
144class ShortArrayGetter {
145public:
146    static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
147        return _env->GetShortArrayElements(array, is_copy);
148    }
149};
150class IntArrayGetter {
151public:
152    static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
153        return _env->GetIntArrayElements(array, is_copy);
154    }
155};
156class LongArrayGetter {
157public:
158    static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
159        return _env->GetLongArrayElements(array, is_copy);
160    }
161};
162class FloatArrayGetter {
163public:
164    static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
165        return _env->GetFloatArrayElements(array, is_copy);
166    }
167};
168class DoubleArrayGetter {
169public:
170    static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
171        return _env->GetDoubleArrayElements(array, is_copy);
172    }
173};
174
175template<typename JTYPEARRAY, typename ARRAYGETTER>
176static void*
177getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
178    return ARRAYGETTER::Get(_env, array, is_copy);
179}
180
181class ByteArrayReleaser {
182public:
183    static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
184        _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
185    }
186};
187class BooleanArrayReleaser {
188public:
189    static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
190        _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
191    }
192};
193class CharArrayReleaser {
194public:
195    static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
196        _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
197    }
198};
199class ShortArrayReleaser {
200public:
201    static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
202        _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
203    }
204};
205class IntArrayReleaser {
206public:
207    static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
208        _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
209    }
210};
211class LongArrayReleaser {
212public:
213    static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
214        _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
215    }
216};
217class FloatArrayReleaser {
218public:
219    static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
220        _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
221    }
222};
223class DoubleArrayReleaser {
224public:
225    static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
226        _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
227    }
228};
229
230template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
231static void
232releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
233    ARRAYRELEASER::Release(_env, array, data, commit);
234}
235
236static void
237releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
238{
239    _env->ReleasePrimitiveArrayCritical(array, data,
240                       commit ? 0 : JNI_ABORT);
241}
242
243static void *
244getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
245    char* buf = (char*) _env->GetDirectBufferAddress(buffer);
246    if (buf) {
247        jint position = _env->GetIntField(buffer, positionID);
248        jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
249        buf += position << elementSizeShift;
250    } else {
251        jniThrowException(_env, "java/lang/IllegalArgumentException",
252                          "Must use a native order direct Buffer");
253    }
254    return (void*) buf;
255}
256
257// --------------------------------------------------------------------------
258
259/*
260 * returns the number of values glGet returns for a given pname.
261 *
262 * The code below is written such that pnames requiring only one values
263 * are the default (and are not explicitely tested for). This makes the
264 * checking code much shorter/readable/efficient.
265 *
266 * This means that unknown pnames (e.g.: extensions) will default to 1. If
267 * that unknown pname needs more than 1 value, then the validation check
268 * is incomplete and the app may crash if it passed the wrong number params.
269 */
270static int getNeededCount(GLint pname) {
271    int needed = 1;
272#ifdef GL_ES_VERSION_3_0
273    // GLES 3.x pnames
274    switch (pname) {
275        case GL_MAX_VIEWPORT_DIMS:
276            needed = 2;
277            break;
278
279        case GL_PROGRAM_BINARY_FORMATS:
280            glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &needed);
281            break;
282    }
283#endif
284
285#ifdef GL_ES_VERSION_2_0
286    // GLES 2.x pnames
287    switch (pname) {
288        case GL_ALIASED_LINE_WIDTH_RANGE:
289        case GL_ALIASED_POINT_SIZE_RANGE:
290            needed = 2;
291            break;
292
293        case GL_BLEND_COLOR:
294        case GL_COLOR_CLEAR_VALUE:
295        case GL_COLOR_WRITEMASK:
296        case GL_SCISSOR_BOX:
297        case GL_VIEWPORT:
298            needed = 4;
299            break;
300
301        case GL_COMPRESSED_TEXTURE_FORMATS:
302            glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
303            break;
304
305        case GL_SHADER_BINARY_FORMATS:
306            glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed);
307            break;
308    }
309#endif
310
311#ifdef GL_VERSION_ES_CM_1_1
312    // GLES 1.x pnames
313    switch (pname) {
314        case GL_ALIASED_LINE_WIDTH_RANGE:
315        case GL_ALIASED_POINT_SIZE_RANGE:
316        case GL_DEPTH_RANGE:
317        case GL_SMOOTH_LINE_WIDTH_RANGE:
318        case GL_SMOOTH_POINT_SIZE_RANGE:
319            needed = 2;
320            break;
321
322        case GL_CURRENT_NORMAL:
323        case GL_POINT_DISTANCE_ATTENUATION:
324            needed = 3;
325            break;
326
327        case GL_COLOR_CLEAR_VALUE:
328        case GL_COLOR_WRITEMASK:
329        case GL_CURRENT_COLOR:
330        case GL_CURRENT_TEXTURE_COORDS:
331        case GL_FOG_COLOR:
332        case GL_LIGHT_MODEL_AMBIENT:
333        case GL_SCISSOR_BOX:
334        case GL_VIEWPORT:
335            needed = 4;
336            break;
337
338        case GL_MODELVIEW_MATRIX:
339        case GL_PROJECTION_MATRIX:
340        case GL_TEXTURE_MATRIX:
341            needed = 16;
342            break;
343
344        case GL_COMPRESSED_TEXTURE_FORMATS:
345            glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
346            break;
347    }
348#endif
349    return needed;
350}
351
352template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
353          typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
354static void
355get
356  (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
357    jint _exception = 0;
358    const char * _exceptionType;
359    const char * _exceptionMessage;
360    CTYPE *params_base = (CTYPE *) 0;
361    jint _remaining;
362    CTYPE *params = (CTYPE *) 0;
363    int _needed = 0;
364
365    if (!params_ref) {
366        _exception = 1;
367        _exceptionType = "java/lang/IllegalArgumentException";
368        _exceptionMessage = "params == null";
369        goto exit;
370    }
371    if (offset < 0) {
372        _exception = 1;
373        _exceptionType = "java/lang/IllegalArgumentException";
374        _exceptionMessage = "offset < 0";
375        goto exit;
376    }
377    _remaining = _env->GetArrayLength(params_ref) - offset;
378    _needed = getNeededCount(pname);
379    // if we didn't find this pname, we just assume the user passed
380    // an array of the right size -- this might happen with extensions
381    // or if we forget an enum here.
382    if (_remaining < _needed) {
383        _exception = 1;
384        _exceptionType = "java/lang/IllegalArgumentException";
385        _exceptionMessage = "length - offset < needed";
386        goto exit;
387    }
388    params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
389        _env, params_ref, (jboolean *)0);
390    params = params_base + offset;
391
392    GET(
393        (GLenum)pname,
394        (CTYPE *)params
395    );
396
397exit:
398    if (params_base) {
399        releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
400            _env, params_ref, params_base, !_exception);
401    }
402    if (_exception) {
403        jniThrowException(_env, _exceptionType, _exceptionMessage);
404    }
405}
406
407
408template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
409          typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
410static void
411getarray
412  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
413    jint _exception = 0;
414    const char * _exceptionType;
415    const char * _exceptionMessage;
416    JTYPEARRAY _array = (JTYPEARRAY) 0;
417    jint _bufferOffset = (jint) 0;
418    jint _remaining;
419    CTYPE *params = (CTYPE *) 0;
420    int _needed = 0;
421
422    params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
423    _remaining /= sizeof(CTYPE);    // convert from bytes to item count
424    _needed = getNeededCount(pname);
425    // if we didn't find this pname, we just assume the user passed
426    // an array of the right size -- this might happen with extensions
427    // or if we forget an enum here.
428    if (_needed>0 && _remaining < _needed) {
429        _exception = 1;
430        _exceptionType = "java/lang/IllegalArgumentException";
431        _exceptionMessage = "remaining() < needed";
432        goto exit;
433    }
434    if (params == NULL) {
435        char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
436            _env, _array, (jboolean *) 0);
437        params = (CTYPE *) (_paramsBase + _bufferOffset);
438    }
439    GET(
440        (GLenum)pname,
441        (CTYPE *)params
442    );
443
444exit:
445    if (_array) {
446        releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
447            _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
448    }
449    if (_exception) {
450        jniThrowException(_env, _exceptionType, _exceptionMessage);
451    }
452}
453
454// --------------------------------------------------------------------------
455/* void glBlendBarrier ( void ) */
456static void
457android_glBlendBarrier__
458  (JNIEnv *_env, jobject _this) {
459    glBlendBarrier();
460}
461
462/* void glCopyImageSubData ( 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 ) */
463static void
464android_glCopyImageSubData__IIIIIIIIIIIIIII
465  (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) {
466    glCopyImageSubData(
467        (GLuint)srcName,
468        (GLenum)srcTarget,
469        (GLint)srcLevel,
470        (GLint)srcX,
471        (GLint)srcY,
472        (GLint)srcZ,
473        (GLuint)dstName,
474        (GLenum)dstTarget,
475        (GLint)dstLevel,
476        (GLint)dstX,
477        (GLint)dstY,
478        (GLint)dstZ,
479        (GLsizei)srcWidth,
480        (GLsizei)srcHeight,
481        (GLsizei)srcDepth
482    );
483}
484
485/* void glDebugMessageControl ( GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled ) */
486static void
487android_glDebugMessageControl__IIII_3IIZ
488  (JNIEnv *_env, jobject _this, jint source, jint type, jint severity, jint count, jintArray ids_ref, jint offset, jboolean enabled) {
489    jint _exception = 0;
490    const char * _exceptionType = NULL;
491    const char * _exceptionMessage = NULL;
492    GLuint *ids_base = (GLuint *) 0;
493    jint _remaining;
494    GLuint *ids = (GLuint *) 0;
495
496    if (!ids_ref) {
497        _exception = 1;
498        _exceptionType = "java/lang/IllegalArgumentException";
499        _exceptionMessage = "ids == null";
500        goto exit;
501    }
502    if (offset < 0) {
503        _exception = 1;
504        _exceptionType = "java/lang/IllegalArgumentException";
505        _exceptionMessage = "offset < 0";
506        goto exit;
507    }
508    _remaining = _env->GetArrayLength(ids_ref) - offset;
509    if (_remaining < count) {
510        _exception = 1;
511        _exceptionType = "java/lang/IllegalArgumentException";
512        _exceptionMessage = "length - offset < count < needed";
513        goto exit;
514    }
515    ids_base = (GLuint *)
516        _env->GetIntArrayElements(ids_ref, (jboolean *)0);
517    ids = ids_base + offset;
518
519    glDebugMessageControl(
520        (GLenum)source,
521        (GLenum)type,
522        (GLenum)severity,
523        (GLsizei)count,
524        (GLuint *)ids,
525        (GLboolean)enabled
526    );
527
528exit:
529    if (ids_base) {
530        _env->ReleaseIntArrayElements(ids_ref, (jint*)ids_base,
531            JNI_ABORT);
532    }
533    if (_exception) {
534        jniThrowException(_env, _exceptionType, _exceptionMessage);
535    }
536}
537
538/* void glDebugMessageControl ( GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled ) */
539static void
540android_glDebugMessageControl__IIIILjava_nio_IntBuffer_2Z
541  (JNIEnv *_env, jobject _this, jint source, jint type, jint severity, jint count, jobject ids_buf, jboolean enabled) {
542    jint _exception = 0;
543    const char * _exceptionType = NULL;
544    const char * _exceptionMessage = NULL;
545    jintArray _array = (jintArray) 0;
546    jint _bufferOffset = (jint) 0;
547    jint _remaining;
548    GLuint *ids = (GLuint *) 0;
549
550    if (!ids_buf) {
551        _exception = 1;
552        _exceptionType = "java/lang/IllegalArgumentException";
553        _exceptionMessage = "ids == null";
554        goto exit;
555    }
556    ids = (GLuint *)getPointer(_env, ids_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
557    if (_remaining < count) {
558        _exception = 1;
559        _exceptionType = "java/lang/IllegalArgumentException";
560        _exceptionMessage = "remaining() < count < needed";
561        goto exit;
562    }
563    if (ids == NULL) {
564        char * _idsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
565        ids = (GLuint *) (_idsBase + _bufferOffset);
566    }
567    glDebugMessageControl(
568        (GLenum)source,
569        (GLenum)type,
570        (GLenum)severity,
571        (GLsizei)count,
572        (GLuint *)ids,
573        (GLboolean)enabled
574    );
575
576exit:
577    if (_array) {
578        _env->ReleaseIntArrayElements(_array, (jint*)ids, JNI_ABORT);
579    }
580    if (_exception) {
581        jniThrowException(_env, _exceptionType, _exceptionMessage);
582    }
583}
584
585/* void glDebugMessageInsert ( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf ) */
586static void
587android_glDebugMessageInsert__IIIIILjava_lang_String_2
588  (JNIEnv *_env, jobject _this, jint source, jint type, jint id, jint severity, jint length, jstring buf) {
589    jint _exception = 0;
590    const char * _exceptionType = NULL;
591    const char * _exceptionMessage = NULL;
592    const char* _nativebuf = 0;
593
594    if (!buf) {
595        _exception = 1;
596        _exceptionType = "java/lang/IllegalArgumentException";
597        _exceptionMessage = "buf == null";
598        goto exit;
599    }
600    _nativebuf = _env->GetStringUTFChars(buf, 0);
601
602    glDebugMessageInsert(
603        (GLenum)source,
604        (GLenum)type,
605        (GLuint)id,
606        (GLenum)severity,
607        (GLsizei)length,
608        (GLchar *)_nativebuf
609    );
610
611exit:
612    if (_nativebuf) {
613        _env->ReleaseStringUTFChars(buf, _nativebuf);
614    }
615
616    if (_exception) {
617        jniThrowException(_env, _exceptionType, _exceptionMessage);
618    }
619}
620
621/* void glDebugMessageCallback ( GLDEBUGPROC callback, const void *userParam ) */
622static void
623android_glDebugMessageCallback(JNIEnv *_env, jobject _this, jobject callback) {
624    jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
625}
626/* GLuint glGetDebugMessageLog ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog ) */
627static jint
628android_glGetDebugMessageLog__II_3II_3II_3II_3II_3II_3BI
629  (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) {
630    jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
631    return 0;
632}
633
634/* GLuint glGetDebugMessageLog ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog ) */
635static uint
636android_glGetDebugMessageLog__ILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_ByteBuffer_2
637  (JNIEnv *_env, jobject _this, jint count, jobject sources_ref, jobject types_ref, jobject ids_ref, jobject severities_ref, jobject lengths_ref, jobject messageLog_ref) {
638    jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
639    return 0;
640}
641
642/* GLuint glGetDebugMessageLog ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog ) */
643static jobjectArray
644android_glGetDebugMessageLog__I_3II_3II_3II_3II
645  (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) {
646    jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
647    return 0;
648}
649
650/* GLuint glGetDebugMessageLog ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog ) */
651static jobjectArray
652android_glGetDebugMessageLog__ILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
653  (JNIEnv *_env, jobject _this, jint count, jobject sources_ref, jobject types_ref, jobject ids_ref, jobject severities_ref) {
654    jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
655    return 0;
656}
657/* void glPushDebugGroup ( GLenum source, GLuint id, GLsizei length, const GLchar *message ) */
658static void
659android_glPushDebugGroup__IIILjava_lang_String_2
660  (JNIEnv *_env, jobject _this, jint source, jint id, jint length, jstring message) {
661    jint _exception = 0;
662    const char * _exceptionType = NULL;
663    const char * _exceptionMessage = NULL;
664    const char* _nativemessage = 0;
665    jsize _stringlen = 0;
666
667    if (!message) {
668        _exception = 1;
669        _exceptionType = "java/lang/IllegalArgumentException";
670        _exceptionMessage = "message == null";
671        goto exit;
672    }
673    _nativemessage = _env->GetStringUTFChars(message, 0);
674    _stringlen = _env->GetStringUTFLength(message);
675    if (length > _stringlen) {
676        _exception = 1;
677        _exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
678        _exceptionMessage = "length of message is shorter than length argument";
679        goto exit;
680    }
681
682    glPushDebugGroup(
683        (GLenum)source,
684        (GLuint)id,
685        (GLsizei)length,
686        (GLchar *)_nativemessage
687    );
688
689exit:
690    if (_nativemessage) {
691        _env->ReleaseStringUTFChars(message, _nativemessage);
692    }
693
694    if (_exception) {
695        jniThrowException(_env, _exceptionType, _exceptionMessage);
696    }
697}
698
699/* void glPopDebugGroup ( void ) */
700static void
701android_glPopDebugGroup__
702  (JNIEnv *_env, jobject _this) {
703    glPopDebugGroup();
704}
705
706/* void glObjectLabel ( GLenum identifier, GLuint name, GLsizei length, const GLchar *label ) */
707static void
708android_glObjectLabel__IIILjava_lang_String_2
709  (JNIEnv *_env, jobject _this, jint identifier, jint name, jint length, jstring label) {
710    jint _exception = 0;
711    const char * _exceptionType = NULL;
712    const char * _exceptionMessage = NULL;
713    const char* _nativelabel = 0;
714    jsize _stringlen = 0;
715
716    if (label) {
717        _nativelabel = _env->GetStringUTFChars(label, 0);
718        _stringlen = _env->GetStringUTFLength(label);
719        if (length > _stringlen) {
720            _exception = 1;
721            _exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
722            _exceptionMessage = "length of label is shorter than length argument";
723            goto exit;
724        }
725    }
726
727    glObjectLabel(
728        (GLenum)identifier,
729        (GLuint)name,
730        (GLsizei)length,
731        (GLchar *)_nativelabel
732    );
733
734exit:
735    if (_nativelabel) {
736        _env->ReleaseStringUTFChars(label, _nativelabel);
737    }
738
739    if (_exception) {
740        jniThrowException(_env, _exceptionType, _exceptionMessage);
741    }
742}
743
744/* void glGetObjectLabel ( GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label ) */
745static jstring
746android_glGetObjectLabel(JNIEnv *_env, jobject _this, jint identifier, jint name) {
747    jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
748    return NULL;
749}
750
751/* void glObjectPtrLabel ( const void *ptr, GLsizei length, const GLchar *label ) */
752static void
753android_glObjectPtrLabel(JNIEnv *_env, jobject _this, jlong ptr, jstring label) {
754    jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
755}
756
757/* void glGetObjectPtrLabel ( const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label ) */
758static jstring
759android_glGetObjectPtrLabel(JNIEnv *_env, jobject _this, jlong ptr) {
760    jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
761    return NULL;
762}
763
764/* void glGetPointerv ( GLenum pname, void **params ) */
765static jlong
766android_glGetPointerv(JNIEnv *_env, jobject _this, jint pname) {
767    jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
768    return NULL;
769}
770
771/* void glEnablei ( GLenum target, GLuint index ) */
772static void
773android_glEnablei__II
774  (JNIEnv *_env, jobject _this, jint target, jint index) {
775    glEnablei(
776        (GLenum)target,
777        (GLuint)index
778    );
779}
780
781/* void glDisablei ( GLenum target, GLuint index ) */
782static void
783android_glDisablei__II
784  (JNIEnv *_env, jobject _this, jint target, jint index) {
785    glDisablei(
786        (GLenum)target,
787        (GLuint)index
788    );
789}
790
791/* void glBlendEquationi ( GLuint buf, GLenum mode ) */
792static void
793android_glBlendEquationi__II
794  (JNIEnv *_env, jobject _this, jint buf, jint mode) {
795    glBlendEquationi(
796        (GLuint)buf,
797        (GLenum)mode
798    );
799}
800
801/* void glBlendEquationSeparatei ( GLuint buf, GLenum modeRGB, GLenum modeAlpha ) */
802static void
803android_glBlendEquationSeparatei__III
804  (JNIEnv *_env, jobject _this, jint buf, jint modeRGB, jint modeAlpha) {
805    glBlendEquationSeparatei(
806        (GLuint)buf,
807        (GLenum)modeRGB,
808        (GLenum)modeAlpha
809    );
810}
811
812/* void glBlendFunci ( GLuint buf, GLenum src, GLenum dst ) */
813static void
814android_glBlendFunci__III
815  (JNIEnv *_env, jobject _this, jint buf, jint src, jint dst) {
816    glBlendFunci(
817        (GLuint)buf,
818        (GLenum)src,
819        (GLenum)dst
820    );
821}
822
823/* void glBlendFuncSeparatei ( GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) */
824static void
825android_glBlendFuncSeparatei__IIIII
826  (JNIEnv *_env, jobject _this, jint buf, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) {
827    glBlendFuncSeparatei(
828        (GLuint)buf,
829        (GLenum)srcRGB,
830        (GLenum)dstRGB,
831        (GLenum)srcAlpha,
832        (GLenum)dstAlpha
833    );
834}
835
836/* void glColorMaski ( GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) */
837static void
838android_glColorMaski__IZZZZ
839  (JNIEnv *_env, jobject _this, jint index, jboolean r, jboolean g, jboolean b, jboolean a) {
840    glColorMaski(
841        (GLuint)index,
842        (GLboolean)r,
843        (GLboolean)g,
844        (GLboolean)b,
845        (GLboolean)a
846    );
847}
848
849/* GLboolean glIsEnabledi ( GLenum target, GLuint index ) */
850static jboolean
851android_glIsEnabledi__II
852  (JNIEnv *_env, jobject _this, jint target, jint index) {
853    GLboolean _returnValue;
854    _returnValue = glIsEnabledi(
855        (GLenum)target,
856        (GLuint)index
857    );
858    return (jboolean)_returnValue;
859}
860
861/* void glDrawElementsBaseVertex ( GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex ) */
862static void
863android_glDrawElementsBaseVertex__IIILjava_nio_Buffer_2I
864  (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf, jint basevertex) {
865    jint _exception = 0;
866    const char * _exceptionType = NULL;
867    const char * _exceptionMessage = NULL;
868    jarray _array = (jarray) 0;
869    jint _bufferOffset = (jint) 0;
870    jint _remaining;
871    void *indices = (void *) 0;
872
873    if (!indices_buf) {
874        _exception = 1;
875        _exceptionType = "java/lang/IllegalArgumentException";
876        _exceptionMessage = "indices == null";
877        goto exit;
878    }
879    indices = (void *)getPointer(_env, indices_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
880    if (_remaining < count-basevertex) {
881        _exception = 1;
882        _exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
883        _exceptionMessage = "remaining() < count-basevertex < needed";
884        goto exit;
885    }
886    if (indices == NULL) {
887        char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
888        indices = (void *) (_indicesBase + _bufferOffset);
889    }
890    glDrawElementsBaseVertex(
891        (GLenum)mode,
892        (GLsizei)count,
893        (GLenum)type,
894        (void *)indices,
895        (GLint)basevertex
896    );
897
898exit:
899    if (_array) {
900        releasePointer(_env, _array, indices, JNI_FALSE);
901    }
902    if (_exception) {
903        jniThrowException(_env, _exceptionType, _exceptionMessage);
904    }
905}
906
907/* void glDrawRangeElementsBaseVertex ( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex ) */
908static void
909android_glDrawRangeElementsBaseVertex__IIIIILjava_nio_Buffer_2I
910  (JNIEnv *_env, jobject _this, jint mode, jint start, jint end, jint count, jint type, jobject indices_buf, jint basevertex) {
911    jint _exception = 0;
912    const char * _exceptionType = NULL;
913    const char * _exceptionMessage = NULL;
914    jarray _array = (jarray) 0;
915    jint _bufferOffset = (jint) 0;
916    jint _remaining;
917    void *indices = (void *) 0;
918
919    if (!indices_buf) {
920        _exception = 1;
921        _exceptionType = "java/lang/IllegalArgumentException";
922        _exceptionMessage = "indices == null";
923        goto exit;
924    }
925    indices = (void *)getPointer(_env, indices_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
926    if (_remaining < count-basevertex) {
927        _exception = 1;
928        _exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
929        _exceptionMessage = "remaining() < count-basevertex < needed";
930        goto exit;
931    }
932    if (indices == NULL) {
933        char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
934        indices = (void *) (_indicesBase + _bufferOffset);
935    }
936    glDrawRangeElementsBaseVertex(
937        (GLenum)mode,
938        (GLuint)start,
939        (GLuint)end,
940        (GLsizei)count,
941        (GLenum)type,
942        (void *)indices,
943        (GLint)basevertex
944    );
945
946exit:
947    if (_array) {
948        releasePointer(_env, _array, indices, JNI_FALSE);
949    }
950    if (_exception) {
951        jniThrowException(_env, _exceptionType, _exceptionMessage);
952    }
953}
954
955/* void glDrawElementsInstancedBaseVertex ( GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instanceCount, GLint basevertex ) */
956static void
957android_glDrawElementsInstancedBaseVertex__IIILjava_nio_Buffer_2II
958  (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf, jint instanceCount, jint basevertex) {
959    jint _exception = 0;
960    const char * _exceptionType = NULL;
961    const char * _exceptionMessage = NULL;
962    jarray _array = (jarray) 0;
963    jint _bufferOffset = (jint) 0;
964    jint _remaining;
965    void *indices = (void *) 0;
966
967    indices = (void *)getPointer(_env, indices_buf, &_array, &_remaining, &_bufferOffset);
968    if (_remaining < count-basevertex) {
969        _exception = 1;
970        _exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
971        _exceptionMessage = "remaining() < count-basevertex < needed";
972        goto exit;
973    }
974    if (indices == NULL) {
975        char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
976        indices = (void *) (_indicesBase + _bufferOffset);
977    }
978    glDrawElementsInstancedBaseVertex(
979        (GLenum)mode,
980        (GLsizei)count,
981        (GLenum)type,
982        (void *)indices,
983        (GLsizei)instanceCount,
984        (GLint) basevertex
985    );
986
987exit:
988    if (_array) {
989        releasePointer(_env, _array, indices, JNI_FALSE);
990    }
991}
992
993/* void glDrawElementsInstancedBaseVertex ( GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instanceCount, GLint basevertex ) */
994static void
995android_glDrawElementsInstancedBaseVertex__IIIIII
996  (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint indicesOffset, jint instanceCount, jint basevertex) {
997    glDrawElementsInstancedBaseVertex(
998        (GLenum)mode,
999        (GLsizei)count,
1000        (GLenum)type,
1001        (void *)static_cast<uintptr_t>(indicesOffset),
1002        (GLsizei)instanceCount,
1003        (GLint)basevertex
1004    );
1005}
1006/* void glFramebufferTexture ( GLenum target, GLenum attachment, GLuint texture, GLint level ) */
1007static void
1008android_glFramebufferTexture__IIII
1009  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint texture, jint level) {
1010    glFramebufferTexture(
1011        (GLenum)target,
1012        (GLenum)attachment,
1013        (GLuint)texture,
1014        (GLint)level
1015    );
1016}
1017
1018/* void glPrimitiveBoundingBox ( GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW ) */
1019static void
1020android_glPrimitiveBoundingBox__FFFFFFFF
1021  (JNIEnv *_env, jobject _this, jfloat minX, jfloat minY, jfloat minZ, jfloat minW, jfloat maxX, jfloat maxY, jfloat maxZ, jfloat maxW) {
1022    glPrimitiveBoundingBox(
1023        (GLfloat)minX,
1024        (GLfloat)minY,
1025        (GLfloat)minZ,
1026        (GLfloat)minW,
1027        (GLfloat)maxX,
1028        (GLfloat)maxY,
1029        (GLfloat)maxZ,
1030        (GLfloat)maxW
1031    );
1032}
1033
1034/* GLenum glGetGraphicsResetStatus ( void ) */
1035static jint
1036android_glGetGraphicsResetStatus__
1037  (JNIEnv *_env, jobject _this) {
1038    GLenum _returnValue;
1039    _returnValue = glGetGraphicsResetStatus();
1040    return (jint)_returnValue;
1041}
1042
1043/* void glReadnPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data ) */
1044static void
1045android_glReadnPixels__IIIIIIILjava_nio_Buffer_2
1046  (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jint bufSize, jobject data_buf) {
1047    jint _exception = 0;
1048    const char * _exceptionType = NULL;
1049    const char * _exceptionMessage = NULL;
1050    jarray _array = (jarray) 0;
1051    jint _bufferOffset = (jint) 0;
1052    jint _remaining;
1053    void *data = (void *) 0;
1054
1055    if (!data_buf) {
1056        _exception = 1;
1057        _exceptionType = "java/lang/IllegalArgumentException";
1058        _exceptionMessage = "data == null";
1059        goto exit;
1060    }
1061    data = (void *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1062    if (_remaining < bufSize) {
1063        _exception = 1;
1064        _exceptionType = "java/lang/IllegalArgumentException";
1065        _exceptionMessage = "remaining() < bufSize < needed";
1066        goto exit;
1067    }
1068    if (data == NULL) {
1069        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1070        data = (void *) (_dataBase + _bufferOffset);
1071    }
1072    glReadnPixels(
1073        (GLint)x,
1074        (GLint)y,
1075        (GLsizei)width,
1076        (GLsizei)height,
1077        (GLenum)format,
1078        (GLenum)type,
1079        (GLsizei)bufSize,
1080        (void *)data
1081    );
1082
1083exit:
1084    if (_array) {
1085        releasePointer(_env, _array, data, _exception ? JNI_FALSE : JNI_TRUE);
1086    }
1087    if (_exception) {
1088        jniThrowException(_env, _exceptionType, _exceptionMessage);
1089    }
1090}
1091
1092/* void glGetnUniformfv ( GLuint program, GLint location, GLsizei bufSize, GLfloat *params ) */
1093static void
1094android_glGetnUniformfv__III_3FI
1095  (JNIEnv *_env, jobject _this, jint program, jint location, jint bufSize, jfloatArray params_ref, jint offset) {
1096    jint _exception = 0;
1097    const char * _exceptionType = NULL;
1098    const char * _exceptionMessage = NULL;
1099    GLfloat *params_base = (GLfloat *) 0;
1100    jint _remaining;
1101    GLfloat *params = (GLfloat *) 0;
1102
1103    if (!params_ref) {
1104        _exception = 1;
1105        _exceptionType = "java/lang/IllegalArgumentException";
1106        _exceptionMessage = "params == null";
1107        goto exit;
1108    }
1109    if (offset < 0) {
1110        _exception = 1;
1111        _exceptionType = "java/lang/IllegalArgumentException";
1112        _exceptionMessage = "offset < 0";
1113        goto exit;
1114    }
1115    _remaining = _env->GetArrayLength(params_ref) - offset;
1116    if (_remaining < bufSize) {
1117        _exception = 1;
1118        _exceptionType = "java/lang/IllegalArgumentException";
1119        _exceptionMessage = "length - offset < bufSize < needed";
1120        goto exit;
1121    }
1122    params_base = (GLfloat *)
1123        _env->GetFloatArrayElements(params_ref, (jboolean *)0);
1124    params = params_base + offset;
1125
1126    glGetnUniformfv(
1127        (GLuint)program,
1128        (GLint)location,
1129        (GLsizei)bufSize,
1130        (GLfloat *)params
1131    );
1132
1133exit:
1134    if (params_base) {
1135        _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
1136            _exception ? JNI_ABORT: 0);
1137    }
1138    if (_exception) {
1139        jniThrowException(_env, _exceptionType, _exceptionMessage);
1140    }
1141}
1142
1143/* void glGetnUniformfv ( GLuint program, GLint location, GLsizei bufSize, GLfloat *params ) */
1144static void
1145android_glGetnUniformfv__IIILjava_nio_FloatBuffer_2
1146  (JNIEnv *_env, jobject _this, jint program, jint location, jint bufSize, jobject params_buf) {
1147    jint _exception = 0;
1148    const char * _exceptionType = NULL;
1149    const char * _exceptionMessage = NULL;
1150    jfloatArray _array = (jfloatArray) 0;
1151    jint _bufferOffset = (jint) 0;
1152    jint _remaining;
1153    GLfloat *params = (GLfloat *) 0;
1154
1155    if (!params_buf) {
1156        _exception = 1;
1157        _exceptionType = "java/lang/IllegalArgumentException";
1158        _exceptionMessage = "params == null";
1159        goto exit;
1160    }
1161    params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1162    if (_remaining < bufSize) {
1163        _exception = 1;
1164        _exceptionType = "java/lang/IllegalArgumentException";
1165        _exceptionMessage = "remaining() < bufSize < needed";
1166        goto exit;
1167    }
1168    if (params == NULL) {
1169        char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
1170        params = (GLfloat *) (_paramsBase + _bufferOffset);
1171    }
1172    glGetnUniformfv(
1173        (GLuint)program,
1174        (GLint)location,
1175        (GLsizei)bufSize,
1176        (GLfloat *)params
1177    );
1178
1179exit:
1180    if (_array) {
1181        _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
1182    }
1183    if (_exception) {
1184        jniThrowException(_env, _exceptionType, _exceptionMessage);
1185    }
1186}
1187
1188/* void glGetnUniformiv ( GLuint program, GLint location, GLsizei bufSize, GLint *params ) */
1189static void
1190android_glGetnUniformiv__III_3II
1191  (JNIEnv *_env, jobject _this, jint program, jint location, jint bufSize, jintArray params_ref, jint offset) {
1192    jint _exception = 0;
1193    const char * _exceptionType = NULL;
1194    const char * _exceptionMessage = NULL;
1195    GLint *params_base = (GLint *) 0;
1196    jint _remaining;
1197    GLint *params = (GLint *) 0;
1198
1199    if (!params_ref) {
1200        _exception = 1;
1201        _exceptionType = "java/lang/IllegalArgumentException";
1202        _exceptionMessage = "params == null";
1203        goto exit;
1204    }
1205    if (offset < 0) {
1206        _exception = 1;
1207        _exceptionType = "java/lang/IllegalArgumentException";
1208        _exceptionMessage = "offset < 0";
1209        goto exit;
1210    }
1211    _remaining = _env->GetArrayLength(params_ref) - offset;
1212    if (_remaining < bufSize) {
1213        _exception = 1;
1214        _exceptionType = "java/lang/IllegalArgumentException";
1215        _exceptionMessage = "length - offset < bufSize < needed";
1216        goto exit;
1217    }
1218    params_base = (GLint *)
1219        _env->GetIntArrayElements(params_ref, (jboolean *)0);
1220    params = params_base + offset;
1221
1222    glGetnUniformiv(
1223        (GLuint)program,
1224        (GLint)location,
1225        (GLsizei)bufSize,
1226        (GLint *)params
1227    );
1228
1229exit:
1230    if (params_base) {
1231        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
1232            _exception ? JNI_ABORT: 0);
1233    }
1234    if (_exception) {
1235        jniThrowException(_env, _exceptionType, _exceptionMessage);
1236    }
1237}
1238
1239/* void glGetnUniformiv ( GLuint program, GLint location, GLsizei bufSize, GLint *params ) */
1240static void
1241android_glGetnUniformiv__IIILjava_nio_IntBuffer_2
1242  (JNIEnv *_env, jobject _this, jint program, jint location, jint bufSize, jobject params_buf) {
1243    jint _exception = 0;
1244    const char * _exceptionType = NULL;
1245    const char * _exceptionMessage = NULL;
1246    jintArray _array = (jintArray) 0;
1247    jint _bufferOffset = (jint) 0;
1248    jint _remaining;
1249    GLint *params = (GLint *) 0;
1250
1251    if (!params_buf) {
1252        _exception = 1;
1253        _exceptionType = "java/lang/IllegalArgumentException";
1254        _exceptionMessage = "params == null";
1255        goto exit;
1256    }
1257    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1258    if (_remaining < bufSize) {
1259        _exception = 1;
1260        _exceptionType = "java/lang/IllegalArgumentException";
1261        _exceptionMessage = "remaining() < bufSize < needed";
1262        goto exit;
1263    }
1264    if (params == NULL) {
1265        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1266        params = (GLint *) (_paramsBase + _bufferOffset);
1267    }
1268    glGetnUniformiv(
1269        (GLuint)program,
1270        (GLint)location,
1271        (GLsizei)bufSize,
1272        (GLint *)params
1273    );
1274
1275exit:
1276    if (_array) {
1277        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
1278    }
1279    if (_exception) {
1280        jniThrowException(_env, _exceptionType, _exceptionMessage);
1281    }
1282}
1283
1284/* void glGetnUniformuiv ( GLuint program, GLint location, GLsizei bufSize, GLuint *params ) */
1285static void
1286android_glGetnUniformuiv__III_3II
1287  (JNIEnv *_env, jobject _this, jint program, jint location, jint bufSize, jintArray params_ref, jint offset) {
1288    jint _exception = 0;
1289    const char * _exceptionType = NULL;
1290    const char * _exceptionMessage = NULL;
1291    GLuint *params_base = (GLuint *) 0;
1292    jint _remaining;
1293    GLuint *params = (GLuint *) 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    if (_remaining < bufSize) {
1309        _exception = 1;
1310        _exceptionType = "java/lang/IllegalArgumentException";
1311        _exceptionMessage = "length - offset < bufSize < needed";
1312        goto exit;
1313    }
1314    params_base = (GLuint *)
1315        _env->GetIntArrayElements(params_ref, (jboolean *)0);
1316    params = params_base + offset;
1317
1318    glGetnUniformuiv(
1319        (GLuint)program,
1320        (GLint)location,
1321        (GLsizei)bufSize,
1322        (GLuint *)params
1323    );
1324
1325exit:
1326    if (params_base) {
1327        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
1328            _exception ? JNI_ABORT: 0);
1329    }
1330    if (_exception) {
1331        jniThrowException(_env, _exceptionType, _exceptionMessage);
1332    }
1333}
1334
1335/* void glGetnUniformuiv ( GLuint program, GLint location, GLsizei bufSize, GLuint *params ) */
1336static void
1337android_glGetnUniformuiv__IIILjava_nio_IntBuffer_2
1338  (JNIEnv *_env, jobject _this, jint program, jint location, jint bufSize, jobject params_buf) {
1339    jint _exception = 0;
1340    const char * _exceptionType = NULL;
1341    const char * _exceptionMessage = NULL;
1342    jintArray _array = (jintArray) 0;
1343    jint _bufferOffset = (jint) 0;
1344    jint _remaining;
1345    GLuint *params = (GLuint *) 0;
1346
1347    if (!params_buf) {
1348        _exception = 1;
1349        _exceptionType = "java/lang/IllegalArgumentException";
1350        _exceptionMessage = "params == null";
1351        goto exit;
1352    }
1353    params = (GLuint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1354    if (_remaining < bufSize) {
1355        _exception = 1;
1356        _exceptionType = "java/lang/IllegalArgumentException";
1357        _exceptionMessage = "remaining() < bufSize < needed";
1358        goto exit;
1359    }
1360    if (params == NULL) {
1361        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1362        params = (GLuint *) (_paramsBase + _bufferOffset);
1363    }
1364    glGetnUniformuiv(
1365        (GLuint)program,
1366        (GLint)location,
1367        (GLsizei)bufSize,
1368        (GLuint *)params
1369    );
1370
1371exit:
1372    if (_array) {
1373        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
1374    }
1375    if (_exception) {
1376        jniThrowException(_env, _exceptionType, _exceptionMessage);
1377    }
1378}
1379
1380/* void glMinSampleShading ( GLfloat value ) */
1381static void
1382android_glMinSampleShading__F
1383  (JNIEnv *_env, jobject _this, jfloat value) {
1384    glMinSampleShading(
1385        (GLfloat)value
1386    );
1387}
1388
1389/* void glPatchParameteri ( GLenum pname, GLint value ) */
1390static void
1391android_glPatchParameteri__II
1392  (JNIEnv *_env, jobject _this, jint pname, jint value) {
1393    glPatchParameteri(
1394        (GLenum)pname,
1395        (GLint)value
1396    );
1397}
1398
1399/* void glTexParameterIiv ( GLenum target, GLenum pname, const GLint *params ) */
1400static void
1401android_glTexParameterIiv__II_3II
1402  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
1403    jint _exception = 0;
1404    const char * _exceptionType = NULL;
1405    const char * _exceptionMessage = NULL;
1406    GLint *params_base = (GLint *) 0;
1407    jint _remaining;
1408    GLint *params = (GLint *) 0;
1409
1410    if (!params_ref) {
1411        _exception = 1;
1412        _exceptionType = "java/lang/IllegalArgumentException";
1413        _exceptionMessage = "params == null";
1414        goto exit;
1415    }
1416    if (offset < 0) {
1417        _exception = 1;
1418        _exceptionType = "java/lang/IllegalArgumentException";
1419        _exceptionMessage = "offset < 0";
1420        goto exit;
1421    }
1422    _remaining = _env->GetArrayLength(params_ref) - offset;
1423    params_base = (GLint *)
1424        _env->GetIntArrayElements(params_ref, (jboolean *)0);
1425    params = params_base + offset;
1426
1427    glTexParameterIiv(
1428        (GLenum)target,
1429        (GLenum)pname,
1430        (GLint *)params
1431    );
1432
1433exit:
1434    if (params_base) {
1435        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
1436            JNI_ABORT);
1437    }
1438    if (_exception) {
1439        jniThrowException(_env, _exceptionType, _exceptionMessage);
1440    }
1441}
1442
1443/* void glTexParameterIiv ( GLenum target, GLenum pname, const GLint *params ) */
1444static void
1445android_glTexParameterIiv__IILjava_nio_IntBuffer_2
1446  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
1447    jint _exception = 0;
1448    const char * _exceptionType = NULL;
1449    const char * _exceptionMessage = NULL;
1450    jintArray _array = (jintArray) 0;
1451    jint _bufferOffset = (jint) 0;
1452    jint _remaining;
1453    GLint *params = (GLint *) 0;
1454
1455    if (!params_buf) {
1456        _exception = 1;
1457        _exceptionType = "java/lang/IllegalArgumentException";
1458        _exceptionMessage = "params == null";
1459        goto exit;
1460    }
1461    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1462    if (params == NULL) {
1463        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1464        params = (GLint *) (_paramsBase + _bufferOffset);
1465    }
1466    glTexParameterIiv(
1467        (GLenum)target,
1468        (GLenum)pname,
1469        (GLint *)params
1470    );
1471
1472exit:
1473    if (_array) {
1474        _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
1475    }
1476    if (_exception) {
1477        jniThrowException(_env, _exceptionType, _exceptionMessage);
1478    }
1479}
1480
1481/* void glTexParameterIuiv ( GLenum target, GLenum pname, const GLuint *params ) */
1482static void
1483android_glTexParameterIuiv__II_3II
1484  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
1485    jint _exception = 0;
1486    const char * _exceptionType = NULL;
1487    const char * _exceptionMessage = NULL;
1488    GLuint *params_base = (GLuint *) 0;
1489    jint _remaining;
1490    GLuint *params = (GLuint *) 0;
1491
1492    if (!params_ref) {
1493        _exception = 1;
1494        _exceptionType = "java/lang/IllegalArgumentException";
1495        _exceptionMessage = "params == null";
1496        goto exit;
1497    }
1498    if (offset < 0) {
1499        _exception = 1;
1500        _exceptionType = "java/lang/IllegalArgumentException";
1501        _exceptionMessage = "offset < 0";
1502        goto exit;
1503    }
1504    _remaining = _env->GetArrayLength(params_ref) - offset;
1505    params_base = (GLuint *)
1506        _env->GetIntArrayElements(params_ref, (jboolean *)0);
1507    params = params_base + offset;
1508
1509    glTexParameterIuiv(
1510        (GLenum)target,
1511        (GLenum)pname,
1512        (GLuint *)params
1513    );
1514
1515exit:
1516    if (params_base) {
1517        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
1518            JNI_ABORT);
1519    }
1520    if (_exception) {
1521        jniThrowException(_env, _exceptionType, _exceptionMessage);
1522    }
1523}
1524
1525/* void glTexParameterIuiv ( GLenum target, GLenum pname, const GLuint *params ) */
1526static void
1527android_glTexParameterIuiv__IILjava_nio_IntBuffer_2
1528  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
1529    jint _exception = 0;
1530    const char * _exceptionType = NULL;
1531    const char * _exceptionMessage = NULL;
1532    jintArray _array = (jintArray) 0;
1533    jint _bufferOffset = (jint) 0;
1534    jint _remaining;
1535    GLuint *params = (GLuint *) 0;
1536
1537    if (!params_buf) {
1538        _exception = 1;
1539        _exceptionType = "java/lang/IllegalArgumentException";
1540        _exceptionMessage = "params == null";
1541        goto exit;
1542    }
1543    params = (GLuint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1544    if (params == NULL) {
1545        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1546        params = (GLuint *) (_paramsBase + _bufferOffset);
1547    }
1548    glTexParameterIuiv(
1549        (GLenum)target,
1550        (GLenum)pname,
1551        (GLuint *)params
1552    );
1553
1554exit:
1555    if (_array) {
1556        _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
1557    }
1558    if (_exception) {
1559        jniThrowException(_env, _exceptionType, _exceptionMessage);
1560    }
1561}
1562
1563/* void glGetTexParameterIiv ( GLenum target, GLenum pname, GLint *params ) */
1564static void
1565android_glGetTexParameterIiv__II_3II
1566  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
1567    jint _exception = 0;
1568    const char * _exceptionType = NULL;
1569    const char * _exceptionMessage = NULL;
1570    GLint *params_base = (GLint *) 0;
1571    jint _remaining;
1572    GLint *params = (GLint *) 0;
1573
1574    if (!params_ref) {
1575        _exception = 1;
1576        _exceptionType = "java/lang/IllegalArgumentException";
1577        _exceptionMessage = "params == null";
1578        goto exit;
1579    }
1580    if (offset < 0) {
1581        _exception = 1;
1582        _exceptionType = "java/lang/IllegalArgumentException";
1583        _exceptionMessage = "offset < 0";
1584        goto exit;
1585    }
1586    _remaining = _env->GetArrayLength(params_ref) - offset;
1587    params_base = (GLint *)
1588        _env->GetIntArrayElements(params_ref, (jboolean *)0);
1589    params = params_base + offset;
1590
1591    glGetTexParameterIiv(
1592        (GLenum)target,
1593        (GLenum)pname,
1594        (GLint *)params
1595    );
1596
1597exit:
1598    if (params_base) {
1599        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
1600            _exception ? JNI_ABORT: 0);
1601    }
1602    if (_exception) {
1603        jniThrowException(_env, _exceptionType, _exceptionMessage);
1604    }
1605}
1606
1607/* void glGetTexParameterIiv ( GLenum target, GLenum pname, GLint *params ) */
1608static void
1609android_glGetTexParameterIiv__IILjava_nio_IntBuffer_2
1610  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
1611    jint _exception = 0;
1612    const char * _exceptionType = NULL;
1613    const char * _exceptionMessage = NULL;
1614    jintArray _array = (jintArray) 0;
1615    jint _bufferOffset = (jint) 0;
1616    jint _remaining;
1617    GLint *params = (GLint *) 0;
1618
1619    if (!params_buf) {
1620        _exception = 1;
1621        _exceptionType = "java/lang/IllegalArgumentException";
1622        _exceptionMessage = "params == null";
1623        goto exit;
1624    }
1625    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1626    if (params == NULL) {
1627        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1628        params = (GLint *) (_paramsBase + _bufferOffset);
1629    }
1630    glGetTexParameterIiv(
1631        (GLenum)target,
1632        (GLenum)pname,
1633        (GLint *)params
1634    );
1635
1636exit:
1637    if (_array) {
1638        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
1639    }
1640    if (_exception) {
1641        jniThrowException(_env, _exceptionType, _exceptionMessage);
1642    }
1643}
1644
1645/* void glGetTexParameterIuiv ( GLenum target, GLenum pname, GLuint *params ) */
1646static void
1647android_glGetTexParameterIuiv__II_3II
1648  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
1649    jint _exception = 0;
1650    const char * _exceptionType = NULL;
1651    const char * _exceptionMessage = NULL;
1652    GLuint *params_base = (GLuint *) 0;
1653    jint _remaining;
1654    GLuint *params = (GLuint *) 0;
1655
1656    if (!params_ref) {
1657        _exception = 1;
1658        _exceptionType = "java/lang/IllegalArgumentException";
1659        _exceptionMessage = "params == null";
1660        goto exit;
1661    }
1662    if (offset < 0) {
1663        _exception = 1;
1664        _exceptionType = "java/lang/IllegalArgumentException";
1665        _exceptionMessage = "offset < 0";
1666        goto exit;
1667    }
1668    _remaining = _env->GetArrayLength(params_ref) - offset;
1669    params_base = (GLuint *)
1670        _env->GetIntArrayElements(params_ref, (jboolean *)0);
1671    params = params_base + offset;
1672
1673    glGetTexParameterIuiv(
1674        (GLenum)target,
1675        (GLenum)pname,
1676        (GLuint *)params
1677    );
1678
1679exit:
1680    if (params_base) {
1681        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
1682            _exception ? JNI_ABORT: 0);
1683    }
1684    if (_exception) {
1685        jniThrowException(_env, _exceptionType, _exceptionMessage);
1686    }
1687}
1688
1689/* void glGetTexParameterIuiv ( GLenum target, GLenum pname, GLuint *params ) */
1690static void
1691android_glGetTexParameterIuiv__IILjava_nio_IntBuffer_2
1692  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
1693    jint _exception = 0;
1694    const char * _exceptionType = NULL;
1695    const char * _exceptionMessage = NULL;
1696    jintArray _array = (jintArray) 0;
1697    jint _bufferOffset = (jint) 0;
1698    jint _remaining;
1699    GLuint *params = (GLuint *) 0;
1700
1701    if (!params_buf) {
1702        _exception = 1;
1703        _exceptionType = "java/lang/IllegalArgumentException";
1704        _exceptionMessage = "params == null";
1705        goto exit;
1706    }
1707    params = (GLuint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1708    if (params == NULL) {
1709        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1710        params = (GLuint *) (_paramsBase + _bufferOffset);
1711    }
1712    glGetTexParameterIuiv(
1713        (GLenum)target,
1714        (GLenum)pname,
1715        (GLuint *)params
1716    );
1717
1718exit:
1719    if (_array) {
1720        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
1721    }
1722    if (_exception) {
1723        jniThrowException(_env, _exceptionType, _exceptionMessage);
1724    }
1725}
1726
1727/* void glSamplerParameterIiv ( GLuint sampler, GLenum pname, const GLint *param ) */
1728static void
1729android_glSamplerParameterIiv__II_3II
1730  (JNIEnv *_env, jobject _this, jint sampler, jint pname, jintArray param_ref, jint offset) {
1731    jint _exception = 0;
1732    const char * _exceptionType = NULL;
1733    const char * _exceptionMessage = NULL;
1734    GLint *param_base = (GLint *) 0;
1735    jint _remaining;
1736    GLint *param = (GLint *) 0;
1737
1738    if (!param_ref) {
1739        _exception = 1;
1740        _exceptionType = "java/lang/IllegalArgumentException";
1741        _exceptionMessage = "param == null";
1742        goto exit;
1743    }
1744    if (offset < 0) {
1745        _exception = 1;
1746        _exceptionType = "java/lang/IllegalArgumentException";
1747        _exceptionMessage = "offset < 0";
1748        goto exit;
1749    }
1750    _remaining = _env->GetArrayLength(param_ref) - offset;
1751    param_base = (GLint *)
1752        _env->GetIntArrayElements(param_ref, (jboolean *)0);
1753    param = param_base + offset;
1754
1755    glSamplerParameterIiv(
1756        (GLuint)sampler,
1757        (GLenum)pname,
1758        (GLint *)param
1759    );
1760
1761exit:
1762    if (param_base) {
1763        _env->ReleaseIntArrayElements(param_ref, (jint*)param_base,
1764            JNI_ABORT);
1765    }
1766    if (_exception) {
1767        jniThrowException(_env, _exceptionType, _exceptionMessage);
1768    }
1769}
1770
1771/* void glSamplerParameterIiv ( GLuint sampler, GLenum pname, const GLint *param ) */
1772static void
1773android_glSamplerParameterIiv__IILjava_nio_IntBuffer_2
1774  (JNIEnv *_env, jobject _this, jint sampler, jint pname, jobject param_buf) {
1775    jint _exception = 0;
1776    const char * _exceptionType = NULL;
1777    const char * _exceptionMessage = NULL;
1778    jintArray _array = (jintArray) 0;
1779    jint _bufferOffset = (jint) 0;
1780    jint _remaining;
1781    GLint *param = (GLint *) 0;
1782
1783    if (!param_buf) {
1784        _exception = 1;
1785        _exceptionType = "java/lang/IllegalArgumentException";
1786        _exceptionMessage = "param == null";
1787        goto exit;
1788    }
1789    param = (GLint *)getPointer(_env, param_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1790    if (param == NULL) {
1791        char * _paramBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1792        param = (GLint *) (_paramBase + _bufferOffset);
1793    }
1794    glSamplerParameterIiv(
1795        (GLuint)sampler,
1796        (GLenum)pname,
1797        (GLint *)param
1798    );
1799
1800exit:
1801    if (_array) {
1802        _env->ReleaseIntArrayElements(_array, (jint*)param, JNI_ABORT);
1803    }
1804    if (_exception) {
1805        jniThrowException(_env, _exceptionType, _exceptionMessage);
1806    }
1807}
1808
1809/* void glSamplerParameterIuiv ( GLuint sampler, GLenum pname, const GLuint *param ) */
1810static void
1811android_glSamplerParameterIuiv__II_3II
1812  (JNIEnv *_env, jobject _this, jint sampler, jint pname, jintArray param_ref, jint offset) {
1813    jint _exception = 0;
1814    const char * _exceptionType = NULL;
1815    const char * _exceptionMessage = NULL;
1816    GLuint *param_base = (GLuint *) 0;
1817    jint _remaining;
1818    GLuint *param = (GLuint *) 0;
1819
1820    if (!param_ref) {
1821        _exception = 1;
1822        _exceptionType = "java/lang/IllegalArgumentException";
1823        _exceptionMessage = "param == null";
1824        goto exit;
1825    }
1826    if (offset < 0) {
1827        _exception = 1;
1828        _exceptionType = "java/lang/IllegalArgumentException";
1829        _exceptionMessage = "offset < 0";
1830        goto exit;
1831    }
1832    _remaining = _env->GetArrayLength(param_ref) - offset;
1833    param_base = (GLuint *)
1834        _env->GetIntArrayElements(param_ref, (jboolean *)0);
1835    param = param_base + offset;
1836
1837    glSamplerParameterIuiv(
1838        (GLuint)sampler,
1839        (GLenum)pname,
1840        (GLuint *)param
1841    );
1842
1843exit:
1844    if (param_base) {
1845        _env->ReleaseIntArrayElements(param_ref, (jint*)param_base,
1846            JNI_ABORT);
1847    }
1848    if (_exception) {
1849        jniThrowException(_env, _exceptionType, _exceptionMessage);
1850    }
1851}
1852
1853/* void glSamplerParameterIuiv ( GLuint sampler, GLenum pname, const GLuint *param ) */
1854static void
1855android_glSamplerParameterIuiv__IILjava_nio_IntBuffer_2
1856  (JNIEnv *_env, jobject _this, jint sampler, jint pname, jobject param_buf) {
1857    jint _exception = 0;
1858    const char * _exceptionType = NULL;
1859    const char * _exceptionMessage = NULL;
1860    jintArray _array = (jintArray) 0;
1861    jint _bufferOffset = (jint) 0;
1862    jint _remaining;
1863    GLuint *param = (GLuint *) 0;
1864
1865    if (!param_buf) {
1866        _exception = 1;
1867        _exceptionType = "java/lang/IllegalArgumentException";
1868        _exceptionMessage = "param == null";
1869        goto exit;
1870    }
1871    param = (GLuint *)getPointer(_env, param_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1872    if (param == NULL) {
1873        char * _paramBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1874        param = (GLuint *) (_paramBase + _bufferOffset);
1875    }
1876    glSamplerParameterIuiv(
1877        (GLuint)sampler,
1878        (GLenum)pname,
1879        (GLuint *)param
1880    );
1881
1882exit:
1883    if (_array) {
1884        _env->ReleaseIntArrayElements(_array, (jint*)param, JNI_ABORT);
1885    }
1886    if (_exception) {
1887        jniThrowException(_env, _exceptionType, _exceptionMessage);
1888    }
1889}
1890
1891/* void glGetSamplerParameterIiv ( GLuint sampler, GLenum pname, GLint *params ) */
1892static void
1893android_glGetSamplerParameterIiv__II_3II
1894  (JNIEnv *_env, jobject _this, jint sampler, jint pname, jintArray params_ref, jint offset) {
1895    jint _exception = 0;
1896    const char * _exceptionType = NULL;
1897    const char * _exceptionMessage = NULL;
1898    GLint *params_base = (GLint *) 0;
1899    jint _remaining;
1900    GLint *params = (GLint *) 0;
1901
1902    if (!params_ref) {
1903        _exception = 1;
1904        _exceptionType = "java/lang/IllegalArgumentException";
1905        _exceptionMessage = "params == null";
1906        goto exit;
1907    }
1908    if (offset < 0) {
1909        _exception = 1;
1910        _exceptionType = "java/lang/IllegalArgumentException";
1911        _exceptionMessage = "offset < 0";
1912        goto exit;
1913    }
1914    _remaining = _env->GetArrayLength(params_ref) - offset;
1915    params_base = (GLint *)
1916        _env->GetIntArrayElements(params_ref, (jboolean *)0);
1917    params = params_base + offset;
1918
1919    glGetSamplerParameterIiv(
1920        (GLuint)sampler,
1921        (GLenum)pname,
1922        (GLint *)params
1923    );
1924
1925exit:
1926    if (params_base) {
1927        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
1928            _exception ? JNI_ABORT: 0);
1929    }
1930    if (_exception) {
1931        jniThrowException(_env, _exceptionType, _exceptionMessage);
1932    }
1933}
1934
1935/* void glGetSamplerParameterIiv ( GLuint sampler, GLenum pname, GLint *params ) */
1936static void
1937android_glGetSamplerParameterIiv__IILjava_nio_IntBuffer_2
1938  (JNIEnv *_env, jobject _this, jint sampler, jint pname, jobject params_buf) {
1939    jint _exception = 0;
1940    const char * _exceptionType = NULL;
1941    const char * _exceptionMessage = NULL;
1942    jintArray _array = (jintArray) 0;
1943    jint _bufferOffset = (jint) 0;
1944    jint _remaining;
1945    GLint *params = (GLint *) 0;
1946
1947    if (!params_buf) {
1948        _exception = 1;
1949        _exceptionType = "java/lang/IllegalArgumentException";
1950        _exceptionMessage = "params == null";
1951        goto exit;
1952    }
1953    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1954    if (params == NULL) {
1955        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1956        params = (GLint *) (_paramsBase + _bufferOffset);
1957    }
1958    glGetSamplerParameterIiv(
1959        (GLuint)sampler,
1960        (GLenum)pname,
1961        (GLint *)params
1962    );
1963
1964exit:
1965    if (_array) {
1966        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
1967    }
1968    if (_exception) {
1969        jniThrowException(_env, _exceptionType, _exceptionMessage);
1970    }
1971}
1972
1973/* void glGetSamplerParameterIuiv ( GLuint sampler, GLenum pname, GLuint *params ) */
1974static void
1975android_glGetSamplerParameterIuiv__II_3II
1976  (JNIEnv *_env, jobject _this, jint sampler, jint pname, jintArray params_ref, jint offset) {
1977    jint _exception = 0;
1978    const char * _exceptionType = NULL;
1979    const char * _exceptionMessage = NULL;
1980    GLuint *params_base = (GLuint *) 0;
1981    jint _remaining;
1982    GLuint *params = (GLuint *) 0;
1983
1984    if (!params_ref) {
1985        _exception = 1;
1986        _exceptionType = "java/lang/IllegalArgumentException";
1987        _exceptionMessage = "params == null";
1988        goto exit;
1989    }
1990    if (offset < 0) {
1991        _exception = 1;
1992        _exceptionType = "java/lang/IllegalArgumentException";
1993        _exceptionMessage = "offset < 0";
1994        goto exit;
1995    }
1996    _remaining = _env->GetArrayLength(params_ref) - offset;
1997    params_base = (GLuint *)
1998        _env->GetIntArrayElements(params_ref, (jboolean *)0);
1999    params = params_base + offset;
2000
2001    glGetSamplerParameterIuiv(
2002        (GLuint)sampler,
2003        (GLenum)pname,
2004        (GLuint *)params
2005    );
2006
2007exit:
2008    if (params_base) {
2009        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
2010            _exception ? JNI_ABORT: 0);
2011    }
2012    if (_exception) {
2013        jniThrowException(_env, _exceptionType, _exceptionMessage);
2014    }
2015}
2016
2017/* void glGetSamplerParameterIuiv ( GLuint sampler, GLenum pname, GLuint *params ) */
2018static void
2019android_glGetSamplerParameterIuiv__IILjava_nio_IntBuffer_2
2020  (JNIEnv *_env, jobject _this, jint sampler, jint pname, jobject params_buf) {
2021    jint _exception = 0;
2022    const char * _exceptionType = NULL;
2023    const char * _exceptionMessage = NULL;
2024    jintArray _array = (jintArray) 0;
2025    jint _bufferOffset = (jint) 0;
2026    jint _remaining;
2027    GLuint *params = (GLuint *) 0;
2028
2029    if (!params_buf) {
2030        _exception = 1;
2031        _exceptionType = "java/lang/IllegalArgumentException";
2032        _exceptionMessage = "params == null";
2033        goto exit;
2034    }
2035    params = (GLuint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2036    if (params == NULL) {
2037        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
2038        params = (GLuint *) (_paramsBase + _bufferOffset);
2039    }
2040    glGetSamplerParameterIuiv(
2041        (GLuint)sampler,
2042        (GLenum)pname,
2043        (GLuint *)params
2044    );
2045
2046exit:
2047    if (_array) {
2048        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
2049    }
2050    if (_exception) {
2051        jniThrowException(_env, _exceptionType, _exceptionMessage);
2052    }
2053}
2054
2055/* void glTexBuffer ( GLenum target, GLenum internalformat, GLuint buffer ) */
2056static void
2057android_glTexBuffer__III
2058  (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint buffer) {
2059    glTexBuffer(
2060        (GLenum)target,
2061        (GLenum)internalformat,
2062        (GLuint)buffer
2063    );
2064}
2065
2066/* void glTexBufferRange ( GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size ) */
2067static void
2068android_glTexBufferRange__IIIII
2069  (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint buffer, jint offset, jint size) {
2070    glTexBufferRange(
2071        (GLenum)target,
2072        (GLenum)internalformat,
2073        (GLuint)buffer,
2074        (GLintptr)offset,
2075        (GLsizeiptr)size
2076    );
2077}
2078
2079/* void glTexStorage3DMultisample ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations ) */
2080static void
2081android_glTexStorage3DMultisample__IIIIIIZ
2082  (JNIEnv *_env, jobject _this, jint target, jint samples, jint internalformat, jint width, jint height, jint depth, jboolean fixedsamplelocations) {
2083    glTexStorage3DMultisample(
2084        (GLenum)target,
2085        (GLsizei)samples,
2086        (GLenum)internalformat,
2087        (GLsizei)width,
2088        (GLsizei)height,
2089        (GLsizei)depth,
2090        (GLboolean)fixedsamplelocations
2091    );
2092}
2093
2094static const char *classPathName = "android/opengl/GLES32";
2095
2096static const JNINativeMethod methods[] = {
2097{"_nativeClassInit", "()V", (void*)nativeClassInit },
2098{"glBlendBarrier", "()V", (void *) android_glBlendBarrier__ },
2099{"glCopyImageSubData", "(IIIIIIIIIIIIIII)V", (void *) android_glCopyImageSubData__IIIIIIIIIIIIIII },
2100{"glDebugMessageControl", "(IIII[IIZ)V", (void *) android_glDebugMessageControl__IIII_3IIZ },
2101{"glDebugMessageControl", "(IIIILjava/nio/IntBuffer;Z)V", (void *) android_glDebugMessageControl__IIIILjava_nio_IntBuffer_2Z },
2102{"glDebugMessageInsert", "(IIIIILjava/lang/String;)V", (void *) android_glDebugMessageInsert__IIIIILjava_lang_String_2 },
2103{"glDebugMessageCallback", "(Landroid/opengl/GLES32$DebugProc;)V", (void *) android_glDebugMessageCallback },
2104{"glGetDebugMessageLog", "(II[II[II[II[II[II[BI)I", (void *) android_glGetDebugMessageLog__II_3II_3II_3II_3II_3II_3BI },
2105{"glGetDebugMessageLog", "(ILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/ByteBuffer;)I", (void *) android_glGetDebugMessageLog__ILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_ByteBuffer_2 },
2106{"glGetDebugMessageLog", "(I[II[II[II[II)[Ljava/lang/String;", (void *) android_glGetDebugMessageLog__I_3II_3II_3II_3II },
2107{"glGetDebugMessageLog", "(ILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;)[Ljava/lang/String;", (void *) android_glGetDebugMessageLog__ILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
2108{"glPushDebugGroup", "(IIILjava/lang/String;)V", (void *) android_glPushDebugGroup__IIILjava_lang_String_2 },
2109{"glPopDebugGroup", "()V", (void *) android_glPopDebugGroup__ },
2110{"glObjectLabel", "(IIILjava/lang/String;)V", (void *) android_glObjectLabel__IIILjava_lang_String_2 },
2111{"glGetObjectLabel", "(II)Ljava/lang/String;", (void *) android_glGetObjectLabel },
2112{"glObjectPtrLabel", "(JLjava/lang/String;)V", (void *) android_glObjectPtrLabel },
2113{"glGetObjectPtrLabel", "(J)Ljava/lang/String;", (void *) android_glGetObjectPtrLabel },
2114{"glGetPointerv", "(I)J", (void *) android_glGetPointerv },
2115{"glEnablei", "(II)V", (void *) android_glEnablei__II },
2116{"glDisablei", "(II)V", (void *) android_glDisablei__II },
2117{"glBlendEquationi", "(II)V", (void *) android_glBlendEquationi__II },
2118{"glBlendEquationSeparatei", "(III)V", (void *) android_glBlendEquationSeparatei__III },
2119{"glBlendFunci", "(III)V", (void *) android_glBlendFunci__III },
2120{"glBlendFuncSeparatei", "(IIIII)V", (void *) android_glBlendFuncSeparatei__IIIII },
2121{"glColorMaski", "(IZZZZ)V", (void *) android_glColorMaski__IZZZZ },
2122{"glIsEnabledi", "(II)Z", (void *) android_glIsEnabledi__II },
2123{"glDrawElementsBaseVertex", "(IIILjava/nio/Buffer;I)V", (void *) android_glDrawElementsBaseVertex__IIILjava_nio_Buffer_2I },
2124{"glDrawRangeElementsBaseVertex", "(IIIIILjava/nio/Buffer;I)V", (void *) android_glDrawRangeElementsBaseVertex__IIIIILjava_nio_Buffer_2I },
2125{"glDrawElementsInstancedBaseVertex", "(IIILjava/nio/Buffer;II)V", (void *) android_glDrawElementsInstancedBaseVertex__IIILjava_nio_Buffer_2II },
2126{"glDrawElementsInstancedBaseVertex", "(IIIIII)V", (void *) android_glDrawElementsInstancedBaseVertex__IIIIII },
2127{"glFramebufferTexture", "(IIII)V", (void *) android_glFramebufferTexture__IIII },
2128{"glPrimitiveBoundingBox", "(FFFFFFFF)V", (void *) android_glPrimitiveBoundingBox__FFFFFFFF },
2129{"glGetGraphicsResetStatus", "()I", (void *) android_glGetGraphicsResetStatus__ },
2130{"glReadnPixels", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glReadnPixels__IIIIIIILjava_nio_Buffer_2 },
2131{"glGetnUniformfv", "(III[FI)V", (void *) android_glGetnUniformfv__III_3FI },
2132{"glGetnUniformfv", "(IIILjava/nio/FloatBuffer;)V", (void *) android_glGetnUniformfv__IIILjava_nio_FloatBuffer_2 },
2133{"glGetnUniformiv", "(III[II)V", (void *) android_glGetnUniformiv__III_3II },
2134{"glGetnUniformiv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetnUniformiv__IIILjava_nio_IntBuffer_2 },
2135{"glGetnUniformuiv", "(III[II)V", (void *) android_glGetnUniformuiv__III_3II },
2136{"glGetnUniformuiv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetnUniformuiv__IIILjava_nio_IntBuffer_2 },
2137{"glMinSampleShading", "(F)V", (void *) android_glMinSampleShading__F },
2138{"glPatchParameteri", "(II)V", (void *) android_glPatchParameteri__II },
2139{"glTexParameterIiv", "(II[II)V", (void *) android_glTexParameterIiv__II_3II },
2140{"glTexParameterIiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameterIiv__IILjava_nio_IntBuffer_2 },
2141{"glTexParameterIuiv", "(II[II)V", (void *) android_glTexParameterIuiv__II_3II },
2142{"glTexParameterIuiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameterIuiv__IILjava_nio_IntBuffer_2 },
2143{"glGetTexParameterIiv", "(II[II)V", (void *) android_glGetTexParameterIiv__II_3II },
2144{"glGetTexParameterIiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameterIiv__IILjava_nio_IntBuffer_2 },
2145{"glGetTexParameterIuiv", "(II[II)V", (void *) android_glGetTexParameterIuiv__II_3II },
2146{"glGetTexParameterIuiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameterIuiv__IILjava_nio_IntBuffer_2 },
2147{"glSamplerParameterIiv", "(II[II)V", (void *) android_glSamplerParameterIiv__II_3II },
2148{"glSamplerParameterIiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glSamplerParameterIiv__IILjava_nio_IntBuffer_2 },
2149{"glSamplerParameterIuiv", "(II[II)V", (void *) android_glSamplerParameterIuiv__II_3II },
2150{"glSamplerParameterIuiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glSamplerParameterIuiv__IILjava_nio_IntBuffer_2 },
2151{"glGetSamplerParameterIiv", "(II[II)V", (void *) android_glGetSamplerParameterIiv__II_3II },
2152{"glGetSamplerParameterIiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetSamplerParameterIiv__IILjava_nio_IntBuffer_2 },
2153{"glGetSamplerParameterIuiv", "(II[II)V", (void *) android_glGetSamplerParameterIuiv__II_3II },
2154{"glGetSamplerParameterIuiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetSamplerParameterIuiv__IILjava_nio_IntBuffer_2 },
2155{"glTexBuffer", "(III)V", (void *) android_glTexBuffer__III },
2156{"glTexBufferRange", "(IIIII)V", (void *) android_glTexBufferRange__IIIII },
2157{"glTexStorage3DMultisample", "(IIIIIIZ)V", (void *) android_glTexStorage3DMultisample__IIIIIIZ },
2158};
2159
2160int register_android_opengl_jni_GLES32(JNIEnv *_env)
2161{
2162    int err;
2163    err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
2164    return err;
2165}
2166