1/*
2**
3** Copyright 2013, The Android Open Source Project
4**
5** Licensed under the Apache License, Version 2.0 (the "License");
6** you may not use this file except in compliance with the License.
7** You may obtain a copy of the License at
8**
9**     http://www.apache.org/licenses/LICENSE-2.0
10**
11** Unless required by applicable law or agreed to in writing, software
12** distributed under the License is distributed on an "AS IS" BASIS,
13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14** See the License for the specific language governing permissions and
15** limitations under the License.
16*/
17
18// This source file is automatically generated
19
20#pragma GCC diagnostic ignored "-Wunused-variable"
21#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
22#pragma GCC diagnostic ignored "-Wunused-function"
23
24#include <GLES3/gl3.h>
25#include <GLES3/gl3ext.h>
26
27#include <jni.h>
28#include <JNIHelp.h>
29#include <android_runtime/AndroidRuntime.h>
30#include <utils/misc.h>
31#include <assert.h>
32
33static int initialized = 0;
34
35static jclass nioAccessClass;
36static jclass bufferClass;
37static jmethodID getBasePointerID;
38static jmethodID getBaseArrayID;
39static jmethodID getBaseArrayOffsetID;
40static jfieldID positionID;
41static jfieldID limitID;
42static jfieldID elementSizeShiftID;
43
44
45/* special calls implemented in Android's GLES wrapper used to more
46 * efficiently bound-check passed arrays */
47extern "C" {
48#ifdef GL_VERSION_ES_CM_1_1
49GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
50        const GLvoid *ptr, GLsizei count);
51GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
52        const GLvoid *pointer, GLsizei count);
53GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
54        GLsizei stride, const GLvoid *pointer, GLsizei count);
55GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
56        GLsizei stride, const GLvoid *pointer, GLsizei count);
57GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
58        GLsizei stride, const GLvoid *pointer, GLsizei count);
59GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
60        GLsizei stride, const GLvoid *pointer, GLsizei count);
61GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
62        GLsizei stride, const GLvoid *pointer, GLsizei count);
63#endif
64#ifdef GL_ES_VERSION_2_0
65static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type,
66        GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) {
67    glVertexAttribPointer(indx, size, type, normalized, stride, pointer);
68}
69#endif
70#ifdef GL_ES_VERSION_3_0
71static void glVertexAttribIPointerBounds(GLuint indx, GLint size, GLenum type,
72        GLsizei stride, const GLvoid *pointer, GLsizei count) {
73    glVertexAttribIPointer(indx, size, type, stride, pointer);
74}
75#endif
76}
77
78/* Cache method IDs each time the class is loaded. */
79
80static void
81nativeClassInit(JNIEnv *_env, jclass glImplClass)
82{
83    jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
84    nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
85
86    jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
87    bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
88
89    getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
90            "getBasePointer", "(Ljava/nio/Buffer;)J");
91    getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
92            "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
93    getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
94            "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
95
96    positionID = _env->GetFieldID(bufferClass, "position", "I");
97    limitID = _env->GetFieldID(bufferClass, "limit", "I");
98    elementSizeShiftID =
99        _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
100}
101
102static void *
103getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
104{
105    jint position;
106    jint limit;
107    jint elementSizeShift;
108    jlong pointer;
109
110    position = _env->GetIntField(buffer, positionID);
111    limit = _env->GetIntField(buffer, limitID);
112    elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
113    *remaining = (limit - position) << elementSizeShift;
114    pointer = _env->CallStaticLongMethod(nioAccessClass,
115            getBasePointerID, buffer);
116    if (pointer != 0L) {
117        *array = NULL;
118        return reinterpret_cast<void*>(pointer);
119    }
120
121    *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
122            getBaseArrayID, buffer);
123    *offset = _env->CallStaticIntMethod(nioAccessClass,
124            getBaseArrayOffsetID, buffer);
125
126    return NULL;
127}
128
129class ByteArrayGetter {
130public:
131    static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
132        return _env->GetByteArrayElements(array, is_copy);
133    }
134};
135class BooleanArrayGetter {
136public:
137    static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
138        return _env->GetBooleanArrayElements(array, is_copy);
139    }
140};
141class CharArrayGetter {
142public:
143    static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
144        return _env->GetCharArrayElements(array, is_copy);
145    }
146};
147class ShortArrayGetter {
148public:
149    static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
150        return _env->GetShortArrayElements(array, is_copy);
151    }
152};
153class IntArrayGetter {
154public:
155    static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
156        return _env->GetIntArrayElements(array, is_copy);
157    }
158};
159class LongArrayGetter {
160public:
161    static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
162        return _env->GetLongArrayElements(array, is_copy);
163    }
164};
165class FloatArrayGetter {
166public:
167    static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
168        return _env->GetFloatArrayElements(array, is_copy);
169    }
170};
171class DoubleArrayGetter {
172public:
173    static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
174        return _env->GetDoubleArrayElements(array, is_copy);
175    }
176};
177
178template<typename JTYPEARRAY, typename ARRAYGETTER>
179static void*
180getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
181    return ARRAYGETTER::Get(_env, array, is_copy);
182}
183
184class ByteArrayReleaser {
185public:
186    static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
187        _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
188    }
189};
190class BooleanArrayReleaser {
191public:
192    static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
193        _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
194    }
195};
196class CharArrayReleaser {
197public:
198    static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
199        _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
200    }
201};
202class ShortArrayReleaser {
203public:
204    static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
205        _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
206    }
207};
208class IntArrayReleaser {
209public:
210    static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
211        _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
212    }
213};
214class LongArrayReleaser {
215public:
216    static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
217        _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
218    }
219};
220class FloatArrayReleaser {
221public:
222    static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
223        _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
224    }
225};
226class DoubleArrayReleaser {
227public:
228    static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
229        _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
230    }
231};
232
233template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
234static void
235releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
236    ARRAYRELEASER::Release(_env, array, data, commit);
237}
238
239static void
240releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
241{
242    _env->ReleasePrimitiveArrayCritical(array, data,
243                       commit ? 0 : JNI_ABORT);
244}
245
246static void *
247getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
248    char* buf = (char*) _env->GetDirectBufferAddress(buffer);
249    if (buf) {
250        jint position = _env->GetIntField(buffer, positionID);
251        jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
252        buf += position << elementSizeShift;
253    } else {
254        jniThrowException(_env, "java/lang/IllegalArgumentException",
255                          "Must use a native order direct Buffer");
256    }
257    return (void*) buf;
258}
259
260// --------------------------------------------------------------------------
261
262/*
263 * returns the number of values glGet returns for a given pname.
264 *
265 * The code below is written such that pnames requiring only one values
266 * are the default (and are not explicitely tested for). This makes the
267 * checking code much shorter/readable/efficient.
268 *
269 * This means that unknown pnames (e.g.: extensions) will default to 1. If
270 * that unknown pname needs more than 1 value, then the validation check
271 * is incomplete and the app may crash if it passed the wrong number params.
272 */
273static int getNeededCount(GLint pname) {
274    int needed = 1;
275#ifdef GL_ES_VERSION_3_0
276    // GLES 3.x pnames
277    switch (pname) {
278        case GL_MAX_VIEWPORT_DIMS:
279            needed = 2;
280            break;
281
282        case GL_PROGRAM_BINARY_FORMATS:
283            glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &needed);
284            break;
285    }
286#endif
287
288#ifdef GL_ES_VERSION_2_0
289    // GLES 2.x pnames
290    switch (pname) {
291        case GL_ALIASED_LINE_WIDTH_RANGE:
292        case GL_ALIASED_POINT_SIZE_RANGE:
293            needed = 2;
294            break;
295
296        case GL_BLEND_COLOR:
297        case GL_COLOR_CLEAR_VALUE:
298        case GL_COLOR_WRITEMASK:
299        case GL_SCISSOR_BOX:
300        case GL_VIEWPORT:
301            needed = 4;
302            break;
303
304        case GL_COMPRESSED_TEXTURE_FORMATS:
305            glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
306            break;
307
308        case GL_SHADER_BINARY_FORMATS:
309            glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed);
310            break;
311    }
312#endif
313
314#ifdef GL_VERSION_ES_CM_1_1
315    // GLES 1.x pnames
316    switch (pname) {
317        case GL_ALIASED_LINE_WIDTH_RANGE:
318        case GL_ALIASED_POINT_SIZE_RANGE:
319        case GL_DEPTH_RANGE:
320        case GL_SMOOTH_LINE_WIDTH_RANGE:
321        case GL_SMOOTH_POINT_SIZE_RANGE:
322            needed = 2;
323            break;
324
325        case GL_CURRENT_NORMAL:
326        case GL_POINT_DISTANCE_ATTENUATION:
327            needed = 3;
328            break;
329
330        case GL_COLOR_CLEAR_VALUE:
331        case GL_COLOR_WRITEMASK:
332        case GL_CURRENT_COLOR:
333        case GL_CURRENT_TEXTURE_COORDS:
334        case GL_FOG_COLOR:
335        case GL_LIGHT_MODEL_AMBIENT:
336        case GL_SCISSOR_BOX:
337        case GL_VIEWPORT:
338            needed = 4;
339            break;
340
341        case GL_MODELVIEW_MATRIX:
342        case GL_PROJECTION_MATRIX:
343        case GL_TEXTURE_MATRIX:
344            needed = 16;
345            break;
346
347        case GL_COMPRESSED_TEXTURE_FORMATS:
348            glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
349            break;
350    }
351#endif
352    return needed;
353}
354
355template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
356          typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
357static void
358get
359  (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
360    jint _exception = 0;
361    const char * _exceptionType;
362    const char * _exceptionMessage;
363    CTYPE *params_base = (CTYPE *) 0;
364    jint _remaining;
365    CTYPE *params = (CTYPE *) 0;
366    int _needed = 0;
367
368    if (!params_ref) {
369        _exception = 1;
370        _exceptionType = "java/lang/IllegalArgumentException";
371        _exceptionMessage = "params == null";
372        goto exit;
373    }
374    if (offset < 0) {
375        _exception = 1;
376        _exceptionType = "java/lang/IllegalArgumentException";
377        _exceptionMessage = "offset < 0";
378        goto exit;
379    }
380    _remaining = _env->GetArrayLength(params_ref) - offset;
381    _needed = getNeededCount(pname);
382    // if we didn't find this pname, we just assume the user passed
383    // an array of the right size -- this might happen with extensions
384    // or if we forget an enum here.
385    if (_remaining < _needed) {
386        _exception = 1;
387        _exceptionType = "java/lang/IllegalArgumentException";
388        _exceptionMessage = "length - offset < needed";
389        goto exit;
390    }
391    params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
392        _env, params_ref, (jboolean *)0);
393    params = params_base + offset;
394
395    GET(
396        (GLenum)pname,
397        (CTYPE *)params
398    );
399
400exit:
401    if (params_base) {
402        releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
403            _env, params_ref, params_base, !_exception);
404    }
405    if (_exception) {
406        jniThrowException(_env, _exceptionType, _exceptionMessage);
407    }
408}
409
410
411template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
412          typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
413static void
414getarray
415  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
416    jint _exception = 0;
417    const char * _exceptionType;
418    const char * _exceptionMessage;
419    JTYPEARRAY _array = (JTYPEARRAY) 0;
420    jint _bufferOffset = (jint) 0;
421    jint _remaining;
422    CTYPE *params = (CTYPE *) 0;
423    int _needed = 0;
424
425    params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
426    _remaining /= sizeof(CTYPE);    // convert from bytes to item count
427    _needed = getNeededCount(pname);
428    // if we didn't find this pname, we just assume the user passed
429    // an array of the right size -- this might happen with extensions
430    // or if we forget an enum here.
431    if (_needed>0 && _remaining < _needed) {
432        _exception = 1;
433        _exceptionType = "java/lang/IllegalArgumentException";
434        _exceptionMessage = "remaining() < needed";
435        goto exit;
436    }
437    if (params == NULL) {
438        char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
439            _env, _array, (jboolean *) 0);
440        params = (CTYPE *) (_paramsBase + _bufferOffset);
441    }
442    GET(
443        (GLenum)pname,
444        (CTYPE *)params
445    );
446
447exit:
448    if (_array) {
449        releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
450            _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
451    }
452    if (_exception) {
453        jniThrowException(_env, _exceptionType, _exceptionMessage);
454    }
455}
456
457// --------------------------------------------------------------------------
458/* void glReadBuffer ( GLenum mode ) */
459static void
460android_glReadBuffer__I
461  (JNIEnv *_env, jobject _this, jint mode) {
462    glReadBuffer(
463        (GLenum)mode
464    );
465}
466
467/* void glDrawRangeElements ( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices ) */
468static void
469android_glDrawRangeElements__IIIIILjava_nio_Buffer_2
470  (JNIEnv *_env, jobject _this, jint mode, jint start, jint end, jint count, jint type, jobject indices_buf) {
471    jint _exception = 0;
472    const char * _exceptionType = NULL;
473    const char * _exceptionMessage = NULL;
474    jarray _array = (jarray) 0;
475    jint _bufferOffset = (jint) 0;
476    jint _remaining;
477    GLvoid *indices = (GLvoid *) 0;
478
479    if (!indices_buf) {
480        _exception = 1;
481        _exceptionType = "java/lang/IllegalArgumentException";
482        _exceptionMessage = "indices == null";
483        goto exit;
484    }
485    indices = (GLvoid *)getPointer(_env, indices_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
486    if (indices == NULL) {
487        char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
488        indices = (GLvoid *) (_indicesBase + _bufferOffset);
489    }
490    glDrawRangeElements(
491        (GLenum)mode,
492        (GLuint)start,
493        (GLuint)end,
494        (GLsizei)count,
495        (GLenum)type,
496        (GLvoid *)indices
497    );
498
499exit:
500    if (_array) {
501        releasePointer(_env, _array, indices, JNI_FALSE);
502    }
503    if (_exception) {
504        jniThrowException(_env, _exceptionType, _exceptionMessage);
505    }
506}
507
508/* void glDrawRangeElements ( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLsizei offset ) */
509static void
510android_glDrawRangeElements__IIIIII
511  (JNIEnv *_env, jobject _this, jint mode, jint start, jint end, jint count, jint type, jint offset) {
512    glDrawRangeElements(
513        (GLenum)mode,
514        (GLuint)start,
515        (GLuint)end,
516        (GLsizei)count,
517        (GLenum)type,
518        reinterpret_cast<GLvoid *>(offset)
519    );
520}
521
522/* void glTexImage3D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */
523static void
524android_glTexImage3D__IIIIIIIIILjava_nio_Buffer_2
525  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint depth, jint border, jint format, jint type, jobject pixels_buf) {
526    jint _exception = 0;
527    const char * _exceptionType = NULL;
528    const char * _exceptionMessage = NULL;
529    jarray _array = (jarray) 0;
530    jint _bufferOffset = (jint) 0;
531    jint _remaining;
532    GLvoid *pixels = (GLvoid *) 0;
533
534    if (pixels_buf) {
535        pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
536    }
537    if (pixels_buf && pixels == NULL) {
538        char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
539        pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
540    }
541    glTexImage3D(
542        (GLenum)target,
543        (GLint)level,
544        (GLint)internalformat,
545        (GLsizei)width,
546        (GLsizei)height,
547        (GLsizei)depth,
548        (GLint)border,
549        (GLenum)format,
550        (GLenum)type,
551        (GLvoid *)pixels
552    );
553    if (_array) {
554        releasePointer(_env, _array, pixels, JNI_FALSE);
555    }
556    if (_exception) {
557        jniThrowException(_env, _exceptionType, _exceptionMessage);
558    }
559}
560
561/* void glTexImage3D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLsizei offset ) */
562static void
563android_glTexImage3D__IIIIIIIIII
564  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint depth, jint border, jint format, jint type, jint offset) {
565    glTexImage3D(
566        (GLenum)target,
567        (GLint)level,
568        (GLint)internalformat,
569        (GLsizei)width,
570        (GLsizei)height,
571        (GLsizei)depth,
572        (GLint)border,
573        (GLenum)format,
574        (GLenum)type,
575        reinterpret_cast<GLvoid *>(offset)
576    );
577}
578
579/* void glTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels ) */
580static void
581android_glTexSubImage3D__IIIIIIIIIILjava_nio_Buffer_2
582  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint zoffset, jint width, jint height, jint depth, jint format, jint type, jobject pixels_buf) {
583    jint _exception = 0;
584    const char * _exceptionType = NULL;
585    const char * _exceptionMessage = NULL;
586    jarray _array = (jarray) 0;
587    jint _bufferOffset = (jint) 0;
588    jint _remaining;
589    GLvoid *pixels = (GLvoid *) 0;
590
591    if (!pixels_buf) {
592        _exception = 1;
593        _exceptionType = "java/lang/IllegalArgumentException";
594        _exceptionMessage = "pixels == null";
595        goto exit;
596    }
597    pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
598    if (pixels == NULL) {
599        char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
600        pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
601    }
602    glTexSubImage3D(
603        (GLenum)target,
604        (GLint)level,
605        (GLint)xoffset,
606        (GLint)yoffset,
607        (GLint)zoffset,
608        (GLsizei)width,
609        (GLsizei)height,
610        (GLsizei)depth,
611        (GLenum)format,
612        (GLenum)type,
613        (GLvoid *)pixels
614    );
615
616exit:
617    if (_array) {
618        releasePointer(_env, _array, pixels, JNI_FALSE);
619    }
620    if (_exception) {
621        jniThrowException(_env, _exceptionType, _exceptionMessage);
622    }
623}
624
625/* void glTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei offset ) */
626static void
627android_glTexSubImage3D__IIIIIIIIIII
628  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint zoffset, jint width, jint height, jint depth, jint format, jint type, jint offset) {
629    glTexSubImage3D(
630        (GLenum)target,
631        (GLint)level,
632        (GLint)xoffset,
633        (GLint)yoffset,
634        (GLint)zoffset,
635        (GLsizei)width,
636        (GLsizei)height,
637        (GLsizei)depth,
638        (GLenum)format,
639        (GLenum)type,
640        reinterpret_cast<GLvoid *>(offset)
641    );
642}
643
644/* void glCopyTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */
645static void
646android_glCopyTexSubImage3D__IIIIIIIII
647  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint zoffset, jint x, jint y, jint width, jint height) {
648    glCopyTexSubImage3D(
649        (GLenum)target,
650        (GLint)level,
651        (GLint)xoffset,
652        (GLint)yoffset,
653        (GLint)zoffset,
654        (GLint)x,
655        (GLint)y,
656        (GLsizei)width,
657        (GLsizei)height
658    );
659}
660
661/* void glCompressedTexImage3D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data ) */
662static void
663android_glCompressedTexImage3D__IIIIIIIILjava_nio_Buffer_2
664  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint depth, jint border, jint imageSize, jobject data_buf) {
665    jint _exception = 0;
666    const char * _exceptionType = NULL;
667    const char * _exceptionMessage = NULL;
668    jarray _array = (jarray) 0;
669    jint _bufferOffset = (jint) 0;
670    jint _remaining;
671    GLvoid *data = (GLvoid *) 0;
672
673    if (!data_buf) {
674        _exception = 1;
675        _exceptionType = "java/lang/IllegalArgumentException";
676        _exceptionMessage = "data == null";
677        goto exit;
678    }
679    data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
680    if (data == NULL) {
681        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
682        data = (GLvoid *) (_dataBase + _bufferOffset);
683    }
684    glCompressedTexImage3D(
685        (GLenum)target,
686        (GLint)level,
687        (GLenum)internalformat,
688        (GLsizei)width,
689        (GLsizei)height,
690        (GLsizei)depth,
691        (GLint)border,
692        (GLsizei)imageSize,
693        (GLvoid *)data
694    );
695
696exit:
697    if (_array) {
698        releasePointer(_env, _array, data, JNI_FALSE);
699    }
700    if (_exception) {
701        jniThrowException(_env, _exceptionType, _exceptionMessage);
702    }
703}
704
705/* void glCompressedTexImage3D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLsizei offset ) */
706static void
707android_glCompressedTexImage3D__IIIIIIIII
708  (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint depth, jint border, jint imageSize, jint offset) {
709    glCompressedTexImage3D(
710        (GLenum)target,
711        (GLint)level,
712        (GLenum)internalformat,
713        (GLsizei)width,
714        (GLsizei)height,
715        (GLsizei)depth,
716        (GLint)border,
717        (GLsizei)imageSize,
718        reinterpret_cast<GLvoid *>(offset)
719    );
720}
721
722/* void glCompressedTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data ) */
723static void
724android_glCompressedTexSubImage3D__IIIIIIIIIILjava_nio_Buffer_2
725  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint zoffset, jint width, jint height, jint depth, jint format, jint imageSize, jobject data_buf) {
726    jint _exception = 0;
727    const char * _exceptionType = NULL;
728    const char * _exceptionMessage = NULL;
729    jarray _array = (jarray) 0;
730    jint _bufferOffset = (jint) 0;
731    jint _remaining;
732    GLvoid *data = (GLvoid *) 0;
733
734    if (!data_buf) {
735        _exception = 1;
736        _exceptionType = "java/lang/IllegalArgumentException";
737        _exceptionMessage = "data == null";
738        goto exit;
739    }
740    data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
741    if (data == NULL) {
742        char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
743        data = (GLvoid *) (_dataBase + _bufferOffset);
744    }
745    glCompressedTexSubImage3D(
746        (GLenum)target,
747        (GLint)level,
748        (GLint)xoffset,
749        (GLint)yoffset,
750        (GLint)zoffset,
751        (GLsizei)width,
752        (GLsizei)height,
753        (GLsizei)depth,
754        (GLenum)format,
755        (GLsizei)imageSize,
756        (GLvoid *)data
757    );
758
759exit:
760    if (_array) {
761        releasePointer(_env, _array, data, JNI_FALSE);
762    }
763    if (_exception) {
764        jniThrowException(_env, _exceptionType, _exceptionMessage);
765    }
766}
767
768/* void glCompressedTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, GLsizei offset ) */
769static void
770android_glCompressedTexSubImage3D__IIIIIIIIIII
771  (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint zoffset, jint width, jint height, jint depth, jint format, jint imageSize, jint offset) {
772    glCompressedTexSubImage3D(
773        (GLenum)target,
774        (GLint)level,
775        (GLint)xoffset,
776        (GLint)yoffset,
777        (GLint)zoffset,
778        (GLsizei)width,
779        (GLsizei)height,
780        (GLsizei)depth,
781        (GLenum)format,
782        (GLsizei)imageSize,
783        reinterpret_cast<GLvoid *>(offset)
784    );
785}
786
787/* void glGenQueries ( GLsizei n, GLuint *ids ) */
788static void
789android_glGenQueries__I_3II
790  (JNIEnv *_env, jobject _this, jint n, jintArray ids_ref, jint offset) {
791    jint _exception = 0;
792    const char * _exceptionType = NULL;
793    const char * _exceptionMessage = NULL;
794    GLuint *ids_base = (GLuint *) 0;
795    jint _remaining;
796    GLuint *ids = (GLuint *) 0;
797
798    if (!ids_ref) {
799        _exception = 1;
800        _exceptionType = "java/lang/IllegalArgumentException";
801        _exceptionMessage = "ids == null";
802        goto exit;
803    }
804    if (offset < 0) {
805        _exception = 1;
806        _exceptionType = "java/lang/IllegalArgumentException";
807        _exceptionMessage = "offset < 0";
808        goto exit;
809    }
810    _remaining = _env->GetArrayLength(ids_ref) - offset;
811    ids_base = (GLuint *)
812        _env->GetIntArrayElements(ids_ref, (jboolean *)0);
813    ids = ids_base + offset;
814
815    glGenQueries(
816        (GLsizei)n,
817        (GLuint *)ids
818    );
819
820exit:
821    if (ids_base) {
822        _env->ReleaseIntArrayElements(ids_ref, (jint*)ids_base,
823            _exception ? JNI_ABORT: 0);
824    }
825    if (_exception) {
826        jniThrowException(_env, _exceptionType, _exceptionMessage);
827    }
828}
829
830/* void glGenQueries ( GLsizei n, GLuint *ids ) */
831static void
832android_glGenQueries__ILjava_nio_IntBuffer_2
833  (JNIEnv *_env, jobject _this, jint n, jobject ids_buf) {
834    jint _exception = 0;
835    const char * _exceptionType = NULL;
836    const char * _exceptionMessage = NULL;
837    jintArray _array = (jintArray) 0;
838    jint _bufferOffset = (jint) 0;
839    jint _remaining;
840    GLuint *ids = (GLuint *) 0;
841
842    if (!ids_buf) {
843        _exception = 1;
844        _exceptionType = "java/lang/IllegalArgumentException";
845        _exceptionMessage = "ids == null";
846        goto exit;
847    }
848    ids = (GLuint *)getPointer(_env, ids_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
849    if (ids == NULL) {
850        char * _idsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
851        ids = (GLuint *) (_idsBase + _bufferOffset);
852    }
853    glGenQueries(
854        (GLsizei)n,
855        (GLuint *)ids
856    );
857
858exit:
859    if (_array) {
860        _env->ReleaseIntArrayElements(_array, (jint*)ids, _exception ? JNI_ABORT : 0);
861    }
862    if (_exception) {
863        jniThrowException(_env, _exceptionType, _exceptionMessage);
864    }
865}
866
867/* void glDeleteQueries ( GLsizei n, const GLuint *ids ) */
868static void
869android_glDeleteQueries__I_3II
870  (JNIEnv *_env, jobject _this, jint n, jintArray ids_ref, jint offset) {
871    jint _exception = 0;
872    const char * _exceptionType = NULL;
873    const char * _exceptionMessage = NULL;
874    GLuint *ids_base = (GLuint *) 0;
875    jint _remaining;
876    GLuint *ids = (GLuint *) 0;
877
878    if (!ids_ref) {
879        _exception = 1;
880        _exceptionType = "java/lang/IllegalArgumentException";
881        _exceptionMessage = "ids == null";
882        goto exit;
883    }
884    if (offset < 0) {
885        _exception = 1;
886        _exceptionType = "java/lang/IllegalArgumentException";
887        _exceptionMessage = "offset < 0";
888        goto exit;
889    }
890    _remaining = _env->GetArrayLength(ids_ref) - offset;
891    ids_base = (GLuint *)
892        _env->GetIntArrayElements(ids_ref, (jboolean *)0);
893    ids = ids_base + offset;
894
895    glDeleteQueries(
896        (GLsizei)n,
897        (GLuint *)ids
898    );
899
900exit:
901    if (ids_base) {
902        _env->ReleaseIntArrayElements(ids_ref, (jint*)ids_base,
903            JNI_ABORT);
904    }
905    if (_exception) {
906        jniThrowException(_env, _exceptionType, _exceptionMessage);
907    }
908}
909
910/* void glDeleteQueries ( GLsizei n, const GLuint *ids ) */
911static void
912android_glDeleteQueries__ILjava_nio_IntBuffer_2
913  (JNIEnv *_env, jobject _this, jint n, jobject ids_buf) {
914    jint _exception = 0;
915    const char * _exceptionType = NULL;
916    const char * _exceptionMessage = NULL;
917    jintArray _array = (jintArray) 0;
918    jint _bufferOffset = (jint) 0;
919    jint _remaining;
920    GLuint *ids = (GLuint *) 0;
921
922    if (!ids_buf) {
923        _exception = 1;
924        _exceptionType = "java/lang/IllegalArgumentException";
925        _exceptionMessage = "ids == null";
926        goto exit;
927    }
928    ids = (GLuint *)getPointer(_env, ids_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
929    if (ids == NULL) {
930        char * _idsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
931        ids = (GLuint *) (_idsBase + _bufferOffset);
932    }
933    glDeleteQueries(
934        (GLsizei)n,
935        (GLuint *)ids
936    );
937
938exit:
939    if (_array) {
940        _env->ReleaseIntArrayElements(_array, (jint*)ids, JNI_ABORT);
941    }
942    if (_exception) {
943        jniThrowException(_env, _exceptionType, _exceptionMessage);
944    }
945}
946
947/* GLboolean glIsQuery ( GLuint id ) */
948static jboolean
949android_glIsQuery__I
950  (JNIEnv *_env, jobject _this, jint id) {
951    GLboolean _returnValue;
952    _returnValue = glIsQuery(
953        (GLuint)id
954    );
955    return (jboolean)_returnValue;
956}
957
958/* void glBeginQuery ( GLenum target, GLuint id ) */
959static void
960android_glBeginQuery__II
961  (JNIEnv *_env, jobject _this, jint target, jint id) {
962    glBeginQuery(
963        (GLenum)target,
964        (GLuint)id
965    );
966}
967
968/* void glEndQuery ( GLenum target ) */
969static void
970android_glEndQuery__I
971  (JNIEnv *_env, jobject _this, jint target) {
972    glEndQuery(
973        (GLenum)target
974    );
975}
976
977/* void glGetQueryiv ( GLenum target, GLenum pname, GLint *params ) */
978static void
979android_glGetQueryiv__II_3II
980  (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
981    jint _exception = 0;
982    const char * _exceptionType = NULL;
983    const char * _exceptionMessage = NULL;
984    GLint *params_base = (GLint *) 0;
985    jint _remaining;
986    GLint *params = (GLint *) 0;
987
988    if (!params_ref) {
989        _exception = 1;
990        _exceptionType = "java/lang/IllegalArgumentException";
991        _exceptionMessage = "params == null";
992        goto exit;
993    }
994    if (offset < 0) {
995        _exception = 1;
996        _exceptionType = "java/lang/IllegalArgumentException";
997        _exceptionMessage = "offset < 0";
998        goto exit;
999    }
1000    _remaining = _env->GetArrayLength(params_ref) - offset;
1001    params_base = (GLint *)
1002        _env->GetIntArrayElements(params_ref, (jboolean *)0);
1003    params = params_base + offset;
1004
1005    glGetQueryiv(
1006        (GLenum)target,
1007        (GLenum)pname,
1008        (GLint *)params
1009    );
1010
1011exit:
1012    if (params_base) {
1013        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
1014            _exception ? JNI_ABORT: 0);
1015    }
1016    if (_exception) {
1017        jniThrowException(_env, _exceptionType, _exceptionMessage);
1018    }
1019}
1020
1021/* void glGetQueryiv ( GLenum target, GLenum pname, GLint *params ) */
1022static void
1023android_glGetQueryiv__IILjava_nio_IntBuffer_2
1024  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
1025    jint _exception = 0;
1026    const char * _exceptionType = NULL;
1027    const char * _exceptionMessage = NULL;
1028    jintArray _array = (jintArray) 0;
1029    jint _bufferOffset = (jint) 0;
1030    jint _remaining;
1031    GLint *params = (GLint *) 0;
1032
1033    if (!params_buf) {
1034        _exception = 1;
1035        _exceptionType = "java/lang/IllegalArgumentException";
1036        _exceptionMessage = "params == null";
1037        goto exit;
1038    }
1039    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1040    if (params == NULL) {
1041        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1042        params = (GLint *) (_paramsBase + _bufferOffset);
1043    }
1044    glGetQueryiv(
1045        (GLenum)target,
1046        (GLenum)pname,
1047        (GLint *)params
1048    );
1049
1050exit:
1051    if (_array) {
1052        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
1053    }
1054    if (_exception) {
1055        jniThrowException(_env, _exceptionType, _exceptionMessage);
1056    }
1057}
1058
1059/* void glGetQueryObjectuiv ( GLuint id, GLenum pname, GLuint *params ) */
1060static void
1061android_glGetQueryObjectuiv__II_3II
1062  (JNIEnv *_env, jobject _this, jint id, jint pname, jintArray params_ref, jint offset) {
1063    jint _exception = 0;
1064    const char * _exceptionType = NULL;
1065    const char * _exceptionMessage = NULL;
1066    GLuint *params_base = (GLuint *) 0;
1067    jint _remaining;
1068    GLuint *params = (GLuint *) 0;
1069
1070    if (!params_ref) {
1071        _exception = 1;
1072        _exceptionType = "java/lang/IllegalArgumentException";
1073        _exceptionMessage = "params == null";
1074        goto exit;
1075    }
1076    if (offset < 0) {
1077        _exception = 1;
1078        _exceptionType = "java/lang/IllegalArgumentException";
1079        _exceptionMessage = "offset < 0";
1080        goto exit;
1081    }
1082    _remaining = _env->GetArrayLength(params_ref) - offset;
1083    params_base = (GLuint *)
1084        _env->GetIntArrayElements(params_ref, (jboolean *)0);
1085    params = params_base + offset;
1086
1087    glGetQueryObjectuiv(
1088        (GLuint)id,
1089        (GLenum)pname,
1090        (GLuint *)params
1091    );
1092
1093exit:
1094    if (params_base) {
1095        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
1096            _exception ? JNI_ABORT: 0);
1097    }
1098    if (_exception) {
1099        jniThrowException(_env, _exceptionType, _exceptionMessage);
1100    }
1101}
1102
1103/* void glGetQueryObjectuiv ( GLuint id, GLenum pname, GLuint *params ) */
1104static void
1105android_glGetQueryObjectuiv__IILjava_nio_IntBuffer_2
1106  (JNIEnv *_env, jobject _this, jint id, jint pname, jobject params_buf) {
1107    jint _exception = 0;
1108    const char * _exceptionType = NULL;
1109    const char * _exceptionMessage = NULL;
1110    jintArray _array = (jintArray) 0;
1111    jint _bufferOffset = (jint) 0;
1112    jint _remaining;
1113    GLuint *params = (GLuint *) 0;
1114
1115    if (!params_buf) {
1116        _exception = 1;
1117        _exceptionType = "java/lang/IllegalArgumentException";
1118        _exceptionMessage = "params == null";
1119        goto exit;
1120    }
1121    params = (GLuint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1122    if (params == NULL) {
1123        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1124        params = (GLuint *) (_paramsBase + _bufferOffset);
1125    }
1126    glGetQueryObjectuiv(
1127        (GLuint)id,
1128        (GLenum)pname,
1129        (GLuint *)params
1130    );
1131
1132exit:
1133    if (_array) {
1134        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
1135    }
1136    if (_exception) {
1137        jniThrowException(_env, _exceptionType, _exceptionMessage);
1138    }
1139}
1140
1141/* GLboolean glUnmapBuffer ( GLenum target ) */
1142static jboolean
1143android_glUnmapBuffer__I
1144  (JNIEnv *_env, jobject _this, jint target) {
1145    GLboolean _returnValue;
1146    _returnValue = glUnmapBuffer(
1147        (GLenum)target
1148    );
1149    return (jboolean)_returnValue;
1150}
1151
1152/* void glGetBufferPointerv ( GLenum target, GLenum pname, GLvoid** params ) */
1153static jobject
1154android_glGetBufferPointerv__II
1155  (JNIEnv *_env, jobject _this, jint target, jint pname) {
1156    GLint64 _mapLength;
1157    GLvoid* _p;
1158    glGetBufferParameteri64v((GLenum)target, GL_BUFFER_MAP_LENGTH, &_mapLength);
1159    glGetBufferPointerv((GLenum)target, (GLenum)pname, &_p);
1160    return _env->NewDirectByteBuffer(_p, _mapLength);
1161}
1162
1163/* void glDrawBuffers ( GLsizei n, const GLenum *bufs ) */
1164static void
1165android_glDrawBuffers__I_3II
1166  (JNIEnv *_env, jobject _this, jint n, jintArray bufs_ref, jint offset) {
1167    jint _exception = 0;
1168    const char * _exceptionType = NULL;
1169    const char * _exceptionMessage = NULL;
1170    GLenum *bufs_base = (GLenum *) 0;
1171    jint _remaining;
1172    GLenum *bufs = (GLenum *) 0;
1173
1174    if (!bufs_ref) {
1175        _exception = 1;
1176        _exceptionType = "java/lang/IllegalArgumentException";
1177        _exceptionMessage = "bufs == null";
1178        goto exit;
1179    }
1180    if (offset < 0) {
1181        _exception = 1;
1182        _exceptionType = "java/lang/IllegalArgumentException";
1183        _exceptionMessage = "offset < 0";
1184        goto exit;
1185    }
1186    _remaining = _env->GetArrayLength(bufs_ref) - offset;
1187    bufs_base = (GLenum *)
1188        _env->GetIntArrayElements(bufs_ref, (jboolean *)0);
1189    bufs = bufs_base + offset;
1190
1191    glDrawBuffers(
1192        (GLsizei)n,
1193        (GLenum *)bufs
1194    );
1195
1196exit:
1197    if (bufs_base) {
1198        _env->ReleaseIntArrayElements(bufs_ref, (jint*)bufs_base,
1199            JNI_ABORT);
1200    }
1201    if (_exception) {
1202        jniThrowException(_env, _exceptionType, _exceptionMessage);
1203    }
1204}
1205
1206/* void glDrawBuffers ( GLsizei n, const GLenum *bufs ) */
1207static void
1208android_glDrawBuffers__ILjava_nio_IntBuffer_2
1209  (JNIEnv *_env, jobject _this, jint n, jobject bufs_buf) {
1210    jint _exception = 0;
1211    const char * _exceptionType = NULL;
1212    const char * _exceptionMessage = NULL;
1213    jintArray _array = (jintArray) 0;
1214    jint _bufferOffset = (jint) 0;
1215    jint _remaining;
1216    GLenum *bufs = (GLenum *) 0;
1217
1218    if (!bufs_buf) {
1219        _exception = 1;
1220        _exceptionType = "java/lang/IllegalArgumentException";
1221        _exceptionMessage = "bufs == null";
1222        goto exit;
1223    }
1224    bufs = (GLenum *)getPointer(_env, bufs_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1225    if (bufs == NULL) {
1226        char * _bufsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1227        bufs = (GLenum *) (_bufsBase + _bufferOffset);
1228    }
1229    glDrawBuffers(
1230        (GLsizei)n,
1231        (GLenum *)bufs
1232    );
1233
1234exit:
1235    if (_array) {
1236        _env->ReleaseIntArrayElements(_array, (jint*)bufs, JNI_ABORT);
1237    }
1238    if (_exception) {
1239        jniThrowException(_env, _exceptionType, _exceptionMessage);
1240    }
1241}
1242
1243/* void glUniformMatrix2x3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
1244static void
1245android_glUniformMatrix2x3fv__IIZ_3FI
1246  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
1247    jint _exception = 0;
1248    const char * _exceptionType = NULL;
1249    const char * _exceptionMessage = NULL;
1250    GLfloat *value_base = (GLfloat *) 0;
1251    jint _remaining;
1252    GLfloat *value = (GLfloat *) 0;
1253
1254    if (!value_ref) {
1255        _exception = 1;
1256        _exceptionType = "java/lang/IllegalArgumentException";
1257        _exceptionMessage = "value == null";
1258        goto exit;
1259    }
1260    if (offset < 0) {
1261        _exception = 1;
1262        _exceptionType = "java/lang/IllegalArgumentException";
1263        _exceptionMessage = "offset < 0";
1264        goto exit;
1265    }
1266    _remaining = _env->GetArrayLength(value_ref) - offset;
1267    value_base = (GLfloat *)
1268        _env->GetFloatArrayElements(value_ref, (jboolean *)0);
1269    value = value_base + offset;
1270
1271    glUniformMatrix2x3fv(
1272        (GLint)location,
1273        (GLsizei)count,
1274        (GLboolean)transpose,
1275        (GLfloat *)value
1276    );
1277
1278exit:
1279    if (value_base) {
1280        _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
1281            JNI_ABORT);
1282    }
1283    if (_exception) {
1284        jniThrowException(_env, _exceptionType, _exceptionMessage);
1285    }
1286}
1287
1288/* void glUniformMatrix2x3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
1289static void
1290android_glUniformMatrix2x3fv__IIZLjava_nio_FloatBuffer_2
1291  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
1292    jint _exception = 0;
1293    const char * _exceptionType = NULL;
1294    const char * _exceptionMessage = NULL;
1295    jfloatArray _array = (jfloatArray) 0;
1296    jint _bufferOffset = (jint) 0;
1297    jint _remaining;
1298    GLfloat *value = (GLfloat *) 0;
1299
1300    if (!value_buf) {
1301        _exception = 1;
1302        _exceptionType = "java/lang/IllegalArgumentException";
1303        _exceptionMessage = "value == null";
1304        goto exit;
1305    }
1306    value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1307    if (value == NULL) {
1308        char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
1309        value = (GLfloat *) (_valueBase + _bufferOffset);
1310    }
1311    glUniformMatrix2x3fv(
1312        (GLint)location,
1313        (GLsizei)count,
1314        (GLboolean)transpose,
1315        (GLfloat *)value
1316    );
1317
1318exit:
1319    if (_array) {
1320        _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
1321    }
1322    if (_exception) {
1323        jniThrowException(_env, _exceptionType, _exceptionMessage);
1324    }
1325}
1326
1327/* void glUniformMatrix3x2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
1328static void
1329android_glUniformMatrix3x2fv__IIZ_3FI
1330  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
1331    jint _exception = 0;
1332    const char * _exceptionType = NULL;
1333    const char * _exceptionMessage = NULL;
1334    GLfloat *value_base = (GLfloat *) 0;
1335    jint _remaining;
1336    GLfloat *value = (GLfloat *) 0;
1337
1338    if (!value_ref) {
1339        _exception = 1;
1340        _exceptionType = "java/lang/IllegalArgumentException";
1341        _exceptionMessage = "value == null";
1342        goto exit;
1343    }
1344    if (offset < 0) {
1345        _exception = 1;
1346        _exceptionType = "java/lang/IllegalArgumentException";
1347        _exceptionMessage = "offset < 0";
1348        goto exit;
1349    }
1350    _remaining = _env->GetArrayLength(value_ref) - offset;
1351    value_base = (GLfloat *)
1352        _env->GetFloatArrayElements(value_ref, (jboolean *)0);
1353    value = value_base + offset;
1354
1355    glUniformMatrix3x2fv(
1356        (GLint)location,
1357        (GLsizei)count,
1358        (GLboolean)transpose,
1359        (GLfloat *)value
1360    );
1361
1362exit:
1363    if (value_base) {
1364        _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
1365            JNI_ABORT);
1366    }
1367    if (_exception) {
1368        jniThrowException(_env, _exceptionType, _exceptionMessage);
1369    }
1370}
1371
1372/* void glUniformMatrix3x2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
1373static void
1374android_glUniformMatrix3x2fv__IIZLjava_nio_FloatBuffer_2
1375  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
1376    jint _exception = 0;
1377    const char * _exceptionType = NULL;
1378    const char * _exceptionMessage = NULL;
1379    jfloatArray _array = (jfloatArray) 0;
1380    jint _bufferOffset = (jint) 0;
1381    jint _remaining;
1382    GLfloat *value = (GLfloat *) 0;
1383
1384    if (!value_buf) {
1385        _exception = 1;
1386        _exceptionType = "java/lang/IllegalArgumentException";
1387        _exceptionMessage = "value == null";
1388        goto exit;
1389    }
1390    value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1391    if (value == NULL) {
1392        char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
1393        value = (GLfloat *) (_valueBase + _bufferOffset);
1394    }
1395    glUniformMatrix3x2fv(
1396        (GLint)location,
1397        (GLsizei)count,
1398        (GLboolean)transpose,
1399        (GLfloat *)value
1400    );
1401
1402exit:
1403    if (_array) {
1404        _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
1405    }
1406    if (_exception) {
1407        jniThrowException(_env, _exceptionType, _exceptionMessage);
1408    }
1409}
1410
1411/* void glUniformMatrix2x4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
1412static void
1413android_glUniformMatrix2x4fv__IIZ_3FI
1414  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
1415    jint _exception = 0;
1416    const char * _exceptionType = NULL;
1417    const char * _exceptionMessage = NULL;
1418    GLfloat *value_base = (GLfloat *) 0;
1419    jint _remaining;
1420    GLfloat *value = (GLfloat *) 0;
1421
1422    if (!value_ref) {
1423        _exception = 1;
1424        _exceptionType = "java/lang/IllegalArgumentException";
1425        _exceptionMessage = "value == null";
1426        goto exit;
1427    }
1428    if (offset < 0) {
1429        _exception = 1;
1430        _exceptionType = "java/lang/IllegalArgumentException";
1431        _exceptionMessage = "offset < 0";
1432        goto exit;
1433    }
1434    _remaining = _env->GetArrayLength(value_ref) - offset;
1435    value_base = (GLfloat *)
1436        _env->GetFloatArrayElements(value_ref, (jboolean *)0);
1437    value = value_base + offset;
1438
1439    glUniformMatrix2x4fv(
1440        (GLint)location,
1441        (GLsizei)count,
1442        (GLboolean)transpose,
1443        (GLfloat *)value
1444    );
1445
1446exit:
1447    if (value_base) {
1448        _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
1449            JNI_ABORT);
1450    }
1451    if (_exception) {
1452        jniThrowException(_env, _exceptionType, _exceptionMessage);
1453    }
1454}
1455
1456/* void glUniformMatrix2x4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
1457static void
1458android_glUniformMatrix2x4fv__IIZLjava_nio_FloatBuffer_2
1459  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
1460    jint _exception = 0;
1461    const char * _exceptionType = NULL;
1462    const char * _exceptionMessage = NULL;
1463    jfloatArray _array = (jfloatArray) 0;
1464    jint _bufferOffset = (jint) 0;
1465    jint _remaining;
1466    GLfloat *value = (GLfloat *) 0;
1467
1468    if (!value_buf) {
1469        _exception = 1;
1470        _exceptionType = "java/lang/IllegalArgumentException";
1471        _exceptionMessage = "value == null";
1472        goto exit;
1473    }
1474    value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1475    if (value == NULL) {
1476        char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
1477        value = (GLfloat *) (_valueBase + _bufferOffset);
1478    }
1479    glUniformMatrix2x4fv(
1480        (GLint)location,
1481        (GLsizei)count,
1482        (GLboolean)transpose,
1483        (GLfloat *)value
1484    );
1485
1486exit:
1487    if (_array) {
1488        _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
1489    }
1490    if (_exception) {
1491        jniThrowException(_env, _exceptionType, _exceptionMessage);
1492    }
1493}
1494
1495/* void glUniformMatrix4x2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
1496static void
1497android_glUniformMatrix4x2fv__IIZ_3FI
1498  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
1499    jint _exception = 0;
1500    const char * _exceptionType = NULL;
1501    const char * _exceptionMessage = NULL;
1502    GLfloat *value_base = (GLfloat *) 0;
1503    jint _remaining;
1504    GLfloat *value = (GLfloat *) 0;
1505
1506    if (!value_ref) {
1507        _exception = 1;
1508        _exceptionType = "java/lang/IllegalArgumentException";
1509        _exceptionMessage = "value == null";
1510        goto exit;
1511    }
1512    if (offset < 0) {
1513        _exception = 1;
1514        _exceptionType = "java/lang/IllegalArgumentException";
1515        _exceptionMessage = "offset < 0";
1516        goto exit;
1517    }
1518    _remaining = _env->GetArrayLength(value_ref) - offset;
1519    value_base = (GLfloat *)
1520        _env->GetFloatArrayElements(value_ref, (jboolean *)0);
1521    value = value_base + offset;
1522
1523    glUniformMatrix4x2fv(
1524        (GLint)location,
1525        (GLsizei)count,
1526        (GLboolean)transpose,
1527        (GLfloat *)value
1528    );
1529
1530exit:
1531    if (value_base) {
1532        _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
1533            JNI_ABORT);
1534    }
1535    if (_exception) {
1536        jniThrowException(_env, _exceptionType, _exceptionMessage);
1537    }
1538}
1539
1540/* void glUniformMatrix4x2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
1541static void
1542android_glUniformMatrix4x2fv__IIZLjava_nio_FloatBuffer_2
1543  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
1544    jint _exception = 0;
1545    const char * _exceptionType = NULL;
1546    const char * _exceptionMessage = NULL;
1547    jfloatArray _array = (jfloatArray) 0;
1548    jint _bufferOffset = (jint) 0;
1549    jint _remaining;
1550    GLfloat *value = (GLfloat *) 0;
1551
1552    if (!value_buf) {
1553        _exception = 1;
1554        _exceptionType = "java/lang/IllegalArgumentException";
1555        _exceptionMessage = "value == null";
1556        goto exit;
1557    }
1558    value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1559    if (value == NULL) {
1560        char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
1561        value = (GLfloat *) (_valueBase + _bufferOffset);
1562    }
1563    glUniformMatrix4x2fv(
1564        (GLint)location,
1565        (GLsizei)count,
1566        (GLboolean)transpose,
1567        (GLfloat *)value
1568    );
1569
1570exit:
1571    if (_array) {
1572        _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
1573    }
1574    if (_exception) {
1575        jniThrowException(_env, _exceptionType, _exceptionMessage);
1576    }
1577}
1578
1579/* void glUniformMatrix3x4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
1580static void
1581android_glUniformMatrix3x4fv__IIZ_3FI
1582  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
1583    jint _exception = 0;
1584    const char * _exceptionType = NULL;
1585    const char * _exceptionMessage = NULL;
1586    GLfloat *value_base = (GLfloat *) 0;
1587    jint _remaining;
1588    GLfloat *value = (GLfloat *) 0;
1589
1590    if (!value_ref) {
1591        _exception = 1;
1592        _exceptionType = "java/lang/IllegalArgumentException";
1593        _exceptionMessage = "value == null";
1594        goto exit;
1595    }
1596    if (offset < 0) {
1597        _exception = 1;
1598        _exceptionType = "java/lang/IllegalArgumentException";
1599        _exceptionMessage = "offset < 0";
1600        goto exit;
1601    }
1602    _remaining = _env->GetArrayLength(value_ref) - offset;
1603    value_base = (GLfloat *)
1604        _env->GetFloatArrayElements(value_ref, (jboolean *)0);
1605    value = value_base + offset;
1606
1607    glUniformMatrix3x4fv(
1608        (GLint)location,
1609        (GLsizei)count,
1610        (GLboolean)transpose,
1611        (GLfloat *)value
1612    );
1613
1614exit:
1615    if (value_base) {
1616        _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
1617            JNI_ABORT);
1618    }
1619    if (_exception) {
1620        jniThrowException(_env, _exceptionType, _exceptionMessage);
1621    }
1622}
1623
1624/* void glUniformMatrix3x4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
1625static void
1626android_glUniformMatrix3x4fv__IIZLjava_nio_FloatBuffer_2
1627  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
1628    jint _exception = 0;
1629    const char * _exceptionType = NULL;
1630    const char * _exceptionMessage = NULL;
1631    jfloatArray _array = (jfloatArray) 0;
1632    jint _bufferOffset = (jint) 0;
1633    jint _remaining;
1634    GLfloat *value = (GLfloat *) 0;
1635
1636    if (!value_buf) {
1637        _exception = 1;
1638        _exceptionType = "java/lang/IllegalArgumentException";
1639        _exceptionMessage = "value == null";
1640        goto exit;
1641    }
1642    value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1643    if (value == NULL) {
1644        char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
1645        value = (GLfloat *) (_valueBase + _bufferOffset);
1646    }
1647    glUniformMatrix3x4fv(
1648        (GLint)location,
1649        (GLsizei)count,
1650        (GLboolean)transpose,
1651        (GLfloat *)value
1652    );
1653
1654exit:
1655    if (_array) {
1656        _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
1657    }
1658    if (_exception) {
1659        jniThrowException(_env, _exceptionType, _exceptionMessage);
1660    }
1661}
1662
1663/* void glUniformMatrix4x3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
1664static void
1665android_glUniformMatrix4x3fv__IIZ_3FI
1666  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
1667    jint _exception = 0;
1668    const char * _exceptionType = NULL;
1669    const char * _exceptionMessage = NULL;
1670    GLfloat *value_base = (GLfloat *) 0;
1671    jint _remaining;
1672    GLfloat *value = (GLfloat *) 0;
1673
1674    if (!value_ref) {
1675        _exception = 1;
1676        _exceptionType = "java/lang/IllegalArgumentException";
1677        _exceptionMessage = "value == null";
1678        goto exit;
1679    }
1680    if (offset < 0) {
1681        _exception = 1;
1682        _exceptionType = "java/lang/IllegalArgumentException";
1683        _exceptionMessage = "offset < 0";
1684        goto exit;
1685    }
1686    _remaining = _env->GetArrayLength(value_ref) - offset;
1687    value_base = (GLfloat *)
1688        _env->GetFloatArrayElements(value_ref, (jboolean *)0);
1689    value = value_base + offset;
1690
1691    glUniformMatrix4x3fv(
1692        (GLint)location,
1693        (GLsizei)count,
1694        (GLboolean)transpose,
1695        (GLfloat *)value
1696    );
1697
1698exit:
1699    if (value_base) {
1700        _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
1701            JNI_ABORT);
1702    }
1703    if (_exception) {
1704        jniThrowException(_env, _exceptionType, _exceptionMessage);
1705    }
1706}
1707
1708/* void glUniformMatrix4x3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
1709static void
1710android_glUniformMatrix4x3fv__IIZLjava_nio_FloatBuffer_2
1711  (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
1712    jint _exception = 0;
1713    const char * _exceptionType = NULL;
1714    const char * _exceptionMessage = NULL;
1715    jfloatArray _array = (jfloatArray) 0;
1716    jint _bufferOffset = (jint) 0;
1717    jint _remaining;
1718    GLfloat *value = (GLfloat *) 0;
1719
1720    if (!value_buf) {
1721        _exception = 1;
1722        _exceptionType = "java/lang/IllegalArgumentException";
1723        _exceptionMessage = "value == null";
1724        goto exit;
1725    }
1726    value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1727    if (value == NULL) {
1728        char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
1729        value = (GLfloat *) (_valueBase + _bufferOffset);
1730    }
1731    glUniformMatrix4x3fv(
1732        (GLint)location,
1733        (GLsizei)count,
1734        (GLboolean)transpose,
1735        (GLfloat *)value
1736    );
1737
1738exit:
1739    if (_array) {
1740        _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
1741    }
1742    if (_exception) {
1743        jniThrowException(_env, _exceptionType, _exceptionMessage);
1744    }
1745}
1746
1747/* void glBlitFramebuffer ( GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter ) */
1748static void
1749android_glBlitFramebuffer__IIIIIIIIII
1750  (JNIEnv *_env, jobject _this, jint srcX0, jint srcY0, jint srcX1, jint srcY1, jint dstX0, jint dstY0, jint dstX1, jint dstY1, jint mask, jint filter) {
1751    glBlitFramebuffer(
1752        (GLint)srcX0,
1753        (GLint)srcY0,
1754        (GLint)srcX1,
1755        (GLint)srcY1,
1756        (GLint)dstX0,
1757        (GLint)dstY0,
1758        (GLint)dstX1,
1759        (GLint)dstY1,
1760        (GLbitfield)mask,
1761        (GLenum)filter
1762    );
1763}
1764
1765/* void glRenderbufferStorageMultisample ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height ) */
1766static void
1767android_glRenderbufferStorageMultisample__IIIII
1768  (JNIEnv *_env, jobject _this, jint target, jint samples, jint internalformat, jint width, jint height) {
1769    glRenderbufferStorageMultisample(
1770        (GLenum)target,
1771        (GLsizei)samples,
1772        (GLenum)internalformat,
1773        (GLsizei)width,
1774        (GLsizei)height
1775    );
1776}
1777
1778/* void glFramebufferTextureLayer ( GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer ) */
1779static void
1780android_glFramebufferTextureLayer__IIIII
1781  (JNIEnv *_env, jobject _this, jint target, jint attachment, jint texture, jint level, jint layer) {
1782    glFramebufferTextureLayer(
1783        (GLenum)target,
1784        (GLenum)attachment,
1785        (GLuint)texture,
1786        (GLint)level,
1787        (GLint)layer
1788    );
1789}
1790
1791/* GLvoid * glMapBufferRange ( GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access ) */
1792static jobject
1793android_glMapBufferRange__IIII
1794  (JNIEnv *_env, jobject _this, jint target, jint offset, jint length, jint access) {
1795    GLvoid* _p = glMapBufferRange((GLenum)target,
1796            (GLintptr)offset, (GLsizeiptr)length, (GLbitfield)access);
1797    jobject _buf = (jobject)0;
1798    if (_p) {
1799        _buf = _env->NewDirectByteBuffer(_p, length);
1800    }
1801    return _buf;
1802}
1803
1804/* void glFlushMappedBufferRange ( GLenum target, GLintptr offset, GLsizeiptr length ) */
1805static void
1806android_glFlushMappedBufferRange__III
1807  (JNIEnv *_env, jobject _this, jint target, jint offset, jint length) {
1808    glFlushMappedBufferRange(
1809        (GLenum)target,
1810        (GLintptr)offset,
1811        (GLsizeiptr)length
1812    );
1813}
1814
1815/* void glBindVertexArray ( GLuint array ) */
1816static void
1817android_glBindVertexArray__I
1818  (JNIEnv *_env, jobject _this, jint array) {
1819    glBindVertexArray(
1820        (GLuint)array
1821    );
1822}
1823
1824/* void glDeleteVertexArrays ( GLsizei n, const GLuint *arrays ) */
1825static void
1826android_glDeleteVertexArrays__I_3II
1827  (JNIEnv *_env, jobject _this, jint n, jintArray arrays_ref, jint offset) {
1828    jint _exception = 0;
1829    const char * _exceptionType = NULL;
1830    const char * _exceptionMessage = NULL;
1831    GLuint *arrays_base = (GLuint *) 0;
1832    jint _remaining;
1833    GLuint *arrays = (GLuint *) 0;
1834
1835    if (!arrays_ref) {
1836        _exception = 1;
1837        _exceptionType = "java/lang/IllegalArgumentException";
1838        _exceptionMessage = "arrays == null";
1839        goto exit;
1840    }
1841    if (offset < 0) {
1842        _exception = 1;
1843        _exceptionType = "java/lang/IllegalArgumentException";
1844        _exceptionMessage = "offset < 0";
1845        goto exit;
1846    }
1847    _remaining = _env->GetArrayLength(arrays_ref) - offset;
1848    arrays_base = (GLuint *)
1849        _env->GetIntArrayElements(arrays_ref, (jboolean *)0);
1850    arrays = arrays_base + offset;
1851
1852    glDeleteVertexArrays(
1853        (GLsizei)n,
1854        (GLuint *)arrays
1855    );
1856
1857exit:
1858    if (arrays_base) {
1859        _env->ReleaseIntArrayElements(arrays_ref, (jint*)arrays_base,
1860            JNI_ABORT);
1861    }
1862    if (_exception) {
1863        jniThrowException(_env, _exceptionType, _exceptionMessage);
1864    }
1865}
1866
1867/* void glDeleteVertexArrays ( GLsizei n, const GLuint *arrays ) */
1868static void
1869android_glDeleteVertexArrays__ILjava_nio_IntBuffer_2
1870  (JNIEnv *_env, jobject _this, jint n, jobject arrays_buf) {
1871    jint _exception = 0;
1872    const char * _exceptionType = NULL;
1873    const char * _exceptionMessage = NULL;
1874    jintArray _array = (jintArray) 0;
1875    jint _bufferOffset = (jint) 0;
1876    jint _remaining;
1877    GLuint *arrays = (GLuint *) 0;
1878
1879    if (!arrays_buf) {
1880        _exception = 1;
1881        _exceptionType = "java/lang/IllegalArgumentException";
1882        _exceptionMessage = "arrays == null";
1883        goto exit;
1884    }
1885    arrays = (GLuint *)getPointer(_env, arrays_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1886    if (arrays == NULL) {
1887        char * _arraysBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1888        arrays = (GLuint *) (_arraysBase + _bufferOffset);
1889    }
1890    glDeleteVertexArrays(
1891        (GLsizei)n,
1892        (GLuint *)arrays
1893    );
1894
1895exit:
1896    if (_array) {
1897        _env->ReleaseIntArrayElements(_array, (jint*)arrays, JNI_ABORT);
1898    }
1899    if (_exception) {
1900        jniThrowException(_env, _exceptionType, _exceptionMessage);
1901    }
1902}
1903
1904/* void glGenVertexArrays ( GLsizei n, GLuint *arrays ) */
1905static void
1906android_glGenVertexArrays__I_3II
1907  (JNIEnv *_env, jobject _this, jint n, jintArray arrays_ref, jint offset) {
1908    jint _exception = 0;
1909    const char * _exceptionType = NULL;
1910    const char * _exceptionMessage = NULL;
1911    GLuint *arrays_base = (GLuint *) 0;
1912    jint _remaining;
1913    GLuint *arrays = (GLuint *) 0;
1914
1915    if (!arrays_ref) {
1916        _exception = 1;
1917        _exceptionType = "java/lang/IllegalArgumentException";
1918        _exceptionMessage = "arrays == null";
1919        goto exit;
1920    }
1921    if (offset < 0) {
1922        _exception = 1;
1923        _exceptionType = "java/lang/IllegalArgumentException";
1924        _exceptionMessage = "offset < 0";
1925        goto exit;
1926    }
1927    _remaining = _env->GetArrayLength(arrays_ref) - offset;
1928    arrays_base = (GLuint *)
1929        _env->GetIntArrayElements(arrays_ref, (jboolean *)0);
1930    arrays = arrays_base + offset;
1931
1932    glGenVertexArrays(
1933        (GLsizei)n,
1934        (GLuint *)arrays
1935    );
1936
1937exit:
1938    if (arrays_base) {
1939        _env->ReleaseIntArrayElements(arrays_ref, (jint*)arrays_base,
1940            _exception ? JNI_ABORT: 0);
1941    }
1942    if (_exception) {
1943        jniThrowException(_env, _exceptionType, _exceptionMessage);
1944    }
1945}
1946
1947/* void glGenVertexArrays ( GLsizei n, GLuint *arrays ) */
1948static void
1949android_glGenVertexArrays__ILjava_nio_IntBuffer_2
1950  (JNIEnv *_env, jobject _this, jint n, jobject arrays_buf) {
1951    jint _exception = 0;
1952    const char * _exceptionType = NULL;
1953    const char * _exceptionMessage = NULL;
1954    jintArray _array = (jintArray) 0;
1955    jint _bufferOffset = (jint) 0;
1956    jint _remaining;
1957    GLuint *arrays = (GLuint *) 0;
1958
1959    if (!arrays_buf) {
1960        _exception = 1;
1961        _exceptionType = "java/lang/IllegalArgumentException";
1962        _exceptionMessage = "arrays == null";
1963        goto exit;
1964    }
1965    arrays = (GLuint *)getPointer(_env, arrays_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1966    if (arrays == NULL) {
1967        char * _arraysBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1968        arrays = (GLuint *) (_arraysBase + _bufferOffset);
1969    }
1970    glGenVertexArrays(
1971        (GLsizei)n,
1972        (GLuint *)arrays
1973    );
1974
1975exit:
1976    if (_array) {
1977        _env->ReleaseIntArrayElements(_array, (jint*)arrays, _exception ? JNI_ABORT : 0);
1978    }
1979    if (_exception) {
1980        jniThrowException(_env, _exceptionType, _exceptionMessage);
1981    }
1982}
1983
1984/* GLboolean glIsVertexArray ( GLuint array ) */
1985static jboolean
1986android_glIsVertexArray__I
1987  (JNIEnv *_env, jobject _this, jint array) {
1988    GLboolean _returnValue;
1989    _returnValue = glIsVertexArray(
1990        (GLuint)array
1991    );
1992    return (jboolean)_returnValue;
1993}
1994
1995/* void glGetIntegeri_v ( GLenum target, GLuint index, GLint *data ) */
1996static void
1997android_glGetIntegeri_v__II_3II
1998  (JNIEnv *_env, jobject _this, jint target, jint index, jintArray data_ref, jint offset) {
1999    jint _exception = 0;
2000    const char * _exceptionType = NULL;
2001    const char * _exceptionMessage = NULL;
2002    GLint *data_base = (GLint *) 0;
2003    jint _remaining;
2004    GLint *data = (GLint *) 0;
2005
2006    if (!data_ref) {
2007        _exception = 1;
2008        _exceptionType = "java/lang/IllegalArgumentException";
2009        _exceptionMessage = "data == null";
2010        goto exit;
2011    }
2012    if (offset < 0) {
2013        _exception = 1;
2014        _exceptionType = "java/lang/IllegalArgumentException";
2015        _exceptionMessage = "offset < 0";
2016        goto exit;
2017    }
2018    _remaining = _env->GetArrayLength(data_ref) - offset;
2019    data_base = (GLint *)
2020        _env->GetIntArrayElements(data_ref, (jboolean *)0);
2021    data = data_base + offset;
2022
2023    glGetIntegeri_v(
2024        (GLenum)target,
2025        (GLuint)index,
2026        (GLint *)data
2027    );
2028
2029exit:
2030    if (data_base) {
2031        _env->ReleaseIntArrayElements(data_ref, (jint*)data_base,
2032            _exception ? JNI_ABORT: 0);
2033    }
2034    if (_exception) {
2035        jniThrowException(_env, _exceptionType, _exceptionMessage);
2036    }
2037}
2038
2039/* void glGetIntegeri_v ( GLenum target, GLuint index, GLint *data ) */
2040static void
2041android_glGetIntegeri_v__IILjava_nio_IntBuffer_2
2042  (JNIEnv *_env, jobject _this, jint target, jint index, jobject data_buf) {
2043    jint _exception = 0;
2044    const char * _exceptionType = NULL;
2045    const char * _exceptionMessage = NULL;
2046    jintArray _array = (jintArray) 0;
2047    jint _bufferOffset = (jint) 0;
2048    jint _remaining;
2049    GLint *data = (GLint *) 0;
2050
2051    if (!data_buf) {
2052        _exception = 1;
2053        _exceptionType = "java/lang/IllegalArgumentException";
2054        _exceptionMessage = "data == null";
2055        goto exit;
2056    }
2057    data = (GLint *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2058    if (data == NULL) {
2059        char * _dataBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
2060        data = (GLint *) (_dataBase + _bufferOffset);
2061    }
2062    glGetIntegeri_v(
2063        (GLenum)target,
2064        (GLuint)index,
2065        (GLint *)data
2066    );
2067
2068exit:
2069    if (_array) {
2070        _env->ReleaseIntArrayElements(_array, (jint*)data, _exception ? JNI_ABORT : 0);
2071    }
2072    if (_exception) {
2073        jniThrowException(_env, _exceptionType, _exceptionMessage);
2074    }
2075}
2076
2077/* void glBeginTransformFeedback ( GLenum primitiveMode ) */
2078static void
2079android_glBeginTransformFeedback__I
2080  (JNIEnv *_env, jobject _this, jint primitiveMode) {
2081    glBeginTransformFeedback(
2082        (GLenum)primitiveMode
2083    );
2084}
2085
2086/* void glEndTransformFeedback ( void ) */
2087static void
2088android_glEndTransformFeedback__
2089  (JNIEnv *_env, jobject _this) {
2090    glEndTransformFeedback();
2091}
2092
2093/* void glBindBufferRange ( GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size ) */
2094static void
2095android_glBindBufferRange__IIIII
2096  (JNIEnv *_env, jobject _this, jint target, jint index, jint buffer, jint offset, jint size) {
2097    glBindBufferRange(
2098        (GLenum)target,
2099        (GLuint)index,
2100        (GLuint)buffer,
2101        (GLintptr)offset,
2102        (GLsizeiptr)size
2103    );
2104}
2105
2106/* void glBindBufferBase ( GLenum target, GLuint index, GLuint buffer ) */
2107static void
2108android_glBindBufferBase__III
2109  (JNIEnv *_env, jobject _this, jint target, jint index, jint buffer) {
2110    glBindBufferBase(
2111        (GLenum)target,
2112        (GLuint)index,
2113        (GLuint)buffer
2114    );
2115}
2116
2117/* void glTransformFeedbackVaryings ( GLuint program, GLsizei count, const GLchar *varyings, GLenum bufferMode ) */
2118static
2119void
2120android_glTransformFeedbackVaryings
2121    (JNIEnv *_env, jobject _this, jint program, jobjectArray varyings_ref, jint bufferMode) {
2122    jint _exception = 0;
2123    const char* _exceptionType = NULL;
2124    const char* _exceptionMessage = NULL;
2125    jint _count = 0, _i;
2126    const char** _varyings = NULL;
2127    const char* _varying = NULL;
2128
2129    if (!varyings_ref) {
2130        _exception = 1;
2131        _exceptionType = "java/lang/IllegalArgumentException";
2132        _exceptionMessage = "varyings == null";
2133        goto exit;
2134    }
2135
2136    _count = _env->GetArrayLength(varyings_ref);
2137    _varyings = (const char**)calloc(_count, sizeof(const char*));
2138    for (_i = 0; _i < _count; _i++) {
2139        jstring _varying = (jstring)_env->GetObjectArrayElement(varyings_ref, _i);
2140        if (!_varying) {
2141            _exception = 1;
2142            _exceptionType = "java/lang/IllegalArgumentException";
2143            _exceptionMessage = "null varyings element";
2144            goto exit;
2145        }
2146        _varyings[_i] = _env->GetStringUTFChars(_varying, 0);
2147    }
2148
2149    glTransformFeedbackVaryings(program, _count, _varyings, bufferMode);
2150
2151exit:
2152    for (_i = _count - 1; _i >= 0; _i--) {
2153        if (_varyings[_i]) {
2154            jstring _varying = (jstring)_env->GetObjectArrayElement(varyings_ref, _i);
2155            if (_varying) {
2156                _env->ReleaseStringUTFChars(_varying, _varyings[_i]);
2157            }
2158        }
2159    }
2160    free(_varyings);
2161    if (_exception) {
2162        jniThrowException(_env, _exceptionType, _exceptionMessage);
2163    }
2164}
2165
2166/* void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */
2167static void
2168android_glGetTransformFeedbackVarying__III_3II_3II_3II_3BI
2169  (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) {
2170    jint _exception = 0;
2171    const char * _exceptionType;
2172    const char * _exceptionMessage;
2173    GLsizei *length_base = (GLsizei *) 0;
2174    jint _lengthRemaining;
2175    GLsizei *length = (GLsizei *) 0;
2176    GLint *size_base = (GLint *) 0;
2177    jint _sizeRemaining;
2178    GLint *size = (GLint *) 0;
2179    GLenum *type_base = (GLenum *) 0;
2180    jint _typeRemaining;
2181    GLenum *type = (GLenum *) 0;
2182    char *name_base = (char *) 0;
2183    jint _nameRemaining;
2184    char *name = (char *) 0;
2185
2186    if (length_ref) {
2187        if (lengthOffset < 0) {
2188            _exception = 1;
2189            _exceptionType = "java/lang/IllegalArgumentException";
2190            _exceptionMessage = "lengthOffset < 0";
2191            goto exit;
2192        }
2193        _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
2194        length_base = (GLsizei *)
2195            _env->GetIntArrayElements(length_ref, (jboolean *)0);
2196        length = length_base + lengthOffset;
2197    }
2198
2199    if (!size_ref) {
2200        _exception = 1;
2201        _exceptionType = "java/lang/IllegalArgumentException";
2202        _exceptionMessage = "size == null";
2203        goto exit;
2204    }
2205    if (sizeOffset < 0) {
2206        _exception = 1;
2207        _exceptionType = "java/lang/IllegalArgumentException";
2208        _exceptionMessage = "sizeOffset < 0";
2209        goto exit;
2210    }
2211    _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2212    size_base = (GLint *)
2213        _env->GetIntArrayElements(size_ref, (jboolean *)0);
2214    size = size_base + sizeOffset;
2215
2216    if (!type_ref) {
2217        _exception = 1;
2218        _exceptionType = "java/lang/IllegalArgumentException";
2219        _exceptionMessage = "type == null";
2220        goto exit;
2221    }
2222    if (typeOffset < 0) {
2223        _exception = 1;
2224        _exceptionType = "java/lang/IllegalArgumentException";
2225        _exceptionMessage = "typeOffset < 0";
2226        goto exit;
2227    }
2228    _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2229    type_base = (GLenum *)
2230        _env->GetIntArrayElements(type_ref, (jboolean *)0);
2231    type = type_base + typeOffset;
2232
2233    if (!name_ref) {
2234        _exception = 1;
2235        _exceptionType = "java/lang/IllegalArgumentException";
2236        _exceptionMessage = "name == null";
2237        goto exit;
2238    }
2239    if (nameOffset < 0) {
2240        _exception = 1;
2241        _exceptionType = "java/lang/IllegalArgumentException";
2242        _exceptionMessage = "nameOffset < 0";
2243        goto exit;
2244    }
2245    _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
2246    name_base = (char *)
2247        _env->GetByteArrayElements(name_ref, (jboolean *)0);
2248    name = name_base + nameOffset;
2249
2250    glGetTransformFeedbackVarying(
2251        (GLuint)program,
2252        (GLuint)index,
2253        (GLsizei)bufsize,
2254        (GLsizei *)length,
2255        (GLint *)size,
2256        (GLenum *)type,
2257        (char *)name
2258    );
2259
2260exit:
2261    if (name_base) {
2262        _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
2263            _exception ? JNI_ABORT: 0);
2264    }
2265    if (type_base) {
2266        _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
2267            _exception ? JNI_ABORT: 0);
2268    }
2269    if (size_base) {
2270        _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
2271            _exception ? JNI_ABORT: 0);
2272    }
2273    if (length_base) {
2274        _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
2275            _exception ? JNI_ABORT: 0);
2276    }
2277    if (_exception) {
2278        jniThrowException(_env, _exceptionType, _exceptionMessage);
2279    }
2280}
2281
2282/* void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */
2283static void
2284android_glGetTransformFeedbackVarying__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
2285  (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
2286    jniThrowException(_env, "java/lang/UnsupportedOperationException", "deprecated");
2287}
2288
2289/* void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */
2290static void
2291android_glGetTransformFeedbackVarying__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_ByteBuffer_2
2292  (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jobject name_buf) {
2293    jintArray _lengthArray = (jintArray) 0;
2294    jint _lengthBufferOffset = (jint) 0;
2295    jintArray _sizeArray = (jintArray) 0;
2296    jint _sizeBufferOffset = (jint) 0;
2297    jintArray _typeArray = (jintArray) 0;
2298    jint _typeBufferOffset = (jint) 0;
2299    jbyteArray _nameArray = (jbyteArray)0;
2300    jint _nameBufferOffset = (jint)0;
2301    jint _lengthRemaining;
2302    GLsizei *length = (GLsizei *) 0;
2303    jint _sizeRemaining;
2304    GLint *size = (GLint *) 0;
2305    jint _typeRemaining;
2306    GLenum *type = (GLenum *) 0;
2307    jint _nameRemaining;
2308    GLchar* name = (GLchar*)0;
2309
2310
2311    length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
2312    size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
2313    type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
2314    name = (GLchar*)getPointer(_env, name_buf, (jarray*)&_nameArray, &_nameRemaining, &_nameBufferOffset);
2315    if (length == NULL) {
2316        char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
2317        length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
2318    }
2319    if (size == NULL) {
2320        char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
2321        size = (GLint *) (_sizeBase + _sizeBufferOffset);
2322    }
2323    if (type == NULL) {
2324        char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
2325        type = (GLenum *) (_typeBase + _typeBufferOffset);
2326    }
2327    if (name == NULL) {
2328        char* _nameBase = (char *)_env->GetByteArrayElements(_nameArray, (jboolean*)0);
2329        name = (GLchar *) (_nameBase + _nameBufferOffset);
2330    }
2331    glGetTransformFeedbackVarying(
2332        (GLuint)program,
2333        (GLuint)index,
2334        (GLsizei)bufsize,
2335        (GLsizei *)length,
2336        (GLint *)size,
2337        (GLenum *)type,
2338        (GLchar*)name
2339    );
2340    if (_typeArray) {
2341        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
2342    }
2343    if (_sizeArray) {
2344        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
2345    }
2346    if (_lengthArray) {
2347        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
2348    }
2349    if (_nameArray) {
2350        releaseArrayPointer<jbyteArray, jbyte*, ByteArrayReleaser>(_env, _nameArray, (jbyte*)name, JNI_TRUE);
2351    }
2352}
2353
2354/* void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */
2355static jstring
2356android_glGetTransformFeedbackVarying1
2357  (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
2358    jint _exception = 0;
2359    const char * _exceptionType;
2360    const char * _exceptionMessage;
2361    GLint *size_base = (GLint *) 0;
2362    jint _sizeRemaining;
2363    GLint *size = (GLint *) 0;
2364    GLenum *type_base = (GLenum *) 0;
2365    jint _typeRemaining;
2366    GLenum *type = (GLenum *) 0;
2367
2368    jstring result = 0;
2369
2370    GLint len = 0;
2371    glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
2372    if (!len) {
2373        return _env->NewStringUTF("");
2374    }
2375    char* buf = (char*) malloc(len);
2376
2377    if (buf == NULL) {
2378        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2379        return NULL;
2380    }
2381    if (!size_ref) {
2382        _exception = 1;
2383        _exceptionType = "java/lang/IllegalArgumentException";
2384        _exceptionMessage = "size == null";
2385        goto exit;
2386    }
2387    if (sizeOffset < 0) {
2388        _exception = 1;
2389        _exceptionType = "java/lang/IllegalArgumentException";
2390        _exceptionMessage = "sizeOffset < 0";
2391        goto exit;
2392    }
2393    _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2394    size_base = (GLint *)
2395        _env->GetIntArrayElements(size_ref, (jboolean *)0);
2396    size = size_base + sizeOffset;
2397
2398    if (!type_ref) {
2399        _exception = 1;
2400        _exceptionType = "java/lang/IllegalArgumentException";
2401        _exceptionMessage = "type == null";
2402        goto exit;
2403    }
2404    if (typeOffset < 0) {
2405        _exception = 1;
2406        _exceptionType = "java/lang/IllegalArgumentException";
2407        _exceptionMessage = "typeOffset < 0";
2408        goto exit;
2409    }
2410    _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2411    type_base = (GLenum *)
2412        _env->GetIntArrayElements(type_ref, (jboolean *)0);
2413    type = type_base + typeOffset;
2414
2415    glGetTransformFeedbackVarying(
2416        (GLuint)program,
2417        (GLuint)index,
2418        (GLsizei)len,
2419        NULL,
2420        (GLint *)size,
2421        (GLenum *)type,
2422        (char *)buf
2423    );
2424exit:
2425    if (type_base) {
2426        _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
2427            _exception ? JNI_ABORT: 0);
2428    }
2429    if (size_base) {
2430        _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
2431            _exception ? JNI_ABORT: 0);
2432    }
2433    if (_exception != 1) {
2434        result = _env->NewStringUTF(buf);
2435    }
2436    if (buf) {
2437        free(buf);
2438    }
2439    if (_exception) {
2440        jniThrowException(_env, _exceptionType, _exceptionMessage);
2441    }
2442    if (result == 0) {
2443        result = _env->NewStringUTF("");
2444    }
2445
2446    return result;
2447}
2448
2449/* void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */
2450static jstring
2451android_glGetTransformFeedbackVarying2
2452  (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
2453    jintArray _sizeArray = (jintArray) 0;
2454    jint _sizeBufferOffset = (jint) 0;
2455    jintArray _typeArray = (jintArray) 0;
2456    jint _typeBufferOffset = (jint) 0;
2457    jint _lengthRemaining;
2458    GLsizei *length = (GLsizei *) 0;
2459    jint _sizeRemaining;
2460    GLint *size = (GLint *) 0;
2461    jint _typeRemaining;
2462    GLenum *type = (GLenum *) 0;
2463
2464    jstring result = 0;
2465
2466    GLint len = 0;
2467    glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
2468    if (!len) {
2469        return _env->NewStringUTF("");
2470    }
2471    char* buf = (char*) malloc(len);
2472
2473    if (buf == NULL) {
2474        jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2475        return NULL;
2476    }
2477
2478    size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
2479    type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
2480    if (size == NULL) {
2481        char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
2482        size = (GLint *) (_sizeBase + _sizeBufferOffset);
2483    }
2484    if (type == NULL) {
2485        char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
2486        type = (GLenum *) (_typeBase + _typeBufferOffset);
2487    }
2488    glGetTransformFeedbackVarying(
2489        (GLuint)program,
2490        (GLuint)index,
2491        (GLsizei)len,
2492        NULL,
2493        (GLint *)size,
2494        (GLenum *)type,
2495        (char *)buf
2496    );
2497
2498    if (_typeArray) {
2499        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
2500    }
2501    if (_sizeArray) {
2502        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
2503    }
2504    result = _env->NewStringUTF(buf);
2505    if (buf) {
2506        free(buf);
2507    }
2508    return result;
2509}
2510/* void glVertexAttribIPointer ( GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) */
2511static void
2512android_glVertexAttribIPointerBounds__IIIILjava_nio_Buffer_2I
2513  (JNIEnv *_env, jobject _this, jint index, jint size, jint type, jint stride, jobject pointer_buf, jint remaining) {
2514    jint _exception = 0;
2515    const char * _exceptionType = NULL;
2516    const char * _exceptionMessage = NULL;
2517    jarray _array = (jarray) 0;
2518    jint _bufferOffset = (jint) 0;
2519    jint _remaining;
2520    GLvoid *pointer = (GLvoid *) 0;
2521
2522    if (pointer_buf) {
2523        pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf);
2524        if ( ! pointer ) {
2525            return;
2526        }
2527    }
2528    glVertexAttribIPointerBounds(
2529        (GLuint)index,
2530        (GLint)size,
2531        (GLenum)type,
2532        (GLsizei)stride,
2533        (GLvoid *)pointer,
2534        (GLsizei)remaining
2535    );
2536    if (_exception) {
2537        jniThrowException(_env, _exceptionType, _exceptionMessage);
2538    }
2539}
2540
2541/* void glVertexAttribIPointer ( GLuint index, GLint size, GLenum type, GLsizei stride, GLsizei offset ) */
2542static void
2543android_glVertexAttribIPointer__IIIII
2544  (JNIEnv *_env, jobject _this, jint index, jint size, jint type, jint stride, jint offset) {
2545    glVertexAttribIPointer(
2546        (GLuint)index,
2547        (GLint)size,
2548        (GLenum)type,
2549        (GLsizei)stride,
2550        reinterpret_cast<GLvoid *>(offset)
2551    );
2552}
2553
2554/* void glGetVertexAttribIiv ( GLuint index, GLenum pname, GLint *params ) */
2555static void
2556android_glGetVertexAttribIiv__II_3II
2557  (JNIEnv *_env, jobject _this, jint index, jint pname, jintArray params_ref, jint offset) {
2558    jint _exception = 0;
2559    const char * _exceptionType = NULL;
2560    const char * _exceptionMessage = NULL;
2561    GLint *params_base = (GLint *) 0;
2562    jint _remaining;
2563    GLint *params = (GLint *) 0;
2564
2565    if (!params_ref) {
2566        _exception = 1;
2567        _exceptionType = "java/lang/IllegalArgumentException";
2568        _exceptionMessage = "params == null";
2569        goto exit;
2570    }
2571    if (offset < 0) {
2572        _exception = 1;
2573        _exceptionType = "java/lang/IllegalArgumentException";
2574        _exceptionMessage = "offset < 0";
2575        goto exit;
2576    }
2577    _remaining = _env->GetArrayLength(params_ref) - offset;
2578    params_base = (GLint *)
2579        _env->GetIntArrayElements(params_ref, (jboolean *)0);
2580    params = params_base + offset;
2581
2582    glGetVertexAttribIiv(
2583        (GLuint)index,
2584        (GLenum)pname,
2585        (GLint *)params
2586    );
2587
2588exit:
2589    if (params_base) {
2590        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
2591            _exception ? JNI_ABORT: 0);
2592    }
2593    if (_exception) {
2594        jniThrowException(_env, _exceptionType, _exceptionMessage);
2595    }
2596}
2597
2598/* void glGetVertexAttribIiv ( GLuint index, GLenum pname, GLint *params ) */
2599static void
2600android_glGetVertexAttribIiv__IILjava_nio_IntBuffer_2
2601  (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
2602    jint _exception = 0;
2603    const char * _exceptionType = NULL;
2604    const char * _exceptionMessage = NULL;
2605    jintArray _array = (jintArray) 0;
2606    jint _bufferOffset = (jint) 0;
2607    jint _remaining;
2608    GLint *params = (GLint *) 0;
2609
2610    if (!params_buf) {
2611        _exception = 1;
2612        _exceptionType = "java/lang/IllegalArgumentException";
2613        _exceptionMessage = "params == null";
2614        goto exit;
2615    }
2616    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2617    if (params == NULL) {
2618        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
2619        params = (GLint *) (_paramsBase + _bufferOffset);
2620    }
2621    glGetVertexAttribIiv(
2622        (GLuint)index,
2623        (GLenum)pname,
2624        (GLint *)params
2625    );
2626
2627exit:
2628    if (_array) {
2629        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
2630    }
2631    if (_exception) {
2632        jniThrowException(_env, _exceptionType, _exceptionMessage);
2633    }
2634}
2635
2636/* void glGetVertexAttribIuiv ( GLuint index, GLenum pname, GLuint *params ) */
2637static void
2638android_glGetVertexAttribIuiv__II_3II
2639  (JNIEnv *_env, jobject _this, jint index, jint pname, jintArray params_ref, jint offset) {
2640    jint _exception = 0;
2641    const char * _exceptionType = NULL;
2642    const char * _exceptionMessage = NULL;
2643    GLuint *params_base = (GLuint *) 0;
2644    jint _remaining;
2645    GLuint *params = (GLuint *) 0;
2646
2647    if (!params_ref) {
2648        _exception = 1;
2649        _exceptionType = "java/lang/IllegalArgumentException";
2650        _exceptionMessage = "params == null";
2651        goto exit;
2652    }
2653    if (offset < 0) {
2654        _exception = 1;
2655        _exceptionType = "java/lang/IllegalArgumentException";
2656        _exceptionMessage = "offset < 0";
2657        goto exit;
2658    }
2659    _remaining = _env->GetArrayLength(params_ref) - offset;
2660    params_base = (GLuint *)
2661        _env->GetIntArrayElements(params_ref, (jboolean *)0);
2662    params = params_base + offset;
2663
2664    glGetVertexAttribIuiv(
2665        (GLuint)index,
2666        (GLenum)pname,
2667        (GLuint *)params
2668    );
2669
2670exit:
2671    if (params_base) {
2672        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
2673            _exception ? JNI_ABORT: 0);
2674    }
2675    if (_exception) {
2676        jniThrowException(_env, _exceptionType, _exceptionMessage);
2677    }
2678}
2679
2680/* void glGetVertexAttribIuiv ( GLuint index, GLenum pname, GLuint *params ) */
2681static void
2682android_glGetVertexAttribIuiv__IILjava_nio_IntBuffer_2
2683  (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
2684    jint _exception = 0;
2685    const char * _exceptionType = NULL;
2686    const char * _exceptionMessage = NULL;
2687    jintArray _array = (jintArray) 0;
2688    jint _bufferOffset = (jint) 0;
2689    jint _remaining;
2690    GLuint *params = (GLuint *) 0;
2691
2692    if (!params_buf) {
2693        _exception = 1;
2694        _exceptionType = "java/lang/IllegalArgumentException";
2695        _exceptionMessage = "params == null";
2696        goto exit;
2697    }
2698    params = (GLuint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2699    if (params == NULL) {
2700        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
2701        params = (GLuint *) (_paramsBase + _bufferOffset);
2702    }
2703    glGetVertexAttribIuiv(
2704        (GLuint)index,
2705        (GLenum)pname,
2706        (GLuint *)params
2707    );
2708
2709exit:
2710    if (_array) {
2711        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
2712    }
2713    if (_exception) {
2714        jniThrowException(_env, _exceptionType, _exceptionMessage);
2715    }
2716}
2717
2718/* void glVertexAttribI4i ( GLuint index, GLint x, GLint y, GLint z, GLint w ) */
2719static void
2720android_glVertexAttribI4i__IIIII
2721  (JNIEnv *_env, jobject _this, jint index, jint x, jint y, jint z, jint w) {
2722    glVertexAttribI4i(
2723        (GLuint)index,
2724        (GLint)x,
2725        (GLint)y,
2726        (GLint)z,
2727        (GLint)w
2728    );
2729}
2730
2731/* void glVertexAttribI4ui ( GLuint index, GLuint x, GLuint y, GLuint z, GLuint w ) */
2732static void
2733android_glVertexAttribI4ui__IIIII
2734  (JNIEnv *_env, jobject _this, jint index, jint x, jint y, jint z, jint w) {
2735    glVertexAttribI4ui(
2736        (GLuint)index,
2737        (GLuint)x,
2738        (GLuint)y,
2739        (GLuint)z,
2740        (GLuint)w
2741    );
2742}
2743
2744/* void glVertexAttribI4iv ( GLuint index, const GLint *v ) */
2745static void
2746android_glVertexAttribI4iv__I_3II
2747  (JNIEnv *_env, jobject _this, jint index, jintArray v_ref, jint offset) {
2748    jint _exception = 0;
2749    const char * _exceptionType = NULL;
2750    const char * _exceptionMessage = NULL;
2751    GLint *v_base = (GLint *) 0;
2752    jint _remaining;
2753    GLint *v = (GLint *) 0;
2754
2755    if (!v_ref) {
2756        _exception = 1;
2757        _exceptionType = "java/lang/IllegalArgumentException";
2758        _exceptionMessage = "v == null";
2759        goto exit;
2760    }
2761    if (offset < 0) {
2762        _exception = 1;
2763        _exceptionType = "java/lang/IllegalArgumentException";
2764        _exceptionMessage = "offset < 0";
2765        goto exit;
2766    }
2767    _remaining = _env->GetArrayLength(v_ref) - offset;
2768    v_base = (GLint *)
2769        _env->GetIntArrayElements(v_ref, (jboolean *)0);
2770    v = v_base + offset;
2771
2772    glVertexAttribI4iv(
2773        (GLuint)index,
2774        (GLint *)v
2775    );
2776
2777exit:
2778    if (v_base) {
2779        _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
2780            JNI_ABORT);
2781    }
2782    if (_exception) {
2783        jniThrowException(_env, _exceptionType, _exceptionMessage);
2784    }
2785}
2786
2787/* void glVertexAttribI4iv ( GLuint index, const GLint *v ) */
2788static void
2789android_glVertexAttribI4iv__ILjava_nio_IntBuffer_2
2790  (JNIEnv *_env, jobject _this, jint index, jobject v_buf) {
2791    jint _exception = 0;
2792    const char * _exceptionType = NULL;
2793    const char * _exceptionMessage = NULL;
2794    jintArray _array = (jintArray) 0;
2795    jint _bufferOffset = (jint) 0;
2796    jint _remaining;
2797    GLint *v = (GLint *) 0;
2798
2799    if (!v_buf) {
2800        _exception = 1;
2801        _exceptionType = "java/lang/IllegalArgumentException";
2802        _exceptionMessage = "v == null";
2803        goto exit;
2804    }
2805    v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2806    if (v == NULL) {
2807        char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
2808        v = (GLint *) (_vBase + _bufferOffset);
2809    }
2810    glVertexAttribI4iv(
2811        (GLuint)index,
2812        (GLint *)v
2813    );
2814
2815exit:
2816    if (_array) {
2817        _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
2818    }
2819    if (_exception) {
2820        jniThrowException(_env, _exceptionType, _exceptionMessage);
2821    }
2822}
2823
2824/* void glVertexAttribI4uiv ( GLuint index, const GLuint *v ) */
2825static void
2826android_glVertexAttribI4uiv__I_3II
2827  (JNIEnv *_env, jobject _this, jint index, jintArray v_ref, jint offset) {
2828    jint _exception = 0;
2829    const char * _exceptionType = NULL;
2830    const char * _exceptionMessage = NULL;
2831    GLuint *v_base = (GLuint *) 0;
2832    jint _remaining;
2833    GLuint *v = (GLuint *) 0;
2834
2835    if (!v_ref) {
2836        _exception = 1;
2837        _exceptionType = "java/lang/IllegalArgumentException";
2838        _exceptionMessage = "v == null";
2839        goto exit;
2840    }
2841    if (offset < 0) {
2842        _exception = 1;
2843        _exceptionType = "java/lang/IllegalArgumentException";
2844        _exceptionMessage = "offset < 0";
2845        goto exit;
2846    }
2847    _remaining = _env->GetArrayLength(v_ref) - offset;
2848    v_base = (GLuint *)
2849        _env->GetIntArrayElements(v_ref, (jboolean *)0);
2850    v = v_base + offset;
2851
2852    glVertexAttribI4uiv(
2853        (GLuint)index,
2854        (GLuint *)v
2855    );
2856
2857exit:
2858    if (v_base) {
2859        _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
2860            JNI_ABORT);
2861    }
2862    if (_exception) {
2863        jniThrowException(_env, _exceptionType, _exceptionMessage);
2864    }
2865}
2866
2867/* void glVertexAttribI4uiv ( GLuint index, const GLuint *v ) */
2868static void
2869android_glVertexAttribI4uiv__ILjava_nio_IntBuffer_2
2870  (JNIEnv *_env, jobject _this, jint index, jobject v_buf) {
2871    jint _exception = 0;
2872    const char * _exceptionType = NULL;
2873    const char * _exceptionMessage = NULL;
2874    jintArray _array = (jintArray) 0;
2875    jint _bufferOffset = (jint) 0;
2876    jint _remaining;
2877    GLuint *v = (GLuint *) 0;
2878
2879    if (!v_buf) {
2880        _exception = 1;
2881        _exceptionType = "java/lang/IllegalArgumentException";
2882        _exceptionMessage = "v == null";
2883        goto exit;
2884    }
2885    v = (GLuint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2886    if (v == NULL) {
2887        char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
2888        v = (GLuint *) (_vBase + _bufferOffset);
2889    }
2890    glVertexAttribI4uiv(
2891        (GLuint)index,
2892        (GLuint *)v
2893    );
2894
2895exit:
2896    if (_array) {
2897        _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
2898    }
2899    if (_exception) {
2900        jniThrowException(_env, _exceptionType, _exceptionMessage);
2901    }
2902}
2903
2904/* void glGetUniformuiv ( GLuint program, GLint location, GLuint *params ) */
2905static void
2906android_glGetUniformuiv__II_3II
2907  (JNIEnv *_env, jobject _this, jint program, jint location, jintArray params_ref, jint offset) {
2908    jint _exception = 0;
2909    const char * _exceptionType = NULL;
2910    const char * _exceptionMessage = NULL;
2911    GLuint *params_base = (GLuint *) 0;
2912    jint _remaining;
2913    GLuint *params = (GLuint *) 0;
2914
2915    if (!params_ref) {
2916        _exception = 1;
2917        _exceptionType = "java/lang/IllegalArgumentException";
2918        _exceptionMessage = "params == null";
2919        goto exit;
2920    }
2921    if (offset < 0) {
2922        _exception = 1;
2923        _exceptionType = "java/lang/IllegalArgumentException";
2924        _exceptionMessage = "offset < 0";
2925        goto exit;
2926    }
2927    _remaining = _env->GetArrayLength(params_ref) - offset;
2928    params_base = (GLuint *)
2929        _env->GetIntArrayElements(params_ref, (jboolean *)0);
2930    params = params_base + offset;
2931
2932    glGetUniformuiv(
2933        (GLuint)program,
2934        (GLint)location,
2935        (GLuint *)params
2936    );
2937
2938exit:
2939    if (params_base) {
2940        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
2941            _exception ? JNI_ABORT: 0);
2942    }
2943    if (_exception) {
2944        jniThrowException(_env, _exceptionType, _exceptionMessage);
2945    }
2946}
2947
2948/* void glGetUniformuiv ( GLuint program, GLint location, GLuint *params ) */
2949static void
2950android_glGetUniformuiv__IILjava_nio_IntBuffer_2
2951  (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
2952    jint _exception = 0;
2953    const char * _exceptionType = NULL;
2954    const char * _exceptionMessage = NULL;
2955    jintArray _array = (jintArray) 0;
2956    jint _bufferOffset = (jint) 0;
2957    jint _remaining;
2958    GLuint *params = (GLuint *) 0;
2959
2960    if (!params_buf) {
2961        _exception = 1;
2962        _exceptionType = "java/lang/IllegalArgumentException";
2963        _exceptionMessage = "params == null";
2964        goto exit;
2965    }
2966    params = (GLuint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2967    if (params == NULL) {
2968        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
2969        params = (GLuint *) (_paramsBase + _bufferOffset);
2970    }
2971    glGetUniformuiv(
2972        (GLuint)program,
2973        (GLint)location,
2974        (GLuint *)params
2975    );
2976
2977exit:
2978    if (_array) {
2979        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
2980    }
2981    if (_exception) {
2982        jniThrowException(_env, _exceptionType, _exceptionMessage);
2983    }
2984}
2985
2986/* GLint glGetFragDataLocation ( GLuint program, const GLchar *name ) */
2987static jint
2988android_glGetFragDataLocation__ILjava_lang_String_2
2989  (JNIEnv *_env, jobject _this, jint program, jstring name) {
2990    jint _exception = 0;
2991    const char * _exceptionType = NULL;
2992    const char * _exceptionMessage = NULL;
2993    GLint _returnValue = 0;
2994    const char* _nativename = 0;
2995
2996    if (!name) {
2997        _exception = 1;
2998        _exceptionType = "java/lang/IllegalArgumentException";
2999        _exceptionMessage = "name == null";
3000        goto exit;
3001    }
3002    _nativename = _env->GetStringUTFChars(name, 0);
3003
3004    _returnValue = glGetFragDataLocation(
3005        (GLuint)program,
3006        (GLchar *)_nativename
3007    );
3008
3009exit:
3010    if (_nativename) {
3011        _env->ReleaseStringUTFChars(name, _nativename);
3012    }
3013
3014    if (_exception) {
3015        jniThrowException(_env, _exceptionType, _exceptionMessage);
3016    }
3017    return (jint)_returnValue;
3018}
3019
3020/* void glUniform1ui ( GLint location, GLuint v0 ) */
3021static void
3022android_glUniform1ui__II
3023  (JNIEnv *_env, jobject _this, jint location, jint v0) {
3024    glUniform1ui(
3025        (GLint)location,
3026        (GLuint)v0
3027    );
3028}
3029
3030/* void glUniform2ui ( GLint location, GLuint v0, GLuint v1 ) */
3031static void
3032android_glUniform2ui__III
3033  (JNIEnv *_env, jobject _this, jint location, jint v0, jint v1) {
3034    glUniform2ui(
3035        (GLint)location,
3036        (GLuint)v0,
3037        (GLuint)v1
3038    );
3039}
3040
3041/* void glUniform3ui ( GLint location, GLuint v0, GLuint v1, GLuint v2 ) */
3042static void
3043android_glUniform3ui__IIII
3044  (JNIEnv *_env, jobject _this, jint location, jint v0, jint v1, jint v2) {
3045    glUniform3ui(
3046        (GLint)location,
3047        (GLuint)v0,
3048        (GLuint)v1,
3049        (GLuint)v2
3050    );
3051}
3052
3053/* void glUniform4ui ( GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3 ) */
3054static void
3055android_glUniform4ui__IIIII
3056  (JNIEnv *_env, jobject _this, jint location, jint v0, jint v1, jint v2, jint v3) {
3057    glUniform4ui(
3058        (GLint)location,
3059        (GLuint)v0,
3060        (GLuint)v1,
3061        (GLuint)v2,
3062        (GLuint)v3
3063    );
3064}
3065
3066/* void glUniform1uiv ( GLint location, GLsizei count, const GLuint *value ) */
3067static void
3068android_glUniform1uiv__II_3II
3069  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray value_ref, jint offset) {
3070    jint _exception = 0;
3071    const char * _exceptionType = NULL;
3072    const char * _exceptionMessage = NULL;
3073    GLuint *value_base = (GLuint *) 0;
3074    jint _remaining;
3075    GLuint *value = (GLuint *) 0;
3076
3077    if (!value_ref) {
3078        _exception = 1;
3079        _exceptionType = "java/lang/IllegalArgumentException";
3080        _exceptionMessage = "value == null";
3081        goto exit;
3082    }
3083    if (offset < 0) {
3084        _exception = 1;
3085        _exceptionType = "java/lang/IllegalArgumentException";
3086        _exceptionMessage = "offset < 0";
3087        goto exit;
3088    }
3089    _remaining = _env->GetArrayLength(value_ref) - offset;
3090    value_base = (GLuint *)
3091        _env->GetIntArrayElements(value_ref, (jboolean *)0);
3092    value = value_base + offset;
3093
3094    glUniform1uiv(
3095        (GLint)location,
3096        (GLsizei)count,
3097        (GLuint *)value
3098    );
3099
3100exit:
3101    if (value_base) {
3102        _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
3103            JNI_ABORT);
3104    }
3105    if (_exception) {
3106        jniThrowException(_env, _exceptionType, _exceptionMessage);
3107    }
3108}
3109
3110/* void glUniform1uiv ( GLint location, GLsizei count, const GLuint *value ) */
3111static void
3112android_glUniform1uiv__IILjava_nio_IntBuffer_2
3113  (JNIEnv *_env, jobject _this, jint location, jint count, jobject value_buf) {
3114    jint _exception = 0;
3115    const char * _exceptionType = NULL;
3116    const char * _exceptionMessage = NULL;
3117    jintArray _array = (jintArray) 0;
3118    jint _bufferOffset = (jint) 0;
3119    jint _remaining;
3120    GLuint *value = (GLuint *) 0;
3121
3122    if (!value_buf) {
3123        _exception = 1;
3124        _exceptionType = "java/lang/IllegalArgumentException";
3125        _exceptionMessage = "value == null";
3126        goto exit;
3127    }
3128    value = (GLuint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3129    if (value == NULL) {
3130        char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
3131        value = (GLuint *) (_valueBase + _bufferOffset);
3132    }
3133    glUniform1uiv(
3134        (GLint)location,
3135        (GLsizei)count,
3136        (GLuint *)value
3137    );
3138
3139exit:
3140    if (_array) {
3141        _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
3142    }
3143    if (_exception) {
3144        jniThrowException(_env, _exceptionType, _exceptionMessage);
3145    }
3146}
3147
3148/* void glUniform2uiv ( GLint location, GLsizei count, const GLuint *value ) */
3149static void
3150android_glUniform2uiv__II_3II
3151  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray value_ref, jint offset) {
3152    jint _exception = 0;
3153    const char * _exceptionType = NULL;
3154    const char * _exceptionMessage = NULL;
3155    GLuint *value_base = (GLuint *) 0;
3156    jint _remaining;
3157    GLuint *value = (GLuint *) 0;
3158
3159    if (!value_ref) {
3160        _exception = 1;
3161        _exceptionType = "java/lang/IllegalArgumentException";
3162        _exceptionMessage = "value == null";
3163        goto exit;
3164    }
3165    if (offset < 0) {
3166        _exception = 1;
3167        _exceptionType = "java/lang/IllegalArgumentException";
3168        _exceptionMessage = "offset < 0";
3169        goto exit;
3170    }
3171    _remaining = _env->GetArrayLength(value_ref) - offset;
3172    value_base = (GLuint *)
3173        _env->GetIntArrayElements(value_ref, (jboolean *)0);
3174    value = value_base + offset;
3175
3176    glUniform2uiv(
3177        (GLint)location,
3178        (GLsizei)count,
3179        (GLuint *)value
3180    );
3181
3182exit:
3183    if (value_base) {
3184        _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
3185            JNI_ABORT);
3186    }
3187    if (_exception) {
3188        jniThrowException(_env, _exceptionType, _exceptionMessage);
3189    }
3190}
3191
3192/* void glUniform2uiv ( GLint location, GLsizei count, const GLuint *value ) */
3193static void
3194android_glUniform2uiv__IILjava_nio_IntBuffer_2
3195  (JNIEnv *_env, jobject _this, jint location, jint count, jobject value_buf) {
3196    jint _exception = 0;
3197    const char * _exceptionType = NULL;
3198    const char * _exceptionMessage = NULL;
3199    jintArray _array = (jintArray) 0;
3200    jint _bufferOffset = (jint) 0;
3201    jint _remaining;
3202    GLuint *value = (GLuint *) 0;
3203
3204    if (!value_buf) {
3205        _exception = 1;
3206        _exceptionType = "java/lang/IllegalArgumentException";
3207        _exceptionMessage = "value == null";
3208        goto exit;
3209    }
3210    value = (GLuint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3211    if (value == NULL) {
3212        char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
3213        value = (GLuint *) (_valueBase + _bufferOffset);
3214    }
3215    glUniform2uiv(
3216        (GLint)location,
3217        (GLsizei)count,
3218        (GLuint *)value
3219    );
3220
3221exit:
3222    if (_array) {
3223        _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
3224    }
3225    if (_exception) {
3226        jniThrowException(_env, _exceptionType, _exceptionMessage);
3227    }
3228}
3229
3230/* void glUniform3uiv ( GLint location, GLsizei count, const GLuint *value ) */
3231static void
3232android_glUniform3uiv__II_3II
3233  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray value_ref, jint offset) {
3234    jint _exception = 0;
3235    const char * _exceptionType = NULL;
3236    const char * _exceptionMessage = NULL;
3237    GLuint *value_base = (GLuint *) 0;
3238    jint _remaining;
3239    GLuint *value = (GLuint *) 0;
3240
3241    if (!value_ref) {
3242        _exception = 1;
3243        _exceptionType = "java/lang/IllegalArgumentException";
3244        _exceptionMessage = "value == null";
3245        goto exit;
3246    }
3247    if (offset < 0) {
3248        _exception = 1;
3249        _exceptionType = "java/lang/IllegalArgumentException";
3250        _exceptionMessage = "offset < 0";
3251        goto exit;
3252    }
3253    _remaining = _env->GetArrayLength(value_ref) - offset;
3254    value_base = (GLuint *)
3255        _env->GetIntArrayElements(value_ref, (jboolean *)0);
3256    value = value_base + offset;
3257
3258    glUniform3uiv(
3259        (GLint)location,
3260        (GLsizei)count,
3261        (GLuint *)value
3262    );
3263
3264exit:
3265    if (value_base) {
3266        _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
3267            JNI_ABORT);
3268    }
3269    if (_exception) {
3270        jniThrowException(_env, _exceptionType, _exceptionMessage);
3271    }
3272}
3273
3274/* void glUniform3uiv ( GLint location, GLsizei count, const GLuint *value ) */
3275static void
3276android_glUniform3uiv__IILjava_nio_IntBuffer_2
3277  (JNIEnv *_env, jobject _this, jint location, jint count, jobject value_buf) {
3278    jint _exception = 0;
3279    const char * _exceptionType = NULL;
3280    const char * _exceptionMessage = NULL;
3281    jintArray _array = (jintArray) 0;
3282    jint _bufferOffset = (jint) 0;
3283    jint _remaining;
3284    GLuint *value = (GLuint *) 0;
3285
3286    if (!value_buf) {
3287        _exception = 1;
3288        _exceptionType = "java/lang/IllegalArgumentException";
3289        _exceptionMessage = "value == null";
3290        goto exit;
3291    }
3292    value = (GLuint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3293    if (value == NULL) {
3294        char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
3295        value = (GLuint *) (_valueBase + _bufferOffset);
3296    }
3297    glUniform3uiv(
3298        (GLint)location,
3299        (GLsizei)count,
3300        (GLuint *)value
3301    );
3302
3303exit:
3304    if (_array) {
3305        _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
3306    }
3307    if (_exception) {
3308        jniThrowException(_env, _exceptionType, _exceptionMessage);
3309    }
3310}
3311
3312/* void glUniform4uiv ( GLint location, GLsizei count, const GLuint *value ) */
3313static void
3314android_glUniform4uiv__II_3II
3315  (JNIEnv *_env, jobject _this, jint location, jint count, jintArray value_ref, jint offset) {
3316    jint _exception = 0;
3317    const char * _exceptionType = NULL;
3318    const char * _exceptionMessage = NULL;
3319    GLuint *value_base = (GLuint *) 0;
3320    jint _remaining;
3321    GLuint *value = (GLuint *) 0;
3322
3323    if (!value_ref) {
3324        _exception = 1;
3325        _exceptionType = "java/lang/IllegalArgumentException";
3326        _exceptionMessage = "value == null";
3327        goto exit;
3328    }
3329    if (offset < 0) {
3330        _exception = 1;
3331        _exceptionType = "java/lang/IllegalArgumentException";
3332        _exceptionMessage = "offset < 0";
3333        goto exit;
3334    }
3335    _remaining = _env->GetArrayLength(value_ref) - offset;
3336    value_base = (GLuint *)
3337        _env->GetIntArrayElements(value_ref, (jboolean *)0);
3338    value = value_base + offset;
3339
3340    glUniform4uiv(
3341        (GLint)location,
3342        (GLsizei)count,
3343        (GLuint *)value
3344    );
3345
3346exit:
3347    if (value_base) {
3348        _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
3349            JNI_ABORT);
3350    }
3351    if (_exception) {
3352        jniThrowException(_env, _exceptionType, _exceptionMessage);
3353    }
3354}
3355
3356/* void glUniform4uiv ( GLint location, GLsizei count, const GLuint *value ) */
3357static void
3358android_glUniform4uiv__IILjava_nio_IntBuffer_2
3359  (JNIEnv *_env, jobject _this, jint location, jint count, jobject value_buf) {
3360    jint _exception = 0;
3361    const char * _exceptionType = NULL;
3362    const char * _exceptionMessage = NULL;
3363    jintArray _array = (jintArray) 0;
3364    jint _bufferOffset = (jint) 0;
3365    jint _remaining;
3366    GLuint *value = (GLuint *) 0;
3367
3368    if (!value_buf) {
3369        _exception = 1;
3370        _exceptionType = "java/lang/IllegalArgumentException";
3371        _exceptionMessage = "value == null";
3372        goto exit;
3373    }
3374    value = (GLuint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3375    if (value == NULL) {
3376        char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
3377        value = (GLuint *) (_valueBase + _bufferOffset);
3378    }
3379    glUniform4uiv(
3380        (GLint)location,
3381        (GLsizei)count,
3382        (GLuint *)value
3383    );
3384
3385exit:
3386    if (_array) {
3387        _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
3388    }
3389    if (_exception) {
3390        jniThrowException(_env, _exceptionType, _exceptionMessage);
3391    }
3392}
3393
3394/* void glClearBufferiv ( GLenum buffer, GLint drawbuffer, const GLint *value ) */
3395static void
3396android_glClearBufferiv__II_3II
3397  (JNIEnv *_env, jobject _this, jint buffer, jint drawbuffer, jintArray value_ref, jint offset) {
3398    jint _exception = 0;
3399    const char * _exceptionType = NULL;
3400    const char * _exceptionMessage = NULL;
3401    GLint *value_base = (GLint *) 0;
3402    jint _remaining;
3403    GLint *value = (GLint *) 0;
3404
3405    if (!value_ref) {
3406        _exception = 1;
3407        _exceptionType = "java/lang/IllegalArgumentException";
3408        _exceptionMessage = "value == null";
3409        goto exit;
3410    }
3411    if (offset < 0) {
3412        _exception = 1;
3413        _exceptionType = "java/lang/IllegalArgumentException";
3414        _exceptionMessage = "offset < 0";
3415        goto exit;
3416    }
3417    _remaining = _env->GetArrayLength(value_ref) - offset;
3418    value_base = (GLint *)
3419        _env->GetIntArrayElements(value_ref, (jboolean *)0);
3420    value = value_base + offset;
3421
3422    glClearBufferiv(
3423        (GLenum)buffer,
3424        (GLint)drawbuffer,
3425        (GLint *)value
3426    );
3427
3428exit:
3429    if (value_base) {
3430        _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
3431            JNI_ABORT);
3432    }
3433    if (_exception) {
3434        jniThrowException(_env, _exceptionType, _exceptionMessage);
3435    }
3436}
3437
3438/* void glClearBufferiv ( GLenum buffer, GLint drawbuffer, const GLint *value ) */
3439static void
3440android_glClearBufferiv__IILjava_nio_IntBuffer_2
3441  (JNIEnv *_env, jobject _this, jint buffer, jint drawbuffer, jobject value_buf) {
3442    jint _exception = 0;
3443    const char * _exceptionType = NULL;
3444    const char * _exceptionMessage = NULL;
3445    jintArray _array = (jintArray) 0;
3446    jint _bufferOffset = (jint) 0;
3447    jint _remaining;
3448    GLint *value = (GLint *) 0;
3449
3450    if (!value_buf) {
3451        _exception = 1;
3452        _exceptionType = "java/lang/IllegalArgumentException";
3453        _exceptionMessage = "value == null";
3454        goto exit;
3455    }
3456    value = (GLint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3457    if (value == NULL) {
3458        char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
3459        value = (GLint *) (_valueBase + _bufferOffset);
3460    }
3461    glClearBufferiv(
3462        (GLenum)buffer,
3463        (GLint)drawbuffer,
3464        (GLint *)value
3465    );
3466
3467exit:
3468    if (_array) {
3469        _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
3470    }
3471    if (_exception) {
3472        jniThrowException(_env, _exceptionType, _exceptionMessage);
3473    }
3474}
3475
3476/* void glClearBufferuiv ( GLenum buffer, GLint drawbuffer, const GLuint *value ) */
3477static void
3478android_glClearBufferuiv__II_3II
3479  (JNIEnv *_env, jobject _this, jint buffer, jint drawbuffer, jintArray value_ref, jint offset) {
3480    jint _exception = 0;
3481    const char * _exceptionType = NULL;
3482    const char * _exceptionMessage = NULL;
3483    GLuint *value_base = (GLuint *) 0;
3484    jint _remaining;
3485    GLuint *value = (GLuint *) 0;
3486
3487    if (!value_ref) {
3488        _exception = 1;
3489        _exceptionType = "java/lang/IllegalArgumentException";
3490        _exceptionMessage = "value == null";
3491        goto exit;
3492    }
3493    if (offset < 0) {
3494        _exception = 1;
3495        _exceptionType = "java/lang/IllegalArgumentException";
3496        _exceptionMessage = "offset < 0";
3497        goto exit;
3498    }
3499    _remaining = _env->GetArrayLength(value_ref) - offset;
3500    value_base = (GLuint *)
3501        _env->GetIntArrayElements(value_ref, (jboolean *)0);
3502    value = value_base + offset;
3503
3504    glClearBufferuiv(
3505        (GLenum)buffer,
3506        (GLint)drawbuffer,
3507        (GLuint *)value
3508    );
3509
3510exit:
3511    if (value_base) {
3512        _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
3513            JNI_ABORT);
3514    }
3515    if (_exception) {
3516        jniThrowException(_env, _exceptionType, _exceptionMessage);
3517    }
3518}
3519
3520/* void glClearBufferuiv ( GLenum buffer, GLint drawbuffer, const GLuint *value ) */
3521static void
3522android_glClearBufferuiv__IILjava_nio_IntBuffer_2
3523  (JNIEnv *_env, jobject _this, jint buffer, jint drawbuffer, jobject value_buf) {
3524    jint _exception = 0;
3525    const char * _exceptionType = NULL;
3526    const char * _exceptionMessage = NULL;
3527    jintArray _array = (jintArray) 0;
3528    jint _bufferOffset = (jint) 0;
3529    jint _remaining;
3530    GLuint *value = (GLuint *) 0;
3531
3532    if (!value_buf) {
3533        _exception = 1;
3534        _exceptionType = "java/lang/IllegalArgumentException";
3535        _exceptionMessage = "value == null";
3536        goto exit;
3537    }
3538    value = (GLuint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3539    if (value == NULL) {
3540        char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
3541        value = (GLuint *) (_valueBase + _bufferOffset);
3542    }
3543    glClearBufferuiv(
3544        (GLenum)buffer,
3545        (GLint)drawbuffer,
3546        (GLuint *)value
3547    );
3548
3549exit:
3550    if (_array) {
3551        _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
3552    }
3553    if (_exception) {
3554        jniThrowException(_env, _exceptionType, _exceptionMessage);
3555    }
3556}
3557
3558/* void glClearBufferfv ( GLenum buffer, GLint drawbuffer, const GLfloat *value ) */
3559static void
3560android_glClearBufferfv__II_3FI
3561  (JNIEnv *_env, jobject _this, jint buffer, jint drawbuffer, jfloatArray value_ref, jint offset) {
3562    jint _exception = 0;
3563    const char * _exceptionType = NULL;
3564    const char * _exceptionMessage = NULL;
3565    GLfloat *value_base = (GLfloat *) 0;
3566    jint _remaining;
3567    GLfloat *value = (GLfloat *) 0;
3568
3569    if (!value_ref) {
3570        _exception = 1;
3571        _exceptionType = "java/lang/IllegalArgumentException";
3572        _exceptionMessage = "value == null";
3573        goto exit;
3574    }
3575    if (offset < 0) {
3576        _exception = 1;
3577        _exceptionType = "java/lang/IllegalArgumentException";
3578        _exceptionMessage = "offset < 0";
3579        goto exit;
3580    }
3581    _remaining = _env->GetArrayLength(value_ref) - offset;
3582    value_base = (GLfloat *)
3583        _env->GetFloatArrayElements(value_ref, (jboolean *)0);
3584    value = value_base + offset;
3585
3586    glClearBufferfv(
3587        (GLenum)buffer,
3588        (GLint)drawbuffer,
3589        (GLfloat *)value
3590    );
3591
3592exit:
3593    if (value_base) {
3594        _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
3595            JNI_ABORT);
3596    }
3597    if (_exception) {
3598        jniThrowException(_env, _exceptionType, _exceptionMessage);
3599    }
3600}
3601
3602/* void glClearBufferfv ( GLenum buffer, GLint drawbuffer, const GLfloat *value ) */
3603static void
3604android_glClearBufferfv__IILjava_nio_FloatBuffer_2
3605  (JNIEnv *_env, jobject _this, jint buffer, jint drawbuffer, jobject value_buf) {
3606    jint _exception = 0;
3607    const char * _exceptionType = NULL;
3608    const char * _exceptionMessage = NULL;
3609    jfloatArray _array = (jfloatArray) 0;
3610    jint _bufferOffset = (jint) 0;
3611    jint _remaining;
3612    GLfloat *value = (GLfloat *) 0;
3613
3614    if (!value_buf) {
3615        _exception = 1;
3616        _exceptionType = "java/lang/IllegalArgumentException";
3617        _exceptionMessage = "value == null";
3618        goto exit;
3619    }
3620    value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3621    if (value == NULL) {
3622        char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
3623        value = (GLfloat *) (_valueBase + _bufferOffset);
3624    }
3625    glClearBufferfv(
3626        (GLenum)buffer,
3627        (GLint)drawbuffer,
3628        (GLfloat *)value
3629    );
3630
3631exit:
3632    if (_array) {
3633        _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
3634    }
3635    if (_exception) {
3636        jniThrowException(_env, _exceptionType, _exceptionMessage);
3637    }
3638}
3639
3640/* void glClearBufferfi ( GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil ) */
3641static void
3642android_glClearBufferfi__IIFI
3643  (JNIEnv *_env, jobject _this, jint buffer, jint drawbuffer, jfloat depth, jint stencil) {
3644    glClearBufferfi(
3645        (GLenum)buffer,
3646        (GLint)drawbuffer,
3647        (GLfloat)depth,
3648        (GLint)stencil
3649    );
3650}
3651
3652/* const GLubyte * glGetStringi ( GLenum name, GLuint index ) */
3653static jstring
3654android_glGetStringi__II
3655  (JNIEnv *_env, jobject _this, jint name, jint index) {
3656    const GLubyte* _chars = glGetStringi((GLenum)name, (GLuint)index);
3657    return _env->NewStringUTF((const char*)_chars);
3658}
3659
3660/* void glCopyBufferSubData ( GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size ) */
3661static void
3662android_glCopyBufferSubData__IIIII
3663  (JNIEnv *_env, jobject _this, jint readTarget, jint writeTarget, jint readOffset, jint writeOffset, jint size) {
3664    glCopyBufferSubData(
3665        (GLenum)readTarget,
3666        (GLenum)writeTarget,
3667        (GLintptr)readOffset,
3668        (GLintptr)writeOffset,
3669        (GLsizeiptr)size
3670    );
3671}
3672
3673/* void glGetUniformIndices ( GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices ) */
3674static
3675void
3676android_glGetUniformIndices_array
3677    (JNIEnv *_env, jobject _this, jint program, jobjectArray uniformNames_ref, jintArray uniformIndices_ref, jint uniformIndicesOffset) {
3678    jint _exception = 0;
3679    const char* _exceptionType = NULL;
3680    const char* _exceptionMessage = NULL;
3681    jint _count = 0;
3682    jint _i;
3683    const char** _names = NULL;
3684    GLuint* _indices_base = NULL;
3685    GLuint* _indices = NULL;
3686
3687    if (!uniformNames_ref) {
3688        _exception = 1;
3689        _exceptionType = "java/lang/IllegalArgumentException";
3690        _exceptionMessage = "uniformNames == null";
3691        goto exit;
3692    }
3693    _count = _env->GetArrayLength(uniformNames_ref);
3694    _names = (const char**)calloc(_count, sizeof(const char*));
3695    for (_i = 0; _i < _count; _i++) {
3696        jstring _name = (jstring)_env->GetObjectArrayElement(uniformNames_ref, _i);
3697        if (!_name) {
3698            _exception = 1;
3699            _exceptionType = "java/lang/IllegalArgumentException";
3700            _exceptionMessage = "null uniformNames element";
3701            goto exit;
3702        }
3703        _names[_i] = _env->GetStringUTFChars(_name, 0);
3704    }
3705
3706    if (!uniformIndices_ref) {
3707        _exception = 1;
3708        _exceptionType = "java/lang/IllegalArgumentException";
3709        _exceptionMessage = "uniformIndices == null";
3710        goto exit;
3711    }
3712    if (uniformIndicesOffset < 0) {
3713        _exception = 1;
3714        _exceptionType = "java/lang/IllegalArgumentException";
3715        _exceptionMessage = "uniformIndicesOffset < 0";
3716        goto exit;
3717    }
3718    if (_env->GetArrayLength(uniformIndices_ref) - uniformIndicesOffset < _count) {
3719        _exception = 1;
3720        _exceptionType = "java/lang/IllegalArgumentException";
3721        _exceptionMessage = "not enough space in uniformIndices";
3722        goto exit;
3723    }
3724    _indices_base = (GLuint*)_env->GetIntArrayElements(
3725            uniformIndices_ref, 0);
3726    _indices = _indices_base + uniformIndicesOffset;
3727
3728    glGetUniformIndices(program, _count, _names, _indices);
3729
3730exit:
3731    if (_indices_base) {
3732        _env->ReleaseIntArrayElements(uniformIndices_ref, (jint*)_indices_base,
3733            _exception ? JNI_ABORT : 0);
3734    }
3735    for (_i = _count - 1; _i >= 0; _i--) {
3736        if (_names[_i]) {
3737            jstring _name = (jstring)_env->GetObjectArrayElement(uniformNames_ref, _i);
3738            if (_name) {
3739                _env->ReleaseStringUTFChars(_name, _names[_i]);
3740            }
3741        }
3742    }
3743    free(_names);
3744    if (_exception) {
3745        jniThrowException(_env, _exceptionType, _exceptionMessage);
3746    }
3747}
3748
3749/* void glGetUniformIndices ( GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices ) */
3750static
3751void
3752android_glGetUniformIndices_buffer
3753    (JNIEnv *_env, jobject _this, jint program, jobjectArray uniformNames_ref, jobject uniformIndices_buf) {
3754    jint _exception = 0;
3755    const char* _exceptionType = NULL;
3756    const char* _exceptionMessage = NULL;
3757    jint _count = 0;
3758    jint _i;
3759    const char** _names = NULL;
3760    jintArray _uniformIndicesArray = (jintArray)0;
3761    jint _uniformIndicesRemaining;
3762    jint _uniformIndicesOffset = 0;
3763    GLuint* _indices = NULL;
3764    char* _indicesBase = NULL;
3765
3766    if (!uniformNames_ref) {
3767        _exception = 1;
3768        _exceptionType = "java/lang/IllegalArgumentException";
3769        _exceptionMessage = "uniformNames == null";
3770        goto exit;
3771    }
3772    if (!uniformIndices_buf) {
3773        _exception = 1;
3774        _exceptionType = "java/lang/IllegalArgumentException";
3775        _exceptionMessage = "uniformIndices == null";
3776        goto exit;
3777    }
3778
3779    _count = _env->GetArrayLength(uniformNames_ref);
3780    _names = (const char**)calloc(_count, sizeof(const char*));
3781    for (_i = 0; _i < _count; _i++) {
3782        jstring _name = (jstring)_env->GetObjectArrayElement(uniformNames_ref, _i);
3783        if (!_name) {
3784            _exception = 1;
3785            _exceptionType = "java/lang/IllegalArgumentException";
3786            _exceptionMessage = "null uniformNames element";
3787            goto exit;
3788        }
3789        _names[_i] = _env->GetStringUTFChars(_name, 0);
3790    }
3791
3792    _indices = (GLuint*)getPointer(_env, uniformIndices_buf,
3793            (jarray*)&_uniformIndicesArray, &_uniformIndicesRemaining,
3794            &_uniformIndicesOffset);
3795    if (!_indices) {
3796        _indicesBase = (char*)_env->GetIntArrayElements(
3797            _uniformIndicesArray, 0);
3798        _indices = (GLuint*)(_indicesBase + _uniformIndicesOffset);
3799    }
3800    if (_uniformIndicesRemaining < _count) {
3801        _exception = 1;
3802        _exceptionType = "java/lang/IllegalArgumentException";
3803        _exceptionMessage = "not enough space in uniformIndices";
3804        goto exit;
3805    }
3806
3807    glGetUniformIndices(program, _count, _names, _indices);
3808
3809exit:
3810    if (_uniformIndicesArray) {
3811        releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(
3812            _env, _uniformIndicesArray, (jint*)_indicesBase, JNI_TRUE);
3813    }
3814    for (_i = _count - 1; _i >= 0; _i--) {
3815        if (_names[_i]) {
3816            jstring _name = (jstring)_env->GetObjectArrayElement(uniformNames_ref, _i);
3817            if (_name) {
3818                _env->ReleaseStringUTFChars(_name, _names[_i]);
3819            }
3820        }
3821    }
3822    free(_names);
3823    if (_exception) {
3824        jniThrowException(_env, _exceptionType, _exceptionMessage);
3825    }
3826}
3827/* void glGetActiveUniformsiv ( GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params ) */
3828static void
3829android_glGetActiveUniformsiv__II_3III_3II
3830  (JNIEnv *_env, jobject _this, jint program, jint uniformCount, jintArray uniformIndices_ref, jint uniformIndicesOffset, jint pname, jintArray params_ref, jint paramsOffset) {
3831    jint _exception = 0;
3832    const char * _exceptionType = NULL;
3833    const char * _exceptionMessage = NULL;
3834    GLuint *uniformIndices_base = (GLuint *) 0;
3835    jint _uniformIndicesRemaining;
3836    GLuint *uniformIndices = (GLuint *) 0;
3837    GLint *params_base = (GLint *) 0;
3838    jint _paramsRemaining;
3839    GLint *params = (GLint *) 0;
3840
3841    if (!uniformIndices_ref) {
3842        _exception = 1;
3843        _exceptionType = "java/lang/IllegalArgumentException";
3844        _exceptionMessage = "uniformIndices == null";
3845        goto exit;
3846    }
3847    if (uniformIndicesOffset < 0) {
3848        _exception = 1;
3849        _exceptionType = "java/lang/IllegalArgumentException";
3850        _exceptionMessage = "uniformIndicesOffset < 0";
3851        goto exit;
3852    }
3853    _uniformIndicesRemaining = _env->GetArrayLength(uniformIndices_ref) - uniformIndicesOffset;
3854    uniformIndices_base = (GLuint *)
3855        _env->GetIntArrayElements(uniformIndices_ref, (jboolean *)0);
3856    uniformIndices = uniformIndices_base + uniformIndicesOffset;
3857
3858    if (!params_ref) {
3859        _exception = 1;
3860        _exceptionType = "java/lang/IllegalArgumentException";
3861        _exceptionMessage = "params == null";
3862        goto exit;
3863    }
3864    if (paramsOffset < 0) {
3865        _exception = 1;
3866        _exceptionType = "java/lang/IllegalArgumentException";
3867        _exceptionMessage = "paramsOffset < 0";
3868        goto exit;
3869    }
3870    _paramsRemaining = _env->GetArrayLength(params_ref) - paramsOffset;
3871    params_base = (GLint *)
3872        _env->GetIntArrayElements(params_ref, (jboolean *)0);
3873    params = params_base + paramsOffset;
3874
3875    glGetActiveUniformsiv(
3876        (GLuint)program,
3877        (GLsizei)uniformCount,
3878        (GLuint *)uniformIndices,
3879        (GLenum)pname,
3880        (GLint *)params
3881    );
3882
3883exit:
3884    if (params_base) {
3885        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
3886            _exception ? JNI_ABORT: 0);
3887    }
3888    if (uniformIndices_base) {
3889        _env->ReleaseIntArrayElements(uniformIndices_ref, (jint*)uniformIndices_base,
3890            JNI_ABORT);
3891    }
3892    if (_exception) {
3893        jniThrowException(_env, _exceptionType, _exceptionMessage);
3894    }
3895}
3896
3897/* void glGetActiveUniformsiv ( GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params ) */
3898static void
3899android_glGetActiveUniformsiv__IILjava_nio_IntBuffer_2ILjava_nio_IntBuffer_2
3900  (JNIEnv *_env, jobject _this, jint program, jint uniformCount, jobject uniformIndices_buf, jint pname, jobject params_buf) {
3901    jint _exception = 0;
3902    const char * _exceptionType = NULL;
3903    const char * _exceptionMessage = NULL;
3904    jintArray _uniformIndicesArray = (jintArray) 0;
3905    jint _uniformIndicesBufferOffset = (jint) 0;
3906    jintArray _paramsArray = (jintArray) 0;
3907    jint _paramsBufferOffset = (jint) 0;
3908    jint _uniformIndicesRemaining;
3909    GLuint *uniformIndices = (GLuint *) 0;
3910    jint _paramsRemaining;
3911    GLint *params = (GLint *) 0;
3912
3913    if (!uniformIndices_buf) {
3914        _exception = 1;
3915        _exceptionType = "java/lang/IllegalArgumentException";
3916        _exceptionMessage = "uniformIndices == null";
3917        goto exit;
3918    }
3919    uniformIndices = (GLuint *)getPointer(_env, uniformIndices_buf, (jarray*)&_uniformIndicesArray, &_uniformIndicesRemaining, &_uniformIndicesBufferOffset);
3920    if (!params_buf) {
3921        _exception = 1;
3922        _exceptionType = "java/lang/IllegalArgumentException";
3923        _exceptionMessage = "params == null";
3924        goto exit;
3925    }
3926    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_paramsArray, &_paramsRemaining, &_paramsBufferOffset);
3927    if (uniformIndices == NULL) {
3928        char * _uniformIndicesBase = (char *)_env->GetIntArrayElements(_uniformIndicesArray, (jboolean *) 0);
3929        uniformIndices = (GLuint *) (_uniformIndicesBase + _uniformIndicesBufferOffset);
3930    }
3931    if (params == NULL) {
3932        char * _paramsBase = (char *)_env->GetIntArrayElements(_paramsArray, (jboolean *) 0);
3933        params = (GLint *) (_paramsBase + _paramsBufferOffset);
3934    }
3935    glGetActiveUniformsiv(
3936        (GLuint)program,
3937        (GLsizei)uniformCount,
3938        (GLuint *)uniformIndices,
3939        (GLenum)pname,
3940        (GLint *)params
3941    );
3942
3943exit:
3944    if (_paramsArray) {
3945        _env->ReleaseIntArrayElements(_paramsArray, (jint*)params, _exception ? JNI_ABORT : 0);
3946    }
3947    if (_uniformIndicesArray) {
3948        _env->ReleaseIntArrayElements(_uniformIndicesArray, (jint*)uniformIndices, JNI_ABORT);
3949    }
3950    if (_exception) {
3951        jniThrowException(_env, _exceptionType, _exceptionMessage);
3952    }
3953}
3954
3955/* GLuint glGetUniformBlockIndex ( GLuint program, const GLchar *uniformBlockName ) */
3956static jint
3957android_glGetUniformBlockIndex__ILjava_lang_String_2
3958  (JNIEnv *_env, jobject _this, jint program, jstring uniformBlockName) {
3959    jint _exception = 0;
3960    const char * _exceptionType = NULL;
3961    const char * _exceptionMessage = NULL;
3962    GLuint _returnValue = 0;
3963    const char* _nativeuniformBlockName = 0;
3964
3965    if (!uniformBlockName) {
3966        _exception = 1;
3967        _exceptionType = "java/lang/IllegalArgumentException";
3968        _exceptionMessage = "uniformBlockName == null";
3969        goto exit;
3970    }
3971    _nativeuniformBlockName = _env->GetStringUTFChars(uniformBlockName, 0);
3972
3973    _returnValue = glGetUniformBlockIndex(
3974        (GLuint)program,
3975        (GLchar *)_nativeuniformBlockName
3976    );
3977
3978exit:
3979    if (_nativeuniformBlockName) {
3980        _env->ReleaseStringUTFChars(uniformBlockName, _nativeuniformBlockName);
3981    }
3982
3983    if (_exception) {
3984        jniThrowException(_env, _exceptionType, _exceptionMessage);
3985    }
3986    return (jint)_returnValue;
3987}
3988
3989/* void glGetActiveUniformBlockiv ( GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params ) */
3990static void
3991android_glGetActiveUniformBlockiv__III_3II
3992  (JNIEnv *_env, jobject _this, jint program, jint uniformBlockIndex, jint pname, jintArray params_ref, jint offset) {
3993    jint _exception = 0;
3994    const char * _exceptionType = NULL;
3995    const char * _exceptionMessage = NULL;
3996    GLint *params_base = (GLint *) 0;
3997    jint _remaining;
3998    GLint *params = (GLint *) 0;
3999
4000    if (!params_ref) {
4001        _exception = 1;
4002        _exceptionType = "java/lang/IllegalArgumentException";
4003        _exceptionMessage = "params == null";
4004        goto exit;
4005    }
4006    if (offset < 0) {
4007        _exception = 1;
4008        _exceptionType = "java/lang/IllegalArgumentException";
4009        _exceptionMessage = "offset < 0";
4010        goto exit;
4011    }
4012    _remaining = _env->GetArrayLength(params_ref) - offset;
4013    params_base = (GLint *)
4014        _env->GetIntArrayElements(params_ref, (jboolean *)0);
4015    params = params_base + offset;
4016
4017    glGetActiveUniformBlockiv(
4018        (GLuint)program,
4019        (GLuint)uniformBlockIndex,
4020        (GLenum)pname,
4021        (GLint *)params
4022    );
4023
4024exit:
4025    if (params_base) {
4026        _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
4027            _exception ? JNI_ABORT: 0);
4028    }
4029    if (_exception) {
4030        jniThrowException(_env, _exceptionType, _exceptionMessage);
4031    }
4032}
4033
4034/* void glGetActiveUniformBlockiv ( GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params ) */
4035static void
4036android_glGetActiveUniformBlockiv__IIILjava_nio_IntBuffer_2
4037  (JNIEnv *_env, jobject _this, jint program, jint uniformBlockIndex, jint pname, jobject params_buf) {
4038    jint _exception = 0;
4039    const char * _exceptionType = NULL;
4040    const char * _exceptionMessage = NULL;
4041    jintArray _array = (jintArray) 0;
4042    jint _bufferOffset = (jint) 0;
4043    jint _remaining;
4044    GLint *params = (GLint *) 0;
4045
4046    if (!params_buf) {
4047        _exception = 1;
4048        _exceptionType = "java/lang/IllegalArgumentException";
4049        _exceptionMessage = "params == null";
4050        goto exit;
4051    }
4052    params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
4053    if (params == NULL) {
4054        char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
4055        params = (GLint *) (_paramsBase + _bufferOffset);
4056    }
4057    glGetActiveUniformBlockiv(
4058        (GLuint)program,
4059        (GLuint)uniformBlockIndex,
4060        (GLenum)pname,
4061        (GLint *)params
4062    );
4063
4064exit:
4065    if (_array) {
4066        _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
4067    }
4068    if (_exception) {
4069        jniThrowException(_env, _exceptionType, _exceptionMessage);
4070    }
4071}
4072
4073/* void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName ) */
4074static void
4075android_glGetActiveUniformBlockName_III_3II_3BI
4076    (JNIEnv* _env, jobject _this, jint program, jint uniformBlockIndex, int bufSize, jintArray length_ref, jint lengthOffset, jbyteArray name_ref, jint nameOffset) {
4077    jint _exception = 0;
4078    const char* _exceptionType;
4079    const char* _exceptionMessage;
4080    GLsizei* _length_base = (GLsizei*)0;
4081    jint _lengthRemaining;
4082    GLsizei* _length = (GLsizei*)0;
4083    GLchar* _name_base = (GLchar*)0;
4084    jint _nameRemaining;
4085    GLchar* _name = (GLchar*)0;
4086
4087    if (length_ref) {
4088        if (lengthOffset < 0) {
4089            _exception = 1;
4090            _exceptionType = "java/lang/IllegalArgumentException";
4091            _exceptionMessage = "lengthOffset < 0";
4092            goto exit;
4093        }
4094        _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
4095        _length_base = (GLsizei*)_env->GetIntArrayElements(
4096                length_ref, (jboolean*)0);
4097        _length = _length_base + lengthOffset;
4098    }
4099
4100    if (!name_ref) {
4101        _exception = 1;
4102        _exceptionType = "java/lang/IllegalArgumentException";
4103        _exceptionMessage = "uniformBlockName == null";
4104        goto exit;
4105    }
4106    if (nameOffset < 0) {
4107        _exception = 1;
4108        _exceptionType = "java/lang/IllegalArgumentException";
4109        _exceptionMessage = "uniformBlockNameOffset < 0";
4110        goto exit;
4111    }
4112    _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
4113    _name_base = (GLchar*)_env->GetByteArrayElements(
4114            name_ref, (jboolean*)0);
4115    _name = _name_base + nameOffset;
4116
4117    glGetActiveUniformBlockName(
4118        (GLuint)program,
4119        (GLuint)uniformBlockIndex,
4120        (GLsizei)bufSize,
4121        (GLsizei*)_length,
4122        (GLchar*)_name
4123    );
4124
4125exit:
4126    if (_name_base) {
4127        _env->ReleaseByteArrayElements(name_ref, (jbyte*)_name_base,
4128            _exception ? JNI_ABORT: 0);
4129    }
4130    if (_length_base) {
4131        _env->ReleaseIntArrayElements(length_ref, (jint*)_length_base,
4132            _exception ? JNI_ABORT: 0);
4133    }
4134    if (_exception) {
4135        jniThrowException(_env, _exceptionType, _exceptionMessage);
4136    }
4137}
4138
4139/* void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName ) */
4140static void
4141android_glGetActiveUniformBlockName_IILjava_nio_Buffer_2Ljava_nio_Buffer_2
4142    (JNIEnv* _env, jobject _this, jint program, jint uniformBlockIndex, jobject length_buf, jobject uniformBlockName_buf) {
4143    jint _exception = 0;
4144    const char* _exceptionType;
4145    const char* _exceptionMessage;
4146    jarray _lengthArray = (jarray)0;
4147    jint _lengthBufferOffset = (jint)0;
4148    GLsizei* _length = (GLsizei*)0;
4149    jint _lengthRemaining;
4150    jarray _nameArray = (jarray)0;
4151    jint _nameBufferOffset = (jint)0;
4152    GLchar* _name = (GLchar*)0;
4153    jint _nameRemaining;
4154
4155    _length = (GLsizei*)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
4156    if (_length == NULL) {
4157        GLsizei* _lengthBase = (GLsizei*)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean*)0);
4158        _length = (GLsizei*)(_lengthBase + _lengthBufferOffset);
4159    }
4160
4161    _name = (GLchar*)getPointer(_env, uniformBlockName_buf, &_nameArray, &_nameRemaining, &_nameBufferOffset);
4162    if (_name == NULL) {
4163        GLchar* _nameBase = (GLchar*)_env->GetPrimitiveArrayCritical(_nameArray, (jboolean*)0);
4164        _name = (GLchar*)(_nameBase + _nameBufferOffset);
4165    }
4166
4167    glGetActiveUniformBlockName(
4168        (GLuint)program,
4169        (GLuint)uniformBlockIndex,
4170        (GLsizei)_nameRemaining,
4171        _length, _name
4172    );
4173    if (_nameArray) {
4174        releasePointer(_env, _nameArray, _name, JNI_TRUE);
4175    }
4176    if (_lengthArray) {
4177        releasePointer(_env, _lengthArray, _length, JNI_TRUE);
4178    }
4179}
4180
4181/* void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName ) */
4182static jstring
4183android_glGetActiveUniformBlockName_II
4184    (JNIEnv *_env, jobject _this, jint program, jint uniformBlockIndex) {
4185    GLint len = 0;
4186    glGetActiveUniformBlockiv((GLuint)program, (GLuint)uniformBlockIndex,
4187            GL_UNIFORM_BLOCK_NAME_LENGTH, &len);
4188    GLchar* name = (GLchar*)malloc(len);
4189    glGetActiveUniformBlockName((GLuint)program, (GLuint)uniformBlockIndex,
4190        len, NULL, name);
4191    jstring result = _env->NewStringUTF(name);
4192    free(name);
4193    return result;
4194}
4195/* void glUniformBlockBinding ( GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding ) */
4196static void
4197android_glUniformBlockBinding__III
4198  (JNIEnv *_env, jobject _this, jint program, jint uniformBlockIndex, jint uniformBlockBinding) {
4199    glUniformBlockBinding(
4200        (GLuint)program,
4201        (GLuint)uniformBlockIndex,
4202        (GLuint)uniformBlockBinding
4203    );
4204}
4205
4206/* void glDrawArraysInstanced ( GLenum mode, GLint first, GLsizei count, GLsizei instanceCount ) */
4207static void
4208android_glDrawArraysInstanced__IIII
4209  (JNIEnv *_env, jobject _this, jint mode, jint first, jint count, jint instanceCount) {
4210    glDrawArraysInstanced(
4211        (GLenum)mode,
4212        (GLint)first,
4213        (GLsizei)count,
4214        (GLsizei)instanceCount
4215    );
4216}
4217
4218/* void glDrawElementsInstanced ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount ) */
4219static void
4220android_glDrawElementsInstanced__IIILjava_nio_Buffer_2I
4221  (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf, jint instanceCount) {
4222    jarray _array = (jarray) 0;
4223    jint _bufferOffset = (jint) 0;
4224    jint _remaining;
4225    GLvoid *indices = (GLvoid *) 0;
4226
4227    indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining, &_bufferOffset);
4228    if (indices == NULL) {
4229        char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4230        indices = (GLvoid *) (_indicesBase + _bufferOffset);
4231    }
4232    glDrawElementsInstanced(
4233        (GLenum)mode,
4234        (GLsizei)count,
4235        (GLenum)type,
4236        (GLvoid *)indices,
4237        (GLsizei)instanceCount
4238    );
4239    if (_array) {
4240        releasePointer(_env, _array, indices, JNI_FALSE);
4241    }
4242}
4243
4244/* void glDrawElementsInstanced ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount ) */
4245static void
4246android_glDrawElementsInstanced__IIIII
4247  (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint indicesOffset, jint instanceCount) {
4248    glDrawElementsInstanced(
4249        (GLenum)mode,
4250        (GLsizei)count,
4251        (GLenum)type,
4252        (GLvoid *)static_cast<uintptr_t>(indicesOffset),
4253        (GLsizei)instanceCount
4254    );
4255}
4256/* GLsync glFenceSync ( GLenum condition, GLbitfield flags ) */
4257static jlong
4258android_glFenceSync__II
4259  (JNIEnv *_env, jobject _this, jint condition, jint flags) {
4260    GLsync _returnValue;
4261    _returnValue = glFenceSync(
4262        (GLenum)condition,
4263        (GLbitfield)flags
4264    );
4265    return (jlong)_returnValue;
4266}
4267
4268/* GLboolean glIsSync ( GLsync sync ) */
4269static jboolean
4270android_glIsSync__J
4271  (JNIEnv *_env, jobject _this, jlong sync) {
4272    GLboolean _returnValue;
4273    _returnValue = glIsSync(
4274        (GLsync)sync
4275    );
4276    return (jboolean)_returnValue;
4277}
4278
4279/* void glDeleteSync ( GLsync sync ) */
4280static void
4281android_glDeleteSync__J
4282  (JNIEnv *_env, jobject _this, jlong sync) {
4283    glDeleteSync(
4284        (GLsync)sync
4285    );
4286}
4287
4288/* GLenum glClientWaitSync ( GLsync sync, GLbitfield flags, GLuint64 timeout ) */
4289static jint
4290android_glClientWaitSync__JIJ
4291  (JNIEnv *_env, jobject _this, jlong sync, jint flags, jlong timeout) {
4292    GLenum _returnValue;
4293    _returnValue = glClientWaitSync(
4294        (GLsync)sync,
4295        (GLbitfield)flags,
4296        (GLuint64)timeout
4297    );
4298    return (jint)_returnValue;
4299}
4300
4301/* void glWaitSync ( GLsync sync, GLbitfield flags, GLuint64 timeout ) */
4302static void
4303android_glWaitSync__JIJ
4304  (JNIEnv *_env, jobject _this, jlong sync, jint flags, jlong timeout) {
4305    glWaitSync(
4306        (GLsync)sync,
4307        (GLbitfield)flags,
4308        (GLuint64)timeout
4309    );
4310}
4311
4312/* void glGetInteger64v ( GLenum pname, GLint64 *params ) */
4313static void
4314android_glGetInteger64v__I_3JI
4315  (JNIEnv *_env, jobject _this, jint pname, jlongArray params_ref, jint offset) {
4316    jint _exception = 0;
4317    const char * _exceptionType = NULL;
4318    const char * _exceptionMessage = NULL;
4319    GLint64 *params_base = (GLint64 *) 0;
4320    jint _remaining;
4321    GLint64 *params = (GLint64 *) 0;
4322
4323    if (!params_ref) {
4324        _exception = 1;
4325        _exceptionType = "java/lang/IllegalArgumentException";
4326        _exceptionMessage = "params == null";
4327        goto exit;
4328    }
4329    if (offset < 0) {
4330        _exception = 1;
4331        _exceptionType = "java/lang/IllegalArgumentException";
4332        _exceptionMessage = "offset < 0";
4333        goto exit;
4334    }
4335    _remaining = _env->GetArrayLength(params_ref) - offset;
4336    params_base = (GLint64 *)
4337        _env->GetLongArrayElements(params_ref, (jboolean *)0);
4338    params = params_base + offset;
4339
4340    glGetInteger64v(
4341        (GLenum)pname,
4342        (GLint64 *)params
4343    );
4344
4345exit:
4346    if (params_base) {
4347        _env->ReleaseLongArrayElements(params_ref, (jlong*)params_base,
4348            _exception ? JNI_ABORT: 0);
4349    }
4350    if (_exception) {
4351        jniThrowException(_env, _exceptionType, _exceptionMessage);
4352    }
4353}
4354
4355/* void glGetInteger64v ( GLenum pname, GLint64 *params ) */
4356static void
4357android_glGetInteger64v__ILjava_nio_LongBuffer_2
4358  (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
4359    jint _exception = 0;
4360    const char * _exceptionType = NULL;
4361    const char * _exceptionMessage = NULL;
4362    jlongArray _array = (jlongArray) 0;
4363    jint _bufferOffset = (jint) 0;
4364    jint _remaining;
4365    GLint64 *params = (GLint64 *) 0;
4366
4367    if (!params_buf) {
4368        _exception = 1;
4369        _exceptionType = "java/lang/IllegalArgumentException";
4370        _exceptionMessage = "params == null";
4371        goto exit;
4372    }
4373    params = (GLint64 *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
4374    if (params == NULL) {
4375        char * _paramsBase = (char *)_env->GetLongArrayElements(_array, (jboolean *) 0);
4376        params = (GLint64 *) (_paramsBase + _bufferOffset);
4377    }
4378    glGetInteger64v(
4379        (GLenum)pname,
4380        (GLint64 *)params
4381    );
4382
4383exit:
4384    if (_array) {
4385        _env->ReleaseLongArrayElements(_array, (jlong*)params, _exception ? JNI_ABORT : 0);
4386    }
4387    if (_exception) {
4388        jniThrowException(_env, _exceptionType, _exceptionMessage);
4389    }
4390}
4391
4392/* void glGetSynciv ( GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values ) */
4393static void
4394android_glGetSynciv__JII_3II_3II
4395  (JNIEnv *_env, jobject _this, jlong sync, jint pname, jint bufSize, jintArray length_ref, jint lengthOffset, jintArray values_ref, jint valuesOffset) {
4396    jint _exception = 0;
4397    const char * _exceptionType = NULL;
4398    const char * _exceptionMessage = NULL;
4399    GLsizei *length_base = (GLsizei *) 0;
4400    jint _lengthRemaining;
4401    GLsizei *length = (GLsizei *) 0;
4402    GLint *values_base = (GLint *) 0;
4403    jint _valuesRemaining;
4404    GLint *values = (GLint *) 0;
4405
4406    if (length_ref) {
4407        if (lengthOffset < 0) {
4408            _exception = 1;
4409            _exceptionType = "java/lang/IllegalArgumentException";
4410            _exceptionMessage = "lengthOffset < 0";
4411            goto exit;
4412        }
4413        _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
4414        length_base = (GLsizei *)
4415            _env->GetIntArrayElements(length_ref, (jboolean *)0);
4416        length = length_base + lengthOffset;
4417    }
4418
4419    if (!values_ref) {
4420        _exception = 1;
4421        _exceptionType = "java/lang/IllegalArgumentException";
4422        _exceptionMessage = "values == null";
4423        goto exit;
4424    }
4425    if (valuesOffset < 0) {
4426        _exception = 1;
4427        _exceptionType = "java/lang/IllegalArgumentException";
4428        _exceptionMessage = "valuesOffset < 0";
4429        goto exit;
4430    }
4431    _valuesRemaining = _env->GetArrayLength(values_ref) - valuesOffset;
4432    values_base = (GLint *)
4433        _env->GetIntArrayElements(values_ref, (jboolean *)0);
4434    values = values_base + valuesOffset;
4435
4436    glGetSynciv(
4437        (GLsync)sync,
4438        (GLenum)pname,
4439        (GLsizei)bufSize,
4440        (GLsizei *)length,
4441        (GLint *)values
4442    );
4443
4444exit:
4445    if (values_base) {
4446        _env->ReleaseIntArrayElements(values_ref, (jint*)values_base,
4447            _exception ? JNI_ABORT: 0);
4448    }
4449    if (length_base) {
4450        _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
4451            _exception ? JNI_ABORT: 0);
4452    }
4453    if (_exception) {
4454        jniThrowException(_env, _exceptionType, _exceptionMessage);
4455    }
4456}
4457
4458/* void glGetSynciv ( GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values ) */
4459static void
4460android_glGetSynciv__JIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
4461  (JNIEnv *_env, jobject _this, jlong sync, jint pname, jint bufSize, jobject length_buf, jobject values_buf) {
4462    jint _exception = 0;
4463    const char * _exceptionType = NULL;
4464    const char * _exceptionMessage = NULL;
4465    jintArray _lengthArray = (jintArray) 0;
4466    jint _lengthBufferOffset = (jint) 0;
4467    jintArray _valuesArray = (jintArray) 0;
4468    jint _valuesBufferOffset = (jint) 0;
4469    jint _lengthRemaining;
4470    GLsizei *length = (GLsizei *) 0;
4471    jint _valuesRemaining;
4472    GLint *values = (GLint *) 0;
4473
4474    if (length_buf) {
4475        length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
4476    }
4477    if (!values_buf) {
4478        _exception = 1;
4479        _exceptionType = "java/lang/IllegalArgumentException";
4480        _exceptionMessage = "values == null";
4481        goto exit;
4482    }
4483    values = (GLint *)getPointer(_env, values_buf, (jarray*)&_valuesArray, &_valuesRemaining, &_valuesBufferOffset);
4484    if (length_buf && length == NULL) {
4485        char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
4486        length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
4487    }
4488    if (values == NULL) {
4489        char * _valuesBase = (char *)_env->GetIntArrayElements(_valuesArray, (jboolean *) 0);
4490        values = (GLint *) (_valuesBase + _valuesBufferOffset);
4491    }
4492    glGetSynciv(
4493        (GLsync)sync,
4494        (GLenum)pname,
4495        (GLsizei)bufSize,
4496        (GLsizei *)length,
4497        (GLint *)values
4498    );
4499
4500exit:
4501    if (_valuesArray) {
4502        _env->ReleaseIntArrayElements(_valuesArray, (jint*)values, _exception ? JNI_ABORT : 0);
4503    }
4504    if (_lengthArray) {
4505        _env->ReleaseIntArrayElements(_lengthArray, (jint*)length, _exception ? JNI_ABORT : 0);
4506    }
4507    if (_exception) {
4508        jniThrowException(_env, _exceptionType, _exceptionMessage);
4509    }
4510}
4511
4512/* void glGetInteger64i_v ( GLenum target, GLuint index, GLint64 *data ) */
4513static void
4514android_glGetInteger64i_v__II_3JI
4515  (JNIEnv *_env, jobject _this, jint target, jint index, jlongArray data_ref, jint offset) {
4516    jint _exception = 0;
4517    const char * _exceptionType = NULL;
4518    const char * _exceptionMessage = NULL;
4519    GLint64 *data_base = (GLint64 *) 0;
4520    jint _remaining;
4521    GLint64 *data = (GLint64 *) 0;
4522
4523    if (!data_ref) {
4524        _exception = 1;
4525        _exceptionType = "java/lang/IllegalArgumentException";
4526        _exceptionMessage = "data == null";
4527        goto exit;
4528    }
4529    if (offset < 0) {
4530        _exception = 1;
4531        _exceptionType = "java/lang/IllegalArgumentException";
4532        _exceptionMessage = "offset < 0";
4533        goto exit;
4534    }
4535    _remaining = _env->GetArrayLength(data_ref) - offset;
4536    data_base = (GLint64 *)
4537        _env->GetLongArrayElements(data_ref, (jboolean *)0);
4538    data = data_base + offset;
4539
4540    glGetInteger64i_v(
4541        (GLenum)target,
4542        (GLuint)index,
4543        (GLint64 *)data
4544    );
4545
4546exit:
4547    if (data_base) {
4548        _env->ReleaseLongArrayElements(data_ref, (jlong*)data_base,
4549            _exception ? JNI_ABORT: 0);
4550    }
4551    if (_exception) {
4552        jniThrowException(_env, _exceptionType, _exceptionMessage);
4553    }
4554}
4555
4556/* void glGetInteger64i_v ( GLenum target, GLuint index, GLint64 *data ) */
4557static void
4558android_glGetInteger64i_v__IILjava_nio_LongBuffer_2
4559  (JNIEnv *_env, jobject _this, jint target, jint index, jobject data_buf) {
4560    jint _exception = 0;
4561    const char * _exceptionType = NULL;
4562    const char * _exceptionMessage = NULL;
4563    jlongArray _array = (jlongArray) 0;
4564    jint _bufferOffset = (jint) 0;
4565    jint _remaining;
4566    GLint64 *data = (GLint64 *) 0;
4567
4568    if (!data_buf) {
4569        _exception = 1;
4570        _exceptionType = "java/lang/IllegalArgumentException";
4571        _exceptionMessage = "data == null";
4572        goto exit;
4573    }
4574    data = (GLint64 *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
4575    if (data == NULL) {
4576        char * _dataBase = (char *)_env->GetLongArrayElements(_array, (jboolean *) 0);
4577        data = (GLint64 *) (_dataBase + _bufferOffset);
4578    }
4579    glGetInteger64i_v(
4580        (GLenum)target,
4581        (GLuint)index,
4582        (GLint64 *)data
4583    );
4584
4585exit:
4586    if (_array) {
4587        _env->ReleaseLongArrayElements(_array, (jlong*)data, _exception ? JNI_ABORT : 0);
4588    }
4589    if (_exception) {
4590        jniThrowException(_env, _exceptionType, _exceptionMessage);
4591    }
4592}
4593
4594/* void glGetBufferParameteri64v ( GLenum target, GLenum pname, GLint64 *params ) */
4595static void
4596android_glGetBufferParameteri64v__II_3JI
4597  (JNIEnv *_env, jobject _this, jint target, jint pname, jlongArray params_ref, jint offset) {
4598    jint _exception = 0;
4599    const char * _exceptionType = NULL;
4600    const char * _exceptionMessage = NULL;
4601    GLint64 *params_base = (GLint64 *) 0;
4602    jint _remaining;
4603    GLint64 *params = (GLint64 *) 0;
4604
4605    if (!params_ref) {
4606        _exception = 1;
4607        _exceptionType = "java/lang/IllegalArgumentException";
4608        _exceptionMessage = "params == null";
4609        goto exit;
4610    }
4611    if (offset < 0) {
4612        _exception = 1;
4613        _exceptionType = "java/lang/IllegalArgumentException";
4614        _exceptionMessage = "offset < 0";
4615        goto exit;
4616    }
4617    _remaining = _env->GetArrayLength(params_ref) - offset;
4618    params_base = (GLint64 *)
4619        _env->GetLongArrayElements(params_ref, (jboolean *)0);
4620    params = params_base + offset;
4621
4622    glGetBufferParameteri64v(
4623        (GLenum)target,
4624        (GLenum)pname,
4625        (GLint64 *)params
4626    );
4627
4628exit:
4629    if (params_base) {
4630        _env->ReleaseLongArrayElements(params_ref, (jlong*)params_base,
4631            _exception ? JNI_ABORT: 0);
4632    }
4633    if (_exception) {
4634        jniThrowException(_env, _exceptionType, _exceptionMessage);
4635    }
4636}
4637
4638/* void glGetBufferParameteri64v ( GLenum target, GLenum pname, GLint64 *params ) */
4639static void
4640android_glGetBufferParameteri64v__IILjava_nio_LongBuffer_2
4641  (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
4642    jint _exception = 0;
4643    const char * _exceptionType = NULL;
4644    const char * _exceptionMessage = NULL;
4645    jlongArray _array = (jlongArray) 0;
4646    jint _bufferOffset = (jint) 0;
4647    jint _remaining;
4648    GLint64 *params = (GLint64 *) 0;
4649
4650    if (!params_buf) {
4651        _exception = 1;
4652        _exceptionType = "java/lang/IllegalArgumentException";
4653        _exceptionMessage = "params == null";
4654        goto exit;
4655    }
4656    params = (GLint64 *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
4657    if (params == NULL) {
4658        char * _paramsBase = (char *)_env->GetLongArrayElements(_array, (jboolean *) 0);
4659        params = (GLint64 *) (_paramsBase + _bufferOffset);
4660    }
4661    glGetBufferParameteri64v(
4662        (GLenum)target,
4663        (GLenum)pname,
4664        (GLint64 *)params
4665    );
4666
4667exit:
4668    if (_array) {
4669        _env->ReleaseLongArrayElements(_array, (jlong*)params, _exception ? JNI_ABORT : 0);
4670    }
4671    if (_exception) {
4672        jniThrowException(_env, _exceptionType, _exceptionMessage);
4673    }
4674}
4675
4676/* void glGenSamplers ( GLsizei count, GLuint *samplers ) */
4677static void
4678android_glGenSamplers__I_3II
4679  (JNIEnv *_env, jobject _this, jint count, jintArray samplers_ref, jint offset) {
4680    jint _exception = 0;
4681    const char * _exceptionType = NULL;
4682    const char * _exceptionMessage = NULL;
4683    GLuint *samplers_base = (GLuint *) 0;
4684    jint _remaining;
4685    GLuint *samplers = (GLuint *) 0;
4686
4687    if (!samplers_ref) {
4688        _exception = 1;
4689        _exceptionType = "java/lang/IllegalArgumentException";
4690        _exceptionMessage = "samplers == null";
4691        goto exit;
4692    }
4693    if (offset < 0) {
4694        _exception = 1;
4695        _exceptionType = "java/lang/IllegalArgumentException";
4696        _exceptionMessage = "offset < 0";
4697        goto exit;
4698    }
4699    _remaining = _env->GetArrayLength(samplers_ref) - offset;
4700    samplers_base = (GLuint *)
4701        _env->GetIntArrayElements(samplers_ref, (jboolean *)0);
4702    samplers = samplers_base + offset;
4703
4704    glGenSamplers(
4705        (GLsizei)count,
4706        (GLuint *)samplers
4707    );
4708
4709exit:
4710    if (samplers_base) {
4711        _env->ReleaseIntArrayElements(samplers_ref, (jint*)samplers_base,
4712            _exception ? JNI_ABORT: 0);
4713    }
4714    if (_exception) {
4715        jniThrowException(_env, _exceptionType, _exceptionMessage);
4716    }
4717}
4718
4719/* void glGenSamplers ( GLsizei count, GLuint *samplers ) */
4720static void
4721android_glGenSamplers__ILjava_nio_IntBuffer_2
4722  (JNIEnv *_env, jobject _this, jint count, jobject samplers_buf) {
4723    jint _exception = 0;
4724    const char * _exceptionType = NULL;
4725    const char * _exceptionMessage = NULL;
4726    jintArray _array = (jintArray) 0;
4727    jint _bufferOffset = (jint) 0;
4728    jint _remaining;
4729    GLuint *samplers = (GLuint *) 0;
4730
4731    if (!samplers_buf) {
4732        _exception = 1;
4733        _exceptionType = "java/lang/IllegalArgumentException";
4734        _exceptionMessage = "samplers == null";
4735        goto exit;
4736    }
4737    samplers = (GLuint *)getPointer(_env, samplers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
4738    if (samplers == NULL) {
4739        char * _samplersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
4740        samplers = (GLuint *) (_samplersBase + _bufferOffset);
4741    }
4742    glGenSamplers(
4743        (GLsizei)count,
4744        (GLuint *)samplers
4745    );
4746
4747exit:
4748    if (_array) {
4749        _env->ReleaseIntArrayElements(_array, (jint*)samplers, _exception ? JNI_ABORT : 0);
4750    }
4751    if (_exception) {
4752        jniThrowException(_env, _exceptionType, _exceptionMessage);
4753    }
4754}
4755
4756/* void glDeleteSamplers ( GLsizei count, const GLuint *samplers ) */
4757static void
4758android_glDeleteSamplers__I_3II
4759  (JNIEnv *_env, jobject _this, jint count, jintArray samplers_ref, jint offset) {
4760    jint _exception = 0;
4761    const char * _exceptionType = NULL;
4762    const char * _exceptionMessage = NULL;
4763    GLuint *samplers_base = (GLuint *) 0;
4764    jint _remaining;
4765    GLuint *samplers = (GLuint *) 0;
4766
4767    if (!samplers_ref) {
4768        _exception = 1;
4769        _exceptionType = "java/lang/IllegalArgumentException";
4770        _exceptionMessage = "samplers == null";
4771        goto exit;
4772    }
4773    if (offset < 0) {
4774        _exception = 1;
4775        _exceptionType = "java/lang/IllegalArgumentException";
4776        _exceptionMessage = "offset < 0";
4777        goto exit;
4778    }
4779    _remaining = _env->GetArrayLength(samplers_ref) - offset;
4780    samplers_base = (GLuint *)
4781        _env->GetIntArrayElements(samplers_ref, (jboolean *)0);
4782    samplers = samplers_base + offset;
4783
4784    glDeleteSamplers(
4785        (GLsizei)count,
4786        (GLuint *)samplers
4787    );
4788
4789exit:
4790    if (samplers_base) {
4791        _env->ReleaseIntArrayElements(samplers_ref, (jint*)samplers_base,
4792            JNI_ABORT);
4793    }
4794    if (_exception) {
4795        jniThrowException(_env, _exceptionType, _exceptionMessage);
4796    }
4797}
4798
4799/* void glDeleteSamplers ( GLsizei count, const GLuint *samplers ) */
4800static void
4801android_glDeleteSamplers__ILjava_nio_IntBuffer_2
4802  (JNIEnv *_env, jobject _this, jint count, jobject samplers_buf) {
4803    jint _exception = 0;
4804    const char * _exceptionType = NULL;
4805    const char * _exceptionMessage = NULL;
4806    jintArray _array = (jintArray) 0;
4807    jint _bufferOffset = (jint) 0;
4808    jint _remaining;
4809    GLuint *samplers = (GLuint *) 0;
4810
4811    if (!samplers_buf) {
4812        _exception = 1;
4813        _exceptionType = "java/lang/IllegalArgumentException";
4814        _exceptionMessage = "samplers == null";
4815        goto exit;
4816    }
4817    samplers = (GLuint *)getPointer(_env, samplers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
4818    if (samplers == NULL) {
4819        char * _samplersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
4820        samplers = (GLuint *) (_samplersBase + _bufferOffset);
4821    }
4822    glDeleteSamplers(
4823        (GLsizei)count,
4824        (GLuint *)samplers
4825    );
4826
4827exit:
4828    if (_array) {
4829        _env->ReleaseIntArrayElements(_array, (jint*)samplers, JNI_ABORT);
4830    }
4831    if (_exception) {
4832        jniThrowException(_env, _exceptionType, _exceptionMessage);
4833    }
4834}
4835
4836/* GLboolean glIsSampler ( GLuint sampler ) */
4837static jboolean
4838android_glIsSampler__I
4839  (JNIEnv *_env, jobject _this, jint sampler) {
4840    GLboolean _returnValue;
4841    _returnValue = glIsSampler(
4842        (GLuint)sampler
4843    );
4844    return (jboolean)_returnValue;
4845}
4846
4847/* void glBindSampler ( GLuint unit, GLuint sampler ) */
4848static void
4849android_glBindSampler__II
4850  (JNIEnv *_env, jobject _this, jint unit, jint sampler) {
4851    glBindSampler(
4852        (GLuint)unit,
4853        (GLuint)sampler
4854    );
4855}
4856
4857/* void glSamplerParameteri ( GLuint sampler, GLenum pname, GLint param ) */
4858static void
4859android_glSamplerParameteri__III
4860  (JNIEnv *_env, jobject _this, jint sampler, jint pname, jint param) {
4861    glSamplerParameteri(
4862        (GLuint)sampler,
4863        (GLenum)pname,
4864        (GLint)param
4865    );
4866}
4867
4868/* void glSamplerParameteriv ( GLuint sampler, GLenum pname, const GLint *param ) */
4869static void
4870android_glSamplerParameteriv__II_3II
4871  (JNIEnv *_env, jobject _this, jint sampler, jint pname, jintArray param_ref, jint offset) {
4872    jint _exception = 0;
4873    const char * _exceptionType =