1 /*
2 **
3 ** Copyright 2009, The Android Open Source Project
4 **
5 ** 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
8 **
9 ** http://www.apache.org/licenses/LICENSE-2.0
10 **
11 ** 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
15 ** limitations under the License.
16 */
17
18 // This source file is automatically generated
19
20 #pragma GCC diagnostic ignored "-Wunused-variable"
21 #pragma GCC diagnostic ignored "-Wunused-but-set-variable"
22 #pragma GCC diagnostic ignored "-Wunused-function"
23
24 #include <GLES/gl.h>
25 #include <GLES/glext.h>
26
27 #include <jni.h>
28 #include <nativehelper/JNIPlatformHelp.h>
29 #include <android_runtime/AndroidRuntime.h>
30 #include <utils/misc.h>
31 #include <assert.h>
32
33
34 /* special calls implemented in Android's GLES wrapper used to more
35 * efficiently bound-check passed arrays */
36 extern "C" {
37 #ifdef GL_VERSION_ES_CM_1_1
38 GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride,
39 const GLvoid *ptr, GLsizei count);
40 GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride,
41 const GLvoid *pointer, GLsizei count);
42 GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type,
43 GLsizei stride, const GLvoid *pointer, GLsizei count);
44 GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type,
45 GLsizei stride, const GLvoid *pointer, GLsizei count);
46 GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type,
47 GLsizei stride, const GLvoid *pointer, GLsizei count);
48 GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type,
49 GLsizei stride, const GLvoid *pointer, GLsizei count);
50 GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type,
51 GLsizei stride, const GLvoid *pointer, GLsizei count);
52 #endif
53 #ifdef GL_ES_VERSION_2_0
glVertexAttribPointerBounds(GLuint indx,GLint size,GLenum type,GLboolean normalized,GLsizei stride,const GLvoid * pointer,GLsizei count)54 static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type,
55 GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) {
56 glVertexAttribPointer(indx, size, type, normalized, stride, pointer);
57 }
58 #endif
59 #ifdef GL_ES_VERSION_3_0
glVertexAttribIPointerBounds(GLuint indx,GLint size,GLenum type,GLsizei stride,const GLvoid * pointer,GLsizei count)60 static void glVertexAttribIPointerBounds(GLuint indx, GLint size, GLenum type,
61 GLsizei stride, const GLvoid *pointer, GLsizei count) {
62 glVertexAttribIPointer(indx, size, type, stride, pointer);
63 }
64 #endif
65 }
66
67 static void
nativeClassInit(JNIEnv * _env,jclass glImplClass)68 nativeClassInit(JNIEnv *_env, jclass glImplClass)
69 {
70 }
71
72 static void *
getPointer(JNIEnv * _env,jobject buffer,jarray * array,jint * remaining,jint * offset)73 getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset)
74 {
75 jint position;
76 jint limit;
77 jint elementSizeShift;
78 jlong pointer;
79
80 pointer = jniGetNioBufferFields(_env, buffer, &position, &limit, &elementSizeShift);
81 *remaining = (limit - position) << elementSizeShift;
82 if (pointer != 0L) {
83 *array = nullptr;
84 pointer += position << elementSizeShift;
85 return reinterpret_cast<void*>(pointer);
86 }
87
88 *array = jniGetNioBufferBaseArray(_env, buffer);
89 *offset = jniGetNioBufferBaseArrayOffset(_env, buffer);
90 return nullptr;
91 }
92
93 class ByteArrayGetter {
94 public:
Get(JNIEnv * _env,jbyteArray array,jboolean * is_copy)95 static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
96 return _env->GetByteArrayElements(array, is_copy);
97 }
98 };
99 class BooleanArrayGetter {
100 public:
Get(JNIEnv * _env,jbooleanArray array,jboolean * is_copy)101 static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
102 return _env->GetBooleanArrayElements(array, is_copy);
103 }
104 };
105 class CharArrayGetter {
106 public:
Get(JNIEnv * _env,jcharArray array,jboolean * is_copy)107 static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
108 return _env->GetCharArrayElements(array, is_copy);
109 }
110 };
111 class ShortArrayGetter {
112 public:
Get(JNIEnv * _env,jshortArray array,jboolean * is_copy)113 static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
114 return _env->GetShortArrayElements(array, is_copy);
115 }
116 };
117 class IntArrayGetter {
118 public:
Get(JNIEnv * _env,jintArray array,jboolean * is_copy)119 static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
120 return _env->GetIntArrayElements(array, is_copy);
121 }
122 };
123 class LongArrayGetter {
124 public:
Get(JNIEnv * _env,jlongArray array,jboolean * is_copy)125 static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
126 return _env->GetLongArrayElements(array, is_copy);
127 }
128 };
129 class FloatArrayGetter {
130 public:
Get(JNIEnv * _env,jfloatArray array,jboolean * is_copy)131 static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
132 return _env->GetFloatArrayElements(array, is_copy);
133 }
134 };
135 class DoubleArrayGetter {
136 public:
Get(JNIEnv * _env,jdoubleArray array,jboolean * is_copy)137 static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
138 return _env->GetDoubleArrayElements(array, is_copy);
139 }
140 };
141
142 template<typename JTYPEARRAY, typename ARRAYGETTER>
143 static void*
getArrayPointer(JNIEnv * _env,JTYPEARRAY array,jboolean * is_copy)144 getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
145 return ARRAYGETTER::Get(_env, array, is_copy);
146 }
147
148 class ByteArrayReleaser {
149 public:
Release(JNIEnv * _env,jbyteArray array,jbyte * data,jboolean commit)150 static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
151 _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
152 }
153 };
154 class BooleanArrayReleaser {
155 public:
Release(JNIEnv * _env,jbooleanArray array,jboolean * data,jboolean commit)156 static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
157 _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
158 }
159 };
160 class CharArrayReleaser {
161 public:
Release(JNIEnv * _env,jcharArray array,jchar * data,jboolean commit)162 static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
163 _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
164 }
165 };
166 class ShortArrayReleaser {
167 public:
Release(JNIEnv * _env,jshortArray array,jshort * data,jboolean commit)168 static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
169 _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
170 }
171 };
172 class IntArrayReleaser {
173 public:
Release(JNIEnv * _env,jintArray array,jint * data,jboolean commit)174 static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
175 _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
176 }
177 };
178 class LongArrayReleaser {
179 public:
Release(JNIEnv * _env,jlongArray array,jlong * data,jboolean commit)180 static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
181 _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
182 }
183 };
184 class FloatArrayReleaser {
185 public:
Release(JNIEnv * _env,jfloatArray array,jfloat * data,jboolean commit)186 static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
187 _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
188 }
189 };
190 class DoubleArrayReleaser {
191 public:
Release(JNIEnv * _env,jdoubleArray array,jdouble * data,jboolean commit)192 static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
193 _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
194 }
195 };
196
197 template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
198 static void
releaseArrayPointer(JNIEnv * _env,JTYPEARRAY array,NTYPEARRAY data,jboolean commit)199 releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
200 ARRAYRELEASER::Release(_env, array, data, commit);
201 }
202
203 static void
releasePointer(JNIEnv * _env,jarray array,void * data,jboolean commit)204 releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
205 {
206 _env->ReleasePrimitiveArrayCritical(array, data,
207 commit ? 0 : JNI_ABORT);
208 }
209
210 static void *
getDirectBufferPointer(JNIEnv * _env,jobject buffer)211 getDirectBufferPointer(JNIEnv *_env, jobject buffer) {
212 jint position;
213 jint limit;
214 jint elementSizeShift;
215 jlong pointer;
216 pointer = jniGetNioBufferFields(_env, buffer, &position, &limit, &elementSizeShift);
217 if (pointer == 0) {
218 jniThrowException(_env, "java/lang/IllegalArgumentException",
219 "Must use a native order direct Buffer");
220 return nullptr;
221 }
222 pointer += position << elementSizeShift;
223 return reinterpret_cast<void*>(pointer);
224 }
225
226 // --------------------------------------------------------------------------
227
228 /*
229 * returns the number of values glGet returns for a given pname.
230 *
231 * The code below is written such that pnames requiring only one values
232 * are the default (and are not explicitely tested for). This makes the
233 * checking code much shorter/readable/efficient.
234 *
235 * This means that unknown pnames (e.g.: extensions) will default to 1. If
236 * that unknown pname needs more than 1 value, then the validation check
237 * is incomplete and the app may crash if it passed the wrong number params.
238 */
getNeededCount(GLint pname)239 static int getNeededCount(GLint pname) {
240 int needed = 1;
241 #ifdef GL_ES_VERSION_3_0
242 // GLES 3.x pnames
243 switch (pname) {
244 case GL_MAX_VIEWPORT_DIMS:
245 needed = 2;
246 break;
247
248 case GL_PROGRAM_BINARY_FORMATS:
249 glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &needed);
250 break;
251 }
252 #endif
253
254 #ifdef GL_ES_VERSION_2_0
255 // GLES 2.x pnames
256 switch (pname) {
257 case GL_ALIASED_LINE_WIDTH_RANGE:
258 case GL_ALIASED_POINT_SIZE_RANGE:
259 needed = 2;
260 break;
261
262 case GL_BLEND_COLOR:
263 case GL_COLOR_CLEAR_VALUE:
264 case GL_COLOR_WRITEMASK:
265 case GL_SCISSOR_BOX:
266 case GL_VIEWPORT:
267 needed = 4;
268 break;
269
270 case GL_COMPRESSED_TEXTURE_FORMATS:
271 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
272 break;
273
274 case GL_SHADER_BINARY_FORMATS:
275 glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed);
276 break;
277 }
278 #endif
279
280 #ifdef GL_VERSION_ES_CM_1_1
281 // GLES 1.x pnames
282 switch (pname) {
283 case GL_ALIASED_LINE_WIDTH_RANGE:
284 case GL_ALIASED_POINT_SIZE_RANGE:
285 case GL_DEPTH_RANGE:
286 case GL_SMOOTH_LINE_WIDTH_RANGE:
287 case GL_SMOOTH_POINT_SIZE_RANGE:
288 needed = 2;
289 break;
290
291 case GL_CURRENT_NORMAL:
292 case GL_POINT_DISTANCE_ATTENUATION:
293 needed = 3;
294 break;
295
296 case GL_COLOR_CLEAR_VALUE:
297 case GL_COLOR_WRITEMASK:
298 case GL_CURRENT_COLOR:
299 case GL_CURRENT_TEXTURE_COORDS:
300 case GL_FOG_COLOR:
301 case GL_LIGHT_MODEL_AMBIENT:
302 case GL_SCISSOR_BOX:
303 case GL_VIEWPORT:
304 needed = 4;
305 break;
306
307 case GL_MODELVIEW_MATRIX:
308 case GL_PROJECTION_MATRIX:
309 case GL_TEXTURE_MATRIX:
310 needed = 16;
311 break;
312
313 case GL_COMPRESSED_TEXTURE_FORMATS:
314 glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed);
315 break;
316 }
317 #endif
318 return needed;
319 }
320
321 template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
322 typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
323 static void
get(JNIEnv * _env,jobject _this,jint pname,JTYPEARRAY params_ref,jint offset)324 get
325 (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
326 jint _exception = 0;
327 const char * _exceptionType;
328 const char * _exceptionMessage;
329 CTYPE *params_base = (CTYPE *) 0;
330 jint _remaining;
331 CTYPE *params = (CTYPE *) 0;
332 int _needed = 0;
333
334 if (!params_ref) {
335 _exception = 1;
336 _exceptionType = "java/lang/IllegalArgumentException";
337 _exceptionMessage = "params == null";
338 goto exit;
339 }
340 if (offset < 0) {
341 _exception = 1;
342 _exceptionType = "java/lang/IllegalArgumentException";
343 _exceptionMessage = "offset < 0";
344 goto exit;
345 }
346 _remaining = _env->GetArrayLength(params_ref) - offset;
347 _needed = getNeededCount(pname);
348 // if we didn't find this pname, we just assume the user passed
349 // an array of the right size -- this might happen with extensions
350 // or if we forget an enum here.
351 if (_remaining < _needed) {
352 _exception = 1;
353 _exceptionType = "java/lang/IllegalArgumentException";
354 _exceptionMessage = "length - offset < needed";
355 goto exit;
356 }
357 params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
358 _env, params_ref, (jboolean *)0);
359 params = params_base + offset;
360
361 GET(
362 (GLenum)pname,
363 (CTYPE *)params
364 );
365
366 exit:
367 if (params_base) {
368 releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
369 _env, params_ref, params_base, !_exception);
370 }
371 if (_exception) {
372 jniThrowException(_env, _exceptionType, _exceptionMessage);
373 }
374 }
375
376
377 template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
378 typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
379 static void
getarray(JNIEnv * _env,jobject _this,jint pname,jobject params_buf)380 getarray
381 (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
382 jint _exception = 0;
383 const char * _exceptionType;
384 const char * _exceptionMessage;
385 JTYPEARRAY _array = (JTYPEARRAY) 0;
386 jint _bufferOffset = (jint) 0;
387 jint _remaining;
388 CTYPE *params = (CTYPE *) 0;
389 int _needed = 0;
390
391 params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
392 _remaining /= sizeof(CTYPE); // convert from bytes to item count
393 _needed = getNeededCount(pname);
394 // if we didn't find this pname, we just assume the user passed
395 // an array of the right size -- this might happen with extensions
396 // or if we forget an enum here.
397 if (_needed>0 && _remaining < _needed) {
398 _exception = 1;
399 _exceptionType = "java/lang/IllegalArgumentException";
400 _exceptionMessage = "remaining() < needed";
401 goto exit;
402 }
403 if (params == NULL) {
404 char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
405 _env, _array, (jboolean *) 0);
406 params = (CTYPE *) (_paramsBase + _bufferOffset);
407 }
408 GET(
409 (GLenum)pname,
410 (CTYPE *)params
411 );
412
413 exit:
414 if (_array) {
415 releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
416 _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
417 }
418 if (_exception) {
419 jniThrowException(_env, _exceptionType, _exceptionMessage);
420 }
421 }
422
423 // --------------------------------------------------------------------------
424 /* GLbitfield glQueryMatrixxOES ( GLfixed *mantissa, GLint *exponent ) */
425 static jint
android_glQueryMatrixxOES___3II_3II(JNIEnv * _env,jobject _this,jintArray mantissa_ref,jint mantissaOffset,jintArray exponent_ref,jint exponentOffset)426 android_glQueryMatrixxOES___3II_3II
427 (JNIEnv *_env, jobject _this, jintArray mantissa_ref, jint mantissaOffset, jintArray exponent_ref, jint exponentOffset) {
428 jint _exception = 0;
429 const char * _exceptionType = NULL;
430 const char * _exceptionMessage = NULL;
431 GLbitfield _returnValue = -1;
432 GLfixed *mantissa_base = (GLfixed *) 0;
433 jint _mantissaRemaining;
434 GLfixed *mantissa = (GLfixed *) 0;
435 GLint *exponent_base = (GLint *) 0;
436 jint _exponentRemaining;
437 GLint *exponent = (GLint *) 0;
438
439 if (!mantissa_ref) {
440 _exception = 1;
441 _exceptionType = "java/lang/IllegalArgumentException";
442 _exceptionMessage = "mantissa == null";
443 goto exit;
444 }
445 if (mantissaOffset < 0) {
446 _exception = 1;
447 _exceptionType = "java/lang/IllegalArgumentException";
448 _exceptionMessage = "mantissaOffset < 0";
449 goto exit;
450 }
451 _mantissaRemaining = _env->GetArrayLength(mantissa_ref) - mantissaOffset;
452 if (_mantissaRemaining < 16) {
453 _exception = 1;
454 _exceptionType = "java/lang/IllegalArgumentException";
455 _exceptionMessage = "length - mantissaOffset < 16 < needed";
456 goto exit;
457 }
458 mantissa_base = (GLfixed *)
459 _env->GetIntArrayElements(mantissa_ref, (jboolean *)0);
460 mantissa = mantissa_base + mantissaOffset;
461
462 if (!exponent_ref) {
463 _exception = 1;
464 _exceptionType = "java/lang/IllegalArgumentException";
465 _exceptionMessage = "exponent == null";
466 goto exit;
467 }
468 if (exponentOffset < 0) {
469 _exception = 1;
470 _exceptionType = "java/lang/IllegalArgumentException";
471 _exceptionMessage = "exponentOffset < 0";
472 goto exit;
473 }
474 _exponentRemaining = _env->GetArrayLength(exponent_ref) - exponentOffset;
475 if (_exponentRemaining < 16) {
476 _exception = 1;
477 _exceptionType = "java/lang/IllegalArgumentException";
478 _exceptionMessage = "length - exponentOffset < 16 < needed";
479 goto exit;
480 }
481 exponent_base = (GLint *)
482 _env->GetIntArrayElements(exponent_ref, (jboolean *)0);
483 exponent = exponent_base + exponentOffset;
484
485 _returnValue = glQueryMatrixxOES(
486 (GLfixed *)mantissa,
487 (GLint *)exponent
488 );
489
490 exit:
491 if (exponent_base) {
492 _env->ReleaseIntArrayElements(exponent_ref, (jint*)exponent_base,
493 _exception ? JNI_ABORT: 0);
494 }
495 if (mantissa_base) {
496 _env->ReleaseIntArrayElements(mantissa_ref, (jint*)mantissa_base,
497 _exception ? JNI_ABORT: 0);
498 }
499 if (_exception) {
500 jniThrowException(_env, _exceptionType, _exceptionMessage);
501 return (jint)0;
502 }
503 return (jint)_returnValue;
504 }
505
506 /* GLbitfield glQueryMatrixxOES ( GLfixed *mantissa, GLint *exponent ) */
507 static jint
android_glQueryMatrixxOES__Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2(JNIEnv * _env,jobject _this,jobject mantissa_buf,jobject exponent_buf)508 android_glQueryMatrixxOES__Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2
509 (JNIEnv *_env, jobject _this, jobject mantissa_buf, jobject exponent_buf) {
510 jint _exception = 0;
511 const char * _exceptionType = NULL;
512 const char * _exceptionMessage = NULL;
513 jintArray _mantissaArray = (jintArray) 0;
514 jint _mantissaBufferOffset = (jint) 0;
515 jintArray _exponentArray = (jintArray) 0;
516 jint _exponentBufferOffset = (jint) 0;
517 GLbitfield _returnValue = -1;
518 jint _mantissaRemaining;
519 GLfixed *mantissa = (GLfixed *) 0;
520 jint _exponentRemaining;
521 GLint *exponent = (GLint *) 0;
522
523 if (!mantissa_buf) {
524 _exception = 1;
525 _exceptionType = "java/lang/IllegalArgumentException";
526 _exceptionMessage = "mantissa == null";
527 goto exit;
528 }
529 mantissa = (GLfixed *)getPointer(_env, mantissa_buf, (jarray*)&_mantissaArray, &_mantissaRemaining, &_mantissaBufferOffset);
530 if (_mantissaRemaining < 16) {
531 _exception = 1;
532 _exceptionType = "java/lang/IllegalArgumentException";
533 _exceptionMessage = "remaining() < 16 < needed";
534 goto exit;
535 }
536 if (!exponent_buf) {
537 _exception = 1;
538 _exceptionType = "java/lang/IllegalArgumentException";
539 _exceptionMessage = "exponent == null";
540 goto exit;
541 }
542 exponent = (GLint *)getPointer(_env, exponent_buf, (jarray*)&_exponentArray, &_exponentRemaining, &_exponentBufferOffset);
543 if (_exponentRemaining < 16) {
544 _exception = 1;
545 _exceptionType = "java/lang/IllegalArgumentException";
546 _exceptionMessage = "remaining() < 16 < needed";
547 goto exit;
548 }
549 if (mantissa == NULL) {
550 char * _mantissaBase = (char *)_env->GetIntArrayElements(_mantissaArray, (jboolean *) 0);
551 mantissa = (GLfixed *) (_mantissaBase + _mantissaBufferOffset);
552 }
553 if (exponent == NULL) {
554 char * _exponentBase = (char *)_env->GetIntArrayElements(_exponentArray, (jboolean *) 0);
555 exponent = (GLint *) (_exponentBase + _exponentBufferOffset);
556 }
557 _returnValue = glQueryMatrixxOES(
558 (GLfixed *)mantissa,
559 (GLint *)exponent
560 );
561
562 exit:
563 if (_exponentArray) {
564 _env->ReleaseIntArrayElements(_exponentArray, (jint*)exponent, _exception ? JNI_ABORT : 0);
565 }
566 if (_mantissaArray) {
567 _env->ReleaseIntArrayElements(_mantissaArray, (jint*)mantissa, _exception ? JNI_ABORT : 0);
568 }
569 if (_exception) {
570 jniThrowException(_env, _exceptionType, _exceptionMessage);
571 return (jint)0;
572 }
573 return (jint)_returnValue;
574 }
575
576 static const char *classPathName = "android/opengl/GLES10Ext";
577
578 static const JNINativeMethod methods[] = {
579 {"_nativeClassInit", "()V", (void*)nativeClassInit },
580 {"glQueryMatrixxOES", "([II[II)I", (void *) android_glQueryMatrixxOES___3II_3II },
581 {"glQueryMatrixxOES", "(Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;)I", (void *) android_glQueryMatrixxOES__Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 },
582 };
583
register_android_opengl_jni_GLES10Ext(JNIEnv * _env)584 int register_android_opengl_jni_GLES10Ext(JNIEnv *_env)
585 {
586 int err;
587 err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods));
588 return err;
589 }
590