blob: 2add72d14c7b726710970ceef35e325a4ae31016 [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
Mathias Agopian2ad04772013-02-23 03:12:30 -080032
33/* special calls implemented in Android's GLES wrapper used to more
34 * efficiently bound-check passed arrays */
35extern "C" {
36#ifdef GL_VERSION_ES_CM_1_1
37GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
38 const GLvoid *ptr, GLsizei count);
39GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
40 const GLvoid *pointer, GLsizei count);
41GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
42 GLsizei stride, const GLvoid *pointer, GLsizei count);
43GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
44 GLsizei stride, const GLvoid *pointer, GLsizei count);
45GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
46 GLsizei stride, const GLvoid *pointer, GLsizei count);
47GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
48 GLsizei stride, const GLvoid *pointer, GLsizei count);
49GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
50 GLsizei stride, const GLvoid *pointer, GLsizei count);
51#endif
52#ifdef GL_ES_VERSION_2_0
53static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type,
54 GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) {
55 glVertexAttribPointer(indx, size, type, normalized, stride, pointer);
56}
57#endif
Andy McFaddencee51982013-04-25 16:08:31 -070058#ifdef GL_ES_VERSION_3_0
59static void glVertexAttribIPointerBounds(GLuint indx, GLint size, GLenum type,
60 GLsizei stride, const GLvoid *pointer, GLsizei count) {
61 glVertexAttribIPointer(indx, size, type, stride, pointer);
62}
63#endif
Mathias Agopian2ad04772013-02-23 03:12:30 -080064}
65
Jack Palevich560814f2009-11-19 16:34:55 +080066static void
Elliott Hughes24ce5fb2011-04-08 20:01:01 -070067nativeClassInit(JNIEnv *_env, jclass glImplClass)
Jack Palevich560814f2009-11-19 16:34:55 +080068{
Jack Palevich560814f2009-11-19 16:34:55 +080069}
70
Jack Palevich560814f2009-11-19 16:34:55 +080071static void *
Thomas Tafertshofer17045a12012-07-12 13:55:55 -070072getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
Jack Palevich560814f2009-11-19 16:34:55 +080073{
74 jint position;
75 jint limit;
76 jint elementSizeShift;
77 jlong pointer;
Jack Palevich560814f2009-11-19 16:34:55 +080078
Orion Hodson02440d32019-02-28 15:15:34 +000079 pointer = jniGetNioBufferFields(_env, buffer, &position, &limit, &elementSizeShift);
Jack Palevich560814f2009-11-19 16:34:55 +080080 *remaining = (limit - position) << elementSizeShift;
Jack Palevich560814f2009-11-19 16:34:55 +080081 if (pointer != 0L) {
Orion Hodson02440d32019-02-28 15:15:34 +000082 *array = nullptr;
83 pointer += position << elementSizeShift;
Ashok Bhat01c26ea2014-02-24 09:49:07 +000084 return reinterpret_cast<void*>(pointer);
Jack Palevich560814f2009-11-19 16:34:55 +080085 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -070086
Orion Hodson02440d32019-02-28 15:15:34 +000087 *array = jniGetNioBufferBaseArray(_env, buffer);
88 *offset = jniGetNioBufferBaseArrayOffset(_env, buffer);
89 return nullptr;
Jack Palevich560814f2009-11-19 16:34:55 +080090}
91
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -070092class ByteArrayGetter {
93public:
94 static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
95 return _env->GetByteArrayElements(array, is_copy);
96 }
97};
98class BooleanArrayGetter {
99public:
100 static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
101 return _env->GetBooleanArrayElements(array, is_copy);
102 }
103};
104class CharArrayGetter {
105public:
106 static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
107 return _env->GetCharArrayElements(array, is_copy);
108 }
109};
110class ShortArrayGetter {
111public:
112 static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
113 return _env->GetShortArrayElements(array, is_copy);
114 }
115};
116class IntArrayGetter {
117public:
118 static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
119 return _env->GetIntArrayElements(array, is_copy);
120 }
121};
122class LongArrayGetter {
123public:
124 static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
125 return _env->GetLongArrayElements(array, is_copy);
126 }
127};
128class FloatArrayGetter {
129public:
130 static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
131 return _env->GetFloatArrayElements(array, is_copy);
132 }
133};
134class DoubleArrayGetter {
135public:
136 static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
137 return _env->GetDoubleArrayElements(array, is_copy);
138 }
139};
140
141template<typename JTYPEARRAY, typename ARRAYGETTER>
142static void*
143getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
144 return ARRAYGETTER::Get(_env, array, is_copy);
145}
146
147class ByteArrayReleaser {
148public:
149 static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
150 _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
151 }
152};
153class BooleanArrayReleaser {
154public:
155 static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
156 _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
157 }
158};
159class CharArrayReleaser {
160public:
161 static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
162 _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
163 }
164};
165class ShortArrayReleaser {
166public:
167 static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
168 _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
169 }
170};
171class IntArrayReleaser {
172public:
173 static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
174 _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
175 }
176};
177class LongArrayReleaser {
178public:
179 static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
180 _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
181 }
182};
183class FloatArrayReleaser {
184public:
185 static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
186 _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
187 }
188};
189class DoubleArrayReleaser {
190public:
191 static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
192 _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
193 }
194};
195
196template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
197static void
198releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
199 ARRAYRELEASER::Release(_env, array, data, commit);
200}
201
Jack Palevich560814f2009-11-19 16:34:55 +0800202static void
203releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
204{
205 _env->ReleasePrimitiveArrayCritical(array, data,
Mathias Agopian2ad04772013-02-23 03:12:30 -0800206 commit ? 0 : JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +0800207}
208
209static void *
210getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
Orion Hodson02440d32019-02-28 15:15:34 +0000211 jint position;
212 jint limit;
213 jint elementSizeShift;
214 jlong pointer;
215 pointer = jniGetNioBufferFields(_env, buffer, &position, &limit, &elementSizeShift);
216 if (pointer == 0) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -0700217 jniThrowException(_env, "java/lang/IllegalArgumentException",
218 "Must use a native order direct Buffer");
Orion Hodson02440d32019-02-28 15:15:34 +0000219 return nullptr;
Jack Palevich560814f2009-11-19 16:34:55 +0800220 }
Orion Hodson02440d32019-02-28 15:15:34 +0000221 pointer += position << elementSizeShift;
222 return reinterpret_cast<void*>(pointer);
Jack Palevich560814f2009-11-19 16:34:55 +0800223}
224
Mathias Agopian2ad04772013-02-23 03:12:30 -0800225// --------------------------------------------------------------------------
226
227/*
228 * returns the number of values glGet returns for a given pname.
229 *
230 * The code below is written such that pnames requiring only one values
231 * are the default (and are not explicitely tested for). This makes the
232 * checking code much shorter/readable/efficient.
233 *
234 * This means that unknown pnames (e.g.: extensions) will default to 1. If
235 * that unknown pname needs more than 1 value, then the validation check
236 * is incomplete and the app may crash if it passed the wrong number params.
237 */
238static int getNeededCount(GLint pname) {
239 int needed = 1;
Romain Guydc43a6c2017-02-17 19:54:25 -0800240#ifdef GL_ES_VERSION_3_0
241 // GLES 3.x pnames
242 switch (pname) {
243 case GL_MAX_VIEWPORT_DIMS:
244 needed = 2;
245 break;
246
247 case GL_PROGRAM_BINARY_FORMATS:
248 glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &needed);
249 break;
250 }
251#endif
252
Mathias Agopian2ad04772013-02-23 03:12:30 -0800253#ifdef GL_ES_VERSION_2_0
254 // GLES 2.x pnames
255 switch (pname) {
256 case GL_ALIASED_LINE_WIDTH_RANGE:
257 case GL_ALIASED_POINT_SIZE_RANGE:
258 needed = 2;
259 break;
260
261 case GL_BLEND_COLOR:
262 case GL_COLOR_CLEAR_VALUE:
263 case GL_COLOR_WRITEMASK:
264 case GL_SCISSOR_BOX:
265 case GL_VIEWPORT:
266 needed = 4;
267 break;
268
269 case GL_COMPRESSED_TEXTURE_FORMATS:
270 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
271 break;
272
273 case GL_SHADER_BINARY_FORMATS:
274 glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed);
275 break;
276 }
277#endif
278
279#ifdef GL_VERSION_ES_CM_1_1
280 // GLES 1.x pnames
281 switch (pname) {
282 case GL_ALIASED_LINE_WIDTH_RANGE:
283 case GL_ALIASED_POINT_SIZE_RANGE:
284 case GL_DEPTH_RANGE:
285 case GL_SMOOTH_LINE_WIDTH_RANGE:
286 case GL_SMOOTH_POINT_SIZE_RANGE:
287 needed = 2;
288 break;
289
290 case GL_CURRENT_NORMAL:
291 case GL_POINT_DISTANCE_ATTENUATION:
292 needed = 3;
293 break;
294
295 case GL_COLOR_CLEAR_VALUE:
296 case GL_COLOR_WRITEMASK:
297 case GL_CURRENT_COLOR:
298 case GL_CURRENT_TEXTURE_COORDS:
299 case GL_FOG_COLOR:
300 case GL_LIGHT_MODEL_AMBIENT:
301 case GL_SCISSOR_BOX:
302 case GL_VIEWPORT:
303 needed = 4;
304 break;
305
306 case GL_MODELVIEW_MATRIX:
307 case GL_PROJECTION_MATRIX:
308 case GL_TEXTURE_MATRIX:
309 needed = 16;
310 break;
311
312 case GL_COMPRESSED_TEXTURE_FORMATS:
313 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
314 break;
315 }
316#endif
317 return needed;
Jack Palevich560814f2009-11-19 16:34:55 +0800318}
319
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700320template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
321 typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
Mathias Agopian2ad04772013-02-23 03:12:30 -0800322static void
323get
324 (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
325 jint _exception = 0;
326 const char * _exceptionType;
327 const char * _exceptionMessage;
328 CTYPE *params_base = (CTYPE *) 0;
329 jint _remaining;
330 CTYPE *params = (CTYPE *) 0;
331 int _needed = 0;
332
333 if (!params_ref) {
334 _exception = 1;
335 _exceptionType = "java/lang/IllegalArgumentException";
336 _exceptionMessage = "params == null";
337 goto exit;
338 }
339 if (offset < 0) {
340 _exception = 1;
341 _exceptionType = "java/lang/IllegalArgumentException";
342 _exceptionMessage = "offset < 0";
343 goto exit;
344 }
345 _remaining = _env->GetArrayLength(params_ref) - offset;
346 _needed = getNeededCount(pname);
347 // if we didn't find this pname, we just assume the user passed
348 // an array of the right size -- this might happen with extensions
349 // or if we forget an enum here.
350 if (_remaining < _needed) {
351 _exception = 1;
352 _exceptionType = "java/lang/IllegalArgumentException";
353 _exceptionMessage = "length - offset < needed";
354 goto exit;
355 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700356 params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
357 _env, params_ref, (jboolean *)0);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800358 params = params_base + offset;
359
360 GET(
361 (GLenum)pname,
362 (CTYPE *)params
363 );
364
365exit:
366 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700367 releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
368 _env, params_ref, params_base, !_exception);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800369 }
370 if (_exception) {
371 jniThrowException(_env, _exceptionType, _exceptionMessage);
372 }
373}
374
375
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700376template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
377 typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
Mathias Agopian2ad04772013-02-23 03:12:30 -0800378static void
379getarray
380 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
381 jint _exception = 0;
382 const char * _exceptionType;
383 const char * _exceptionMessage;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700384 JTYPEARRAY _array = (JTYPEARRAY) 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800385 jint _bufferOffset = (jint) 0;
386 jint _remaining;
387 CTYPE *params = (CTYPE *) 0;
388 int _needed = 0;
389
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700390 params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Andy McFaddencee51982013-04-25 16:08:31 -0700391 _remaining /= sizeof(CTYPE); // convert from bytes to item count
Mathias Agopian2ad04772013-02-23 03:12:30 -0800392 _needed = getNeededCount(pname);
393 // if we didn't find this pname, we just assume the user passed
394 // an array of the right size -- this might happen with extensions
395 // or if we forget an enum here.
396 if (_needed>0 && _remaining < _needed) {
397 _exception = 1;
398 _exceptionType = "java/lang/IllegalArgumentException";
399 _exceptionMessage = "remaining() < needed";
400 goto exit;
401 }
402 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700403 char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
404 _env, _array, (jboolean *) 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800405 params = (CTYPE *) (_paramsBase + _bufferOffset);
406 }
407 GET(
408 (GLenum)pname,
409 (CTYPE *)params
410 );
411
412exit:
413 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700414 releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
415 _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
Mathias Agopian2ad04772013-02-23 03:12:30 -0800416 }
417 if (_exception) {
418 jniThrowException(_env, _exceptionType, _exceptionMessage);
419 }
Jack Palevich560814f2009-11-19 16:34:55 +0800420}
421
422// --------------------------------------------------------------------------
Jack Palevich560814f2009-11-19 16:34:55 +0800423/* void glActiveTexture ( GLenum texture ) */
424static void
425android_glActiveTexture__I
426 (JNIEnv *_env, jobject _this, jint texture) {
427 glActiveTexture(
428 (GLenum)texture
429 );
430}
431
432/* void glAttachShader ( GLuint program, GLuint shader ) */
433static void
434android_glAttachShader__II
435 (JNIEnv *_env, jobject _this, jint program, jint shader) {
436 glAttachShader(
437 (GLuint)program,
438 (GLuint)shader
439 );
440}
441
442/* void glBindAttribLocation ( GLuint program, GLuint index, const char *name ) */
443static void
444android_glBindAttribLocation__IILjava_lang_String_2
445 (JNIEnv *_env, jobject _this, jint program, jint index, jstring name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700446 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800447 const char * _exceptionType = NULL;
448 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800449 const char* _nativename = 0;
450
451 if (!name) {
Elliott Hughes428d3fc2013-09-24 17:15:41 -0700452 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700453 _exceptionType = "java/lang/IllegalArgumentException";
454 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +0800455 goto exit;
456 }
457 _nativename = _env->GetStringUTFChars(name, 0);
458
459 glBindAttribLocation(
460 (GLuint)program,
461 (GLuint)index,
462 (char *)_nativename
463 );
464
465exit:
466 if (_nativename) {
467 _env->ReleaseStringUTFChars(name, _nativename);
468 }
469
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700470 if (_exception) {
471 jniThrowException(_env, _exceptionType, _exceptionMessage);
472 }
Jack Palevich560814f2009-11-19 16:34:55 +0800473}
474
475/* void glBindBuffer ( GLenum target, GLuint buffer ) */
476static void
477android_glBindBuffer__II
478 (JNIEnv *_env, jobject _this, jint target, jint buffer) {
479 glBindBuffer(
480 (GLenum)target,
481 (GLuint)buffer
482 );
483}
484
485/* void glBindFramebuffer ( GLenum target, GLuint framebuffer ) */
486static void
487android_glBindFramebuffer__II
488 (JNIEnv *_env, jobject _this, jint target, jint framebuffer) {
489 glBindFramebuffer(
490 (GLenum)target,
491 (GLuint)framebuffer
492 );
493}
494
495/* void glBindRenderbuffer ( GLenum target, GLuint renderbuffer ) */
496static void
497android_glBindRenderbuffer__II
498 (JNIEnv *_env, jobject _this, jint target, jint renderbuffer) {
499 glBindRenderbuffer(
500 (GLenum)target,
501 (GLuint)renderbuffer
502 );
503}
504
505/* void glBindTexture ( GLenum target, GLuint texture ) */
506static void
507android_glBindTexture__II
508 (JNIEnv *_env, jobject _this, jint target, jint texture) {
509 glBindTexture(
510 (GLenum)target,
511 (GLuint)texture
512 );
513}
514
515/* void glBlendColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
516static void
517android_glBlendColor__FFFF
518 (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
519 glBlendColor(
520 (GLclampf)red,
521 (GLclampf)green,
522 (GLclampf)blue,
523 (GLclampf)alpha
524 );
525}
526
527/* void glBlendEquation ( GLenum mode ) */
528static void
529android_glBlendEquation__I
530 (JNIEnv *_env, jobject _this, jint mode) {
Jack Palevich73108672011-03-28 14:49:12 -0700531 glBlendEquation(
532 (GLenum)mode
533 );
Jack Palevich560814f2009-11-19 16:34:55 +0800534}
535
536/* void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha ) */
537static void
538android_glBlendEquationSeparate__II
539 (JNIEnv *_env, jobject _this, jint modeRGB, jint modeAlpha) {
Jack Palevich73108672011-03-28 14:49:12 -0700540 glBlendEquationSeparate(
541 (GLenum)modeRGB,
542 (GLenum)modeAlpha
543 );
Jack Palevich560814f2009-11-19 16:34:55 +0800544}
545
546/* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */
547static void
548android_glBlendFunc__II
549 (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) {
550 glBlendFunc(
551 (GLenum)sfactor,
552 (GLenum)dfactor
553 );
554}
555
556/* void glBlendFuncSeparate ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) */
557static void
558android_glBlendFuncSeparate__IIII
559 (JNIEnv *_env, jobject _this, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) {
Jack Palevich73108672011-03-28 14:49:12 -0700560 glBlendFuncSeparate(
561 (GLenum)srcRGB,
562 (GLenum)dstRGB,
563 (GLenum)srcAlpha,
564 (GLenum)dstAlpha
565 );
Jack Palevich560814f2009-11-19 16:34:55 +0800566}
567
568/* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */
569static void
570android_glBufferData__IILjava_nio_Buffer_2I
571 (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700572 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800573 const char * _exceptionType = NULL;
574 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800575 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700576 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800577 jint _remaining;
578 GLvoid *data = (GLvoid *) 0;
579
580 if (data_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700581 data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +0800582 if (_remaining < size) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700583 _exception = 1;
584 _exceptionType = "java/lang/IllegalArgumentException";
585 _exceptionMessage = "remaining() < size < needed";
Jack Palevich560814f2009-11-19 16:34:55 +0800586 goto exit;
587 }
588 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -0700589 if (data_buf && data == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700590 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
591 data = (GLvoid *) (_dataBase + _bufferOffset);
592 }
Jack Palevich560814f2009-11-19 16:34:55 +0800593 glBufferData(
594 (GLenum)target,
595 (GLsizeiptr)size,
596 (GLvoid *)data,
597 (GLenum)usage
598 );
599
600exit:
601 if (_array) {
602 releasePointer(_env, _array, data, JNI_FALSE);
603 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700604 if (_exception) {
605 jniThrowException(_env, _exceptionType, _exceptionMessage);
606 }
Jack Palevich560814f2009-11-19 16:34:55 +0800607}
608
609/* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */
610static void
611android_glBufferSubData__IIILjava_nio_Buffer_2
612 (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700613 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800614 const char * _exceptionType = NULL;
615 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800616 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700617 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800618 jint _remaining;
619 GLvoid *data = (GLvoid *) 0;
620
Romain Guy84cac202016-12-05 12:26:02 -0800621 if (!data_buf) {
622 _exception = 1;
623 _exceptionType = "java/lang/IllegalArgumentException";
624 _exceptionMessage = "data == null";
625 goto exit;
626 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700627 data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +0800628 if (_remaining < size) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700629 _exception = 1;
630 _exceptionType = "java/lang/IllegalArgumentException";
631 _exceptionMessage = "remaining() < size < needed";
Jack Palevich560814f2009-11-19 16:34:55 +0800632 goto exit;
633 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700634 if (data == NULL) {
635 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
636 data = (GLvoid *) (_dataBase + _bufferOffset);
637 }
Jack Palevich560814f2009-11-19 16:34:55 +0800638 glBufferSubData(
639 (GLenum)target,
640 (GLintptr)offset,
641 (GLsizeiptr)size,
642 (GLvoid *)data
643 );
644
645exit:
646 if (_array) {
647 releasePointer(_env, _array, data, JNI_FALSE);
648 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700649 if (_exception) {
650 jniThrowException(_env, _exceptionType, _exceptionMessage);
651 }
Jack Palevich560814f2009-11-19 16:34:55 +0800652}
653
654/* GLenum glCheckFramebufferStatus ( GLenum target ) */
655static jint
656android_glCheckFramebufferStatus__I
657 (JNIEnv *_env, jobject _this, jint target) {
658 GLenum _returnValue;
659 _returnValue = glCheckFramebufferStatus(
660 (GLenum)target
661 );
Andy McFaddencee51982013-04-25 16:08:31 -0700662 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +0800663}
664
665/* void glClear ( GLbitfield mask ) */
666static void
667android_glClear__I
668 (JNIEnv *_env, jobject _this, jint mask) {
669 glClear(
670 (GLbitfield)mask
671 );
672}
673
674/* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */
675static void
676android_glClearColor__FFFF
677 (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) {
678 glClearColor(
679 (GLclampf)red,
680 (GLclampf)green,
681 (GLclampf)blue,
682 (GLclampf)alpha
683 );
684}
685
686/* void glClearDepthf ( GLclampf depth ) */
687static void
688android_glClearDepthf__F
689 (JNIEnv *_env, jobject _this, jfloat depth) {
690 glClearDepthf(
691 (GLclampf)depth
692 );
693}
694
695/* void glClearStencil ( GLint s ) */
696static void
697android_glClearStencil__I
698 (JNIEnv *_env, jobject _this, jint s) {
699 glClearStencil(
700 (GLint)s
701 );
702}
703
704/* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */
705static void
706android_glColorMask__ZZZZ
707 (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) {
708 glColorMask(
709 (GLboolean)red,
710 (GLboolean)green,
711 (GLboolean)blue,
712 (GLboolean)alpha
713 );
714}
715
716/* void glCompileShader ( GLuint shader ) */
717static void
718android_glCompileShader__I
719 (JNIEnv *_env, jobject _this, jint shader) {
720 glCompileShader(
721 (GLuint)shader
722 );
723}
724
725/* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */
726static void
727android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2
728 (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 -0800729 jint _exception = 0;
730 const char * _exceptionType = NULL;
731 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800732 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700733 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800734 jint _remaining;
735 GLvoid *data = (GLvoid *) 0;
736
Romain Guy84cac202016-12-05 12:26:02 -0800737 if (!data_buf) {
738 _exception = 1;
739 _exceptionType = "java/lang/IllegalArgumentException";
740 _exceptionMessage = "data == null";
741 goto exit;
742 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700743 data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700744 if (data == NULL) {
745 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
746 data = (GLvoid *) (_dataBase + _bufferOffset);
747 }
Jack Palevich560814f2009-11-19 16:34:55 +0800748 glCompressedTexImage2D(
749 (GLenum)target,
750 (GLint)level,
751 (GLenum)internalformat,
752 (GLsizei)width,
753 (GLsizei)height,
754 (GLint)border,
755 (GLsizei)imageSize,
756 (GLvoid *)data
757 );
Romain Guy84cac202016-12-05 12:26:02 -0800758
759exit:
Jack Palevich560814f2009-11-19 16:34:55 +0800760 if (_array) {
761 releasePointer(_env, _array, data, JNI_FALSE);
762 }
Romain Guy84cac202016-12-05 12:26:02 -0800763 if (_exception) {
764 jniThrowException(_env, _exceptionType, _exceptionMessage);
765 }
Jack Palevich560814f2009-11-19 16:34:55 +0800766}
767
768/* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */
769static void
770android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
771 (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 -0800772 jint _exception = 0;
773 const char * _exceptionType = NULL;
774 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800775 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700776 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800777 jint _remaining;
778 GLvoid *data = (GLvoid *) 0;
779
Romain Guy84cac202016-12-05 12:26:02 -0800780 if (!data_buf) {
781 _exception = 1;
782 _exceptionType = "java/lang/IllegalArgumentException";
783 _exceptionMessage = "data == null";
784 goto exit;
785 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700786 data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700787 if (data == NULL) {
788 char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
789 data = (GLvoid *) (_dataBase + _bufferOffset);
790 }
Jack Palevich560814f2009-11-19 16:34:55 +0800791 glCompressedTexSubImage2D(
792 (GLenum)target,
793 (GLint)level,
794 (GLint)xoffset,
795 (GLint)yoffset,
796 (GLsizei)width,
797 (GLsizei)height,
798 (GLenum)format,
799 (GLsizei)imageSize,
800 (GLvoid *)data
801 );
Romain Guy84cac202016-12-05 12:26:02 -0800802
803exit:
Jack Palevich560814f2009-11-19 16:34:55 +0800804 if (_array) {
805 releasePointer(_env, _array, data, JNI_FALSE);
806 }
Romain Guy84cac202016-12-05 12:26:02 -0800807 if (_exception) {
808 jniThrowException(_env, _exceptionType, _exceptionMessage);
809 }
Jack Palevich560814f2009-11-19 16:34:55 +0800810}
811
812/* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */
813static void
814android_glCopyTexImage2D__IIIIIIII
815 (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) {
816 glCopyTexImage2D(
817 (GLenum)target,
818 (GLint)level,
819 (GLenum)internalformat,
820 (GLint)x,
821 (GLint)y,
822 (GLsizei)width,
823 (GLsizei)height,
824 (GLint)border
825 );
826}
827
828/* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */
829static void
830android_glCopyTexSubImage2D__IIIIIIII
831 (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) {
832 glCopyTexSubImage2D(
833 (GLenum)target,
834 (GLint)level,
835 (GLint)xoffset,
836 (GLint)yoffset,
837 (GLint)x,
838 (GLint)y,
839 (GLsizei)width,
840 (GLsizei)height
841 );
842}
843
844/* GLuint glCreateProgram ( void ) */
845static jint
846android_glCreateProgram__
847 (JNIEnv *_env, jobject _this) {
848 GLuint _returnValue;
849 _returnValue = glCreateProgram();
Andy McFaddencee51982013-04-25 16:08:31 -0700850 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +0800851}
852
853/* GLuint glCreateShader ( GLenum type ) */
854static jint
855android_glCreateShader__I
856 (JNIEnv *_env, jobject _this, jint type) {
857 GLuint _returnValue;
858 _returnValue = glCreateShader(
859 (GLenum)type
860 );
Andy McFaddencee51982013-04-25 16:08:31 -0700861 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +0800862}
863
864/* void glCullFace ( GLenum mode ) */
865static void
866android_glCullFace__I
867 (JNIEnv *_env, jobject _this, jint mode) {
868 glCullFace(
869 (GLenum)mode
870 );
871}
872
873/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
874static void
875android_glDeleteBuffers__I_3II
876 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700877 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800878 const char * _exceptionType = NULL;
879 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800880 GLuint *buffers_base = (GLuint *) 0;
881 jint _remaining;
882 GLuint *buffers = (GLuint *) 0;
883
884 if (!buffers_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700885 _exception = 1;
886 _exceptionType = "java/lang/IllegalArgumentException";
887 _exceptionMessage = "buffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +0800888 goto exit;
889 }
890 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700891 _exception = 1;
892 _exceptionType = "java/lang/IllegalArgumentException";
893 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +0800894 goto exit;
895 }
896 _remaining = _env->GetArrayLength(buffers_ref) - offset;
897 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700898 _exception = 1;
899 _exceptionType = "java/lang/IllegalArgumentException";
900 _exceptionMessage = "length - offset < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +0800901 goto exit;
902 }
903 buffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700904 _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +0800905 buffers = buffers_base + offset;
906
907 glDeleteBuffers(
908 (GLsizei)n,
909 (GLuint *)buffers
910 );
911
912exit:
913 if (buffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700914 _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
Jack Palevich560814f2009-11-19 16:34:55 +0800915 JNI_ABORT);
916 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700917 if (_exception) {
918 jniThrowException(_env, _exceptionType, _exceptionMessage);
919 }
Jack Palevich560814f2009-11-19 16:34:55 +0800920}
921
922/* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */
923static void
924android_glDeleteBuffers__ILjava_nio_IntBuffer_2
925 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700926 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800927 const char * _exceptionType = NULL;
928 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700929 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700930 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +0800931 jint _remaining;
932 GLuint *buffers = (GLuint *) 0;
933
Romain Guy84cac202016-12-05 12:26:02 -0800934 if (!buffers_buf) {
935 _exception = 1;
936 _exceptionType = "java/lang/IllegalArgumentException";
937 _exceptionMessage = "buffers == null";
938 goto exit;
939 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700940 buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +0800941 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700942 _exception = 1;
943 _exceptionType = "java/lang/IllegalArgumentException";
944 _exceptionMessage = "remaining() < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +0800945 goto exit;
946 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700947 if (buffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700948 char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -0700949 buffers = (GLuint *) (_buffersBase + _bufferOffset);
950 }
Jack Palevich560814f2009-11-19 16:34:55 +0800951 glDeleteBuffers(
952 (GLsizei)n,
953 (GLuint *)buffers
954 );
955
956exit:
957 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700958 _env->ReleaseIntArrayElements(_array, (jint*)buffers, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +0800959 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700960 if (_exception) {
961 jniThrowException(_env, _exceptionType, _exceptionMessage);
962 }
Jack Palevich560814f2009-11-19 16:34:55 +0800963}
964
965/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */
966static void
967android_glDeleteFramebuffers__I_3II
968 (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700969 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800970 const char * _exceptionType = NULL;
971 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +0800972 GLuint *framebuffers_base = (GLuint *) 0;
973 jint _remaining;
974 GLuint *framebuffers = (GLuint *) 0;
975
976 if (!framebuffers_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700977 _exception = 1;
978 _exceptionType = "java/lang/IllegalArgumentException";
979 _exceptionMessage = "framebuffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +0800980 goto exit;
981 }
982 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -0700983 _exception = 1;
984 _exceptionType = "java/lang/IllegalArgumentException";
985 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +0800986 goto exit;
987 }
988 _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -0800989 if (_remaining < n) {
990 _exception = 1;
991 _exceptionType = "java/lang/IllegalArgumentException";
992 _exceptionMessage = "length - offset < n < needed";
993 goto exit;
994 }
Jack Palevich560814f2009-11-19 16:34:55 +0800995 framebuffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -0700996 _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +0800997 framebuffers = framebuffers_base + offset;
998
999 glDeleteFramebuffers(
1000 (GLsizei)n,
1001 (GLuint *)framebuffers
1002 );
1003
1004exit:
1005 if (framebuffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001006 _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001007 JNI_ABORT);
1008 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001009 if (_exception) {
1010 jniThrowException(_env, _exceptionType, _exceptionMessage);
1011 }
Jack Palevich560814f2009-11-19 16:34:55 +08001012}
1013
1014/* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */
1015static void
1016android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2
1017 (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001018 jint _exception = 0;
1019 const char * _exceptionType = NULL;
1020 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001021 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001022 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001023 jint _remaining;
1024 GLuint *framebuffers = (GLuint *) 0;
1025
Romain Guy84cac202016-12-05 12:26:02 -08001026 if (!framebuffers_buf) {
1027 _exception = 1;
1028 _exceptionType = "java/lang/IllegalArgumentException";
1029 _exceptionMessage = "framebuffers == null";
1030 goto exit;
1031 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001032 framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001033 if (_remaining < n) {
1034 _exception = 1;
1035 _exceptionType = "java/lang/IllegalArgumentException";
1036 _exceptionMessage = "remaining() < n < needed";
1037 goto exit;
1038 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001039 if (framebuffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001040 char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001041 framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
1042 }
Jack Palevich560814f2009-11-19 16:34:55 +08001043 glDeleteFramebuffers(
1044 (GLsizei)n,
1045 (GLuint *)framebuffers
1046 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001047
1048exit:
Jack Palevich560814f2009-11-19 16:34:55 +08001049 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001050 _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08001051 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08001052 if (_exception) {
1053 jniThrowException(_env, _exceptionType, _exceptionMessage);
1054 }
Jack Palevich560814f2009-11-19 16:34:55 +08001055}
1056
1057/* void glDeleteProgram ( GLuint program ) */
1058static void
1059android_glDeleteProgram__I
1060 (JNIEnv *_env, jobject _this, jint program) {
1061 glDeleteProgram(
1062 (GLuint)program
1063 );
1064}
1065
1066/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */
1067static void
1068android_glDeleteRenderbuffers__I_3II
1069 (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001070 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001071 const char * _exceptionType = NULL;
1072 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001073 GLuint *renderbuffers_base = (GLuint *) 0;
1074 jint _remaining;
1075 GLuint *renderbuffers = (GLuint *) 0;
1076
1077 if (!renderbuffers_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001078 _exception = 1;
1079 _exceptionType = "java/lang/IllegalArgumentException";
1080 _exceptionMessage = "renderbuffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001081 goto exit;
1082 }
1083 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001084 _exception = 1;
1085 _exceptionType = "java/lang/IllegalArgumentException";
1086 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001087 goto exit;
1088 }
1089 _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001090 if (_remaining < n) {
1091 _exception = 1;
1092 _exceptionType = "java/lang/IllegalArgumentException";
1093 _exceptionMessage = "length - offset < n < needed";
1094 goto exit;
1095 }
Jack Palevich560814f2009-11-19 16:34:55 +08001096 renderbuffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001097 _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001098 renderbuffers = renderbuffers_base + offset;
1099
1100 glDeleteRenderbuffers(
1101 (GLsizei)n,
1102 (GLuint *)renderbuffers
1103 );
1104
1105exit:
1106 if (renderbuffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001107 _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001108 JNI_ABORT);
1109 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001110 if (_exception) {
1111 jniThrowException(_env, _exceptionType, _exceptionMessage);
1112 }
Jack Palevich560814f2009-11-19 16:34:55 +08001113}
1114
1115/* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */
1116static void
1117android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2
1118 (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001119 jint _exception = 0;
1120 const char * _exceptionType = NULL;
1121 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001122 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001123 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001124 jint _remaining;
1125 GLuint *renderbuffers = (GLuint *) 0;
1126
Romain Guy84cac202016-12-05 12:26:02 -08001127 if (!renderbuffers_buf) {
1128 _exception = 1;
1129 _exceptionType = "java/lang/IllegalArgumentException";
1130 _exceptionMessage = "renderbuffers == null";
1131 goto exit;
1132 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001133 renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001134 if (_remaining < n) {
1135 _exception = 1;
1136 _exceptionType = "java/lang/IllegalArgumentException";
1137 _exceptionMessage = "remaining() < n < needed";
1138 goto exit;
1139 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001140 if (renderbuffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001141 char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001142 renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
1143 }
Jack Palevich560814f2009-11-19 16:34:55 +08001144 glDeleteRenderbuffers(
1145 (GLsizei)n,
1146 (GLuint *)renderbuffers
1147 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001148
1149exit:
Jack Palevich560814f2009-11-19 16:34:55 +08001150 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001151 _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08001152 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08001153 if (_exception) {
1154 jniThrowException(_env, _exceptionType, _exceptionMessage);
1155 }
Jack Palevich560814f2009-11-19 16:34:55 +08001156}
1157
1158/* void glDeleteShader ( GLuint shader ) */
1159static void
1160android_glDeleteShader__I
1161 (JNIEnv *_env, jobject _this, jint shader) {
1162 glDeleteShader(
1163 (GLuint)shader
1164 );
1165}
1166
1167/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
1168static void
1169android_glDeleteTextures__I_3II
1170 (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001171 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001172 const char * _exceptionType = NULL;
1173 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001174 GLuint *textures_base = (GLuint *) 0;
1175 jint _remaining;
1176 GLuint *textures = (GLuint *) 0;
1177
1178 if (!textures_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001179 _exception = 1;
1180 _exceptionType = "java/lang/IllegalArgumentException";
1181 _exceptionMessage = "textures == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001182 goto exit;
1183 }
1184 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001185 _exception = 1;
1186 _exceptionType = "java/lang/IllegalArgumentException";
1187 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001188 goto exit;
1189 }
1190 _remaining = _env->GetArrayLength(textures_ref) - offset;
1191 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001192 _exception = 1;
1193 _exceptionType = "java/lang/IllegalArgumentException";
1194 _exceptionMessage = "length - offset < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001195 goto exit;
1196 }
1197 textures_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001198 _env->GetIntArrayElements(textures_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001199 textures = textures_base + offset;
1200
1201 glDeleteTextures(
1202 (GLsizei)n,
1203 (GLuint *)textures
1204 );
1205
1206exit:
1207 if (textures_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001208 _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001209 JNI_ABORT);
1210 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001211 if (_exception) {
1212 jniThrowException(_env, _exceptionType, _exceptionMessage);
1213 }
Jack Palevich560814f2009-11-19 16:34:55 +08001214}
1215
1216/* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */
1217static void
1218android_glDeleteTextures__ILjava_nio_IntBuffer_2
1219 (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001220 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001221 const char * _exceptionType = NULL;
1222 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001223 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001224 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001225 jint _remaining;
1226 GLuint *textures = (GLuint *) 0;
1227
Romain Guy84cac202016-12-05 12:26:02 -08001228 if (!textures_buf) {
1229 _exception = 1;
1230 _exceptionType = "java/lang/IllegalArgumentException";
1231 _exceptionMessage = "textures == null";
1232 goto exit;
1233 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001234 textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08001235 if (_remaining < n) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001236 _exception = 1;
1237 _exceptionType = "java/lang/IllegalArgumentException";
1238 _exceptionMessage = "remaining() < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001239 goto exit;
1240 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001241 if (textures == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001242 char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001243 textures = (GLuint *) (_texturesBase + _bufferOffset);
1244 }
Jack Palevich560814f2009-11-19 16:34:55 +08001245 glDeleteTextures(
1246 (GLsizei)n,
1247 (GLuint *)textures
1248 );
1249
1250exit:
1251 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001252 _env->ReleaseIntArrayElements(_array, (jint*)textures, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08001253 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001254 if (_exception) {
1255 jniThrowException(_env, _exceptionType, _exceptionMessage);
1256 }
Jack Palevich560814f2009-11-19 16:34:55 +08001257}
1258
1259/* void glDepthFunc ( GLenum func ) */
1260static void
1261android_glDepthFunc__I
1262 (JNIEnv *_env, jobject _this, jint func) {
1263 glDepthFunc(
1264 (GLenum)func
1265 );
1266}
1267
1268/* void glDepthMask ( GLboolean flag ) */
1269static void
1270android_glDepthMask__Z
1271 (JNIEnv *_env, jobject _this, jboolean flag) {
1272 glDepthMask(
1273 (GLboolean)flag
1274 );
1275}
1276
1277/* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */
1278static void
1279android_glDepthRangef__FF
1280 (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) {
1281 glDepthRangef(
1282 (GLclampf)zNear,
1283 (GLclampf)zFar
1284 );
1285}
1286
1287/* void glDetachShader ( GLuint program, GLuint shader ) */
1288static void
1289android_glDetachShader__II
1290 (JNIEnv *_env, jobject _this, jint program, jint shader) {
1291 glDetachShader(
1292 (GLuint)program,
1293 (GLuint)shader
1294 );
1295}
1296
1297/* void glDisable ( GLenum cap ) */
1298static void
1299android_glDisable__I
1300 (JNIEnv *_env, jobject _this, jint cap) {
1301 glDisable(
1302 (GLenum)cap
1303 );
1304}
1305
1306/* void glDisableVertexAttribArray ( GLuint index ) */
1307static void
1308android_glDisableVertexAttribArray__I
1309 (JNIEnv *_env, jobject _this, jint index) {
1310 glDisableVertexAttribArray(
1311 (GLuint)index
1312 );
1313}
1314
1315/* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */
1316static void
1317android_glDrawArrays__III
1318 (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) {
1319 glDrawArrays(
1320 (GLenum)mode,
1321 (GLint)first,
1322 (GLsizei)count
1323 );
1324}
1325
Jack Palevich224107a2010-06-22 20:08:40 +08001326/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */
1327static void
1328android_glDrawElements__IIII
1329 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001330 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001331 const char * _exceptionType = NULL;
1332 const char * _exceptionMessage = NULL;
Jack Palevich224107a2010-06-22 20:08:40 +08001333 glDrawElements(
1334 (GLenum)mode,
1335 (GLsizei)count,
1336 (GLenum)type,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00001337 reinterpret_cast<GLvoid *>(offset)
Jack Palevich224107a2010-06-22 20:08:40 +08001338 );
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001339 if (_exception) {
1340 jniThrowException(_env, _exceptionType, _exceptionMessage);
1341 }
Jack Palevich224107a2010-06-22 20:08:40 +08001342}
1343
Jack Palevich560814f2009-11-19 16:34:55 +08001344/* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */
1345static void
1346android_glDrawElements__IIILjava_nio_Buffer_2
1347 (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001348 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001349 const char * _exceptionType = NULL;
1350 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001351 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001352 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001353 jint _remaining;
1354 GLvoid *indices = (GLvoid *) 0;
1355
Romain Guy84cac202016-12-05 12:26:02 -08001356 if (!indices_buf) {
1357 _exception = 1;
1358 _exceptionType = "java/lang/IllegalArgumentException";
1359 _exceptionMessage = "indices == null";
1360 goto exit;
1361 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001362 indices = (GLvoid *)getPointer(_env, indices_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08001363 if (_remaining < count) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001364 _exception = 1;
1365 _exceptionType = "java/lang/ArrayIndexOutOfBoundsException";
1366 _exceptionMessage = "remaining() < count < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001367 goto exit;
1368 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001369 if (indices == NULL) {
1370 char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
1371 indices = (GLvoid *) (_indicesBase + _bufferOffset);
1372 }
Jack Palevich560814f2009-11-19 16:34:55 +08001373 glDrawElements(
1374 (GLenum)mode,
1375 (GLsizei)count,
1376 (GLenum)type,
1377 (GLvoid *)indices
1378 );
1379
1380exit:
1381 if (_array) {
1382 releasePointer(_env, _array, indices, JNI_FALSE);
1383 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001384 if (_exception) {
1385 jniThrowException(_env, _exceptionType, _exceptionMessage);
1386 }
Jack Palevich560814f2009-11-19 16:34:55 +08001387}
1388
1389/* void glEnable ( GLenum cap ) */
1390static void
1391android_glEnable__I
1392 (JNIEnv *_env, jobject _this, jint cap) {
1393 glEnable(
1394 (GLenum)cap
1395 );
1396}
1397
1398/* void glEnableVertexAttribArray ( GLuint index ) */
1399static void
1400android_glEnableVertexAttribArray__I
1401 (JNIEnv *_env, jobject _this, jint index) {
1402 glEnableVertexAttribArray(
1403 (GLuint)index
1404 );
1405}
1406
1407/* void glFinish ( void ) */
1408static void
1409android_glFinish__
1410 (JNIEnv *_env, jobject _this) {
1411 glFinish();
1412}
1413
1414/* void glFlush ( void ) */
1415static void
1416android_glFlush__
1417 (JNIEnv *_env, jobject _this) {
1418 glFlush();
1419}
1420
1421/* void glFramebufferRenderbuffer ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) */
1422static void
1423android_glFramebufferRenderbuffer__IIII
1424 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint renderbuffertarget, jint renderbuffer) {
1425 glFramebufferRenderbuffer(
1426 (GLenum)target,
1427 (GLenum)attachment,
1428 (GLenum)renderbuffertarget,
1429 (GLuint)renderbuffer
1430 );
1431}
1432
1433/* void glFramebufferTexture2D ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) */
1434static void
1435android_glFramebufferTexture2D__IIIII
1436 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint textarget, jint texture, jint level) {
1437 glFramebufferTexture2D(
1438 (GLenum)target,
1439 (GLenum)attachment,
1440 (GLenum)textarget,
1441 (GLuint)texture,
1442 (GLint)level
1443 );
1444}
1445
1446/* void glFrontFace ( GLenum mode ) */
1447static void
1448android_glFrontFace__I
1449 (JNIEnv *_env, jobject _this, jint mode) {
1450 glFrontFace(
1451 (GLenum)mode
1452 );
1453}
1454
1455/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
1456static void
1457android_glGenBuffers__I_3II
1458 (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) {
1459 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001460 const char * _exceptionType = NULL;
1461 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001462 GLuint *buffers_base = (GLuint *) 0;
1463 jint _remaining;
1464 GLuint *buffers = (GLuint *) 0;
1465
1466 if (!buffers_ref) {
1467 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001468 _exceptionType = "java/lang/IllegalArgumentException";
1469 _exceptionMessage = "buffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001470 goto exit;
1471 }
1472 if (offset < 0) {
1473 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001474 _exceptionType = "java/lang/IllegalArgumentException";
1475 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001476 goto exit;
1477 }
1478 _remaining = _env->GetArrayLength(buffers_ref) - offset;
1479 if (_remaining < n) {
1480 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001481 _exceptionType = "java/lang/IllegalArgumentException";
1482 _exceptionMessage = "length - offset < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001483 goto exit;
1484 }
1485 buffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001486 _env->GetIntArrayElements(buffers_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001487 buffers = buffers_base + offset;
1488
1489 glGenBuffers(
1490 (GLsizei)n,
1491 (GLuint *)buffers
1492 );
1493
1494exit:
1495 if (buffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001496 _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001497 _exception ? JNI_ABORT: 0);
1498 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001499 if (_exception) {
1500 jniThrowException(_env, _exceptionType, _exceptionMessage);
1501 }
Jack Palevich560814f2009-11-19 16:34:55 +08001502}
1503
1504/* void glGenBuffers ( GLsizei n, GLuint *buffers ) */
1505static void
1506android_glGenBuffers__ILjava_nio_IntBuffer_2
1507 (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) {
1508 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001509 const char * _exceptionType = NULL;
1510 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001511 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001512 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001513 jint _remaining;
1514 GLuint *buffers = (GLuint *) 0;
1515
Romain Guy84cac202016-12-05 12:26:02 -08001516 if (!buffers_buf) {
1517 _exception = 1;
1518 _exceptionType = "java/lang/IllegalArgumentException";
1519 _exceptionMessage = "buffers == null";
1520 goto exit;
1521 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001522 buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08001523 if (_remaining < n) {
1524 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001525 _exceptionType = "java/lang/IllegalArgumentException";
1526 _exceptionMessage = "remaining() < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001527 goto exit;
1528 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001529 if (buffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001530 char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001531 buffers = (GLuint *) (_buffersBase + _bufferOffset);
1532 }
Jack Palevich560814f2009-11-19 16:34:55 +08001533 glGenBuffers(
1534 (GLsizei)n,
1535 (GLuint *)buffers
1536 );
1537
1538exit:
1539 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001540 _env->ReleaseIntArrayElements(_array, (jint*)buffers, _exception ? JNI_ABORT : 0);
Jack Palevich560814f2009-11-19 16:34:55 +08001541 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001542 if (_exception) {
1543 jniThrowException(_env, _exceptionType, _exceptionMessage);
1544 }
Jack Palevich560814f2009-11-19 16:34:55 +08001545}
1546
1547/* void glGenerateMipmap ( GLenum target ) */
1548static void
1549android_glGenerateMipmap__I
1550 (JNIEnv *_env, jobject _this, jint target) {
1551 glGenerateMipmap(
1552 (GLenum)target
1553 );
1554}
1555
1556/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */
1557static void
1558android_glGenFramebuffers__I_3II
1559 (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) {
1560 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001561 const char * _exceptionType = NULL;
1562 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001563 GLuint *framebuffers_base = (GLuint *) 0;
1564 jint _remaining;
1565 GLuint *framebuffers = (GLuint *) 0;
1566
1567 if (!framebuffers_ref) {
1568 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001569 _exceptionType = "java/lang/IllegalArgumentException";
1570 _exceptionMessage = "framebuffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001571 goto exit;
1572 }
1573 if (offset < 0) {
1574 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001575 _exceptionType = "java/lang/IllegalArgumentException";
1576 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001577 goto exit;
1578 }
1579 _remaining = _env->GetArrayLength(framebuffers_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001580 if (_remaining < n) {
1581 _exception = 1;
1582 _exceptionType = "java/lang/IllegalArgumentException";
1583 _exceptionMessage = "length - offset < n < needed";
1584 goto exit;
1585 }
Jack Palevich560814f2009-11-19 16:34:55 +08001586 framebuffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001587 _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001588 framebuffers = framebuffers_base + offset;
1589
1590 glGenFramebuffers(
1591 (GLsizei)n,
1592 (GLuint *)framebuffers
1593 );
1594
1595exit:
1596 if (framebuffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001597 _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001598 _exception ? JNI_ABORT: 0);
1599 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001600 if (_exception) {
1601 jniThrowException(_env, _exceptionType, _exceptionMessage);
1602 }
Jack Palevich560814f2009-11-19 16:34:55 +08001603}
1604
1605/* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */
1606static void
1607android_glGenFramebuffers__ILjava_nio_IntBuffer_2
1608 (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001609 jint _exception = 0;
1610 const char * _exceptionType = NULL;
1611 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001612 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001613 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001614 jint _remaining;
1615 GLuint *framebuffers = (GLuint *) 0;
1616
Romain Guy84cac202016-12-05 12:26:02 -08001617 if (!framebuffers_buf) {
1618 _exception = 1;
1619 _exceptionType = "java/lang/IllegalArgumentException";
1620 _exceptionMessage = "framebuffers == null";
1621 goto exit;
1622 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001623 framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001624 if (_remaining < n) {
1625 _exception = 1;
1626 _exceptionType = "java/lang/IllegalArgumentException";
1627 _exceptionMessage = "remaining() < n < needed";
1628 goto exit;
1629 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001630 if (framebuffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001631 char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001632 framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset);
1633 }
Jack Palevich560814f2009-11-19 16:34:55 +08001634 glGenFramebuffers(
1635 (GLsizei)n,
1636 (GLuint *)framebuffers
1637 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001638
1639exit:
Jack Palevich560814f2009-11-19 16:34:55 +08001640 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001641 _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001642 }
1643 if (_exception) {
1644 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08001645 }
1646}
1647
1648/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */
1649static void
1650android_glGenRenderbuffers__I_3II
1651 (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) {
1652 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001653 const char * _exceptionType = NULL;
1654 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001655 GLuint *renderbuffers_base = (GLuint *) 0;
1656 jint _remaining;
1657 GLuint *renderbuffers = (GLuint *) 0;
1658
1659 if (!renderbuffers_ref) {
1660 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001661 _exceptionType = "java/lang/IllegalArgumentException";
1662 _exceptionMessage = "renderbuffers == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001663 goto exit;
1664 }
1665 if (offset < 0) {
1666 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001667 _exceptionType = "java/lang/IllegalArgumentException";
1668 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001669 goto exit;
1670 }
1671 _remaining = _env->GetArrayLength(renderbuffers_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001672 if (_remaining < n) {
1673 _exception = 1;
1674 _exceptionType = "java/lang/IllegalArgumentException";
1675 _exceptionMessage = "length - offset < n < needed";
1676 goto exit;
1677 }
Jack Palevich560814f2009-11-19 16:34:55 +08001678 renderbuffers_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001679 _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001680 renderbuffers = renderbuffers_base + offset;
1681
1682 glGenRenderbuffers(
1683 (GLsizei)n,
1684 (GLuint *)renderbuffers
1685 );
1686
1687exit:
1688 if (renderbuffers_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001689 _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001690 _exception ? JNI_ABORT: 0);
1691 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001692 if (_exception) {
1693 jniThrowException(_env, _exceptionType, _exceptionMessage);
1694 }
Jack Palevich560814f2009-11-19 16:34:55 +08001695}
1696
1697/* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */
1698static void
1699android_glGenRenderbuffers__ILjava_nio_IntBuffer_2
1700 (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08001701 jint _exception = 0;
1702 const char * _exceptionType = NULL;
1703 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001704 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001705 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001706 jint _remaining;
1707 GLuint *renderbuffers = (GLuint *) 0;
1708
Romain Guy84cac202016-12-05 12:26:02 -08001709 if (!renderbuffers_buf) {
1710 _exception = 1;
1711 _exceptionType = "java/lang/IllegalArgumentException";
1712 _exceptionMessage = "renderbuffers == null";
1713 goto exit;
1714 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001715 renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001716 if (_remaining < n) {
1717 _exception = 1;
1718 _exceptionType = "java/lang/IllegalArgumentException";
1719 _exceptionMessage = "remaining() < n < needed";
1720 goto exit;
1721 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001722 if (renderbuffers == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001723 char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001724 renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset);
1725 }
Jack Palevich560814f2009-11-19 16:34:55 +08001726 glGenRenderbuffers(
1727 (GLsizei)n,
1728 (GLuint *)renderbuffers
1729 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08001730
1731exit:
Jack Palevich560814f2009-11-19 16:34:55 +08001732 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001733 _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08001734 }
1735 if (_exception) {
1736 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08001737 }
1738}
1739
1740/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1741static void
1742android_glGenTextures__I_3II
1743 (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) {
1744 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001745 const char * _exceptionType = NULL;
1746 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08001747 GLuint *textures_base = (GLuint *) 0;
1748 jint _remaining;
1749 GLuint *textures = (GLuint *) 0;
1750
1751 if (!textures_ref) {
1752 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001753 _exceptionType = "java/lang/IllegalArgumentException";
1754 _exceptionMessage = "textures == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001755 goto exit;
1756 }
1757 if (offset < 0) {
1758 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001759 _exceptionType = "java/lang/IllegalArgumentException";
1760 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001761 goto exit;
1762 }
1763 _remaining = _env->GetArrayLength(textures_ref) - offset;
1764 if (_remaining < n) {
1765 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001766 _exceptionType = "java/lang/IllegalArgumentException";
1767 _exceptionMessage = "length - offset < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001768 goto exit;
1769 }
1770 textures_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001771 _env->GetIntArrayElements(textures_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001772 textures = textures_base + offset;
1773
1774 glGenTextures(
1775 (GLsizei)n,
1776 (GLuint *)textures
1777 );
1778
1779exit:
1780 if (textures_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001781 _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001782 _exception ? JNI_ABORT: 0);
1783 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001784 if (_exception) {
1785 jniThrowException(_env, _exceptionType, _exceptionMessage);
1786 }
Jack Palevich560814f2009-11-19 16:34:55 +08001787}
1788
1789/* void glGenTextures ( GLsizei n, GLuint *textures ) */
1790static void
1791android_glGenTextures__ILjava_nio_IntBuffer_2
1792 (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) {
1793 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08001794 const char * _exceptionType = NULL;
1795 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001796 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001797 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001798 jint _remaining;
1799 GLuint *textures = (GLuint *) 0;
1800
Romain Guy84cac202016-12-05 12:26:02 -08001801 if (!textures_buf) {
1802 _exception = 1;
1803 _exceptionType = "java/lang/IllegalArgumentException";
1804 _exceptionMessage = "textures == null";
1805 goto exit;
1806 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001807 textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08001808 if (_remaining < n) {
1809 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001810 _exceptionType = "java/lang/IllegalArgumentException";
1811 _exceptionMessage = "remaining() < n < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08001812 goto exit;
1813 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001814 if (textures == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001815 char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001816 textures = (GLuint *) (_texturesBase + _bufferOffset);
1817 }
Jack Palevich560814f2009-11-19 16:34:55 +08001818 glGenTextures(
1819 (GLsizei)n,
1820 (GLuint *)textures
1821 );
1822
1823exit:
1824 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001825 _env->ReleaseIntArrayElements(_array, (jint*)textures, _exception ? JNI_ABORT : 0);
Jack Palevich560814f2009-11-19 16:34:55 +08001826 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001827 if (_exception) {
1828 jniThrowException(_env, _exceptionType, _exceptionMessage);
1829 }
Jack Palevich560814f2009-11-19 16:34:55 +08001830}
1831
1832/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1833static void
1834android_glGetActiveAttrib__III_3II_3II_3II_3BI
1835 (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) {
1836 jint _exception = 0;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001837 const char * _exceptionType;
1838 const char * _exceptionMessage;
Jack Palevich560814f2009-11-19 16:34:55 +08001839 GLsizei *length_base = (GLsizei *) 0;
1840 jint _lengthRemaining;
1841 GLsizei *length = (GLsizei *) 0;
1842 GLint *size_base = (GLint *) 0;
1843 jint _sizeRemaining;
1844 GLint *size = (GLint *) 0;
1845 GLenum *type_base = (GLenum *) 0;
1846 jint _typeRemaining;
1847 GLenum *type = (GLenum *) 0;
1848 char *name_base = (char *) 0;
1849 jint _nameRemaining;
1850 char *name = (char *) 0;
1851
Pablo Ceballos6aff9062015-10-01 18:35:39 -07001852 if (length_ref) {
1853 if (lengthOffset < 0) {
1854 _exception = 1;
1855 _exceptionType = "java/lang/IllegalArgumentException";
1856 _exceptionMessage = "lengthOffset < 0";
1857 goto exit;
1858 }
1859 _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
1860 length_base = (GLsizei *)
1861 _env->GetIntArrayElements(length_ref, (jboolean *)0);
1862 length = length_base + lengthOffset;
Jack Palevich560814f2009-11-19 16:34:55 +08001863 }
Jack Palevich560814f2009-11-19 16:34:55 +08001864
1865 if (!size_ref) {
1866 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001867 _exceptionType = "java/lang/IllegalArgumentException";
1868 _exceptionMessage = "size == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001869 goto exit;
1870 }
1871 if (sizeOffset < 0) {
1872 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001873 _exceptionType = "java/lang/IllegalArgumentException";
1874 _exceptionMessage = "sizeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001875 goto exit;
1876 }
1877 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
1878 size_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001879 _env->GetIntArrayElements(size_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001880 size = size_base + sizeOffset;
1881
1882 if (!type_ref) {
1883 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001884 _exceptionType = "java/lang/IllegalArgumentException";
1885 _exceptionMessage = "type == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001886 goto exit;
1887 }
1888 if (typeOffset < 0) {
1889 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001890 _exceptionType = "java/lang/IllegalArgumentException";
1891 _exceptionMessage = "typeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001892 goto exit;
1893 }
1894 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
1895 type_base = (GLenum *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001896 _env->GetIntArrayElements(type_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001897 type = type_base + typeOffset;
1898
1899 if (!name_ref) {
1900 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001901 _exceptionType = "java/lang/IllegalArgumentException";
1902 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +08001903 goto exit;
1904 }
1905 if (nameOffset < 0) {
1906 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001907 _exceptionType = "java/lang/IllegalArgumentException";
1908 _exceptionMessage = "nameOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08001909 goto exit;
1910 }
1911 _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
1912 name_base = (char *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001913 _env->GetByteArrayElements(name_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08001914 name = name_base + nameOffset;
1915
1916 glGetActiveAttrib(
1917 (GLuint)program,
1918 (GLuint)index,
1919 (GLsizei)bufsize,
1920 (GLsizei *)length,
1921 (GLint *)size,
1922 (GLenum *)type,
1923 (char *)name
1924 );
1925
1926exit:
1927 if (name_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001928 _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001929 _exception ? JNI_ABORT: 0);
1930 }
1931 if (type_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001932 _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001933 _exception ? JNI_ABORT: 0);
1934 }
1935 if (size_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001936 _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001937 _exception ? JNI_ABORT: 0);
1938 }
1939 if (length_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001940 _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
Jack Palevich560814f2009-11-19 16:34:55 +08001941 _exception ? JNI_ABORT: 0);
1942 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07001943 if (_exception) {
1944 jniThrowException(_env, _exceptionType, _exceptionMessage);
1945 }
Jack Palevich560814f2009-11-19 16:34:55 +08001946}
1947
1948/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
1949static void
1950android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
1951 (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 -07001952 jintArray _lengthArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001953 jint _lengthBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001954 jintArray _sizeArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001955 jint _sizeBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001956 jintArray _typeArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001957 jint _typeBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08001958 jint _lengthRemaining;
1959 GLsizei *length = (GLsizei *) 0;
1960 jint _sizeRemaining;
1961 GLint *size = (GLint *) 0;
1962 jint _typeRemaining;
1963 GLenum *type = (GLenum *) 0;
1964
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001965 length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
1966 size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
1967 type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001968 if (length == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001969 char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001970 length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
1971 }
1972 if (size == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001973 char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001974 size = (GLint *) (_sizeBase + _sizeBufferOffset);
1975 }
1976 if (type == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001977 char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001978 type = (GLenum *) (_typeBase + _typeBufferOffset);
1979 }
Jack Palevich560814f2009-11-19 16:34:55 +08001980 glGetActiveAttrib(
1981 (GLuint)program,
1982 (GLuint)index,
1983 (GLsizei)bufsize,
1984 (GLsizei *)length,
1985 (GLint *)size,
1986 (GLenum *)type,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00001987 reinterpret_cast<char *>(name)
Jack Palevich560814f2009-11-19 16:34:55 +08001988 );
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001989 if (_typeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001990 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08001991 }
1992 if (_sizeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001993 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08001994 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07001995 if (_lengthArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07001996 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08001997 }
1998}
1999
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002000/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2001static jstring
2002android_glGetActiveAttrib1
2003 (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
2004 jint _exception = 0;
2005 const char * _exceptionType;
2006 const char * _exceptionMessage;
2007 GLint *size_base = (GLint *) 0;
2008 jint _sizeRemaining;
2009 GLint *size = (GLint *) 0;
2010 GLenum *type_base = (GLenum *) 0;
2011 jint _typeRemaining;
2012 GLenum *type = (GLenum *) 0;
2013
2014 jstring result = 0;
2015
2016 GLint len = 0;
2017 glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
2018 if (!len) {
2019 return _env->NewStringUTF("");
2020 }
2021 char* buf = (char*) malloc(len);
2022
2023 if (buf == NULL) {
2024 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2025 return NULL;
2026 }
2027 if (!size_ref) {
2028 _exception = 1;
2029 _exceptionType = "java/lang/IllegalArgumentException";
2030 _exceptionMessage = "size == null";
2031 goto exit;
2032 }
2033 if (sizeOffset < 0) {
2034 _exception = 1;
2035 _exceptionType = "java/lang/IllegalArgumentException";
2036 _exceptionMessage = "sizeOffset < 0";
2037 goto exit;
2038 }
2039 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2040 size_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002041 _env->GetIntArrayElements(size_ref, (jboolean *)0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002042 size = size_base + sizeOffset;
2043
2044 if (!type_ref) {
2045 _exception = 1;
2046 _exceptionType = "java/lang/IllegalArgumentException";
2047 _exceptionMessage = "type == null";
2048 goto exit;
2049 }
2050 if (typeOffset < 0) {
2051 _exception = 1;
2052 _exceptionType = "java/lang/IllegalArgumentException";
2053 _exceptionMessage = "typeOffset < 0";
2054 goto exit;
2055 }
2056 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2057 type_base = (GLenum *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002058 _env->GetIntArrayElements(type_ref, (jboolean *)0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002059 type = type_base + typeOffset;
2060
2061 glGetActiveAttrib(
2062 (GLuint)program,
2063 (GLuint)index,
2064 (GLsizei)len,
2065 NULL,
2066 (GLint *)size,
2067 (GLenum *)type,
2068 (char *)buf
2069 );
2070exit:
2071 if (type_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002072 _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002073 _exception ? JNI_ABORT: 0);
2074 }
2075 if (size_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002076 _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002077 _exception ? JNI_ABORT: 0);
2078 }
2079 if (_exception != 1) {
2080 result = _env->NewStringUTF(buf);
2081 }
2082 if (buf) {
2083 free(buf);
2084 }
2085 if (_exception) {
2086 jniThrowException(_env, _exceptionType, _exceptionMessage);
2087 }
2088 if (result == 0) {
2089 result = _env->NewStringUTF("");
2090 }
2091
2092 return result;
2093}
2094
2095/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2096static jstring
2097android_glGetActiveAttrib2
2098 (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002099 jintArray _sizeArray = (jintArray) 0;
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002100 jint _sizeBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002101 jintArray _typeArray = (jintArray) 0;
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002102 jint _typeBufferOffset = (jint) 0;
2103 jint _lengthRemaining;
2104 GLsizei *length = (GLsizei *) 0;
2105 jint _sizeRemaining;
2106 GLint *size = (GLint *) 0;
2107 jint _typeRemaining;
2108 GLenum *type = (GLenum *) 0;
2109
2110 jstring result = 0;
2111
2112 GLint len = 0;
2113 glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
2114 if (!len) {
2115 return _env->NewStringUTF("");
2116 }
2117 char* buf = (char*) malloc(len);
2118
2119 if (buf == NULL) {
2120 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2121 return NULL;
2122 }
2123
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002124 size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
2125 type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002126 if (size == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002127 char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002128 size = (GLint *) (_sizeBase + _sizeBufferOffset);
2129 }
2130 if (type == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002131 char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002132 type = (GLenum *) (_typeBase + _typeBufferOffset);
2133 }
2134 glGetActiveAttrib(
2135 (GLuint)program,
2136 (GLuint)index,
2137 (GLsizei)len,
2138 NULL,
2139 (GLint *)size,
2140 (GLenum *)type,
2141 (char *)buf
2142 );
2143
2144 if (_typeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002145 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002146 }
2147 if (_sizeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002148 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002149 }
2150 result = _env->NewStringUTF(buf);
2151 if (buf) {
2152 free(buf);
2153 }
2154 return result;
2155}
Jack Palevich560814f2009-11-19 16:34:55 +08002156/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2157static void
2158android_glGetActiveUniform__III_3II_3II_3II_3BI
2159 (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) {
2160 jint _exception = 0;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002161 const char * _exceptionType;
2162 const char * _exceptionMessage;
Jack Palevich560814f2009-11-19 16:34:55 +08002163 GLsizei *length_base = (GLsizei *) 0;
2164 jint _lengthRemaining;
2165 GLsizei *length = (GLsizei *) 0;
2166 GLint *size_base = (GLint *) 0;
2167 jint _sizeRemaining;
2168 GLint *size = (GLint *) 0;
2169 GLenum *type_base = (GLenum *) 0;
2170 jint _typeRemaining;
2171 GLenum *type = (GLenum *) 0;
2172 char *name_base = (char *) 0;
2173 jint _nameRemaining;
2174 char *name = (char *) 0;
2175
Pablo Ceballos6aff9062015-10-01 18:35:39 -07002176 if (length_ref) {
2177 if (lengthOffset < 0) {
2178 _exception = 1;
2179 _exceptionType = "java/lang/IllegalArgumentException";
2180 _exceptionMessage = "lengthOffset < 0";
2181 goto exit;
2182 }
2183 _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
2184 length_base = (GLsizei *)
2185 _env->GetIntArrayElements(length_ref, (jboolean *)0);
2186 length = length_base + lengthOffset;
Jack Palevich560814f2009-11-19 16:34:55 +08002187 }
Jack Palevich560814f2009-11-19 16:34:55 +08002188
2189 if (!size_ref) {
2190 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002191 _exceptionType = "java/lang/IllegalArgumentException";
2192 _exceptionMessage = "size == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002193 goto exit;
2194 }
2195 if (sizeOffset < 0) {
2196 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002197 _exceptionType = "java/lang/IllegalArgumentException";
2198 _exceptionMessage = "sizeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002199 goto exit;
2200 }
2201 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2202 size_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002203 _env->GetIntArrayElements(size_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08002204 size = size_base + sizeOffset;
2205
2206 if (!type_ref) {
2207 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002208 _exceptionType = "java/lang/IllegalArgumentException";
2209 _exceptionMessage = "type == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002210 goto exit;
2211 }
2212 if (typeOffset < 0) {
2213 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002214 _exceptionType = "java/lang/IllegalArgumentException";
2215 _exceptionMessage = "typeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002216 goto exit;
2217 }
2218 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2219 type_base = (GLenum *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002220 _env->GetIntArrayElements(type_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08002221 type = type_base + typeOffset;
2222
2223 if (!name_ref) {
2224 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002225 _exceptionType = "java/lang/IllegalArgumentException";
2226 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002227 goto exit;
2228 }
2229 if (nameOffset < 0) {
2230 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002231 _exceptionType = "java/lang/IllegalArgumentException";
2232 _exceptionMessage = "nameOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002233 goto exit;
2234 }
2235 _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
2236 name_base = (char *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002237 _env->GetByteArrayElements(name_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08002238 name = name_base + nameOffset;
2239
2240 glGetActiveUniform(
2241 (GLuint)program,
2242 (GLuint)index,
2243 (GLsizei)bufsize,
2244 (GLsizei *)length,
2245 (GLint *)size,
2246 (GLenum *)type,
2247 (char *)name
2248 );
2249
2250exit:
2251 if (name_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002252 _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002253 _exception ? JNI_ABORT: 0);
2254 }
2255 if (type_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002256 _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002257 _exception ? JNI_ABORT: 0);
2258 }
2259 if (size_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002260 _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002261 _exception ? JNI_ABORT: 0);
2262 }
2263 if (length_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002264 _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002265 _exception ? JNI_ABORT: 0);
2266 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002267 if (_exception) {
2268 jniThrowException(_env, _exceptionType, _exceptionMessage);
2269 }
Jack Palevich560814f2009-11-19 16:34:55 +08002270}
2271
2272/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2273static void
2274android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
2275 (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 -07002276 jintArray _lengthArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002277 jint _lengthBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002278 jintArray _sizeArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002279 jint _sizeBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002280 jintArray _typeArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002281 jint _typeBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002282 jint _lengthRemaining;
2283 GLsizei *length = (GLsizei *) 0;
2284 jint _sizeRemaining;
2285 GLint *size = (GLint *) 0;
2286 jint _typeRemaining;
2287 GLenum *type = (GLenum *) 0;
2288
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002289 length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
2290 size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
2291 type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002292 if (length == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002293 char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002294 length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
2295 }
2296 if (size == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002297 char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002298 size = (GLint *) (_sizeBase + _sizeBufferOffset);
2299 }
2300 if (type == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002301 char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002302 type = (GLenum *) (_typeBase + _typeBufferOffset);
2303 }
Jack Palevich560814f2009-11-19 16:34:55 +08002304 glGetActiveUniform(
2305 (GLuint)program,
2306 (GLuint)index,
2307 (GLsizei)bufsize,
2308 (GLsizei *)length,
2309 (GLint *)size,
2310 (GLenum *)type,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00002311 reinterpret_cast<char *>(name)
Jack Palevich560814f2009-11-19 16:34:55 +08002312 );
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002313 if (_typeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002314 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08002315 }
2316 if (_sizeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002317 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08002318 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002319 if (_lengthArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002320 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08002321 }
2322}
2323
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002324/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2325static jstring
2326android_glGetActiveUniform1
2327 (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
2328 jint _exception = 0;
2329 const char * _exceptionType;
2330 const char * _exceptionMessage;
2331
2332 GLint *size_base = (GLint *) 0;
2333 jint _sizeRemaining;
2334 GLint *size = (GLint *) 0;
2335
2336 GLenum *type_base = (GLenum *) 0;
2337 jint _typeRemaining;
2338 GLenum *type = (GLenum *) 0;
2339
2340 jstring result = 0;
2341
2342 GLint len = 0;
2343 glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
2344 if (!len) {
2345 return _env->NewStringUTF("");
2346 }
2347 char* buf = (char*) malloc(len);
2348
2349 if (buf == NULL) {
2350 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2351 return NULL;
2352 }
2353
2354 if (!size_ref) {
2355 _exception = 1;
2356 _exceptionType = "java/lang/IllegalArgumentException";
2357 _exceptionMessage = "size == null";
2358 goto exit;
2359 }
2360 if (sizeOffset < 0) {
2361 _exception = 1;
2362 _exceptionType = "java/lang/IllegalArgumentException";
2363 _exceptionMessage = "sizeOffset < 0";
2364 goto exit;
2365 }
2366 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
2367 size_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002368 _env->GetIntArrayElements(size_ref, (jboolean *)0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002369 size = size_base + sizeOffset;
2370
2371 if (!type_ref) {
2372 _exception = 1;
2373 _exceptionType = "java/lang/IllegalArgumentException";
2374 _exceptionMessage = "type == null";
2375 goto exit;
2376 }
2377 if (typeOffset < 0) {
2378 _exception = 1;
2379 _exceptionType = "java/lang/IllegalArgumentException";
2380 _exceptionMessage = "typeOffset < 0";
2381 goto exit;
2382 }
2383 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
2384 type_base = (GLenum *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002385 _env->GetIntArrayElements(type_ref, (jboolean *)0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002386 type = type_base + typeOffset;
2387
2388 glGetActiveUniform(
2389 (GLuint)program,
2390 (GLuint)index,
2391 (GLsizei)len,
2392 NULL,
2393 (GLint *)size,
2394 (GLenum *)type,
2395 (char *)buf
2396 );
2397
2398exit:
2399 if (type_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002400 _env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002401 _exception ? JNI_ABORT: 0);
2402 }
2403 if (size_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002404 _env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002405 _exception ? JNI_ABORT: 0);
2406 }
2407 if (_exception != 1) {
2408 result = _env->NewStringUTF(buf);
2409 }
2410 if (buf) {
2411 free(buf);
2412 }
2413 if (_exception) {
2414 jniThrowException(_env, _exceptionType, _exceptionMessage);
2415 }
2416 if (result == 0) {
2417 result = _env->NewStringUTF("");
2418 }
2419 return result;
2420}
2421
2422/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
2423static jstring
2424android_glGetActiveUniform2
2425 (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002426 jintArray _sizeArray = (jintArray) 0;
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002427 jint _sizeBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002428 jintArray _typeArray = (jintArray) 0;
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002429 jint _typeBufferOffset = (jint) 0;
2430 jint _sizeRemaining;
2431 GLint *size = (GLint *) 0;
2432 jint _typeRemaining;
2433 GLenum *type = (GLenum *) 0;
2434
2435 jstring result = 0;
2436 GLint len = 0;
2437 glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len);
2438 if (!len) {
2439 return _env->NewStringUTF("");
2440 }
2441 char* buf = (char*) malloc(len);
2442
2443 if (buf == NULL) {
2444 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2445 return NULL;
2446 }
2447
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002448 size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
2449 type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002450
2451 if (size == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002452 char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002453 size = (GLint *) (_sizeBase + _sizeBufferOffset);
2454 }
2455 if (type == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002456 char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002457 type = (GLenum *) (_typeBase + _typeBufferOffset);
2458 }
2459 glGetActiveUniform(
2460 (GLuint)program,
2461 (GLuint)index,
2462 len,
2463 NULL,
2464 (GLint *)size,
2465 (GLenum *)type,
2466 (char *)buf
2467 );
2468
2469 if (_typeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002470 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002471 }
2472 if (_sizeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002473 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07002474 }
2475 result = _env->NewStringUTF(buf);
2476 if (buf) {
2477 free(buf);
2478 }
2479 return result;
2480}
Jack Palevich560814f2009-11-19 16:34:55 +08002481/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */
2482static void
2483android_glGetAttachedShaders__II_3II_3II
2484 (JNIEnv *_env, jobject _this, jint program, jint maxcount, jintArray count_ref, jint countOffset, jintArray shaders_ref, jint shadersOffset) {
2485 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002486 const char * _exceptionType = NULL;
2487 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002488 GLsizei *count_base = (GLsizei *) 0;
2489 jint _countRemaining;
2490 GLsizei *count = (GLsizei *) 0;
2491 GLuint *shaders_base = (GLuint *) 0;
2492 jint _shadersRemaining;
2493 GLuint *shaders = (GLuint *) 0;
2494
Pablo Ceballos6aff9062015-10-01 18:35:39 -07002495 if (count_ref) {
2496 if (countOffset < 0) {
2497 _exception = 1;
2498 _exceptionType = "java/lang/IllegalArgumentException";
2499 _exceptionMessage = "countOffset < 0";
2500 goto exit;
2501 }
2502 _countRemaining = _env->GetArrayLength(count_ref) - countOffset;
2503 if (_countRemaining < 1) {
2504 _exception = 1;
2505 _exceptionType = "java/lang/IllegalArgumentException";
2506 _exceptionMessage = "length - countOffset < 1 < needed";
2507 goto exit;
2508 }
2509 count_base = (GLsizei *)
2510 _env->GetIntArrayElements(count_ref, (jboolean *)0);
2511 count = count_base + countOffset;
Jack Palevich560814f2009-11-19 16:34:55 +08002512 }
Jack Palevich560814f2009-11-19 16:34:55 +08002513
2514 if (!shaders_ref) {
2515 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002516 _exceptionType = "java/lang/IllegalArgumentException";
2517 _exceptionMessage = "shaders == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002518 goto exit;
2519 }
2520 if (shadersOffset < 0) {
2521 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002522 _exceptionType = "java/lang/IllegalArgumentException";
2523 _exceptionMessage = "shadersOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002524 goto exit;
2525 }
2526 _shadersRemaining = _env->GetArrayLength(shaders_ref) - shadersOffset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002527 if (_shadersRemaining < maxcount) {
2528 _exception = 1;
2529 _exceptionType = "java/lang/IllegalArgumentException";
2530 _exceptionMessage = "length - shadersOffset < maxcount < needed";
2531 goto exit;
2532 }
Jack Palevich560814f2009-11-19 16:34:55 +08002533 shaders_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002534 _env->GetIntArrayElements(shaders_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08002535 shaders = shaders_base + shadersOffset;
2536
2537 glGetAttachedShaders(
2538 (GLuint)program,
2539 (GLsizei)maxcount,
2540 (GLsizei *)count,
2541 (GLuint *)shaders
2542 );
2543
2544exit:
2545 if (shaders_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002546 _env->ReleaseIntArrayElements(shaders_ref, (jint*)shaders_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002547 _exception ? JNI_ABORT: 0);
2548 }
2549 if (count_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002550 _env->ReleaseIntArrayElements(count_ref, (jint*)count_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002551 _exception ? JNI_ABORT: 0);
2552 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002553 if (_exception) {
2554 jniThrowException(_env, _exceptionType, _exceptionMessage);
2555 }
Jack Palevich560814f2009-11-19 16:34:55 +08002556}
2557
2558/* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */
2559static void
2560android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
2561 (JNIEnv *_env, jobject _this, jint program, jint maxcount, jobject count_buf, jobject shaders_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002562 jint _exception = 0;
2563 const char * _exceptionType = NULL;
2564 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002565 jintArray _countArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002566 jint _countBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002567 jintArray _shadersArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002568 jint _shadersBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002569 jint _countRemaining;
2570 GLsizei *count = (GLsizei *) 0;
2571 jint _shadersRemaining;
2572 GLuint *shaders = (GLuint *) 0;
2573
Mathias Agopian2ad04772013-02-23 03:12:30 -08002574 if (count_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002575 count = (GLsizei *)getPointer(_env, count_buf, (jarray*)&_countArray, &_countRemaining, &_countBufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08002576 if (_countRemaining < 1) {
2577 _exception = 1;
2578 _exceptionType = "java/lang/IllegalArgumentException";
2579 _exceptionMessage = "remaining() < 1 < needed";
2580 goto exit;
2581 }
2582 }
Romain Guy84cac202016-12-05 12:26:02 -08002583 if (!shaders_buf) {
2584 _exception = 1;
2585 _exceptionType = "java/lang/IllegalArgumentException";
2586 _exceptionMessage = "shaders == null";
2587 goto exit;
2588 }
Pablo Ceballos6aff9062015-10-01 18:35:39 -07002589 shaders = (GLuint *)getPointer(_env, shaders_buf, (jarray*)&_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
2590 if (_shadersRemaining < maxcount) {
2591 _exception = 1;
2592 _exceptionType = "java/lang/IllegalArgumentException";
2593 _exceptionMessage = "remaining() < maxcount < needed";
2594 goto exit;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002595 }
2596 if (count_buf && count == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002597 char * _countBase = (char *)_env->GetIntArrayElements(_countArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002598 count = (GLsizei *) (_countBase + _countBufferOffset);
2599 }
Pablo Ceballos6aff9062015-10-01 18:35:39 -07002600 if (shaders == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002601 char * _shadersBase = (char *)_env->GetIntArrayElements(_shadersArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002602 shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
2603 }
Jack Palevich560814f2009-11-19 16:34:55 +08002604 glGetAttachedShaders(
2605 (GLuint)program,
2606 (GLsizei)maxcount,
2607 (GLsizei *)count,
2608 (GLuint *)shaders
2609 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08002610
2611exit:
Jack Palevich560814f2009-11-19 16:34:55 +08002612 if (_shadersArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002613 _env->ReleaseIntArrayElements(_shadersArray, (jint*)shaders, _exception ? JNI_ABORT : 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002614 }
2615 if (_countArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002616 _env->ReleaseIntArrayElements(_countArray, (jint*)count, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08002617 }
2618 if (_exception) {
2619 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08002620 }
2621}
2622
Mathias Agopian89be00b2013-02-22 20:08:06 -08002623/* GLint glGetAttribLocation ( GLuint program, const char *name ) */
Jack Palevich560814f2009-11-19 16:34:55 +08002624static jint
2625android_glGetAttribLocation__ILjava_lang_String_2
2626 (JNIEnv *_env, jobject _this, jint program, jstring name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002627 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002628 const char * _exceptionType = NULL;
2629 const char * _exceptionMessage = NULL;
Mathias Agopian89be00b2013-02-22 20:08:06 -08002630 GLint _returnValue = 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002631 const char* _nativename = 0;
2632
2633 if (!name) {
Elliott Hughes428d3fc2013-09-24 17:15:41 -07002634 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002635 _exceptionType = "java/lang/IllegalArgumentException";
2636 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002637 goto exit;
2638 }
2639 _nativename = _env->GetStringUTFChars(name, 0);
2640
2641 _returnValue = glGetAttribLocation(
2642 (GLuint)program,
2643 (char *)_nativename
2644 );
2645
2646exit:
2647 if (_nativename) {
2648 _env->ReleaseStringUTFChars(name, _nativename);
2649 }
2650
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002651 if (_exception) {
2652 jniThrowException(_env, _exceptionType, _exceptionMessage);
Orion Hodsonc240f222019-02-26 18:05:03 +00002653 return (jint)0;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002654 }
Andy McFaddencee51982013-04-25 16:08:31 -07002655 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08002656}
2657
2658/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
2659static void
2660android_glGetBooleanv__I_3ZI
2661 (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002662 get<jbooleanArray, BooleanArrayGetter, jboolean*, BooleanArrayReleaser, GLboolean, glGetBooleanv>(
2663 _env, _this, pname, params_ref, offset);
Jack Palevich560814f2009-11-19 16:34:55 +08002664}
2665
2666/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
2667static void
2668android_glGetBooleanv__ILjava_nio_IntBuffer_2
2669 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002670 getarray<GLboolean, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetBooleanv>(
2671 _env, _this, pname, params_buf);
Jack Palevich560814f2009-11-19 16:34:55 +08002672}
Jack Palevich560814f2009-11-19 16:34:55 +08002673/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2674static void
2675android_glGetBufferParameteriv__II_3II
2676 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Jack Palevich73108672011-03-28 14:49:12 -07002677 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002678 const char * _exceptionType = NULL;
2679 const char * _exceptionMessage = NULL;
Jack Palevich73108672011-03-28 14:49:12 -07002680 GLint *params_base = (GLint *) 0;
2681 jint _remaining;
2682 GLint *params = (GLint *) 0;
2683
2684 if (!params_ref) {
2685 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002686 _exceptionType = "java/lang/IllegalArgumentException";
2687 _exceptionMessage = "params == null";
Jack Palevich73108672011-03-28 14:49:12 -07002688 goto exit;
2689 }
2690 if (offset < 0) {
2691 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002692 _exceptionType = "java/lang/IllegalArgumentException";
2693 _exceptionMessage = "offset < 0";
Jack Palevich73108672011-03-28 14:49:12 -07002694 goto exit;
2695 }
2696 _remaining = _env->GetArrayLength(params_ref) - offset;
2697 if (_remaining < 1) {
2698 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002699 _exceptionType = "java/lang/IllegalArgumentException";
2700 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich73108672011-03-28 14:49:12 -07002701 goto exit;
2702 }
2703 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002704 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich73108672011-03-28 14:49:12 -07002705 params = params_base + offset;
2706
2707 glGetBufferParameteriv(
2708 (GLenum)target,
2709 (GLenum)pname,
2710 (GLint *)params
2711 );
2712
2713exit:
2714 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002715 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich73108672011-03-28 14:49:12 -07002716 _exception ? JNI_ABORT: 0);
2717 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002718 if (_exception) {
2719 jniThrowException(_env, _exceptionType, _exceptionMessage);
2720 }
Jack Palevich560814f2009-11-19 16:34:55 +08002721}
2722
2723/* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
2724static void
2725android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2
2726 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Jack Palevich73108672011-03-28 14:49:12 -07002727 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002728 const char * _exceptionType = NULL;
2729 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002730 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002731 jint _bufferOffset = (jint) 0;
Jack Palevich73108672011-03-28 14:49:12 -07002732 jint _remaining;
2733 GLint *params = (GLint *) 0;
2734
Romain Guy84cac202016-12-05 12:26:02 -08002735 if (!params_buf) {
2736 _exception = 1;
2737 _exceptionType = "java/lang/IllegalArgumentException";
2738 _exceptionMessage = "params == null";
2739 goto exit;
2740 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002741 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich73108672011-03-28 14:49:12 -07002742 if (_remaining < 1) {
2743 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002744 _exceptionType = "java/lang/IllegalArgumentException";
2745 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich73108672011-03-28 14:49:12 -07002746 goto exit;
2747 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002748 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002749 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002750 params = (GLint *) (_paramsBase + _bufferOffset);
2751 }
Jack Palevich73108672011-03-28 14:49:12 -07002752 glGetBufferParameteriv(
2753 (GLenum)target,
2754 (GLenum)pname,
2755 (GLint *)params
2756 );
2757
2758exit:
2759 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002760 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich73108672011-03-28 14:49:12 -07002761 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002762 if (_exception) {
2763 jniThrowException(_env, _exceptionType, _exceptionMessage);
2764 }
Jack Palevich560814f2009-11-19 16:34:55 +08002765}
2766
2767/* GLenum glGetError ( void ) */
2768static jint
2769android_glGetError__
2770 (JNIEnv *_env, jobject _this) {
2771 GLenum _returnValue;
2772 _returnValue = glGetError();
Andy McFaddencee51982013-04-25 16:08:31 -07002773 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08002774}
2775
2776/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
2777static void
2778android_glGetFloatv__I_3FI
2779 (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002780 get<jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, GLfloat, glGetFloatv>(
2781 _env, _this, pname, params_ref, offset);
Jack Palevich560814f2009-11-19 16:34:55 +08002782}
2783
2784/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
2785static void
2786android_glGetFloatv__ILjava_nio_FloatBuffer_2
2787 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002788 getarray<GLfloat, jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, glGetFloatv>(
2789 _env, _this, pname, params_buf);
Jack Palevich560814f2009-11-19 16:34:55 +08002790}
Jack Palevich560814f2009-11-19 16:34:55 +08002791/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
2792static void
2793android_glGetFramebufferAttachmentParameteriv__III_3II
2794 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) {
2795 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002796 const char * _exceptionType = NULL;
2797 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002798 GLint *params_base = (GLint *) 0;
2799 jint _remaining;
2800 GLint *params = (GLint *) 0;
2801
2802 if (!params_ref) {
2803 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002804 _exceptionType = "java/lang/IllegalArgumentException";
2805 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002806 goto exit;
2807 }
2808 if (offset < 0) {
2809 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002810 _exceptionType = "java/lang/IllegalArgumentException";
2811 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002812 goto exit;
2813 }
2814 _remaining = _env->GetArrayLength(params_ref) - offset;
2815 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002816 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08002817 params = params_base + offset;
2818
2819 glGetFramebufferAttachmentParameteriv(
2820 (GLenum)target,
2821 (GLenum)attachment,
2822 (GLenum)pname,
2823 (GLint *)params
2824 );
2825
2826exit:
2827 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002828 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002829 _exception ? JNI_ABORT: 0);
2830 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002831 if (_exception) {
2832 jniThrowException(_env, _exceptionType, _exceptionMessage);
2833 }
Jack Palevich560814f2009-11-19 16:34:55 +08002834}
2835
2836/* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */
2837static void
2838android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2
2839 (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) {
Romain Guy84cac202016-12-05 12:26:02 -08002840 jint _exception = 0;
2841 const char * _exceptionType = NULL;
2842 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002843 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002844 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002845 jint _remaining;
2846 GLint *params = (GLint *) 0;
2847
Romain Guy84cac202016-12-05 12:26:02 -08002848 if (!params_buf) {
2849 _exception = 1;
2850 _exceptionType = "java/lang/IllegalArgumentException";
2851 _exceptionMessage = "params == null";
2852 goto exit;
2853 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002854 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002855 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002856 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002857 params = (GLint *) (_paramsBase + _bufferOffset);
2858 }
Jack Palevich560814f2009-11-19 16:34:55 +08002859 glGetFramebufferAttachmentParameteriv(
2860 (GLenum)target,
2861 (GLenum)attachment,
2862 (GLenum)pname,
2863 (GLint *)params
2864 );
Romain Guy84cac202016-12-05 12:26:02 -08002865
2866exit:
Jack Palevich560814f2009-11-19 16:34:55 +08002867 if (_array) {
Romain Guy84cac202016-12-05 12:26:02 -08002868 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
2869 }
2870 if (_exception) {
2871 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08002872 }
2873}
2874
2875/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2876static void
2877android_glGetIntegerv__I_3II
2878 (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002879 get<jintArray, IntArrayGetter, jint*, IntArrayReleaser, GLint, glGetIntegerv>(
2880 _env, _this, pname, params_ref, offset);
Jack Palevich560814f2009-11-19 16:34:55 +08002881}
2882
2883/* void glGetIntegerv ( GLenum pname, GLint *params ) */
2884static void
2885android_glGetIntegerv__ILjava_nio_IntBuffer_2
2886 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002887 getarray<GLint, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetIntegerv>(
2888 _env, _this, pname, params_buf);
Jack Palevich560814f2009-11-19 16:34:55 +08002889}
Jack Palevich560814f2009-11-19 16:34:55 +08002890/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2891static void
2892android_glGetProgramiv__II_3II
2893 (JNIEnv *_env, jobject _this, jint program, jint pname, jintArray params_ref, jint offset) {
2894 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002895 const char * _exceptionType = NULL;
2896 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002897 GLint *params_base = (GLint *) 0;
2898 jint _remaining;
2899 GLint *params = (GLint *) 0;
2900
2901 if (!params_ref) {
2902 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002903 _exceptionType = "java/lang/IllegalArgumentException";
2904 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08002905 goto exit;
2906 }
2907 if (offset < 0) {
2908 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002909 _exceptionType = "java/lang/IllegalArgumentException";
2910 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08002911 goto exit;
2912 }
2913 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08002914 if (_remaining < 1) {
2915 _exception = 1;
2916 _exceptionType = "java/lang/IllegalArgumentException";
2917 _exceptionMessage = "length - offset < 1 < needed";
2918 goto exit;
2919 }
Jack Palevich560814f2009-11-19 16:34:55 +08002920 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002921 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08002922 params = params_base + offset;
2923
2924 glGetProgramiv(
2925 (GLuint)program,
2926 (GLenum)pname,
2927 (GLint *)params
2928 );
2929
2930exit:
2931 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002932 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08002933 _exception ? JNI_ABORT: 0);
2934 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07002935 if (_exception) {
2936 jniThrowException(_env, _exceptionType, _exceptionMessage);
2937 }
Jack Palevich560814f2009-11-19 16:34:55 +08002938}
2939
2940/* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */
2941static void
2942android_glGetProgramiv__IILjava_nio_IntBuffer_2
2943 (JNIEnv *_env, jobject _this, jint program, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08002944 jint _exception = 0;
2945 const char * _exceptionType = NULL;
2946 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002947 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002948 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002949 jint _remaining;
2950 GLint *params = (GLint *) 0;
2951
Romain Guy84cac202016-12-05 12:26:02 -08002952 if (!params_buf) {
2953 _exception = 1;
2954 _exceptionType = "java/lang/IllegalArgumentException";
2955 _exceptionMessage = "params == null";
2956 goto exit;
2957 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002958 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08002959 if (_remaining < 1) {
2960 _exception = 1;
2961 _exceptionType = "java/lang/IllegalArgumentException";
2962 _exceptionMessage = "remaining() < 1 < needed";
2963 goto exit;
2964 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002965 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002966 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07002967 params = (GLint *) (_paramsBase + _bufferOffset);
2968 }
Jack Palevich560814f2009-11-19 16:34:55 +08002969 glGetProgramiv(
2970 (GLuint)program,
2971 (GLenum)pname,
2972 (GLint *)params
2973 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08002974
2975exit:
Jack Palevich560814f2009-11-19 16:34:55 +08002976 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07002977 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08002978 }
2979 if (_exception) {
2980 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08002981 }
2982}
2983
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002984#include <stdlib.h>
Jack Palevich560814f2009-11-19 16:34:55 +08002985
2986/* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002987static jstring android_glGetProgramInfoLog(JNIEnv *_env, jobject, jint shader) {
Jack Palevich560814f2009-11-19 16:34:55 +08002988 GLint infoLen = 0;
Jack Palevich560814f2009-11-19 16:34:55 +08002989 glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002990 if (!infoLen) {
2991 return _env->NewStringUTF("");
Jack Palevich560814f2009-11-19 16:34:55 +08002992 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002993 char* buf = (char*) malloc(infoLen);
2994 if (buf == NULL) {
2995 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
2996 return NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08002997 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07002998 glGetProgramInfoLog(shader, infoLen, NULL, buf);
2999 jstring result = _env->NewStringUTF(buf);
3000 free(buf);
3001 return result;
Jack Palevich560814f2009-11-19 16:34:55 +08003002}
3003/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3004static void
3005android_glGetRenderbufferParameteriv__II_3II
3006 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
3007 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003008 const char * _exceptionType = NULL;
3009 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003010 GLint *params_base = (GLint *) 0;
3011 jint _remaining;
3012 GLint *params = (GLint *) 0;
3013
3014 if (!params_ref) {
3015 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003016 _exceptionType = "java/lang/IllegalArgumentException";
3017 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003018 goto exit;
3019 }
3020 if (offset < 0) {
3021 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003022 _exceptionType = "java/lang/IllegalArgumentException";
3023 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003024 goto exit;
3025 }
3026 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003027 if (_remaining < 1) {
3028 _exception = 1;
3029 _exceptionType = "java/lang/IllegalArgumentException";
3030 _exceptionMessage = "length - offset < 1 < needed";
3031 goto exit;
3032 }
Jack Palevich560814f2009-11-19 16:34:55 +08003033 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003034 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003035 params = params_base + offset;
3036
3037 glGetRenderbufferParameteriv(
3038 (GLenum)target,
3039 (GLenum)pname,
3040 (GLint *)params
3041 );
3042
3043exit:
3044 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003045 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003046 _exception ? JNI_ABORT: 0);
3047 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003048 if (_exception) {
3049 jniThrowException(_env, _exceptionType, _exceptionMessage);
3050 }
Jack Palevich560814f2009-11-19 16:34:55 +08003051}
3052
3053/* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3054static void
3055android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2
3056 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003057 jint _exception = 0;
3058 const char * _exceptionType = NULL;
3059 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003060 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003061 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003062 jint _remaining;
3063 GLint *params = (GLint *) 0;
3064
Romain Guy84cac202016-12-05 12:26:02 -08003065 if (!params_buf) {
3066 _exception = 1;
3067 _exceptionType = "java/lang/IllegalArgumentException";
3068 _exceptionMessage = "params == null";
3069 goto exit;
3070 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003071 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003072 if (_remaining < 1) {
3073 _exception = 1;
3074 _exceptionType = "java/lang/IllegalArgumentException";
3075 _exceptionMessage = "remaining() < 1 < needed";
3076 goto exit;
3077 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003078 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003079 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003080 params = (GLint *) (_paramsBase + _bufferOffset);
3081 }
Jack Palevich560814f2009-11-19 16:34:55 +08003082 glGetRenderbufferParameteriv(
3083 (GLenum)target,
3084 (GLenum)pname,
3085 (GLint *)params
3086 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003087
3088exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003089 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003090 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003091 }
3092 if (_exception) {
3093 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003094 }
3095}
3096
3097/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
3098static void
3099android_glGetShaderiv__II_3II
3100 (JNIEnv *_env, jobject _this, jint shader, jint pname, jintArray params_ref, jint offset) {
3101 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003102 const char * _exceptionType = NULL;
3103 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003104 GLint *params_base = (GLint *) 0;
3105 jint _remaining;
3106 GLint *params = (GLint *) 0;
3107
3108 if (!params_ref) {
3109 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003110 _exceptionType = "java/lang/IllegalArgumentException";
3111 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003112 goto exit;
3113 }
3114 if (offset < 0) {
3115 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003116 _exceptionType = "java/lang/IllegalArgumentException";
3117 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003118 goto exit;
3119 }
3120 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003121 if (_remaining < 1) {
3122 _exception = 1;
3123 _exceptionType = "java/lang/IllegalArgumentException";
3124 _exceptionMessage = "length - offset < 1 < needed";
3125 goto exit;
3126 }
Jack Palevich560814f2009-11-19 16:34:55 +08003127 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003128 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003129 params = params_base + offset;
3130
3131 glGetShaderiv(
3132 (GLuint)shader,
3133 (GLenum)pname,
3134 (GLint *)params
3135 );
3136
3137exit:
3138 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003139 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003140 _exception ? JNI_ABORT: 0);
3141 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003142 if (_exception) {
3143 jniThrowException(_env, _exceptionType, _exceptionMessage);
3144 }
Jack Palevich560814f2009-11-19 16:34:55 +08003145}
3146
3147/* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */
3148static void
3149android_glGetShaderiv__IILjava_nio_IntBuffer_2
3150 (JNIEnv *_env, jobject _this, jint shader, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003151 jint _exception = 0;
3152 const char * _exceptionType = NULL;
3153 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003154 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003155 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003156 jint _remaining;
3157 GLint *params = (GLint *) 0;
3158
Romain Guy84cac202016-12-05 12:26:02 -08003159 if (!params_buf) {
3160 _exception = 1;
3161 _exceptionType = "java/lang/IllegalArgumentException";
3162 _exceptionMessage = "params == null";
3163 goto exit;
3164 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003165 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003166 if (_remaining < 1) {
3167 _exception = 1;
3168 _exceptionType = "java/lang/IllegalArgumentException";
3169 _exceptionMessage = "remaining() < 1 < needed";
3170 goto exit;
3171 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003172 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003173 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003174 params = (GLint *) (_paramsBase + _bufferOffset);
3175 }
Jack Palevich560814f2009-11-19 16:34:55 +08003176 glGetShaderiv(
3177 (GLuint)shader,
3178 (GLenum)pname,
3179 (GLint *)params
3180 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003181
3182exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003183 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003184 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003185 }
3186 if (_exception) {
3187 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003188 }
3189}
3190
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003191#include <stdlib.h>
Jack Palevich560814f2009-11-19 16:34:55 +08003192
3193/* void glGetShaderInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003194static jstring android_glGetShaderInfoLog(JNIEnv *_env, jobject, jint shader) {
Jack Palevich560814f2009-11-19 16:34:55 +08003195 GLint infoLen = 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003196 glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003197 if (!infoLen) {
Romain Guye842e502016-11-29 19:26:29 -08003198 infoLen = 512;
Jack Palevich560814f2009-11-19 16:34:55 +08003199 }
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003200 char* buf = (char*) malloc(infoLen);
3201 if (buf == NULL) {
3202 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
3203 return NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003204 }
Romain Guye842e502016-11-29 19:26:29 -08003205 GLsizei outLen = 0;
3206 glGetShaderInfoLog(shader, infoLen, &outLen, buf);
3207 jstring result = _env->NewStringUTF(outLen == 0 ? "" : buf);
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003208 free(buf);
3209 return result;
Jack Palevich560814f2009-11-19 16:34:55 +08003210}
3211/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
3212static void
3213android_glGetShaderPrecisionFormat__II_3II_3II
3214 (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jintArray range_ref, jint rangeOffset, jintArray precision_ref, jint precisionOffset) {
3215 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003216 const char * _exceptionType = NULL;
3217 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003218 GLint *range_base = (GLint *) 0;
3219 jint _rangeRemaining;
3220 GLint *range = (GLint *) 0;
3221 GLint *precision_base = (GLint *) 0;
3222 jint _precisionRemaining;
3223 GLint *precision = (GLint *) 0;
3224
3225 if (!range_ref) {
3226 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003227 _exceptionType = "java/lang/IllegalArgumentException";
3228 _exceptionMessage = "range == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003229 goto exit;
3230 }
3231 if (rangeOffset < 0) {
3232 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003233 _exceptionType = "java/lang/IllegalArgumentException";
3234 _exceptionMessage = "rangeOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003235 goto exit;
3236 }
3237 _rangeRemaining = _env->GetArrayLength(range_ref) - rangeOffset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003238 if (_rangeRemaining < 1) {
3239 _exception = 1;
3240 _exceptionType = "java/lang/IllegalArgumentException";
3241 _exceptionMessage = "length - rangeOffset < 1 < needed";
3242 goto exit;
3243 }
Jack Palevich560814f2009-11-19 16:34:55 +08003244 range_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003245 _env->GetIntArrayElements(range_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003246 range = range_base + rangeOffset;
3247
3248 if (!precision_ref) {
3249 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003250 _exceptionType = "java/lang/IllegalArgumentException";
3251 _exceptionMessage = "precision == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003252 goto exit;
3253 }
3254 if (precisionOffset < 0) {
3255 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003256 _exceptionType = "java/lang/IllegalArgumentException";
3257 _exceptionMessage = "precisionOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003258 goto exit;
3259 }
3260 _precisionRemaining = _env->GetArrayLength(precision_ref) - precisionOffset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003261 if (_precisionRemaining < 1) {
3262 _exception = 1;
3263 _exceptionType = "java/lang/IllegalArgumentException";
3264 _exceptionMessage = "length - precisionOffset < 1 < needed";
3265 goto exit;
3266 }
Jack Palevich560814f2009-11-19 16:34:55 +08003267 precision_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003268 _env->GetIntArrayElements(precision_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003269 precision = precision_base + precisionOffset;
3270
3271 glGetShaderPrecisionFormat(
3272 (GLenum)shadertype,
3273 (GLenum)precisiontype,
3274 (GLint *)range,
3275 (GLint *)precision
3276 );
3277
3278exit:
3279 if (precision_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003280 _env->ReleaseIntArrayElements(precision_ref, (jint*)precision_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003281 _exception ? JNI_ABORT: 0);
3282 }
3283 if (range_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003284 _env->ReleaseIntArrayElements(range_ref, (jint*)range_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003285 _exception ? JNI_ABORT: 0);
3286 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003287 if (_exception) {
3288 jniThrowException(_env, _exceptionType, _exceptionMessage);
3289 }
Jack Palevich560814f2009-11-19 16:34:55 +08003290}
3291
3292/* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */
3293static void
3294android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
3295 (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jobject range_buf, jobject precision_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003296 jint _exception = 0;
3297 const char * _exceptionType = NULL;
3298 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003299 jintArray _rangeArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003300 jint _rangeBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003301 jintArray _precisionArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003302 jint _precisionBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003303 jint _rangeRemaining;
3304 GLint *range = (GLint *) 0;
3305 jint _precisionRemaining;
3306 GLint *precision = (GLint *) 0;
3307
Romain Guy84cac202016-12-05 12:26:02 -08003308 if (!range_buf) {
3309 _exception = 1;
3310 _exceptionType = "java/lang/IllegalArgumentException";
3311 _exceptionMessage = "range == null";
3312 goto exit;
3313 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003314 range = (GLint *)getPointer(_env, range_buf, (jarray*)&_rangeArray, &_rangeRemaining, &_rangeBufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003315 if (_rangeRemaining < 1) {
3316 _exception = 1;
3317 _exceptionType = "java/lang/IllegalArgumentException";
3318 _exceptionMessage = "remaining() < 1 < needed";
3319 goto exit;
3320 }
Romain Guy84cac202016-12-05 12:26:02 -08003321 if (!precision_buf) {
3322 _exception = 1;
3323 _exceptionType = "java/lang/IllegalArgumentException";
3324 _exceptionMessage = "precision == null";
3325 goto exit;
3326 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003327 precision = (GLint *)getPointer(_env, precision_buf, (jarray*)&_precisionArray, &_precisionRemaining, &_precisionBufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003328 if (_precisionRemaining < 1) {
3329 _exception = 1;
3330 _exceptionType = "java/lang/IllegalArgumentException";
3331 _exceptionMessage = "remaining() < 1 < needed";
3332 goto exit;
3333 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003334 if (range == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003335 char * _rangeBase = (char *)_env->GetIntArrayElements(_rangeArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003336 range = (GLint *) (_rangeBase + _rangeBufferOffset);
3337 }
3338 if (precision == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003339 char * _precisionBase = (char *)_env->GetIntArrayElements(_precisionArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003340 precision = (GLint *) (_precisionBase + _precisionBufferOffset);
3341 }
Jack Palevich560814f2009-11-19 16:34:55 +08003342 glGetShaderPrecisionFormat(
3343 (GLenum)shadertype,
3344 (GLenum)precisiontype,
3345 (GLint *)range,
3346 (GLint *)precision
3347 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003348
3349exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003350 if (_precisionArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003351 _env->ReleaseIntArrayElements(_precisionArray, (jint*)precision, _exception ? JNI_ABORT : 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003352 }
3353 if (_rangeArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003354 _env->ReleaseIntArrayElements(_rangeArray, (jint*)range, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003355 }
3356 if (_exception) {
3357 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003358 }
3359}
3360
3361/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3362static void
3363android_glGetShaderSource__II_3II_3BI
3364 (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jintArray length_ref, jint lengthOffset, jbyteArray source_ref, jint sourceOffset) {
3365 jint _exception = 0;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003366 const char * _exceptionType;
3367 const char * _exceptionMessage;
Jack Palevich560814f2009-11-19 16:34:55 +08003368 GLsizei *length_base = (GLsizei *) 0;
3369 jint _lengthRemaining;
3370 GLsizei *length = (GLsizei *) 0;
3371 char *source_base = (char *) 0;
3372 jint _sourceRemaining;
3373 char *source = (char *) 0;
3374
Pablo Ceballos6aff9062015-10-01 18:35:39 -07003375 if (length_ref) {
3376 if (lengthOffset < 0) {
3377 _exception = 1;
3378 _exceptionType = "java/lang/IllegalArgumentException";
3379 _exceptionMessage = "lengthOffset < 0";
3380 goto exit;
3381 }
3382 _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
3383 length_base = (GLsizei *)
3384 _env->GetIntArrayElements(length_ref, (jboolean *)0);
3385 length = length_base + lengthOffset;
Jack Palevich560814f2009-11-19 16:34:55 +08003386 }
Jack Palevich560814f2009-11-19 16:34:55 +08003387
3388 if (!source_ref) {
3389 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003390 _exceptionType = "java/lang/IllegalArgumentException";
3391 _exceptionMessage = "source == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003392 goto exit;
3393 }
3394 if (sourceOffset < 0) {
3395 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003396 _exceptionType = "java/lang/IllegalArgumentException";
3397 _exceptionMessage = "sourceOffset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003398 goto exit;
3399 }
3400 _sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset;
3401 source_base = (char *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003402 _env->GetByteArrayElements(source_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003403 source = source_base + sourceOffset;
3404
3405 glGetShaderSource(
3406 (GLuint)shader,
3407 (GLsizei)bufsize,
3408 (GLsizei *)length,
3409 (char *)source
3410 );
3411
3412exit:
3413 if (source_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003414 _env->ReleaseByteArrayElements(source_ref, (jbyte*)source_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003415 _exception ? JNI_ABORT: 0);
3416 }
3417 if (length_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003418 _env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003419 _exception ? JNI_ABORT: 0);
3420 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003421 if (_exception) {
3422 jniThrowException(_env, _exceptionType, _exceptionMessage);
3423 }
Jack Palevich560814f2009-11-19 16:34:55 +08003424}
3425
3426/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3427static void
3428android_glGetShaderSource__IILjava_nio_IntBuffer_2B
3429 (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jobject length_buf, jbyte source) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003430 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003431 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003432 jint _remaining;
3433 GLsizei *length = (GLsizei *) 0;
3434
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003435 length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003436 if (length == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003437 char * _lengthBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003438 length = (GLsizei *) (_lengthBase + _bufferOffset);
3439 }
Jack Palevich560814f2009-11-19 16:34:55 +08003440 glGetShaderSource(
3441 (GLuint)shader,
3442 (GLsizei)bufsize,
3443 (GLsizei *)length,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00003444 reinterpret_cast<char *>(source)
Jack Palevich560814f2009-11-19 16:34:55 +08003445 );
3446 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003447 releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _array, (jint*)length, JNI_TRUE);
Jack Palevich560814f2009-11-19 16:34:55 +08003448 }
3449}
3450
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07003451/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */
3452static jstring android_glGetShaderSource(JNIEnv *_env, jobject, jint shader) {
3453 GLint shaderLen = 0;
3454 glGetShaderiv((GLuint)shader, GL_SHADER_SOURCE_LENGTH, &shaderLen);
3455 if (!shaderLen) {
3456 return _env->NewStringUTF("");
3457 }
3458 char* buf = (char*) malloc(shaderLen);
3459 if (buf == NULL) {
3460 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
3461 return NULL;
3462 }
3463 glGetShaderSource(shader, shaderLen, NULL, buf);
3464 jstring result = _env->NewStringUTF(buf);
3465 free(buf);
3466 return result;
3467}
Jack Palevich560814f2009-11-19 16:34:55 +08003468/* const GLubyte * glGetString ( GLenum name ) */
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07003469static jstring android_glGetString(JNIEnv* _env, jobject, jint name) {
3470 const char* chars = (const char*) glGetString((GLenum) name);
3471 return _env->NewStringUTF(chars);
Jack Palevich560814f2009-11-19 16:34:55 +08003472}
3473/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
3474static void
3475android_glGetTexParameterfv__II_3FI
3476 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
3477 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003478 const char * _exceptionType = NULL;
3479 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003480 GLfloat *params_base = (GLfloat *) 0;
3481 jint _remaining;
3482 GLfloat *params = (GLfloat *) 0;
3483
3484 if (!params_ref) {
3485 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003486 _exceptionType = "java/lang/IllegalArgumentException";
3487 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003488 goto exit;
3489 }
3490 if (offset < 0) {
3491 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003492 _exceptionType = "java/lang/IllegalArgumentException";
3493 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003494 goto exit;
3495 }
3496 _remaining = _env->GetArrayLength(params_ref) - offset;
3497 if (_remaining < 1) {
3498 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003499 _exceptionType = "java/lang/IllegalArgumentException";
3500 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08003501 goto exit;
3502 }
3503 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003504 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003505 params = params_base + offset;
3506
3507 glGetTexParameterfv(
3508 (GLenum)target,
3509 (GLenum)pname,
3510 (GLfloat *)params
3511 );
3512
3513exit:
3514 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003515 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003516 _exception ? JNI_ABORT: 0);
3517 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003518 if (_exception) {
3519 jniThrowException(_env, _exceptionType, _exceptionMessage);
3520 }
Jack Palevich560814f2009-11-19 16:34:55 +08003521}
3522
3523/* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */
3524static void
3525android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2
3526 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3527 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003528 const char * _exceptionType = NULL;
3529 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003530 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003531 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003532 jint _remaining;
3533 GLfloat *params = (GLfloat *) 0;
3534
Romain Guy84cac202016-12-05 12:26:02 -08003535 if (!params_buf) {
3536 _exception = 1;
3537 _exceptionType = "java/lang/IllegalArgumentException";
3538 _exceptionMessage = "params == null";
3539 goto exit;
3540 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003541 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08003542 if (_remaining < 1) {
3543 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003544 _exceptionType = "java/lang/IllegalArgumentException";
3545 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08003546 goto exit;
3547 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003548 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003549 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003550 params = (GLfloat *) (_paramsBase + _bufferOffset);
3551 }
Jack Palevich560814f2009-11-19 16:34:55 +08003552 glGetTexParameterfv(
3553 (GLenum)target,
3554 (GLenum)pname,
3555 (GLfloat *)params
3556 );
3557
3558exit:
3559 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003560 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Jack Palevich560814f2009-11-19 16:34:55 +08003561 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003562 if (_exception) {
3563 jniThrowException(_env, _exceptionType, _exceptionMessage);
3564 }
Jack Palevich560814f2009-11-19 16:34:55 +08003565}
3566
3567/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3568static void
3569android_glGetTexParameteriv__II_3II
3570 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
3571 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003572 const char * _exceptionType = NULL;
3573 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003574 GLint *params_base = (GLint *) 0;
3575 jint _remaining;
3576 GLint *params = (GLint *) 0;
3577
3578 if (!params_ref) {
3579 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003580 _exceptionType = "java/lang/IllegalArgumentException";
3581 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003582 goto exit;
3583 }
3584 if (offset < 0) {
3585 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003586 _exceptionType = "java/lang/IllegalArgumentException";
3587 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003588 goto exit;
3589 }
3590 _remaining = _env->GetArrayLength(params_ref) - offset;
3591 if (_remaining < 1) {
3592 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003593 _exceptionType = "java/lang/IllegalArgumentException";
3594 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08003595 goto exit;
3596 }
3597 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003598 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003599 params = params_base + offset;
3600
3601 glGetTexParameteriv(
3602 (GLenum)target,
3603 (GLenum)pname,
3604 (GLint *)params
3605 );
3606
3607exit:
3608 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003609 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003610 _exception ? JNI_ABORT: 0);
3611 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003612 if (_exception) {
3613 jniThrowException(_env, _exceptionType, _exceptionMessage);
3614 }
Jack Palevich560814f2009-11-19 16:34:55 +08003615}
3616
3617/* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */
3618static void
3619android_glGetTexParameteriv__IILjava_nio_IntBuffer_2
3620 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
3621 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003622 const char * _exceptionType = NULL;
3623 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003624 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003625 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003626 jint _remaining;
3627 GLint *params = (GLint *) 0;
3628
Romain Guy84cac202016-12-05 12:26:02 -08003629 if (!params_buf) {
3630 _exception = 1;
3631 _exceptionType = "java/lang/IllegalArgumentException";
3632 _exceptionMessage = "params == null";
3633 goto exit;
3634 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003635 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08003636 if (_remaining < 1) {
3637 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003638 _exceptionType = "java/lang/IllegalArgumentException";
3639 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08003640 goto exit;
3641 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003642 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003643 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003644 params = (GLint *) (_paramsBase + _bufferOffset);
3645 }
Jack Palevich560814f2009-11-19 16:34:55 +08003646 glGetTexParameteriv(
3647 (GLenum)target,
3648 (GLenum)pname,
3649 (GLint *)params
3650 );
3651
3652exit:
3653 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003654 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Jack Palevich560814f2009-11-19 16:34:55 +08003655 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003656 if (_exception) {
3657 jniThrowException(_env, _exceptionType, _exceptionMessage);
3658 }
Jack Palevich560814f2009-11-19 16:34:55 +08003659}
3660
3661/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3662static void
3663android_glGetUniformfv__II_3FI
3664 (JNIEnv *_env, jobject _this, jint program, jint location, jfloatArray params_ref, jint offset) {
3665 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003666 const char * _exceptionType = NULL;
3667 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003668 GLfloat *params_base = (GLfloat *) 0;
3669 jint _remaining;
3670 GLfloat *params = (GLfloat *) 0;
3671
3672 if (!params_ref) {
3673 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003674 _exceptionType = "java/lang/IllegalArgumentException";
3675 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003676 goto exit;
3677 }
3678 if (offset < 0) {
3679 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003680 _exceptionType = "java/lang/IllegalArgumentException";
3681 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003682 goto exit;
3683 }
3684 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003685 if (_remaining < 1) {
3686 _exception = 1;
3687 _exceptionType = "java/lang/IllegalArgumentException";
3688 _exceptionMessage = "length - offset < 1 < needed";
3689 goto exit;
3690 }
Jack Palevich560814f2009-11-19 16:34:55 +08003691 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003692 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003693 params = params_base + offset;
3694
3695 glGetUniformfv(
3696 (GLuint)program,
3697 (GLint)location,
3698 (GLfloat *)params
3699 );
3700
3701exit:
3702 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003703 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003704 _exception ? JNI_ABORT: 0);
3705 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003706 if (_exception) {
3707 jniThrowException(_env, _exceptionType, _exceptionMessage);
3708 }
Jack Palevich560814f2009-11-19 16:34:55 +08003709}
3710
3711/* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */
3712static void
3713android_glGetUniformfv__IILjava_nio_FloatBuffer_2
3714 (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003715 jint _exception = 0;
3716 const char * _exceptionType = NULL;
3717 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003718 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003719 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003720 jint _remaining;
3721 GLfloat *params = (GLfloat *) 0;
3722
Romain Guy84cac202016-12-05 12:26:02 -08003723 if (!params_buf) {
3724 _exception = 1;
3725 _exceptionType = "java/lang/IllegalArgumentException";
3726 _exceptionMessage = "params == null";
3727 goto exit;
3728 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003729 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003730 if (_remaining < 1) {
3731 _exception = 1;
3732 _exceptionType = "java/lang/IllegalArgumentException";
3733 _exceptionMessage = "remaining() < 1 < needed";
3734 goto exit;
3735 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003736 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003737 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003738 params = (GLfloat *) (_paramsBase + _bufferOffset);
3739 }
Jack Palevich560814f2009-11-19 16:34:55 +08003740 glGetUniformfv(
3741 (GLuint)program,
3742 (GLint)location,
3743 (GLfloat *)params
3744 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003745
3746exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003747 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003748 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003749 }
3750 if (_exception) {
3751 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003752 }
3753}
3754
3755/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3756static void
3757android_glGetUniformiv__II_3II
3758 (JNIEnv *_env, jobject _this, jint program, jint location, jintArray params_ref, jint offset) {
3759 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003760 const char * _exceptionType = NULL;
3761 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003762 GLint *params_base = (GLint *) 0;
3763 jint _remaining;
3764 GLint *params = (GLint *) 0;
3765
3766 if (!params_ref) {
3767 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003768 _exceptionType = "java/lang/IllegalArgumentException";
3769 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003770 goto exit;
3771 }
3772 if (offset < 0) {
3773 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003774 _exceptionType = "java/lang/IllegalArgumentException";
3775 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003776 goto exit;
3777 }
3778 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003779 if (_remaining < 1) {
3780 _exception = 1;
3781 _exceptionType = "java/lang/IllegalArgumentException";
3782 _exceptionMessage = "length - offset < 1 < needed";
3783 goto exit;
3784 }
Jack Palevich560814f2009-11-19 16:34:55 +08003785 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003786 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003787 params = params_base + offset;
3788
3789 glGetUniformiv(
3790 (GLuint)program,
3791 (GLint)location,
3792 (GLint *)params
3793 );
3794
3795exit:
3796 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003797 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003798 _exception ? JNI_ABORT: 0);
3799 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003800 if (_exception) {
3801 jniThrowException(_env, _exceptionType, _exceptionMessage);
3802 }
Jack Palevich560814f2009-11-19 16:34:55 +08003803}
3804
3805/* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */
3806static void
3807android_glGetUniformiv__IILjava_nio_IntBuffer_2
3808 (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003809 jint _exception = 0;
3810 const char * _exceptionType = NULL;
3811 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003812 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003813 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003814 jint _remaining;
3815 GLint *params = (GLint *) 0;
3816
Romain Guy84cac202016-12-05 12:26:02 -08003817 if (!params_buf) {
3818 _exception = 1;
3819 _exceptionType = "java/lang/IllegalArgumentException";
3820 _exceptionMessage = "params == null";
3821 goto exit;
3822 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003823 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003824 if (_remaining < 1) {
3825 _exception = 1;
3826 _exceptionType = "java/lang/IllegalArgumentException";
3827 _exceptionMessage = "remaining() < 1 < needed";
3828 goto exit;
3829 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003830 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003831 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003832 params = (GLint *) (_paramsBase + _bufferOffset);
3833 }
Jack Palevich560814f2009-11-19 16:34:55 +08003834 glGetUniformiv(
3835 (GLuint)program,
3836 (GLint)location,
3837 (GLint *)params
3838 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003839
3840exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003841 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003842 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003843 }
3844 if (_exception) {
3845 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003846 }
3847}
3848
Mathias Agopian89be00b2013-02-22 20:08:06 -08003849/* GLint glGetUniformLocation ( GLuint program, const char *name ) */
Jack Palevich560814f2009-11-19 16:34:55 +08003850static jint
3851android_glGetUniformLocation__ILjava_lang_String_2
3852 (JNIEnv *_env, jobject _this, jint program, jstring name) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003853 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003854 const char * _exceptionType = NULL;
3855 const char * _exceptionMessage = NULL;
Mathias Agopian89be00b2013-02-22 20:08:06 -08003856 GLint _returnValue = 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003857 const char* _nativename = 0;
3858
3859 if (!name) {
Elliott Hughes428d3fc2013-09-24 17:15:41 -07003860 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003861 _exceptionType = "java/lang/IllegalArgumentException";
3862 _exceptionMessage = "name == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003863 goto exit;
3864 }
3865 _nativename = _env->GetStringUTFChars(name, 0);
3866
3867 _returnValue = glGetUniformLocation(
3868 (GLuint)program,
3869 (char *)_nativename
3870 );
3871
3872exit:
3873 if (_nativename) {
3874 _env->ReleaseStringUTFChars(name, _nativename);
3875 }
3876
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003877 if (_exception) {
3878 jniThrowException(_env, _exceptionType, _exceptionMessage);
Orion Hodsonc240f222019-02-26 18:05:03 +00003879 return (jint)0;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003880 }
Andy McFaddencee51982013-04-25 16:08:31 -07003881 return (jint)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08003882}
3883
3884/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3885static void
3886android_glGetVertexAttribfv__II_3FI
3887 (JNIEnv *_env, jobject _this, jint index, jint pname, jfloatArray params_ref, jint offset) {
3888 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003889 const char * _exceptionType = NULL;
3890 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08003891 GLfloat *params_base = (GLfloat *) 0;
3892 jint _remaining;
3893 GLfloat *params = (GLfloat *) 0;
3894
3895 if (!params_ref) {
3896 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003897 _exceptionType = "java/lang/IllegalArgumentException";
3898 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08003899 goto exit;
3900 }
3901 if (offset < 0) {
3902 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003903 _exceptionType = "java/lang/IllegalArgumentException";
3904 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08003905 goto exit;
3906 }
3907 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08003908 int _needed;
3909 switch (pname) {
3910#if defined(GL_CURRENT_VERTEX_ATTRIB)
3911 case GL_CURRENT_VERTEX_ATTRIB:
3912#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3913 _needed = 4;
3914 break;
3915 default:
3916 _needed = 1;
3917 break;
3918 }
3919 if (_remaining < _needed) {
3920 _exception = 1;
3921 _exceptionType = "java/lang/IllegalArgumentException";
3922 _exceptionMessage = "length - offset < needed";
3923 goto exit;
3924 }
Jack Palevich560814f2009-11-19 16:34:55 +08003925 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003926 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08003927 params = params_base + offset;
3928
3929 glGetVertexAttribfv(
3930 (GLuint)index,
3931 (GLenum)pname,
3932 (GLfloat *)params
3933 );
3934
3935exit:
3936 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003937 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08003938 _exception ? JNI_ABORT: 0);
3939 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07003940 if (_exception) {
3941 jniThrowException(_env, _exceptionType, _exceptionMessage);
3942 }
Jack Palevich560814f2009-11-19 16:34:55 +08003943}
3944
3945/* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */
3946static void
3947android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2
3948 (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08003949 jint _exception = 0;
3950 const char * _exceptionType = NULL;
3951 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003952 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003953 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08003954 jint _remaining;
3955 GLfloat *params = (GLfloat *) 0;
3956
Romain Guy84cac202016-12-05 12:26:02 -08003957 if (!params_buf) {
3958 _exception = 1;
3959 _exceptionType = "java/lang/IllegalArgumentException";
3960 _exceptionMessage = "params == null";
3961 goto exit;
3962 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003963 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003964 int _needed;
3965 switch (pname) {
3966#if defined(GL_CURRENT_VERTEX_ATTRIB)
3967 case GL_CURRENT_VERTEX_ATTRIB:
3968#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
3969 _needed = 4;
3970 break;
3971 default:
3972 _needed = 1;
3973 break;
3974 }
3975 if (_remaining < _needed) {
3976 _exception = 1;
3977 _exceptionType = "java/lang/IllegalArgumentException";
3978 _exceptionMessage = "remaining() < needed";
3979 goto exit;
3980 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003981 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003982 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07003983 params = (GLfloat *) (_paramsBase + _bufferOffset);
3984 }
Jack Palevich560814f2009-11-19 16:34:55 +08003985 glGetVertexAttribfv(
3986 (GLuint)index,
3987 (GLenum)pname,
3988 (GLfloat *)params
3989 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08003990
3991exit:
Jack Palevich560814f2009-11-19 16:34:55 +08003992 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07003993 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08003994 }
3995 if (_exception) {
3996 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08003997 }
3998}
3999
4000/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
4001static void
4002android_glGetVertexAttribiv__II_3II
4003 (JNIEnv *_env, jobject _this, jint index, jint pname, jintArray params_ref, jint offset) {
4004 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004005 const char * _exceptionType = NULL;
4006 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004007 GLint *params_base = (GLint *) 0;
4008 jint _remaining;
4009 GLint *params = (GLint *) 0;
4010
4011 if (!params_ref) {
4012 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004013 _exceptionType = "java/lang/IllegalArgumentException";
4014 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004015 goto exit;
4016 }
4017 if (offset < 0) {
4018 _exception = 1;
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004019 _exceptionType = "java/lang/IllegalArgumentException";
4020 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004021 goto exit;
4022 }
4023 _remaining = _env->GetArrayLength(params_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004024 int _needed;
4025 switch (pname) {
4026#if defined(GL_CURRENT_VERTEX_ATTRIB)
4027 case GL_CURRENT_VERTEX_ATTRIB:
4028#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
4029 _needed = 4;
4030 break;
4031 default:
4032 _needed = 1;
4033 break;
4034 }
4035 if (_remaining < _needed) {
4036 _exception = 1;
4037 _exceptionType = "java/lang/IllegalArgumentException";
4038 _exceptionMessage = "length - offset < needed";
4039 goto exit;
4040 }
Jack Palevich560814f2009-11-19 16:34:55 +08004041 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004042 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08004043 params = params_base + offset;
4044
4045 glGetVertexAttribiv(
4046 (GLuint)index,
4047 (GLenum)pname,
4048 (GLint *)params
4049 );
4050
4051exit:
4052 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004053 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08004054 _exception ? JNI_ABORT: 0);
4055 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004056 if (_exception) {
4057 jniThrowException(_env, _exceptionType, _exceptionMessage);
4058 }
Jack Palevich560814f2009-11-19 16:34:55 +08004059}
4060
4061/* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */
4062static void
4063android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2
4064 (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08004065 jint _exception = 0;
4066 const char * _exceptionType = NULL;
4067 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004068 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004069 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004070 jint _remaining;
4071 GLint *params = (GLint *) 0;
4072
Romain Guy84cac202016-12-05 12:26:02 -08004073 if (!params_buf) {
4074 _exception = 1;
4075 _exceptionType = "java/lang/IllegalArgumentException";
4076 _exceptionMessage = "params == null";
4077 goto exit;
4078 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004079 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004080 int _needed;
4081 switch (pname) {
4082#if defined(GL_CURRENT_VERTEX_ATTRIB)
4083 case GL_CURRENT_VERTEX_ATTRIB:
4084#endif // defined(GL_CURRENT_VERTEX_ATTRIB)
4085 _needed = 4;
4086 break;
4087 default:
4088 _needed = 1;
4089 break;
4090 }
4091 if (_remaining < _needed) {
4092 _exception = 1;
4093 _exceptionType = "java/lang/IllegalArgumentException";
4094 _exceptionMessage = "remaining() < needed";
4095 goto exit;
4096 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004097 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004098 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004099 params = (GLint *) (_paramsBase + _bufferOffset);
4100 }
Jack Palevich560814f2009-11-19 16:34:55 +08004101 glGetVertexAttribiv(
4102 (GLuint)index,
4103 (GLenum)pname,
4104 (GLint *)params
4105 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08004106
4107exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004108 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004109 _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004110 }
4111 if (_exception) {
4112 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08004113 }
4114}
4115
4116/* void glHint ( GLenum target, GLenum mode ) */
4117static void
4118android_glHint__II
4119 (JNIEnv *_env, jobject _this, jint target, jint mode) {
4120 glHint(
4121 (GLenum)target,
4122 (GLenum)mode
4123 );
4124}
4125
4126/* GLboolean glIsBuffer ( GLuint buffer ) */
4127static jboolean
4128android_glIsBuffer__I
4129 (JNIEnv *_env, jobject _this, jint buffer) {
4130 GLboolean _returnValue;
4131 _returnValue = glIsBuffer(
4132 (GLuint)buffer
4133 );
Andy McFaddencee51982013-04-25 16:08:31 -07004134 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08004135}
4136
4137/* GLboolean glIsEnabled ( GLenum cap ) */
4138static jboolean
4139android_glIsEnabled__I
4140 (JNIEnv *_env, jobject _this, jint cap) {
4141 GLboolean _returnValue;
4142 _returnValue = glIsEnabled(
4143 (GLenum)cap
4144 );
Andy McFaddencee51982013-04-25 16:08:31 -07004145 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08004146}
4147
4148/* GLboolean glIsFramebuffer ( GLuint framebuffer ) */
4149static jboolean
4150android_glIsFramebuffer__I
4151 (JNIEnv *_env, jobject _this, jint framebuffer) {
4152 GLboolean _returnValue;
4153 _returnValue = glIsFramebuffer(
4154 (GLuint)framebuffer
4155 );
Andy McFaddencee51982013-04-25 16:08:31 -07004156 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08004157}
4158
4159/* GLboolean glIsProgram ( GLuint program ) */
4160static jboolean
4161android_glIsProgram__I
4162 (JNIEnv *_env, jobject _this, jint program) {
4163 GLboolean _returnValue;
4164 _returnValue = glIsProgram(
4165 (GLuint)program
4166 );
Andy McFaddencee51982013-04-25 16:08:31 -07004167 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08004168}
4169
4170/* GLboolean glIsRenderbuffer ( GLuint renderbuffer ) */
4171static jboolean
4172android_glIsRenderbuffer__I
4173 (JNIEnv *_env, jobject _this, jint renderbuffer) {
4174 GLboolean _returnValue;
4175 _returnValue = glIsRenderbuffer(
4176 (GLuint)renderbuffer
4177 );
Andy McFaddencee51982013-04-25 16:08:31 -07004178 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08004179}
4180
4181/* GLboolean glIsShader ( GLuint shader ) */
4182static jboolean
4183android_glIsShader__I
4184 (JNIEnv *_env, jobject _this, jint shader) {
4185 GLboolean _returnValue;
4186 _returnValue = glIsShader(
4187 (GLuint)shader
4188 );
Andy McFaddencee51982013-04-25 16:08:31 -07004189 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08004190}
4191
4192/* GLboolean glIsTexture ( GLuint texture ) */
4193static jboolean
4194android_glIsTexture__I
4195 (JNIEnv *_env, jobject _this, jint texture) {
4196 GLboolean _returnValue;
4197 _returnValue = glIsTexture(
4198 (GLuint)texture
4199 );
Andy McFaddencee51982013-04-25 16:08:31 -07004200 return (jboolean)_returnValue;
Jack Palevich560814f2009-11-19 16:34:55 +08004201}
4202
4203/* void glLineWidth ( GLfloat width ) */
4204static void
4205android_glLineWidth__F
4206 (JNIEnv *_env, jobject _this, jfloat width) {
4207 glLineWidth(
4208 (GLfloat)width
4209 );
4210}
4211
4212/* void glLinkProgram ( GLuint program ) */
4213static void
4214android_glLinkProgram__I
4215 (JNIEnv *_env, jobject _this, jint program) {
4216 glLinkProgram(
4217 (GLuint)program
4218 );
4219}
4220
4221/* void glPixelStorei ( GLenum pname, GLint param ) */
4222static void
4223android_glPixelStorei__II
4224 (JNIEnv *_env, jobject _this, jint pname, jint param) {
4225 glPixelStorei(
4226 (GLenum)pname,
4227 (GLint)param
4228 );
4229}
4230
4231/* void glPolygonOffset ( GLfloat factor, GLfloat units ) */
4232static void
4233android_glPolygonOffset__FF
4234 (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) {
4235 glPolygonOffset(
4236 (GLfloat)factor,
4237 (GLfloat)units
4238 );
4239}
4240
4241/* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */
4242static void
4243android_glReadPixels__IIIIIILjava_nio_Buffer_2
4244 (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 -08004245 jint _exception = 0;
4246 const char * _exceptionType = NULL;
4247 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004248 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004249 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004250 jint _remaining;
4251 GLvoid *pixels = (GLvoid *) 0;
4252
Romain Guy84cac202016-12-05 12:26:02 -08004253 if (!pixels_buf) {
4254 _exception = 1;
4255 _exceptionType = "java/lang/IllegalArgumentException";
4256 _exceptionMessage = "pixels == null";
4257 goto exit;
4258 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004259 pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004260 if (pixels == NULL) {
4261 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4262 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
4263 }
Jack Palevich560814f2009-11-19 16:34:55 +08004264 glReadPixels(
4265 (GLint)x,
4266 (GLint)y,
4267 (GLsizei)width,
4268 (GLsizei)height,
4269 (GLenum)format,
4270 (GLenum)type,
4271 (GLvoid *)pixels
4272 );
Romain Guy84cac202016-12-05 12:26:02 -08004273
4274exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004275 if (_array) {
Romain Guy84cac202016-12-05 12:26:02 -08004276 releasePointer(_env, _array, pixels, _exception ? JNI_FALSE : JNI_TRUE);
4277 }
4278 if (_exception) {
4279 jniThrowException(_env, _exceptionType, _exceptionMessage);
Jack Palevich560814f2009-11-19 16:34:55 +08004280 }
4281}
4282
4283/* void glReleaseShaderCompiler ( void ) */
4284static void
4285android_glReleaseShaderCompiler__
4286 (JNIEnv *_env, jobject _this) {
4287 glReleaseShaderCompiler();
4288}
4289
4290/* void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) */
4291static void
4292android_glRenderbufferStorage__IIII
4293 (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint width, jint height) {
4294 glRenderbufferStorage(
4295 (GLenum)target,
4296 (GLenum)internalformat,
4297 (GLsizei)width,
4298 (GLsizei)height
4299 );
4300}
4301
4302/* void glSampleCoverage ( GLclampf value, GLboolean invert ) */
4303static void
4304android_glSampleCoverage__FZ
4305 (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) {
4306 glSampleCoverage(
4307 (GLclampf)value,
4308 (GLboolean)invert
4309 );
4310}
4311
4312/* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */
4313static void
4314android_glScissor__IIII
4315 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
4316 glScissor(
4317 (GLint)x,
4318 (GLint)y,
4319 (GLsizei)width,
4320 (GLsizei)height
4321 );
4322}
4323
4324/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
4325static void
4326android_glShaderBinary__I_3IIILjava_nio_Buffer_2I
4327 (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 -07004328 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004329 const char * _exceptionType = NULL;
4330 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004331 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004332 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004333 GLuint *shaders_base = (GLuint *) 0;
4334 jint _shadersRemaining;
4335 GLuint *shaders = (GLuint *) 0;
4336 jint _binaryRemaining;
4337 GLvoid *binary = (GLvoid *) 0;
4338
4339 if (!shaders_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004340 _exception = 1;
4341 _exceptionType = "java/lang/IllegalArgumentException";
4342 _exceptionMessage = "shaders == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004343 goto exit;
4344 }
4345 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004346 _exception = 1;
4347 _exceptionType = "java/lang/IllegalArgumentException";
4348 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004349 goto exit;
4350 }
4351 _shadersRemaining = _env->GetArrayLength(shaders_ref) - offset;
4352 shaders_base = (GLuint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004353 _env->GetIntArrayElements(shaders_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08004354 shaders = shaders_base + offset;
4355
Romain Guy84cac202016-12-05 12:26:02 -08004356 if (!binary_buf) {
4357 _exception = 1;
4358 _exceptionType = "java/lang/IllegalArgumentException";
4359 _exceptionMessage = "binary == null";
4360 goto exit;
4361 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004362 binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_array, &_binaryRemaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004363 if (_binaryRemaining < length) {
4364 _exception = 1;
4365 _exceptionType = "java/lang/IllegalArgumentException";
4366 _exceptionMessage = "remaining() < length < needed";
4367 goto exit;
4368 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004369 if (binary == NULL) {
4370 char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4371 binary = (GLvoid *) (_binaryBase + _bufferOffset);
4372 }
Jack Palevich560814f2009-11-19 16:34:55 +08004373 glShaderBinary(
4374 (GLsizei)n,
4375 (GLuint *)shaders,
4376 (GLenum)binaryformat,
4377 (GLvoid *)binary,
4378 (GLsizei)length
4379 );
4380
4381exit:
4382 if (_array) {
4383 releasePointer(_env, _array, binary, JNI_FALSE);
4384 }
4385 if (shaders_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004386 _env->ReleaseIntArrayElements(shaders_ref, (jint*)shaders_base,
Jack Palevich560814f2009-11-19 16:34:55 +08004387 JNI_ABORT);
4388 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004389 if (_exception) {
4390 jniThrowException(_env, _exceptionType, _exceptionMessage);
4391 }
Jack Palevich560814f2009-11-19 16:34:55 +08004392}
4393
4394/* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */
4395static void
4396android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I
4397 (JNIEnv *_env, jobject _this, jint n, jobject shaders_buf, jint binaryformat, jobject binary_buf, jint length) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08004398 jint _exception = 0;
4399 const char * _exceptionType = NULL;
4400 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004401 jintArray _shadersArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004402 jint _shadersBufferOffset = (jint) 0;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004403 jintArray _binaryArray = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004404 jint _binaryBufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004405 jint _shadersRemaining;
4406 GLuint *shaders = (GLuint *) 0;
4407 jint _binaryRemaining;
4408 GLvoid *binary = (GLvoid *) 0;
4409
Romain Guy84cac202016-12-05 12:26:02 -08004410 if (!shaders_buf) {
4411 _exception = 1;
4412 _exceptionType = "java/lang/IllegalArgumentException";
4413 _exceptionMessage = "shaders == null";
4414 goto exit;
4415 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004416 shaders = (GLuint *)getPointer(_env, shaders_buf, (jarray*)&_shadersArray, &_shadersRemaining, &_shadersBufferOffset);
Romain Guy84cac202016-12-05 12:26:02 -08004417 if (!binary_buf) {
4418 _exception = 1;
4419 _exceptionType = "java/lang/IllegalArgumentException";
4420 _exceptionMessage = "binary == null";
4421 goto exit;
4422 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004423 binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_binaryArray, &_binaryRemaining, &_binaryBufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004424 if (_binaryRemaining < length) {
4425 _exception = 1;
4426 _exceptionType = "java/lang/IllegalArgumentException";
4427 _exceptionMessage = "remaining() < length < needed";
4428 goto exit;
4429 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004430 if (shaders == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004431 char * _shadersBase = (char *)_env->GetIntArrayElements(_shadersArray, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004432 shaders = (GLuint *) (_shadersBase + _shadersBufferOffset);
4433 }
4434 if (binary == NULL) {
4435 char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_binaryArray, (jboolean *) 0);
4436 binary = (GLvoid *) (_binaryBase + _binaryBufferOffset);
4437 }
Jack Palevich560814f2009-11-19 16:34:55 +08004438 glShaderBinary(
4439 (GLsizei)n,
4440 (GLuint *)shaders,
4441 (GLenum)binaryformat,
4442 (GLvoid *)binary,
4443 (GLsizei)length
4444 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08004445
4446exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004447 if (_binaryArray) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004448 releasePointer(_env, _binaryArray, binary, JNI_FALSE);
4449 }
4450 if (_shadersArray) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004451 _env->ReleaseIntArrayElements(_shadersArray, (jint*)shaders, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08004452 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08004453 if (_exception) {
4454 jniThrowException(_env, _exceptionType, _exceptionMessage);
4455 }
Jack Palevich560814f2009-11-19 16:34:55 +08004456}
4457
4458
4459/* void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint * length ) */
4460static
4461void
4462android_glShaderSource
4463 (JNIEnv *_env, jobject _this, jint shader, jstring string) {
4464
4465 if (!string) {
Elliott Hughes24ce5fb2011-04-08 20:01:01 -07004466 jniThrowException(_env, "java/lang/IllegalArgumentException", "string == null");
Jack Palevich560814f2009-11-19 16:34:55 +08004467 return;
4468 }
4469
4470 const char* nativeString = _env->GetStringUTFChars(string, 0);
4471 const char* strings[] = {nativeString};
4472 glShaderSource(shader, 1, strings, 0);
4473 _env->ReleaseStringUTFChars(string, nativeString);
4474}
4475/* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */
4476static void
4477android_glStencilFunc__III
4478 (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) {
4479 glStencilFunc(
4480 (GLenum)func,
4481 (GLint)ref,
4482 (GLuint)mask
4483 );
4484}
4485
4486/* void glStencilFuncSeparate ( GLenum face, GLenum func, GLint ref, GLuint mask ) */
4487static void
4488android_glStencilFuncSeparate__IIII
4489 (JNIEnv *_env, jobject _this, jint face, jint func, jint ref, jint mask) {
4490 glStencilFuncSeparate(
4491 (GLenum)face,
4492 (GLenum)func,
4493 (GLint)ref,
4494 (GLuint)mask
4495 );
4496}
4497
4498/* void glStencilMask ( GLuint mask ) */
4499static void
4500android_glStencilMask__I
4501 (JNIEnv *_env, jobject _this, jint mask) {
4502 glStencilMask(
4503 (GLuint)mask
4504 );
4505}
4506
4507/* void glStencilMaskSeparate ( GLenum face, GLuint mask ) */
4508static void
4509android_glStencilMaskSeparate__II
4510 (JNIEnv *_env, jobject _this, jint face, jint mask) {
4511 glStencilMaskSeparate(
4512 (GLenum)face,
4513 (GLuint)mask
4514 );
4515}
4516
4517/* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */
4518static void
4519android_glStencilOp__III
4520 (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) {
4521 glStencilOp(
4522 (GLenum)fail,
4523 (GLenum)zfail,
4524 (GLenum)zpass
4525 );
4526}
4527
4528/* void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) */
4529static void
4530android_glStencilOpSeparate__IIII
4531 (JNIEnv *_env, jobject _this, jint face, jint fail, jint zfail, jint zpass) {
4532 glStencilOpSeparate(
4533 (GLenum)face,
4534 (GLenum)fail,
4535 (GLenum)zfail,
4536 (GLenum)zpass
4537 );
4538}
4539
4540/* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */
4541static void
4542android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2
4543 (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 -08004544 jint _exception = 0;
4545 const char * _exceptionType = NULL;
4546 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004547 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004548 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004549 jint _remaining;
4550 GLvoid *pixels = (GLvoid *) 0;
4551
4552 if (pixels_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004553 pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004554 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -07004555 if (pixels_buf && pixels == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004556 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4557 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08004558 }
4559 glTexImage2D(
4560 (GLenum)target,
4561 (GLint)level,
4562 (GLint)internalformat,
4563 (GLsizei)width,
4564 (GLsizei)height,
4565 (GLint)border,
4566 (GLenum)format,
4567 (GLenum)type,
4568 (GLvoid *)pixels
4569 );
4570 if (_array) {
4571 releasePointer(_env, _array, pixels, JNI_FALSE);
4572 }
Romain Guy84cac202016-12-05 12:26:02 -08004573 if (_exception) {
4574 jniThrowException(_env, _exceptionType, _exceptionMessage);
4575 }
Jack Palevich560814f2009-11-19 16:34:55 +08004576}
4577
4578/* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */
4579static void
4580android_glTexParameterf__IIF
4581 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) {
4582 glTexParameterf(
4583 (GLenum)target,
4584 (GLenum)pname,
4585 (GLfloat)param
4586 );
4587}
4588
4589/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
4590static void
4591android_glTexParameterfv__II_3FI
4592 (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004593 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004594 const char * _exceptionType = NULL;
4595 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004596 GLfloat *params_base = (GLfloat *) 0;
4597 jint _remaining;
4598 GLfloat *params = (GLfloat *) 0;
4599
4600 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004601 _exception = 1;
4602 _exceptionType = "java/lang/IllegalArgumentException";
4603 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004604 goto exit;
4605 }
4606 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004607 _exception = 1;
4608 _exceptionType = "java/lang/IllegalArgumentException";
4609 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004610 goto exit;
4611 }
4612 _remaining = _env->GetArrayLength(params_ref) - offset;
4613 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004614 _exception = 1;
4615 _exceptionType = "java/lang/IllegalArgumentException";
4616 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08004617 goto exit;
4618 }
4619 params_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004620 _env->GetFloatArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08004621 params = params_base + offset;
4622
4623 glTexParameterfv(
4624 (GLenum)target,
4625 (GLenum)pname,
4626 (GLfloat *)params
4627 );
4628
4629exit:
4630 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004631 _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08004632 JNI_ABORT);
4633 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004634 if (_exception) {
4635 jniThrowException(_env, _exceptionType, _exceptionMessage);
4636 }
Jack Palevich560814f2009-11-19 16:34:55 +08004637}
4638
4639/* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */
4640static void
4641android_glTexParameterfv__IILjava_nio_FloatBuffer_2
4642 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004643 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004644 const char * _exceptionType = NULL;
4645 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004646 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004647 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004648 jint _remaining;
4649 GLfloat *params = (GLfloat *) 0;
4650
Romain Guy84cac202016-12-05 12:26:02 -08004651 if (!params_buf) {
4652 _exception = 1;
4653 _exceptionType = "java/lang/IllegalArgumentException";
4654 _exceptionMessage = "params == null";
4655 goto exit;
4656 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004657 params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08004658 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004659 _exception = 1;
4660 _exceptionType = "java/lang/IllegalArgumentException";
4661 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08004662 goto exit;
4663 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004664 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004665 char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004666 params = (GLfloat *) (_paramsBase + _bufferOffset);
4667 }
Jack Palevich560814f2009-11-19 16:34:55 +08004668 glTexParameterfv(
4669 (GLenum)target,
4670 (GLenum)pname,
4671 (GLfloat *)params
4672 );
4673
4674exit:
4675 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004676 _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08004677 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004678 if (_exception) {
4679 jniThrowException(_env, _exceptionType, _exceptionMessage);
4680 }
Jack Palevich560814f2009-11-19 16:34:55 +08004681}
4682
4683/* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */
4684static void
4685android_glTexParameteri__III
4686 (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) {
4687 glTexParameteri(
4688 (GLenum)target,
4689 (GLenum)pname,
4690 (GLint)param
4691 );
4692}
4693
4694/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
4695static void
4696android_glTexParameteriv__II_3II
4697 (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004698 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004699 const char * _exceptionType = NULL;
4700 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004701 GLint *params_base = (GLint *) 0;
4702 jint _remaining;
4703 GLint *params = (GLint *) 0;
4704
4705 if (!params_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004706 _exception = 1;
4707 _exceptionType = "java/lang/IllegalArgumentException";
4708 _exceptionMessage = "params == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004709 goto exit;
4710 }
4711 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004712 _exception = 1;
4713 _exceptionType = "java/lang/IllegalArgumentException";
4714 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004715 goto exit;
4716 }
4717 _remaining = _env->GetArrayLength(params_ref) - offset;
4718 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004719 _exception = 1;
4720 _exceptionType = "java/lang/IllegalArgumentException";
4721 _exceptionMessage = "length - offset < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08004722 goto exit;
4723 }
4724 params_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004725 _env->GetIntArrayElements(params_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08004726 params = params_base + offset;
4727
4728 glTexParameteriv(
4729 (GLenum)target,
4730 (GLenum)pname,
4731 (GLint *)params
4732 );
4733
4734exit:
4735 if (params_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004736 _env->ReleaseIntArrayElements(params_ref, (jint*)params_base,
Jack Palevich560814f2009-11-19 16:34:55 +08004737 JNI_ABORT);
4738 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004739 if (_exception) {
4740 jniThrowException(_env, _exceptionType, _exceptionMessage);
4741 }
Jack Palevich560814f2009-11-19 16:34:55 +08004742}
4743
4744/* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */
4745static void
4746android_glTexParameteriv__IILjava_nio_IntBuffer_2
4747 (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004748 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004749 const char * _exceptionType = NULL;
4750 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004751 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004752 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004753 jint _remaining;
4754 GLint *params = (GLint *) 0;
4755
Romain Guy84cac202016-12-05 12:26:02 -08004756 if (!params_buf) {
4757 _exception = 1;
4758 _exceptionType = "java/lang/IllegalArgumentException";
4759 _exceptionMessage = "params == null";
4760 goto exit;
4761 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004762 params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08004763 if (_remaining < 1) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004764 _exception = 1;
4765 _exceptionType = "java/lang/IllegalArgumentException";
4766 _exceptionMessage = "remaining() < 1 < needed";
Jack Palevich560814f2009-11-19 16:34:55 +08004767 goto exit;
4768 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004769 if (params == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004770 char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004771 params = (GLint *) (_paramsBase + _bufferOffset);
4772 }
Jack Palevich560814f2009-11-19 16:34:55 +08004773 glTexParameteriv(
4774 (GLenum)target,
4775 (GLenum)pname,
4776 (GLint *)params
4777 );
4778
4779exit:
4780 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004781 _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08004782 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004783 if (_exception) {
4784 jniThrowException(_env, _exceptionType, _exceptionMessage);
4785 }
Jack Palevich560814f2009-11-19 16:34:55 +08004786}
4787
4788/* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */
4789static void
4790android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2
4791 (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 -08004792 jint _exception = 0;
4793 const char * _exceptionType = NULL;
4794 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004795 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004796 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004797 jint _remaining;
4798 GLvoid *pixels = (GLvoid *) 0;
4799
4800 if (pixels_buf) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004801 pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004802 }
Thomas Tafertshofer37c9b492012-07-23 16:56:04 -07004803 if (pixels_buf && pixels == NULL) {
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004804 char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
4805 pixels = (GLvoid *) (_pixelsBase + _bufferOffset);
Jack Palevich560814f2009-11-19 16:34:55 +08004806 }
4807 glTexSubImage2D(
4808 (GLenum)target,
4809 (GLint)level,
4810 (GLint)xoffset,
4811 (GLint)yoffset,
4812 (GLsizei)width,
4813 (GLsizei)height,
4814 (GLenum)format,
4815 (GLenum)type,
4816 (GLvoid *)pixels
4817 );
4818 if (_array) {
4819 releasePointer(_env, _array, pixels, JNI_FALSE);
4820 }
Romain Guy84cac202016-12-05 12:26:02 -08004821 if (_exception) {
4822 jniThrowException(_env, _exceptionType, _exceptionMessage);
4823 }
Jack Palevich560814f2009-11-19 16:34:55 +08004824}
4825
4826/* void glUniform1f ( GLint location, GLfloat x ) */
4827static void
4828android_glUniform1f__IF
4829 (JNIEnv *_env, jobject _this, jint location, jfloat x) {
4830 glUniform1f(
4831 (GLint)location,
4832 (GLfloat)x
4833 );
4834}
4835
4836/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
4837static void
4838android_glUniform1fv__II_3FI
4839 (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004840 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004841 const char * _exceptionType = NULL;
4842 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004843 GLfloat *v_base = (GLfloat *) 0;
4844 jint _remaining;
4845 GLfloat *v = (GLfloat *) 0;
4846
4847 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004848 _exception = 1;
4849 _exceptionType = "java/lang/IllegalArgumentException";
4850 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004851 goto exit;
4852 }
4853 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004854 _exception = 1;
4855 _exceptionType = "java/lang/IllegalArgumentException";
4856 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004857 goto exit;
4858 }
4859 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004860 if (_remaining < count) {
4861 _exception = 1;
4862 _exceptionType = "java/lang/IllegalArgumentException";
4863 _exceptionMessage = "length - offset < count < needed";
4864 goto exit;
4865 }
Jack Palevich560814f2009-11-19 16:34:55 +08004866 v_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004867 _env->GetFloatArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08004868 v = v_base + offset;
4869
4870 glUniform1fv(
4871 (GLint)location,
4872 (GLsizei)count,
4873 (GLfloat *)v
4874 );
4875
4876exit:
4877 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004878 _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08004879 JNI_ABORT);
4880 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004881 if (_exception) {
4882 jniThrowException(_env, _exceptionType, _exceptionMessage);
4883 }
Jack Palevich560814f2009-11-19 16:34:55 +08004884}
4885
4886/* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */
4887static void
4888android_glUniform1fv__IILjava_nio_FloatBuffer_2
4889 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08004890 jint _exception = 0;
4891 const char * _exceptionType = NULL;
4892 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004893 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004894 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004895 jint _remaining;
4896 GLfloat *v = (GLfloat *) 0;
4897
Romain Guy84cac202016-12-05 12:26:02 -08004898 if (!v_buf) {
4899 _exception = 1;
4900 _exceptionType = "java/lang/IllegalArgumentException";
4901 _exceptionMessage = "v == null";
4902 goto exit;
4903 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004904 v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08004905 if (_remaining < count) {
4906 _exception = 1;
4907 _exceptionType = "java/lang/IllegalArgumentException";
4908 _exceptionMessage = "remaining() < count < needed";
4909 goto exit;
4910 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004911 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004912 char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004913 v = (GLfloat *) (_vBase + _bufferOffset);
4914 }
Jack Palevich560814f2009-11-19 16:34:55 +08004915 glUniform1fv(
4916 (GLint)location,
4917 (GLsizei)count,
4918 (GLfloat *)v
4919 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08004920
4921exit:
Jack Palevich560814f2009-11-19 16:34:55 +08004922 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004923 _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08004924 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08004925 if (_exception) {
4926 jniThrowException(_env, _exceptionType, _exceptionMessage);
4927 }
Jack Palevich560814f2009-11-19 16:34:55 +08004928}
4929
4930/* void glUniform1i ( GLint location, GLint x ) */
4931static void
4932android_glUniform1i__II
4933 (JNIEnv *_env, jobject _this, jint location, jint x) {
4934 glUniform1i(
4935 (GLint)location,
4936 (GLint)x
4937 );
4938}
4939
4940/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
4941static void
4942android_glUniform1iv__II_3II
4943 (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004944 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004945 const char * _exceptionType = NULL;
4946 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08004947 GLint *v_base = (GLint *) 0;
4948 jint _remaining;
4949 GLint *v = (GLint *) 0;
4950
4951 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004952 _exception = 1;
4953 _exceptionType = "java/lang/IllegalArgumentException";
4954 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08004955 goto exit;
4956 }
4957 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004958 _exception = 1;
4959 _exceptionType = "java/lang/IllegalArgumentException";
4960 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08004961 goto exit;
4962 }
4963 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08004964 if (_remaining < count) {
4965 _exception = 1;
4966 _exceptionType = "java/lang/IllegalArgumentException";
4967 _exceptionMessage = "length - offset < count < needed";
4968 goto exit;
4969 }
Jack Palevich560814f2009-11-19 16:34:55 +08004970 v_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004971 _env->GetIntArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08004972 v = v_base + offset;
4973
4974 glUniform1iv(
4975 (GLint)location,
4976 (GLsizei)count,
4977 (GLint *)v
4978 );
4979
4980exit:
4981 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004982 _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08004983 JNI_ABORT);
4984 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07004985 if (_exception) {
4986 jniThrowException(_env, _exceptionType, _exceptionMessage);
4987 }
Jack Palevich560814f2009-11-19 16:34:55 +08004988}
4989
4990/* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */
4991static void
4992android_glUniform1iv__IILjava_nio_IntBuffer_2
4993 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08004994 jint _exception = 0;
4995 const char * _exceptionType = NULL;
4996 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07004997 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07004998 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08004999 jint _remaining;
5000 GLint *v = (GLint *) 0;
5001
Romain Guy84cac202016-12-05 12:26:02 -08005002 if (!v_buf) {
5003 _exception = 1;
5004 _exceptionType = "java/lang/IllegalArgumentException";
5005 _exceptionMessage = "v == null";
5006 goto exit;
5007 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005008 v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005009 if (_remaining < count) {
5010 _exception = 1;
5011 _exceptionType = "java/lang/IllegalArgumentException";
5012 _exceptionMessage = "remaining() < count < needed";
5013 goto exit;
5014 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005015 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005016 char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005017 v = (GLint *) (_vBase + _bufferOffset);
5018 }
Jack Palevich560814f2009-11-19 16:34:55 +08005019 glUniform1iv(
5020 (GLint)location,
5021 (GLsizei)count,
5022 (GLint *)v
5023 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005024
5025exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005026 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005027 _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005028 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005029 if (_exception) {
5030 jniThrowException(_env, _exceptionType, _exceptionMessage);
5031 }
Jack Palevich560814f2009-11-19 16:34:55 +08005032}
5033
5034/* void glUniform2f ( GLint location, GLfloat x, GLfloat y ) */
5035static void
5036android_glUniform2f__IFF
5037 (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y) {
5038 glUniform2f(
5039 (GLint)location,
5040 (GLfloat)x,
5041 (GLfloat)y
5042 );
5043}
5044
5045/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
5046static void
5047android_glUniform2fv__II_3FI
5048 (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005049 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005050 const char * _exceptionType = NULL;
5051 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005052 GLfloat *v_base = (GLfloat *) 0;
5053 jint _remaining;
5054 GLfloat *v = (GLfloat *) 0;
5055
5056 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005057 _exception = 1;
5058 _exceptionType = "java/lang/IllegalArgumentException";
5059 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005060 goto exit;
5061 }
5062 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005063 _exception = 1;
5064 _exceptionType = "java/lang/IllegalArgumentException";
5065 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005066 goto exit;
5067 }
5068 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005069 if (_remaining < count*2) {
5070 _exception = 1;
5071 _exceptionType = "java/lang/IllegalArgumentException";
5072 _exceptionMessage = "length - offset < count*2 < needed";
5073 goto exit;
5074 }
Jack Palevich560814f2009-11-19 16:34:55 +08005075 v_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005076 _env->GetFloatArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005077 v = v_base + offset;
5078
5079 glUniform2fv(
5080 (GLint)location,
5081 (GLsizei)count,
5082 (GLfloat *)v
5083 );
5084
5085exit:
5086 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005087 _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005088 JNI_ABORT);
5089 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005090 if (_exception) {
5091 jniThrowException(_env, _exceptionType, _exceptionMessage);
5092 }
Jack Palevich560814f2009-11-19 16:34:55 +08005093}
5094
5095/* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */
5096static void
5097android_glUniform2fv__IILjava_nio_FloatBuffer_2
5098 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005099 jint _exception = 0;
5100 const char * _exceptionType = NULL;
5101 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005102 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005103 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005104 jint _remaining;
5105 GLfloat *v = (GLfloat *) 0;
5106
Romain Guy84cac202016-12-05 12:26:02 -08005107 if (!v_buf) {
5108 _exception = 1;
5109 _exceptionType = "java/lang/IllegalArgumentException";
5110 _exceptionMessage = "v == null";
5111 goto exit;
5112 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005113 v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005114 if (_remaining < count*2) {
5115 _exception = 1;
5116 _exceptionType = "java/lang/IllegalArgumentException";
5117 _exceptionMessage = "remaining() < count*2 < needed";
5118 goto exit;
5119 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005120 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005121 char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005122 v = (GLfloat *) (_vBase + _bufferOffset);
5123 }
Jack Palevich560814f2009-11-19 16:34:55 +08005124 glUniform2fv(
5125 (GLint)location,
5126 (GLsizei)count,
5127 (GLfloat *)v
5128 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005129
5130exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005131 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005132 _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005133 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005134 if (_exception) {
5135 jniThrowException(_env, _exceptionType, _exceptionMessage);
5136 }
Jack Palevich560814f2009-11-19 16:34:55 +08005137}
5138
5139/* void glUniform2i ( GLint location, GLint x, GLint y ) */
5140static void
5141android_glUniform2i__III
5142 (JNIEnv *_env, jobject _this, jint location, jint x, jint y) {
5143 glUniform2i(
5144 (GLint)location,
5145 (GLint)x,
5146 (GLint)y
5147 );
5148}
5149
5150/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
5151static void
5152android_glUniform2iv__II_3II
5153 (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005154 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005155 const char * _exceptionType = NULL;
5156 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005157 GLint *v_base = (GLint *) 0;
5158 jint _remaining;
5159 GLint *v = (GLint *) 0;
5160
5161 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005162 _exception = 1;
5163 _exceptionType = "java/lang/IllegalArgumentException";
5164 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005165 goto exit;
5166 }
5167 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005168 _exception = 1;
5169 _exceptionType = "java/lang/IllegalArgumentException";
5170 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005171 goto exit;
5172 }
5173 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005174 if (_remaining < count*2) {
5175 _exception = 1;
5176 _exceptionType = "java/lang/IllegalArgumentException";
5177 _exceptionMessage = "length - offset < count*2 < needed";
5178 goto exit;
5179 }
Jack Palevich560814f2009-11-19 16:34:55 +08005180 v_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005181 _env->GetIntArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005182 v = v_base + offset;
5183
5184 glUniform2iv(
5185 (GLint)location,
5186 (GLsizei)count,
5187 (GLint *)v
5188 );
5189
5190exit:
5191 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005192 _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005193 JNI_ABORT);
5194 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005195 if (_exception) {
5196 jniThrowException(_env, _exceptionType, _exceptionMessage);
5197 }
Jack Palevich560814f2009-11-19 16:34:55 +08005198}
5199
5200/* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */
5201static void
5202android_glUniform2iv__IILjava_nio_IntBuffer_2
5203 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005204 jint _exception = 0;
5205 const char * _exceptionType = NULL;
5206 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005207 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005208 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005209 jint _remaining;
5210 GLint *v = (GLint *) 0;
5211
Romain Guy84cac202016-12-05 12:26:02 -08005212 if (!v_buf) {
5213 _exception = 1;
5214 _exceptionType = "java/lang/IllegalArgumentException";
5215 _exceptionMessage = "v == null";
5216 goto exit;
5217 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005218 v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005219 if (_remaining < count*2) {
5220 _exception = 1;
5221 _exceptionType = "java/lang/IllegalArgumentException";
5222 _exceptionMessage = "remaining() < count*2 < needed";
5223 goto exit;
5224 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005225 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005226 char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005227 v = (GLint *) (_vBase + _bufferOffset);
5228 }
Jack Palevich560814f2009-11-19 16:34:55 +08005229 glUniform2iv(
5230 (GLint)location,
5231 (GLsizei)count,
5232 (GLint *)v
5233 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005234
5235exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005236 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005237 _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005238 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005239 if (_exception) {
5240 jniThrowException(_env, _exceptionType, _exceptionMessage);
5241 }
Jack Palevich560814f2009-11-19 16:34:55 +08005242}
5243
5244/* void glUniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z ) */
5245static void
5246android_glUniform3f__IFFF
5247 (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z) {
5248 glUniform3f(
5249 (GLint)location,
5250 (GLfloat)x,
5251 (GLfloat)y,
5252 (GLfloat)z
5253 );
5254}
5255
5256/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
5257static void
5258android_glUniform3fv__II_3FI
5259 (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005260 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005261 const char * _exceptionType = NULL;
5262 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005263 GLfloat *v_base = (GLfloat *) 0;
5264 jint _remaining;
5265 GLfloat *v = (GLfloat *) 0;
5266
5267 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005268 _exception = 1;
5269 _exceptionType = "java/lang/IllegalArgumentException";
5270 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005271 goto exit;
5272 }
5273 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005274 _exception = 1;
5275 _exceptionType = "java/lang/IllegalArgumentException";
5276 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005277 goto exit;
5278 }
5279 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005280 if (_remaining < count*3) {
5281 _exception = 1;
5282 _exceptionType = "java/lang/IllegalArgumentException";
5283 _exceptionMessage = "length - offset < count*3 < needed";
5284 goto exit;
5285 }
Jack Palevich560814f2009-11-19 16:34:55 +08005286 v_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005287 _env->GetFloatArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005288 v = v_base + offset;
5289
5290 glUniform3fv(
5291 (GLint)location,
5292 (GLsizei)count,
5293 (GLfloat *)v
5294 );
5295
5296exit:
5297 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005298 _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005299 JNI_ABORT);
5300 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005301 if (_exception) {
5302 jniThrowException(_env, _exceptionType, _exceptionMessage);
5303 }
Jack Palevich560814f2009-11-19 16:34:55 +08005304}
5305
5306/* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */
5307static void
5308android_glUniform3fv__IILjava_nio_FloatBuffer_2
5309 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005310 jint _exception = 0;
5311 const char * _exceptionType = NULL;
5312 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005313 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005314 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005315 jint _remaining;
5316 GLfloat *v = (GLfloat *) 0;
5317
Romain Guy84cac202016-12-05 12:26:02 -08005318 if (!v_buf) {
5319 _exception = 1;
5320 _exceptionType = "java/lang/IllegalArgumentException";
5321 _exceptionMessage = "v == null";
5322 goto exit;
5323 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005324 v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005325 if (_remaining < count*3) {
5326 _exception = 1;
5327 _exceptionType = "java/lang/IllegalArgumentException";
5328 _exceptionMessage = "remaining() < count*3 < needed";
5329 goto exit;
5330 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005331 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005332 char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005333 v = (GLfloat *) (_vBase + _bufferOffset);
5334 }
Jack Palevich560814f2009-11-19 16:34:55 +08005335 glUniform3fv(
5336 (GLint)location,
5337 (GLsizei)count,
5338 (GLfloat *)v
5339 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005340
5341exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005342 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005343 _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005344 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005345 if (_exception) {
5346 jniThrowException(_env, _exceptionType, _exceptionMessage);
5347 }
Jack Palevich560814f2009-11-19 16:34:55 +08005348}
5349
5350/* void glUniform3i ( GLint location, GLint x, GLint y, GLint z ) */
5351static void
5352android_glUniform3i__IIII
5353 (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z) {
5354 glUniform3i(
5355 (GLint)location,
5356 (GLint)x,
5357 (GLint)y,
5358 (GLint)z
5359 );
5360}
5361
5362/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
5363static void
5364android_glUniform3iv__II_3II
5365 (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005366 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005367 const char * _exceptionType = NULL;
5368 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005369 GLint *v_base = (GLint *) 0;
5370 jint _remaining;
5371 GLint *v = (GLint *) 0;
5372
5373 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005374 _exception = 1;
5375 _exceptionType = "java/lang/IllegalArgumentException";
5376 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005377 goto exit;
5378 }
5379 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005380 _exception = 1;
5381 _exceptionType = "java/lang/IllegalArgumentException";
5382 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005383 goto exit;
5384 }
5385 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005386 if (_remaining < count*3) {
5387 _exception = 1;
5388 _exceptionType = "java/lang/IllegalArgumentException";
5389 _exceptionMessage = "length - offset < count*3 < needed";
5390 goto exit;
5391 }
Jack Palevich560814f2009-11-19 16:34:55 +08005392 v_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005393 _env->GetIntArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005394 v = v_base + offset;
5395
5396 glUniform3iv(
5397 (GLint)location,
5398 (GLsizei)count,
5399 (GLint *)v
5400 );
5401
5402exit:
5403 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005404 _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005405 JNI_ABORT);
5406 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005407 if (_exception) {
5408 jniThrowException(_env, _exceptionType, _exceptionMessage);
5409 }
Jack Palevich560814f2009-11-19 16:34:55 +08005410}
5411
5412/* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */
5413static void
5414android_glUniform3iv__IILjava_nio_IntBuffer_2
5415 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005416 jint _exception = 0;
5417 const char * _exceptionType = NULL;
5418 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005419 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005420 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005421 jint _remaining;
5422 GLint *v = (GLint *) 0;
5423
Romain Guy84cac202016-12-05 12:26:02 -08005424 if (!v_buf) {
5425 _exception = 1;
5426 _exceptionType = "java/lang/IllegalArgumentException";
5427 _exceptionMessage = "v == null";
5428 goto exit;
5429 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005430 v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005431 if (_remaining < count*3) {
5432 _exception = 1;
5433 _exceptionType = "java/lang/IllegalArgumentException";
5434 _exceptionMessage = "remaining() < count*3 < needed";
5435 goto exit;
5436 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005437 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005438 char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005439 v = (GLint *) (_vBase + _bufferOffset);
5440 }
Jack Palevich560814f2009-11-19 16:34:55 +08005441 glUniform3iv(
5442 (GLint)location,
5443 (GLsizei)count,
5444 (GLint *)v
5445 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005446
5447exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005448 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005449 _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005450 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005451 if (_exception) {
5452 jniThrowException(_env, _exceptionType, _exceptionMessage);
5453 }
Jack Palevich560814f2009-11-19 16:34:55 +08005454}
5455
5456/* void glUniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
5457static void
5458android_glUniform4f__IFFFF
5459 (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z, jfloat w) {
5460 glUniform4f(
5461 (GLint)location,
5462 (GLfloat)x,
5463 (GLfloat)y,
5464 (GLfloat)z,
5465 (GLfloat)w
5466 );
5467}
5468
5469/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
5470static void
5471android_glUniform4fv__II_3FI
5472 (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005473 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005474 const char * _exceptionType = NULL;
5475 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005476 GLfloat *v_base = (GLfloat *) 0;
5477 jint _remaining;
5478 GLfloat *v = (GLfloat *) 0;
5479
5480 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005481 _exception = 1;
5482 _exceptionType = "java/lang/IllegalArgumentException";
5483 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005484 goto exit;
5485 }
5486 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005487 _exception = 1;
5488 _exceptionType = "java/lang/IllegalArgumentException";
5489 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005490 goto exit;
5491 }
5492 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005493 if (_remaining < count*4) {
5494 _exception = 1;
5495 _exceptionType = "java/lang/IllegalArgumentException";
5496 _exceptionMessage = "length - offset < count*4 < needed";
5497 goto exit;
5498 }
Jack Palevich560814f2009-11-19 16:34:55 +08005499 v_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005500 _env->GetFloatArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005501 v = v_base + offset;
5502
5503 glUniform4fv(
5504 (GLint)location,
5505 (GLsizei)count,
5506 (GLfloat *)v
5507 );
5508
5509exit:
5510 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005511 _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005512 JNI_ABORT);
5513 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005514 if (_exception) {
5515 jniThrowException(_env, _exceptionType, _exceptionMessage);
5516 }
Jack Palevich560814f2009-11-19 16:34:55 +08005517}
5518
5519/* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */
5520static void
5521android_glUniform4fv__IILjava_nio_FloatBuffer_2
5522 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005523 jint _exception = 0;
5524 const char * _exceptionType = NULL;
5525 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005526 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005527 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005528 jint _remaining;
5529 GLfloat *v = (GLfloat *) 0;
5530
Romain Guy84cac202016-12-05 12:26:02 -08005531 if (!v_buf) {
5532 _exception = 1;
5533 _exceptionType = "java/lang/IllegalArgumentException";
5534 _exceptionMessage = "v == null";
5535 goto exit;
5536 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005537 v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005538 if (_remaining < count*4) {
5539 _exception = 1;
5540 _exceptionType = "java/lang/IllegalArgumentException";
5541 _exceptionMessage = "remaining() < count*4 < needed";
5542 goto exit;
5543 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005544 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005545 char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005546 v = (GLfloat *) (_vBase + _bufferOffset);
5547 }
Jack Palevich560814f2009-11-19 16:34:55 +08005548 glUniform4fv(
5549 (GLint)location,
5550 (GLsizei)count,
5551 (GLfloat *)v
5552 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005553
5554exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005555 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005556 _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005557 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005558 if (_exception) {
5559 jniThrowException(_env, _exceptionType, _exceptionMessage);
5560 }
Jack Palevich560814f2009-11-19 16:34:55 +08005561}
5562
5563/* void glUniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w ) */
5564static void
5565android_glUniform4i__IIIII
5566 (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z, jint w) {
5567 glUniform4i(
5568 (GLint)location,
5569 (GLint)x,
5570 (GLint)y,
5571 (GLint)z,
5572 (GLint)w
5573 );
5574}
5575
5576/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
5577static void
5578android_glUniform4iv__II_3II
5579 (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005580 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005581 const char * _exceptionType = NULL;
5582 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005583 GLint *v_base = (GLint *) 0;
5584 jint _remaining;
5585 GLint *v = (GLint *) 0;
5586
5587 if (!v_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005588 _exception = 1;
5589 _exceptionType = "java/lang/IllegalArgumentException";
5590 _exceptionMessage = "v == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005591 goto exit;
5592 }
5593 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005594 _exception = 1;
5595 _exceptionType = "java/lang/IllegalArgumentException";
5596 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005597 goto exit;
5598 }
5599 _remaining = _env->GetArrayLength(v_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005600 if (_remaining < count*4) {
5601 _exception = 1;
5602 _exceptionType = "java/lang/IllegalArgumentException";
5603 _exceptionMessage = "length - offset < count*4 < needed";
5604 goto exit;
5605 }
Jack Palevich560814f2009-11-19 16:34:55 +08005606 v_base = (GLint *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005607 _env->GetIntArrayElements(v_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005608 v = v_base + offset;
5609
5610 glUniform4iv(
5611 (GLint)location,
5612 (GLsizei)count,
5613 (GLint *)v
5614 );
5615
5616exit:
5617 if (v_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005618 _env->ReleaseIntArrayElements(v_ref, (jint*)v_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005619 JNI_ABORT);
5620 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005621 if (_exception) {
5622 jniThrowException(_env, _exceptionType, _exceptionMessage);
5623 }
Jack Palevich560814f2009-11-19 16:34:55 +08005624}
5625
5626/* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */
5627static void
5628android_glUniform4iv__IILjava_nio_IntBuffer_2
5629 (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005630 jint _exception = 0;
5631 const char * _exceptionType = NULL;
5632 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005633 jintArray _array = (jintArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005634 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005635 jint _remaining;
5636 GLint *v = (GLint *) 0;
5637
Romain Guy84cac202016-12-05 12:26:02 -08005638 if (!v_buf) {
5639 _exception = 1;
5640 _exceptionType = "java/lang/IllegalArgumentException";
5641 _exceptionMessage = "v == null";
5642 goto exit;
5643 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005644 v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005645 if (_remaining < count*4) {
5646 _exception = 1;
5647 _exceptionType = "java/lang/IllegalArgumentException";
5648 _exceptionMessage = "remaining() < count*4 < needed";
5649 goto exit;
5650 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005651 if (v == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005652 char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005653 v = (GLint *) (_vBase + _bufferOffset);
5654 }
Jack Palevich560814f2009-11-19 16:34:55 +08005655 glUniform4iv(
5656 (GLint)location,
5657 (GLsizei)count,
5658 (GLint *)v
5659 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005660
5661exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005662 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005663 _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005664 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005665 if (_exception) {
5666 jniThrowException(_env, _exceptionType, _exceptionMessage);
5667 }
Jack Palevich560814f2009-11-19 16:34:55 +08005668}
5669
5670/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5671static void
5672android_glUniformMatrix2fv__IIZ_3FI
5673 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005674 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005675 const char * _exceptionType = NULL;
5676 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005677 GLfloat *value_base = (GLfloat *) 0;
5678 jint _remaining;
5679 GLfloat *value = (GLfloat *) 0;
5680
5681 if (!value_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005682 _exception = 1;
5683 _exceptionType = "java/lang/IllegalArgumentException";
5684 _exceptionMessage = "value == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005685 goto exit;
5686 }
5687 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005688 _exception = 1;
5689 _exceptionType = "java/lang/IllegalArgumentException";
5690 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005691 goto exit;
5692 }
5693 _remaining = _env->GetArrayLength(value_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005694 if (_remaining < count*4) {
5695 _exception = 1;
5696 _exceptionType = "java/lang/IllegalArgumentException";
5697 _exceptionMessage = "length - offset < count*4 < needed";
5698 goto exit;
5699 }
Jack Palevich560814f2009-11-19 16:34:55 +08005700 value_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005701 _env->GetFloatArrayElements(value_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005702 value = value_base + offset;
5703
5704 glUniformMatrix2fv(
5705 (GLint)location,
5706 (GLsizei)count,
5707 (GLboolean)transpose,
5708 (GLfloat *)value
5709 );
5710
5711exit:
5712 if (value_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005713 _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005714 JNI_ABORT);
5715 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005716 if (_exception) {
5717 jniThrowException(_env, _exceptionType, _exceptionMessage);
5718 }
Jack Palevich560814f2009-11-19 16:34:55 +08005719}
5720
5721/* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5722static void
5723android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2
5724 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005725 jint _exception = 0;
5726 const char * _exceptionType = NULL;
5727 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005728 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005729 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005730 jint _remaining;
5731 GLfloat *value = (GLfloat *) 0;
5732
Romain Guy84cac202016-12-05 12:26:02 -08005733 if (!value_buf) {
5734 _exception = 1;
5735 _exceptionType = "java/lang/IllegalArgumentException";
5736 _exceptionMessage = "value == null";
5737 goto exit;
5738 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005739 value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005740 if (_remaining < count*4) {
5741 _exception = 1;
5742 _exceptionType = "java/lang/IllegalArgumentException";
5743 _exceptionMessage = "remaining() < count*4 < needed";
5744 goto exit;
5745 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005746 if (value == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005747 char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005748 value = (GLfloat *) (_valueBase + _bufferOffset);
5749 }
Jack Palevich560814f2009-11-19 16:34:55 +08005750 glUniformMatrix2fv(
5751 (GLint)location,
5752 (GLsizei)count,
5753 (GLboolean)transpose,
5754 (GLfloat *)value
5755 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005756
5757exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005758 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005759 _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005760 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005761 if (_exception) {
5762 jniThrowException(_env, _exceptionType, _exceptionMessage);
5763 }
Jack Palevich560814f2009-11-19 16:34:55 +08005764}
5765
5766/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5767static void
5768android_glUniformMatrix3fv__IIZ_3FI
5769 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005770 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005771 const char * _exceptionType = NULL;
5772 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005773 GLfloat *value_base = (GLfloat *) 0;
5774 jint _remaining;
5775 GLfloat *value = (GLfloat *) 0;
5776
5777 if (!value_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005778 _exception = 1;
5779 _exceptionType = "java/lang/IllegalArgumentException";
5780 _exceptionMessage = "value == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005781 goto exit;
5782 }
5783 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005784 _exception = 1;
5785 _exceptionType = "java/lang/IllegalArgumentException";
5786 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005787 goto exit;
5788 }
5789 _remaining = _env->GetArrayLength(value_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005790 if (_remaining < count*9) {
5791 _exception = 1;
5792 _exceptionType = "java/lang/IllegalArgumentException";
5793 _exceptionMessage = "length - offset < count*9 < needed";
5794 goto exit;
5795 }
Jack Palevich560814f2009-11-19 16:34:55 +08005796 value_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005797 _env->GetFloatArrayElements(value_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005798 value = value_base + offset;
5799
5800 glUniformMatrix3fv(
5801 (GLint)location,
5802 (GLsizei)count,
5803 (GLboolean)transpose,
5804 (GLfloat *)value
5805 );
5806
5807exit:
5808 if (value_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005809 _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005810 JNI_ABORT);
5811 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005812 if (_exception) {
5813 jniThrowException(_env, _exceptionType, _exceptionMessage);
5814 }
Jack Palevich560814f2009-11-19 16:34:55 +08005815}
5816
5817/* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5818static void
5819android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2
5820 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005821 jint _exception = 0;
5822 const char * _exceptionType = NULL;
5823 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005824 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005825 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005826 jint _remaining;
5827 GLfloat *value = (GLfloat *) 0;
5828
Romain Guy84cac202016-12-05 12:26:02 -08005829 if (!value_buf) {
5830 _exception = 1;
5831 _exceptionType = "java/lang/IllegalArgumentException";
5832 _exceptionMessage = "value == null";
5833 goto exit;
5834 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005835 value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005836 if (_remaining < count*9) {
5837 _exception = 1;
5838 _exceptionType = "java/lang/IllegalArgumentException";
5839 _exceptionMessage = "remaining() < count*9 < needed";
5840 goto exit;
5841 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005842 if (value == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005843 char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005844 value = (GLfloat *) (_valueBase + _bufferOffset);
5845 }
Jack Palevich560814f2009-11-19 16:34:55 +08005846 glUniformMatrix3fv(
5847 (GLint)location,
5848 (GLsizei)count,
5849 (GLboolean)transpose,
5850 (GLfloat *)value
5851 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005852
5853exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005854 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005855 _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005856 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005857 if (_exception) {
5858 jniThrowException(_env, _exceptionType, _exceptionMessage);
5859 }
Jack Palevich560814f2009-11-19 16:34:55 +08005860}
5861
5862/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5863static void
5864android_glUniformMatrix4fv__IIZ_3FI
5865 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005866 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005867 const char * _exceptionType = NULL;
5868 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005869 GLfloat *value_base = (GLfloat *) 0;
5870 jint _remaining;
5871 GLfloat *value = (GLfloat *) 0;
5872
5873 if (!value_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005874 _exception = 1;
5875 _exceptionType = "java/lang/IllegalArgumentException";
5876 _exceptionMessage = "value == null";
Jack Palevich560814f2009-11-19 16:34:55 +08005877 goto exit;
5878 }
5879 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005880 _exception = 1;
5881 _exceptionType = "java/lang/IllegalArgumentException";
5882 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08005883 goto exit;
5884 }
5885 _remaining = _env->GetArrayLength(value_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005886 if (_remaining < count*16) {
5887 _exception = 1;
5888 _exceptionType = "java/lang/IllegalArgumentException";
5889 _exceptionMessage = "length - offset < count*16 < needed";
5890 goto exit;
5891 }
Jack Palevich560814f2009-11-19 16:34:55 +08005892 value_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005893 _env->GetFloatArrayElements(value_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08005894 value = value_base + offset;
5895
5896 glUniformMatrix4fv(
5897 (GLint)location,
5898 (GLsizei)count,
5899 (GLboolean)transpose,
5900 (GLfloat *)value
5901 );
5902
5903exit:
5904 if (value_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005905 _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base,
Jack Palevich560814f2009-11-19 16:34:55 +08005906 JNI_ABORT);
5907 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005908 if (_exception) {
5909 jniThrowException(_env, _exceptionType, _exceptionMessage);
5910 }
Jack Palevich560814f2009-11-19 16:34:55 +08005911}
5912
5913/* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */
5914static void
5915android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2
5916 (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08005917 jint _exception = 0;
5918 const char * _exceptionType = NULL;
5919 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005920 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005921 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08005922 jint _remaining;
5923 GLfloat *value = (GLfloat *) 0;
5924
Romain Guy84cac202016-12-05 12:26:02 -08005925 if (!value_buf) {
5926 _exception = 1;
5927 _exceptionType = "java/lang/IllegalArgumentException";
5928 _exceptionMessage = "value == null";
5929 goto exit;
5930 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005931 value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08005932 if (_remaining < count*16) {
5933 _exception = 1;
5934 _exceptionType = "java/lang/IllegalArgumentException";
5935 _exceptionMessage = "remaining() < count*16 < needed";
5936 goto exit;
5937 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005938 if (value == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005939 char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07005940 value = (GLfloat *) (_valueBase + _bufferOffset);
5941 }
Jack Palevich560814f2009-11-19 16:34:55 +08005942 glUniformMatrix4fv(
5943 (GLint)location,
5944 (GLsizei)count,
5945 (GLboolean)transpose,
5946 (GLfloat *)value
5947 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08005948
5949exit:
Jack Palevich560814f2009-11-19 16:34:55 +08005950 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07005951 _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08005952 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08005953 if (_exception) {
5954 jniThrowException(_env, _exceptionType, _exceptionMessage);
5955 }
Jack Palevich560814f2009-11-19 16:34:55 +08005956}
5957
5958/* void glUseProgram ( GLuint program ) */
5959static void
5960android_glUseProgram__I
5961 (JNIEnv *_env, jobject _this, jint program) {
5962 glUseProgram(
5963 (GLuint)program
5964 );
5965}
5966
5967/* void glValidateProgram ( GLuint program ) */
5968static void
5969android_glValidateProgram__I
5970 (JNIEnv *_env, jobject _this, jint program) {
5971 glValidateProgram(
5972 (GLuint)program
5973 );
5974}
5975
5976/* void glVertexAttrib1f ( GLuint indx, GLfloat x ) */
5977static void
5978android_glVertexAttrib1f__IF
5979 (JNIEnv *_env, jobject _this, jint indx, jfloat x) {
5980 glVertexAttrib1f(
5981 (GLuint)indx,
5982 (GLfloat)x
5983 );
5984}
5985
5986/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
5987static void
5988android_glVertexAttrib1fv__I_3FI
5989 (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005990 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08005991 const char * _exceptionType = NULL;
5992 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08005993 GLfloat *values_base = (GLfloat *) 0;
5994 jint _remaining;
5995 GLfloat *values = (GLfloat *) 0;
5996
5997 if (!values_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07005998 _exception = 1;
5999 _exceptionType = "java/lang/IllegalArgumentException";
6000 _exceptionMessage = "values == null";
Jack Palevich560814f2009-11-19 16:34:55 +08006001 goto exit;
6002 }
6003 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006004 _exception = 1;
6005 _exceptionType = "java/lang/IllegalArgumentException";
6006 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08006007 goto exit;
6008 }
6009 _remaining = _env->GetArrayLength(values_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08006010 if (_remaining < 1) {
6011 _exception = 1;
6012 _exceptionType = "java/lang/IllegalArgumentException";
6013 _exceptionMessage = "length - offset < 1 < needed";
6014 goto exit;
6015 }
Jack Palevich560814f2009-11-19 16:34:55 +08006016 values_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006017 _env->GetFloatArrayElements(values_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08006018 values = values_base + offset;
6019
6020 glVertexAttrib1fv(
6021 (GLuint)indx,
6022 (GLfloat *)values
6023 );
6024
6025exit:
6026 if (values_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006027 _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
Jack Palevich560814f2009-11-19 16:34:55 +08006028 JNI_ABORT);
6029 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006030 if (_exception) {
6031 jniThrowException(_env, _exceptionType, _exceptionMessage);
6032 }
Jack Palevich560814f2009-11-19 16:34:55 +08006033}
6034
6035/* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */
6036static void
6037android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2
6038 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08006039 jint _exception = 0;
6040 const char * _exceptionType = NULL;
6041 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006042 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006043 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08006044 jint _remaining;
6045 GLfloat *values = (GLfloat *) 0;
6046
Romain Guy84cac202016-12-05 12:26:02 -08006047 if (!values_buf) {
6048 _exception = 1;
6049 _exceptionType = "java/lang/IllegalArgumentException";
6050 _exceptionMessage = "values == null";
6051 goto exit;
6052 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006053 values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08006054 if (_remaining < 1) {
6055 _exception = 1;
6056 _exceptionType = "java/lang/IllegalArgumentException";
6057 _exceptionMessage = "remaining() < 1 < needed";
6058 goto exit;
6059 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006060 if (values == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006061 char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006062 values = (GLfloat *) (_valuesBase + _bufferOffset);
6063 }
Jack Palevich560814f2009-11-19 16:34:55 +08006064 glVertexAttrib1fv(
6065 (GLuint)indx,
6066 (GLfloat *)values
6067 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08006068
6069exit:
Jack Palevich560814f2009-11-19 16:34:55 +08006070 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006071 _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08006072 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08006073 if (_exception) {
6074 jniThrowException(_env, _exceptionType, _exceptionMessage);
6075 }
Jack Palevich560814f2009-11-19 16:34:55 +08006076}
6077
6078/* void glVertexAttrib2f ( GLuint indx, GLfloat x, GLfloat y ) */
6079static void
6080android_glVertexAttrib2f__IFF
6081 (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y) {
6082 glVertexAttrib2f(
6083 (GLuint)indx,
6084 (GLfloat)x,
6085 (GLfloat)y
6086 );
6087}
6088
6089/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
6090static void
6091android_glVertexAttrib2fv__I_3FI
6092 (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006093 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08006094 const char * _exceptionType = NULL;
6095 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08006096 GLfloat *values_base = (GLfloat *) 0;
6097 jint _remaining;
6098 GLfloat *values = (GLfloat *) 0;
6099
6100 if (!values_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006101 _exception = 1;
6102 _exceptionType = "java/lang/IllegalArgumentException";
6103 _exceptionMessage = "values == null";
Jack Palevich560814f2009-11-19 16:34:55 +08006104 goto exit;
6105 }
6106 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006107 _exception = 1;
6108 _exceptionType = "java/lang/IllegalArgumentException";
6109 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08006110 goto exit;
6111 }
6112 _remaining = _env->GetArrayLength(values_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08006113 if (_remaining < 2) {
6114 _exception = 1;
6115 _exceptionType = "java/lang/IllegalArgumentException";
6116 _exceptionMessage = "length - offset < 2 < needed";
6117 goto exit;
6118 }
Jack Palevich560814f2009-11-19 16:34:55 +08006119 values_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006120 _env->GetFloatArrayElements(values_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08006121 values = values_base + offset;
6122
6123 glVertexAttrib2fv(
6124 (GLuint)indx,
6125 (GLfloat *)values
6126 );
6127
6128exit:
6129 if (values_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006130 _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
Jack Palevich560814f2009-11-19 16:34:55 +08006131 JNI_ABORT);
6132 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006133 if (_exception) {
6134 jniThrowException(_env, _exceptionType, _exceptionMessage);
6135 }
Jack Palevich560814f2009-11-19 16:34:55 +08006136}
6137
6138/* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */
6139static void
6140android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2
6141 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08006142 jint _exception = 0;
6143 const char * _exceptionType = NULL;
6144 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006145 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006146 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08006147 jint _remaining;
6148 GLfloat *values = (GLfloat *) 0;
6149
Romain Guy84cac202016-12-05 12:26:02 -08006150 if (!values_buf) {
6151 _exception = 1;
6152 _exceptionType = "java/lang/IllegalArgumentException";
6153 _exceptionMessage = "values == null";
6154 goto exit;
6155 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006156 values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08006157 if (_remaining < 2) {
6158 _exception = 1;
6159 _exceptionType = "java/lang/IllegalArgumentException";
6160 _exceptionMessage = "remaining() < 2 < needed";
6161 goto exit;
6162 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006163 if (values == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006164 char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006165 values = (GLfloat *) (_valuesBase + _bufferOffset);
6166 }
Jack Palevich560814f2009-11-19 16:34:55 +08006167 glVertexAttrib2fv(
6168 (GLuint)indx,
6169 (GLfloat *)values
6170 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08006171
6172exit:
Jack Palevich560814f2009-11-19 16:34:55 +08006173 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006174 _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08006175 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08006176 if (_exception) {
6177 jniThrowException(_env, _exceptionType, _exceptionMessage);
6178 }
Jack Palevich560814f2009-11-19 16:34:55 +08006179}
6180
6181/* void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z ) */
6182static void
6183android_glVertexAttrib3f__IFFF
6184 (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z) {
6185 glVertexAttrib3f(
6186 (GLuint)indx,
6187 (GLfloat)x,
6188 (GLfloat)y,
6189 (GLfloat)z
6190 );
6191}
6192
6193/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
6194static void
6195android_glVertexAttrib3fv__I_3FI
6196 (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006197 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08006198 const char * _exceptionType = NULL;
6199 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08006200 GLfloat *values_base = (GLfloat *) 0;
6201 jint _remaining;
6202 GLfloat *values = (GLfloat *) 0;
6203
6204 if (!values_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006205 _exception = 1;
6206 _exceptionType = "java/lang/IllegalArgumentException";
6207 _exceptionMessage = "values == null";
Jack Palevich560814f2009-11-19 16:34:55 +08006208 goto exit;
6209 }
6210 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006211 _exception = 1;
6212 _exceptionType = "java/lang/IllegalArgumentException";
6213 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08006214 goto exit;
6215 }
6216 _remaining = _env->GetArrayLength(values_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08006217 if (_remaining < 3) {
6218 _exception = 1;
6219 _exceptionType = "java/lang/IllegalArgumentException";
6220 _exceptionMessage = "length - offset < 3 < needed";
6221 goto exit;
6222 }
Jack Palevich560814f2009-11-19 16:34:55 +08006223 values_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006224 _env->GetFloatArrayElements(values_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08006225 values = values_base + offset;
6226
6227 glVertexAttrib3fv(
6228 (GLuint)indx,
6229 (GLfloat *)values
6230 );
6231
6232exit:
6233 if (values_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006234 _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
Jack Palevich560814f2009-11-19 16:34:55 +08006235 JNI_ABORT);
6236 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006237 if (_exception) {
6238 jniThrowException(_env, _exceptionType, _exceptionMessage);
6239 }
Jack Palevich560814f2009-11-19 16:34:55 +08006240}
6241
6242/* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */
6243static void
6244android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2
6245 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08006246 jint _exception = 0;
6247 const char * _exceptionType = NULL;
6248 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006249 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006250 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08006251 jint _remaining;
6252 GLfloat *values = (GLfloat *) 0;
6253
Romain Guy84cac202016-12-05 12:26:02 -08006254 if (!values_buf) {
6255 _exception = 1;
6256 _exceptionType = "java/lang/IllegalArgumentException";
6257 _exceptionMessage = "values == null";
6258 goto exit;
6259 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006260 values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08006261 if (_remaining < 3) {
6262 _exception = 1;
6263 _exceptionType = "java/lang/IllegalArgumentException";
6264 _exceptionMessage = "remaining() < 3 < needed";
6265 goto exit;
6266 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006267 if (values == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006268 char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006269 values = (GLfloat *) (_valuesBase + _bufferOffset);
6270 }
Jack Palevich560814f2009-11-19 16:34:55 +08006271 glVertexAttrib3fv(
6272 (GLuint)indx,
6273 (GLfloat *)values
6274 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08006275
6276exit:
Jack Palevich560814f2009-11-19 16:34:55 +08006277 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006278 _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08006279 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08006280 if (_exception) {
6281 jniThrowException(_env, _exceptionType, _exceptionMessage);
6282 }
Jack Palevich560814f2009-11-19 16:34:55 +08006283}
6284
6285/* void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */
6286static void
6287android_glVertexAttrib4f__IFFFF
6288 (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z, jfloat w) {
6289 glVertexAttrib4f(
6290 (GLuint)indx,
6291 (GLfloat)x,
6292 (GLfloat)y,
6293 (GLfloat)z,
6294 (GLfloat)w
6295 );
6296}
6297
6298/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
6299static void
6300android_glVertexAttrib4fv__I_3FI
6301 (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006302 jint _exception = 0;
Mathias Agopian2ad04772013-02-23 03:12:30 -08006303 const char * _exceptionType = NULL;
6304 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08006305 GLfloat *values_base = (GLfloat *) 0;
6306 jint _remaining;
6307 GLfloat *values = (GLfloat *) 0;
6308
6309 if (!values_ref) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006310 _exception = 1;
6311 _exceptionType = "java/lang/IllegalArgumentException";
6312 _exceptionMessage = "values == null";
Jack Palevich560814f2009-11-19 16:34:55 +08006313 goto exit;
6314 }
6315 if (offset < 0) {
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006316 _exception = 1;
6317 _exceptionType = "java/lang/IllegalArgumentException";
6318 _exceptionMessage = "offset < 0";
Jack Palevich560814f2009-11-19 16:34:55 +08006319 goto exit;
6320 }
6321 _remaining = _env->GetArrayLength(values_ref) - offset;
Mathias Agopian2ad04772013-02-23 03:12:30 -08006322 if (_remaining < 4) {
6323 _exception = 1;
6324 _exceptionType = "java/lang/IllegalArgumentException";
6325 _exceptionMessage = "length - offset < 4 < needed";
6326 goto exit;
6327 }
Jack Palevich560814f2009-11-19 16:34:55 +08006328 values_base = (GLfloat *)
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006329 _env->GetFloatArrayElements(values_ref, (jboolean *)0);
Jack Palevich560814f2009-11-19 16:34:55 +08006330 values = values_base + offset;
6331
6332 glVertexAttrib4fv(
6333 (GLuint)indx,
6334 (GLfloat *)values
6335 );
6336
6337exit:
6338 if (values_base) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006339 _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base,
Jack Palevich560814f2009-11-19 16:34:55 +08006340 JNI_ABORT);
6341 }
Thomas Tafertshofer2545b322012-06-27 16:33:26 -07006342 if (_exception) {
6343 jniThrowException(_env, _exceptionType, _exceptionMessage);
6344 }
Jack Palevich560814f2009-11-19 16:34:55 +08006345}
6346
6347/* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */
6348static void
6349android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2
6350 (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) {
Mathias Agopian2ad04772013-02-23 03:12:30 -08006351 jint _exception = 0;
6352 const char * _exceptionType = NULL;
6353 const char * _exceptionMessage = NULL;
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006354 jfloatArray _array = (jfloatArray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006355 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08006356 jint _remaining;
6357 GLfloat *values = (GLfloat *) 0;
6358
Romain Guy84cac202016-12-05 12:26:02 -08006359 if (!values_buf) {
6360 _exception = 1;
6361 _exceptionType = "java/lang/IllegalArgumentException";
6362 _exceptionMessage = "values == null";
6363 goto exit;
6364 }
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006365 values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
Mathias Agopian2ad04772013-02-23 03:12:30 -08006366 if (_remaining < 4) {
6367 _exception = 1;
6368 _exceptionType = "java/lang/IllegalArgumentException";
6369 _exceptionMessage = "remaining() < 4 < needed";
6370 goto exit;
6371 }
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006372 if (values == NULL) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006373 char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0);
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006374 values = (GLfloat *) (_valuesBase + _bufferOffset);
6375 }
Jack Palevich560814f2009-11-19 16:34:55 +08006376 glVertexAttrib4fv(
6377 (GLuint)indx,
6378 (GLfloat *)values
6379 );
Mathias Agopian2ad04772013-02-23 03:12:30 -08006380
6381exit:
Jack Palevich560814f2009-11-19 16:34:55 +08006382 if (_array) {
Hiroshi Yamauchi3b1d46e2015-05-13 13:10:33 -07006383 _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT);
Jack Palevich560814f2009-11-19 16:34:55 +08006384 }
Mathias Agopian2ad04772013-02-23 03:12:30 -08006385 if (_exception) {
6386 jniThrowException(_env, _exceptionType, _exceptionMessage);
6387 }
Jack Palevich560814f2009-11-19 16:34:55 +08006388}
6389
Jack Palevich224107a2010-06-22 20:08:40 +08006390/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint offset ) */
6391static void
6392android_glVertexAttribPointer__IIIZII
6393 (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jint offset) {
6394 glVertexAttribPointer(
6395 (GLuint)indx,
6396 (GLint)size,
6397 (GLenum)type,
6398 (GLboolean)normalized,
6399 (GLsizei)stride,
Ashok Bhat01c26ea2014-02-24 09:49:07 +00006400 reinterpret_cast<GLvoid *>(offset)
Jack Palevich224107a2010-06-22 20:08:40 +08006401 );
6402}
6403
Jack Palevich560814f2009-11-19 16:34:55 +08006404/* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr ) */
6405static void
6406android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I
6407 (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 -08006408 jint _exception = 0;
6409 const char * _exceptionType = NULL;
6410 const char * _exceptionMessage = NULL;
Jack Palevich560814f2009-11-19 16:34:55 +08006411 jarray _array = (jarray) 0;
Thomas Tafertshofer17045a12012-07-12 13:55:55 -07006412 jint _bufferOffset = (jint) 0;
Jack Palevich560814f2009-11-19 16:34:55 +08006413 jint _remaining;
6414 GLvoid *ptr = (GLvoid *) 0;
6415
6416 if (ptr_buf) {
6417 ptr = (GLvoid *) getDirectBufferPointer(_env, ptr_buf);
6418 if ( ! ptr ) {
6419 return;
6420 }
6421 }
6422 glVertexAttribPointerBounds(
6423 (GLuint)indx,
6424 (GLint)size,
6425 (GLenum)type,
6426 (GLboolean)normalized,
6427 (GLsizei)stride,
6428 (GLvoid *)ptr,
6429 (GLsizei)remaining
6430 );
Romain Guy84cac202016-12-05 12:26:02 -08006431 if (_exception) {
6432 jniThrowException(_env, _exceptionType, _exceptionMessage);
6433 }
Jack Palevich560814f2009-11-19 16:34:55 +08006434}
6435
6436/* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */
6437static void
6438android_glViewport__IIII
6439 (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) {
6440 glViewport(
6441 (GLint)x,
6442 (GLint)y,
6443 (GLsizei)width,
6444 (GLsizei)height
6445 );
6446}
6447
6448static const char *classPathName = "android/opengl/GLES20";
6449
Daniel Micay76f6a862015-09-19 17:31:01 -04006450static const JNINativeMethod methods[] = {
Jack Palevich560814f2009-11-19 16:34:55 +08006451{"_nativeClassInit", "()V", (void*)nativeClassInit },
6452{"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I },
6453{"glAttachShader", "(II)V", (void *) android_glAttachShader__II },
6454{"glBindAttribLocation", "(IILjava/lang/String;)V", (void *) android_glBindAttribLocation__IILjava_lang_String_2 },
6455{"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II },
6456{"glBindFramebuffer", "(II)V", (void *) android_glBindFramebuffer__II },
6457{"glBindRenderbuffer", "(II)V", (void *) android_glBindRenderbuffer__II },
6458{"glBindTexture", "(II)V", (void *) android_glBindTexture__II },
6459{"glBlendColor", "(FFFF)V", (void *) android_glBlendColor__FFFF },
6460{"glBlendEquation", "(I)V", (void *) android_glBlendEquation__I },
6461{"glBlendEquationSeparate", "(II)V", (void *) android_glBlendEquationSeparate__II },
6462{"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II },
6463{"glBlendFuncSeparate", "(IIII)V", (void *) android_glBlendFuncSeparate__IIII },
6464{"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I },
6465{"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 },
6466{"glCheckFramebufferStatus", "(I)I", (void *) android_glCheckFramebufferStatus__I },
6467{"glClear", "(I)V", (void *) android_glClear__I },
6468{"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF },
6469{"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F },
6470{"glClearStencil", "(I)V", (void *) android_glClearStencil__I },
6471{"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ },
6472{"glCompileShader", "(I)V", (void *) android_glCompileShader__I },
6473{"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 },
6474{"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
6475{"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII },
6476{"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII },
6477{"glCreateProgram", "()I", (void *) android_glCreateProgram__ },
6478{"glCreateShader", "(I)I", (void *) android_glCreateShader__I },
6479{"glCullFace", "(I)V", (void *) android_glCullFace__I },
6480{"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II },
6481{"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 },
6482{"glDeleteFramebuffers", "(I[II)V", (void *) android_glDeleteFramebuffers__I_3II },
6483{"glDeleteFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2 },
6484{"glDeleteProgram", "(I)V", (void *) android_glDeleteProgram__I },
6485{"glDeleteRenderbuffers", "(I[II)V", (void *) android_glDeleteRenderbuffers__I_3II },
6486{"glDeleteRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2 },
6487{"glDeleteShader", "(I)V", (void *) android_glDeleteShader__I },
6488{"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II },
6489{"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 },
6490{"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I },
6491{"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z },
6492{"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF },
6493{"glDetachShader", "(II)V", (void *) android_glDetachShader__II },
6494{"glDisable", "(I)V", (void *) android_glDisable__I },
6495{"glDisableVertexAttribArray", "(I)V", (void *) android_glDisableVertexAttribArray__I },
6496{"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III },
Jack Palevich224107a2010-06-22 20:08:40 +08006497{"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII },
Jack Palevich560814f2009-11-19 16:34:55 +08006498{"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 },
6499{"glEnable", "(I)V", (void *) android_glEnable__I },
6500{"glEnableVertexAttribArray", "(I)V", (void *) android_glEnableVertexAttribArray__I },
6501{"glFinish", "()V", (void *) android_glFinish__ },
6502{"glFlush", "()V", (void *) android_glFlush__ },
6503{"glFramebufferRenderbuffer", "(IIII)V", (void *) android_glFramebufferRenderbuffer__IIII },
6504{"glFramebufferTexture2D", "(IIIII)V", (void *) android_glFramebufferTexture2D__IIIII },
6505{"glFrontFace", "(I)V", (void *) android_glFrontFace__I },
6506{"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II },
6507{"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 },
6508{"glGenerateMipmap", "(I)V", (void *) android_glGenerateMipmap__I },
6509{"glGenFramebuffers", "(I[II)V", (void *) android_glGenFramebuffers__I_3II },
6510{"glGenFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenFramebuffers__ILjava_nio_IntBuffer_2 },
6511{"glGenRenderbuffers", "(I[II)V", (void *) android_glGenRenderbuffers__I_3II },
6512{"glGenRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenRenderbuffers__ILjava_nio_IntBuffer_2 },
6513{"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II },
6514{"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 },
6515{"glGetActiveAttrib", "(III[II[II[II[BI)V", (void *) android_glGetActiveAttrib__III_3II_3II_3II_3BI },
6516{"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 -07006517{"glGetActiveAttrib", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveAttrib1 },
6518{"glGetActiveAttrib", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveAttrib2 },
Jack Palevich560814f2009-11-19 16:34:55 +08006519{"glGetActiveUniform", "(III[II[II[II[BI)V", (void *) android_glGetActiveUniform__III_3II_3II_3II_3BI },
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07006520{"glGetActiveUniform", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveUniform1 },
Jack Palevich560814f2009-11-19 16:34:55 +08006521{"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 -07006522{"glGetActiveUniform", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveUniform2 },
Jack Palevich560814f2009-11-19 16:34:55 +08006523{"glGetAttachedShaders", "(II[II[II)V", (void *) android_glGetAttachedShaders__II_3II_3II },
6524{"glGetAttachedShaders", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
6525{"glGetAttribLocation", "(ILjava/lang/String;)I", (void *) android_glGetAttribLocation__ILjava_lang_String_2 },
6526{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI },
6527{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 },
6528{"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II },
6529{"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 },
6530{"glGetError", "()I", (void *) android_glGetError__ },
6531{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI },
6532{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 },
6533{"glGetFramebufferAttachmentParameteriv", "(III[II)V", (void *) android_glGetFramebufferAttachmentParameteriv__III_3II },
6534{"glGetFramebufferAttachmentParameteriv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 },
6535{"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II },
6536{"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 },
6537{"glGetProgramiv", "(II[II)V", (void *) android_glGetProgramiv__II_3II },
6538{"glGetProgramiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetProgramiv__IILjava_nio_IntBuffer_2 },
6539{"glGetProgramInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetProgramInfoLog },
6540{"glGetRenderbufferParameteriv", "(II[II)V", (void *) android_glGetRenderbufferParameteriv__II_3II },
6541{"glGetRenderbufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2 },
6542{"glGetShaderiv", "(II[II)V", (void *) android_glGetShaderiv__II_3II },
6543{"glGetShaderiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetShaderiv__IILjava_nio_IntBuffer_2 },
6544{"glGetShaderInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetShaderInfoLog },
6545{"glGetShaderPrecisionFormat", "(II[II[II)V", (void *) android_glGetShaderPrecisionFormat__II_3II_3II },
6546{"glGetShaderPrecisionFormat", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
6547{"glGetShaderSource", "(II[II[BI)V", (void *) android_glGetShaderSource__II_3II_3BI },
6548{"glGetShaderSource", "(IILjava/nio/IntBuffer;B)V", (void *) android_glGetShaderSource__IILjava_nio_IntBuffer_2B },
Thomas Tafertshoferdd069462012-07-19 16:55:37 -07006549{"glGetShaderSource", "(I)Ljava/lang/String;", (void *) android_glGetShaderSource },
Jack Palevich560814f2009-11-19 16:34:55 +08006550{"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString },
6551{"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI },
6552{"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 },
6553{"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II },
6554{"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 },
6555{"glGetUniformfv", "(II[FI)V", (void *) android_glGetUniformfv__II_3FI },
6556{"glGetUniformfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetUniformfv__IILjava_nio_FloatBuffer_2 },
6557{"glGetUniformiv", "(II[II)V", (void *) android_glGetUniformiv__II_3II },
6558{"glGetUniformiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetUniformiv__IILjava_nio_IntBuffer_2 },
6559{"glGetUniformLocation", "(ILjava/lang/String;)I", (void *) android_glGetUniformLocation__ILjava_lang_String_2 },
6560{"glGetVertexAttribfv", "(II[FI)V", (void *) android_glGetVertexAttribfv__II_3FI },
6561{"glGetVertexAttribfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2 },
6562{"glGetVertexAttribiv", "(II[II)V", (void *) android_glGetVertexAttribiv__II_3II },
6563{"glGetVertexAttribiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2 },
6564{"glHint", "(II)V", (void *) android_glHint__II },
6565{"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I },
6566{"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I },
6567{"glIsFramebuffer", "(I)Z", (void *) android_glIsFramebuffer__I },
6568{"glIsProgram", "(I)Z", (void *) android_glIsProgram__I },
6569{"glIsRenderbuffer", "(I)Z", (void *) android_glIsRenderbuffer__I },
6570{"glIsShader", "(I)Z", (void *) android_glIsShader__I },
6571{"glIsTexture", "(I)Z", (void *) android_glIsTexture__I },
6572{"glLineWidth", "(F)V", (void *) android_glLineWidth__F },
6573{"glLinkProgram", "(I)V", (void *) android_glLinkProgram__I },
6574{"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II },
6575{"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF },
6576{"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 },
6577{"glReleaseShaderCompiler", "()V", (void *) android_glReleaseShaderCompiler__ },
6578{"glRenderbufferStorage", "(IIII)V", (void *) android_glRenderbufferStorage__IIII },
6579{"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ },
6580{"glScissor", "(IIII)V", (void *) android_glScissor__IIII },
6581{"glShaderBinary", "(I[IIILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__I_3IIILjava_nio_Buffer_2I },
6582{"glShaderBinary", "(ILjava/nio/IntBuffer;ILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I },
6583{"glShaderSource", "(ILjava/lang/String;)V", (void *) android_glShaderSource },
6584{"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III },
6585{"glStencilFuncSeparate", "(IIII)V", (void *) android_glStencilFuncSeparate__IIII },
6586{"glStencilMask", "(I)V", (void *) android_glStencilMask__I },
6587{"glStencilMaskSeparate", "(II)V", (void *) android_glStencilMaskSeparate__II },
6588{"glStencilOp", "(III)V", (void *) android_glStencilOp__III },
6589{"glStencilOpSeparate", "(IIII)V", (void *) android_glStencilOpSeparate__IIII },
6590{"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 },
6591{"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF },
6592{"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI },
6593{"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 },
6594{"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III },
6595{"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II },
6596{"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 },
6597{"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 },
6598{"glUniform1f", "(IF)V", (void *) android_glUniform1f__IF },
6599{"glUniform1fv", "(II[FI)V", (void *) android_glUniform1fv__II_3FI },
6600{"glUniform1fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform1fv__IILjava_nio_FloatBuffer_2 },
6601{"glUniform1i", "(II)V", (void *) android_glUniform1i__II },
6602{"glUniform1iv", "(II[II)V", (void *) android_glUniform1iv__II_3II },
6603{"glUniform1iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform1iv__IILjava_nio_IntBuffer_2 },
6604{"glUniform2f", "(IFF)V", (void *) android_glUniform2f__IFF },
6605{"glUniform2fv", "(II[FI)V", (void *) android_glUniform2fv__II_3FI },
6606{"glUniform2fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform2fv__IILjava_nio_FloatBuffer_2 },
6607{"glUniform2i", "(III)V", (void *) android_glUniform2i__III },
6608{"glUniform2iv", "(II[II)V", (void *) android_glUniform2iv__II_3II },
6609{"glUniform2iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform2iv__IILjava_nio_IntBuffer_2 },
6610{"glUniform3f", "(IFFF)V", (void *) android_glUniform3f__IFFF },
6611{"glUniform3fv", "(II[FI)V", (void *) android_glUniform3fv__II_3FI },
6612{"glUniform3fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform3fv__IILjava_nio_FloatBuffer_2 },
6613{"glUniform3i", "(IIII)V", (void *) android_glUniform3i__IIII },
6614{"glUniform3iv", "(II[II)V", (void *) android_glUniform3iv__II_3II },
6615{"glUniform3iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform3iv__IILjava_nio_IntBuffer_2 },
6616{"glUniform4f", "(IFFFF)V", (void *) android_glUniform4f__IFFFF },
6617{"glUniform4fv", "(II[FI)V", (void *) android_glUniform4fv__II_3FI },
6618{"glUniform4fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform4fv__IILjava_nio_FloatBuffer_2 },
6619{"glUniform4i", "(IIIII)V", (void *) android_glUniform4i__IIIII },
6620{"glUniform4iv", "(II[II)V", (void *) android_glUniform4iv__II_3II },
6621{"glUniform4iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform4iv__IILjava_nio_IntBuffer_2 },
6622{"glUniformMatrix2fv", "(IIZ[FI)V", (void *) android_glUniformMatrix2fv__IIZ_3FI },
6623{"glUniformMatrix2fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 },
6624{"glUniformMatrix3fv", "(IIZ[FI)V", (void *) android_glUniformMatrix3fv__IIZ_3FI },
6625{"glUniformMatrix3fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 },
6626{"glUniformMatrix4fv", "(IIZ[FI)V", (void *) android_glUniformMatrix4fv__IIZ_3FI },
6627{"glUniformMatrix4fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2 },
6628{"glUseProgram", "(I)V", (void *) android_glUseProgram__I },
6629{"glValidateProgram", "(I)V", (void *) android_glValidateProgram__I },
6630{"glVertexAttrib1f", "(IF)V", (void *) android_glVertexAttrib1f__IF },
6631{"glVertexAttrib1fv", "(I[FI)V", (void *) android_glVertexAttrib1fv__I_3FI },
6632{"glVertexAttrib1fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2 },
6633{"glVertexAttrib2f", "(IFF)V", (void *) android_glVertexAttrib2f__IFF },
6634{"glVertexAttrib2fv", "(I[FI)V", (void *) android_glVertexAttrib2fv__I_3FI },
6635{"glVertexAttrib2fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2 },
6636{"glVertexAttrib3f", "(IFFF)V", (void *) android_glVertexAttrib3f__IFFF },
6637{"glVertexAttrib3fv", "(I[FI)V", (void *) android_glVertexAttrib3fv__I_3FI },
6638{"glVertexAttrib3fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2 },
6639{"glVertexAttrib4f", "(IFFFF)V", (void *) android_glVertexAttrib4f__IFFFF },
6640{"glVertexAttrib4fv", "(I[FI)V", (void *) android_glVertexAttrib4fv__I_3FI },
6641{"glVertexAttrib4fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 },
Jack Palevich224107a2010-06-22 20:08:40 +08006642{"glVertexAttribPointer", "(IIIZII)V", (void *) android_glVertexAttribPointer__IIIZII },
Jack Palevich560814f2009-11-19 16:34:55 +08006643{"glVertexAttribPointerBounds", "(IIIZILjava/nio/Buffer;I)V", (void *) android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I },
6644{"glViewport", "(IIII)V", (void *) android_glViewport__IIII },
6645};
6646
6647int register_android_opengl_jni_GLES20(JNIEnv *_env)
6648{
6649 int err;
6650 err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
6651 return err;
6652}