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