blob: 99922cfe401df3cf2b9c0f476d34e0b996e08c98 [file] [log] [blame]
Jack Palevich560814f2009-11-19 16:34:55 +08001/*
2**
3** Copyright 2009, The Android Open Source Project
4**
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07005** Licensed under the Apache License, Version 2.0 (the "License");
6** you may not use this file except in compliance with the License.
7** You may obtain a copy of the License at
Jack Palevich560814f2009-11-19 16:34:55 +08008**
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07009** http://www.apache.org/licenses/LICENSE-2.0
Jack Palevich560814f2009-11-19 16:34:55 +080010**
Elliott Hughes24ce5fb2011-04-08 20:01:01 -070011** Unless required by applicable law or agreed to in writing, software
12** distributed under the License is distributed on an "AS IS" BASIS,
13** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14** See the License for the specific language governing permissions and
Jack Palevich560814f2009-11-19 16:34:55 +080015** limitations under the License.
16*/
17
18// This source file is automatically generated
19
Andreas Gampebfe63332014-11-12 14:12:45 -080020#pragma GCC diagnostic ignored "-Wunused-variable"
Andreas Gampebfe63332014-11-12 14:12:45 -080021#pragma GCC diagnostic ignored "-Wunused-function"
22
Mathias Agopian2ad04772013-02-23 03:12:30 -080023#include <GLES2/gl2.h>
24#include <GLES2/gl2ext.h>
25
Jesse Hall9626f822014-05-19 20:57:49 -070026#include <jni.h>
Steven Moreland2279b252017-07-19 09:50:45 -070027#include <nativehelper/JNIHelp.h>
Jack Palevich560814f2009-11-19 16:34:55 +080028#include <android_runtime/AndroidRuntime.h>
29#include <utils/misc.h>
Jack Palevich560814f2009-11-19 16:34:55 +080030#include <assert.h>
Jack Palevich560814f2009-11-19 16:34:55 +080031
32static int initialized = 0;
33
34static jclass nioAccessClass;
35static jclass bufferClass;
Jack Palevich560814f2009-11-19 16:34:55 +080036static jmethodID getBasePointerID;
37static jmethodID getBaseArrayID;
38static jmethodID getBaseArrayOffsetID;
39static jfieldID positionID;
40static jfieldID limitID;
41static jfieldID elementSizeShiftID;
42
Mathias Agopian2ad04772013-02-23 03:12:30 -080043
44/* special calls implemented in Android's GLES wrapper used to more
45 * efficiently bound-check passed arrays */
46extern "C" {
47#ifdef GL_VERSION_ES_CM_1_1
48GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
49 const GLvoid *ptr, GLsizei count);
50GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
51 const GLvoid *pointer, GLsizei count);
52GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
53 GLsizei stride, const GLvoid *pointer, GLsizei count);
54GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
55 GLsizei stride, const GLvoid *pointer, GLsizei count);
56GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
57 GLsizei stride, const GLvoid *pointer, GLsizei count);
58GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
59 GLsizei stride, const GLvoid *pointer, GLsizei count);
60GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
61 GLsizei stride, const GLvoid *pointer, GLsizei count);
62#endif
63#ifdef GL_ES_VERSION_2_0
64static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type,
65 GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) {
66 glVertexAttribPointer(indx, size, type, normalized, stride, pointer);
67}
68#endif
Andy McFaddencee51982013-04-25 16:08:31 -070069#ifdef GL_ES_VERSION_3_0
70static void glVertexAttribIPointerBounds(GLuint indx, GLint size, GLenum type,
71 GLsizei stride, const GLvoid *pointer, GLsizei count) {
72 glVertexAttribIPointer(indx, size, type, stride, pointer);
73}
74#endif
Mathias Agopian2ad04772013-02-23 03:12:30 -080075}
76
Jack Palevich560814f2009-11-19 16:34:55 +080077/* Cache method IDs each time the class is loaded. */
78
79static void
Elliott Hughes24ce5fb2011-04-08 20:01:01 -070080nativeClassInit(JNIEnv *_env, jclass glImplClass)
Jack Palevich560814f2009-11-19 16:34:55 +080081{
82 jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess");
83 nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal);
84
85 jclass bufferClassLocal = _env->FindClass("java/nio/Buffer");
86 bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal);
87
88 getBasePointerID = _env->GetStaticMethodID(nioAccessClass,
89 "getBasePointer", "(Ljava/nio/Buffer;)J");
90 getBaseArrayID = _env->GetStaticMethodID(nioAccessClass,
91 "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;");
92 getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass,
93 "getBaseArrayOffset", "(Ljava/nio/Buffer;)I");
94
95 positionID = _env->GetFieldID(bufferClass, "position", "I");
96 limitID = _env->GetFieldID(bufferClass, "limit", "I");
97 elementSizeShiftID =
98 _env->GetFieldID(bufferClass, "_elementSizeShift", "I");
99}
100
Jack Palevich560814f2009-11-19 16:34:55 +0800101static void *
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700102getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
Jack Palevich560814f2009-11-19 16:34:55 +0800103{
104 jint position;
105 jint limit;
106 jint elementSizeShift;
107 jlong pointer;
Jack Palevich560814f2009-11-19 16:34:55 +0800108
109 position = _env->GetIntField(buffer, positionID);
110 limit = _env->GetIntField(buffer, limitID);
111 elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
112 *remaining = (limit - position) << elementSizeShift;
113 pointer = _env->CallStaticLongMethod(nioAccessClass,
114 getBasePointerID, buffer);
115 if (pointer != 0L) {
116 *array = NULL;
Ashok Bhat01c26ea2014-02-24 09:49:07 +0000117 return reinterpret_cast<void*>(pointer);
Jack Palevich560814f2009-11-19 16:34:55 +0800118 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700119
Jack Palevich560814f2009-11-19 16:34:55 +0800120 *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass,
121 getBaseArrayID, buffer);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700122 *offset = _env->CallStaticIntMethod(nioAccessClass,
Jack Palevich560814f2009-11-19 16:34:55 +0800123 getBaseArrayOffsetID, buffer);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700124
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700125 return NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800126}
127
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700128class ByteArrayGetter {
129public:
130 static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
131 return _env->GetByteArrayElements(array, is_copy);
132 }
133};
134class BooleanArrayGetter {
135public:
136 static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
137 return _env->GetBooleanArrayElements(array, is_copy);
138 }
139};
140class CharArrayGetter {
141public:
142 static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
143 return _env->GetCharArrayElements(array, is_copy);
144 }
145};
146class ShortArrayGetter {
147public:
148 static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
149 return _env->GetShortArrayElements(array, is_copy);
150 }
151};
152class IntArrayGetter {
153public:
154 static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
155 return _env->GetIntArrayElements(array, is_copy);
156 }
157};
158class LongArrayGetter {
159public:
160 static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
161 return _env->GetLongArrayElements(array, is_copy);
162 }
163};
164class FloatArrayGetter {
165public:
166 static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
167 return _env->GetFloatArrayElements(array, is_copy);
168 }
169};
170class DoubleArrayGetter {
171public:
172 static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
173 return _env->GetDoubleArrayElements(array, is_copy);
174 }
175};
176
177template<typename JTYPEARRAY, typename ARRAYGETTER>
178static void*
179getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
180 return ARRAYGETTER::Get(_env, array, is_copy);
181}
182
183class ByteArrayReleaser {
184public:
185 static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
186 _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
187 }
188};
189class BooleanArrayReleaser {
190public:
191 static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
192 _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
193 }
194};
195class CharArrayReleaser {
196public:
197 static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
198 _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
199 }
200};
201class ShortArrayReleaser {
202public:
203 static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
204 _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
205 }
206};
207class IntArrayReleaser {
208public:
209 static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
210 _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
211 }
212};
213class LongArrayReleaser {
214public:
215 static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
216 _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
217 }
218};
219class FloatArrayReleaser {
220public:
221 static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
222 _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
223 }
224};
225class DoubleArrayReleaser {
226public:
227 static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
228 _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
229 }
230};
231
232template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
233static void
234releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
235 ARRAYRELEASER::Release(_env, array, data, commit);
236}
237
Jack Palevich560814f2009-11-19 16:34:55 +0800238static void
239releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
240{
241 _env->ReleasePrimitiveArrayCritical(array, data,
Mathias Agopian2ad04772013-02-23 03:12:30 -0800242 commit ? 0 : JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +0800243}
244
245static void *
246getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
247 char* buf = (char*) _env->GetDirectBufferAddress(buffer);
248 if (buf) {
249 jint position = _env->GetIntField(buffer, positionID);
250 jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID);
251 buf += position << elementSizeShift;
252 } else {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700253 jniThrowException(_env, "java/lang/IllegalArgumentException",
254 "Must use a native order direct Buffer");
Jack Palevich560814f2009-11-19 16:34:55 +0800255 }
256 return (void*) buf;
257}
258
Mathias Agopian2ad04772013-02-23 03:12:30 -0800259// --------------------------------------------------------------------------
260
261/*
262 * returns the number of values glGet returns for a given pname.
263 *
264 * The code below is written such that pnames requiring only one values
265 * are the default (and are not explicitely tested for). This makes the
266 * checking code much shorter/readable/efficient.
267 *
268 * This means that unknown pnames (e.g.: extensions) will default to 1. If
269 * that unknown pname needs more than 1 value, then the validation check
270 * is incomplete and the app may crash if it passed the wrong number params.
271 */
272static int getNeededCount(GLint pname) {
273 int needed = 1;
Romain Guydc43a6c2017-02-17 19:54:25 -0800274#ifdef GL_ES_VERSION_3_0
275 // GLES 3.x pnames
276 switch (pname) {
277 case GL_MAX_VIEWPORT_DIMS:
278 needed = 2;
279 break;
280
281 case GL_PROGRAM_BINARY_FORMATS:
282 glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &needed);
283 break;
284 }
285#endif
286
Mathias Agopian2ad04772013-02-23 03:12:30 -0800287#ifdef GL_ES_VERSION_2_0
288 // GLES 2.x pnames
289 switch (pname) {
290 case GL_ALIASED_LINE_WIDTH_RANGE:
291 case GL_ALIASED_POINT_SIZE_RANGE:
292 needed = 2;
293 break;
294
295 case GL_BLEND_COLOR:
296 case GL_COLOR_CLEAR_VALUE:
297 case GL_COLOR_WRITEMASK:
298 case GL_SCISSOR_BOX:
299 case GL_VIEWPORT:
300 needed = 4;
301 break;
302
303 case GL_COMPRESSED_TEXTURE_FORMATS:
304 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
305 break;
306
307 case GL_SHADER_BINARY_FORMATS:
308 glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed);
309 break;
310 }
311#endif
312
313#ifdef GL_VERSION_ES_CM_1_1
314 // GLES 1.x pnames
315 switch (pname) {
316 case GL_ALIASED_LINE_WIDTH_RANGE:
317 case GL_ALIASED_POINT_SIZE_RANGE:
318 case GL_DEPTH_RANGE:
319 case GL_SMOOTH_LINE_WIDTH_RANGE:
320 case GL_SMOOTH_POINT_SIZE_RANGE:
321 needed = 2;
322 break;
323
324 case GL_CURRENT_NORMAL:
325 case GL_POINT_DISTANCE_ATTENUATION:
326 needed = 3;
327 break;
328
329 case GL_COLOR_CLEAR_VALUE:
330 case GL_COLOR_WRITEMASK:
331 case GL_CURRENT_COLOR:
332 case GL_CURRENT_TEXTURE_COORDS:
333 case GL_FOG_COLOR:
334 case GL_LIGHT_MODEL_AMBIENT:
335 case GL_SCISSOR_BOX:
336 case GL_VIEWPORT:
337 needed = 4;
338 break;
339
340 case GL_MODELVIEW_MATRIX:
341 case GL_PROJECTION_MATRIX:
342 case GL_TEXTURE_MATRIX:
343 needed = 16;
344 break;
345
346 case GL_COMPRESSED_TEXTURE_FORMATS:
347 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
348 break;
349 }
350#endif
351 return needed;
Jack Palevich560814f2009-11-19 16:34:55 +0800352}
353
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700354template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
355 typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
Mathias Agopian2ad04772013-02-23 03:12:30 -0800356static void
357get
358 (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
359 jint _exception = 0;
360 const char * _exceptionType;
361 const char * _exceptionMessage;
362 CTYPE *params_base = (CTYPE *) 0;
363 jint _remaining;
364 CTYPE *params = (CTYPE *) 0;
365 int _needed = 0;
366
367 if (!params_ref) {
368 _exception = 1;
369 _exceptionType = "java/lang/IllegalArgumentException";
370 _exceptionMessage = "params == null";
371 goto exit;
372 }
373 if (offset < 0) {
374 _exception = 1;
375 _exceptionType = "java/lang/IllegalArgumentException";
376 _exceptionMessage = "offset < 0";
377 goto exit;
378 }
379 _remaining = _env->GetArrayLength(params_ref) - offset;
380 _needed = getNeededCount(pname);
381 // if we didn't find this pname, we just assume the user passed
382 // an array of the right size -- this might happen with extensions
383 // or if we forget an enum here.
384 if (_remaining < _needed) {
385 _exception = 1;
386 _exceptionType = "java/lang/IllegalArgumentException";
387 _exceptionMessage = "length - offset < needed";
388 goto exit;
389 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700390 params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
391 _env, params_ref, (jboolean *)0);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800392 params = params_base + offset;
393
394 GET(
395 (GLenum)pname,
396 (CTYPE *)params
397 );
398
399exit:
400 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700401 releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
402 _env, params_ref, params_base, !_exception);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800403 }
404 if (_exception) {
405 jniThrowException(_env, _exceptionType, _exceptionMessage);
406 }
407}
408
409
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700410template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
411 typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
Mathias Agopian2ad04772013-02-23 03:12:30 -0800412static void
413getarray
414 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
415 jint _exception = 0;
416 const char * _exceptionType;
417 const char * _exceptionMessage;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700418 JTYPEARRAY _array = (JTYPEARRAY) 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800419 jint _bufferOffset = (jint) 0;
420 jint _remaining;
421 CTYPE *params = (CTYPE *) 0;
422 int _needed = 0;
423
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700424 params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Andy McFaddencee51982013-04-25 16:08:31 -0700425 _remaining /= sizeof(CTYPE); // convert from bytes to item count
Mathias Agopian2ad04772013-02-23 03:12:30 -0800426 _needed = getNeededCount(pname);
427 // if we didn't find this pname, we just assume the user passed
428 // an array of the right size -- this might happen with extensions
429 // or if we forget an enum here.
430 if (_needed>0 && _remaining < _needed) {
431 _exception = 1;
432 _exceptionType = "java/lang/IllegalArgumentException";
433 _exceptionMessage = "remaining() < needed";
434 goto exit;
435 }
436 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700437 char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
438 _env, _array, (jboolean *) 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800439 params = (CTYPE *) (_paramsBase + _bufferOffset);
440 }
441 GET(
442 (GLenum)pname,
443 (CTYPE *)params
444 );
445
446exit:
447 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700448 releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
449 _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800450 }
451 if (_exception) {
452 jniThrowException(_env, _exceptionType, _exceptionMessage);
453 }
Jack Palevich560814f2009-11-19 16:34:55 +0800454}
455
456// --------------------------------------------------------------------------
Jack Palevich560814f2009-11-19 16:34:55 +0800457/* void glActiveTexture ( GLenum texture ) */
458static void
459android_glActiveTexture__I
460 (JNIEnv *_env, jobject _this, jint texture) {
461 glActiveTexture(
462 (GLenum)texture
463 );
464}
465
466/* void glAttachShader ( GLuint program, GLuint shader ) */
467static void
468android_glAttachShader__II
469 (JNIEnv *_env, jobject _this, jint program, jint shader) {
470 glAttachShader(
471 (GLuint)program,
472 (GLuint)shader
473 );
474}
475
476/* void glBindAttribLocation ( GLuint program, GLuint index, const char *name ) */
477static void
478android_glBindAttribLocation__IILjava_lang_String_2
479 (JNIEnv *_env, jobject _this, jint program, jint index, jstring name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700480 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800481 const char * _exceptionType = NULL;
482 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800483 const char* _nativename = 0;
484
485 if (!name) {
Elliott Hughes428d3fc2013-09-24 17:15:41 -0700486 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700487 _exceptionType = "java/lang/IllegalArgumentException";
488 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +0800489 goto exit;
490 }
491 _nativename = _env->GetStringUTFChars(name, 0);
492
493 glBindAttribLocation(
494 (GLuint)program,
495 (GLuint)index,
496 (char *)_nativename
497 );
498
499exit:
500 if (_nativename) {
501 _env->ReleaseStringUTFChars(name, _nativename);
502 }
503
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700504 if (_exception) {
505 jniThrowException(_env, _exceptionType, _exceptionMessage);
506 }
Jack Palevich560814f2009-11-19 16:34:55 +0800507}
508
509/* void glBindBuffer ( GLenum target, GLuint buffer ) */
510static void
511android_glBindBuffer__II
512 (JNIEnv *_env, jobject _this, jint target, jint buffer) {
513 glBindBuffer(
514 (GLenum)target,
515 (GLuint)buffer
516 );
517}
518
519/* void glBindFramebuffer ( GLenum target, GLuint framebuffer ) */
520static void
521android_glBindFramebuffer__II
522 (JNIEnv *_env, jobject _this, jint target, jint framebuffer) {
523 glBindFramebuffer(
524 (GLenum)target,
525 (GLuint)framebuffer
526 );
527}
528
529/* void glBindRenderbuffer ( GLenum target, GLuint renderbuffer ) */
530static void
531android_glBindRenderbuffer__II
532 (JNIEnv *_env, jobject _this, jint target, jint renderbuffer) {
533 glBindRenderbuffer(
534 (GLenum)target,
535 (GLuint)renderbuffer
536 );
537}
538
539/* void glBindTexture ( GLenum target, GLuint texture ) */
540static void
541android_glBindTexture__II
542 (JNIEnv *_env, jobject _this, jint target, jint texture) {
543 glBindTexture(
544 (GLenum)target,
545 (GLuint)texture
546 );
547}
548
549/* void glBlendColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
550static void
551android_glBlendColor__FFFF
552 (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
553 glBlendColor(
554 (GLclampf)red,
555 (GLclampf)green,
556 (GLclampf)blue,
557 (GLclampf)alpha
558 );
559}
560
561/* void glBlendEquation ( GLenum mode ) */
562static void
563android_glBlendEquation__I
564 (JNIEnv *_env, jobject _this, jint mode) {
Jack Palevich73108672011-03-28 14:49:12 -0700565 glBlendEquation(
566 (GLenum)mode
567 );
Jack Palevich560814f2009-11-19 16:34:55 +0800568}
569
570/* void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha ) */
571static void
572android_glBlendEquationSeparate__II
573 (JNIEnv *_env, jobject _this, jint modeRGB, jint modeAlpha) {
Jack Palevich73108672011-03-28 14:49:12 -0700574 glBlendEquationSeparate(
575 (GLenum)modeRGB,
576 (GLenum)modeAlpha
577 );
Jack Palevich560814f2009-11-19 16:34:55 +0800578}
579
580/* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */
581static void
582android_glBlendFunc__II
583 (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) {
584 glBlendFunc(
585 (GLenum)sfactor,
586 (GLenum)dfactor
587 );
588}
589
590/* void glBlendFuncSeparate ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) */
591static void
592android_glBlendFuncSeparate__IIII
593 (JNIEnv *_env, jobject _this, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) {
Jack Palevich73108672011-03-28 14:49:12 -0700594 glBlendFuncSeparate(
595 (GLenum)srcRGB,
596 (GLenum)dstRGB,
597 (GLenum)srcAlpha,
598 (GLenum)dstAlpha
599 );
Jack Palevich560814f2009-11-19 16:34:55 +0800600}
601
602/* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */
603static void
604android_glBufferData__IILjava_nio_Buffer_2I
605 (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700606 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800607 const char * _exceptionType = NULL;
608 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800609 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700610 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800611 jint _remaining;
612 GLvoid *data = (GLvoid *) 0;
613
614 if (data_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700615 data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +0800616 if (_remaining < size) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700617 _exception = 1;
618 _exceptionType = "java/lang/IllegalArgumentException";
619 _exceptionMessage = "remaining() < size < needed";
Jack Palevich560814f2009-11-19 16:34:55 +0800620 goto exit;
621 }
622 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -0700623 if (data_buf && data == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700624 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
625 data = (GLvoid *) (_dataBase + _bufferOffset);
626 }
Jack Palevich560814f2009-11-19 16:34:55 +0800627 glBufferData(
628 (GLenum)target,
629 (GLsizeiptr)size,
630 (GLvoid *)data,
631 (GLenum)usage
632 );
633
634exit:
635 if (_array) {
636 releasePointer(_env, _array, data, JNI_FALSE);
637 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700638 if (_exception) {
639 jniThrowException(_env, _exceptionType, _exceptionMessage);
640 }
Jack Palevich560814f2009-11-19 16:34:55 +0800641}
642
643/* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */
644static void
645android_glBufferSubData__IIILjava_nio_Buffer_2
646 (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700647 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800648 const char * _exceptionType = NULL;
649 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800650 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700651 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800652 jint _remaining;
653 GLvoid *data = (GLvoid *) 0;
654
Romain Guy84cac202016-12-05 12:26:02 -0800655 if (!data_buf) {
656 _exception = 1;
657 _exceptionType = "java/lang/IllegalArgumentException";
658 _exceptionMessage = "data == null";
659 goto exit;
660 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700661 data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +0800662 if (_remaining < size) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700663 _exception = 1;
664 _exceptionType = "java/lang/IllegalArgumentException";
665 _exceptionMessage = "remaining() < size < needed";
Jack Palevich560814f2009-11-19 16:34:55 +0800666 goto exit;
667 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700668 if (data == NULL) {
669 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
670 data = (GLvoid *) (_dataBase + _bufferOffset);
671 }
Jack Palevich560814f2009-11-19 16:34:55 +0800672 glBufferSubData(
673 (GLenum)target,
674 (GLintptr)offset,
675 (GLsizeiptr)size,
676 (GLvoid *)data
677 );
678
679exit:
680 if (_array) {
681 releasePointer(_env, _array, data, JNI_FALSE);
682 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700683 if (_exception) {
684 jniThrowException(_env, _exceptionType, _exceptionMessage);
685 }
Jack Palevich560814f2009-11-19 16:34:55 +0800686}
687
688/* GLenum glCheckFramebufferStatus ( GLenum target ) */
689static jint
690android_glCheckFramebufferStatus__I
691 (JNIEnv *_env, jobject _this, jint target) {
692 GLenum _returnValue;
693 _returnValue = glCheckFramebufferStatus(
694 (GLenum)target
695 );
Andy McFaddencee51982013-04-25 16:08:31 -0700696 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +0800697}
698
699/* void glClear ( GLbitfield mask ) */
700static void
701android_glClear__I
702 (JNIEnv *_env, jobject _this, jint mask) {
703 glClear(
704 (GLbitfield)mask
705 );
706}
707
708/* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
709static void
710android_glClearColor__FFFF
711 (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
712 glClearColor(
713 (GLclampf)red,
714 (GLclampf)green,
715 (GLclampf)blue,
716 (GLclampf)alpha
717 );
718}
719
720/* void glClearDepthf ( GLclampf depth ) */
721static void
722android_glClearDepthf__F
723 (JNIEnv *_env, jobject _this, jfloat depth) {
724 glClearDepthf(
725 (GLclampf)depth
726 );
727}
728
729/* void glClearStencil ( GLint s ) */
730static void
731android_glClearStencil__I
732 (JNIEnv *_env, jobject _this, jint s) {
733 glClearStencil(
734 (GLint)s
735 );
736}
737
738/* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */
739static void
740android_glColorMask__ZZZZ
741 (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) {
742 glColorMask(
743 (GLboolean)red,
744 (GLboolean)green,
745 (GLboolean)blue,
746 (GLboolean)alpha
747 );
748}
749
750/* void glCompileShader ( GLuint shader ) */
751static void
752android_glCompileShader__I
753 (JNIEnv *_env, jobject _this, jint shader) {
754 glCompileShader(
755 (GLuint)shader
756 );
757}
758
759/* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */
760static void
761android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2
762 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) {
Romain Guy84cac202016-12-05 12:26:02 -0800763 jint _exception = 0;
764 const char * _exceptionType = NULL;
765 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800766 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700767 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800768 jint _remaining;
769 GLvoid *data = (GLvoid *) 0;
770
Romain Guy84cac202016-12-05 12:26:02 -0800771 if (!data_buf) {
772 _exception = 1;
773 _exceptionType = "java/lang/IllegalArgumentException";
774 _exceptionMessage = "data == null";
775 goto exit;
776 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700777 data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700778 if (data == NULL) {
779 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
780 data = (GLvoid *) (_dataBase + _bufferOffset);
781 }
Jack Palevich560814f2009-11-19 16:34:55 +0800782 glCompressedTexImage2D(
783 (GLenum)target,
784 (GLint)level,
785 (GLenum)internalformat,
786 (GLsizei)width,
787 (GLsizei)height,
788 (GLint)border,
789 (GLsizei)imageSize,
790 (GLvoid *)data
791 );
Romain Guy84cac202016-12-05 12:26:02 -0800792
793exit:
Jack Palevich560814f2009-11-19 16:34:55 +0800794 if (_array) {
795 releasePointer(_env, _array, data, JNI_FALSE);
796 }
Romain Guy84cac202016-12-05 12:26:02 -0800797 if (_exception) {
798 jniThrowException(_env, _exceptionType, _exceptionMessage);
799 }
Jack Palevich560814f2009-11-19 16:34:55 +0800800}
801
802/* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */
803static void
804android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
805 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) {
Romain Guy84cac202016-12-05 12:26:02 -0800806 jint _exception = 0;
807 const char * _exceptionType = NULL;
808 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800809 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700810 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800811 jint _remaining;
812 GLvoid *data = (GLvoid *) 0;
813
Romain Guy84cac202016-12-05 12:26:02 -0800814 if (!data_buf) {
815 _exception = 1;
816 _exceptionType = "java/lang/IllegalArgumentException";
817 _exceptionMessage = "data == null";
818 goto exit;
819 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700820 data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700821 if (data == NULL) {
822 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
823 data = (GLvoid *) (_dataBase + _bufferOffset);
824 }
Jack Palevich560814f2009-11-19 16:34:55 +0800825 glCompressedTexSubImage2D(
826 (GLenum)target,
827 (GLint)level,
828 (GLint)xoffset,
829 (GLint)yoffset,
830 (GLsizei)width,
831 (GLsizei)height,
832 (GLenum)format,
833 (GLsizei)imageSize,
834 (GLvoid *)data
835 );
Romain Guy84cac202016-12-05 12:26:02 -0800836
837exit:
Jack Palevich560814f2009-11-19 16:34:55 +0800838 if (_array) {
839 releasePointer(_env, _array, data, JNI_FALSE);
840 }
Romain Guy84cac202016-12-05 12:26:02 -0800841 if (_exception) {
842 jniThrowException(_env, _exceptionType, _exceptionMessage);
843 }
Jack Palevich560814f2009-11-19 16:34:55 +0800844}
845
846/* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */
847static void
848android_glCopyTexImage2D__IIIIIIII
849 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) {
850 glCopyTexImage2D(
851 (GLenum)target,
852 (GLint)level,
853 (GLenum)internalformat,
854 (GLint)x,
855 (GLint)y,
856 (GLsizei)width,
857 (GLsizei)height,
858 (GLint)border
859 );
860}
861
862/* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */
863static void
864android_glCopyTexSubImage2D__IIIIIIII
865 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) {
866 glCopyTexSubImage2D(
867 (GLenum)target,
868 (GLint)level,
869 (GLint)xoffset,
870 (GLint)yoffset,
871 (GLint)x,
872 (GLint)y,
873 (GLsizei)width,
874 (GLsizei)height
875 );
876}
877
878/* GLuint glCreateProgram ( void ) */
879static jint
880android_glCreateProgram__
881 (JNIEnv *_env, jobject _this) {
882 GLuint _returnValue;
883 _returnValue = glCreateProgram();
Andy McFaddencee51982013-04-25 16:08:31 -0700884 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +0800885}
886
887/* GLuint glCreateShader ( GLenum type ) */
888static jint
889android_glCreateShader__I
890 (JNIEnv *_env, jobject _this, jint type) {
891 GLuint _returnValue;
892 _returnValue = glCreateShader(
893 (GLenum)type
894 );
Andy McFaddencee51982013-04-25 16:08:31 -0700895 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +0800896}
897
898/* void glCullFace ( GLenum mode ) */
899static void
900android_glCullFace__I
901 (JNIEnv *_env, jobject _this, jint mode) {
902 glCullFace(
903 (GLenum)mode
904 );
905}
906
907/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
908static void
909android_glDeleteBuffers__I_3II
910 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700911 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800912 const char * _exceptionType = NULL;
913 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800914 GLuint *buffers_base = (GLuint *) 0;
915 jint _remaining;
916 GLuint *buffers = (GLuint *) 0;
917
918 if (!buffers_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700919 _exception = 1;
920 _exceptionType = "java/lang/IllegalArgumentException";
921 _exceptionMessage = "buffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +0800922 goto exit;
923 }
924 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700925 _exception = 1;
926 _exceptionType = "java/lang/IllegalArgumentException";
927 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +0800928 goto exit;
929 }
930 _remaining = _env->GetArrayLength(buffers_ref) - offset;
931 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700932 _exception = 1;
933 _exceptionType = "java/lang/IllegalArgumentException";
934 _exceptionMessage = "length - offset < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +0800935 goto exit;
936 }
937 buffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700938 _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +0800939 buffers = buffers_base + offset;
940
941 glDeleteBuffers(
942 (GLsizei)n,
943 (GLuint *)buffers
944 );
945
946exit:
947 if (buffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700948 _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
Jack Palevich560814f2009-11-19 16:34:55 +0800949 JNI_ABORT);
950 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700951 if (_exception) {
952 jniThrowException(_env, _exceptionType, _exceptionMessage);
953 }
Jack Palevich560814f2009-11-19 16:34:55 +0800954}
955
956/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
957static void
958android_glDeleteBuffers__ILjava_nio_IntBuffer_2
959 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700960 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800961 const char * _exceptionType = NULL;
962 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700963 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700964 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800965 jint _remaining;
966 GLuint *buffers = (GLuint *) 0;
967
Romain Guy84cac202016-12-05 12:26:02 -0800968 if (!buffers_buf) {
969 _exception = 1;
970 _exceptionType = "java/lang/IllegalArgumentException";
971 _exceptionMessage = "buffers == null";
972 goto exit;
973 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700974 buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +0800975 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700976 _exception = 1;
977 _exceptionType = "java/lang/IllegalArgumentException";
978 _exceptionMessage = "remaining() < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +0800979 goto exit;
980 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700981 if (buffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700982 char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700983 buffers = (GLuint *) (_buffersBase + _bufferOffset);
984 }
Jack Palevich560814f2009-11-19 16:34:55 +0800985 glDeleteBuffers(
986 (GLsizei)n,
987 (GLuint *)buffers
988 );
989
990exit:
991 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700992 _env->ReleaseIntArrayElements(_array, (jint*)buffers, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +0800993 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700994 if (_exception) {
995 jniThrowException(_env, _exceptionType, _exceptionMessage);
996 }
Jack Palevich560814f2009-11-19 16:34:55 +0800997}
998
999/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */
1000static void
1001android_glDeleteFramebuffers__I_3II
1002 (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001003 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001004 const char * _exceptionType = NULL;
1005 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001006 GLuint *framebuffers_base = (GLuint *) 0;
1007 jint _remaining;
1008 GLuint *framebuffers = (GLuint *) 0;
1009
1010 if (!framebuffers_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001011 _exception = 1;
1012 _exceptionType = "java/lang/IllegalArgumentException";
1013 _exceptionMessage = "framebuffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001014 goto exit;
1015 }
1016 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001017 _exception = 1;
1018 _exceptionType = "java/lang/IllegalArgumentException";
1019 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001020 goto exit;
1021 }
1022 _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001023 if (_remaining < n) {
1024 _exception = 1;
1025 _exceptionType = "java/lang/IllegalArgumentException";
1026 _exceptionMessage = "length - offset < n < needed";
1027 goto exit;
1028 }
Jack Palevich560814f2009-11-19 16:34:55 +08001029 framebuffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001030 _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001031 framebuffers = framebuffers_base + offset;
1032
1033 glDeleteFramebuffers(
1034 (GLsizei)n,
1035 (GLuint *)framebuffers
1036 );
1037
1038exit:
1039 if (framebuffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001040 _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001041 JNI_ABORT);
1042 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001043 if (_exception) {
1044 jniThrowException(_env, _exceptionType, _exceptionMessage);
1045 }
Jack Palevich560814f2009-11-19 16:34:55 +08001046}
1047
1048/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */
1049static void
1050android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2
1051 (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001052 jint _exception = 0;
1053 const char * _exceptionType = NULL;
1054 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001055 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001056 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001057 jint _remaining;
1058 GLuint *framebuffers = (GLuint *) 0;
1059
Romain Guy84cac202016-12-05 12:26:02 -08001060 if (!framebuffers_buf) {
1061 _exception = 1;
1062 _exceptionType = "java/lang/IllegalArgumentException";
1063 _exceptionMessage = "framebuffers == null";
1064 goto exit;
1065 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001066 framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001067 if (_remaining < n) {
1068 _exception = 1;
1069 _exceptionType = "java/lang/IllegalArgumentException";
1070 _exceptionMessage = "remaining() < n < needed";
1071 goto exit;
1072 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001073 if (framebuffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001074 char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001075 framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
1076 }
Jack Palevich560814f2009-11-19 16:34:55 +08001077 glDeleteFramebuffers(
1078 (GLsizei)n,
1079 (GLuint *)framebuffers
1080 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001081
1082exit:
Jack Palevich560814f2009-11-19 16:34:55 +08001083 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001084 _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08001085 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08001086 if (_exception) {
1087 jniThrowException(_env, _exceptionType, _exceptionMessage);
1088 }
Jack Palevich560814f2009-11-19 16:34:55 +08001089}
1090
1091/* void glDeleteProgram ( GLuint program ) */
1092static void
1093android_glDeleteProgram__I
1094 (JNIEnv *_env, jobject _this, jint program) {
1095 glDeleteProgram(
1096 (GLuint)program
1097 );
1098}
1099
1100/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */
1101static void
1102android_glDeleteRenderbuffers__I_3II
1103 (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001104 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001105 const char * _exceptionType = NULL;
1106 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001107 GLuint *renderbuffers_base = (GLuint *) 0;
1108 jint _remaining;
1109 GLuint *renderbuffers = (GLuint *) 0;
1110
1111 if (!renderbuffers_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001112 _exception = 1;
1113 _exceptionType = "java/lang/IllegalArgumentException";
1114 _exceptionMessage = "renderbuffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001115 goto exit;
1116 }
1117 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001118 _exception = 1;
1119 _exceptionType = "java/lang/IllegalArgumentException";
1120 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001121 goto exit;
1122 }
1123 _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001124 if (_remaining < n) {
1125 _exception = 1;
1126 _exceptionType = "java/lang/IllegalArgumentException";
1127 _exceptionMessage = "length - offset < n < needed";
1128 goto exit;
1129 }
Jack Palevich560814f2009-11-19 16:34:55 +08001130 renderbuffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001131 _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001132 renderbuffers = renderbuffers_base + offset;
1133
1134 glDeleteRenderbuffers(
1135 (GLsizei)n,
1136 (GLuint *)renderbuffers
1137 );
1138
1139exit:
1140 if (renderbuffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001141 _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001142 JNI_ABORT);
1143 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001144 if (_exception) {
1145 jniThrowException(_env, _exceptionType, _exceptionMessage);
1146 }
Jack Palevich560814f2009-11-19 16:34:55 +08001147}
1148
1149/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */
1150static void
1151android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2
1152 (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001153 jint _exception = 0;
1154 const char * _exceptionType = NULL;
1155 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001156 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001157 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001158 jint _remaining;
1159 GLuint *renderbuffers = (GLuint *) 0;
1160
Romain Guy84cac202016-12-05 12:26:02 -08001161 if (!renderbuffers_buf) {
1162 _exception = 1;
1163 _exceptionType = "java/lang/IllegalArgumentException";
1164 _exceptionMessage = "renderbuffers == null";
1165 goto exit;
1166 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001167 renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001168 if (_remaining < n) {
1169 _exception = 1;
1170 _exceptionType = "java/lang/IllegalArgumentException";
1171 _exceptionMessage = "remaining() < n < needed";
1172 goto exit;
1173 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001174 if (renderbuffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001175 char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001176 renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
1177 }
Jack Palevich560814f2009-11-19 16:34:55 +08001178 glDeleteRenderbuffers(
1179 (GLsizei)n,
1180 (GLuint *)renderbuffers
1181 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001182
1183exit:
Jack Palevich560814f2009-11-19 16:34:55 +08001184 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001185 _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08001186 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08001187 if (_exception) {
1188 jniThrowException(_env, _exceptionType, _exceptionMessage);
1189 }
Jack Palevich560814f2009-11-19 16:34:55 +08001190}
1191
1192/* void glDeleteShader ( GLuint shader ) */
1193static void
1194android_glDeleteShader__I
1195 (JNIEnv *_env, jobject _this, jint shader) {
1196 glDeleteShader(
1197 (GLuint)shader
1198 );
1199}
1200
1201/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
1202static void
1203android_glDeleteTextures__I_3II
1204 (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001205 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001206 const char * _exceptionType = NULL;
1207 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001208 GLuint *textures_base = (GLuint *) 0;
1209 jint _remaining;
1210 GLuint *textures = (GLuint *) 0;
1211
1212 if (!textures_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001213 _exception = 1;
1214 _exceptionType = "java/lang/IllegalArgumentException";
1215 _exceptionMessage = "textures == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001216 goto exit;
1217 }
1218 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001219 _exception = 1;
1220 _exceptionType = "java/lang/IllegalArgumentException";
1221 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001222 goto exit;
1223 }
1224 _remaining = _env->GetArrayLength(textures_ref) - offset;
1225 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001226 _exception = 1;
1227 _exceptionType = "java/lang/IllegalArgumentException";
1228 _exceptionMessage = "length - offset < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001229 goto exit;
1230 }
1231 textures_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001232 _env->GetIntArrayElements(textures_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001233 textures = textures_base + offset;
1234
1235 glDeleteTextures(
1236 (GLsizei)n,
1237 (GLuint *)textures
1238 );
1239
1240exit:
1241 if (textures_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001242 _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001243 JNI_ABORT);
1244 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001245 if (_exception) {
1246 jniThrowException(_env, _exceptionType, _exceptionMessage);
1247 }
Jack Palevich560814f2009-11-19 16:34:55 +08001248}
1249
1250/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
1251static void
1252android_glDeleteTextures__ILjava_nio_IntBuffer_2
1253 (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001254 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001255 const char * _exceptionType = NULL;
1256 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001257 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001258 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001259 jint _remaining;
1260 GLuint *textures = (GLuint *) 0;
1261
Romain Guy84cac202016-12-05 12:26:02 -08001262 if (!textures_buf) {
1263 _exception = 1;
1264 _exceptionType = "java/lang/IllegalArgumentException";
1265 _exceptionMessage = "textures == null";
1266 goto exit;
1267 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001268 textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08001269 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001270 _exception = 1;
1271 _exceptionType = "java/lang/IllegalArgumentException";
1272 _exceptionMessage = "remaining() < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001273 goto exit;
1274 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001275 if (textures == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001276 char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001277 textures = (GLuint *) (_texturesBase + _bufferOffset);
1278 }
Jack Palevich560814f2009-11-19 16:34:55 +08001279 glDeleteTextures(
1280 (GLsizei)n,
1281 (GLuint *)textures
1282 );
1283
1284exit:
1285 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001286 _env->ReleaseIntArrayElements(_array, (jint*)textures, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08001287 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001288 if (_exception) {
1289 jniThrowException(_env, _exceptionType, _exceptionMessage);
1290 }
Jack Palevich560814f2009-11-19 16:34:55 +08001291}
1292
1293/* void glDepthFunc ( GLenum func ) */
1294static void
1295android_glDepthFunc__I
1296 (JNIEnv *_env, jobject _this, jint func) {
1297 glDepthFunc(
1298 (GLenum)func
1299 );
1300}
1301
1302/* void glDepthMask ( GLboolean flag ) */
1303static void
1304android_glDepthMask__Z
1305 (JNIEnv *_env, jobject _this, jboolean flag) {
1306 glDepthMask(
1307 (GLboolean)flag
1308 );
1309}
1310
1311/* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */
1312static void
1313android_glDepthRangef__FF
1314 (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) {
1315 glDepthRangef(
1316 (GLclampf)zNear,
1317 (GLclampf)zFar
1318 );
1319}
1320
1321/* void glDetachShader ( GLuint program, GLuint shader ) */
1322static void
1323android_glDetachShader__II
1324 (JNIEnv *_env, jobject _this, jint program, jint shader) {
1325 glDetachShader(
1326 (GLuint)program,
1327 (GLuint)shader
1328 );
1329}
1330
1331/* void glDisable ( GLenum cap ) */
1332static void
1333android_glDisable__I
1334 (JNIEnv *_env, jobject _this, jint cap) {
1335 glDisable(
1336 (GLenum)cap
1337 );
1338}
1339
1340/* void glDisableVertexAttribArray ( GLuint index ) */
1341static void
1342android_glDisableVertexAttribArray__I
1343 (JNIEnv *_env, jobject _this, jint index) {
1344 glDisableVertexAttribArray(
1345 (GLuint)index
1346 );
1347}
1348
1349/* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */
1350static void
1351android_glDrawArrays__III
1352 (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) {
1353 glDrawArrays(
1354 (GLenum)mode,
1355 (GLint)first,
1356 (GLsizei)count
1357 );
1358}
1359
Jack Palevich224107a2010-06-22 20:08:40 +08001360/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */
1361static void
1362android_glDrawElements__IIII
1363 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001364 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001365 const char * _exceptionType = NULL;
1366 const char * _exceptionMessage = NULL;
Jack Palevich224107a2010-06-22 20:08:40 +08001367 glDrawElements(
1368 (GLenum)mode,
1369 (GLsizei)count,
1370 (GLenum)type,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00001371 reinterpret_cast<GLvoid *>(offset)
Jack Palevich224107a2010-06-22 20:08:40 +08001372 );
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001373 if (_exception) {
1374 jniThrowException(_env, _exceptionType, _exceptionMessage);
1375 }
Jack Palevich224107a2010-06-22 20:08:40 +08001376}
1377
Jack Palevich560814f2009-11-19 16:34:55 +08001378/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */
1379static void
1380android_glDrawElements__IIILjava_nio_Buffer_2
1381 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001382 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001383 const char * _exceptionType = NULL;
1384 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001385 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001386 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001387 jint _remaining;
1388 GLvoid *indices = (GLvoid *) 0;
1389
Romain Guy84cac202016-12-05 12:26:02 -08001390 if (!indices_buf) {
1391 _exception = 1;
1392 _exceptionType = "java/lang/IllegalArgumentException";
1393 _exceptionMessage = "indices == null";
1394 goto exit;
1395 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001396 indices = (GLvoid *)getPointer(_env, indices_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08001397 if (_remaining < count) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001398 _exception = 1;
1399 _exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
1400 _exceptionMessage = "remaining() < count < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001401 goto exit;
1402 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001403 if (indices == NULL) {
1404 char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1405 indices = (GLvoid *) (_indicesBase + _bufferOffset);
1406 }
Jack Palevich560814f2009-11-19 16:34:55 +08001407 glDrawElements(
1408 (GLenum)mode,
1409 (GLsizei)count,
1410 (GLenum)type,
1411 (GLvoid *)indices
1412 );
1413
1414exit:
1415 if (_array) {
1416 releasePointer(_env, _array, indices, JNI_FALSE);
1417 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001418 if (_exception) {
1419 jniThrowException(_env, _exceptionType, _exceptionMessage);
1420 }
Jack Palevich560814f2009-11-19 16:34:55 +08001421}
1422
1423/* void glEnable ( GLenum cap ) */
1424static void
1425android_glEnable__I
1426 (JNIEnv *_env, jobject _this, jint cap) {
1427 glEnable(
1428 (GLenum)cap
1429 );
1430}
1431
1432/* void glEnableVertexAttribArray ( GLuint index ) */
1433static void
1434android_glEnableVertexAttribArray__I
1435 (JNIEnv *_env, jobject _this, jint index) {
1436 glEnableVertexAttribArray(
1437 (GLuint)index
1438 );
1439}
1440
1441/* void glFinish ( void ) */
1442static void
1443android_glFinish__
1444 (JNIEnv *_env, jobject _this) {
1445 glFinish();
1446}
1447
1448/* void glFlush ( void ) */
1449static void
1450android_glFlush__
1451 (JNIEnv *_env, jobject _this) {
1452 glFlush();
1453}
1454
1455/* void glFramebufferRenderbuffer ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) */
1456static void
1457android_glFramebufferRenderbuffer__IIII
1458 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint renderbuffertarget, jint renderbuffer) {
1459 glFramebufferRenderbuffer(
1460 (GLenum)target,
1461 (GLenum)attachment,
1462 (GLenum)renderbuffertarget,
1463 (GLuint)renderbuffer
1464 );
1465}
1466
1467/* void glFramebufferTexture2D ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) */
1468static void
1469android_glFramebufferTexture2D__IIIII
1470 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint textarget, jint texture, jint level) {
1471 glFramebufferTexture2D(
1472 (GLenum)target,
1473 (GLenum)attachment,
1474 (GLenum)textarget,
1475 (GLuint)texture,
1476 (GLint)level
1477 );
1478}
1479
1480/* void glFrontFace ( GLenum mode ) */
1481static void
1482android_glFrontFace__I
1483 (JNIEnv *_env, jobject _this, jint mode) {
1484 glFrontFace(
1485 (GLenum)mode
1486 );
1487}
1488
1489/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
1490static void
1491android_glGenBuffers__I_3II
1492 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
1493 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001494 const char * _exceptionType = NULL;
1495 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001496 GLuint *buffers_base = (GLuint *) 0;
1497 jint _remaining;
1498 GLuint *buffers = (GLuint *) 0;
1499
1500 if (!buffers_ref) {
1501 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001502 _exceptionType = "java/lang/IllegalArgumentException";
1503 _exceptionMessage = "buffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001504 goto exit;
1505 }
1506 if (offset < 0) {
1507 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001508 _exceptionType = "java/lang/IllegalArgumentException";
1509 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001510 goto exit;
1511 }
1512 _remaining = _env->GetArrayLength(buffers_ref) - offset;
1513 if (_remaining < n) {
1514 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001515 _exceptionType = "java/lang/IllegalArgumentException";
1516 _exceptionMessage = "length - offset < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001517 goto exit;
1518 }
1519 buffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001520 _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001521 buffers = buffers_base + offset;
1522
1523 glGenBuffers(
1524 (GLsizei)n,
1525 (GLuint *)buffers
1526 );
1527
1528exit:
1529 if (buffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001530 _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001531 _exception ? JNI_ABORT: 0);
1532 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001533 if (_exception) {
1534 jniThrowException(_env, _exceptionType, _exceptionMessage);
1535 }
Jack Palevich560814f2009-11-19 16:34:55 +08001536}
1537
1538/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
1539static void
1540android_glGenBuffers__ILjava_nio_IntBuffer_2
1541 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
1542 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001543 const char * _exceptionType = NULL;
1544 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001545 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001546 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001547 jint _remaining;
1548 GLuint *buffers = (GLuint *) 0;
1549
Romain Guy84cac202016-12-05 12:26:02 -08001550 if (!buffers_buf) {
1551 _exception = 1;
1552 _exceptionType = "java/lang/IllegalArgumentException";
1553 _exceptionMessage = "buffers == null";
1554 goto exit;
1555 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001556 buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08001557 if (_remaining < n) {
1558 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001559 _exceptionType = "java/lang/IllegalArgumentException";
1560 _exceptionMessage = "remaining() < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001561 goto exit;
1562 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001563 if (buffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001564 char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001565 buffers = (GLuint *) (_buffersBase + _bufferOffset);
1566 }
Jack Palevich560814f2009-11-19 16:34:55 +08001567 glGenBuffers(
1568 (GLsizei)n,
1569 (GLuint *)buffers
1570 );
1571
1572exit:
1573 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001574 _env->ReleaseIntArrayElements(_array, (jint*)buffers, _exception ? JNI_ABORT : 0);
Jack Palevich560814f2009-11-19 16:34:55 +08001575 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001576 if (_exception) {
1577 jniThrowException(_env, _exceptionType, _exceptionMessage);
1578 }
Jack Palevich560814f2009-11-19 16:34:55 +08001579}
1580
1581/* void glGenerateMipmap ( GLenum target ) */
1582static void
1583android_glGenerateMipmap__I
1584 (JNIEnv *_env, jobject _this, jint target) {
1585 glGenerateMipmap(
1586 (GLenum)target
1587 );
1588}
1589
1590/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */
1591static void
1592android_glGenFramebuffers__I_3II
1593 (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
1594 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001595 const char * _exceptionType = NULL;
1596 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001597 GLuint *framebuffers_base = (GLuint *) 0;
1598 jint _remaining;
1599 GLuint *framebuffers = (GLuint *) 0;
1600
1601 if (!framebuffers_ref) {
1602 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001603 _exceptionType = "java/lang/IllegalArgumentException";
1604 _exceptionMessage = "framebuffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001605 goto exit;
1606 }
1607 if (offset < 0) {
1608 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001609 _exceptionType = "java/lang/IllegalArgumentException";
1610 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001611 goto exit;
1612 }
1613 _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001614 if (_remaining < n) {
1615 _exception = 1;
1616 _exceptionType = "java/lang/IllegalArgumentException";
1617 _exceptionMessage = "length - offset < n < needed";
1618 goto exit;
1619 }
Jack Palevich560814f2009-11-19 16:34:55 +08001620 framebuffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001621 _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001622 framebuffers = framebuffers_base + offset;
1623
1624 glGenFramebuffers(
1625 (GLsizei)n,
1626 (GLuint *)framebuffers
1627 );
1628
1629exit:
1630 if (framebuffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001631 _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001632 _exception ? JNI_ABORT: 0);
1633 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001634 if (_exception) {
1635 jniThrowException(_env, _exceptionType, _exceptionMessage);
1636 }
Jack Palevich560814f2009-11-19 16:34:55 +08001637}
1638
1639/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */
1640static void
1641android_glGenFramebuffers__ILjava_nio_IntBuffer_2
1642 (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001643 jint _exception = 0;
1644 const char * _exceptionType = NULL;
1645 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001646 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001647 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001648 jint _remaining;
1649 GLuint *framebuffers = (GLuint *) 0;
1650
Romain Guy84cac202016-12-05 12:26:02 -08001651 if (!framebuffers_buf) {
1652 _exception = 1;
1653 _exceptionType = "java/lang/IllegalArgumentException";
1654 _exceptionMessage = "framebuffers == null";
1655 goto exit;
1656 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001657 framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001658 if (_remaining < n) {
1659 _exception = 1;
1660 _exceptionType = "java/lang/IllegalArgumentException";
1661 _exceptionMessage = "remaining() < n < needed";
1662 goto exit;
1663 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001664 if (framebuffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001665 char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001666 framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
1667 }
Jack Palevich560814f2009-11-19 16:34:55 +08001668 glGenFramebuffers(
1669 (GLsizei)n,
1670 (GLuint *)framebuffers
1671 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001672
1673exit:
Jack Palevich560814f2009-11-19 16:34:55 +08001674 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001675 _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001676 }
1677 if (_exception) {
1678 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08001679 }
1680}
1681
1682/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */
1683static void
1684android_glGenRenderbuffers__I_3II
1685 (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
1686 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001687 const char * _exceptionType = NULL;
1688 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001689 GLuint *renderbuffers_base = (GLuint *) 0;
1690 jint _remaining;
1691 GLuint *renderbuffers = (GLuint *) 0;
1692
1693 if (!renderbuffers_ref) {
1694 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001695 _exceptionType = "java/lang/IllegalArgumentException";
1696 _exceptionMessage = "renderbuffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001697 goto exit;
1698 }
1699 if (offset < 0) {
1700 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001701 _exceptionType = "java/lang/IllegalArgumentException";
1702 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001703 goto exit;
1704 }
1705 _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001706 if (_remaining < n) {
1707 _exception = 1;
1708 _exceptionType = "java/lang/IllegalArgumentException";
1709 _exceptionMessage = "length - offset < n < needed";
1710 goto exit;
1711 }
Jack Palevich560814f2009-11-19 16:34:55 +08001712 renderbuffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001713 _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001714 renderbuffers = renderbuffers_base + offset;
1715
1716 glGenRenderbuffers(
1717 (GLsizei)n,
1718 (GLuint *)renderbuffers
1719 );
1720
1721exit:
1722 if (renderbuffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001723 _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001724 _exception ? JNI_ABORT: 0);
1725 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001726 if (_exception) {
1727 jniThrowException(_env, _exceptionType, _exceptionMessage);
1728 }
Jack Palevich560814f2009-11-19 16:34:55 +08001729}
1730
1731/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */
1732static void
1733android_glGenRenderbuffers__ILjava_nio_IntBuffer_2
1734 (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001735 jint _exception = 0;
1736 const char * _exceptionType = NULL;
1737 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001738 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001739 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001740 jint _remaining;
1741 GLuint *renderbuffers = (GLuint *) 0;
1742
Romain Guy84cac202016-12-05 12:26:02 -08001743 if (!renderbuffers_buf) {
1744 _exception = 1;
1745 _exceptionType = "java/lang/IllegalArgumentException";
1746 _exceptionMessage = "renderbuffers == null";
1747 goto exit;
1748 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001749 renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001750 if (_remaining < n) {
1751 _exception = 1;
1752 _exceptionType = "java/lang/IllegalArgumentException";
1753 _exceptionMessage = "remaining() < n < needed";
1754 goto exit;
1755 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001756 if (renderbuffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001757 char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001758 renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
1759 }
Jack Palevich560814f2009-11-19 16:34:55 +08001760 glGenRenderbuffers(
1761 (GLsizei)n,
1762 (GLuint *)renderbuffers
1763 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001764
1765exit:
Jack Palevich560814f2009-11-19 16:34:55 +08001766 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001767 _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001768 }
1769 if (_exception) {
1770 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08001771 }
1772}
1773
1774/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1775static void
1776android_glGenTextures__I_3II
1777 (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
1778 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001779 const char * _exceptionType = NULL;
1780 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001781 GLuint *textures_base = (GLuint *) 0;
1782 jint _remaining;
1783 GLuint *textures = (GLuint *) 0;
1784
1785 if (!textures_ref) {
1786 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001787 _exceptionType = "java/lang/IllegalArgumentException";
1788 _exceptionMessage = "textures == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001789 goto exit;
1790 }
1791 if (offset < 0) {
1792 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001793 _exceptionType = "java/lang/IllegalArgumentException";
1794 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001795 goto exit;
1796 }
1797 _remaining = _env->GetArrayLength(textures_ref) - offset;
1798 if (_remaining < n) {
1799 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001800 _exceptionType = "java/lang/IllegalArgumentException";
1801 _exceptionMessage = "length - offset < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001802 goto exit;
1803 }
1804 textures_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001805 _env->GetIntArrayElements(textures_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001806 textures = textures_base + offset;
1807
1808 glGenTextures(
1809 (GLsizei)n,
1810 (GLuint *)textures
1811 );
1812
1813exit:
1814 if (textures_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001815 _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001816 _exception ? JNI_ABORT: 0);
1817 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001818 if (_exception) {
1819 jniThrowException(_env, _exceptionType, _exceptionMessage);
1820 }
Jack Palevich560814f2009-11-19 16:34:55 +08001821}
1822
1823/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1824static void
1825android_glGenTextures__ILjava_nio_IntBuffer_2
1826 (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
1827 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001828 const char * _exceptionType = NULL;
1829 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001830 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001831 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001832 jint _remaining;
1833 GLuint *textures = (GLuint *) 0;
1834
Romain Guy84cac202016-12-05 12:26:02 -08001835 if (!textures_buf) {
1836 _exception = 1;
1837 _exceptionType = "java/lang/IllegalArgumentException";
1838 _exceptionMessage = "textures == null";
1839 goto exit;
1840 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001841 textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08001842 if (_remaining < n) {
1843 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001844 _exceptionType = "java/lang/IllegalArgumentException";
1845 _exceptionMessage = "remaining() < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001846 goto exit;
1847 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001848 if (textures == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001849 char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001850 textures = (GLuint *) (_texturesBase + _bufferOffset);
1851 }
Jack Palevich560814f2009-11-19 16:34:55 +08001852 glGenTextures(
1853 (GLsizei)n,
1854 (GLuint *)textures
1855 );
1856
1857exit:
1858 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001859 _env->ReleaseIntArrayElements(_array, (jint*)textures, _exception ? JNI_ABORT : 0);
Jack Palevich560814f2009-11-19 16:34:55 +08001860 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001861 if (_exception) {
1862 jniThrowException(_env, _exceptionType, _exceptionMessage);
1863 }
Jack Palevich560814f2009-11-19 16:34:55 +08001864}
1865
1866/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1867static void
1868android_glGetActiveAttrib__III_3II_3II_3II_3BI
1869 (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) {
1870 jint _exception = 0;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001871 const char * _exceptionType;
1872 const char * _exceptionMessage;
Jack Palevich560814f2009-11-19 16:34:55 +08001873 GLsizei *length_base = (GLsizei *) 0;
1874 jint _lengthRemaining;
1875 GLsizei *length = (GLsizei *) 0;
1876 GLint *size_base = (GLint *) 0;
1877 jint _sizeRemaining;
1878 GLint *size = (GLint *) 0;
1879 GLenum *type_base = (GLenum *) 0;
1880 jint _typeRemaining;
1881 GLenum *type = (GLenum *) 0;
1882 char *name_base = (char *) 0;
1883 jint _nameRemaining;
1884 char *name = (char *) 0;
1885
Pablo Ceballos6aff9062015-10-01 18:35:39 -07001886 if (length_ref) {
1887 if (lengthOffset < 0) {
1888 _exception = 1;
1889 _exceptionType = "java/lang/IllegalArgumentException";
1890 _exceptionMessage = "lengthOffset < 0";
1891 goto exit;
1892 }
1893 _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
1894 length_base = (GLsizei *)
1895 _env->GetIntArrayElements(length_ref, (jboolean *)0);
1896 length = length_base + lengthOffset;
Jack Palevich560814f2009-11-19 16:34:55 +08001897 }
Jack Palevich560814f2009-11-19 16:34:55 +08001898
1899 if (!size_ref) {
1900 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001901 _exceptionType = "java/lang/IllegalArgumentException";
1902 _exceptionMessage = "size == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001903 goto exit;
1904 }
1905 if (sizeOffset < 0) {
1906 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001907 _exceptionType = "java/lang/IllegalArgumentException";
1908 _exceptionMessage = "sizeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001909 goto exit;
1910 }
1911 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
1912 size_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001913 _env->GetIntArrayElements(size_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001914 size = size_base + sizeOffset;
1915
1916 if (!type_ref) {
1917 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001918 _exceptionType = "java/lang/IllegalArgumentException";
1919 _exceptionMessage = "type == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001920 goto exit;
1921 }
1922 if (typeOffset < 0) {
1923 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001924 _exceptionType = "java/lang/IllegalArgumentException";
1925 _exceptionMessage = "typeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001926 goto exit;
1927 }
1928 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
1929 type_base = (GLenum *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001930 _env->GetIntArrayElements(type_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001931 type = type_base + typeOffset;
1932
1933 if (!name_ref) {
1934 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001935 _exceptionType = "java/lang/IllegalArgumentException";
1936 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001937 goto exit;
1938 }
1939 if (nameOffset < 0) {
1940 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001941 _exceptionType = "java/lang/IllegalArgumentException";
1942 _exceptionMessage = "nameOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001943 goto exit;
1944 }
1945 _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
1946 name_base = (char *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001947 _env->GetByteArrayElements(name_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001948 name = name_base + nameOffset;
1949
1950 glGetActiveAttrib(
1951 (GLuint)program,
1952 (GLuint)index,
1953 (GLsizei)bufsize,
1954 (GLsizei *)length,
1955 (GLint *)size,
1956 (GLenum *)type,
1957 (char *)name
1958 );
1959
1960exit:
1961 if (name_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001962 _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001963 _exception ? JNI_ABORT: 0);
1964 }
1965 if (type_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001966 _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001967 _exception ? JNI_ABORT: 0);
1968 }
1969 if (size_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001970 _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001971 _exception ? JNI_ABORT: 0);
1972 }
1973 if (length_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001974 _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001975 _exception ? JNI_ABORT: 0);
1976 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001977 if (_exception) {
1978 jniThrowException(_env, _exceptionType, _exceptionMessage);
1979 }
Jack Palevich560814f2009-11-19 16:34:55 +08001980}
1981
1982/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1983static void
1984android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
1985 (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001986 jintArray _lengthArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001987 jint _lengthBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001988 jintArray _sizeArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001989 jint _sizeBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001990 jintArray _typeArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001991 jint _typeBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001992 jint _lengthRemaining;
1993 GLsizei *length = (GLsizei *) 0;
1994 jint _sizeRemaining;
1995 GLint *size = (GLint *) 0;
1996 jint _typeRemaining;
1997 GLenum *type = (GLenum *) 0;
1998
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001999 length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
2000 size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
2001 type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002002 if (length == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002003 char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002004 length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
2005 }
2006 if (size == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002007 char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002008 size = (GLint *) (_sizeBase + _sizeBufferOffset);
2009 }
2010 if (type == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002011 char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002012 type = (GLenum *) (_typeBase + _typeBufferOffset);
2013 }
Jack Palevich560814f2009-11-19 16:34:55 +08002014 glGetActiveAttrib(
2015 (GLuint)program,
2016 (GLuint)index,
2017 (GLsizei)bufsize,
2018 (GLsizei *)length,
2019 (GLint *)size,
2020 (GLenum *)type,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00002021 reinterpret_cast<char *>(name)
Jack Palevich560814f2009-11-19 16:34:55 +08002022 );
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002023 if (_typeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002024 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08002025 }
2026 if (_sizeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002027 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08002028 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002029 if (_lengthArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002030 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08002031 }
2032}
2033
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002034/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2035static jstring
2036android_glGetActiveAttrib1
2037 (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
2038 jint _exception = 0;
2039 const char * _exceptionType;
2040 const char * _exceptionMessage;
2041 GLint *size_base = (GLint *) 0;
2042 jint _sizeRemaining;
2043 GLint *size = (GLint *) 0;
2044 GLenum *type_base = (GLenum *) 0;
2045 jint _typeRemaining;
2046 GLenum *type = (GLenum *) 0;
2047
2048 jstring result = 0;
2049
2050 GLint len = 0;
2051 glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
2052 if (!len) {
2053 return _env->NewStringUTF("");
2054 }
2055 char* buf = (char*) malloc(len);
2056
2057 if (buf == NULL) {
2058 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2059 return NULL;
2060 }
2061 if (!size_ref) {
2062 _exception = 1;
2063 _exceptionType = "java/lang/IllegalArgumentException";
2064 _exceptionMessage = "size == null";
2065 goto exit;
2066 }
2067 if (sizeOffset < 0) {
2068 _exception = 1;
2069 _exceptionType = "java/lang/IllegalArgumentException";
2070 _exceptionMessage = "sizeOffset < 0";
2071 goto exit;
2072 }
2073 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2074 size_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002075 _env->GetIntArrayElements(size_ref, (jboolean *)0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002076 size = size_base + sizeOffset;
2077
2078 if (!type_ref) {
2079 _exception = 1;
2080 _exceptionType = "java/lang/IllegalArgumentException";
2081 _exceptionMessage = "type == null";
2082 goto exit;
2083 }
2084 if (typeOffset < 0) {
2085 _exception = 1;
2086 _exceptionType = "java/lang/IllegalArgumentException";
2087 _exceptionMessage = "typeOffset < 0";
2088 goto exit;
2089 }
2090 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2091 type_base = (GLenum *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002092 _env->GetIntArrayElements(type_ref, (jboolean *)0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002093 type = type_base + typeOffset;
2094
2095 glGetActiveAttrib(
2096 (GLuint)program,
2097 (GLuint)index,
2098 (GLsizei)len,
2099 NULL,
2100 (GLint *)size,
2101 (GLenum *)type,
2102 (char *)buf
2103 );
2104exit:
2105 if (type_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002106 _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002107 _exception ? JNI_ABORT: 0);
2108 }
2109 if (size_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002110 _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002111 _exception ? JNI_ABORT: 0);
2112 }
2113 if (_exception != 1) {
2114 result = _env->NewStringUTF(buf);
2115 }
2116 if (buf) {
2117 free(buf);
2118 }
2119 if (_exception) {
2120 jniThrowException(_env, _exceptionType, _exceptionMessage);
2121 }
2122 if (result == 0) {
2123 result = _env->NewStringUTF("");
2124 }
2125
2126 return result;
2127}
2128
2129/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2130static jstring
2131android_glGetActiveAttrib2
2132 (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002133 jintArray _sizeArray = (jintArray) 0;
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002134 jint _sizeBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002135 jintArray _typeArray = (jintArray) 0;
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002136 jint _typeBufferOffset = (jint) 0;
2137 jint _lengthRemaining;
2138 GLsizei *length = (GLsizei *) 0;
2139 jint _sizeRemaining;
2140 GLint *size = (GLint *) 0;
2141 jint _typeRemaining;
2142 GLenum *type = (GLenum *) 0;
2143
2144 jstring result = 0;
2145
2146 GLint len = 0;
2147 glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
2148 if (!len) {
2149 return _env->NewStringUTF("");
2150 }
2151 char* buf = (char*) malloc(len);
2152
2153 if (buf == NULL) {
2154 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2155 return NULL;
2156 }
2157
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002158 size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
2159 type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002160 if (size == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002161 char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002162 size = (GLint *) (_sizeBase + _sizeBufferOffset);
2163 }
2164 if (type == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002165 char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002166 type = (GLenum *) (_typeBase + _typeBufferOffset);
2167 }
2168 glGetActiveAttrib(
2169 (GLuint)program,
2170 (GLuint)index,
2171 (GLsizei)len,
2172 NULL,
2173 (GLint *)size,
2174 (GLenum *)type,
2175 (char *)buf
2176 );
2177
2178 if (_typeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002179 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002180 }
2181 if (_sizeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002182 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002183 }
2184 result = _env->NewStringUTF(buf);
2185 if (buf) {
2186 free(buf);
2187 }
2188 return result;
2189}
Jack Palevich560814f2009-11-19 16:34:55 +08002190/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2191static void
2192android_glGetActiveUniform__III_3II_3II_3II_3BI
2193 (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) {
2194 jint _exception = 0;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002195 const char * _exceptionType;
2196 const char * _exceptionMessage;
Jack Palevich560814f2009-11-19 16:34:55 +08002197 GLsizei *length_base = (GLsizei *) 0;
2198 jint _lengthRemaining;
2199 GLsizei *length = (GLsizei *) 0;
2200 GLint *size_base = (GLint *) 0;
2201 jint _sizeRemaining;
2202 GLint *size = (GLint *) 0;
2203 GLenum *type_base = (GLenum *) 0;
2204 jint _typeRemaining;
2205 GLenum *type = (GLenum *) 0;
2206 char *name_base = (char *) 0;
2207 jint _nameRemaining;
2208 char *name = (char *) 0;
2209
Pablo Ceballos6aff9062015-10-01 18:35:39 -07002210 if (length_ref) {
2211 if (lengthOffset < 0) {
2212 _exception = 1;
2213 _exceptionType = "java/lang/IllegalArgumentException";
2214 _exceptionMessage = "lengthOffset < 0";
2215 goto exit;
2216 }
2217 _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
2218 length_base = (GLsizei *)
2219 _env->GetIntArrayElements(length_ref, (jboolean *)0);
2220 length = length_base + lengthOffset;
Jack Palevich560814f2009-11-19 16:34:55 +08002221 }
Jack Palevich560814f2009-11-19 16:34:55 +08002222
2223 if (!size_ref) {
2224 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002225 _exceptionType = "java/lang/IllegalArgumentException";
2226 _exceptionMessage = "size == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002227 goto exit;
2228 }
2229 if (sizeOffset < 0) {
2230 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002231 _exceptionType = "java/lang/IllegalArgumentException";
2232 _exceptionMessage = "sizeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002233 goto exit;
2234 }
2235 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2236 size_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002237 _env->GetIntArrayElements(size_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08002238 size = size_base + sizeOffset;
2239
2240 if (!type_ref) {
2241 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002242 _exceptionType = "java/lang/IllegalArgumentException";
2243 _exceptionMessage = "type == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002244 goto exit;
2245 }
2246 if (typeOffset < 0) {
2247 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002248 _exceptionType = "java/lang/IllegalArgumentException";
2249 _exceptionMessage = "typeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002250 goto exit;
2251 }
2252 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2253 type_base = (GLenum *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002254 _env->GetIntArrayElements(type_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08002255 type = type_base + typeOffset;
2256
2257 if (!name_ref) {
2258 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002259 _exceptionType = "java/lang/IllegalArgumentException";
2260 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002261 goto exit;
2262 }
2263 if (nameOffset < 0) {
2264 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002265 _exceptionType = "java/lang/IllegalArgumentException";
2266 _exceptionMessage = "nameOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002267 goto exit;
2268 }
2269 _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
2270 name_base = (char *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002271 _env->GetByteArrayElements(name_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08002272 name = name_base + nameOffset;
2273
2274 glGetActiveUniform(
2275 (GLuint)program,
2276 (GLuint)index,
2277 (GLsizei)bufsize,
2278 (GLsizei *)length,
2279 (GLint *)size,
2280 (GLenum *)type,
2281 (char *)name
2282 );
2283
2284exit:
2285 if (name_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002286 _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002287 _exception ? JNI_ABORT: 0);
2288 }
2289 if (type_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002290 _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002291 _exception ? JNI_ABORT: 0);
2292 }
2293 if (size_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002294 _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002295 _exception ? JNI_ABORT: 0);
2296 }
2297 if (length_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002298 _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002299 _exception ? JNI_ABORT: 0);
2300 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002301 if (_exception) {
2302 jniThrowException(_env, _exceptionType, _exceptionMessage);
2303 }
Jack Palevich560814f2009-11-19 16:34:55 +08002304}
2305
2306/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2307static void
2308android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
2309 (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002310 jintArray _lengthArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002311 jint _lengthBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002312 jintArray _sizeArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002313 jint _sizeBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002314 jintArray _typeArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002315 jint _typeBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002316 jint _lengthRemaining;
2317 GLsizei *length = (GLsizei *) 0;
2318 jint _sizeRemaining;
2319 GLint *size = (GLint *) 0;
2320 jint _typeRemaining;
2321 GLenum *type = (GLenum *) 0;
2322
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002323 length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
2324 size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
2325 type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002326 if (length == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002327 char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002328 length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
2329 }
2330 if (size == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002331 char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002332 size = (GLint *) (_sizeBase + _sizeBufferOffset);
2333 }
2334 if (type == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002335 char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002336 type = (GLenum *) (_typeBase + _typeBufferOffset);
2337 }
Jack Palevich560814f2009-11-19 16:34:55 +08002338 glGetActiveUniform(
2339 (GLuint)program,
2340 (GLuint)index,
2341 (GLsizei)bufsize,
2342 (GLsizei *)length,
2343 (GLint *)size,
2344 (GLenum *)type,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00002345 reinterpret_cast<char *>(name)
Jack Palevich560814f2009-11-19 16:34:55 +08002346 );
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002347 if (_typeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002348 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08002349 }
2350 if (_sizeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002351 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08002352 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002353 if (_lengthArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002354 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08002355 }
2356}
2357
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002358/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2359static jstring
2360android_glGetActiveUniform1
2361 (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
2362 jint _exception = 0;
2363 const char * _exceptionType;
2364 const char * _exceptionMessage;
2365
2366 GLint *size_base = (GLint *) 0;
2367 jint _sizeRemaining;
2368 GLint *size = (GLint *) 0;
2369
2370 GLenum *type_base = (GLenum *) 0;
2371 jint _typeRemaining;
2372 GLenum *type = (GLenum *) 0;
2373
2374 jstring result = 0;
2375
2376 GLint len = 0;
2377 glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
2378 if (!len) {
2379 return _env->NewStringUTF("");
2380 }
2381 char* buf = (char*) malloc(len);
2382
2383 if (buf == NULL) {
2384 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2385 return NULL;
2386 }
2387
2388 if (!size_ref) {
2389 _exception = 1;
2390 _exceptionType = "java/lang/IllegalArgumentException";
2391 _exceptionMessage = "size == null";
2392 goto exit;
2393 }
2394 if (sizeOffset < 0) {
2395 _exception = 1;
2396 _exceptionType = "java/lang/IllegalArgumentException";
2397 _exceptionMessage = "sizeOffset < 0";
2398 goto exit;
2399 }
2400 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2401 size_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002402 _env->GetIntArrayElements(size_ref, (jboolean *)0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002403 size = size_base + sizeOffset;
2404
2405 if (!type_ref) {
2406 _exception = 1;
2407 _exceptionType = "java/lang/IllegalArgumentException";
2408 _exceptionMessage = "type == null";
2409 goto exit;
2410 }
2411 if (typeOffset < 0) {
2412 _exception = 1;
2413 _exceptionType = "java/lang/IllegalArgumentException";
2414 _exceptionMessage = "typeOffset < 0";
2415 goto exit;
2416 }
2417 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2418 type_base = (GLenum *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002419 _env->GetIntArrayElements(type_ref, (jboolean *)0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002420 type = type_base + typeOffset;
2421
2422 glGetActiveUniform(
2423 (GLuint)program,
2424 (GLuint)index,
2425 (GLsizei)len,
2426 NULL,
2427 (GLint *)size,
2428 (GLenum *)type,
2429 (char *)buf
2430 );
2431
2432exit:
2433 if (type_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002434 _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002435 _exception ? JNI_ABORT: 0);
2436 }
2437 if (size_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002438 _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002439 _exception ? JNI_ABORT: 0);
2440 }
2441 if (_exception != 1) {
2442 result = _env->NewStringUTF(buf);
2443 }
2444 if (buf) {
2445 free(buf);
2446 }
2447 if (_exception) {
2448 jniThrowException(_env, _exceptionType, _exceptionMessage);
2449 }
2450 if (result == 0) {
2451 result = _env->NewStringUTF("");
2452 }
2453 return result;
2454}
2455
2456/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2457static jstring
2458android_glGetActiveUniform2
2459 (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002460 jintArray _sizeArray = (jintArray) 0;
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002461 jint _sizeBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002462 jintArray _typeArray = (jintArray) 0;
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002463 jint _typeBufferOffset = (jint) 0;
2464 jint _sizeRemaining;
2465 GLint *size = (GLint *) 0;
2466 jint _typeRemaining;
2467 GLenum *type = (GLenum *) 0;
2468
2469 jstring result = 0;
2470 GLint len = 0;
2471 glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
2472 if (!len) {
2473 return _env->NewStringUTF("");
2474 }
2475 char* buf = (char*) malloc(len);
2476
2477 if (buf == NULL) {
2478 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2479 return NULL;
2480 }
2481
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002482 size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
2483 type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002484
2485 if (size == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002486 char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002487 size = (GLint *) (_sizeBase + _sizeBufferOffset);
2488 }
2489 if (type == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002490 char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002491 type = (GLenum *) (_typeBase + _typeBufferOffset);
2492 }
2493 glGetActiveUniform(
2494 (GLuint)program,
2495 (GLuint)index,
2496 len,
2497 NULL,
2498 (GLint *)size,
2499 (GLenum *)type,
2500 (char *)buf
2501 );
2502
2503 if (_typeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002504 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002505 }
2506 if (_sizeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002507 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002508 }
2509 result = _env->NewStringUTF(buf);
2510 if (buf) {
2511 free(buf);
2512 }
2513 return result;
2514}
Jack Palevich560814f2009-11-19 16:34:55 +08002515/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */
2516static void
2517android_glGetAttachedShaders__II_3II_3II
2518 (JNIEnv *_env, jobject _this, jint program, jint maxcount, jintArray count_ref, jint countOffset, jintArray shaders_ref, jint shadersOffset) {
2519 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002520 const char * _exceptionType = NULL;
2521 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002522 GLsizei *count_base = (GLsizei *) 0;
2523 jint _countRemaining;
2524 GLsizei *count = (GLsizei *) 0;
2525 GLuint *shaders_base = (GLuint *) 0;
2526 jint _shadersRemaining;
2527 GLuint *shaders = (GLuint *) 0;
2528
Pablo Ceballos6aff9062015-10-01 18:35:39 -07002529 if (count_ref) {
2530 if (countOffset < 0) {
2531 _exception = 1;
2532 _exceptionType = "java/lang/IllegalArgumentException";
2533 _exceptionMessage = "countOffset < 0";
2534 goto exit;
2535 }
2536 _countRemaining = _env->GetArrayLength(count_ref) - countOffset;
2537 if (_countRemaining < 1) {
2538 _exception = 1;
2539 _exceptionType = "java/lang/IllegalArgumentException";
2540 _exceptionMessage = "length - countOffset < 1 < needed";
2541 goto exit;
2542 }
2543 count_base = (GLsizei *)
2544 _env->GetIntArrayElements(count_ref, (jboolean *)0);
2545 count = count_base + countOffset;
Jack Palevich560814f2009-11-19 16:34:55 +08002546 }
Jack Palevich560814f2009-11-19 16:34:55 +08002547
2548 if (!shaders_ref) {
2549 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002550 _exceptionType = "java/lang/IllegalArgumentException";
2551 _exceptionMessage = "shaders == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002552 goto exit;
2553 }
2554 if (shadersOffset < 0) {
2555 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002556 _exceptionType = "java/lang/IllegalArgumentException";
2557 _exceptionMessage = "shadersOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002558 goto exit;
2559 }
2560 _shadersRemaining = _env->GetArrayLength(shaders_ref) - shadersOffset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002561 if (_shadersRemaining < maxcount) {
2562 _exception = 1;
2563 _exceptionType = "java/lang/IllegalArgumentException";
2564 _exceptionMessage = "length - shadersOffset < maxcount < needed";
2565 goto exit;
2566 }
Jack Palevich560814f2009-11-19 16:34:55 +08002567 shaders_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002568 _env->GetIntArrayElements(shaders_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08002569 shaders = shaders_base + shadersOffset;
2570
2571 glGetAttachedShaders(
2572 (GLuint)program,
2573 (GLsizei)maxcount,
2574 (GLsizei *)count,
2575 (GLuint *)shaders
2576 );
2577
2578exit:
2579 if (shaders_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002580 _env->ReleaseIntArrayElements(shaders_ref, (jint*)shaders_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002581 _exception ? JNI_ABORT: 0);
2582 }
2583 if (count_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002584 _env->ReleaseIntArrayElements(count_ref, (jint*)count_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002585 _exception ? JNI_ABORT: 0);
2586 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002587 if (_exception) {
2588 jniThrowException(_env, _exceptionType, _exceptionMessage);
2589 }
Jack Palevich560814f2009-11-19 16:34:55 +08002590}
2591
2592/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */
2593static void
2594android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
2595 (JNIEnv *_env, jobject _this, jint program, jint maxcount, jobject count_buf, jobject shaders_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002596 jint _exception = 0;
2597 const char * _exceptionType = NULL;
2598 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002599 jintArray _countArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002600 jint _countBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002601 jintArray _shadersArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002602 jint _shadersBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002603 jint _countRemaining;
2604 GLsizei *count = (GLsizei *) 0;
2605 jint _shadersRemaining;
2606 GLuint *shaders = (GLuint *) 0;
2607
Mathias Agopian2ad04772013-02-23 03:12:30 -08002608 if (count_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002609 count = (GLsizei *)getPointer(_env, count_buf, (jarray*)&_countArray, &_countRemaining, &_countBufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08002610 if (_countRemaining < 1) {
2611 _exception = 1;
2612 _exceptionType = "java/lang/IllegalArgumentException";
2613 _exceptionMessage = "remaining() < 1 < needed";
2614 goto exit;
2615 }
2616 }
Romain Guy84cac202016-12-05 12:26:02 -08002617 if (!shaders_buf) {
2618 _exception = 1;
2619 _exceptionType = "java/lang/IllegalArgumentException";
2620 _exceptionMessage = "shaders == null";
2621 goto exit;
2622 }
Pablo Ceballos6aff9062015-10-01 18:35:39 -07002623 shaders = (GLuint *)getPointer(_env, shaders_buf, (jarray*)&_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
2624 if (_shadersRemaining < maxcount) {
2625 _exception = 1;
2626 _exceptionType = "java/lang/IllegalArgumentException";
2627 _exceptionMessage = "remaining() < maxcount < needed";
2628 goto exit;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002629 }
2630 if (count_buf && count == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002631 char * _countBase = (char *)_env->GetIntArrayElements(_countArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002632 count = (GLsizei *) (_countBase + _countBufferOffset);
2633 }
Pablo Ceballos6aff9062015-10-01 18:35:39 -07002634 if (shaders == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002635 char * _shadersBase = (char *)_env->GetIntArrayElements(_shadersArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002636 shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
2637 }
Jack Palevich560814f2009-11-19 16:34:55 +08002638 glGetAttachedShaders(
2639 (GLuint)program,
2640 (GLsizei)maxcount,
2641 (GLsizei *)count,
2642 (GLuint *)shaders
2643 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08002644
2645exit:
Jack Palevich560814f2009-11-19 16:34:55 +08002646 if (_shadersArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002647 _env->ReleaseIntArrayElements(_shadersArray, (jint*)shaders, _exception ? JNI_ABORT : 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002648 }
2649 if (_countArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002650 _env->ReleaseIntArrayElements(_countArray, (jint*)count, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08002651 }
2652 if (_exception) {
2653 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08002654 }
2655}
2656
Mathias Agopian89be00b2013-02-22 20:08:06 -08002657/* GLint glGetAttribLocation ( GLuint program, const char *name ) */
Jack Palevich560814f2009-11-19 16:34:55 +08002658static jint
2659android_glGetAttribLocation__ILjava_lang_String_2
2660 (JNIEnv *_env, jobject _this, jint program, jstring name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002661 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002662 const char * _exceptionType = NULL;
2663 const char * _exceptionMessage = NULL;
Mathias Agopian89be00b2013-02-22 20:08:06 -08002664 GLint _returnValue = 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002665 const char* _nativename = 0;
2666
2667 if (!name) {
Elliott Hughes428d3fc2013-09-24 17:15:41 -07002668 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002669 _exceptionType = "java/lang/IllegalArgumentException";
2670 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002671 goto exit;
2672 }
2673 _nativename = _env->GetStringUTFChars(name, 0);
2674
2675 _returnValue = glGetAttribLocation(
2676 (GLuint)program,
2677 (char *)_nativename
2678 );
2679
2680exit:
2681 if (_nativename) {
2682 _env->ReleaseStringUTFChars(name, _nativename);
2683 }
2684
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002685 if (_exception) {
2686 jniThrowException(_env, _exceptionType, _exceptionMessage);
2687 }
Andy McFaddencee51982013-04-25 16:08:31 -07002688 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08002689}
2690
2691/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
2692static void
2693android_glGetBooleanv__I_3ZI
2694 (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002695 get<jbooleanArray, BooleanArrayGetter, jboolean*, BooleanArrayReleaser, GLboolean, glGetBooleanv>(
2696 _env, _this, pname, params_ref, offset);
Jack Palevich560814f2009-11-19 16:34:55 +08002697}
2698
2699/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
2700static void
2701android_glGetBooleanv__ILjava_nio_IntBuffer_2
2702 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002703 getarray<GLboolean, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetBooleanv>(
2704 _env, _this, pname, params_buf);
Jack Palevich560814f2009-11-19 16:34:55 +08002705}
Jack Palevich560814f2009-11-19 16:34:55 +08002706/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2707static void
2708android_glGetBufferParameteriv__II_3II
2709 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Jack Palevich73108672011-03-28 14:49:12 -07002710 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002711 const char * _exceptionType = NULL;
2712 const char * _exceptionMessage = NULL;
Jack Palevich73108672011-03-28 14:49:12 -07002713 GLint *params_base = (GLint *) 0;
2714 jint _remaining;
2715 GLint *params = (GLint *) 0;
2716
2717 if (!params_ref) {
2718 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002719 _exceptionType = "java/lang/IllegalArgumentException";
2720 _exceptionMessage = "params == null";
Jack Palevich73108672011-03-28 14:49:12 -07002721 goto exit;
2722 }
2723 if (offset < 0) {
2724 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002725 _exceptionType = "java/lang/IllegalArgumentException";
2726 _exceptionMessage = "offset < 0";
Jack Palevich73108672011-03-28 14:49:12 -07002727 goto exit;
2728 }
2729 _remaining = _env->GetArrayLength(params_ref) - offset;
2730 if (_remaining < 1) {
2731 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002732 _exceptionType = "java/lang/IllegalArgumentException";
2733 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich73108672011-03-28 14:49:12 -07002734 goto exit;
2735 }
2736 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002737 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich73108672011-03-28 14:49:12 -07002738 params = params_base + offset;
2739
2740 glGetBufferParameteriv(
2741 (GLenum)target,
2742 (GLenum)pname,
2743 (GLint *)params
2744 );
2745
2746exit:
2747 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002748 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich73108672011-03-28 14:49:12 -07002749 _exception ? JNI_ABORT: 0);
2750 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002751 if (_exception) {
2752 jniThrowException(_env, _exceptionType, _exceptionMessage);
2753 }
Jack Palevich560814f2009-11-19 16:34:55 +08002754}
2755
2756/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2757static void
2758android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
2759 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Jack Palevich73108672011-03-28 14:49:12 -07002760 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002761 const char * _exceptionType = NULL;
2762 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002763 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002764 jint _bufferOffset = (jint) 0;
Jack Palevich73108672011-03-28 14:49:12 -07002765 jint _remaining;
2766 GLint *params = (GLint *) 0;
2767
Romain Guy84cac202016-12-05 12:26:02 -08002768 if (!params_buf) {
2769 _exception = 1;
2770 _exceptionType = "java/lang/IllegalArgumentException";
2771 _exceptionMessage = "params == null";
2772 goto exit;
2773 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002774 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich73108672011-03-28 14:49:12 -07002775 if (_remaining < 1) {
2776 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002777 _exceptionType = "java/lang/IllegalArgumentException";
2778 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich73108672011-03-28 14:49:12 -07002779 goto exit;
2780 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002781 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002782 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002783 params = (GLint *) (_paramsBase + _bufferOffset);
2784 }
Jack Palevich73108672011-03-28 14:49:12 -07002785 glGetBufferParameteriv(
2786 (GLenum)target,
2787 (GLenum)pname,
2788 (GLint *)params
2789 );
2790
2791exit:
2792 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002793 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich73108672011-03-28 14:49:12 -07002794 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002795 if (_exception) {
2796 jniThrowException(_env, _exceptionType, _exceptionMessage);
2797 }
Jack Palevich560814f2009-11-19 16:34:55 +08002798}
2799
2800/* GLenum glGetError ( void ) */
2801static jint
2802android_glGetError__
2803 (JNIEnv *_env, jobject _this) {
2804 GLenum _returnValue;
2805 _returnValue = glGetError();
Andy McFaddencee51982013-04-25 16:08:31 -07002806 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08002807}
2808
2809/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
2810static void
2811android_glGetFloatv__I_3FI
2812 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002813 get<jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, GLfloat, glGetFloatv>(
2814 _env, _this, pname, params_ref, offset);
Jack Palevich560814f2009-11-19 16:34:55 +08002815}
2816
2817/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
2818static void
2819android_glGetFloatv__ILjava_nio_FloatBuffer_2
2820 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002821 getarray<GLfloat, jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, glGetFloatv>(
2822 _env, _this, pname, params_buf);
Jack Palevich560814f2009-11-19 16:34:55 +08002823}
Jack Palevich560814f2009-11-19 16:34:55 +08002824/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
2825static void
2826android_glGetFramebufferAttachmentParameteriv__III_3II
2827 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) {
2828 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002829 const char * _exceptionType = NULL;
2830 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002831 GLint *params_base = (GLint *) 0;
2832 jint _remaining;
2833 GLint *params = (GLint *) 0;
2834
2835 if (!params_ref) {
2836 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002837 _exceptionType = "java/lang/IllegalArgumentException";
2838 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002839 goto exit;
2840 }
2841 if (offset < 0) {
2842 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002843 _exceptionType = "java/lang/IllegalArgumentException";
2844 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002845 goto exit;
2846 }
2847 _remaining = _env->GetArrayLength(params_ref) - offset;
2848 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002849 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08002850 params = params_base + offset;
2851
2852 glGetFramebufferAttachmentParameteriv(
2853 (GLenum)target,
2854 (GLenum)attachment,
2855 (GLenum)pname,
2856 (GLint *)params
2857 );
2858
2859exit:
2860 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002861 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002862 _exception ? JNI_ABORT: 0);
2863 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002864 if (_exception) {
2865 jniThrowException(_env, _exceptionType, _exceptionMessage);
2866 }
Jack Palevich560814f2009-11-19 16:34:55 +08002867}
2868
2869/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
2870static void
2871android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2
2872 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) {
Romain Guy84cac202016-12-05 12:26:02 -08002873 jint _exception = 0;
2874 const char * _exceptionType = NULL;
2875 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002876 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002877 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002878 jint _remaining;
2879 GLint *params = (GLint *) 0;
2880
Romain Guy84cac202016-12-05 12:26:02 -08002881 if (!params_buf) {
2882 _exception = 1;
2883 _exceptionType = "java/lang/IllegalArgumentException";
2884 _exceptionMessage = "params == null";
2885 goto exit;
2886 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002887 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002888 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002889 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002890 params = (GLint *) (_paramsBase + _bufferOffset);
2891 }
Jack Palevich560814f2009-11-19 16:34:55 +08002892 glGetFramebufferAttachmentParameteriv(
2893 (GLenum)target,
2894 (GLenum)attachment,
2895 (GLenum)pname,
2896 (GLint *)params
2897 );
Romain Guy84cac202016-12-05 12:26:02 -08002898
2899exit:
Jack Palevich560814f2009-11-19 16:34:55 +08002900 if (_array) {
Romain Guy84cac202016-12-05 12:26:02 -08002901 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
2902 }
2903 if (_exception) {
2904 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08002905 }
2906}
2907
2908/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2909static void
2910android_glGetIntegerv__I_3II
2911 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002912 get<jintArray, IntArrayGetter, jint*, IntArrayReleaser, GLint, glGetIntegerv>(
2913 _env, _this, pname, params_ref, offset);
Jack Palevich560814f2009-11-19 16:34:55 +08002914}
2915
2916/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2917static void
2918android_glGetIntegerv__ILjava_nio_IntBuffer_2
2919 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002920 getarray<GLint, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetIntegerv>(
2921 _env, _this, pname, params_buf);
Jack Palevich560814f2009-11-19 16:34:55 +08002922}
Jack Palevich560814f2009-11-19 16:34:55 +08002923/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2924static void
2925android_glGetProgramiv__II_3II
2926 (JNIEnv *_env, jobject _this, jint program, jint pname, jintArray params_ref, jint offset) {
2927 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002928 const char * _exceptionType = NULL;
2929 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002930 GLint *params_base = (GLint *) 0;
2931 jint _remaining;
2932 GLint *params = (GLint *) 0;
2933
2934 if (!params_ref) {
2935 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002936 _exceptionType = "java/lang/IllegalArgumentException";
2937 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002938 goto exit;
2939 }
2940 if (offset < 0) {
2941 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002942 _exceptionType = "java/lang/IllegalArgumentException";
2943 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002944 goto exit;
2945 }
2946 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002947 if (_remaining < 1) {
2948 _exception = 1;
2949 _exceptionType = "java/lang/IllegalArgumentException";
2950 _exceptionMessage = "length - offset < 1 < needed";
2951 goto exit;
2952 }
Jack Palevich560814f2009-11-19 16:34:55 +08002953 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002954 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08002955 params = params_base + offset;
2956
2957 glGetProgramiv(
2958 (GLuint)program,
2959 (GLenum)pname,
2960 (GLint *)params
2961 );
2962
2963exit:
2964 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002965 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002966 _exception ? JNI_ABORT: 0);
2967 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002968 if (_exception) {
2969 jniThrowException(_env, _exceptionType, _exceptionMessage);
2970 }
Jack Palevich560814f2009-11-19 16:34:55 +08002971}
2972
2973/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2974static void
2975android_glGetProgramiv__IILjava_nio_IntBuffer_2
2976 (JNIEnv *_env, jobject _this, jint program, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002977 jint _exception = 0;
2978 const char * _exceptionType = NULL;
2979 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002980 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002981 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002982 jint _remaining;
2983 GLint *params = (GLint *) 0;
2984
Romain Guy84cac202016-12-05 12:26:02 -08002985 if (!params_buf) {
2986 _exception = 1;
2987 _exceptionType = "java/lang/IllegalArgumentException";
2988 _exceptionMessage = "params == null";
2989 goto exit;
2990 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002991 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08002992 if (_remaining < 1) {
2993 _exception = 1;
2994 _exceptionType = "java/lang/IllegalArgumentException";
2995 _exceptionMessage = "remaining() < 1 < needed";
2996 goto exit;
2997 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002998 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002999 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003000 params = (GLint *) (_paramsBase + _bufferOffset);
3001 }
Jack Palevich560814f2009-11-19 16:34:55 +08003002 glGetProgramiv(
3003 (GLuint)program,
3004 (GLenum)pname,
3005 (GLint *)params
3006 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003007
3008exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003009 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003010 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003011 }
3012 if (_exception) {
3013 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003014 }
3015}
3016
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003017#include <stdlib.h>
Jack Palevich560814f2009-11-19 16:34:55 +08003018
3019/* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003020static jstring android_glGetProgramInfoLog(JNIEnv *_env, jobject, jint shader) {
Jack Palevich560814f2009-11-19 16:34:55 +08003021 GLint infoLen = 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003022 glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003023 if (!infoLen) {
3024 return _env->NewStringUTF("");
Jack Palevich560814f2009-11-19 16:34:55 +08003025 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003026 char* buf = (char*) malloc(infoLen);
3027 if (buf == NULL) {
3028 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
3029 return NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003030 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003031 glGetProgramInfoLog(shader, infoLen, NULL, buf);
3032 jstring result = _env->NewStringUTF(buf);
3033 free(buf);
3034 return result;
Jack Palevich560814f2009-11-19 16:34:55 +08003035}
3036/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3037static void
3038android_glGetRenderbufferParameteriv__II_3II
3039 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
3040 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003041 const char * _exceptionType = NULL;
3042 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003043 GLint *params_base = (GLint *) 0;
3044 jint _remaining;
3045 GLint *params = (GLint *) 0;
3046
3047 if (!params_ref) {
3048 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003049 _exceptionType = "java/lang/IllegalArgumentException";
3050 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003051 goto exit;
3052 }
3053 if (offset < 0) {
3054 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003055 _exceptionType = "java/lang/IllegalArgumentException";
3056 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003057 goto exit;
3058 }
3059 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003060 if (_remaining < 1) {
3061 _exception = 1;
3062 _exceptionType = "java/lang/IllegalArgumentException";
3063 _exceptionMessage = "length - offset < 1 < needed";
3064 goto exit;
3065 }
Jack Palevich560814f2009-11-19 16:34:55 +08003066 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003067 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003068 params = params_base + offset;
3069
3070 glGetRenderbufferParameteriv(
3071 (GLenum)target,
3072 (GLenum)pname,
3073 (GLint *)params
3074 );
3075
3076exit:
3077 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003078 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003079 _exception ? JNI_ABORT: 0);
3080 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003081 if (_exception) {
3082 jniThrowException(_env, _exceptionType, _exceptionMessage);
3083 }
Jack Palevich560814f2009-11-19 16:34:55 +08003084}
3085
3086/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3087static void
3088android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2
3089 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003090 jint _exception = 0;
3091 const char * _exceptionType = NULL;
3092 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003093 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003094 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003095 jint _remaining;
3096 GLint *params = (GLint *) 0;
3097
Romain Guy84cac202016-12-05 12:26:02 -08003098 if (!params_buf) {
3099 _exception = 1;
3100 _exceptionType = "java/lang/IllegalArgumentException";
3101 _exceptionMessage = "params == null";
3102 goto exit;
3103 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003104 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003105 if (_remaining < 1) {
3106 _exception = 1;
3107 _exceptionType = "java/lang/IllegalArgumentException";
3108 _exceptionMessage = "remaining() < 1 < needed";
3109 goto exit;
3110 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003111 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003112 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003113 params = (GLint *) (_paramsBase + _bufferOffset);
3114 }
Jack Palevich560814f2009-11-19 16:34:55 +08003115 glGetRenderbufferParameteriv(
3116 (GLenum)target,
3117 (GLenum)pname,
3118 (GLint *)params
3119 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003120
3121exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003122 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003123 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003124 }
3125 if (_exception) {
3126 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003127 }
3128}
3129
3130/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
3131static void
3132android_glGetShaderiv__II_3II
3133 (JNIEnv *_env, jobject _this, jint shader, jint pname, jintArray params_ref, jint offset) {
3134 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003135 const char * _exceptionType = NULL;
3136 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003137 GLint *params_base = (GLint *) 0;
3138 jint _remaining;
3139 GLint *params = (GLint *) 0;
3140
3141 if (!params_ref) {
3142 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003143 _exceptionType = "java/lang/IllegalArgumentException";
3144 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003145 goto exit;
3146 }
3147 if (offset < 0) {
3148 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003149 _exceptionType = "java/lang/IllegalArgumentException";
3150 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003151 goto exit;
3152 }
3153 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003154 if (_remaining < 1) {
3155 _exception = 1;
3156 _exceptionType = "java/lang/IllegalArgumentException";
3157 _exceptionMessage = "length - offset < 1 < needed";
3158 goto exit;
3159 }
Jack Palevich560814f2009-11-19 16:34:55 +08003160 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003161 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003162 params = params_base + offset;
3163
3164 glGetShaderiv(
3165 (GLuint)shader,
3166 (GLenum)pname,
3167 (GLint *)params
3168 );
3169
3170exit:
3171 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003172 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003173 _exception ? JNI_ABORT: 0);
3174 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003175 if (_exception) {
3176 jniThrowException(_env, _exceptionType, _exceptionMessage);
3177 }
Jack Palevich560814f2009-11-19 16:34:55 +08003178}
3179
3180/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
3181static void
3182android_glGetShaderiv__IILjava_nio_IntBuffer_2
3183 (JNIEnv *_env, jobject _this, jint shader, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003184 jint _exception = 0;
3185 const char * _exceptionType = NULL;
3186 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003187 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003188 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003189 jint _remaining;
3190 GLint *params = (GLint *) 0;
3191
Romain Guy84cac202016-12-05 12:26:02 -08003192 if (!params_buf) {
3193 _exception = 1;
3194 _exceptionType = "java/lang/IllegalArgumentException";
3195 _exceptionMessage = "params == null";
3196 goto exit;
3197 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003198 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003199 if (_remaining < 1) {
3200 _exception = 1;
3201 _exceptionType = "java/lang/IllegalArgumentException";
3202 _exceptionMessage = "remaining() < 1 < needed";
3203 goto exit;
3204 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003205 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003206 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003207 params = (GLint *) (_paramsBase + _bufferOffset);
3208 }
Jack Palevich560814f2009-11-19 16:34:55 +08003209 glGetShaderiv(
3210 (GLuint)shader,
3211 (GLenum)pname,
3212 (GLint *)params
3213 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003214
3215exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003216 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003217 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003218 }
3219 if (_exception) {
3220 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003221 }
3222}
3223
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003224#include <stdlib.h>
Jack Palevich560814f2009-11-19 16:34:55 +08003225
3226/* void glGetShaderInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003227static jstring android_glGetShaderInfoLog(JNIEnv *_env, jobject, jint shader) {
Jack Palevich560814f2009-11-19 16:34:55 +08003228 GLint infoLen = 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003229 glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003230 if (!infoLen) {
Romain Guye842e502016-11-29 19:26:29 -08003231 infoLen = 512;
Jack Palevich560814f2009-11-19 16:34:55 +08003232 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003233 char* buf = (char*) malloc(infoLen);
3234 if (buf == NULL) {
3235 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
3236 return NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003237 }
Romain Guye842e502016-11-29 19:26:29 -08003238 GLsizei outLen = 0;
3239 glGetShaderInfoLog(shader, infoLen, &outLen, buf);
3240 jstring result = _env->NewStringUTF(outLen == 0 ? "" : buf);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003241 free(buf);
3242 return result;
Jack Palevich560814f2009-11-19 16:34:55 +08003243}
3244/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
3245static void
3246android_glGetShaderPrecisionFormat__II_3II_3II
3247 (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jintArray range_ref, jint rangeOffset, jintArray precision_ref, jint precisionOffset) {
3248 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003249 const char * _exceptionType = NULL;
3250 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003251 GLint *range_base = (GLint *) 0;
3252 jint _rangeRemaining;
3253 GLint *range = (GLint *) 0;
3254 GLint *precision_base = (GLint *) 0;
3255 jint _precisionRemaining;
3256 GLint *precision = (GLint *) 0;
3257
3258 if (!range_ref) {
3259 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003260 _exceptionType = "java/lang/IllegalArgumentException";
3261 _exceptionMessage = "range == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003262 goto exit;
3263 }
3264 if (rangeOffset < 0) {
3265 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003266 _exceptionType = "java/lang/IllegalArgumentException";
3267 _exceptionMessage = "rangeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003268 goto exit;
3269 }
3270 _rangeRemaining = _env->GetArrayLength(range_ref) - rangeOffset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003271 if (_rangeRemaining < 1) {
3272 _exception = 1;
3273 _exceptionType = "java/lang/IllegalArgumentException";
3274 _exceptionMessage = "length - rangeOffset < 1 < needed";
3275 goto exit;
3276 }
Jack Palevich560814f2009-11-19 16:34:55 +08003277 range_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003278 _env->GetIntArrayElements(range_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003279 range = range_base + rangeOffset;
3280
3281 if (!precision_ref) {
3282 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003283 _exceptionType = "java/lang/IllegalArgumentException";
3284 _exceptionMessage = "precision == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003285 goto exit;
3286 }
3287 if (precisionOffset < 0) {
3288 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003289 _exceptionType = "java/lang/IllegalArgumentException";
3290 _exceptionMessage = "precisionOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003291 goto exit;
3292 }
3293 _precisionRemaining = _env->GetArrayLength(precision_ref) - precisionOffset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003294 if (_precisionRemaining < 1) {
3295 _exception = 1;
3296 _exceptionType = "java/lang/IllegalArgumentException";
3297 _exceptionMessage = "length - precisionOffset < 1 < needed";
3298 goto exit;
3299 }
Jack Palevich560814f2009-11-19 16:34:55 +08003300 precision_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003301 _env->GetIntArrayElements(precision_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003302 precision = precision_base + precisionOffset;
3303
3304 glGetShaderPrecisionFormat(
3305 (GLenum)shadertype,
3306 (GLenum)precisiontype,
3307 (GLint *)range,
3308 (GLint *)precision
3309 );
3310
3311exit:
3312 if (precision_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003313 _env->ReleaseIntArrayElements(precision_ref, (jint*)precision_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003314 _exception ? JNI_ABORT: 0);
3315 }
3316 if (range_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003317 _env->ReleaseIntArrayElements(range_ref, (jint*)range_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003318 _exception ? JNI_ABORT: 0);
3319 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003320 if (_exception) {
3321 jniThrowException(_env, _exceptionType, _exceptionMessage);
3322 }
Jack Palevich560814f2009-11-19 16:34:55 +08003323}
3324
3325/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
3326static void
3327android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
3328 (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jobject range_buf, jobject precision_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003329 jint _exception = 0;
3330 const char * _exceptionType = NULL;
3331 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003332 jintArray _rangeArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003333 jint _rangeBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003334 jintArray _precisionArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003335 jint _precisionBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003336 jint _rangeRemaining;
3337 GLint *range = (GLint *) 0;
3338 jint _precisionRemaining;
3339 GLint *precision = (GLint *) 0;
3340
Romain Guy84cac202016-12-05 12:26:02 -08003341 if (!range_buf) {
3342 _exception = 1;
3343 _exceptionType = "java/lang/IllegalArgumentException";
3344 _exceptionMessage = "range == null";
3345 goto exit;
3346 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003347 range = (GLint *)getPointer(_env, range_buf, (jarray*)&_rangeArray, &_rangeRemaining, &_rangeBufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003348 if (_rangeRemaining < 1) {
3349 _exception = 1;
3350 _exceptionType = "java/lang/IllegalArgumentException";
3351 _exceptionMessage = "remaining() < 1 < needed";
3352 goto exit;
3353 }
Romain Guy84cac202016-12-05 12:26:02 -08003354 if (!precision_buf) {
3355 _exception = 1;
3356 _exceptionType = "java/lang/IllegalArgumentException";
3357 _exceptionMessage = "precision == null";
3358 goto exit;
3359 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003360 precision = (GLint *)getPointer(_env, precision_buf, (jarray*)&_precisionArray, &_precisionRemaining, &_precisionBufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003361 if (_precisionRemaining < 1) {
3362 _exception = 1;
3363 _exceptionType = "java/lang/IllegalArgumentException";
3364 _exceptionMessage = "remaining() < 1 < needed";
3365 goto exit;
3366 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003367 if (range == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003368 char * _rangeBase = (char *)_env->GetIntArrayElements(_rangeArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003369 range = (GLint *) (_rangeBase + _rangeBufferOffset);
3370 }
3371 if (precision == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003372 char * _precisionBase = (char *)_env->GetIntArrayElements(_precisionArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003373 precision = (GLint *) (_precisionBase + _precisionBufferOffset);
3374 }
Jack Palevich560814f2009-11-19 16:34:55 +08003375 glGetShaderPrecisionFormat(
3376 (GLenum)shadertype,
3377 (GLenum)precisiontype,
3378 (GLint *)range,
3379 (GLint *)precision
3380 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003381
3382exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003383 if (_precisionArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003384 _env->ReleaseIntArrayElements(_precisionArray, (jint*)precision, _exception ? JNI_ABORT : 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003385 }
3386 if (_rangeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003387 _env->ReleaseIntArrayElements(_rangeArray, (jint*)range, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003388 }
3389 if (_exception) {
3390 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003391 }
3392}
3393
3394/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3395static void
3396android_glGetShaderSource__II_3II_3BI
3397 (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jintArray length_ref, jint lengthOffset, jbyteArray source_ref, jint sourceOffset) {
3398 jint _exception = 0;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003399 const char * _exceptionType;
3400 const char * _exceptionMessage;
Jack Palevich560814f2009-11-19 16:34:55 +08003401 GLsizei *length_base = (GLsizei *) 0;
3402 jint _lengthRemaining;
3403 GLsizei *length = (GLsizei *) 0;
3404 char *source_base = (char *) 0;
3405 jint _sourceRemaining;
3406 char *source = (char *) 0;
3407
Pablo Ceballos6aff9062015-10-01 18:35:39 -07003408 if (length_ref) {
3409 if (lengthOffset < 0) {
3410 _exception = 1;
3411 _exceptionType = "java/lang/IllegalArgumentException";
3412 _exceptionMessage = "lengthOffset < 0";
3413 goto exit;
3414 }
3415 _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
3416 length_base = (GLsizei *)
3417 _env->GetIntArrayElements(length_ref, (jboolean *)0);
3418 length = length_base + lengthOffset;
Jack Palevich560814f2009-11-19 16:34:55 +08003419 }
Jack Palevich560814f2009-11-19 16:34:55 +08003420
3421 if (!source_ref) {
3422 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003423 _exceptionType = "java/lang/IllegalArgumentException";
3424 _exceptionMessage = "source == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003425 goto exit;
3426 }
3427 if (sourceOffset < 0) {
3428 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003429 _exceptionType = "java/lang/IllegalArgumentException";
3430 _exceptionMessage = "sourceOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003431 goto exit;
3432 }
3433 _sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset;
3434 source_base = (char *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003435 _env->GetByteArrayElements(source_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003436 source = source_base + sourceOffset;
3437
3438 glGetShaderSource(
3439 (GLuint)shader,
3440 (GLsizei)bufsize,
3441 (GLsizei *)length,
3442 (char *)source
3443 );
3444
3445exit:
3446 if (source_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003447 _env->ReleaseByteArrayElements(source_ref, (jbyte*)source_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003448 _exception ? JNI_ABORT: 0);
3449 }
3450 if (length_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003451 _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003452 _exception ? JNI_ABORT: 0);
3453 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003454 if (_exception) {
3455 jniThrowException(_env, _exceptionType, _exceptionMessage);
3456 }
Jack Palevich560814f2009-11-19 16:34:55 +08003457}
3458
3459/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3460static void
3461android_glGetShaderSource__IILjava_nio_IntBuffer_2B
3462 (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jobject length_buf, jbyte source) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003463 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003464 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003465 jint _remaining;
3466 GLsizei *length = (GLsizei *) 0;
3467
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003468 length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003469 if (length == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003470 char * _lengthBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003471 length = (GLsizei *) (_lengthBase + _bufferOffset);
3472 }
Jack Palevich560814f2009-11-19 16:34:55 +08003473 glGetShaderSource(
3474 (GLuint)shader,
3475 (GLsizei)bufsize,
3476 (GLsizei *)length,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00003477 reinterpret_cast<char *>(source)
Jack Palevich560814f2009-11-19 16:34:55 +08003478 );
3479 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003480 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _array, (jint*)length, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08003481 }
3482}
3483
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07003484/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3485static jstring android_glGetShaderSource(JNIEnv *_env, jobject, jint shader) {
3486 GLint shaderLen = 0;
3487 glGetShaderiv((GLuint)shader, GL_SHADER_SOURCE_LENGTH, &shaderLen);
3488 if (!shaderLen) {
3489 return _env->NewStringUTF("");
3490 }
3491 char* buf = (char*) malloc(shaderLen);
3492 if (buf == NULL) {
3493 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
3494 return NULL;
3495 }
3496 glGetShaderSource(shader, shaderLen, NULL, buf);
3497 jstring result = _env->NewStringUTF(buf);
3498 free(buf);
3499 return result;
3500}
Jack Palevich560814f2009-11-19 16:34:55 +08003501/* const GLubyte * glGetString ( GLenum name ) */
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003502static jstring android_glGetString(JNIEnv* _env, jobject, jint name) {
3503 const char* chars = (const char*) glGetString((GLenum) name);
3504 return _env->NewStringUTF(chars);
Jack Palevich560814f2009-11-19 16:34:55 +08003505}
3506/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
3507static void
3508android_glGetTexParameterfv__II_3FI
3509 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
3510 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003511 const char * _exceptionType = NULL;
3512 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003513 GLfloat *params_base = (GLfloat *) 0;
3514 jint _remaining;
3515 GLfloat *params = (GLfloat *) 0;
3516
3517 if (!params_ref) {
3518 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003519 _exceptionType = "java/lang/IllegalArgumentException";
3520 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003521 goto exit;
3522 }
3523 if (offset < 0) {
3524 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003525 _exceptionType = "java/lang/IllegalArgumentException";
3526 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003527 goto exit;
3528 }
3529 _remaining = _env->GetArrayLength(params_ref) - offset;
3530 if (_remaining < 1) {
3531 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003532 _exceptionType = "java/lang/IllegalArgumentException";
3533 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08003534 goto exit;
3535 }
3536 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003537 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003538 params = params_base + offset;
3539
3540 glGetTexParameterfv(
3541 (GLenum)target,
3542 (GLenum)pname,
3543 (GLfloat *)params
3544 );
3545
3546exit:
3547 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003548 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003549 _exception ? JNI_ABORT: 0);
3550 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003551 if (_exception) {
3552 jniThrowException(_env, _exceptionType, _exceptionMessage);
3553 }
Jack Palevich560814f2009-11-19 16:34:55 +08003554}
3555
3556/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
3557static void
3558android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2
3559 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3560 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003561 const char * _exceptionType = NULL;
3562 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003563 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003564 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003565 jint _remaining;
3566 GLfloat *params = (GLfloat *) 0;
3567
Romain Guy84cac202016-12-05 12:26:02 -08003568 if (!params_buf) {
3569 _exception = 1;
3570 _exceptionType = "java/lang/IllegalArgumentException";
3571 _exceptionMessage = "params == null";
3572 goto exit;
3573 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003574 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08003575 if (_remaining < 1) {
3576 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003577 _exceptionType = "java/lang/IllegalArgumentException";
3578 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08003579 goto exit;
3580 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003581 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003582 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003583 params = (GLfloat *) (_paramsBase + _bufferOffset);
3584 }
Jack Palevich560814f2009-11-19 16:34:55 +08003585 glGetTexParameterfv(
3586 (GLenum)target,
3587 (GLenum)pname,
3588 (GLfloat *)params
3589 );
3590
3591exit:
3592 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003593 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Jack Palevich560814f2009-11-19 16:34:55 +08003594 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003595 if (_exception) {
3596 jniThrowException(_env, _exceptionType, _exceptionMessage);
3597 }
Jack Palevich560814f2009-11-19 16:34:55 +08003598}
3599
3600/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3601static void
3602android_glGetTexParameteriv__II_3II
3603 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
3604 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003605 const char * _exceptionType = NULL;
3606 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003607 GLint *params_base = (GLint *) 0;
3608 jint _remaining;
3609 GLint *params = (GLint *) 0;
3610
3611 if (!params_ref) {
3612 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003613 _exceptionType = "java/lang/IllegalArgumentException";
3614 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003615 goto exit;
3616 }
3617 if (offset < 0) {
3618 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003619 _exceptionType = "java/lang/IllegalArgumentException";
3620 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003621 goto exit;
3622 }
3623 _remaining = _env->GetArrayLength(params_ref) - offset;
3624 if (_remaining < 1) {
3625 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003626 _exceptionType = "java/lang/IllegalArgumentException";
3627 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08003628 goto exit;
3629 }
3630 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003631 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003632 params = params_base + offset;
3633
3634 glGetTexParameteriv(
3635 (GLenum)target,
3636 (GLenum)pname,
3637 (GLint *)params
3638 );
3639
3640exit:
3641 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003642 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003643 _exception ? JNI_ABORT: 0);
3644 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003645 if (_exception) {
3646 jniThrowException(_env, _exceptionType, _exceptionMessage);
3647 }
Jack Palevich560814f2009-11-19 16:34:55 +08003648}
3649
3650/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3651static void
3652android_glGetTexParameteriv__IILjava_nio_IntBuffer_2
3653 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3654 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003655 const char * _exceptionType = NULL;
3656 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003657 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003658 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003659 jint _remaining;
3660 GLint *params = (GLint *) 0;
3661
Romain Guy84cac202016-12-05 12:26:02 -08003662 if (!params_buf) {
3663 _exception = 1;
3664 _exceptionType = "java/lang/IllegalArgumentException";
3665 _exceptionMessage = "params == null";
3666 goto exit;
3667 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003668 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08003669 if (_remaining < 1) {
3670 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003671 _exceptionType = "java/lang/IllegalArgumentException";
3672 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08003673 goto exit;
3674 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003675 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003676 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003677 params = (GLint *) (_paramsBase + _bufferOffset);
3678 }
Jack Palevich560814f2009-11-19 16:34:55 +08003679 glGetTexParameteriv(
3680 (GLenum)target,
3681 (GLenum)pname,
3682 (GLint *)params
3683 );
3684
3685exit:
3686 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003687 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich560814f2009-11-19 16:34:55 +08003688 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003689 if (_exception) {
3690 jniThrowException(_env, _exceptionType, _exceptionMessage);
3691 }
Jack Palevich560814f2009-11-19 16:34:55 +08003692}
3693
3694/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3695static void
3696android_glGetUniformfv__II_3FI
3697 (JNIEnv *_env, jobject _this, jint program, jint location, jfloatArray params_ref, jint offset) {
3698 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003699 const char * _exceptionType = NULL;
3700 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003701 GLfloat *params_base = (GLfloat *) 0;
3702 jint _remaining;
3703 GLfloat *params = (GLfloat *) 0;
3704
3705 if (!params_ref) {
3706 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003707 _exceptionType = "java/lang/IllegalArgumentException";
3708 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003709 goto exit;
3710 }
3711 if (offset < 0) {
3712 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003713 _exceptionType = "java/lang/IllegalArgumentException";
3714 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003715 goto exit;
3716 }
3717 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003718 if (_remaining < 1) {
3719 _exception = 1;
3720 _exceptionType = "java/lang/IllegalArgumentException";
3721 _exceptionMessage = "length - offset < 1 < needed";
3722 goto exit;
3723 }
Jack Palevich560814f2009-11-19 16:34:55 +08003724 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003725 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003726 params = params_base + offset;
3727
3728 glGetUniformfv(
3729 (GLuint)program,
3730 (GLint)location,
3731 (GLfloat *)params
3732 );
3733
3734exit:
3735 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003736 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003737 _exception ? JNI_ABORT: 0);
3738 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003739 if (_exception) {
3740 jniThrowException(_env, _exceptionType, _exceptionMessage);
3741 }
Jack Palevich560814f2009-11-19 16:34:55 +08003742}
3743
3744/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3745static void
3746android_glGetUniformfv__IILjava_nio_FloatBuffer_2
3747 (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003748 jint _exception = 0;
3749 const char * _exceptionType = NULL;
3750 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003751 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003752 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003753 jint _remaining;
3754 GLfloat *params = (GLfloat *) 0;
3755
Romain Guy84cac202016-12-05 12:26:02 -08003756 if (!params_buf) {
3757 _exception = 1;
3758 _exceptionType = "java/lang/IllegalArgumentException";
3759 _exceptionMessage = "params == null";
3760 goto exit;
3761 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003762 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003763 if (_remaining < 1) {
3764 _exception = 1;
3765 _exceptionType = "java/lang/IllegalArgumentException";
3766 _exceptionMessage = "remaining() < 1 < needed";
3767 goto exit;
3768 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003769 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003770 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003771 params = (GLfloat *) (_paramsBase + _bufferOffset);
3772 }
Jack Palevich560814f2009-11-19 16:34:55 +08003773 glGetUniformfv(
3774 (GLuint)program,
3775 (GLint)location,
3776 (GLfloat *)params
3777 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003778
3779exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003780 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003781 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003782 }
3783 if (_exception) {
3784 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003785 }
3786}
3787
3788/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3789static void
3790android_glGetUniformiv__II_3II
3791 (JNIEnv *_env, jobject _this, jint program, jint location, jintArray params_ref, jint offset) {
3792 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003793 const char * _exceptionType = NULL;
3794 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003795 GLint *params_base = (GLint *) 0;
3796 jint _remaining;
3797 GLint *params = (GLint *) 0;
3798
3799 if (!params_ref) {
3800 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003801 _exceptionType = "java/lang/IllegalArgumentException";
3802 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003803 goto exit;
3804 }
3805 if (offset < 0) {
3806 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003807 _exceptionType = "java/lang/IllegalArgumentException";
3808 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003809 goto exit;
3810 }
3811 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003812 if (_remaining < 1) {
3813 _exception = 1;
3814 _exceptionType = "java/lang/IllegalArgumentException";
3815 _exceptionMessage = "length - offset < 1 < needed";
3816 goto exit;
3817 }
Jack Palevich560814f2009-11-19 16:34:55 +08003818 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003819 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003820 params = params_base + offset;
3821
3822 glGetUniformiv(
3823 (GLuint)program,
3824 (GLint)location,
3825 (GLint *)params
3826 );
3827
3828exit:
3829 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003830 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003831 _exception ? JNI_ABORT: 0);
3832 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003833 if (_exception) {
3834 jniThrowException(_env, _exceptionType, _exceptionMessage);
3835 }
Jack Palevich560814f2009-11-19 16:34:55 +08003836}
3837
3838/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3839static void
3840android_glGetUniformiv__IILjava_nio_IntBuffer_2
3841 (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003842 jint _exception = 0;
3843 const char * _exceptionType = NULL;
3844 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003845 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003846 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003847 jint _remaining;
3848 GLint *params = (GLint *) 0;
3849
Romain Guy84cac202016-12-05 12:26:02 -08003850 if (!params_buf) {
3851 _exception = 1;
3852 _exceptionType = "java/lang/IllegalArgumentException";
3853 _exceptionMessage = "params == null";
3854 goto exit;
3855 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003856 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003857 if (_remaining < 1) {
3858 _exception = 1;
3859 _exceptionType = "java/lang/IllegalArgumentException";
3860 _exceptionMessage = "remaining() < 1 < needed";
3861 goto exit;
3862 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003863 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003864 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003865 params = (GLint *) (_paramsBase + _bufferOffset);
3866 }
Jack Palevich560814f2009-11-19 16:34:55 +08003867 glGetUniformiv(
3868 (GLuint)program,
3869 (GLint)location,
3870 (GLint *)params
3871 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003872
3873exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003874 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003875 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003876 }
3877 if (_exception) {
3878 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003879 }
3880}
3881
Mathias Agopian89be00b2013-02-22 20:08:06 -08003882/* GLint glGetUniformLocation ( GLuint program, const char *name ) */
Jack Palevich560814f2009-11-19 16:34:55 +08003883static jint
3884android_glGetUniformLocation__ILjava_lang_String_2
3885 (JNIEnv *_env, jobject _this, jint program, jstring name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003886 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003887 const char * _exceptionType = NULL;
3888 const char * _exceptionMessage = NULL;
Mathias Agopian89be00b2013-02-22 20:08:06 -08003889 GLint _returnValue = 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003890 const char* _nativename = 0;
3891
3892 if (!name) {
Elliott Hughes428d3fc2013-09-24 17:15:41 -07003893 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003894 _exceptionType = "java/lang/IllegalArgumentException";
3895 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003896 goto exit;
3897 }
3898 _nativename = _env->GetStringUTFChars(name, 0);
3899
3900 _returnValue = glGetUniformLocation(
3901 (GLuint)program,
3902 (char *)_nativename
3903 );
3904
3905exit:
3906 if (_nativename) {
3907 _env->ReleaseStringUTFChars(name, _nativename);
3908 }
3909
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003910 if (_exception) {
3911 jniThrowException(_env, _exceptionType, _exceptionMessage);
3912 }
Andy McFaddencee51982013-04-25 16:08:31 -07003913 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08003914}
3915
3916/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3917static void
3918android_glGetVertexAttribfv__II_3FI
3919 (JNIEnv *_env, jobject _this, jint index, jint pname, jfloatArray params_ref, jint offset) {
3920 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003921 const char * _exceptionType = NULL;
3922 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003923 GLfloat *params_base = (GLfloat *) 0;
3924 jint _remaining;
3925 GLfloat *params = (GLfloat *) 0;
3926
3927 if (!params_ref) {
3928 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003929 _exceptionType = "java/lang/IllegalArgumentException";
3930 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003931 goto exit;
3932 }
3933 if (offset < 0) {
3934 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003935 _exceptionType = "java/lang/IllegalArgumentException";
3936 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003937 goto exit;
3938 }
3939 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003940 int _needed;
3941 switch (pname) {
3942#if defined(GL_CURRENT_VERTEX_ATTRIB)
3943 case GL_CURRENT_VERTEX_ATTRIB:
3944#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3945 _needed = 4;
3946 break;
3947 default:
3948 _needed = 1;
3949 break;
3950 }
3951 if (_remaining < _needed) {
3952 _exception = 1;
3953 _exceptionType = "java/lang/IllegalArgumentException";
3954 _exceptionMessage = "length - offset < needed";
3955 goto exit;
3956 }
Jack Palevich560814f2009-11-19 16:34:55 +08003957 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003958 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003959 params = params_base + offset;
3960
3961 glGetVertexAttribfv(
3962 (GLuint)index,
3963 (GLenum)pname,
3964 (GLfloat *)params
3965 );
3966
3967exit:
3968 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003969 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003970 _exception ? JNI_ABORT: 0);
3971 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003972 if (_exception) {
3973 jniThrowException(_env, _exceptionType, _exceptionMessage);
3974 }
Jack Palevich560814f2009-11-19 16:34:55 +08003975}
3976
3977/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3978static void
3979android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2
3980 (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003981 jint _exception = 0;
3982 const char * _exceptionType = NULL;
3983 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003984 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003985 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003986 jint _remaining;
3987 GLfloat *params = (GLfloat *) 0;
3988
Romain Guy84cac202016-12-05 12:26:02 -08003989 if (!params_buf) {
3990 _exception = 1;
3991 _exceptionType = "java/lang/IllegalArgumentException";
3992 _exceptionMessage = "params == null";
3993 goto exit;
3994 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003995 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003996 int _needed;
3997 switch (pname) {
3998#if defined(GL_CURRENT_VERTEX_ATTRIB)
3999 case GL_CURRENT_VERTEX_ATTRIB:
4000#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
4001 _needed = 4;
4002 break;
4003 default:
4004 _needed = 1;
4005 break;
4006 }
4007 if (_remaining < _needed) {
4008 _exception = 1;
4009 _exceptionType = "java/lang/IllegalArgumentException";
4010 _exceptionMessage = "remaining() < needed";
4011 goto exit;
4012 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004013 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004014 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004015 params = (GLfloat *) (_paramsBase + _bufferOffset);
4016 }
Jack Palevich560814f2009-11-19 16:34:55 +08004017 glGetVertexAttribfv(
4018 (GLuint)index,
4019 (GLenum)pname,
4020 (GLfloat *)params
4021 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08004022
4023exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004024 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004025 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004026 }
4027 if (_exception) {
4028 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08004029 }
4030}
4031
4032/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
4033static void
4034android_glGetVertexAttribiv__II_3II
4035 (JNIEnv *_env, jobject _this, jint index, jint pname, jintArray params_ref, jint offset) {
4036 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004037 const char * _exceptionType = NULL;
4038 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004039 GLint *params_base = (GLint *) 0;
4040 jint _remaining;
4041 GLint *params = (GLint *) 0;
4042
4043 if (!params_ref) {
4044 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004045 _exceptionType = "java/lang/IllegalArgumentException";
4046 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004047 goto exit;
4048 }
4049 if (offset < 0) {
4050 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004051 _exceptionType = "java/lang/IllegalArgumentException";
4052 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004053 goto exit;
4054 }
4055 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004056 int _needed;
4057 switch (pname) {
4058#if defined(GL_CURRENT_VERTEX_ATTRIB)
4059 case GL_CURRENT_VERTEX_ATTRIB:
4060#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
4061 _needed = 4;
4062 break;
4063 default:
4064 _needed = 1;
4065 break;
4066 }
4067 if (_remaining < _needed) {
4068 _exception = 1;
4069 _exceptionType = "java/lang/IllegalArgumentException";
4070 _exceptionMessage = "length - offset < needed";
4071 goto exit;
4072 }
Jack Palevich560814f2009-11-19 16:34:55 +08004073 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004074 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08004075 params = params_base + offset;
4076
4077 glGetVertexAttribiv(
4078 (GLuint)index,
4079 (GLenum)pname,
4080 (GLint *)params
4081 );
4082
4083exit:
4084 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004085 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08004086 _exception ? JNI_ABORT: 0);
4087 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004088 if (_exception) {
4089 jniThrowException(_env, _exceptionType, _exceptionMessage);
4090 }
Jack Palevich560814f2009-11-19 16:34:55 +08004091}
4092
4093/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
4094static void
4095android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2
4096 (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08004097 jint _exception = 0;
4098 const char * _exceptionType = NULL;
4099 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004100 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004101 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004102 jint _remaining;
4103 GLint *params = (GLint *) 0;
4104
Romain Guy84cac202016-12-05 12:26:02 -08004105 if (!params_buf) {
4106 _exception = 1;
4107 _exceptionType = "java/lang/IllegalArgumentException";
4108 _exceptionMessage = "params == null";
4109 goto exit;
4110 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004111 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004112 int _needed;
4113 switch (pname) {
4114#if defined(GL_CURRENT_VERTEX_ATTRIB)
4115 case GL_CURRENT_VERTEX_ATTRIB:
4116#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
4117 _needed = 4;
4118 break;
4119 default:
4120 _needed = 1;
4121 break;
4122 }
4123 if (_remaining < _needed) {
4124 _exception = 1;
4125 _exceptionType = "java/lang/IllegalArgumentException";
4126 _exceptionMessage = "remaining() < needed";
4127 goto exit;
4128 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004129 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004130 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004131 params = (GLint *) (_paramsBase + _bufferOffset);
4132 }
Jack Palevich560814f2009-11-19 16:34:55 +08004133 glGetVertexAttribiv(
4134 (GLuint)index,
4135 (GLenum)pname,
4136 (GLint *)params
4137 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08004138
4139exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004140 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004141 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004142 }
4143 if (_exception) {
4144 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08004145 }
4146}
4147
4148/* void glHint ( GLenum target, GLenum mode ) */
4149static void
4150android_glHint__II
4151 (JNIEnv *_env, jobject _this, jint target, jint mode) {
4152 glHint(
4153 (GLenum)target,
4154 (GLenum)mode
4155 );
4156}
4157
4158/* GLboolean glIsBuffer ( GLuint buffer ) */
4159static jboolean
4160android_glIsBuffer__I
4161 (JNIEnv *_env, jobject _this, jint buffer) {
4162 GLboolean _returnValue;
4163 _returnValue = glIsBuffer(
4164 (GLuint)buffer
4165 );
Andy McFaddencee51982013-04-25 16:08:31 -07004166 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08004167}
4168
4169/* GLboolean glIsEnabled ( GLenum cap ) */
4170static jboolean
4171android_glIsEnabled__I
4172 (JNIEnv *_env, jobject _this, jint cap) {
4173 GLboolean _returnValue;
4174 _returnValue = glIsEnabled(
4175 (GLenum)cap
4176 );
Andy McFaddencee51982013-04-25 16:08:31 -07004177 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08004178}
4179
4180/* GLboolean glIsFramebuffer ( GLuint framebuffer ) */
4181static jboolean
4182android_glIsFramebuffer__I
4183 (JNIEnv *_env, jobject _this, jint framebuffer) {
4184 GLboolean _returnValue;
4185 _returnValue = glIsFramebuffer(
4186 (GLuint)framebuffer
4187 );
Andy McFaddencee51982013-04-25 16:08:31 -07004188 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08004189}
4190
4191/* GLboolean glIsProgram ( GLuint program ) */
4192static jboolean
4193android_glIsProgram__I
4194 (JNIEnv *_env, jobject _this, jint program) {
4195 GLboolean _returnValue;
4196 _returnValue = glIsProgram(
4197 (GLuint)program
4198 );
Andy McFaddencee51982013-04-25 16:08:31 -07004199 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08004200}
4201
4202/* GLboolean glIsRenderbuffer ( GLuint renderbuffer ) */
4203static jboolean
4204android_glIsRenderbuffer__I
4205 (JNIEnv *_env, jobject _this, jint renderbuffer) {
4206 GLboolean _returnValue;
4207 _returnValue = glIsRenderbuffer(
4208 (GLuint)renderbuffer
4209 );
Andy McFaddencee51982013-04-25 16:08:31 -07004210 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08004211}
4212
4213/* GLboolean glIsShader ( GLuint shader ) */
4214static jboolean
4215android_glIsShader__I
4216 (JNIEnv *_env, jobject _this, jint shader) {
4217 GLboolean _returnValue;
4218 _returnValue = glIsShader(
4219 (GLuint)shader
4220 );
Andy McFaddencee51982013-04-25 16:08:31 -07004221 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08004222}
4223
4224/* GLboolean glIsTexture ( GLuint texture ) */
4225static jboolean
4226android_glIsTexture__I
4227 (JNIEnv *_env, jobject _this, jint texture) {
4228 GLboolean _returnValue;
4229 _returnValue = glIsTexture(
4230 (GLuint)texture
4231 );
Andy McFaddencee51982013-04-25 16:08:31 -07004232 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08004233}
4234
4235/* void glLineWidth ( GLfloat width ) */
4236static void
4237android_glLineWidth__F
4238 (JNIEnv *_env, jobject _this, jfloat width) {
4239 glLineWidth(
4240 (GLfloat)width
4241 );
4242}
4243
4244/* void glLinkProgram ( GLuint program ) */
4245static void
4246android_glLinkProgram__I
4247 (JNIEnv *_env, jobject _this, jint program) {
4248 glLinkProgram(
4249 (GLuint)program
4250 );
4251}
4252
4253/* void glPixelStorei ( GLenum pname, GLint param ) */
4254static void
4255android_glPixelStorei__II
4256 (JNIEnv *_env, jobject _this, jint pname, jint param) {
4257 glPixelStorei(
4258 (GLenum)pname,
4259 (GLint)param
4260 );
4261}
4262
4263/* void glPolygonOffset ( GLfloat factor, GLfloat units ) */
4264static void
4265android_glPolygonOffset__FF
4266 (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) {
4267 glPolygonOffset(
4268 (GLfloat)factor,
4269 (GLfloat)units
4270 );
4271}
4272
4273/* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */
4274static void
4275android_glReadPixels__IIIIIILjava_nio_Buffer_2
4276 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) {
Romain Guy84cac202016-12-05 12:26:02 -08004277 jint _exception = 0;
4278 const char * _exceptionType = NULL;
4279 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004280 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004281 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004282 jint _remaining;
4283 GLvoid *pixels = (GLvoid *) 0;
4284
Romain Guy84cac202016-12-05 12:26:02 -08004285 if (!pixels_buf) {
4286 _exception = 1;
4287 _exceptionType = "java/lang/IllegalArgumentException";
4288 _exceptionMessage = "pixels == null";
4289 goto exit;
4290 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004291 pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004292 if (pixels == NULL) {
4293 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4294 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
4295 }
Jack Palevich560814f2009-11-19 16:34:55 +08004296 glReadPixels(
4297 (GLint)x,
4298 (GLint)y,
4299 (GLsizei)width,
4300 (GLsizei)height,
4301 (GLenum)format,
4302 (GLenum)type,
4303 (GLvoid *)pixels
4304 );
Romain Guy84cac202016-12-05 12:26:02 -08004305
4306exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004307 if (_array) {
Romain Guy84cac202016-12-05 12:26:02 -08004308 releasePointer(_env, _array, pixels, _exception ? JNI_FALSE : JNI_TRUE);
4309 }
4310 if (_exception) {
4311 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08004312 }
4313}
4314
4315/* void glReleaseShaderCompiler ( void ) */
4316static void
4317android_glReleaseShaderCompiler__
4318 (JNIEnv *_env, jobject _this) {
4319 glReleaseShaderCompiler();
4320}
4321
4322/* void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) */
4323static void
4324android_glRenderbufferStorage__IIII
4325 (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint width, jint height) {
4326 glRenderbufferStorage(
4327 (GLenum)target,
4328 (GLenum)internalformat,
4329 (GLsizei)width,
4330 (GLsizei)height
4331 );
4332}
4333
4334/* void glSampleCoverage ( GLclampf value, GLboolean invert ) */
4335static void
4336android_glSampleCoverage__FZ
4337 (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) {
4338 glSampleCoverage(
4339 (GLclampf)value,
4340 (GLboolean)invert
4341 );
4342}
4343
4344/* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */
4345static void
4346android_glScissor__IIII
4347 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
4348 glScissor(
4349 (GLint)x,
4350 (GLint)y,
4351 (GLsizei)width,
4352 (GLsizei)height
4353 );
4354}
4355
4356/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
4357static void
4358android_glShaderBinary__I_3IIILjava_nio_Buffer_2I
4359 (JNIEnv *_env, jobject _this, jint n, jintArray shaders_ref, jint offset, jint binaryformat, jobject binary_buf, jint length) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004360 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004361 const char * _exceptionType = NULL;
4362 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004363 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004364 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004365 GLuint *shaders_base = (GLuint *) 0;
4366 jint _shadersRemaining;
4367 GLuint *shaders = (GLuint *) 0;
4368 jint _binaryRemaining;
4369 GLvoid *binary = (GLvoid *) 0;
4370
4371 if (!shaders_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004372 _exception = 1;
4373 _exceptionType = "java/lang/IllegalArgumentException";
4374 _exceptionMessage = "shaders == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004375 goto exit;
4376 }
4377 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004378 _exception = 1;
4379 _exceptionType = "java/lang/IllegalArgumentException";
4380 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004381 goto exit;
4382 }
4383 _shadersRemaining = _env->GetArrayLength(shaders_ref) - offset;
4384 shaders_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004385 _env->GetIntArrayElements(shaders_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08004386 shaders = shaders_base + offset;
4387
Romain Guy84cac202016-12-05 12:26:02 -08004388 if (!binary_buf) {
4389 _exception = 1;
4390 _exceptionType = "java/lang/IllegalArgumentException";
4391 _exceptionMessage = "binary == null";
4392 goto exit;
4393 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004394 binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_array, &_binaryRemaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004395 if (_binaryRemaining < length) {
4396 _exception = 1;
4397 _exceptionType = "java/lang/IllegalArgumentException";
4398 _exceptionMessage = "remaining() < length < needed";
4399 goto exit;
4400 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004401 if (binary == NULL) {
4402 char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4403 binary = (GLvoid *) (_binaryBase + _bufferOffset);
4404 }
Jack Palevich560814f2009-11-19 16:34:55 +08004405 glShaderBinary(
4406 (GLsizei)n,
4407 (GLuint *)shaders,
4408 (GLenum)binaryformat,
4409 (GLvoid *)binary,
4410 (GLsizei)length
4411 );
4412
4413exit:
4414 if (_array) {
4415 releasePointer(_env, _array, binary, JNI_FALSE);
4416 }
4417 if (shaders_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004418 _env->ReleaseIntArrayElements(shaders_ref, (jint*)shaders_base,
Jack Palevich560814f2009-11-19 16:34:55 +08004419 JNI_ABORT);
4420 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004421 if (_exception) {
4422 jniThrowException(_env, _exceptionType, _exceptionMessage);
4423 }
Jack Palevich560814f2009-11-19 16:34:55 +08004424}
4425
4426/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
4427static void
4428android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I
4429 (JNIEnv *_env, jobject _this, jint n, jobject shaders_buf, jint binaryformat, jobject binary_buf, jint length) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08004430 jint _exception = 0;
4431 const char * _exceptionType = NULL;
4432 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004433 jintArray _shadersArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004434 jint _shadersBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004435 jintArray _binaryArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004436 jint _binaryBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004437 jint _shadersRemaining;
4438 GLuint *shaders = (GLuint *) 0;
4439 jint _binaryRemaining;
4440 GLvoid *binary = (GLvoid *) 0;
4441
Romain Guy84cac202016-12-05 12:26:02 -08004442 if (!shaders_buf) {
4443 _exception = 1;
4444 _exceptionType = "java/lang/IllegalArgumentException";
4445 _exceptionMessage = "shaders == null";
4446 goto exit;
4447 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004448 shaders = (GLuint *)getPointer(_env, shaders_buf, (jarray*)&_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
Romain Guy84cac202016-12-05 12:26:02 -08004449 if (!binary_buf) {
4450 _exception = 1;
4451 _exceptionType = "java/lang/IllegalArgumentException";
4452 _exceptionMessage = "binary == null";
4453 goto exit;
4454 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004455 binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_binaryArray, &_binaryRemaining, &_binaryBufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004456 if (_binaryRemaining < length) {
4457 _exception = 1;
4458 _exceptionType = "java/lang/IllegalArgumentException";
4459 _exceptionMessage = "remaining() < length < needed";
4460 goto exit;
4461 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004462 if (shaders == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004463 char * _shadersBase = (char *)_env->GetIntArrayElements(_shadersArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004464 shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
4465 }
4466 if (binary == NULL) {
4467 char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_binaryArray, (jboolean *) 0);
4468 binary = (GLvoid *) (_binaryBase + _binaryBufferOffset);
4469 }
Jack Palevich560814f2009-11-19 16:34:55 +08004470 glShaderBinary(
4471 (GLsizei)n,
4472 (GLuint *)shaders,
4473 (GLenum)binaryformat,
4474 (GLvoid *)binary,
4475 (GLsizei)length
4476 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08004477
4478exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004479 if (_binaryArray) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004480 releasePointer(_env, _binaryArray, binary, JNI_FALSE);
4481 }
4482 if (_shadersArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004483 _env->ReleaseIntArrayElements(_shadersArray, (jint*)shaders, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08004484 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08004485 if (_exception) {
4486 jniThrowException(_env, _exceptionType, _exceptionMessage);
4487 }
Jack Palevich560814f2009-11-19 16:34:55 +08004488}
4489
4490
4491/* void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint * length ) */
4492static
4493void
4494android_glShaderSource
4495 (JNIEnv *_env, jobject _this, jint shader, jstring string) {
4496
4497 if (!string) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07004498 jniThrowException(_env, "java/lang/IllegalArgumentException", "string == null");
Jack Palevich560814f2009-11-19 16:34:55 +08004499 return;
4500 }
4501
4502 const char* nativeString = _env->GetStringUTFChars(string, 0);
4503 const char* strings[] = {nativeString};
4504 glShaderSource(shader, 1, strings, 0);
4505 _env->ReleaseStringUTFChars(string, nativeString);
4506}
4507/* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */
4508static void
4509android_glStencilFunc__III
4510 (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) {
4511 glStencilFunc(
4512 (GLenum)func,
4513 (GLint)ref,
4514 (GLuint)mask
4515 );
4516}
4517
4518/* void glStencilFuncSeparate ( GLenum face, GLenum func, GLint ref, GLuint mask ) */
4519static void
4520android_glStencilFuncSeparate__IIII
4521 (JNIEnv *_env, jobject _this, jint face, jint func, jint ref, jint mask) {
4522 glStencilFuncSeparate(
4523 (GLenum)face,
4524 (GLenum)func,
4525 (GLint)ref,
4526 (GLuint)mask
4527 );
4528}
4529
4530/* void glStencilMask ( GLuint mask ) */
4531static void
4532android_glStencilMask__I
4533 (JNIEnv *_env, jobject _this, jint mask) {
4534 glStencilMask(
4535 (GLuint)mask
4536 );
4537}
4538
4539/* void glStencilMaskSeparate ( GLenum face, GLuint mask ) */
4540static void
4541android_glStencilMaskSeparate__II
4542 (JNIEnv *_env, jobject _this, jint face, jint mask) {
4543 glStencilMaskSeparate(
4544 (GLenum)face,
4545 (GLuint)mask
4546 );
4547}
4548
4549/* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */
4550static void
4551android_glStencilOp__III
4552 (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) {
4553 glStencilOp(
4554 (GLenum)fail,
4555 (GLenum)zfail,
4556 (GLenum)zpass
4557 );
4558}
4559
4560/* void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) */
4561static void
4562android_glStencilOpSeparate__IIII
4563 (JNIEnv *_env, jobject _this, jint face, jint fail, jint zfail, jint zpass) {
4564 glStencilOpSeparate(
4565 (GLenum)face,
4566 (GLenum)fail,
4567 (GLenum)zfail,
4568 (GLenum)zpass
4569 );
4570}
4571
4572/* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */
4573static void
4574android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2
4575 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) {
Romain Guy84cac202016-12-05 12:26:02 -08004576 jint _exception = 0;
4577 const char * _exceptionType = NULL;
4578 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004579 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004580 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004581 jint _remaining;
4582 GLvoid *pixels = (GLvoid *) 0;
4583
4584 if (pixels_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004585 pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004586 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -07004587 if (pixels_buf && pixels == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004588 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4589 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08004590 }
4591 glTexImage2D(
4592 (GLenum)target,
4593 (GLint)level,
4594 (GLint)internalformat,
4595 (GLsizei)width,
4596 (GLsizei)height,
4597 (GLint)border,
4598 (GLenum)format,
4599 (GLenum)type,
4600 (GLvoid *)pixels
4601 );
4602 if (_array) {
4603 releasePointer(_env, _array, pixels, JNI_FALSE);
4604 }
Romain Guy84cac202016-12-05 12:26:02 -08004605 if (_exception) {
4606 jniThrowException(_env, _exceptionType, _exceptionMessage);
4607 }
Jack Palevich560814f2009-11-19 16:34:55 +08004608}
4609
4610/* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */
4611static void
4612android_glTexParameterf__IIF
4613 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
4614 glTexParameterf(
4615 (GLenum)target,
4616 (GLenum)pname,
4617 (GLfloat)param
4618 );
4619}
4620
4621/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
4622static void
4623android_glTexParameterfv__II_3FI
4624 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004625 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004626 const char * _exceptionType = NULL;
4627 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004628 GLfloat *params_base = (GLfloat *) 0;
4629 jint _remaining;
4630 GLfloat *params = (GLfloat *) 0;
4631
4632 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004633 _exception = 1;
4634 _exceptionType = "java/lang/IllegalArgumentException";
4635 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004636 goto exit;
4637 }
4638 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004639 _exception = 1;
4640 _exceptionType = "java/lang/IllegalArgumentException";
4641 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004642 goto exit;
4643 }
4644 _remaining = _env->GetArrayLength(params_ref) - offset;
4645 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004646 _exception = 1;
4647 _exceptionType = "java/lang/IllegalArgumentException";
4648 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08004649 goto exit;
4650 }
4651 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004652 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08004653 params = params_base + offset;
4654
4655 glTexParameterfv(
4656 (GLenum)target,
4657 (GLenum)pname,
4658 (GLfloat *)params
4659 );
4660
4661exit:
4662 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004663 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08004664 JNI_ABORT);
4665 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004666 if (_exception) {
4667 jniThrowException(_env, _exceptionType, _exceptionMessage);
4668 }
Jack Palevich560814f2009-11-19 16:34:55 +08004669}
4670
4671/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
4672static void
4673android_glTexParameterfv__IILjava_nio_FloatBuffer_2
4674 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004675 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004676 const char * _exceptionType = NULL;
4677 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004678 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004679 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004680 jint _remaining;
4681 GLfloat *params = (GLfloat *) 0;
4682
Romain Guy84cac202016-12-05 12:26:02 -08004683 if (!params_buf) {
4684 _exception = 1;
4685 _exceptionType = "java/lang/IllegalArgumentException";
4686 _exceptionMessage = "params == null";
4687 goto exit;
4688 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004689 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08004690 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004691 _exception = 1;
4692 _exceptionType = "java/lang/IllegalArgumentException";
4693 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08004694 goto exit;
4695 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004696 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004697 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004698 params = (GLfloat *) (_paramsBase + _bufferOffset);
4699 }
Jack Palevich560814f2009-11-19 16:34:55 +08004700 glTexParameterfv(
4701 (GLenum)target,
4702 (GLenum)pname,
4703 (GLfloat *)params
4704 );
4705
4706exit:
4707 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004708 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08004709 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004710 if (_exception) {
4711 jniThrowException(_env, _exceptionType, _exceptionMessage);
4712 }
Jack Palevich560814f2009-11-19 16:34:55 +08004713}
4714
4715/* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */
4716static void
4717android_glTexParameteri__III
4718 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
4719 glTexParameteri(
4720 (GLenum)target,
4721 (GLenum)pname,
4722 (GLint)param
4723 );
4724}
4725
4726/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
4727static void
4728android_glTexParameteriv__II_3II
4729 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004730 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004731 const char * _exceptionType = NULL;
4732 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004733 GLint *params_base = (GLint *) 0;
4734 jint _remaining;
4735 GLint *params = (GLint *) 0;
4736
4737 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004738 _exception = 1;
4739 _exceptionType = "java/lang/IllegalArgumentException";
4740 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004741 goto exit;
4742 }
4743 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004744 _exception = 1;
4745 _exceptionType = "java/lang/IllegalArgumentException";
4746 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004747 goto exit;
4748 }
4749 _remaining = _env->GetArrayLength(params_ref) - offset;
4750 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004751 _exception = 1;
4752 _exceptionType = "java/lang/IllegalArgumentException";
4753 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08004754 goto exit;
4755 }
4756 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004757 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08004758 params = params_base + offset;
4759
4760 glTexParameteriv(
4761 (GLenum)target,
4762 (GLenum)pname,
4763 (GLint *)params
4764 );
4765
4766exit:
4767 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004768 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08004769 JNI_ABORT);
4770 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004771 if (_exception) {
4772 jniThrowException(_env, _exceptionType, _exceptionMessage);
4773 }
Jack Palevich560814f2009-11-19 16:34:55 +08004774}
4775
4776/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
4777static void
4778android_glTexParameteriv__IILjava_nio_IntBuffer_2
4779 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004780 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004781 const char * _exceptionType = NULL;
4782 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004783 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004784 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004785 jint _remaining;
4786 GLint *params = (GLint *) 0;
4787
Romain Guy84cac202016-12-05 12:26:02 -08004788 if (!params_buf) {
4789 _exception = 1;
4790 _exceptionType = "java/lang/IllegalArgumentException";
4791 _exceptionMessage = "params == null";
4792 goto exit;
4793 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004794 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08004795 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004796 _exception = 1;
4797 _exceptionType = "java/lang/IllegalArgumentException";
4798 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08004799 goto exit;
4800 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004801 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004802 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004803 params = (GLint *) (_paramsBase + _bufferOffset);
4804 }
Jack Palevich560814f2009-11-19 16:34:55 +08004805 glTexParameteriv(
4806 (GLenum)target,
4807 (GLenum)pname,
4808 (GLint *)params
4809 );
4810
4811exit:
4812 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004813 _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08004814 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004815 if (_exception) {
4816 jniThrowException(_env, _exceptionType, _exceptionMessage);
4817 }
Jack Palevich560814f2009-11-19 16:34:55 +08004818}
4819
4820/* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */
4821static void
4822android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
4823 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) {
Romain Guy84cac202016-12-05 12:26:02 -08004824 jint _exception = 0;
4825 const char * _exceptionType = NULL;
4826 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004827 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004828 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004829 jint _remaining;
4830 GLvoid *pixels = (GLvoid *) 0;
4831
4832 if (pixels_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004833 pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004834 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -07004835 if (pixels_buf && pixels == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004836 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4837 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08004838 }
4839 glTexSubImage2D(
4840 (GLenum)target,
4841 (GLint)level,
4842 (GLint)xoffset,
4843 (GLint)yoffset,
4844 (GLsizei)width,
4845 (GLsizei)height,
4846 (GLenum)format,
4847 (GLenum)type,
4848 (GLvoid *)pixels
4849 );
4850 if (_array) {
4851 releasePointer(_env, _array, pixels, JNI_FALSE);
4852 }
Romain Guy84cac202016-12-05 12:26:02 -08004853 if (_exception) {
4854 jniThrowException(_env, _exceptionType, _exceptionMessage);
4855 }
Jack Palevich560814f2009-11-19 16:34:55 +08004856}
4857
4858/* void glUniform1f ( GLint location, GLfloat x ) */
4859static void
4860android_glUniform1f__IF
4861 (JNIEnv *_env, jobject _this, jint location, jfloat x) {
4862 glUniform1f(
4863 (GLint)location,
4864 (GLfloat)x
4865 );
4866}
4867
4868/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
4869static void
4870android_glUniform1fv__II_3FI
4871 (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004872 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004873 const char * _exceptionType = NULL;
4874 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004875 GLfloat *v_base = (GLfloat *) 0;
4876 jint _remaining;
4877 GLfloat *v = (GLfloat *) 0;
4878
4879 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004880 _exception = 1;
4881 _exceptionType = "java/lang/IllegalArgumentException";
4882 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004883 goto exit;
4884 }
4885 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004886 _exception = 1;
4887 _exceptionType = "java/lang/IllegalArgumentException";
4888 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004889 goto exit;
4890 }
4891 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004892 if (_remaining < count) {
4893 _exception = 1;
4894 _exceptionType = "java/lang/IllegalArgumentException";
4895 _exceptionMessage = "length - offset < count < needed";
4896 goto exit;
4897 }
Jack Palevich560814f2009-11-19 16:34:55 +08004898 v_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004899 _env->GetFloatArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08004900 v = v_base + offset;
4901
4902 glUniform1fv(
4903 (GLint)location,
4904 (GLsizei)count,
4905 (GLfloat *)v
4906 );
4907
4908exit:
4909 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004910 _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08004911 JNI_ABORT);
4912 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004913 if (_exception) {
4914 jniThrowException(_env, _exceptionType, _exceptionMessage);
4915 }
Jack Palevich560814f2009-11-19 16:34:55 +08004916}
4917
4918/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
4919static void
4920android_glUniform1fv__IILjava_nio_FloatBuffer_2
4921 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08004922 jint _exception = 0;
4923 const char * _exceptionType = NULL;
4924 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004925 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004926 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004927 jint _remaining;
4928 GLfloat *v = (GLfloat *) 0;
4929
Romain Guy84cac202016-12-05 12:26:02 -08004930 if (!v_buf) {
4931 _exception = 1;
4932 _exceptionType = "java/lang/IllegalArgumentException";
4933 _exceptionMessage = "v == null";
4934 goto exit;
4935 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004936 v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004937 if (_remaining < count) {
4938 _exception = 1;
4939 _exceptionType = "java/lang/IllegalArgumentException";
4940 _exceptionMessage = "remaining() < count < needed";
4941 goto exit;
4942 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004943 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004944 char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004945 v = (GLfloat *) (_vBase + _bufferOffset);
4946 }
Jack Palevich560814f2009-11-19 16:34:55 +08004947 glUniform1fv(
4948 (GLint)location,
4949 (GLsizei)count,
4950 (GLfloat *)v
4951 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08004952
4953exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004954 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004955 _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08004956 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08004957 if (_exception) {
4958 jniThrowException(_env, _exceptionType, _exceptionMessage);
4959 }
Jack Palevich560814f2009-11-19 16:34:55 +08004960}
4961
4962/* void glUniform1i ( GLint location, GLint x ) */
4963static void
4964android_glUniform1i__II
4965 (JNIEnv *_env, jobject _this, jint location, jint x) {
4966 glUniform1i(
4967 (GLint)location,
4968 (GLint)x
4969 );
4970}
4971
4972/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
4973static void
4974android_glUniform1iv__II_3II
4975 (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004976 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004977 const char * _exceptionType = NULL;
4978 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004979 GLint *v_base = (GLint *) 0;
4980 jint _remaining;
4981 GLint *v = (GLint *) 0;
4982
4983 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004984 _exception = 1;
4985 _exceptionType = "java/lang/IllegalArgumentException";
4986 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004987 goto exit;
4988 }
4989 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004990 _exception = 1;
4991 _exceptionType = "java/lang/IllegalArgumentException";
4992 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004993 goto exit;
4994 }
4995 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004996 if (_remaining < count) {
4997 _exception = 1;
4998 _exceptionType = "java/lang/IllegalArgumentException";
4999 _exceptionMessage = "length - offset < count < needed";
5000 goto exit;
5001 }
Jack Palevich560814f2009-11-19 16:34:55 +08005002 v_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005003 _env->GetIntArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005004 v = v_base + offset;
5005
5006 glUniform1iv(
5007 (GLint)location,
5008 (GLsizei)count,
5009 (GLint *)v
5010 );
5011
5012exit:
5013 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005014 _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005015 JNI_ABORT);
5016 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005017 if (_exception) {
5018 jniThrowException(_env, _exceptionType, _exceptionMessage);
5019 }
Jack Palevich560814f2009-11-19 16:34:55 +08005020}
5021
5022/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
5023static void
5024android_glUniform1iv__IILjava_nio_IntBuffer_2
5025 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005026 jint _exception = 0;
5027 const char * _exceptionType = NULL;
5028 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005029 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005030 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005031 jint _remaining;
5032 GLint *v = (GLint *) 0;
5033
Romain Guy84cac202016-12-05 12:26:02 -08005034 if (!v_buf) {
5035 _exception = 1;
5036 _exceptionType = "java/lang/IllegalArgumentException";
5037 _exceptionMessage = "v == null";
5038 goto exit;
5039 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005040 v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005041 if (_remaining < count) {
5042 _exception = 1;
5043 _exceptionType = "java/lang/IllegalArgumentException";
5044 _exceptionMessage = "remaining() < count < needed";
5045 goto exit;
5046 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005047 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005048 char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005049 v = (GLint *) (_vBase + _bufferOffset);
5050 }
Jack Palevich560814f2009-11-19 16:34:55 +08005051 glUniform1iv(
5052 (GLint)location,
5053 (GLsizei)count,
5054 (GLint *)v
5055 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005056
5057exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005058 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005059 _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005060 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005061 if (_exception) {
5062 jniThrowException(_env, _exceptionType, _exceptionMessage);
5063 }
Jack Palevich560814f2009-11-19 16:34:55 +08005064}
5065
5066/* void glUniform2f ( GLint location, GLfloat x, GLfloat y ) */
5067static void
5068android_glUniform2f__IFF
5069 (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y) {
5070 glUniform2f(
5071 (GLint)location,
5072 (GLfloat)x,
5073 (GLfloat)y
5074 );
5075}
5076
5077/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
5078static void
5079android_glUniform2fv__II_3FI
5080 (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005081 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005082 const char * _exceptionType = NULL;
5083 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005084 GLfloat *v_base = (GLfloat *) 0;
5085 jint _remaining;
5086 GLfloat *v = (GLfloat *) 0;
5087
5088 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005089 _exception = 1;
5090 _exceptionType = "java/lang/IllegalArgumentException";
5091 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005092 goto exit;
5093 }
5094 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005095 _exception = 1;
5096 _exceptionType = "java/lang/IllegalArgumentException";
5097 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005098 goto exit;
5099 }
5100 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005101 if (_remaining < count*2) {
5102 _exception = 1;
5103 _exceptionType = "java/lang/IllegalArgumentException";
5104 _exceptionMessage = "length - offset < count*2 < needed";
5105 goto exit;
5106 }
Jack Palevich560814f2009-11-19 16:34:55 +08005107 v_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005108 _env->GetFloatArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005109 v = v_base + offset;
5110
5111 glUniform2fv(
5112 (GLint)location,
5113 (GLsizei)count,
5114 (GLfloat *)v
5115 );
5116
5117exit:
5118 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005119 _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005120 JNI_ABORT);
5121 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005122 if (_exception) {
5123 jniThrowException(_env, _exceptionType, _exceptionMessage);
5124 }
Jack Palevich560814f2009-11-19 16:34:55 +08005125}
5126
5127/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
5128static void
5129android_glUniform2fv__IILjava_nio_FloatBuffer_2
5130 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005131 jint _exception = 0;
5132 const char * _exceptionType = NULL;
5133 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005134 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005135 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005136 jint _remaining;
5137 GLfloat *v = (GLfloat *) 0;
5138
Romain Guy84cac202016-12-05 12:26:02 -08005139 if (!v_buf) {
5140 _exception = 1;
5141 _exceptionType = "java/lang/IllegalArgumentException";
5142 _exceptionMessage = "v == null";
5143 goto exit;
5144 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005145 v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005146 if (_remaining < count*2) {
5147 _exception = 1;
5148 _exceptionType = "java/lang/IllegalArgumentException";
5149 _exceptionMessage = "remaining() < count*2 < needed";
5150 goto exit;
5151 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005152 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005153 char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005154 v = (GLfloat *) (_vBase + _bufferOffset);
5155 }
Jack Palevich560814f2009-11-19 16:34:55 +08005156 glUniform2fv(
5157 (GLint)location,
5158 (GLsizei)count,
5159 (GLfloat *)v
5160 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005161
5162exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005163 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005164 _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005165 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005166 if (_exception) {
5167 jniThrowException(_env, _exceptionType, _exceptionMessage);
5168 }
Jack Palevich560814f2009-11-19 16:34:55 +08005169}
5170
5171/* void glUniform2i ( GLint location, GLint x, GLint y ) */
5172static void
5173android_glUniform2i__III
5174 (JNIEnv *_env, jobject _this, jint location, jint x, jint y) {
5175 glUniform2i(
5176 (GLint)location,
5177 (GLint)x,
5178 (GLint)y
5179 );
5180}
5181
5182/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
5183static void
5184android_glUniform2iv__II_3II
5185 (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005186 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005187 const char * _exceptionType = NULL;
5188 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005189 GLint *v_base = (GLint *) 0;
5190 jint _remaining;
5191 GLint *v = (GLint *) 0;
5192
5193 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005194 _exception = 1;
5195 _exceptionType = "java/lang/IllegalArgumentException";
5196 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005197 goto exit;
5198 }
5199 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005200 _exception = 1;
5201 _exceptionType = "java/lang/IllegalArgumentException";
5202 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005203 goto exit;
5204 }
5205 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005206 if (_remaining < count*2) {
5207 _exception = 1;
5208 _exceptionType = "java/lang/IllegalArgumentException";
5209 _exceptionMessage = "length - offset < count*2 < needed";
5210 goto exit;
5211 }
Jack Palevich560814f2009-11-19 16:34:55 +08005212 v_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005213 _env->GetIntArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005214 v = v_base + offset;
5215
5216 glUniform2iv(
5217 (GLint)location,
5218 (GLsizei)count,
5219 (GLint *)v
5220 );
5221
5222exit:
5223 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005224 _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005225 JNI_ABORT);
5226 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005227 if (_exception) {
5228 jniThrowException(_env, _exceptionType, _exceptionMessage);
5229 }
Jack Palevich560814f2009-11-19 16:34:55 +08005230}
5231
5232/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
5233static void
5234android_glUniform2iv__IILjava_nio_IntBuffer_2
5235 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005236 jint _exception = 0;
5237 const char * _exceptionType = NULL;
5238 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005239 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005240 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005241 jint _remaining;
5242 GLint *v = (GLint *) 0;
5243
Romain Guy84cac202016-12-05 12:26:02 -08005244 if (!v_buf) {
5245 _exception = 1;
5246 _exceptionType = "java/lang/IllegalArgumentException";
5247 _exceptionMessage = "v == null";
5248 goto exit;
5249 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005250 v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005251 if (_remaining < count*2) {
5252 _exception = 1;
5253 _exceptionType = "java/lang/IllegalArgumentException";
5254 _exceptionMessage = "remaining() < count*2 < needed";
5255 goto exit;
5256 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005257 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005258 char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005259 v = (GLint *) (_vBase + _bufferOffset);
5260 }
Jack Palevich560814f2009-11-19 16:34:55 +08005261 glUniform2iv(
5262 (GLint)location,
5263 (GLsizei)count,
5264 (GLint *)v
5265 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005266
5267exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005268 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005269 _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005270 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005271 if (_exception) {
5272 jniThrowException(_env, _exceptionType, _exceptionMessage);
5273 }
Jack Palevich560814f2009-11-19 16:34:55 +08005274}
5275
5276/* void glUniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z ) */
5277static void
5278android_glUniform3f__IFFF
5279 (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z) {
5280 glUniform3f(
5281 (GLint)location,
5282 (GLfloat)x,
5283 (GLfloat)y,
5284 (GLfloat)z
5285 );
5286}
5287
5288/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
5289static void
5290android_glUniform3fv__II_3FI
5291 (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005292 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005293 const char * _exceptionType = NULL;
5294 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005295 GLfloat *v_base = (GLfloat *) 0;
5296 jint _remaining;
5297 GLfloat *v = (GLfloat *) 0;
5298
5299 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005300 _exception = 1;
5301 _exceptionType = "java/lang/IllegalArgumentException";
5302 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005303 goto exit;
5304 }
5305 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005306 _exception = 1;
5307 _exceptionType = "java/lang/IllegalArgumentException";
5308 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005309 goto exit;
5310 }
5311 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005312 if (_remaining < count*3) {
5313 _exception = 1;
5314 _exceptionType = "java/lang/IllegalArgumentException";
5315 _exceptionMessage = "length - offset < count*3 < needed";
5316 goto exit;
5317 }
Jack Palevich560814f2009-11-19 16:34:55 +08005318 v_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005319 _env->GetFloatArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005320 v = v_base + offset;
5321
5322 glUniform3fv(
5323 (GLint)location,
5324 (GLsizei)count,
5325 (GLfloat *)v
5326 );
5327
5328exit:
5329 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005330 _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005331 JNI_ABORT);
5332 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005333 if (_exception) {
5334 jniThrowException(_env, _exceptionType, _exceptionMessage);
5335 }
Jack Palevich560814f2009-11-19 16:34:55 +08005336}
5337
5338/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
5339static void
5340android_glUniform3fv__IILjava_nio_FloatBuffer_2
5341 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005342 jint _exception = 0;
5343 const char * _exceptionType = NULL;
5344 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005345 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005346 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005347 jint _remaining;
5348 GLfloat *v = (GLfloat *) 0;
5349
Romain Guy84cac202016-12-05 12:26:02 -08005350 if (!v_buf) {
5351 _exception = 1;
5352 _exceptionType = "java/lang/IllegalArgumentException";
5353 _exceptionMessage = "v == null";
5354 goto exit;
5355 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005356 v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005357 if (_remaining < count*3) {
5358 _exception = 1;
5359 _exceptionType = "java/lang/IllegalArgumentException";
5360 _exceptionMessage = "remaining() < count*3 < needed";
5361 goto exit;
5362 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005363 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005364 char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005365 v = (GLfloat *) (_vBase + _bufferOffset);
5366 }
Jack Palevich560814f2009-11-19 16:34:55 +08005367 glUniform3fv(
5368 (GLint)location,
5369 (GLsizei)count,
5370 (GLfloat *)v
5371 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005372
5373exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005374 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005375 _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005376 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005377 if (_exception) {
5378 jniThrowException(_env, _exceptionType, _exceptionMessage);
5379 }
Jack Palevich560814f2009-11-19 16:34:55 +08005380}
5381
5382/* void glUniform3i ( GLint location, GLint x, GLint y, GLint z ) */
5383static void
5384android_glUniform3i__IIII
5385 (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z) {
5386 glUniform3i(
5387 (GLint)location,
5388 (GLint)x,
5389 (GLint)y,
5390 (GLint)z
5391 );
5392}
5393
5394/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
5395static void
5396android_glUniform3iv__II_3II
5397 (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005398 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005399 const char * _exceptionType = NULL;
5400 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005401 GLint *v_base = (GLint *) 0;
5402 jint _remaining;
5403 GLint *v = (GLint *) 0;
5404
5405 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005406 _exception = 1;
5407 _exceptionType = "java/lang/IllegalArgumentException";
5408 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005409 goto exit;
5410 }
5411 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005412 _exception = 1;
5413 _exceptionType = "java/lang/IllegalArgumentException";
5414 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005415 goto exit;
5416 }
5417 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005418 if (_remaining < count*3) {
5419 _exception = 1;
5420 _exceptionType = "java/lang/IllegalArgumentException";
5421 _exceptionMessage = "length - offset < count*3 < needed";
5422 goto exit;
5423 }
Jack Palevich560814f2009-11-19 16:34:55 +08005424 v_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005425 _env->GetIntArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005426 v = v_base + offset;
5427
5428 glUniform3iv(
5429 (GLint)location,
5430 (GLsizei)count,
5431 (GLint *)v
5432 );
5433
5434exit:
5435 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005436 _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005437 JNI_ABORT);
5438 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005439 if (_exception) {
5440 jniThrowException(_env, _exceptionType, _exceptionMessage);
5441 }
Jack Palevich560814f2009-11-19 16:34:55 +08005442}
5443
5444/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
5445static void
5446android_glUniform3iv__IILjava_nio_IntBuffer_2
5447 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005448 jint _exception = 0;
5449 const char * _exceptionType = NULL;
5450 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005451 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005452 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005453 jint _remaining;
5454 GLint *v = (GLint *) 0;
5455
Romain Guy84cac202016-12-05 12:26:02 -08005456 if (!v_buf) {
5457 _exception = 1;
5458 _exceptionType = "java/lang/IllegalArgumentException";
5459 _exceptionMessage = "v == null";
5460 goto exit;
5461 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005462 v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005463 if (_remaining < count*3) {
5464 _exception = 1;
5465 _exceptionType = "java/lang/IllegalArgumentException";
5466 _exceptionMessage = "remaining() < count*3 < needed";
5467 goto exit;
5468 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005469 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005470 char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005471 v = (GLint *) (_vBase + _bufferOffset);
5472 }
Jack Palevich560814f2009-11-19 16:34:55 +08005473 glUniform3iv(
5474 (GLint)location,
5475 (GLsizei)count,
5476 (GLint *)v
5477 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005478
5479exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005480 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005481 _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005482 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005483 if (_exception) {
5484 jniThrowException(_env, _exceptionType, _exceptionMessage);
5485 }
Jack Palevich560814f2009-11-19 16:34:55 +08005486}
5487
5488/* void glUniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
5489static void
5490android_glUniform4f__IFFFF
5491 (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z, jfloat w) {
5492 glUniform4f(
5493 (GLint)location,
5494 (GLfloat)x,
5495 (GLfloat)y,
5496 (GLfloat)z,
5497 (GLfloat)w
5498 );
5499}
5500
5501/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
5502static void
5503android_glUniform4fv__II_3FI
5504 (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005505 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005506 const char * _exceptionType = NULL;
5507 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005508 GLfloat *v_base = (GLfloat *) 0;
5509 jint _remaining;
5510 GLfloat *v = (GLfloat *) 0;
5511
5512 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005513 _exception = 1;
5514 _exceptionType = "java/lang/IllegalArgumentException";
5515 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005516 goto exit;
5517 }
5518 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005519 _exception = 1;
5520 _exceptionType = "java/lang/IllegalArgumentException";
5521 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005522 goto exit;
5523 }
5524 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005525 if (_remaining < count*4) {
5526 _exception = 1;
5527 _exceptionType = "java/lang/IllegalArgumentException";
5528 _exceptionMessage = "length - offset < count*4 < needed";
5529 goto exit;
5530 }
Jack Palevich560814f2009-11-19 16:34:55 +08005531 v_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005532 _env->GetFloatArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005533 v = v_base + offset;
5534
5535 glUniform4fv(
5536 (GLint)location,
5537 (GLsizei)count,
5538 (GLfloat *)v
5539 );
5540
5541exit:
5542 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005543 _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005544 JNI_ABORT);
5545 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005546 if (_exception) {
5547 jniThrowException(_env, _exceptionType, _exceptionMessage);
5548 }
Jack Palevich560814f2009-11-19 16:34:55 +08005549}
5550
5551/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
5552static void
5553android_glUniform4fv__IILjava_nio_FloatBuffer_2
5554 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005555 jint _exception = 0;
5556 const char * _exceptionType = NULL;
5557 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005558 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005559 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005560 jint _remaining;
5561 GLfloat *v = (GLfloat *) 0;
5562
Romain Guy84cac202016-12-05 12:26:02 -08005563 if (!v_buf) {
5564 _exception = 1;
5565 _exceptionType = "java/lang/IllegalArgumentException";
5566 _exceptionMessage = "v == null";
5567 goto exit;
5568 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005569 v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005570 if (_remaining < count*4) {
5571 _exception = 1;
5572 _exceptionType = "java/lang/IllegalArgumentException";
5573 _exceptionMessage = "remaining() < count*4 < needed";
5574 goto exit;
5575 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005576 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005577 char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005578 v = (GLfloat *) (_vBase + _bufferOffset);
5579 }
Jack Palevich560814f2009-11-19 16:34:55 +08005580 glUniform4fv(
5581 (GLint)location,
5582 (GLsizei)count,
5583 (GLfloat *)v
5584 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005585
5586exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005587 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005588 _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005589 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005590 if (_exception) {
5591 jniThrowException(_env, _exceptionType, _exceptionMessage);
5592 }
Jack Palevich560814f2009-11-19 16:34:55 +08005593}
5594
5595/* void glUniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w ) */
5596static void
5597android_glUniform4i__IIIII
5598 (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z, jint w) {
5599 glUniform4i(
5600 (GLint)location,
5601 (GLint)x,
5602 (GLint)y,
5603 (GLint)z,
5604 (GLint)w
5605 );
5606}
5607
5608/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
5609static void
5610android_glUniform4iv__II_3II
5611 (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005612 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005613 const char * _exceptionType = NULL;
5614 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005615 GLint *v_base = (GLint *) 0;
5616 jint _remaining;
5617 GLint *v = (GLint *) 0;
5618
5619 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005620 _exception = 1;
5621 _exceptionType = "java/lang/IllegalArgumentException";
5622 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005623 goto exit;
5624 }
5625 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005626 _exception = 1;
5627 _exceptionType = "java/lang/IllegalArgumentException";
5628 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005629 goto exit;
5630 }
5631 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005632 if (_remaining < count*4) {
5633 _exception = 1;
5634 _exceptionType = "java/lang/IllegalArgumentException";
5635 _exceptionMessage = "length - offset < count*4 < needed";
5636 goto exit;
5637 }
Jack Palevich560814f2009-11-19 16:34:55 +08005638 v_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005639 _env->GetIntArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005640 v = v_base + offset;
5641
5642 glUniform4iv(
5643 (GLint)location,
5644 (GLsizei)count,
5645 (GLint *)v
5646 );
5647
5648exit:
5649 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005650 _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005651 JNI_ABORT);
5652 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005653 if (_exception) {
5654 jniThrowException(_env, _exceptionType, _exceptionMessage);
5655 }
Jack Palevich560814f2009-11-19 16:34:55 +08005656}
5657
5658/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
5659static void
5660android_glUniform4iv__IILjava_nio_IntBuffer_2
5661 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005662 jint _exception = 0;
5663 const char * _exceptionType = NULL;
5664 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005665 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005666 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005667 jint _remaining;
5668 GLint *v = (GLint *) 0;
5669
Romain Guy84cac202016-12-05 12:26:02 -08005670 if (!v_buf) {
5671 _exception = 1;
5672 _exceptionType = "java/lang/IllegalArgumentException";
5673 _exceptionMessage = "v == null";
5674 goto exit;
5675 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005676 v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005677 if (_remaining < count*4) {
5678 _exception = 1;
5679 _exceptionType = "java/lang/IllegalArgumentException";
5680 _exceptionMessage = "remaining() < count*4 < needed";
5681 goto exit;
5682 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005683 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005684 char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005685 v = (GLint *) (_vBase + _bufferOffset);
5686 }
Jack Palevich560814f2009-11-19 16:34:55 +08005687 glUniform4iv(
5688 (GLint)location,
5689 (GLsizei)count,
5690 (GLint *)v
5691 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005692
5693exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005694 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005695 _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005696 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005697 if (_exception) {
5698 jniThrowException(_env, _exceptionType, _exceptionMessage);
5699 }
Jack Palevich560814f2009-11-19 16:34:55 +08005700}
5701
5702/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5703static void
5704android_glUniformMatrix2fv__IIZ_3FI
5705 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005706 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005707 const char * _exceptionType = NULL;
5708 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005709 GLfloat *value_base = (GLfloat *) 0;
5710 jint _remaining;
5711 GLfloat *value = (GLfloat *) 0;
5712
5713 if (!value_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005714 _exception = 1;
5715 _exceptionType = "java/lang/IllegalArgumentException";
5716 _exceptionMessage = "value == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005717 goto exit;
5718 }
5719 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005720 _exception = 1;
5721 _exceptionType = "java/lang/IllegalArgumentException";
5722 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005723 goto exit;
5724 }
5725 _remaining = _env->GetArrayLength(value_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005726 if (_remaining < count*4) {
5727 _exception = 1;
5728 _exceptionType = "java/lang/IllegalArgumentException";
5729 _exceptionMessage = "length - offset < count*4 < needed";
5730 goto exit;
5731 }
Jack Palevich560814f2009-11-19 16:34:55 +08005732 value_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005733 _env->GetFloatArrayElements(value_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005734 value = value_base + offset;
5735
5736 glUniformMatrix2fv(
5737 (GLint)location,
5738 (GLsizei)count,
5739 (GLboolean)transpose,
5740 (GLfloat *)value
5741 );
5742
5743exit:
5744 if (value_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005745 _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005746 JNI_ABORT);
5747 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005748 if (_exception) {
5749 jniThrowException(_env, _exceptionType, _exceptionMessage);
5750 }
Jack Palevich560814f2009-11-19 16:34:55 +08005751}
5752
5753/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5754static void
5755android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2
5756 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005757 jint _exception = 0;
5758 const char * _exceptionType = NULL;
5759 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005760 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005761 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005762 jint _remaining;
5763 GLfloat *value = (GLfloat *) 0;
5764
Romain Guy84cac202016-12-05 12:26:02 -08005765 if (!value_buf) {
5766 _exception = 1;
5767 _exceptionType = "java/lang/IllegalArgumentException";
5768 _exceptionMessage = "value == null";
5769 goto exit;
5770 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005771 value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005772 if (_remaining < count*4) {
5773 _exception = 1;
5774 _exceptionType = "java/lang/IllegalArgumentException";
5775 _exceptionMessage = "remaining() < count*4 < needed";
5776 goto exit;
5777 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005778 if (value == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005779 char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005780 value = (GLfloat *) (_valueBase + _bufferOffset);
5781 }
Jack Palevich560814f2009-11-19 16:34:55 +08005782 glUniformMatrix2fv(
5783 (GLint)location,
5784 (GLsizei)count,
5785 (GLboolean)transpose,
5786 (GLfloat *)value
5787 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005788
5789exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005790 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005791 _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005792 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005793 if (_exception) {
5794 jniThrowException(_env, _exceptionType, _exceptionMessage);
5795 }
Jack Palevich560814f2009-11-19 16:34:55 +08005796}
5797
5798/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5799static void
5800android_glUniformMatrix3fv__IIZ_3FI
5801 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005802 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005803 const char * _exceptionType = NULL;
5804 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005805 GLfloat *value_base = (GLfloat *) 0;
5806 jint _remaining;
5807 GLfloat *value = (GLfloat *) 0;
5808
5809 if (!value_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005810 _exception = 1;
5811 _exceptionType = "java/lang/IllegalArgumentException";
5812 _exceptionMessage = "value == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005813 goto exit;
5814 }
5815 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005816 _exception = 1;
5817 _exceptionType = "java/lang/IllegalArgumentException";
5818 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005819 goto exit;
5820 }
5821 _remaining = _env->GetArrayLength(value_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005822 if (_remaining < count*9) {
5823 _exception = 1;
5824 _exceptionType = "java/lang/IllegalArgumentException";
5825 _exceptionMessage = "length - offset < count*9 < needed";
5826 goto exit;
5827 }
Jack Palevich560814f2009-11-19 16:34:55 +08005828 value_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005829 _env->GetFloatArrayElements(value_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005830 value = value_base + offset;
5831
5832 glUniformMatrix3fv(
5833 (GLint)location,
5834 (GLsizei)count,
5835 (GLboolean)transpose,
5836 (GLfloat *)value
5837 );
5838
5839exit:
5840 if (value_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005841 _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005842 JNI_ABORT);
5843 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005844 if (_exception) {
5845 jniThrowException(_env, _exceptionType, _exceptionMessage);
5846 }
Jack Palevich560814f2009-11-19 16:34:55 +08005847}
5848
5849/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5850static void
5851android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2
5852 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005853 jint _exception = 0;
5854 const char * _exceptionType = NULL;
5855 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005856 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005857 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005858 jint _remaining;
5859 GLfloat *value = (GLfloat *) 0;
5860
Romain Guy84cac202016-12-05 12:26:02 -08005861 if (!value_buf) {
5862 _exception = 1;
5863 _exceptionType = "java/lang/IllegalArgumentException";
5864 _exceptionMessage = "value == null";
5865 goto exit;
5866 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005867 value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005868 if (_remaining < count*9) {
5869 _exception = 1;
5870 _exceptionType = "java/lang/IllegalArgumentException";
5871 _exceptionMessage = "remaining() < count*9 < needed";
5872 goto exit;
5873 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005874 if (value == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005875 char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005876 value = (GLfloat *) (_valueBase + _bufferOffset);
5877 }
Jack Palevich560814f2009-11-19 16:34:55 +08005878 glUniformMatrix3fv(
5879 (GLint)location,
5880 (GLsizei)count,
5881 (GLboolean)transpose,
5882 (GLfloat *)value
5883 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005884
5885exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005886 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005887 _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005888 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005889 if (_exception) {
5890 jniThrowException(_env, _exceptionType, _exceptionMessage);
5891 }
Jack Palevich560814f2009-11-19 16:34:55 +08005892}
5893
5894/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5895static void
5896android_glUniformMatrix4fv__IIZ_3FI
5897 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005898 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005899 const char * _exceptionType = NULL;
5900 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005901 GLfloat *value_base = (GLfloat *) 0;
5902 jint _remaining;
5903 GLfloat *value = (GLfloat *) 0;
5904
5905 if (!value_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005906 _exception = 1;
5907 _exceptionType = "java/lang/IllegalArgumentException";
5908 _exceptionMessage = "value == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005909 goto exit;
5910 }
5911 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005912 _exception = 1;
5913 _exceptionType = "java/lang/IllegalArgumentException";
5914 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005915 goto exit;
5916 }
5917 _remaining = _env->GetArrayLength(value_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005918 if (_remaining < count*16) {
5919 _exception = 1;
5920 _exceptionType = "java/lang/IllegalArgumentException";
5921 _exceptionMessage = "length - offset < count*16 < needed";
5922 goto exit;
5923 }
Jack Palevich560814f2009-11-19 16:34:55 +08005924 value_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005925 _env->GetFloatArrayElements(value_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005926 value = value_base + offset;
5927
5928 glUniformMatrix4fv(
5929 (GLint)location,
5930 (GLsizei)count,
5931 (GLboolean)transpose,
5932 (GLfloat *)value
5933 );
5934
5935exit:
5936 if (value_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005937 _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005938 JNI_ABORT);
5939 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005940 if (_exception) {
5941 jniThrowException(_env, _exceptionType, _exceptionMessage);
5942 }
Jack Palevich560814f2009-11-19 16:34:55 +08005943}
5944
5945/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5946static void
5947android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2
5948 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005949 jint _exception = 0;
5950 const char * _exceptionType = NULL;
5951 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005952 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005953 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005954 jint _remaining;
5955 GLfloat *value = (GLfloat *) 0;
5956
Romain Guy84cac202016-12-05 12:26:02 -08005957 if (!value_buf) {
5958 _exception = 1;
5959 _exceptionType = "java/lang/IllegalArgumentException";
5960 _exceptionMessage = "value == null";
5961 goto exit;
5962 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005963 value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005964 if (_remaining < count*16) {
5965 _exception = 1;
5966 _exceptionType = "java/lang/IllegalArgumentException";
5967 _exceptionMessage = "remaining() < count*16 < needed";
5968 goto exit;
5969 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005970 if (value == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005971 char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005972 value = (GLfloat *) (_valueBase + _bufferOffset);
5973 }
Jack Palevich560814f2009-11-19 16:34:55 +08005974 glUniformMatrix4fv(
5975 (GLint)location,
5976 (GLsizei)count,
5977 (GLboolean)transpose,
5978 (GLfloat *)value
5979 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005980
5981exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005982 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005983 _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005984 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005985 if (_exception) {
5986 jniThrowException(_env, _exceptionType, _exceptionMessage);
5987 }
Jack Palevich560814f2009-11-19 16:34:55 +08005988}
5989
5990/* void glUseProgram ( GLuint program ) */
5991static void
5992android_glUseProgram__I
5993 (JNIEnv *_env, jobject _this, jint program) {
5994 glUseProgram(
5995 (GLuint)program
5996 );
5997}
5998
5999/* void glValidateProgram ( GLuint program ) */
6000static void
6001android_glValidateProgram__I
6002 (JNIEnv *_env, jobject _this, jint program) {
6003 glValidateProgram(
6004 (GLuint)program
6005 );
6006}
6007
6008/* void glVertexAttrib1f ( GLuint indx, GLfloat x ) */
6009static void
6010android_glVertexAttrib1f__IF
6011 (JNIEnv *_env, jobject _this, jint indx, jfloat x) {
6012 glVertexAttrib1f(
6013 (GLuint)indx,
6014 (GLfloat)x
6015 );
6016}
6017
6018/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
6019static void
6020android_glVertexAttrib1fv__I_3FI
6021 (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006022 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08006023 const char * _exceptionType = NULL;
6024 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08006025 GLfloat *values_base = (GLfloat *) 0;
6026 jint _remaining;
6027 GLfloat *values = (GLfloat *) 0;
6028
6029 if (!values_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006030 _exception = 1;
6031 _exceptionType = "java/lang/IllegalArgumentException";
6032 _exceptionMessage = "values == null";
Jack Palevich560814f2009-11-19 16:34:55 +08006033 goto exit;
6034 }
6035 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006036 _exception = 1;
6037 _exceptionType = "java/lang/IllegalArgumentException";
6038 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08006039 goto exit;
6040 }
6041 _remaining = _env->GetArrayLength(values_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08006042 if (_remaining < 1) {
6043 _exception = 1;
6044 _exceptionType = "java/lang/IllegalArgumentException";
6045 _exceptionMessage = "length - offset < 1 < needed";
6046 goto exit;
6047 }
Jack Palevich560814f2009-11-19 16:34:55 +08006048 values_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006049 _env->GetFloatArrayElements(values_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08006050 values = values_base + offset;
6051
6052 glVertexAttrib1fv(
6053 (GLuint)indx,
6054 (GLfloat *)values
6055 );
6056
6057exit:
6058 if (values_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006059 _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
Jack Palevich560814f2009-11-19 16:34:55 +08006060 JNI_ABORT);
6061 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006062 if (_exception) {
6063 jniThrowException(_env, _exceptionType, _exceptionMessage);
6064 }
Jack Palevich560814f2009-11-19 16:34:55 +08006065}
6066
6067/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
6068static void
6069android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2
6070 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08006071 jint _exception = 0;
6072 const char * _exceptionType = NULL;
6073 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006074 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006075 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08006076 jint _remaining;
6077 GLfloat *values = (GLfloat *) 0;
6078
Romain Guy84cac202016-12-05 12:26:02 -08006079 if (!values_buf) {
6080 _exception = 1;
6081 _exceptionType = "java/lang/IllegalArgumentException";
6082 _exceptionMessage = "values == null";
6083 goto exit;
6084 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006085 values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08006086 if (_remaining < 1) {
6087 _exception = 1;
6088 _exceptionType = "java/lang/IllegalArgumentException";
6089 _exceptionMessage = "remaining() < 1 < needed";
6090 goto exit;
6091 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006092 if (values == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006093 char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006094 values = (GLfloat *) (_valuesBase + _bufferOffset);
6095 }
Jack Palevich560814f2009-11-19 16:34:55 +08006096 glVertexAttrib1fv(
6097 (GLuint)indx,
6098 (GLfloat *)values
6099 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08006100
6101exit:
Jack Palevich560814f2009-11-19 16:34:55 +08006102 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006103 _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08006104 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08006105 if (_exception) {
6106 jniThrowException(_env, _exceptionType, _exceptionMessage);
6107 }
Jack Palevich560814f2009-11-19 16:34:55 +08006108}
6109
6110/* void glVertexAttrib2f ( GLuint indx, GLfloat x, GLfloat y ) */
6111static void
6112android_glVertexAttrib2f__IFF
6113 (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y) {
6114 glVertexAttrib2f(
6115 (GLuint)indx,
6116 (GLfloat)x,
6117 (GLfloat)y
6118 );
6119}
6120
6121/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
6122static void
6123android_glVertexAttrib2fv__I_3FI
6124 (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006125 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08006126 const char * _exceptionType = NULL;
6127 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08006128 GLfloat *values_base = (GLfloat *) 0;
6129 jint _remaining;
6130 GLfloat *values = (GLfloat *) 0;
6131
6132 if (!values_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006133 _exception = 1;
6134 _exceptionType = "java/lang/IllegalArgumentException";
6135 _exceptionMessage = "values == null";
Jack Palevich560814f2009-11-19 16:34:55 +08006136 goto exit;
6137 }
6138 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006139 _exception = 1;
6140 _exceptionType = "java/lang/IllegalArgumentException";
6141 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08006142 goto exit;
6143 }
6144 _remaining = _env->GetArrayLength(values_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08006145 if (_remaining < 2) {
6146 _exception = 1;
6147 _exceptionType = "java/lang/IllegalArgumentException";
6148 _exceptionMessage = "length - offset < 2 < needed";
6149 goto exit;
6150 }
Jack Palevich560814f2009-11-19 16:34:55 +08006151 values_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006152 _env->GetFloatArrayElements(values_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08006153 values = values_base + offset;
6154
6155 glVertexAttrib2fv(
6156 (GLuint)indx,
6157 (GLfloat *)values
6158 );
6159
6160exit:
6161 if (values_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006162 _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
Jack Palevich560814f2009-11-19 16:34:55 +08006163 JNI_ABORT);
6164 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006165 if (_exception) {
6166 jniThrowException(_env, _exceptionType, _exceptionMessage);
6167 }
Jack Palevich560814f2009-11-19 16:34:55 +08006168}
6169
6170/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
6171static void
6172android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2
6173 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08006174 jint _exception = 0;
6175 const char * _exceptionType = NULL;
6176 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006177 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006178 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08006179 jint _remaining;
6180 GLfloat *values = (GLfloat *) 0;
6181
Romain Guy84cac202016-12-05 12:26:02 -08006182 if (!values_buf) {
6183 _exception = 1;
6184 _exceptionType = "java/lang/IllegalArgumentException";
6185 _exceptionMessage = "values == null";
6186 goto exit;
6187 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006188 values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08006189 if (_remaining < 2) {
6190 _exception = 1;
6191 _exceptionType = "java/lang/IllegalArgumentException";
6192 _exceptionMessage = "remaining() < 2 < needed";
6193 goto exit;
6194 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006195 if (values == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006196 char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006197 values = (GLfloat *) (_valuesBase + _bufferOffset);
6198 }
Jack Palevich560814f2009-11-19 16:34:55 +08006199 glVertexAttrib2fv(
6200 (GLuint)indx,
6201 (GLfloat *)values
6202 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08006203
6204exit:
Jack Palevich560814f2009-11-19 16:34:55 +08006205 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006206 _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08006207 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08006208 if (_exception) {
6209 jniThrowException(_env, _exceptionType, _exceptionMessage);
6210 }
Jack Palevich560814f2009-11-19 16:34:55 +08006211}
6212
6213/* void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z ) */
6214static void
6215android_glVertexAttrib3f__IFFF
6216 (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z) {
6217 glVertexAttrib3f(
6218 (GLuint)indx,
6219 (GLfloat)x,
6220 (GLfloat)y,
6221 (GLfloat)z
6222 );
6223}
6224
6225/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
6226static void
6227android_glVertexAttrib3fv__I_3FI
6228 (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006229 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08006230 const char * _exceptionType = NULL;
6231 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08006232 GLfloat *values_base = (GLfloat *) 0;
6233 jint _remaining;
6234 GLfloat *values = (GLfloat *) 0;
6235
6236 if (!values_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006237 _exception = 1;
6238 _exceptionType = "java/lang/IllegalArgumentException";
6239 _exceptionMessage = "values == null";
Jack Palevich560814f2009-11-19 16:34:55 +08006240 goto exit;
6241 }
6242 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006243 _exception = 1;
6244 _exceptionType = "java/lang/IllegalArgumentException";
6245 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08006246 goto exit;
6247 }
6248 _remaining = _env->GetArrayLength(values_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08006249 if (_remaining < 3) {
6250 _exception = 1;
6251 _exceptionType = "java/lang/IllegalArgumentException";
6252 _exceptionMessage = "length - offset < 3 < needed";
6253 goto exit;
6254 }
Jack Palevich560814f2009-11-19 16:34:55 +08006255 values_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006256 _env->GetFloatArrayElements(values_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08006257 values = values_base + offset;
6258
6259 glVertexAttrib3fv(
6260 (GLuint)indx,
6261 (GLfloat *)values
6262 );
6263
6264exit:
6265 if (values_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006266 _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
Jack Palevich560814f2009-11-19 16:34:55 +08006267 JNI_ABORT);
6268 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006269 if (_exception) {
6270 jniThrowException(_env, _exceptionType, _exceptionMessage);
6271 }
Jack Palevich560814f2009-11-19 16:34:55 +08006272}
6273
6274/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
6275static void
6276android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2
6277 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08006278 jint _exception = 0;
6279 const char * _exceptionType = NULL;
6280 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006281 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006282 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08006283 jint _remaining;
6284 GLfloat *values = (GLfloat *) 0;
6285
Romain Guy84cac202016-12-05 12:26:02 -08006286 if (!values_buf) {
6287 _exception = 1;
6288 _exceptionType = "java/lang/IllegalArgumentException";
6289 _exceptionMessage = "values == null";
6290 goto exit;
6291 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006292 values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08006293 if (_remaining < 3) {
6294 _exception = 1;
6295 _exceptionType = "java/lang/IllegalArgumentException";
6296 _exceptionMessage = "remaining() < 3 < needed";
6297 goto exit;
6298 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006299 if (values == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006300 char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006301 values = (GLfloat *) (_valuesBase + _bufferOffset);
6302 }
Jack Palevich560814f2009-11-19 16:34:55 +08006303 glVertexAttrib3fv(
6304 (GLuint)indx,
6305 (GLfloat *)values
6306 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08006307
6308exit:
Jack Palevich560814f2009-11-19 16:34:55 +08006309 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006310 _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08006311 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08006312 if (_exception) {
6313 jniThrowException(_env, _exceptionType, _exceptionMessage);
6314 }
Jack Palevich560814f2009-11-19 16:34:55 +08006315}
6316
6317/* void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
6318static void
6319android_glVertexAttrib4f__IFFFF
6320 (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z, jfloat w) {
6321 glVertexAttrib4f(
6322 (GLuint)indx,
6323 (GLfloat)x,
6324 (GLfloat)y,
6325 (GLfloat)z,
6326 (GLfloat)w
6327 );
6328}
6329
6330/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
6331static void
6332android_glVertexAttrib4fv__I_3FI
6333 (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006334 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08006335 const char * _exceptionType = NULL;
6336 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08006337 GLfloat *values_base = (GLfloat *) 0;
6338 jint _remaining;
6339 GLfloat *values = (GLfloat *) 0;
6340
6341 if (!values_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006342 _exception = 1;
6343 _exceptionType = "java/lang/IllegalArgumentException";
6344 _exceptionMessage = "values == null";
Jack Palevich560814f2009-11-19 16:34:55 +08006345 goto exit;
6346 }
6347 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006348 _exception = 1;
6349 _exceptionType = "java/lang/IllegalArgumentException";
6350 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08006351 goto exit;
6352 }
6353 _remaining = _env->GetArrayLength(values_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08006354 if (_remaining < 4) {
6355 _exception = 1;
6356 _exceptionType = "java/lang/IllegalArgumentException";
6357 _exceptionMessage = "length - offset < 4 < needed";
6358 goto exit;
6359 }
Jack Palevich560814f2009-11-19 16:34:55 +08006360 values_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006361 _env->GetFloatArrayElements(values_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08006362 values = values_base + offset;
6363
6364 glVertexAttrib4fv(
6365 (GLuint)indx,
6366 (GLfloat *)values
6367 );
6368
6369exit:
6370 if (values_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006371 _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
Jack Palevich560814f2009-11-19 16:34:55 +08006372 JNI_ABORT);
6373 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006374 if (_exception) {
6375 jniThrowException(_env, _exceptionType, _exceptionMessage);
6376 }
Jack Palevich560814f2009-11-19 16:34:55 +08006377}
6378
6379/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
6380static void
6381android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2
6382 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08006383 jint _exception = 0;
6384 const char * _exceptionType = NULL;
6385 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006386 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006387 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08006388 jint _remaining;
6389 GLfloat *values = (GLfloat *) 0;
6390
Romain Guy84cac202016-12-05 12:26:02 -08006391 if (!values_buf) {
6392 _exception = 1;
6393 _exceptionType = "java/lang/IllegalArgumentException";
6394 _exceptionMessage = "values == null";
6395 goto exit;
6396 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006397 values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08006398 if (_remaining < 4) {
6399 _exception = 1;
6400 _exceptionType = "java/lang/IllegalArgumentException";
6401 _exceptionMessage = "remaining() < 4 < needed";
6402 goto exit;
6403 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006404 if (values == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006405 char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006406 values = (GLfloat *) (_valuesBase + _bufferOffset);
6407 }
Jack Palevich560814f2009-11-19 16:34:55 +08006408 glVertexAttrib4fv(
6409 (GLuint)indx,
6410 (GLfloat *)values
6411 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08006412
6413exit:
Jack Palevich560814f2009-11-19 16:34:55 +08006414 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006415 _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08006416 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08006417 if (_exception) {
6418 jniThrowException(_env, _exceptionType, _exceptionMessage);
6419 }
Jack Palevich560814f2009-11-19 16:34:55 +08006420}
6421
Jack Palevich224107a2010-06-22 20:08:40 +08006422/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint offset ) */
6423static void
6424android_glVertexAttribPointer__IIIZII
6425 (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jint offset) {
6426 glVertexAttribPointer(
6427 (GLuint)indx,
6428 (GLint)size,
6429 (GLenum)type,
6430 (GLboolean)normalized,
6431 (GLsizei)stride,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00006432 reinterpret_cast<GLvoid *>(offset)
Jack Palevich224107a2010-06-22 20:08:40 +08006433 );
6434}
6435
Jack Palevich560814f2009-11-19 16:34:55 +08006436/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr ) */
6437static void
6438android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I
6439 (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jobject ptr_buf, jint remaining) {
Romain Guy84cac202016-12-05 12:26:02 -08006440 jint _exception = 0;
6441 const char * _exceptionType = NULL;
6442 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08006443 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006444 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08006445 jint _remaining;
6446 GLvoid *ptr = (GLvoid *) 0;
6447
6448 if (ptr_buf) {
6449 ptr = (GLvoid *) getDirectBufferPointer(_env, ptr_buf);
6450 if ( ! ptr ) {
6451 return;
6452 }
6453 }
6454 glVertexAttribPointerBounds(
6455 (GLuint)indx,
6456 (GLint)size,
6457 (GLenum)type,
6458 (GLboolean)normalized,
6459 (GLsizei)stride,
6460 (GLvoid *)ptr,
6461 (GLsizei)remaining
6462 );
Romain Guy84cac202016-12-05 12:26:02 -08006463 if (_exception) {
6464 jniThrowException(_env, _exceptionType, _exceptionMessage);
6465 }
Jack Palevich560814f2009-11-19 16:34:55 +08006466}
6467
6468/* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */
6469static void
6470android_glViewport__IIII
6471 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
6472 glViewport(
6473 (GLint)x,
6474 (GLint)y,
6475 (GLsizei)width,
6476 (GLsizei)height
6477 );
6478}
6479
6480static const char *classPathName = "android/opengl/GLES20";
6481
Daniel Micay76f6a862015-09-19 17:31:01 -04006482static const JNINativeMethod methods[] = {
Jack Palevich560814f2009-11-19 16:34:55 +08006483{"_nativeClassInit", "()V", (void*)nativeClassInit },
6484{"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I },
6485{"glAttachShader", "(II)V", (void *) android_glAttachShader__II },
6486{"glBindAttribLocation", "(IILjava/lang/String;)V", (void *) android_glBindAttribLocation__IILjava_lang_String_2 },
6487{"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II },
6488{"glBindFramebuffer", "(II)V", (void *) android_glBindFramebuffer__II },
6489{"glBindRenderbuffer", "(II)V", (void *) android_glBindRenderbuffer__II },
6490{"glBindTexture", "(II)V", (void *) android_glBindTexture__II },
6491{"glBlendColor", "(FFFF)V", (void *) android_glBlendColor__FFFF },
6492{"glBlendEquation", "(I)V", (void *) android_glBlendEquation__I },
6493{"glBlendEquationSeparate", "(II)V", (void *) android_glBlendEquationSeparate__II },
6494{"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II },
6495{"glBlendFuncSeparate", "(IIII)V", (void *) android_glBlendFuncSeparate__IIII },
6496{"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I },
6497{"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 },
6498{"glCheckFramebufferStatus", "(I)I", (void *) android_glCheckFramebufferStatus__I },
6499{"glClear", "(I)V", (void *) android_glClear__I },
6500{"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF },
6501{"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F },
6502{"glClearStencil", "(I)V", (void *) android_glClearStencil__I },
6503{"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ },
6504{"glCompileShader", "(I)V", (void *) android_glCompileShader__I },
6505{"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 },
6506{"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
6507{"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII },
6508{"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII },
6509{"glCreateProgram", "()I", (void *) android_glCreateProgram__ },
6510{"glCreateShader", "(I)I", (void *) android_glCreateShader__I },
6511{"glCullFace", "(I)V", (void *) android_glCullFace__I },
6512{"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II },
6513{"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 },
6514{"glDeleteFramebuffers", "(I[II)V", (void *) android_glDeleteFramebuffers__I_3II },
6515{"glDeleteFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2 },
6516{"glDeleteProgram", "(I)V", (void *) android_glDeleteProgram__I },
6517{"glDeleteRenderbuffers", "(I[II)V", (void *) android_glDeleteRenderbuffers__I_3II },
6518{"glDeleteRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2 },
6519{"glDeleteShader", "(I)V", (void *) android_glDeleteShader__I },
6520{"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II },
6521{"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 },
6522{"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I },
6523{"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z },
6524{"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF },
6525{"glDetachShader", "(II)V", (void *) android_glDetachShader__II },
6526{"glDisable", "(I)V", (void *) android_glDisable__I },
6527{"glDisableVertexAttribArray", "(I)V", (void *) android_glDisableVertexAttribArray__I },
6528{"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III },
Jack Palevich224107a2010-06-22 20:08:40 +08006529{"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII },
Jack Palevich560814f2009-11-19 16:34:55 +08006530{"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 },
6531{"glEnable", "(I)V", (void *) android_glEnable__I },
6532{"glEnableVertexAttribArray", "(I)V", (void *) android_glEnableVertexAttribArray__I },
6533{"glFinish", "()V", (void *) android_glFinish__ },
6534{"glFlush", "()V", (void *) android_glFlush__ },
6535{"glFramebufferRenderbuffer", "(IIII)V", (void *) android_glFramebufferRenderbuffer__IIII },
6536{"glFramebufferTexture2D", "(IIIII)V", (void *) android_glFramebufferTexture2D__IIIII },
6537{"glFrontFace", "(I)V", (void *) android_glFrontFace__I },
6538{"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II },
6539{"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 },
6540{"glGenerateMipmap", "(I)V", (void *) android_glGenerateMipmap__I },
6541{"glGenFramebuffers", "(I[II)V", (void *) android_glGenFramebuffers__I_3II },
6542{"glGenFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenFramebuffers__ILjava_nio_IntBuffer_2 },
6543{"glGenRenderbuffers", "(I[II)V", (void *) android_glGenRenderbuffers__I_3II },
6544{"glGenRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenRenderbuffers__ILjava_nio_IntBuffer_2 },
6545{"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II },
6546{"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 },
6547{"glGetActiveAttrib", "(III[II[II[II[BI)V", (void *) android_glGetActiveAttrib__III_3II_3II_3II_3BI },
6548{"glGetActiveAttrib", "(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V", (void *) android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B },
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07006549{"glGetActiveAttrib", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveAttrib1 },
6550{"glGetActiveAttrib", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveAttrib2 },
Jack Palevich560814f2009-11-19 16:34:55 +08006551{"glGetActiveUniform", "(III[II[II[II[BI)V", (void *) android_glGetActiveUniform__III_3II_3II_3II_3BI },
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07006552{"glGetActiveUniform", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveUniform1 },
Jack Palevich560814f2009-11-19 16:34:55 +08006553{"glGetActiveUniform", "(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V", (void *) android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B },
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07006554{"glGetActiveUniform", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveUniform2 },
Jack Palevich560814f2009-11-19 16:34:55 +08006555{"glGetAttachedShaders", "(II[II[II)V", (void *) android_glGetAttachedShaders__II_3II_3II },
6556{"glGetAttachedShaders", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
6557{"glGetAttribLocation", "(ILjava/lang/String;)I", (void *) android_glGetAttribLocation__ILjava_lang_String_2 },
6558{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI },
6559{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 },
6560{"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II },
6561{"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 },
6562{"glGetError", "()I", (void *) android_glGetError__ },
6563{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI },
6564{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 },
6565{"glGetFramebufferAttachmentParameteriv", "(III[II)V", (void *) android_glGetFramebufferAttachmentParameteriv__III_3II },
6566{"glGetFramebufferAttachmentParameteriv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 },
6567{"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II },
6568{"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 },
6569{"glGetProgramiv", "(II[II)V", (void *) android_glGetProgramiv__II_3II },
6570{"glGetProgramiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetProgramiv__IILjava_nio_IntBuffer_2 },
6571{"glGetProgramInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetProgramInfoLog },
6572{"glGetRenderbufferParameteriv", "(II[II)V", (void *) android_glGetRenderbufferParameteriv__II_3II },
6573{"glGetRenderbufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2 },
6574{"glGetShaderiv", "(II[II)V", (void *) android_glGetShaderiv__II_3II },
6575{"glGetShaderiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetShaderiv__IILjava_nio_IntBuffer_2 },
6576{"glGetShaderInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetShaderInfoLog },
6577{"glGetShaderPrecisionFormat", "(II[II[II)V", (void *) android_glGetShaderPrecisionFormat__II_3II_3II },
6578{"glGetShaderPrecisionFormat", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
6579{"glGetShaderSource", "(II[II[BI)V", (void *) android_glGetShaderSource__II_3II_3BI },
6580{"glGetShaderSource", "(IILjava/nio/IntBuffer;B)V", (void *) android_glGetShaderSource__IILjava_nio_IntBuffer_2B },
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07006581{"glGetShaderSource", "(I)Ljava/lang/String;", (void *) android_glGetShaderSource },
Jack Palevich560814f2009-11-19 16:34:55 +08006582{"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString },
6583{"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI },
6584{"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 },
6585{"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II },
6586{"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 },
6587{"glGetUniformfv", "(II[FI)V", (void *) android_glGetUniformfv__II_3FI },
6588{"glGetUniformfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetUniformfv__IILjava_nio_FloatBuffer_2 },
6589{"glGetUniformiv", "(II[II)V", (void *) android_glGetUniformiv__II_3II },
6590{"glGetUniformiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetUniformiv__IILjava_nio_IntBuffer_2 },
6591{"glGetUniformLocation", "(ILjava/lang/String;)I", (void *) android_glGetUniformLocation__ILjava_lang_String_2 },
6592{"glGetVertexAttribfv", "(II[FI)V", (void *) android_glGetVertexAttribfv__II_3FI },
6593{"glGetVertexAttribfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2 },
6594{"glGetVertexAttribiv", "(II[II)V", (void *) android_glGetVertexAttribiv__II_3II },
6595{"glGetVertexAttribiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2 },
6596{"glHint", "(II)V", (void *) android_glHint__II },
6597{"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I },
6598{"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I },
6599{"glIsFramebuffer", "(I)Z", (void *) android_glIsFramebuffer__I },
6600{"glIsProgram", "(I)Z", (void *) android_glIsProgram__I },
6601{"glIsRenderbuffer", "(I)Z", (void *) android_glIsRenderbuffer__I },
6602{"glIsShader", "(I)Z", (void *) android_glIsShader__I },
6603{"glIsTexture", "(I)Z", (void *) android_glIsTexture__I },
6604{"glLineWidth", "(F)V", (void *) android_glLineWidth__F },
6605{"glLinkProgram", "(I)V", (void *) android_glLinkProgram__I },
6606{"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II },
6607{"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF },
6608{"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 },
6609{"glReleaseShaderCompiler", "()V", (void *) android_glReleaseShaderCompiler__ },
6610{"glRenderbufferStorage", "(IIII)V", (void *) android_glRenderbufferStorage__IIII },
6611{"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ },
6612{"glScissor", "(IIII)V", (void *) android_glScissor__IIII },
6613{"glShaderBinary", "(I[IIILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__I_3IIILjava_nio_Buffer_2I },
6614{"glShaderBinary", "(ILjava/nio/IntBuffer;ILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I },
6615{"glShaderSource", "(ILjava/lang/String;)V", (void *) android_glShaderSource },
6616{"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III },
6617{"glStencilFuncSeparate", "(IIII)V", (void *) android_glStencilFuncSeparate__IIII },
6618{"glStencilMask", "(I)V", (void *) android_glStencilMask__I },
6619{"glStencilMaskSeparate", "(II)V", (void *) android_glStencilMaskSeparate__II },
6620{"glStencilOp", "(III)V", (void *) android_glStencilOp__III },
6621{"glStencilOpSeparate", "(IIII)V", (void *) android_glStencilOpSeparate__IIII },
6622{"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 },
6623{"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF },
6624{"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI },
6625{"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 },
6626{"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III },
6627{"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II },
6628{"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 },
6629{"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
6630{"glUniform1f", "(IF)V", (void *) android_glUniform1f__IF },
6631{"glUniform1fv", "(II[FI)V", (void *) android_glUniform1fv__II_3FI },
6632{"glUniform1fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform1fv__IILjava_nio_FloatBuffer_2 },
6633{"glUniform1i", "(II)V", (void *) android_glUniform1i__II },
6634{"glUniform1iv", "(II[II)V", (void *) android_glUniform1iv__II_3II },
6635{"glUniform1iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform1iv__IILjava_nio_IntBuffer_2 },
6636{"glUniform2f", "(IFF)V", (void *) android_glUniform2f__IFF },
6637{"glUniform2fv", "(II[FI)V", (void *) android_glUniform2fv__II_3FI },
6638{"glUniform2fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform2fv__IILjava_nio_FloatBuffer_2 },
6639{"glUniform2i", "(III)V", (void *) android_glUniform2i__III },
6640{"glUniform2iv", "(II[II)V", (void *) android_glUniform2iv__II_3II },
6641{"glUniform2iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform2iv__IILjava_nio_IntBuffer_2 },
6642{"glUniform3f", "(IFFF)V", (void *) android_glUniform3f__IFFF },
6643{"glUniform3fv", "(II[FI)V", (void *) android_glUniform3fv__II_3FI },
6644{"glUniform3fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform3fv__IILjava_nio_FloatBuffer_2 },
6645{"glUniform3i", "(IIII)V", (void *) android_glUniform3i__IIII },
6646{"glUniform3iv", "(II[II)V", (void *) android_glUniform3iv__II_3II },
6647{"glUniform3iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform3iv__IILjava_nio_IntBuffer_2 },
6648{"glUniform4f", "(IFFFF)V", (void *) android_glUniform4f__IFFFF },
6649{"glUniform4fv", "(II[FI)V", (void *) android_glUniform4fv__II_3FI },
6650{"glUniform4fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform4fv__IILjava_nio_FloatBuffer_2 },
6651{"glUniform4i", "(IIIII)V", (void *) android_glUniform4i__IIIII },
6652{"glUniform4iv", "(II[II)V", (void *) android_glUniform4iv__II_3II },
6653{"glUniform4iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform4iv__IILjava_nio_IntBuffer_2 },
6654{"glUniformMatrix2fv", "(IIZ[FI)V", (void *) android_glUniformMatrix2fv__IIZ_3FI },
6655{"glUniformMatrix2fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 },
6656{"glUniformMatrix3fv", "(IIZ[FI)V", (void *) android_glUniformMatrix3fv__IIZ_3FI },
6657{"glUniformMatrix3fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 },
6658{"glUniformMatrix4fv", "(IIZ[FI)V", (void *) android_glUniformMatrix4fv__IIZ_3FI },
6659{"glUniformMatrix4fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2 },
6660{"glUseProgram", "(I)V", (void *) android_glUseProgram__I },
6661{"glValidateProgram", "(I)V", (void *) android_glValidateProgram__I },
6662{"glVertexAttrib1f", "(IF)V", (void *) android_glVertexAttrib1f__IF },
6663{"glVertexAttrib1fv", "(I[FI)V", (void *) android_glVertexAttrib1fv__I_3FI },
6664{"glVertexAttrib1fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2 },
6665{"glVertexAttrib2f", "(IFF)V", (void *) android_glVertexAttrib2f__IFF },
6666{"glVertexAttrib2fv", "(I[FI)V", (void *) android_glVertexAttrib2fv__I_3FI },
6667{"glVertexAttrib2fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2 },
6668{"glVertexAttrib3f", "(IFFF)V", (void *) android_glVertexAttrib3f__IFFF },
6669{"glVertexAttrib3fv", "(I[FI)V", (void *) android_glVertexAttrib3fv__I_3FI },
6670{"glVertexAttrib3fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2 },
6671{"glVertexAttrib4f", "(IFFFF)V", (void *) android_glVertexAttrib4f__IFFFF },
6672{"glVertexAttrib4fv", "(I[FI)V", (void *) android_glVertexAttrib4fv__I_3FI },
6673{"glVertexAttrib4fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 },
Jack Palevich224107a2010-06-22 20:08:40 +08006674{"glVertexAttribPointer", "(IIIZII)V", (void *) android_glVertexAttribPointer__IIIZII },
Jack Palevich560814f2009-11-19 16:34:55 +08006675{"glVertexAttribPointerBounds", "(IIIZILjava/nio/Buffer;I)V", (void *) android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I },
6676{"glViewport", "(IIII)V", (void *) android_glViewport__IIII },
6677};
6678
6679int register_android_opengl_jni_GLES20(JNIEnv *_env)
6680{
6681 int err;
6682 err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
6683 return err;
6684}