OSDN Git Service

Don't crash when primary volume is null in AppCollector.
[android-x86/frameworks-base.git] / core / jni / android_opengl_GLES31.cpp
1 /*
2  * Copyright 2014 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 // This source file is automatically generated
18
19 #pragma GCC diagnostic ignored "-Wunused-variable"
20 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
21 #pragma GCC diagnostic ignored "-Wunused-function"
22
23 #include <stdint.h>
24 #include <GLES3/gl31.h>
25 #include <jni.h>
26 #include <JNIHelp.h>
27 #include <android_runtime/AndroidRuntime.h>
28 #include <utils/misc.h>
29 #include <assert.h>
30
31 static int initialized = 0;
32
33 static jclass nioAccessClass;
34 static jclass bufferClass;
35 static jmethodID getBasePointerID;
36 static jmethodID getBaseArrayID;
37 static jmethodID getBaseArrayOffsetID;
38 static jfieldID positionID;
39 static jfieldID limitID;
40 static jfieldID elementSizeShiftID;
41
42
43 /* special calls implemented in Android's GLES wrapper used to more
44  * efficiently bound-check passed arrays */
45 extern "C" {
46 #ifdef GL_VERSION_ES_CM_1_1
47 GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
48         const GLvoid *ptr, GLsizei count);
49 GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
50         const GLvoid *pointer, GLsizei count);
51 GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
52         GLsizei stride, const GLvoid *pointer, GLsizei count);
53 GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
54         GLsizei stride, const GLvoid *pointer, GLsizei count);
55 GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
56         GLsizei stride, const GLvoid *pointer, GLsizei count);
57 GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
58         GLsizei stride, const GLvoid *pointer, GLsizei count);
59 GL_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
63 static 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
69 static 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
78 static void
79 nativeClassInit(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
100 static void *
101 getPointer(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
127 class ByteArrayGetter {
128 public:
129     static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
130         return _env->GetByteArrayElements(array, is_copy);
131     }
132 };
133 class BooleanArrayGetter {
134 public:
135     static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
136         return _env->GetBooleanArrayElements(array, is_copy);
137     }
138 };
139 class CharArrayGetter {
140 public:
141     static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
142         return _env->GetCharArrayElements(array, is_copy);
143     }
144 };
145 class ShortArrayGetter {
146 public:
147     static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
148         return _env->GetShortArrayElements(array, is_copy);
149     }
150 };
151 class IntArrayGetter {
152 public:
153     static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
154         return _env->GetIntArrayElements(array, is_copy);
155     }
156 };
157 class LongArrayGetter {
158 public:
159     static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
160         return _env->GetLongArrayElements(array, is_copy);
161     }
162 };
163 class FloatArrayGetter {
164 public:
165     static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
166         return _env->GetFloatArrayElements(array, is_copy);
167     }
168 };
169 class DoubleArrayGetter {
170 public:
171     static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
172         return _env->GetDoubleArrayElements(array, is_copy);
173     }
174 };
175
176 template<typename JTYPEARRAY, typename ARRAYGETTER>
177 static void*
178 getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
179     return ARRAYGETTER::Get(_env, array, is_copy);
180 }
181
182 class ByteArrayReleaser {
183 public:
184     static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
185         _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
186     }
187 };
188 class BooleanArrayReleaser {
189 public:
190     static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
191         _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
192     }
193 };
194 class CharArrayReleaser {
195 public:
196     static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
197         _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
198     }
199 };
200 class ShortArrayReleaser {
201 public:
202     static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
203         _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
204     }
205 };
206 class IntArrayReleaser {
207 public:
208     static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
209         _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
210     }
211 };
212 class LongArrayReleaser {
213 public:
214     static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
215         _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
216     }
217 };
218 class FloatArrayReleaser {
219 public:
220     static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
221         _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
222     }
223 };
224 class DoubleArrayReleaser {
225 public:
226     static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
227         _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
228     }
229 };
230
231 template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
232 static void
233 releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
234     ARRAYRELEASER::Release(_env, array, data, commit);
235 }
236
237 static void
238 releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
239 {
240     _env->ReleasePrimitiveArrayCritical(array, data,
241                        commit ? 0 : JNI_ABORT);
242 }
243
244 static void *
245 getDirectBufferPointer(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  */
271 static int getNeededCount(GLint pname) {
272     int needed = 1;
273 #ifdef GL_ES_VERSION_2_0
274     // GLES 2.x pnames
275     switch (pname) {
276         case GL_ALIASED_LINE_WIDTH_RANGE:
277         case GL_ALIASED_POINT_SIZE_RANGE:
278             needed = 2;
279             break;
280
281         case GL_BLEND_COLOR:
282         case GL_COLOR_CLEAR_VALUE:
283         case GL_COLOR_WRITEMASK:
284         case GL_SCISSOR_BOX:
285         case GL_VIEWPORT:
286             needed = 4;
287             break;
288
289         case GL_COMPRESSED_TEXTURE_FORMATS:
290             glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
291             break;
292
293         case GL_SHADER_BINARY_FORMATS:
294             glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed);
295             break;
296     }
297 #endif
298
299 #ifdef GL_VERSION_ES_CM_1_1
300     // GLES 1.x pnames
301     switch (pname) {
302         case GL_ALIASED_LINE_WIDTH_RANGE:
303         case GL_ALIASED_POINT_SIZE_RANGE:
304         case GL_DEPTH_RANGE:
305         case GL_SMOOTH_LINE_WIDTH_RANGE:
306         case GL_SMOOTH_POINT_SIZE_RANGE:
307             needed = 2;
308             break;
309
310         case GL_CURRENT_NORMAL:
311         case GL_POINT_DISTANCE_ATTENUATION:
312             needed = 3;
313             break;
314
315         case GL_COLOR_CLEAR_VALUE:
316         case GL_COLOR_WRITEMASK:
317         case GL_CURRENT_COLOR:
318         case GL_CURRENT_TEXTURE_COORDS:
319         case GL_FOG_COLOR:
320         case GL_LIGHT_MODEL_AMBIENT:
321         case GL_SCISSOR_BOX:
322         case GL_VIEWPORT:
323             needed = 4;
324             break;
325
326         case GL_MODELVIEW_MATRIX:
327         case GL_PROJECTION_MATRIX:
328         case GL_TEXTURE_MATRIX:
329             needed = 16;
330             break;
331
332         case GL_COMPRESSED_TEXTURE_FORMATS:
333             glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
334             break;
335     }
336 #endif
337     return needed;
338 }
339
340 template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
341           typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
342 static void
343 get
344   (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
345     jint _exception = 0;
346     const char * _exceptionType;
347     const char * _exceptionMessage;
348     CTYPE *params_base = (CTYPE *) 0;
349     jint _remaining;
350     CTYPE *params = (CTYPE *) 0;
351     int _needed = 0;
352
353     if (!params_ref) {
354         _exception = 1;
355         _exceptionType = "java/lang/IllegalArgumentException";
356         _exceptionMessage = "params == null";
357         goto exit;
358     }
359     if (offset < 0) {
360         _exception = 1;
361         _exceptionType = "java/lang/IllegalArgumentException";
362         _exceptionMessage = "offset < 0";
363         goto exit;
364     }
365     _remaining = _env->GetArrayLength(params_ref) - offset;
366     _needed = getNeededCount(pname);
367     // if we didn't find this pname, we just assume the user passed
368     // an array of the right size -- this might happen with extensions
369     // or if we forget an enum here.
370     if (_remaining < _needed) {
371         _exception = 1;
372         _exceptionType = "java/lang/IllegalArgumentException";
373         _exceptionMessage = "length - offset < needed";
374         goto exit;
375     }
376     params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
377         _env, params_ref, (jboolean *)0);
378     params = params_base + offset;
379
380     GET(
381         (GLenum)pname,
382         (CTYPE *)params
383     );
384
385 exit:
386     if (params_base) {
387         releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
388             _env, params_ref, params_base, !_exception);
389     }
390     if (_exception) {
391         jniThrowException(_env, _exceptionType, _exceptionMessage);
392     }
393 }
394
395
396 template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
397           typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
398 static void
399 getarray
400   (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
401     jint _exception = 0;
402     const char * _exceptionType;
403     const char * _exceptionMessage;
404     JTYPEARRAY _array = (JTYPEARRAY) 0;
405     jint _bufferOffset = (jint) 0;
406     jint _remaining;
407     CTYPE *params = (CTYPE *) 0;
408     int _needed = 0;
409
410     params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
411     _remaining /= sizeof(CTYPE);    // convert from bytes to item count
412     _needed = getNeededCount(pname);
413     // if we didn't find this pname, we just assume the user passed
414     // an array of the right size -- this might happen with extensions
415     // or if we forget an enum here.
416     if (_needed>0 && _remaining < _needed) {
417         _exception = 1;
418         _exceptionType = "java/lang/IllegalArgumentException";
419         _exceptionMessage = "remaining() < needed";
420         goto exit;
421     }
422     if (params == NULL) {
423         char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
424             _env, _array, (jboolean *) 0);
425         params = (CTYPE *) (_paramsBase + _bufferOffset);
426     }
427     GET(
428         (GLenum)pname,
429         (CTYPE *)params
430     );
431
432 exit:
433     if (_array) {
434         releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
435             _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
436     }
437     if (_exception) {
438         jniThrowException(_env, _exceptionType, _exceptionMessage);
439     }
440 }
441
442 // --------------------------------------------------------------------------
443 /* void glDispatchCompute ( GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z ) */
444 static void
445 android_glDispatchCompute__III
446   (JNIEnv *_env, jobject _this, jint num_groups_x, jint num_groups_y, jint num_groups_z) {
447     glDispatchCompute(
448         (GLuint)num_groups_x,
449         (GLuint)num_groups_y,
450         (GLuint)num_groups_z
451     );
452 }
453
454 /* void glDispatchComputeIndirect ( GLintptr indirect ) */
455 static void android_glDispatchComputeIndirect(JNIEnv *_env, jobject, jlong indirect) {
456     // 'indirect' is a byte offset, not a pointer. GL checks for negative and too-large values.
457     // Here we only need to check for successful 64-bit to 32-bit conversion.
458     // - jlong is a int64_t (jni.h)
459     // - GLintptr is a long (khrplatform.h)
460     if (sizeof(GLintptr) != sizeof(jlong) && (indirect < LONG_MIN || indirect > LONG_MAX)) {
461         jniThrowException(_env, "java/lang/IllegalArgumentException", "indirect offset too large");
462         return;
463     }
464     glDispatchComputeIndirect((GLintptr)indirect);
465 }
466
467 /* void glDrawArraysIndirect ( GLenum mode, const void *indirect ) */
468 static void android_glDrawArraysIndirect(JNIEnv *_env, jobject, int mode, jlong indirect) {
469     // In OpenGL ES, 'indirect' is a byte offset into a buffer, not a raw pointer.
470     // GL checks for too-large values. Here we only need to check for successful signed 64-bit
471     // to unsigned 32-bit conversion.
472     if (sizeof(void*) != sizeof(jlong) && indirect > static_cast<jlong>(UINT32_MAX)) {
473         jniThrowException(_env, "java/lang/IllegalArgumentException", "indirect offset too large");
474         return;
475     }
476     glDrawArraysIndirect(mode, (const void*)indirect);
477 }
478
479 /* void glDrawElementsIndirect ( GLenum mode, GLenum type, const void *indirect ) */
480 static void android_glDrawElementsIndirect(JNIEnv *_env, jobject, jint mode, jint type, jlong indirect) {
481     // In OpenGL ES, 'indirect' is a byte offset into a buffer, not a raw pointer.
482     // GL checks for too-large values. Here we only need to check for successful signed 64-bit
483     // to unsigned 32-bit conversion.
484     if (sizeof(void*) != sizeof(jlong) && indirect > static_cast<jlong>(UINT32_MAX)) {
485         jniThrowException(_env, "java/lang/IllegalArgumentException", "indirect offset too large");
486         return;
487     }
488     glDrawElementsIndirect(mode, type, (const void*)indirect);
489 }
490
491 /* void glFramebufferParameteri ( GLenum target, GLenum pname, GLint param ) */
492 static void
493 android_glFramebufferParameteri__III
494   (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
495     glFramebufferParameteri(
496         (GLenum)target,
497         (GLenum)pname,
498         (GLint)param
499     );
500 }
501
502 /* void glGetFramebufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
503 static void
504 android_glGetFramebufferParameteriv__II_3II
505   (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
506     jint _exception = 0;
507     const char * _exceptionType = NULL;
508     const char * _exceptionMessage = NULL;
509     GLint *params_base = (GLint *) 0;
510     jint _remaining;
511     GLint *params = (GLint *) 0;
512
513     if (!params_ref) {
514         _exception = 1;
515         _exceptionType = "java/lang/IllegalArgumentException";
516         _exceptionMessage = "params == null";
517         goto exit;
518     }
519     if (offset < 0) {
520         _exception = 1;
521         _exceptionType = "java/lang/IllegalArgumentException";
522         _exceptionMessage = "offset < 0";
523         goto exit;
524     }
525     _remaining = _env->GetArrayLength(params_ref) - offset;
526     params_base = (GLint *)
527         _env->GetIntArrayElements(params_ref, (jboolean *)0);
528     params = params_base + offset;
529
530     glGetFramebufferParameteriv(
531         (GLenum)target,
532         (GLenum)pname,
533         (GLint *)params
534     );
535
536 exit:
537     if (params_base) {
538         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
539             _exception ? JNI_ABORT: 0);
540     }
541     if (_exception) {
542         jniThrowException(_env, _exceptionType, _exceptionMessage);
543     }
544 }
545
546 /* void glGetFramebufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
547 static void
548 android_glGetFramebufferParameteriv__IILjava_nio_IntBuffer_2
549   (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
550     jintArray _array = (jintArray) 0;
551     jint _bufferOffset = (jint) 0;
552     jint _remaining;
553     GLint *params = (GLint *) 0;
554
555     params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
556     if (params == NULL) {
557         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
558         params = (GLint *) (_paramsBase + _bufferOffset);
559     }
560     glGetFramebufferParameteriv(
561         (GLenum)target,
562         (GLenum)pname,
563         (GLint *)params
564     );
565     if (_array) {
566         _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
567     }
568 }
569
570 /* void glGetProgramInterfaceiv ( GLuint program, GLenum programInterface, GLenum pname, GLint *params ) */
571 static void
572 android_glGetProgramInterfaceiv__III_3II
573   (JNIEnv *_env, jobject _this, jint program, jint programInterface, jint pname, jintArray params_ref, jint offset) {
574     jint _exception = 0;
575     const char * _exceptionType = NULL;
576     const char * _exceptionMessage = NULL;
577     GLint *params_base = (GLint *) 0;
578     jint _remaining;
579     GLint *params = (GLint *) 0;
580
581     if (!params_ref) {
582         _exception = 1;
583         _exceptionType = "java/lang/IllegalArgumentException";
584         _exceptionMessage = "params == null";
585         goto exit;
586     }
587     if (offset < 0) {
588         _exception = 1;
589         _exceptionType = "java/lang/IllegalArgumentException";
590         _exceptionMessage = "offset < 0";
591         goto exit;
592     }
593     _remaining = _env->GetArrayLength(params_ref) - offset;
594     params_base = (GLint *)
595         _env->GetIntArrayElements(params_ref, (jboolean *)0);
596     params = params_base + offset;
597
598     glGetProgramInterfaceiv(
599         (GLuint)program,
600         (GLenum)programInterface,
601         (GLenum)pname,
602         (GLint *)params
603     );
604
605 exit:
606     if (params_base) {
607         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
608             _exception ? JNI_ABORT: 0);
609     }
610     if (_exception) {
611         jniThrowException(_env, _exceptionType, _exceptionMessage);
612     }
613 }
614
615 /* void glGetProgramInterfaceiv ( GLuint program, GLenum programInterface, GLenum pname, GLint *params ) */
616 static void
617 android_glGetProgramInterfaceiv__IIILjava_nio_IntBuffer_2
618   (JNIEnv *_env, jobject _this, jint program, jint programInterface, jint pname, jobject params_buf) {
619     jintArray _array = (jintArray) 0;
620     jint _bufferOffset = (jint) 0;
621     jint _remaining;
622     GLint *params = (GLint *) 0;
623
624     params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
625     if (params == NULL) {
626         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
627         params = (GLint *) (_paramsBase + _bufferOffset);
628     }
629     glGetProgramInterfaceiv(
630         (GLuint)program,
631         (GLenum)programInterface,
632         (GLenum)pname,
633         (GLint *)params
634     );
635     if (_array) {
636         _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
637     }
638 }
639
640 /* GLuint glGetProgramResourceIndex ( GLuint program, GLenum programInterface, const GLchar *name ) */
641 static jint
642 android_glGetProgramResourceIndex__IILjava_lang_String_2
643   (JNIEnv *_env, jobject _this, jint program, jint programInterface, jstring name) {
644     jint _exception = 0;
645     const char * _exceptionType = NULL;
646     const char * _exceptionMessage = NULL;
647     GLuint _returnValue = 0;
648     const char* _nativename = 0;
649
650     if (!name) {
651         _exception = 1;
652         _exceptionType = "java/lang/IllegalArgumentException";
653         _exceptionMessage = "name == null";
654         goto exit;
655     }
656     _nativename = _env->GetStringUTFChars(name, 0);
657
658     _returnValue = glGetProgramResourceIndex(
659         (GLuint)program,
660         (GLenum)programInterface,
661         (GLchar *)_nativename
662     );
663
664 exit:
665     if (_nativename) {
666         _env->ReleaseStringUTFChars(name, _nativename);
667     }
668
669     if (_exception) {
670         jniThrowException(_env, _exceptionType, _exceptionMessage);
671     }
672     return (jint)_returnValue;
673 }
674
675 /* void glGetProgramResourceName ( GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name ) */
676 static jstring
677 android_glGetProgramResourceName
678   (JNIEnv *_env, jobject _this, jint program, jint programInterface, jint index) {
679     jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
680     return NULL;
681 }
682
683 /* void glGetProgramResourceiv ( GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params ) */
684 static void
685 android_glGetProgramResourceiv__IIII_3III_3II_3II
686   (JNIEnv *_env, jobject _this, jint program, jint programInterface, jint index, jint propCount, jintArray props_ref, jint propsOffset, jint bufSize, jintArray length_ref, jint lengthOffset, jintArray params_ref, jint paramsOffset) {
687     jint _exception = 0;
688     const char * _exceptionType = NULL;
689     const char * _exceptionMessage = NULL;
690     GLenum *props_base = (GLenum *) 0;
691     jint _propsRemaining;
692     GLenum *props = (GLenum *) 0;
693     GLsizei *length_base = (GLsizei *) 0;
694     jint _lengthRemaining;
695     GLsizei *length = (GLsizei *) 0;
696     GLint *params_base = (GLint *) 0;
697     jint _paramsRemaining;
698     GLint *params = (GLint *) 0;
699
700     if (!props_ref) {
701         _exception = 1;
702         _exceptionType = "java/lang/IllegalArgumentException";
703         _exceptionMessage = "props == null";
704         goto exit;
705     }
706     if (propsOffset < 0) {
707         _exception = 1;
708         _exceptionType = "java/lang/IllegalArgumentException";
709         _exceptionMessage = "propsOffset < 0";
710         goto exit;
711     }
712     _propsRemaining = _env->GetArrayLength(props_ref) - propsOffset;
713     props_base = (GLenum *)
714         _env->GetIntArrayElements(props_ref, (jboolean *)0);
715     props = props_base + propsOffset;
716
717     if (length_ref) {
718         if (lengthOffset < 0) {
719             _exception = 1;
720             _exceptionType = "java/lang/IllegalArgumentException";
721             _exceptionMessage = "lengthOffset < 0";
722             goto exit;
723         }
724         _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
725         length_base = (GLsizei *)
726             _env->GetIntArrayElements(length_ref, (jboolean *)0);
727         length = length_base + lengthOffset;
728     }
729
730     if (!params_ref) {
731         _exception = 1;
732         _exceptionType = "java/lang/IllegalArgumentException";
733         _exceptionMessage = "params == null";
734         goto exit;
735     }
736     if (paramsOffset < 0) {
737         _exception = 1;
738         _exceptionType = "java/lang/IllegalArgumentException";
739         _exceptionMessage = "paramsOffset < 0";
740         goto exit;
741     }
742     _paramsRemaining = _env->GetArrayLength(params_ref) - paramsOffset;
743     params_base = (GLint *)
744         _env->GetIntArrayElements(params_ref, (jboolean *)0);
745     params = params_base + paramsOffset;
746
747     glGetProgramResourceiv(
748         (GLuint)program,
749         (GLenum)programInterface,
750         (GLuint)index,
751         (GLsizei)propCount,
752         (GLenum *)props,
753         (GLsizei)bufSize,
754         (GLsizei *)length,
755         (GLint *)params
756     );
757
758 exit:
759     if (params_base) {
760         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
761             _exception ? JNI_ABORT: 0);
762     }
763     if (length_base) {
764         _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
765             _exception ? JNI_ABORT: 0);
766     }
767     if (props_base) {
768         _env->ReleaseIntArrayElements(props_ref, (jint*)props_base,
769             JNI_ABORT);
770     }
771     if (_exception) {
772         jniThrowException(_env, _exceptionType, _exceptionMessage);
773     }
774 }
775
776 /* void glGetProgramResourceiv ( GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params ) */
777 static void
778 android_glGetProgramResourceiv__IIIILjava_nio_IntBuffer_2ILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
779   (JNIEnv *_env, jobject _this, jint program, jint programInterface, jint index, jint propCount, jobject props_buf, jint bufSize, jobject length_buf, jobject params_buf) {
780     jintArray _propsArray = (jintArray) 0;
781     jint _propsBufferOffset = (jint) 0;
782     jintArray _lengthArray = (jintArray) 0;
783     jint _lengthBufferOffset = (jint) 0;
784     jintArray _paramsArray = (jintArray) 0;
785     jint _paramsBufferOffset = (jint) 0;
786     jint _propsRemaining;
787     GLenum *props = (GLenum *) 0;
788     jint _lengthRemaining;
789     GLsizei *length = (GLsizei *) 0;
790     jint _paramsRemaining;
791     GLint *params = (GLint *) 0;
792
793     props = (GLenum *)getPointer(_env, props_buf, (jarray*)&_propsArray, &_propsRemaining, &_propsBufferOffset);
794     if (length_buf) {
795         length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
796     }
797     params = (GLint *)getPointer(_env, params_buf, (jarray*)&_paramsArray, &_paramsRemaining, &_paramsBufferOffset);
798     if (props == NULL) {
799         char * _propsBase = (char *)_env->GetIntArrayElements(_propsArray, (jboolean *) 0);
800         props = (GLenum *) (_propsBase + _propsBufferOffset);
801     }
802     if (length_buf && length == NULL) {
803         char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
804         length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
805     }
806     if (params == NULL) {
807         char * _paramsBase = (char *)_env->GetIntArrayElements(_paramsArray, (jboolean *) 0);
808         params = (GLint *) (_paramsBase + _paramsBufferOffset);
809     }
810     glGetProgramResourceiv(
811         (GLuint)program,
812         (GLenum)programInterface,
813         (GLuint)index,
814         (GLsizei)propCount,
815         (GLenum *)props,
816         (GLsizei)bufSize,
817         (GLsizei *)length,
818         (GLint *)params
819     );
820     if (_paramsArray) {
821         _env->ReleaseIntArrayElements(_paramsArray, (jint*)params, 0);
822     }
823     if (_lengthArray) {
824         _env->ReleaseIntArrayElements(_lengthArray, (jint*)length, 0);
825     }
826     if (_propsArray) {
827         _env->ReleaseIntArrayElements(_propsArray, (jint*)props, JNI_ABORT);
828     }
829 }
830
831 /* GLint glGetProgramResourceLocation ( GLuint program, GLenum programInterface, const GLchar *name ) */
832 static jint
833 android_glGetProgramResourceLocation__IILjava_lang_String_2
834   (JNIEnv *_env, jobject _this, jint program, jint programInterface, jstring name) {
835     jint _exception = 0;
836     const char * _exceptionType = NULL;
837     const char * _exceptionMessage = NULL;
838     GLint _returnValue = 0;
839     const char* _nativename = 0;
840
841     if (!name) {
842         _exception = 1;
843         _exceptionType = "java/lang/IllegalArgumentException";
844         _exceptionMessage = "name == null";
845         goto exit;
846     }
847     _nativename = _env->GetStringUTFChars(name, 0);
848
849     _returnValue = glGetProgramResourceLocation(
850         (GLuint)program,
851         (GLenum)programInterface,
852         (GLchar *)_nativename
853     );
854
855 exit:
856     if (_nativename) {
857         _env->ReleaseStringUTFChars(name, _nativename);
858     }
859
860     if (_exception) {
861         jniThrowException(_env, _exceptionType, _exceptionMessage);
862     }
863     return (jint)_returnValue;
864 }
865
866 /* void glUseProgramStages ( GLuint pipeline, GLbitfield stages, GLuint program ) */
867 static void
868 android_glUseProgramStages__III
869   (JNIEnv *_env, jobject _this, jint pipeline, jint stages, jint program) {
870     glUseProgramStages(
871         (GLuint)pipeline,
872         (GLbitfield)stages,
873         (GLuint)program
874     );
875 }
876
877 /* void glActiveShaderProgram ( GLuint pipeline, GLuint program ) */
878 static void
879 android_glActiveShaderProgram__II
880   (JNIEnv *_env, jobject _this, jint pipeline, jint program) {
881     glActiveShaderProgram(
882         (GLuint)pipeline,
883         (GLuint)program
884     );
885 }
886
887 /* GLuint glCreateShaderProgramv ( GLenum type, GLsizei count, const GLchar *const *strings ) */
888 static jint
889 android_glCreateShaderProgramv
890   (JNIEnv *_env, jobject _this, jint type, jobjectArray strings) {
891     jint _exception = 0;
892     const char * _exceptionType = NULL;
893     const char * _exceptionMessage = NULL;
894     GLsizei _count;
895     const GLchar** _strings = NULL;
896     jstring* _jstrings = NULL;
897     GLuint _returnValue = 0;
898
899     if (!strings) {
900         _exception = 1;
901         _exceptionType = "java/lang/IllegalArgumentException";
902         _exceptionMessage = "strings == null";
903         goto exit;
904     }
905
906     _count = _env->GetArrayLength(strings);
907
908     _strings = (const GLchar**) calloc(_count, sizeof(const GLchar*));
909     if (!_strings) {
910         _exception = 1;
911         _exceptionType = "java/lang/OutOfMemoryError";
912         _exceptionMessage = "out of memory";
913         goto exit;
914     }
915
916     _jstrings = (jstring*) calloc(_count, sizeof(jstring));
917     if (!_jstrings) {
918         _exception = 1;
919         _exceptionType = "java/lang/OutOfMemoryError";
920         _exceptionMessage = "out of memory";
921         goto exit;
922     }
923
924     for(int i = 0; i < _count; i++) {
925         _jstrings[i] = (jstring) _env->GetObjectArrayElement(strings, i);
926         if (!_jstrings[i]) {
927             _exception = 1;
928             _exceptionType = "java/lang/IllegalArgumentException";
929             _exceptionMessage = "strings == null";
930             goto exit;
931         }
932         _strings[i] = _env->GetStringUTFChars(_jstrings[i], 0);
933     }
934
935     _returnValue = glCreateShaderProgramv((GLenum)type, _count, _strings);
936 exit:
937     if (_strings && _jstrings) {
938         for(int i = 0; i < _count; i++) {
939             if (_strings[i] && _jstrings[i]) {
940                 _env->ReleaseStringUTFChars(_jstrings[i], _strings[i]);
941             }
942         }
943     }
944     if (_strings) {
945         free(_strings);
946     }
947     if (_jstrings) {
948         free(_jstrings);
949     }
950     if (_exception) {
951         jniThrowException(_env, _exceptionType, _exceptionMessage);
952     }
953     return (jint)_returnValue;
954 }
955 /* void glBindProgramPipeline ( GLuint pipeline ) */
956 static void
957 android_glBindProgramPipeline__I
958   (JNIEnv *_env, jobject _this, jint pipeline) {
959     glBindProgramPipeline(
960         (GLuint)pipeline
961     );
962 }
963
964 /* void glDeleteProgramPipelines ( GLsizei n, const GLuint *pipelines ) */
965 static void
966 android_glDeleteProgramPipelines__I_3II
967   (JNIEnv *_env, jobject _this, jint n, jintArray pipelines_ref, jint offset) {
968     jint _exception = 0;
969     const char * _exceptionType = NULL;
970     const char * _exceptionMessage = NULL;
971     GLuint *pipelines_base = (GLuint *) 0;
972     jint _remaining;
973     GLuint *pipelines = (GLuint *) 0;
974
975     if (!pipelines_ref) {
976         _exception = 1;
977         _exceptionType = "java/lang/IllegalArgumentException";
978         _exceptionMessage = "pipelines == null";
979         goto exit;
980     }
981     if (offset < 0) {
982         _exception = 1;
983         _exceptionType = "java/lang/IllegalArgumentException";
984         _exceptionMessage = "offset < 0";
985         goto exit;
986     }
987     _remaining = _env->GetArrayLength(pipelines_ref) - offset;
988     pipelines_base = (GLuint *)
989         _env->GetIntArrayElements(pipelines_ref, (jboolean *)0);
990     pipelines = pipelines_base + offset;
991
992     glDeleteProgramPipelines(
993         (GLsizei)n,
994         (GLuint *)pipelines
995     );
996
997 exit:
998     if (pipelines_base) {
999         _env->ReleaseIntArrayElements(pipelines_ref, (jint*)pipelines_base,
1000             JNI_ABORT);
1001     }
1002     if (_exception) {
1003         jniThrowException(_env, _exceptionType, _exceptionMessage);
1004     }
1005 }
1006
1007 /* void glDeleteProgramPipelines ( GLsizei n, const GLuint *pipelines ) */
1008 static void
1009 android_glDeleteProgramPipelines__ILjava_nio_IntBuffer_2
1010   (JNIEnv *_env, jobject _this, jint n, jobject pipelines_buf) {
1011     jintArray _array = (jintArray) 0;
1012     jint _bufferOffset = (jint) 0;
1013     jint _remaining;
1014     GLuint *pipelines = (GLuint *) 0;
1015
1016     pipelines = (GLuint *)getPointer(_env, pipelines_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1017     if (pipelines == NULL) {
1018         char * _pipelinesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1019         pipelines = (GLuint *) (_pipelinesBase + _bufferOffset);
1020     }
1021     glDeleteProgramPipelines(
1022         (GLsizei)n,
1023         (GLuint *)pipelines
1024     );
1025     if (_array) {
1026         _env->ReleaseIntArrayElements(_array, (jint*)pipelines, JNI_ABORT);
1027     }
1028 }
1029
1030 /* void glGenProgramPipelines ( GLsizei n, GLuint *pipelines ) */
1031 static void
1032 android_glGenProgramPipelines__I_3II
1033   (JNIEnv *_env, jobject _this, jint n, jintArray pipelines_ref, jint offset) {
1034     jint _exception = 0;
1035     const char * _exceptionType = NULL;
1036     const char * _exceptionMessage = NULL;
1037     GLuint *pipelines_base = (GLuint *) 0;
1038     jint _remaining;
1039     GLuint *pipelines = (GLuint *) 0;
1040
1041     if (!pipelines_ref) {
1042         _exception = 1;
1043         _exceptionType = "java/lang/IllegalArgumentException";
1044         _exceptionMessage = "pipelines == 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(pipelines_ref) - offset;
1054     pipelines_base = (GLuint *)
1055         _env->GetIntArrayElements(pipelines_ref, (jboolean *)0);
1056     pipelines = pipelines_base + offset;
1057
1058     glGenProgramPipelines(
1059         (GLsizei)n,
1060         (GLuint *)pipelines
1061     );
1062
1063 exit:
1064     if (pipelines_base) {
1065         _env->ReleaseIntArrayElements(pipelines_ref, (jint*)pipelines_base,
1066             _exception ? JNI_ABORT: 0);
1067     }
1068     if (_exception) {
1069         jniThrowException(_env, _exceptionType, _exceptionMessage);
1070     }
1071 }
1072
1073 /* void glGenProgramPipelines ( GLsizei n, GLuint *pipelines ) */
1074 static void
1075 android_glGenProgramPipelines__ILjava_nio_IntBuffer_2
1076   (JNIEnv *_env, jobject _this, jint n, jobject pipelines_buf) {
1077     jintArray _array = (jintArray) 0;
1078     jint _bufferOffset = (jint) 0;
1079     jint _remaining;
1080     GLuint *pipelines = (GLuint *) 0;
1081
1082     pipelines = (GLuint *)getPointer(_env, pipelines_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1083     if (pipelines == NULL) {
1084         char * _pipelinesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1085         pipelines = (GLuint *) (_pipelinesBase + _bufferOffset);
1086     }
1087     glGenProgramPipelines(
1088         (GLsizei)n,
1089         (GLuint *)pipelines
1090     );
1091     if (_array) {
1092         _env->ReleaseIntArrayElements(_array, (jint*)pipelines, 0);
1093     }
1094 }
1095
1096 /* GLboolean glIsProgramPipeline ( GLuint pipeline ) */
1097 static jboolean
1098 android_glIsProgramPipeline__I
1099   (JNIEnv *_env, jobject _this, jint pipeline) {
1100     GLboolean _returnValue;
1101     _returnValue = glIsProgramPipeline(
1102         (GLuint)pipeline
1103     );
1104     return (jboolean)_returnValue;
1105 }
1106
1107 /* void glGetProgramPipelineiv ( GLuint pipeline, GLenum pname, GLint *params ) */
1108 static void
1109 android_glGetProgramPipelineiv__II_3II
1110   (JNIEnv *_env, jobject _this, jint pipeline, jint pname, jintArray params_ref, jint offset) {
1111     jint _exception = 0;
1112     const char * _exceptionType = NULL;
1113     const char * _exceptionMessage = NULL;
1114     GLint *params_base = (GLint *) 0;
1115     jint _remaining;
1116     GLint *params = (GLint *) 0;
1117
1118     if (!params_ref) {
1119         _exception = 1;
1120         _exceptionType = "java/lang/IllegalArgumentException";
1121         _exceptionMessage = "params == null";
1122         goto exit;
1123     }
1124     if (offset < 0) {
1125         _exception = 1;
1126         _exceptionType = "java/lang/IllegalArgumentException";
1127         _exceptionMessage = "offset < 0";
1128         goto exit;
1129     }
1130     _remaining = _env->GetArrayLength(params_ref) - offset;
1131     params_base = (GLint *)
1132         _env->GetIntArrayElements(params_ref, (jboolean *)0);
1133     params = params_base + offset;
1134
1135     glGetProgramPipelineiv(
1136         (GLuint)pipeline,
1137         (GLenum)pname,
1138         (GLint *)params
1139     );
1140
1141 exit:
1142     if (params_base) {
1143         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
1144             _exception ? JNI_ABORT: 0);
1145     }
1146     if (_exception) {
1147         jniThrowException(_env, _exceptionType, _exceptionMessage);
1148     }
1149 }
1150
1151 /* void glGetProgramPipelineiv ( GLuint pipeline, GLenum pname, GLint *params ) */
1152 static void
1153 android_glGetProgramPipelineiv__IILjava_nio_IntBuffer_2
1154   (JNIEnv *_env, jobject _this, jint pipeline, jint pname, jobject params_buf) {
1155     jintArray _array = (jintArray) 0;
1156     jint _bufferOffset = (jint) 0;
1157     jint _remaining;
1158     GLint *params = (GLint *) 0;
1159
1160     params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1161     if (params == NULL) {
1162         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1163         params = (GLint *) (_paramsBase + _bufferOffset);
1164     }
1165     glGetProgramPipelineiv(
1166         (GLuint)pipeline,
1167         (GLenum)pname,
1168         (GLint *)params
1169     );
1170     if (_array) {
1171         _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
1172     }
1173 }
1174
1175 /* void glProgramUniform1i ( GLuint program, GLint location, GLint v0 ) */
1176 static void
1177 android_glProgramUniform1i__III
1178   (JNIEnv *_env, jobject _this, jint program, jint location, jint v0) {
1179     glProgramUniform1i(
1180         (GLuint)program,
1181         (GLint)location,
1182         (GLint)v0
1183     );
1184 }
1185
1186 /* void glProgramUniform2i ( GLuint program, GLint location, GLint v0, GLint v1 ) */
1187 static void
1188 android_glProgramUniform2i__IIII
1189   (JNIEnv *_env, jobject _this, jint program, jint location, jint v0, jint v1) {
1190     glProgramUniform2i(
1191         (GLuint)program,
1192         (GLint)location,
1193         (GLint)v0,
1194         (GLint)v1
1195     );
1196 }
1197
1198 /* void glProgramUniform3i ( GLuint program, GLint location, GLint v0, GLint v1, GLint v2 ) */
1199 static void
1200 android_glProgramUniform3i__IIIII
1201   (JNIEnv *_env, jobject _this, jint program, jint location, jint v0, jint v1, jint v2) {
1202     glProgramUniform3i(
1203         (GLuint)program,
1204         (GLint)location,
1205         (GLint)v0,
1206         (GLint)v1,
1207         (GLint)v2
1208     );
1209 }
1210
1211 /* void glProgramUniform4i ( GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3 ) */
1212 static void
1213 android_glProgramUniform4i__IIIIII
1214   (JNIEnv *_env, jobject _this, jint program, jint location, jint v0, jint v1, jint v2, jint v3) {
1215     glProgramUniform4i(
1216         (GLuint)program,
1217         (GLint)location,
1218         (GLint)v0,
1219         (GLint)v1,
1220         (GLint)v2,
1221         (GLint)v3
1222     );
1223 }
1224
1225 /* void glProgramUniform1ui ( GLuint program, GLint location, GLuint v0 ) */
1226 static void
1227 android_glProgramUniform1ui__III
1228   (JNIEnv *_env, jobject _this, jint program, jint location, jint v0) {
1229     glProgramUniform1ui(
1230         (GLuint)program,
1231         (GLint)location,
1232         (GLuint)v0
1233     );
1234 }
1235
1236 /* void glProgramUniform2ui ( GLuint program, GLint location, GLuint v0, GLuint v1 ) */
1237 static void
1238 android_glProgramUniform2ui__IIII
1239   (JNIEnv *_env, jobject _this, jint program, jint location, jint v0, jint v1) {
1240     glProgramUniform2ui(
1241         (GLuint)program,
1242         (GLint)location,
1243         (GLuint)v0,
1244         (GLuint)v1
1245     );
1246 }
1247
1248 /* void glProgramUniform3ui ( GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2 ) */
1249 static void
1250 android_glProgramUniform3ui__IIIII
1251   (JNIEnv *_env, jobject _this, jint program, jint location, jint v0, jint v1, jint v2) {
1252     glProgramUniform3ui(
1253         (GLuint)program,
1254         (GLint)location,
1255         (GLuint)v0,
1256         (GLuint)v1,
1257         (GLuint)v2
1258     );
1259 }
1260
1261 /* void glProgramUniform4ui ( GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3 ) */
1262 static void
1263 android_glProgramUniform4ui__IIIIII
1264   (JNIEnv *_env, jobject _this, jint program, jint location, jint v0, jint v1, jint v2, jint v3) {
1265     glProgramUniform4ui(
1266         (GLuint)program,
1267         (GLint)location,
1268         (GLuint)v0,
1269         (GLuint)v1,
1270         (GLuint)v2,
1271         (GLuint)v3
1272     );
1273 }
1274
1275 /* void glProgramUniform1f ( GLuint program, GLint location, GLfloat v0 ) */
1276 static void
1277 android_glProgramUniform1f__IIF
1278   (JNIEnv *_env, jobject _this, jint program, jint location, jfloat v0) {
1279     glProgramUniform1f(
1280         (GLuint)program,
1281         (GLint)location,
1282         (GLfloat)v0
1283     );
1284 }
1285
1286 /* void glProgramUniform2f ( GLuint program, GLint location, GLfloat v0, GLfloat v1 ) */
1287 static void
1288 android_glProgramUniform2f__IIFF
1289   (JNIEnv *_env, jobject _this, jint program, jint location, jfloat v0, jfloat v1) {
1290     glProgramUniform2f(
1291         (GLuint)program,
1292         (GLint)location,
1293         (GLfloat)v0,
1294         (GLfloat)v1
1295     );
1296 }
1297
1298 /* void glProgramUniform3f ( GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2 ) */
1299 static void
1300 android_glProgramUniform3f__IIFFF
1301   (JNIEnv *_env, jobject _this, jint program, jint location, jfloat v0, jfloat v1, jfloat v2) {
1302     glProgramUniform3f(
1303         (GLuint)program,
1304         (GLint)location,
1305         (GLfloat)v0,
1306         (GLfloat)v1,
1307         (GLfloat)v2
1308     );
1309 }
1310
1311 /* void glProgramUniform4f ( GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3 ) */
1312 static void
1313 android_glProgramUniform4f__IIFFFF
1314   (JNIEnv *_env, jobject _this, jint program, jint location, jfloat v0, jfloat v1, jfloat v2, jfloat v3) {
1315     glProgramUniform4f(
1316         (GLuint)program,
1317         (GLint)location,
1318         (GLfloat)v0,
1319         (GLfloat)v1,
1320         (GLfloat)v2,
1321         (GLfloat)v3
1322     );
1323 }
1324
1325 /* void glProgramUniform1iv ( GLuint program, GLint location, GLsizei count, const GLint *value ) */
1326 static void
1327 android_glProgramUniform1iv__III_3II
1328   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jintArray value_ref, jint offset) {
1329     jint _exception = 0;
1330     const char * _exceptionType = NULL;
1331     const char * _exceptionMessage = NULL;
1332     GLint *value_base = (GLint *) 0;
1333     jint _remaining;
1334     GLint *value = (GLint *) 0;
1335
1336     if (!value_ref) {
1337         _exception = 1;
1338         _exceptionType = "java/lang/IllegalArgumentException";
1339         _exceptionMessage = "value == null";
1340         goto exit;
1341     }
1342     if (offset < 0) {
1343         _exception = 1;
1344         _exceptionType = "java/lang/IllegalArgumentException";
1345         _exceptionMessage = "offset < 0";
1346         goto exit;
1347     }
1348     _remaining = _env->GetArrayLength(value_ref) - offset;
1349     value_base = (GLint *)
1350         _env->GetIntArrayElements(value_ref, (jboolean *)0);
1351     value = value_base + offset;
1352
1353     glProgramUniform1iv(
1354         (GLuint)program,
1355         (GLint)location,
1356         (GLsizei)count,
1357         (GLint *)value
1358     );
1359
1360 exit:
1361     if (value_base) {
1362         _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
1363             JNI_ABORT);
1364     }
1365     if (_exception) {
1366         jniThrowException(_env, _exceptionType, _exceptionMessage);
1367     }
1368 }
1369
1370 /* void glProgramUniform1iv ( GLuint program, GLint location, GLsizei count, const GLint *value ) */
1371 static void
1372 android_glProgramUniform1iv__IIILjava_nio_IntBuffer_2
1373   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
1374     jintArray _array = (jintArray) 0;
1375     jint _bufferOffset = (jint) 0;
1376     jint _remaining;
1377     GLint *value = (GLint *) 0;
1378
1379     value = (GLint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1380     if (value == NULL) {
1381         char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1382         value = (GLint *) (_valueBase + _bufferOffset);
1383     }
1384     glProgramUniform1iv(
1385         (GLuint)program,
1386         (GLint)location,
1387         (GLsizei)count,
1388         (GLint *)value
1389     );
1390     if (_array) {
1391         _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
1392     }
1393 }
1394
1395 /* void glProgramUniform2iv ( GLuint program, GLint location, GLsizei count, const GLint *value ) */
1396 static void
1397 android_glProgramUniform2iv__III_3II
1398   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jintArray value_ref, jint offset) {
1399     jint _exception = 0;
1400     const char * _exceptionType = NULL;
1401     const char * _exceptionMessage = NULL;
1402     GLint *value_base = (GLint *) 0;
1403     jint _remaining;
1404     GLint *value = (GLint *) 0;
1405
1406     if (!value_ref) {
1407         _exception = 1;
1408         _exceptionType = "java/lang/IllegalArgumentException";
1409         _exceptionMessage = "value == null";
1410         goto exit;
1411     }
1412     if (offset < 0) {
1413         _exception = 1;
1414         _exceptionType = "java/lang/IllegalArgumentException";
1415         _exceptionMessage = "offset < 0";
1416         goto exit;
1417     }
1418     _remaining = _env->GetArrayLength(value_ref) - offset;
1419     value_base = (GLint *)
1420         _env->GetIntArrayElements(value_ref, (jboolean *)0);
1421     value = value_base + offset;
1422
1423     glProgramUniform2iv(
1424         (GLuint)program,
1425         (GLint)location,
1426         (GLsizei)count,
1427         (GLint *)value
1428     );
1429
1430 exit:
1431     if (value_base) {
1432         _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
1433             JNI_ABORT);
1434     }
1435     if (_exception) {
1436         jniThrowException(_env, _exceptionType, _exceptionMessage);
1437     }
1438 }
1439
1440 /* void glProgramUniform2iv ( GLuint program, GLint location, GLsizei count, const GLint *value ) */
1441 static void
1442 android_glProgramUniform2iv__IIILjava_nio_IntBuffer_2
1443   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
1444     jintArray _array = (jintArray) 0;
1445     jint _bufferOffset = (jint) 0;
1446     jint _remaining;
1447     GLint *value = (GLint *) 0;
1448
1449     value = (GLint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1450     if (value == NULL) {
1451         char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1452         value = (GLint *) (_valueBase + _bufferOffset);
1453     }
1454     glProgramUniform2iv(
1455         (GLuint)program,
1456         (GLint)location,
1457         (GLsizei)count,
1458         (GLint *)value
1459     );
1460     if (_array) {
1461         _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
1462     }
1463 }
1464
1465 /* void glProgramUniform3iv ( GLuint program, GLint location, GLsizei count, const GLint *value ) */
1466 static void
1467 android_glProgramUniform3iv__III_3II
1468   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jintArray value_ref, jint offset) {
1469     jint _exception = 0;
1470     const char * _exceptionType = NULL;
1471     const char * _exceptionMessage = NULL;
1472     GLint *value_base = (GLint *) 0;
1473     jint _remaining;
1474     GLint *value = (GLint *) 0;
1475
1476     if (!value_ref) {
1477         _exception = 1;
1478         _exceptionType = "java/lang/IllegalArgumentException";
1479         _exceptionMessage = "value == null";
1480         goto exit;
1481     }
1482     if (offset < 0) {
1483         _exception = 1;
1484         _exceptionType = "java/lang/IllegalArgumentException";
1485         _exceptionMessage = "offset < 0";
1486         goto exit;
1487     }
1488     _remaining = _env->GetArrayLength(value_ref) - offset;
1489     value_base = (GLint *)
1490         _env->GetIntArrayElements(value_ref, (jboolean *)0);
1491     value = value_base + offset;
1492
1493     glProgramUniform3iv(
1494         (GLuint)program,
1495         (GLint)location,
1496         (GLsizei)count,
1497         (GLint *)value
1498     );
1499
1500 exit:
1501     if (value_base) {
1502         _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
1503             JNI_ABORT);
1504     }
1505     if (_exception) {
1506         jniThrowException(_env, _exceptionType, _exceptionMessage);
1507     }
1508 }
1509
1510 /* void glProgramUniform3iv ( GLuint program, GLint location, GLsizei count, const GLint *value ) */
1511 static void
1512 android_glProgramUniform3iv__IIILjava_nio_IntBuffer_2
1513   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
1514     jintArray _array = (jintArray) 0;
1515     jint _bufferOffset = (jint) 0;
1516     jint _remaining;
1517     GLint *value = (GLint *) 0;
1518
1519     value = (GLint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1520     if (value == NULL) {
1521         char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1522         value = (GLint *) (_valueBase + _bufferOffset);
1523     }
1524     glProgramUniform3iv(
1525         (GLuint)program,
1526         (GLint)location,
1527         (GLsizei)count,
1528         (GLint *)value
1529     );
1530     if (_array) {
1531         _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
1532     }
1533 }
1534
1535 /* void glProgramUniform4iv ( GLuint program, GLint location, GLsizei count, const GLint *value ) */
1536 static void
1537 android_glProgramUniform4iv__III_3II
1538   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jintArray value_ref, jint offset) {
1539     jint _exception = 0;
1540     const char * _exceptionType = NULL;
1541     const char * _exceptionMessage = NULL;
1542     GLint *value_base = (GLint *) 0;
1543     jint _remaining;
1544     GLint *value = (GLint *) 0;
1545
1546     if (!value_ref) {
1547         _exception = 1;
1548         _exceptionType = "java/lang/IllegalArgumentException";
1549         _exceptionMessage = "value == null";
1550         goto exit;
1551     }
1552     if (offset < 0) {
1553         _exception = 1;
1554         _exceptionType = "java/lang/IllegalArgumentException";
1555         _exceptionMessage = "offset < 0";
1556         goto exit;
1557     }
1558     _remaining = _env->GetArrayLength(value_ref) - offset;
1559     value_base = (GLint *)
1560         _env->GetIntArrayElements(value_ref, (jboolean *)0);
1561     value = value_base + offset;
1562
1563     glProgramUniform4iv(
1564         (GLuint)program,
1565         (GLint)location,
1566         (GLsizei)count,
1567         (GLint *)value
1568     );
1569
1570 exit:
1571     if (value_base) {
1572         _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
1573             JNI_ABORT);
1574     }
1575     if (_exception) {
1576         jniThrowException(_env, _exceptionType, _exceptionMessage);
1577     }
1578 }
1579
1580 /* void glProgramUniform4iv ( GLuint program, GLint location, GLsizei count, const GLint *value ) */
1581 static void
1582 android_glProgramUniform4iv__IIILjava_nio_IntBuffer_2
1583   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
1584     jintArray _array = (jintArray) 0;
1585     jint _bufferOffset = (jint) 0;
1586     jint _remaining;
1587     GLint *value = (GLint *) 0;
1588
1589     value = (GLint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1590     if (value == NULL) {
1591         char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1592         value = (GLint *) (_valueBase + _bufferOffset);
1593     }
1594     glProgramUniform4iv(
1595         (GLuint)program,
1596         (GLint)location,
1597         (GLsizei)count,
1598         (GLint *)value
1599     );
1600     if (_array) {
1601         _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
1602     }
1603 }
1604
1605 /* void glProgramUniform1uiv ( GLuint program, GLint location, GLsizei count, const GLuint *value ) */
1606 static void
1607 android_glProgramUniform1uiv__III_3II
1608   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jintArray value_ref, jint offset) {
1609     jint _exception = 0;
1610     const char * _exceptionType = NULL;
1611     const char * _exceptionMessage = NULL;
1612     GLuint *value_base = (GLuint *) 0;
1613     jint _remaining;
1614     GLuint *value = (GLuint *) 0;
1615
1616     if (!value_ref) {
1617         _exception = 1;
1618         _exceptionType = "java/lang/IllegalArgumentException";
1619         _exceptionMessage = "value == null";
1620         goto exit;
1621     }
1622     if (offset < 0) {
1623         _exception = 1;
1624         _exceptionType = "java/lang/IllegalArgumentException";
1625         _exceptionMessage = "offset < 0";
1626         goto exit;
1627     }
1628     _remaining = _env->GetArrayLength(value_ref) - offset;
1629     value_base = (GLuint *)
1630         _env->GetIntArrayElements(value_ref, (jboolean *)0);
1631     value = value_base + offset;
1632
1633     glProgramUniform1uiv(
1634         (GLuint)program,
1635         (GLint)location,
1636         (GLsizei)count,
1637         (GLuint *)value
1638     );
1639
1640 exit:
1641     if (value_base) {
1642         _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
1643             JNI_ABORT);
1644     }
1645     if (_exception) {
1646         jniThrowException(_env, _exceptionType, _exceptionMessage);
1647     }
1648 }
1649
1650 /* void glProgramUniform1uiv ( GLuint program, GLint location, GLsizei count, const GLuint *value ) */
1651 static void
1652 android_glProgramUniform1uiv__IIILjava_nio_IntBuffer_2
1653   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
1654     jintArray _array = (jintArray) 0;
1655     jint _bufferOffset = (jint) 0;
1656     jint _remaining;
1657     GLuint *value = (GLuint *) 0;
1658
1659     value = (GLuint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1660     if (value == NULL) {
1661         char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1662         value = (GLuint *) (_valueBase + _bufferOffset);
1663     }
1664     glProgramUniform1uiv(
1665         (GLuint)program,
1666         (GLint)location,
1667         (GLsizei)count,
1668         (GLuint *)value
1669     );
1670     if (_array) {
1671         _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
1672     }
1673 }
1674
1675 /* void glProgramUniform2uiv ( GLuint program, GLint location, GLsizei count, const GLuint *value ) */
1676 static void
1677 android_glProgramUniform2uiv__III_3II
1678   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jintArray value_ref, jint offset) {
1679     jint _exception = 0;
1680     const char * _exceptionType = NULL;
1681     const char * _exceptionMessage = NULL;
1682     GLuint *value_base = (GLuint *) 0;
1683     jint _remaining;
1684     GLuint *value = (GLuint *) 0;
1685
1686     if (!value_ref) {
1687         _exception = 1;
1688         _exceptionType = "java/lang/IllegalArgumentException";
1689         _exceptionMessage = "value == null";
1690         goto exit;
1691     }
1692     if (offset < 0) {
1693         _exception = 1;
1694         _exceptionType = "java/lang/IllegalArgumentException";
1695         _exceptionMessage = "offset < 0";
1696         goto exit;
1697     }
1698     _remaining = _env->GetArrayLength(value_ref) - offset;
1699     value_base = (GLuint *)
1700         _env->GetIntArrayElements(value_ref, (jboolean *)0);
1701     value = value_base + offset;
1702
1703     glProgramUniform2uiv(
1704         (GLuint)program,
1705         (GLint)location,
1706         (GLsizei)count,
1707         (GLuint *)value
1708     );
1709
1710 exit:
1711     if (value_base) {
1712         _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
1713             JNI_ABORT);
1714     }
1715     if (_exception) {
1716         jniThrowException(_env, _exceptionType, _exceptionMessage);
1717     }
1718 }
1719
1720 /* void glProgramUniform2uiv ( GLuint program, GLint location, GLsizei count, const GLuint *value ) */
1721 static void
1722 android_glProgramUniform2uiv__IIILjava_nio_IntBuffer_2
1723   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
1724     jintArray _array = (jintArray) 0;
1725     jint _bufferOffset = (jint) 0;
1726     jint _remaining;
1727     GLuint *value = (GLuint *) 0;
1728
1729     value = (GLuint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1730     if (value == NULL) {
1731         char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1732         value = (GLuint *) (_valueBase + _bufferOffset);
1733     }
1734     glProgramUniform2uiv(
1735         (GLuint)program,
1736         (GLint)location,
1737         (GLsizei)count,
1738         (GLuint *)value
1739     );
1740     if (_array) {
1741         _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
1742     }
1743 }
1744
1745 /* void glProgramUniform3uiv ( GLuint program, GLint location, GLsizei count, const GLuint *value ) */
1746 static void
1747 android_glProgramUniform3uiv__III_3II
1748   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jintArray value_ref, jint offset) {
1749     jint _exception = 0;
1750     const char * _exceptionType = NULL;
1751     const char * _exceptionMessage = NULL;
1752     GLuint *value_base = (GLuint *) 0;
1753     jint _remaining;
1754     GLuint *value = (GLuint *) 0;
1755
1756     if (!value_ref) {
1757         _exception = 1;
1758         _exceptionType = "java/lang/IllegalArgumentException";
1759         _exceptionMessage = "value == null";
1760         goto exit;
1761     }
1762     if (offset < 0) {
1763         _exception = 1;
1764         _exceptionType = "java/lang/IllegalArgumentException";
1765         _exceptionMessage = "offset < 0";
1766         goto exit;
1767     }
1768     _remaining = _env->GetArrayLength(value_ref) - offset;
1769     value_base = (GLuint *)
1770         _env->GetIntArrayElements(value_ref, (jboolean *)0);
1771     value = value_base + offset;
1772
1773     glProgramUniform3uiv(
1774         (GLuint)program,
1775         (GLint)location,
1776         (GLsizei)count,
1777         (GLuint *)value
1778     );
1779
1780 exit:
1781     if (value_base) {
1782         _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
1783             JNI_ABORT);
1784     }
1785     if (_exception) {
1786         jniThrowException(_env, _exceptionType, _exceptionMessage);
1787     }
1788 }
1789
1790 /* void glProgramUniform3uiv ( GLuint program, GLint location, GLsizei count, const GLuint *value ) */
1791 static void
1792 android_glProgramUniform3uiv__IIILjava_nio_IntBuffer_2
1793   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
1794     jintArray _array = (jintArray) 0;
1795     jint _bufferOffset = (jint) 0;
1796     jint _remaining;
1797     GLuint *value = (GLuint *) 0;
1798
1799     value = (GLuint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1800     if (value == NULL) {
1801         char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1802         value = (GLuint *) (_valueBase + _bufferOffset);
1803     }
1804     glProgramUniform3uiv(
1805         (GLuint)program,
1806         (GLint)location,
1807         (GLsizei)count,
1808         (GLuint *)value
1809     );
1810     if (_array) {
1811         _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
1812     }
1813 }
1814
1815 /* void glProgramUniform4uiv ( GLuint program, GLint location, GLsizei count, const GLuint *value ) */
1816 static void
1817 android_glProgramUniform4uiv__III_3II
1818   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jintArray value_ref, jint offset) {
1819     jint _exception = 0;
1820     const char * _exceptionType = NULL;
1821     const char * _exceptionMessage = NULL;
1822     GLuint *value_base = (GLuint *) 0;
1823     jint _remaining;
1824     GLuint *value = (GLuint *) 0;
1825
1826     if (!value_ref) {
1827         _exception = 1;
1828         _exceptionType = "java/lang/IllegalArgumentException";
1829         _exceptionMessage = "value == null";
1830         goto exit;
1831     }
1832     if (offset < 0) {
1833         _exception = 1;
1834         _exceptionType = "java/lang/IllegalArgumentException";
1835         _exceptionMessage = "offset < 0";
1836         goto exit;
1837     }
1838     _remaining = _env->GetArrayLength(value_ref) - offset;
1839     value_base = (GLuint *)
1840         _env->GetIntArrayElements(value_ref, (jboolean *)0);
1841     value = value_base + offset;
1842
1843     glProgramUniform4uiv(
1844         (GLuint)program,
1845         (GLint)location,
1846         (GLsizei)count,
1847         (GLuint *)value
1848     );
1849
1850 exit:
1851     if (value_base) {
1852         _env->ReleaseIntArrayElements(value_ref, (jint*)value_base,
1853             JNI_ABORT);
1854     }
1855     if (_exception) {
1856         jniThrowException(_env, _exceptionType, _exceptionMessage);
1857     }
1858 }
1859
1860 /* void glProgramUniform4uiv ( GLuint program, GLint location, GLsizei count, const GLuint *value ) */
1861 static void
1862 android_glProgramUniform4uiv__IIILjava_nio_IntBuffer_2
1863   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
1864     jintArray _array = (jintArray) 0;
1865     jint _bufferOffset = (jint) 0;
1866     jint _remaining;
1867     GLuint *value = (GLuint *) 0;
1868
1869     value = (GLuint *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1870     if (value == NULL) {
1871         char * _valueBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
1872         value = (GLuint *) (_valueBase + _bufferOffset);
1873     }
1874     glProgramUniform4uiv(
1875         (GLuint)program,
1876         (GLint)location,
1877         (GLsizei)count,
1878         (GLuint *)value
1879     );
1880     if (_array) {
1881         _env->ReleaseIntArrayElements(_array, (jint*)value, JNI_ABORT);
1882     }
1883 }
1884
1885 /* void glProgramUniform1fv ( GLuint program, GLint location, GLsizei count, const GLfloat *value ) */
1886 static void
1887 android_glProgramUniform1fv__III_3FI
1888   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jfloatArray value_ref, jint offset) {
1889     jint _exception = 0;
1890     const char * _exceptionType = NULL;
1891     const char * _exceptionMessage = NULL;
1892     GLfloat *value_base = (GLfloat *) 0;
1893     jint _remaining;
1894     GLfloat *value = (GLfloat *) 0;
1895
1896     if (!value_ref) {
1897         _exception = 1;
1898         _exceptionType = "java/lang/IllegalArgumentException";
1899         _exceptionMessage = "value == null";
1900         goto exit;
1901     }
1902     if (offset < 0) {
1903         _exception = 1;
1904         _exceptionType = "java/lang/IllegalArgumentException";
1905         _exceptionMessage = "offset < 0";
1906         goto exit;
1907     }
1908     _remaining = _env->GetArrayLength(value_ref) - offset;
1909     value_base = (GLfloat *)
1910         _env->GetFloatArrayElements(value_ref, (jboolean *)0);
1911     value = value_base + offset;
1912
1913     glProgramUniform1fv(
1914         (GLuint)program,
1915         (GLint)location,
1916         (GLsizei)count,
1917         (GLfloat *)value
1918     );
1919
1920 exit:
1921     if (value_base) {
1922         _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
1923             JNI_ABORT);
1924     }
1925     if (_exception) {
1926         jniThrowException(_env, _exceptionType, _exceptionMessage);
1927     }
1928 }
1929
1930 /* void glProgramUniform1fv ( GLuint program, GLint location, GLsizei count, const GLfloat *value ) */
1931 static void
1932 android_glProgramUniform1fv__IIILjava_nio_FloatBuffer_2
1933   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
1934     jfloatArray _array = (jfloatArray) 0;
1935     jint _bufferOffset = (jint) 0;
1936     jint _remaining;
1937     GLfloat *value = (GLfloat *) 0;
1938
1939     value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
1940     if (value == NULL) {
1941         char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
1942         value = (GLfloat *) (_valueBase + _bufferOffset);
1943     }
1944     glProgramUniform1fv(
1945         (GLuint)program,
1946         (GLint)location,
1947         (GLsizei)count,
1948         (GLfloat *)value
1949     );
1950     if (_array) {
1951         _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
1952     }
1953 }
1954
1955 /* void glProgramUniform2fv ( GLuint program, GLint location, GLsizei count, const GLfloat *value ) */
1956 static void
1957 android_glProgramUniform2fv__III_3FI
1958   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jfloatArray value_ref, jint offset) {
1959     jint _exception = 0;
1960     const char * _exceptionType = NULL;
1961     const char * _exceptionMessage = NULL;
1962     GLfloat *value_base = (GLfloat *) 0;
1963     jint _remaining;
1964     GLfloat *value = (GLfloat *) 0;
1965
1966     if (!value_ref) {
1967         _exception = 1;
1968         _exceptionType = "java/lang/IllegalArgumentException";
1969         _exceptionMessage = "value == null";
1970         goto exit;
1971     }
1972     if (offset < 0) {
1973         _exception = 1;
1974         _exceptionType = "java/lang/IllegalArgumentException";
1975         _exceptionMessage = "offset < 0";
1976         goto exit;
1977     }
1978     _remaining = _env->GetArrayLength(value_ref) - offset;
1979     value_base = (GLfloat *)
1980         _env->GetFloatArrayElements(value_ref, (jboolean *)0);
1981     value = value_base + offset;
1982
1983     glProgramUniform2fv(
1984         (GLuint)program,
1985         (GLint)location,
1986         (GLsizei)count,
1987         (GLfloat *)value
1988     );
1989
1990 exit:
1991     if (value_base) {
1992         _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
1993             JNI_ABORT);
1994     }
1995     if (_exception) {
1996         jniThrowException(_env, _exceptionType, _exceptionMessage);
1997     }
1998 }
1999
2000 /* void glProgramUniform2fv ( GLuint program, GLint location, GLsizei count, const GLfloat *value ) */
2001 static void
2002 android_glProgramUniform2fv__IIILjava_nio_FloatBuffer_2
2003   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
2004     jfloatArray _array = (jfloatArray) 0;
2005     jint _bufferOffset = (jint) 0;
2006     jint _remaining;
2007     GLfloat *value = (GLfloat *) 0;
2008
2009     value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2010     if (value == NULL) {
2011         char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
2012         value = (GLfloat *) (_valueBase + _bufferOffset);
2013     }
2014     glProgramUniform2fv(
2015         (GLuint)program,
2016         (GLint)location,
2017         (GLsizei)count,
2018         (GLfloat *)value
2019     );
2020     if (_array) {
2021         _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
2022     }
2023 }
2024
2025 /* void glProgramUniform3fv ( GLuint program, GLint location, GLsizei count, const GLfloat *value ) */
2026 static void
2027 android_glProgramUniform3fv__III_3FI
2028   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jfloatArray value_ref, jint offset) {
2029     jint _exception = 0;
2030     const char * _exceptionType = NULL;
2031     const char * _exceptionMessage = NULL;
2032     GLfloat *value_base = (GLfloat *) 0;
2033     jint _remaining;
2034     GLfloat *value = (GLfloat *) 0;
2035
2036     if (!value_ref) {
2037         _exception = 1;
2038         _exceptionType = "java/lang/IllegalArgumentException";
2039         _exceptionMessage = "value == null";
2040         goto exit;
2041     }
2042     if (offset < 0) {
2043         _exception = 1;
2044         _exceptionType = "java/lang/IllegalArgumentException";
2045         _exceptionMessage = "offset < 0";
2046         goto exit;
2047     }
2048     _remaining = _env->GetArrayLength(value_ref) - offset;
2049     value_base = (GLfloat *)
2050         _env->GetFloatArrayElements(value_ref, (jboolean *)0);
2051     value = value_base + offset;
2052
2053     glProgramUniform3fv(
2054         (GLuint)program,
2055         (GLint)location,
2056         (GLsizei)count,
2057         (GLfloat *)value
2058     );
2059
2060 exit:
2061     if (value_base) {
2062         _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
2063             JNI_ABORT);
2064     }
2065     if (_exception) {
2066         jniThrowException(_env, _exceptionType, _exceptionMessage);
2067     }
2068 }
2069
2070 /* void glProgramUniform3fv ( GLuint program, GLint location, GLsizei count, const GLfloat *value ) */
2071 static void
2072 android_glProgramUniform3fv__IIILjava_nio_FloatBuffer_2
2073   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
2074     jfloatArray _array = (jfloatArray) 0;
2075     jint _bufferOffset = (jint) 0;
2076     jint _remaining;
2077     GLfloat *value = (GLfloat *) 0;
2078
2079     value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2080     if (value == NULL) {
2081         char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
2082         value = (GLfloat *) (_valueBase + _bufferOffset);
2083     }
2084     glProgramUniform3fv(
2085         (GLuint)program,
2086         (GLint)location,
2087         (GLsizei)count,
2088         (GLfloat *)value
2089     );
2090     if (_array) {
2091         _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
2092     }
2093 }
2094
2095 /* void glProgramUniform4fv ( GLuint program, GLint location, GLsizei count, const GLfloat *value ) */
2096 static void
2097 android_glProgramUniform4fv__III_3FI
2098   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jfloatArray value_ref, jint offset) {
2099     jint _exception = 0;
2100     const char * _exceptionType = NULL;
2101     const char * _exceptionMessage = NULL;
2102     GLfloat *value_base = (GLfloat *) 0;
2103     jint _remaining;
2104     GLfloat *value = (GLfloat *) 0;
2105
2106     if (!value_ref) {
2107         _exception = 1;
2108         _exceptionType = "java/lang/IllegalArgumentException";
2109         _exceptionMessage = "value == null";
2110         goto exit;
2111     }
2112     if (offset < 0) {
2113         _exception = 1;
2114         _exceptionType = "java/lang/IllegalArgumentException";
2115         _exceptionMessage = "offset < 0";
2116         goto exit;
2117     }
2118     _remaining = _env->GetArrayLength(value_ref) - offset;
2119     value_base = (GLfloat *)
2120         _env->GetFloatArrayElements(value_ref, (jboolean *)0);
2121     value = value_base + offset;
2122
2123     glProgramUniform4fv(
2124         (GLuint)program,
2125         (GLint)location,
2126         (GLsizei)count,
2127         (GLfloat *)value
2128     );
2129
2130 exit:
2131     if (value_base) {
2132         _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
2133             JNI_ABORT);
2134     }
2135     if (_exception) {
2136         jniThrowException(_env, _exceptionType, _exceptionMessage);
2137     }
2138 }
2139
2140 /* void glProgramUniform4fv ( GLuint program, GLint location, GLsizei count, const GLfloat *value ) */
2141 static void
2142 android_glProgramUniform4fv__IIILjava_nio_FloatBuffer_2
2143   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jobject value_buf) {
2144     jfloatArray _array = (jfloatArray) 0;
2145     jint _bufferOffset = (jint) 0;
2146     jint _remaining;
2147     GLfloat *value = (GLfloat *) 0;
2148
2149     value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2150     if (value == NULL) {
2151         char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
2152         value = (GLfloat *) (_valueBase + _bufferOffset);
2153     }
2154     glProgramUniform4fv(
2155         (GLuint)program,
2156         (GLint)location,
2157         (GLsizei)count,
2158         (GLfloat *)value
2159     );
2160     if (_array) {
2161         _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
2162     }
2163 }
2164
2165 /* void glProgramUniformMatrix2fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
2166 static void
2167 android_glProgramUniformMatrix2fv__IIIZ_3FI
2168   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
2169     jint _exception = 0;
2170     const char * _exceptionType = NULL;
2171     const char * _exceptionMessage = NULL;
2172     GLfloat *value_base = (GLfloat *) 0;
2173     jint _remaining;
2174     GLfloat *value = (GLfloat *) 0;
2175
2176     if (!value_ref) {
2177         _exception = 1;
2178         _exceptionType = "java/lang/IllegalArgumentException";
2179         _exceptionMessage = "value == null";
2180         goto exit;
2181     }
2182     if (offset < 0) {
2183         _exception = 1;
2184         _exceptionType = "java/lang/IllegalArgumentException";
2185         _exceptionMessage = "offset < 0";
2186         goto exit;
2187     }
2188     _remaining = _env->GetArrayLength(value_ref) - offset;
2189     value_base = (GLfloat *)
2190         _env->GetFloatArrayElements(value_ref, (jboolean *)0);
2191     value = value_base + offset;
2192
2193     glProgramUniformMatrix2fv(
2194         (GLuint)program,
2195         (GLint)location,
2196         (GLsizei)count,
2197         (GLboolean)transpose,
2198         (GLfloat *)value
2199     );
2200
2201 exit:
2202     if (value_base) {
2203         _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
2204             JNI_ABORT);
2205     }
2206     if (_exception) {
2207         jniThrowException(_env, _exceptionType, _exceptionMessage);
2208     }
2209 }
2210
2211 /* void glProgramUniformMatrix2fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
2212 static void
2213 android_glProgramUniformMatrix2fv__IIIZLjava_nio_FloatBuffer_2
2214   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jobject value_buf) {
2215     jfloatArray _array = (jfloatArray) 0;
2216     jint _bufferOffset = (jint) 0;
2217     jint _remaining;
2218     GLfloat *value = (GLfloat *) 0;
2219
2220     value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2221     if (value == NULL) {
2222         char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
2223         value = (GLfloat *) (_valueBase + _bufferOffset);
2224     }
2225     glProgramUniformMatrix2fv(
2226         (GLuint)program,
2227         (GLint)location,
2228         (GLsizei)count,
2229         (GLboolean)transpose,
2230         (GLfloat *)value
2231     );
2232     if (_array) {
2233         _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
2234     }
2235 }
2236
2237 /* void glProgramUniformMatrix3fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
2238 static void
2239 android_glProgramUniformMatrix3fv__IIIZ_3FI
2240   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
2241     jint _exception = 0;
2242     const char * _exceptionType = NULL;
2243     const char * _exceptionMessage = NULL;
2244     GLfloat *value_base = (GLfloat *) 0;
2245     jint _remaining;
2246     GLfloat *value = (GLfloat *) 0;
2247
2248     if (!value_ref) {
2249         _exception = 1;
2250         _exceptionType = "java/lang/IllegalArgumentException";
2251         _exceptionMessage = "value == null";
2252         goto exit;
2253     }
2254     if (offset < 0) {
2255         _exception = 1;
2256         _exceptionType = "java/lang/IllegalArgumentException";
2257         _exceptionMessage = "offset < 0";
2258         goto exit;
2259     }
2260     _remaining = _env->GetArrayLength(value_ref) - offset;
2261     value_base = (GLfloat *)
2262         _env->GetFloatArrayElements(value_ref, (jboolean *)0);
2263     value = value_base + offset;
2264
2265     glProgramUniformMatrix3fv(
2266         (GLuint)program,
2267         (GLint)location,
2268         (GLsizei)count,
2269         (GLboolean)transpose,
2270         (GLfloat *)value
2271     );
2272
2273 exit:
2274     if (value_base) {
2275         _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
2276             JNI_ABORT);
2277     }
2278     if (_exception) {
2279         jniThrowException(_env, _exceptionType, _exceptionMessage);
2280     }
2281 }
2282
2283 /* void glProgramUniformMatrix3fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
2284 static void
2285 android_glProgramUniformMatrix3fv__IIIZLjava_nio_FloatBuffer_2
2286   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jobject value_buf) {
2287     jfloatArray _array = (jfloatArray) 0;
2288     jint _bufferOffset = (jint) 0;
2289     jint _remaining;
2290     GLfloat *value = (GLfloat *) 0;
2291
2292     value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2293     if (value == NULL) {
2294         char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
2295         value = (GLfloat *) (_valueBase + _bufferOffset);
2296     }
2297     glProgramUniformMatrix3fv(
2298         (GLuint)program,
2299         (GLint)location,
2300         (GLsizei)count,
2301         (GLboolean)transpose,
2302         (GLfloat *)value
2303     );
2304     if (_array) {
2305         _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
2306     }
2307 }
2308
2309 /* void glProgramUniformMatrix4fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
2310 static void
2311 android_glProgramUniformMatrix4fv__IIIZ_3FI
2312   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
2313     jint _exception = 0;
2314     const char * _exceptionType = NULL;
2315     const char * _exceptionMessage = NULL;
2316     GLfloat *value_base = (GLfloat *) 0;
2317     jint _remaining;
2318     GLfloat *value = (GLfloat *) 0;
2319
2320     if (!value_ref) {
2321         _exception = 1;
2322         _exceptionType = "java/lang/IllegalArgumentException";
2323         _exceptionMessage = "value == null";
2324         goto exit;
2325     }
2326     if (offset < 0) {
2327         _exception = 1;
2328         _exceptionType = "java/lang/IllegalArgumentException";
2329         _exceptionMessage = "offset < 0";
2330         goto exit;
2331     }
2332     _remaining = _env->GetArrayLength(value_ref) - offset;
2333     value_base = (GLfloat *)
2334         _env->GetFloatArrayElements(value_ref, (jboolean *)0);
2335     value = value_base + offset;
2336
2337     glProgramUniformMatrix4fv(
2338         (GLuint)program,
2339         (GLint)location,
2340         (GLsizei)count,
2341         (GLboolean)transpose,
2342         (GLfloat *)value
2343     );
2344
2345 exit:
2346     if (value_base) {
2347         _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
2348             JNI_ABORT);
2349     }
2350     if (_exception) {
2351         jniThrowException(_env, _exceptionType, _exceptionMessage);
2352     }
2353 }
2354
2355 /* void glProgramUniformMatrix4fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
2356 static void
2357 android_glProgramUniformMatrix4fv__IIIZLjava_nio_FloatBuffer_2
2358   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jobject value_buf) {
2359     jfloatArray _array = (jfloatArray) 0;
2360     jint _bufferOffset = (jint) 0;
2361     jint _remaining;
2362     GLfloat *value = (GLfloat *) 0;
2363
2364     value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2365     if (value == NULL) {
2366         char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
2367         value = (GLfloat *) (_valueBase + _bufferOffset);
2368     }
2369     glProgramUniformMatrix4fv(
2370         (GLuint)program,
2371         (GLint)location,
2372         (GLsizei)count,
2373         (GLboolean)transpose,
2374         (GLfloat *)value
2375     );
2376     if (_array) {
2377         _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
2378     }
2379 }
2380
2381 /* void glProgramUniformMatrix2x3fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
2382 static void
2383 android_glProgramUniformMatrix2x3fv__IIIZ_3FI
2384   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
2385     jint _exception = 0;
2386     const char * _exceptionType = NULL;
2387     const char * _exceptionMessage = NULL;
2388     GLfloat *value_base = (GLfloat *) 0;
2389     jint _remaining;
2390     GLfloat *value = (GLfloat *) 0;
2391
2392     if (!value_ref) {
2393         _exception = 1;
2394         _exceptionType = "java/lang/IllegalArgumentException";
2395         _exceptionMessage = "value == null";
2396         goto exit;
2397     }
2398     if (offset < 0) {
2399         _exception = 1;
2400         _exceptionType = "java/lang/IllegalArgumentException";
2401         _exceptionMessage = "offset < 0";
2402         goto exit;
2403     }
2404     _remaining = _env->GetArrayLength(value_ref) - offset;
2405     value_base = (GLfloat *)
2406         _env->GetFloatArrayElements(value_ref, (jboolean *)0);
2407     value = value_base + offset;
2408
2409     glProgramUniformMatrix2x3fv(
2410         (GLuint)program,
2411         (GLint)location,
2412         (GLsizei)count,
2413         (GLboolean)transpose,
2414         (GLfloat *)value
2415     );
2416
2417 exit:
2418     if (value_base) {
2419         _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
2420             JNI_ABORT);
2421     }
2422     if (_exception) {
2423         jniThrowException(_env, _exceptionType, _exceptionMessage);
2424     }
2425 }
2426
2427 /* void glProgramUniformMatrix2x3fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
2428 static void
2429 android_glProgramUniformMatrix2x3fv__IIIZLjava_nio_FloatBuffer_2
2430   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jobject value_buf) {
2431     jfloatArray _array = (jfloatArray) 0;
2432     jint _bufferOffset = (jint) 0;
2433     jint _remaining;
2434     GLfloat *value = (GLfloat *) 0;
2435
2436     value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2437     if (value == NULL) {
2438         char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
2439         value = (GLfloat *) (_valueBase + _bufferOffset);
2440     }
2441     glProgramUniformMatrix2x3fv(
2442         (GLuint)program,
2443         (GLint)location,
2444         (GLsizei)count,
2445         (GLboolean)transpose,
2446         (GLfloat *)value
2447     );
2448     if (_array) {
2449         _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
2450     }
2451 }
2452
2453 /* void glProgramUniformMatrix3x2fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
2454 static void
2455 android_glProgramUniformMatrix3x2fv__IIIZ_3FI
2456   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
2457     jint _exception = 0;
2458     const char * _exceptionType = NULL;
2459     const char * _exceptionMessage = NULL;
2460     GLfloat *value_base = (GLfloat *) 0;
2461     jint _remaining;
2462     GLfloat *value = (GLfloat *) 0;
2463
2464     if (!value_ref) {
2465         _exception = 1;
2466         _exceptionType = "java/lang/IllegalArgumentException";
2467         _exceptionMessage = "value == null";
2468         goto exit;
2469     }
2470     if (offset < 0) {
2471         _exception = 1;
2472         _exceptionType = "java/lang/IllegalArgumentException";
2473         _exceptionMessage = "offset < 0";
2474         goto exit;
2475     }
2476     _remaining = _env->GetArrayLength(value_ref) - offset;
2477     value_base = (GLfloat *)
2478         _env->GetFloatArrayElements(value_ref, (jboolean *)0);
2479     value = value_base + offset;
2480
2481     glProgramUniformMatrix3x2fv(
2482         (GLuint)program,
2483         (GLint)location,
2484         (GLsizei)count,
2485         (GLboolean)transpose,
2486         (GLfloat *)value
2487     );
2488
2489 exit:
2490     if (value_base) {
2491         _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
2492             JNI_ABORT);
2493     }
2494     if (_exception) {
2495         jniThrowException(_env, _exceptionType, _exceptionMessage);
2496     }
2497 }
2498
2499 /* void glProgramUniformMatrix3x2fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
2500 static void
2501 android_glProgramUniformMatrix3x2fv__IIIZLjava_nio_FloatBuffer_2
2502   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jobject value_buf) {
2503     jfloatArray _array = (jfloatArray) 0;
2504     jint _bufferOffset = (jint) 0;
2505     jint _remaining;
2506     GLfloat *value = (GLfloat *) 0;
2507
2508     value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2509     if (value == NULL) {
2510         char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
2511         value = (GLfloat *) (_valueBase + _bufferOffset);
2512     }
2513     glProgramUniformMatrix3x2fv(
2514         (GLuint)program,
2515         (GLint)location,
2516         (GLsizei)count,
2517         (GLboolean)transpose,
2518         (GLfloat *)value
2519     );
2520     if (_array) {
2521         _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
2522     }
2523 }
2524
2525 /* void glProgramUniformMatrix2x4fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
2526 static void
2527 android_glProgramUniformMatrix2x4fv__IIIZ_3FI
2528   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
2529     jint _exception = 0;
2530     const char * _exceptionType = NULL;
2531     const char * _exceptionMessage = NULL;
2532     GLfloat *value_base = (GLfloat *) 0;
2533     jint _remaining;
2534     GLfloat *value = (GLfloat *) 0;
2535
2536     if (!value_ref) {
2537         _exception = 1;
2538         _exceptionType = "java/lang/IllegalArgumentException";
2539         _exceptionMessage = "value == null";
2540         goto exit;
2541     }
2542     if (offset < 0) {
2543         _exception = 1;
2544         _exceptionType = "java/lang/IllegalArgumentException";
2545         _exceptionMessage = "offset < 0";
2546         goto exit;
2547     }
2548     _remaining = _env->GetArrayLength(value_ref) - offset;
2549     value_base = (GLfloat *)
2550         _env->GetFloatArrayElements(value_ref, (jboolean *)0);
2551     value = value_base + offset;
2552
2553     glProgramUniformMatrix2x4fv(
2554         (GLuint)program,
2555         (GLint)location,
2556         (GLsizei)count,
2557         (GLboolean)transpose,
2558         (GLfloat *)value
2559     );
2560
2561 exit:
2562     if (value_base) {
2563         _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
2564             JNI_ABORT);
2565     }
2566     if (_exception) {
2567         jniThrowException(_env, _exceptionType, _exceptionMessage);
2568     }
2569 }
2570
2571 /* void glProgramUniformMatrix2x4fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
2572 static void
2573 android_glProgramUniformMatrix2x4fv__IIIZLjava_nio_FloatBuffer_2
2574   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jobject value_buf) {
2575     jfloatArray _array = (jfloatArray) 0;
2576     jint _bufferOffset = (jint) 0;
2577     jint _remaining;
2578     GLfloat *value = (GLfloat *) 0;
2579
2580     value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2581     if (value == NULL) {
2582         char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
2583         value = (GLfloat *) (_valueBase + _bufferOffset);
2584     }
2585     glProgramUniformMatrix2x4fv(
2586         (GLuint)program,
2587         (GLint)location,
2588         (GLsizei)count,
2589         (GLboolean)transpose,
2590         (GLfloat *)value
2591     );
2592     if (_array) {
2593         _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
2594     }
2595 }
2596
2597 /* void glProgramUniformMatrix4x2fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
2598 static void
2599 android_glProgramUniformMatrix4x2fv__IIIZ_3FI
2600   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
2601     jint _exception = 0;
2602     const char * _exceptionType = NULL;
2603     const char * _exceptionMessage = NULL;
2604     GLfloat *value_base = (GLfloat *) 0;
2605     jint _remaining;
2606     GLfloat *value = (GLfloat *) 0;
2607
2608     if (!value_ref) {
2609         _exception = 1;
2610         _exceptionType = "java/lang/IllegalArgumentException";
2611         _exceptionMessage = "value == null";
2612         goto exit;
2613     }
2614     if (offset < 0) {
2615         _exception = 1;
2616         _exceptionType = "java/lang/IllegalArgumentException";
2617         _exceptionMessage = "offset < 0";
2618         goto exit;
2619     }
2620     _remaining = _env->GetArrayLength(value_ref) - offset;
2621     value_base = (GLfloat *)
2622         _env->GetFloatArrayElements(value_ref, (jboolean *)0);
2623     value = value_base + offset;
2624
2625     glProgramUniformMatrix4x2fv(
2626         (GLuint)program,
2627         (GLint)location,
2628         (GLsizei)count,
2629         (GLboolean)transpose,
2630         (GLfloat *)value
2631     );
2632
2633 exit:
2634     if (value_base) {
2635         _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
2636             JNI_ABORT);
2637     }
2638     if (_exception) {
2639         jniThrowException(_env, _exceptionType, _exceptionMessage);
2640     }
2641 }
2642
2643 /* void glProgramUniformMatrix4x2fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
2644 static void
2645 android_glProgramUniformMatrix4x2fv__IIIZLjava_nio_FloatBuffer_2
2646   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jobject value_buf) {
2647     jfloatArray _array = (jfloatArray) 0;
2648     jint _bufferOffset = (jint) 0;
2649     jint _remaining;
2650     GLfloat *value = (GLfloat *) 0;
2651
2652     value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2653     if (value == NULL) {
2654         char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
2655         value = (GLfloat *) (_valueBase + _bufferOffset);
2656     }
2657     glProgramUniformMatrix4x2fv(
2658         (GLuint)program,
2659         (GLint)location,
2660         (GLsizei)count,
2661         (GLboolean)transpose,
2662         (GLfloat *)value
2663     );
2664     if (_array) {
2665         _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
2666     }
2667 }
2668
2669 /* void glProgramUniformMatrix3x4fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
2670 static void
2671 android_glProgramUniformMatrix3x4fv__IIIZ_3FI
2672   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
2673     jint _exception = 0;
2674     const char * _exceptionType = NULL;
2675     const char * _exceptionMessage = NULL;
2676     GLfloat *value_base = (GLfloat *) 0;
2677     jint _remaining;
2678     GLfloat *value = (GLfloat *) 0;
2679
2680     if (!value_ref) {
2681         _exception = 1;
2682         _exceptionType = "java/lang/IllegalArgumentException";
2683         _exceptionMessage = "value == null";
2684         goto exit;
2685     }
2686     if (offset < 0) {
2687         _exception = 1;
2688         _exceptionType = "java/lang/IllegalArgumentException";
2689         _exceptionMessage = "offset < 0";
2690         goto exit;
2691     }
2692     _remaining = _env->GetArrayLength(value_ref) - offset;
2693     value_base = (GLfloat *)
2694         _env->GetFloatArrayElements(value_ref, (jboolean *)0);
2695     value = value_base + offset;
2696
2697     glProgramUniformMatrix3x4fv(
2698         (GLuint)program,
2699         (GLint)location,
2700         (GLsizei)count,
2701         (GLboolean)transpose,
2702         (GLfloat *)value
2703     );
2704
2705 exit:
2706     if (value_base) {
2707         _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
2708             JNI_ABORT);
2709     }
2710     if (_exception) {
2711         jniThrowException(_env, _exceptionType, _exceptionMessage);
2712     }
2713 }
2714
2715 /* void glProgramUniformMatrix3x4fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
2716 static void
2717 android_glProgramUniformMatrix3x4fv__IIIZLjava_nio_FloatBuffer_2
2718   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jobject value_buf) {
2719     jfloatArray _array = (jfloatArray) 0;
2720     jint _bufferOffset = (jint) 0;
2721     jint _remaining;
2722     GLfloat *value = (GLfloat *) 0;
2723
2724     value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2725     if (value == NULL) {
2726         char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
2727         value = (GLfloat *) (_valueBase + _bufferOffset);
2728     }
2729     glProgramUniformMatrix3x4fv(
2730         (GLuint)program,
2731         (GLint)location,
2732         (GLsizei)count,
2733         (GLboolean)transpose,
2734         (GLfloat *)value
2735     );
2736     if (_array) {
2737         _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
2738     }
2739 }
2740
2741 /* void glProgramUniformMatrix4x3fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
2742 static void
2743 android_glProgramUniformMatrix4x3fv__IIIZ_3FI
2744   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
2745     jint _exception = 0;
2746     const char * _exceptionType = NULL;
2747     const char * _exceptionMessage = NULL;
2748     GLfloat *value_base = (GLfloat *) 0;
2749     jint _remaining;
2750     GLfloat *value = (GLfloat *) 0;
2751
2752     if (!value_ref) {
2753         _exception = 1;
2754         _exceptionType = "java/lang/IllegalArgumentException";
2755         _exceptionMessage = "value == null";
2756         goto exit;
2757     }
2758     if (offset < 0) {
2759         _exception = 1;
2760         _exceptionType = "java/lang/IllegalArgumentException";
2761         _exceptionMessage = "offset < 0";
2762         goto exit;
2763     }
2764     _remaining = _env->GetArrayLength(value_ref) - offset;
2765     value_base = (GLfloat *)
2766         _env->GetFloatArrayElements(value_ref, (jboolean *)0);
2767     value = value_base + offset;
2768
2769     glProgramUniformMatrix4x3fv(
2770         (GLuint)program,
2771         (GLint)location,
2772         (GLsizei)count,
2773         (GLboolean)transpose,
2774         (GLfloat *)value
2775     );
2776
2777 exit:
2778     if (value_base) {
2779         _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
2780             JNI_ABORT);
2781     }
2782     if (_exception) {
2783         jniThrowException(_env, _exceptionType, _exceptionMessage);
2784     }
2785 }
2786
2787 /* void glProgramUniformMatrix4x3fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
2788 static void
2789 android_glProgramUniformMatrix4x3fv__IIIZLjava_nio_FloatBuffer_2
2790   (JNIEnv *_env, jobject _this, jint program, jint location, jint count, jboolean transpose, jobject value_buf) {
2791     jfloatArray _array = (jfloatArray) 0;
2792     jint _bufferOffset = (jint) 0;
2793     jint _remaining;
2794     GLfloat *value = (GLfloat *) 0;
2795
2796     value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2797     if (value == NULL) {
2798         char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
2799         value = (GLfloat *) (_valueBase + _bufferOffset);
2800     }
2801     glProgramUniformMatrix4x3fv(
2802         (GLuint)program,
2803         (GLint)location,
2804         (GLsizei)count,
2805         (GLboolean)transpose,
2806         (GLfloat *)value
2807     );
2808     if (_array) {
2809         _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
2810     }
2811 }
2812
2813 /* void glValidateProgramPipeline ( GLuint pipeline ) */
2814 static void
2815 android_glValidateProgramPipeline__I
2816   (JNIEnv *_env, jobject _this, jint pipeline) {
2817     glValidateProgramPipeline(
2818         (GLuint)pipeline
2819     );
2820 }
2821
2822 #include <stdlib.h>
2823
2824 /* void glGetProgramPipelineInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
2825 static jstring android_glGetProgramPipelineInfoLog(JNIEnv *_env, jobject, jint shader) {
2826     GLint infoLen = 0;
2827     glGetProgramPipelineiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
2828     if (!infoLen) {
2829         return _env->NewStringUTF("");
2830     }
2831     char* buf = (char*) malloc(infoLen);
2832     if (buf == NULL) {
2833         jniThrowException(_env, "java/lang/OutOfMemoryError", "out of memory");
2834         return NULL;
2835     }
2836     glGetProgramPipelineInfoLog(shader, infoLen, NULL, buf);
2837     jstring result = _env->NewStringUTF(buf);
2838     free(buf);
2839     return result;
2840 }
2841 /* void glBindImageTexture ( GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format ) */
2842 static void
2843 android_glBindImageTexture__IIIZIII
2844   (JNIEnv *_env, jobject _this, jint unit, jint texture, jint level, jboolean layered, jint layer, jint access, jint format) {
2845     glBindImageTexture(
2846         (GLuint)unit,
2847         (GLuint)texture,
2848         (GLint)level,
2849         (GLboolean)layered,
2850         (GLint)layer,
2851         (GLenum)access,
2852         (GLenum)format
2853     );
2854 }
2855
2856 /* void glGetBooleani_v ( GLenum target, GLuint index, GLboolean *data ) */
2857 static void
2858 android_glGetBooleani_v__II_3ZI
2859   (JNIEnv *_env, jobject _this, jint target, jint index, jbooleanArray data_ref, jint offset) {
2860     jint _exception = 0;
2861     const char * _exceptionType = NULL;
2862     const char * _exceptionMessage = NULL;
2863     GLboolean *data_base = (GLboolean *) 0;
2864     jint _remaining;
2865     GLboolean *data = (GLboolean *) 0;
2866
2867     if (!data_ref) {
2868         _exception = 1;
2869         _exceptionType = "java/lang/IllegalArgumentException";
2870         _exceptionMessage = "data == null";
2871         goto exit;
2872     }
2873     if (offset < 0) {
2874         _exception = 1;
2875         _exceptionType = "java/lang/IllegalArgumentException";
2876         _exceptionMessage = "offset < 0";
2877         goto exit;
2878     }
2879     _remaining = _env->GetArrayLength(data_ref) - offset;
2880     data_base = (GLboolean *)
2881         _env->GetBooleanArrayElements(data_ref, (jboolean *)0);
2882     data = data_base + offset;
2883
2884     glGetBooleani_v(
2885         (GLenum)target,
2886         (GLuint)index,
2887         (GLboolean *)data
2888     );
2889
2890 exit:
2891     if (data_base) {
2892         _env->ReleaseBooleanArrayElements(data_ref, (jboolean*)data_base,
2893             _exception ? JNI_ABORT: 0);
2894     }
2895     if (_exception) {
2896         jniThrowException(_env, _exceptionType, _exceptionMessage);
2897     }
2898 }
2899
2900 /* void glGetBooleani_v ( GLenum target, GLuint index, GLboolean *data ) */
2901 static void
2902 android_glGetBooleani_v__IILjava_nio_IntBuffer_2
2903   (JNIEnv *_env, jobject _this, jint target, jint index, jobject data_buf) {
2904     jintArray _array = (jintArray) 0;
2905     jint _bufferOffset = (jint) 0;
2906     jint _remaining;
2907     GLboolean *data = (GLboolean *) 0;
2908
2909     data = (GLboolean *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
2910     if (data == NULL) {
2911         char * _dataBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
2912         data = (GLboolean *) (_dataBase + _bufferOffset);
2913     }
2914     glGetBooleani_v(
2915         (GLenum)target,
2916         (GLuint)index,
2917         (GLboolean *)data
2918     );
2919     if (_array) {
2920         _env->ReleaseIntArrayElements(_array, (jint*)data, 0);
2921     }
2922 }
2923
2924 /* void glMemoryBarrier ( GLbitfield barriers ) */
2925 static void
2926 android_glMemoryBarrier__I
2927   (JNIEnv *_env, jobject _this, jint barriers) {
2928     glMemoryBarrier(
2929         (GLbitfield)barriers
2930     );
2931 }
2932
2933 /* void glMemoryBarrierByRegion ( GLbitfield barriers ) */
2934 static void
2935 android_glMemoryBarrierByRegion__I
2936   (JNIEnv *_env, jobject _this, jint barriers) {
2937     glMemoryBarrierByRegion(
2938         (GLbitfield)barriers
2939     );
2940 }
2941
2942 /* void glTexStorage2DMultisample ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations ) */
2943 static void
2944 android_glTexStorage2DMultisample__IIIIIZ
2945   (JNIEnv *_env, jobject _this, jint target, jint samples, jint internalformat, jint width, jint height, jboolean fixedsamplelocations) {
2946     glTexStorage2DMultisample(
2947         (GLenum)target,
2948         (GLsizei)samples,
2949         (GLenum)internalformat,
2950         (GLsizei)width,
2951         (GLsizei)height,
2952         (GLboolean)fixedsamplelocations
2953     );
2954 }
2955
2956 /* void glGetMultisamplefv ( GLenum pname, GLuint index, GLfloat *val ) */
2957 static void
2958 android_glGetMultisamplefv__II_3FI
2959   (JNIEnv *_env, jobject _this, jint pname, jint index, jfloatArray val_ref, jint offset) {
2960     jint _exception = 0;
2961     const char * _exceptionType = NULL;
2962     const char * _exceptionMessage = NULL;
2963     GLfloat *val_base = (GLfloat *) 0;
2964     jint _remaining;
2965     GLfloat *val = (GLfloat *) 0;
2966
2967     if (!val_ref) {
2968         _exception = 1;
2969         _exceptionType = "java/lang/IllegalArgumentException";
2970         _exceptionMessage = "val == null";
2971         goto exit;
2972     }
2973     if (offset < 0) {
2974         _exception = 1;
2975         _exceptionType = "java/lang/IllegalArgumentException";
2976         _exceptionMessage = "offset < 0";
2977         goto exit;
2978     }
2979     _remaining = _env->GetArrayLength(val_ref) - offset;
2980     val_base = (GLfloat *)
2981         _env->GetFloatArrayElements(val_ref, (jboolean *)0);
2982     val = val_base + offset;
2983
2984     glGetMultisamplefv(
2985         (GLenum)pname,
2986         (GLuint)index,
2987         (GLfloat *)val
2988     );
2989
2990 exit:
2991     if (val_base) {
2992         _env->ReleaseFloatArrayElements(val_ref, (jfloat*)val_base,
2993             _exception ? JNI_ABORT: 0);
2994     }
2995     if (_exception) {
2996         jniThrowException(_env, _exceptionType, _exceptionMessage);
2997     }
2998 }
2999
3000 /* void glGetMultisamplefv ( GLenum pname, GLuint index, GLfloat *val ) */
3001 static void
3002 android_glGetMultisamplefv__IILjava_nio_FloatBuffer_2
3003   (JNIEnv *_env, jobject _this, jint pname, jint index, jobject val_buf) {
3004     jfloatArray _array = (jfloatArray) 0;
3005     jint _bufferOffset = (jint) 0;
3006     jint _remaining;
3007     GLfloat *val = (GLfloat *) 0;
3008
3009     val = (GLfloat *)getPointer(_env, val_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3010     if (val == NULL) {
3011         char * _valBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
3012         val = (GLfloat *) (_valBase + _bufferOffset);
3013     }
3014     glGetMultisamplefv(
3015         (GLenum)pname,
3016         (GLuint)index,
3017         (GLfloat *)val
3018     );
3019     if (_array) {
3020         _env->ReleaseFloatArrayElements(_array, (jfloat*)val, 0);
3021     }
3022 }
3023
3024 /* void glSampleMaski ( GLuint maskNumber, GLbitfield mask ) */
3025 static void
3026 android_glSampleMaski__II
3027   (JNIEnv *_env, jobject _this, jint maskNumber, jint mask) {
3028     glSampleMaski(
3029         (GLuint)maskNumber,
3030         (GLbitfield)mask
3031     );
3032 }
3033
3034 /* void glGetTexLevelParameteriv ( GLenum target, GLint level, GLenum pname, GLint *params ) */
3035 static void
3036 android_glGetTexLevelParameteriv__III_3II
3037   (JNIEnv *_env, jobject _this, jint target, jint level, jint pname, jintArray params_ref, jint offset) {
3038     jint _exception = 0;
3039     const char * _exceptionType = NULL;
3040     const char * _exceptionMessage = NULL;
3041     GLint *params_base = (GLint *) 0;
3042     jint _remaining;
3043     GLint *params = (GLint *) 0;
3044
3045     if (!params_ref) {
3046         _exception = 1;
3047         _exceptionType = "java/lang/IllegalArgumentException";
3048         _exceptionMessage = "params == null";
3049         goto exit;
3050     }
3051     if (offset < 0) {
3052         _exception = 1;
3053         _exceptionType = "java/lang/IllegalArgumentException";
3054         _exceptionMessage = "offset < 0";
3055         goto exit;
3056     }
3057     _remaining = _env->GetArrayLength(params_ref) - offset;
3058     params_base = (GLint *)
3059         _env->GetIntArrayElements(params_ref, (jboolean *)0);
3060     params = params_base + offset;
3061
3062     glGetTexLevelParameteriv(
3063         (GLenum)target,
3064         (GLint)level,
3065         (GLenum)pname,
3066         (GLint *)params
3067     );
3068
3069 exit:
3070     if (params_base) {
3071         _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
3072             _exception ? JNI_ABORT: 0);
3073     }
3074     if (_exception) {
3075         jniThrowException(_env, _exceptionType, _exceptionMessage);
3076     }
3077 }
3078
3079 /* void glGetTexLevelParameteriv ( GLenum target, GLint level, GLenum pname, GLint *params ) */
3080 static void
3081 android_glGetTexLevelParameteriv__IIILjava_nio_IntBuffer_2
3082   (JNIEnv *_env, jobject _this, jint target, jint level, jint pname, jobject params_buf) {
3083     jintArray _array = (jintArray) 0;
3084     jint _bufferOffset = (jint) 0;
3085     jint _remaining;
3086     GLint *params = (GLint *) 0;
3087
3088     params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3089     if (params == NULL) {
3090         char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
3091         params = (GLint *) (_paramsBase + _bufferOffset);
3092     }
3093     glGetTexLevelParameteriv(
3094         (GLenum)target,
3095         (GLint)level,
3096         (GLenum)pname,
3097         (GLint *)params
3098     );
3099     if (_array) {
3100         _env->ReleaseIntArrayElements(_array, (jint*)params, 0);
3101     }
3102 }
3103
3104 /* void glGetTexLevelParameterfv ( GLenum target, GLint level, GLenum pname, GLfloat *params ) */
3105 static void
3106 android_glGetTexLevelParameterfv__III_3FI
3107   (JNIEnv *_env, jobject _this, jint target, jint level, jint pname, jfloatArray params_ref, jint offset) {
3108     jint _exception = 0;
3109     const char * _exceptionType = NULL;
3110     const char * _exceptionMessage = NULL;
3111     GLfloat *params_base = (GLfloat *) 0;
3112     jint _remaining;
3113     GLfloat *params = (GLfloat *) 0;
3114
3115     if (!params_ref) {
3116         _exception = 1;
3117         _exceptionType = "java/lang/IllegalArgumentException";
3118         _exceptionMessage = "params == null";
3119         goto exit;
3120     }
3121     if (offset < 0) {
3122         _exception = 1;
3123         _exceptionType = "java/lang/IllegalArgumentException";
3124         _exceptionMessage = "offset < 0";
3125         goto exit;
3126     }
3127     _remaining = _env->GetArrayLength(params_ref) - offset;
3128     params_base = (GLfloat *)
3129         _env->GetFloatArrayElements(params_ref, (jboolean *)0);
3130     params = params_base + offset;
3131
3132     glGetTexLevelParameterfv(
3133         (GLenum)target,
3134         (GLint)level,
3135         (GLenum)pname,
3136         (GLfloat *)params
3137     );
3138
3139 exit:
3140     if (params_base) {
3141         _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
3142             _exception ? JNI_ABORT: 0);
3143     }
3144     if (_exception) {
3145         jniThrowException(_env, _exceptionType, _exceptionMessage);
3146     }
3147 }
3148
3149 /* void glGetTexLevelParameterfv ( GLenum target, GLint level, GLenum pname, GLfloat *params ) */
3150 static void
3151 android_glGetTexLevelParameterfv__IIILjava_nio_FloatBuffer_2
3152   (JNIEnv *_env, jobject _this, jint target, jint level, jint pname, jobject params_buf) {
3153     jfloatArray _array = (jfloatArray) 0;
3154     jint _bufferOffset = (jint) 0;
3155     jint _remaining;
3156     GLfloat *params = (GLfloat *) 0;
3157
3158     params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
3159     if (params == NULL) {
3160         char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
3161         params = (GLfloat *) (_paramsBase + _bufferOffset);
3162     }
3163     glGetTexLevelParameterfv(
3164         (GLenum)target,
3165         (GLint)level,
3166         (GLenum)pname,
3167         (GLfloat *)params
3168     );
3169     if (_array) {
3170         _env->ReleaseFloatArrayElements(_array, (jfloat*)params, 0);
3171     }
3172 }
3173
3174 /* void glBindVertexBuffer ( GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride ) */
3175 static void
3176 android_glBindVertexBuffer__IIJI
3177   (JNIEnv *_env, jobject _this, jint bindingindex, jint buffer, jlong offset, jint stride) {
3178     if (sizeof(GLintptr) != sizeof(jlong) && (offset < LONG_MIN || offset > LONG_MAX)) {
3179         jniThrowException(_env, "java/lang/IllegalArgumentException", "offset too large");
3180         return;
3181     }
3182     glBindVertexBuffer(
3183         (GLuint)bindingindex,
3184         (GLuint)buffer,
3185         (GLintptr)offset,
3186         (GLsizei)stride
3187     );
3188 }
3189 /* void glVertexAttribFormat ( GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset ) */
3190 static void
3191 android_glVertexAttribFormat__IIIZI
3192   (JNIEnv *_env, jobject _this, jint attribindex, jint size, jint type, jboolean normalized, jint relativeoffset) {
3193     glVertexAttribFormat(
3194         (GLuint)attribindex,
3195         (GLint)size,
3196         (GLenum)type,
3197         (GLboolean)normalized,
3198         (GLuint)relativeoffset
3199     );
3200 }
3201
3202 /* void glVertexAttribIFormat ( GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset ) */
3203 static void
3204 android_glVertexAttribIFormat__IIII
3205   (JNIEnv *_env, jobject _this, jint attribindex, jint size, jint type, jint relativeoffset) {
3206     glVertexAttribIFormat(
3207         (GLuint)attribindex,
3208         (GLint)size,
3209         (GLenum)type,
3210         (GLuint)relativeoffset
3211     );
3212 }
3213
3214 /* void glVertexAttribBinding ( GLuint attribindex, GLuint bindingindex ) */
3215 static void
3216 android_glVertexAttribBinding__II
3217   (JNIEnv *_env, jobject _this, jint attribindex, jint bindingindex) {
3218     glVertexAttribBinding(
3219         (GLuint)attribindex,
3220         (GLuint)bindingindex
3221     );
3222 }
3223
3224 /* void glVertexBindingDivisor ( GLuint bindingindex, GLuint divisor ) */
3225 static void
3226 android_glVertexBindingDivisor__II
3227   (JNIEnv *_env, jobject _this, jint bindingindex, jint divisor) {
3228     glVertexBindingDivisor(
3229         (GLuint)bindingindex,
3230         (GLuint)divisor
3231     );
3232 }
3233
3234 static const char *classPathName = "android/opengl/GLES31";
3235
3236 static const JNINativeMethod methods[] = {
3237 {"_nativeClassInit", "()V", (void*)nativeClassInit },
3238 {"glDispatchCompute", "(III)V", (void *) android_glDispatchCompute__III },
3239 {"glDispatchComputeIndirect", "(J)V", (void *) android_glDispatchComputeIndirect },
3240 {"glDrawArraysIndirect", "(IJ)V", (void *) android_glDrawArraysIndirect },
3241 {"glDrawElementsIndirect", "(IIJ)V", (void *) android_glDrawElementsIndirect },
3242 {"glFramebufferParameteri", "(III)V", (void *) android_glFramebufferParameteri__III },
3243 {"glGetFramebufferParameteriv", "(II[II)V", (void *) android_glGetFramebufferParameteriv__II_3II },
3244 {"glGetFramebufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetFramebufferParameteriv__IILjava_nio_IntBuffer_2 },
3245 {"glGetProgramInterfaceiv", "(III[II)V", (void *) android_glGetProgramInterfaceiv__III_3II },
3246 {"glGetProgramInterfaceiv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetProgramInterfaceiv__IIILjava_nio_IntBuffer_2 },
3247 {"glGetProgramResourceIndex", "(IILjava/lang/String;)I", (void *) android_glGetProgramResourceIndex__IILjava_lang_String_2 },
3248 {"glGetProgramResourceName", "(III)Ljava/lang/String;", (void *) android_glGetProgramResourceName },
3249 {"glGetProgramResourceiv", "(IIII[III[II[II)V", (void *) android_glGetProgramResourceiv__IIII_3III_3II_3II },
3250 {"glGetProgramResourceiv", "(IIIILjava/nio/IntBuffer;ILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetProgramResourceiv__IIIILjava_nio_IntBuffer_2ILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
3251 {"glGetProgramResourceLocation", "(IILjava/lang/String;)I", (void *) android_glGetProgramResourceLocation__IILjava_lang_String_2 },
3252 {"glUseProgramStages", "(III)V", (void *) android_glUseProgramStages__III },
3253 {"glActiveShaderProgram", "(II)V", (void *) android_glActiveShaderProgram__II },
3254 {"glCreateShaderProgramv", "(I[Ljava/lang/String;)I", (void *) android_glCreateShaderProgramv },
3255 {"glBindProgramPipeline", "(I)V", (void *) android_glBindProgramPipeline__I },
3256 {"glDeleteProgramPipelines", "(I[II)V", (void *) android_glDeleteProgramPipelines__I_3II },
3257 {"glDeleteProgramPipelines", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteProgramPipelines__ILjava_nio_IntBuffer_2 },
3258 {"glGenProgramPipelines", "(I[II)V", (void *) android_glGenProgramPipelines__I_3II },
3259 {"glGenProgramPipelines", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenProgramPipelines__ILjava_nio_IntBuffer_2 },
3260 {"glIsProgramPipeline", "(I)Z", (void *) android_glIsProgramPipeline__I },
3261 {"glGetProgramPipelineiv", "(II[II)V", (void *) android_glGetProgramPipelineiv__II_3II },
3262 {"glGetProgramPipelineiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetProgramPipelineiv__IILjava_nio_IntBuffer_2 },
3263 {"glProgramUniform1i", "(III)V", (void *) android_glProgramUniform1i__III },
3264 {"glProgramUniform2i", "(IIII)V", (void *) android_glProgramUniform2i__IIII },
3265 {"glProgramUniform3i", "(IIIII)V", (void *) android_glProgramUniform3i__IIIII },
3266 {"glProgramUniform4i", "(IIIIII)V", (void *) android_glProgramUniform4i__IIIIII },
3267 {"glProgramUniform1ui", "(III)V", (void *) android_glProgramUniform1ui__III },
3268 {"glProgramUniform2ui", "(IIII)V", (void *) android_glProgramUniform2ui__IIII },
3269 {"glProgramUniform3ui", "(IIIII)V", (void *) android_glProgramUniform3ui__IIIII },
3270 {"glProgramUniform4ui", "(IIIIII)V", (void *) android_glProgramUniform4ui__IIIIII },
3271 {"glProgramUniform1f", "(IIF)V", (void *) android_glProgramUniform1f__IIF },
3272 {"glProgramUniform2f", "(IIFF)V", (void *) android_glProgramUniform2f__IIFF },
3273 {"glProgramUniform3f", "(IIFFF)V", (void *) android_glProgramUniform3f__IIFFF },
3274 {"glProgramUniform4f", "(IIFFFF)V", (void *) android_glProgramUniform4f__IIFFFF },
3275 {"glProgramUniform1iv", "(III[II)V", (void *) android_glProgramUniform1iv__III_3II },
3276 {"glProgramUniform1iv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glProgramUniform1iv__IIILjava_nio_IntBuffer_2 },
3277 {"glProgramUniform2iv", "(III[II)V", (void *) android_glProgramUniform2iv__III_3II },
3278 {"glProgramUniform2iv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glProgramUniform2iv__IIILjava_nio_IntBuffer_2 },
3279 {"glProgramUniform3iv", "(III[II)V", (void *) android_glProgramUniform3iv__III_3II },
3280 {"glProgramUniform3iv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glProgramUniform3iv__IIILjava_nio_IntBuffer_2 },
3281 {"glProgramUniform4iv", "(III[II)V", (void *) android_glProgramUniform4iv__III_3II },
3282 {"glProgramUniform4iv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glProgramUniform4iv__IIILjava_nio_IntBuffer_2 },
3283 {"glProgramUniform1uiv", "(III[II)V", (void *) android_glProgramUniform1uiv__III_3II },
3284 {"glProgramUniform1uiv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glProgramUniform1uiv__IIILjava_nio_IntBuffer_2 },
3285 {"glProgramUniform2uiv", "(III[II)V", (void *) android_glProgramUniform2uiv__III_3II },
3286 {"glProgramUniform2uiv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glProgramUniform2uiv__IIILjava_nio_IntBuffer_2 },
3287 {"glProgramUniform3uiv", "(III[II)V", (void *) android_glProgramUniform3uiv__III_3II },
3288 {"glProgramUniform3uiv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glProgramUniform3uiv__IIILjava_nio_IntBuffer_2 },
3289 {"glProgramUniform4uiv", "(III[II)V", (void *) android_glProgramUniform4uiv__III_3II },
3290 {"glProgramUniform4uiv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glProgramUniform4uiv__IIILjava_nio_IntBuffer_2 },
3291 {"glProgramUniform1fv", "(III[FI)V", (void *) android_glProgramUniform1fv__III_3FI },
3292 {"glProgramUniform1fv", "(IIILjava/nio/FloatBuffer;)V", (void *) android_glProgramUniform1fv__IIILjava_nio_FloatBuffer_2 },
3293 {"glProgramUniform2fv", "(III[FI)V", (void *) android_glProgramUniform2fv__III_3FI },
3294 {"glProgramUniform2fv", "(IIILjava/nio/FloatBuffer;)V", (void *) android_glProgramUniform2fv__IIILjava_nio_FloatBuffer_2 },
3295 {"glProgramUniform3fv", "(III[FI)V", (void *) android_glProgramUniform3fv__III_3FI },
3296 {"glProgramUniform3fv", "(IIILjava/nio/FloatBuffer;)V", (void *) android_glProgramUniform3fv__IIILjava_nio_FloatBuffer_2 },
3297 {"glProgramUniform4fv", "(III[FI)V", (void *) android_glProgramUniform4fv__III_3FI },
3298 {"glProgramUniform4fv", "(IIILjava/nio/FloatBuffer;)V", (void *) android_glProgramUniform4fv__IIILjava_nio_FloatBuffer_2 },
3299 {"glProgramUniformMatrix2fv", "(IIIZ[FI)V", (void *) android_glProgramUniformMatrix2fv__IIIZ_3FI },
3300 {"glProgramUniformMatrix2fv", "(IIIZLjava/nio/FloatBuffer;)V", (void *) android_glProgramUniformMatrix2fv__IIIZLjava_nio_FloatBuffer_2 },
3301 {"glProgramUniformMatrix3fv", "(IIIZ[FI)V", (void *) android_glProgramUniformMatrix3fv__IIIZ_3FI },
3302 {"glProgramUniformMatrix3fv", "(IIIZLjava/nio/FloatBuffer;)V", (void *) android_glProgramUniformMatrix3fv__IIIZLjava_nio_FloatBuffer_2 },
3303 {"glProgramUniformMatrix4fv", "(IIIZ[FI)V", (void *) android_glProgramUniformMatrix4fv__IIIZ_3FI },
3304 {"glProgramUniformMatrix4fv", "(IIIZLjava/nio/FloatBuffer;)V", (void *) android_glProgramUniformMatrix4fv__IIIZLjava_nio_FloatBuffer_2 },
3305 {"glProgramUniformMatrix2x3fv", "(IIIZ[FI)V", (void *) android_glProgramUniformMatrix2x3fv__IIIZ_3FI },
3306 {"glProgramUniformMatrix2x3fv", "(IIIZLjava/nio/FloatBuffer;)V", (void *) android_glProgramUniformMatrix2x3fv__IIIZLjava_nio_FloatBuffer_2 },
3307 {"glProgramUniformMatrix3x2fv", "(IIIZ[FI)V", (void *) android_glProgramUniformMatrix3x2fv__IIIZ_3FI },
3308 {"glProgramUniformMatrix3x2fv", "(IIIZLjava/nio/FloatBuffer;)V", (void *) android_glProgramUniformMatrix3x2fv__IIIZLjava_nio_FloatBuffer_2 },
3309 {"glProgramUniformMatrix2x4fv", "(IIIZ[FI)V", (void *) android_glProgramUniformMatrix2x4fv__IIIZ_3FI },
3310 {"glProgramUniformMatrix2x4fv", "(IIIZLjava/nio/FloatBuffer;)V", (void *) android_glProgramUniformMatrix2x4fv__IIIZLjava_nio_FloatBuffer_2 },
3311 {"glProgramUniformMatrix4x2fv", "(IIIZ[FI)V", (void *) android_glProgramUniformMatrix4x2fv__IIIZ_3FI },
3312 {"glProgramUniformMatrix4x2fv", "(IIIZLjava/nio/FloatBuffer;)V", (void *) android_glProgramUniformMatrix4x2fv__IIIZLjava_nio_FloatBuffer_2 },
3313 {"glProgramUniformMatrix3x4fv", "(IIIZ[FI)V", (void *) android_glProgramUniformMatrix3x4fv__IIIZ_3FI },
3314 {"glProgramUniformMatrix3x4fv", "(IIIZLjava/nio/FloatBuffer;)V", (void *) android_glProgramUniformMatrix3x4fv__IIIZLjava_nio_FloatBuffer_2 },
3315 {"glProgramUniformMatrix4x3fv", "(IIIZ[FI)V", (void *) android_glProgramUniformMatrix4x3fv__IIIZ_3FI },
3316 {"glProgramUniformMatrix4x3fv", "(IIIZLjava/nio/FloatBuffer;)V", (void *) android_glProgramUniformMatrix4x3fv__IIIZLjava_nio_FloatBuffer_2 },
3317 {"glValidateProgramPipeline", "(I)V", (void *) android_glValidateProgramPipeline__I },
3318 {"glGetProgramPipelineInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetProgramPipelineInfoLog },
3319 {"glBindImageTexture", "(IIIZIII)V", (void *) android_glBindImageTexture__IIIZIII },
3320 {"glGetBooleani_v", "(II[ZI)V", (void *) android_glGetBooleani_v__II_3ZI },
3321 {"glGetBooleani_v", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBooleani_v__IILjava_nio_IntBuffer_2 },
3322 {"glMemoryBarrier", "(I)V", (void *) android_glMemoryBarrier__I },
3323 {"glMemoryBarrierByRegion", "(I)V", (void *) android_glMemoryBarrierByRegion__I },
3324 {"glTexStorage2DMultisample", "(IIIIIZ)V", (void *) android_glTexStorage2DMultisample__IIIIIZ },
3325 {"glGetMultisamplefv", "(II[FI)V", (void *) android_glGetMultisamplefv__II_3FI },
3326 {"glGetMultisamplefv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetMultisamplefv__IILjava_nio_FloatBuffer_2 },
3327 {"glSampleMaski", "(II)V", (void *) android_glSampleMaski__II },
3328 {"glGetTexLevelParameteriv", "(III[II)V", (void *) android_glGetTexLevelParameteriv__III_3II },
3329 {"glGetTexLevelParameteriv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetTexLevelParameteriv__IIILjava_nio_IntBuffer_2 },
3330 {"glGetTexLevelParameterfv", "(III[FI)V", (void *) android_glGetTexLevelParameterfv__III_3FI },
3331 {"glGetTexLevelParameterfv", "(IIILjava/nio/FloatBuffer;)V", (void *) android_glGetTexLevelParameterfv__IIILjava_nio_FloatBuffer_2 },
3332 {"glBindVertexBuffer", "(IIJI)V", (void *) android_glBindVertexBuffer__IIJI },
3333 {"glVertexAttribFormat", "(IIIZI)V", (void *) android_glVertexAttribFormat__IIIZI },
3334 {"glVertexAttribIFormat", "(IIII)V", (void *) android_glVertexAttribIFormat__IIII },
3335 {"glVertexAttribBinding", "(II)V", (void *) android_glVertexAttribBinding__II },
3336 {"glVertexBindingDivisor", "(II)V", (void *) android_glVertexBindingDivisor__II },
3337 };
3338
3339 int register_android_opengl_jni_GLES31(JNIEnv *_env)
3340 {
3341     int err;
3342     err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
3343     return err;
3344 }