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