Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1 | /* |
| 2 | ** |
| 3 | ** Copyright 2009, The Android Open Source Project |
| 4 | ** |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 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 |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 8 | ** |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 9 | ** http://www.apache.org/licenses/LICENSE-2.0 |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 10 | ** |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 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 |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | // This source file is automatically generated |
| 19 | |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 20 | #include <GLES2/gl2.h> |
| 21 | #include <GLES2/gl2ext.h> |
| 22 | |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 23 | #include "jni.h" |
| 24 | #include "JNIHelp.h" |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 25 | #include <android_runtime/AndroidRuntime.h> |
| 26 | #include <utils/misc.h> |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 27 | #include <assert.h> |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 28 | |
| 29 | static int initialized = 0; |
| 30 | |
| 31 | static jclass nioAccessClass; |
| 32 | static jclass bufferClass; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 33 | static jmethodID getBasePointerID; |
| 34 | static jmethodID getBaseArrayID; |
| 35 | static jmethodID getBaseArrayOffsetID; |
| 36 | static jfieldID positionID; |
| 37 | static jfieldID limitID; |
| 38 | static jfieldID elementSizeShiftID; |
| 39 | |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 40 | |
| 41 | /* special calls implemented in Android's GLES wrapper used to more |
| 42 | * efficiently bound-check passed arrays */ |
| 43 | extern "C" { |
| 44 | #ifdef GL_VERSION_ES_CM_1_1 |
| 45 | GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride, |
| 46 | const GLvoid *ptr, GLsizei count); |
| 47 | GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride, |
| 48 | const GLvoid *pointer, GLsizei count); |
| 49 | GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type, |
| 50 | GLsizei stride, const GLvoid *pointer, GLsizei count); |
| 51 | GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type, |
| 52 | GLsizei stride, const GLvoid *pointer, GLsizei count); |
| 53 | GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, |
| 54 | GLsizei stride, const GLvoid *pointer, GLsizei count); |
| 55 | GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, |
| 56 | GLsizei stride, const GLvoid *pointer, GLsizei count); |
| 57 | GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, |
| 58 | GLsizei stride, const GLvoid *pointer, GLsizei count); |
| 59 | #endif |
| 60 | #ifdef GL_ES_VERSION_2_0 |
| 61 | static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type, |
| 62 | GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) { |
| 63 | glVertexAttribPointer(indx, size, type, normalized, stride, pointer); |
| 64 | } |
| 65 | #endif |
| 66 | } |
| 67 | |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 68 | /* Cache method IDs each time the class is loaded. */ |
| 69 | |
| 70 | static void |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 71 | nativeClassInit(JNIEnv *_env, jclass glImplClass) |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 72 | { |
| 73 | jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); |
| 74 | nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); |
| 75 | |
| 76 | jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); |
| 77 | bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); |
| 78 | |
| 79 | getBasePointerID = _env->GetStaticMethodID(nioAccessClass, |
| 80 | "getBasePointer", "(Ljava/nio/Buffer;)J"); |
| 81 | getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, |
| 82 | "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); |
| 83 | getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, |
| 84 | "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); |
| 85 | |
| 86 | positionID = _env->GetFieldID(bufferClass, "position", "I"); |
| 87 | limitID = _env->GetFieldID(bufferClass, "limit", "I"); |
| 88 | elementSizeShiftID = |
| 89 | _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); |
| 90 | } |
| 91 | |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 92 | static void * |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 93 | getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset) |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 94 | { |
| 95 | jint position; |
| 96 | jint limit; |
| 97 | jint elementSizeShift; |
| 98 | jlong pointer; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 99 | |
| 100 | position = _env->GetIntField(buffer, positionID); |
| 101 | limit = _env->GetIntField(buffer, limitID); |
| 102 | elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); |
| 103 | *remaining = (limit - position) << elementSizeShift; |
| 104 | pointer = _env->CallStaticLongMethod(nioAccessClass, |
| 105 | getBasePointerID, buffer); |
| 106 | if (pointer != 0L) { |
| 107 | *array = NULL; |
| 108 | return (void *) (jint) pointer; |
| 109 | } |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 110 | |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 111 | *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, |
| 112 | getBaseArrayID, buffer); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 113 | *offset = _env->CallStaticIntMethod(nioAccessClass, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 114 | getBaseArrayOffsetID, buffer); |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 115 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 116 | return NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 117 | } |
| 118 | |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 119 | static void |
| 120 | releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) |
| 121 | { |
| 122 | _env->ReleasePrimitiveArrayCritical(array, data, |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 123 | commit ? 0 : JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 124 | } |
| 125 | |
| 126 | static void * |
| 127 | getDirectBufferPointer(JNIEnv *_env, jobject buffer) { |
| 128 | char* buf = (char*) _env->GetDirectBufferAddress(buffer); |
| 129 | if (buf) { |
| 130 | jint position = _env->GetIntField(buffer, positionID); |
| 131 | jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); |
| 132 | buf += position << elementSizeShift; |
| 133 | } else { |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 134 | jniThrowException(_env, "java/lang/IllegalArgumentException", |
| 135 | "Must use a native order direct Buffer"); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 136 | } |
| 137 | return (void*) buf; |
| 138 | } |
| 139 | |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 140 | // -------------------------------------------------------------------------- |
| 141 | |
| 142 | /* |
| 143 | * returns the number of values glGet returns for a given pname. |
| 144 | * |
| 145 | * The code below is written such that pnames requiring only one values |
| 146 | * are the default (and are not explicitely tested for). This makes the |
| 147 | * checking code much shorter/readable/efficient. |
| 148 | * |
| 149 | * This means that unknown pnames (e.g.: extensions) will default to 1. If |
| 150 | * that unknown pname needs more than 1 value, then the validation check |
| 151 | * is incomplete and the app may crash if it passed the wrong number params. |
| 152 | */ |
| 153 | static int getNeededCount(GLint pname) { |
| 154 | int needed = 1; |
| 155 | #ifdef GL_ES_VERSION_2_0 |
| 156 | // GLES 2.x pnames |
| 157 | switch (pname) { |
| 158 | case GL_ALIASED_LINE_WIDTH_RANGE: |
| 159 | case GL_ALIASED_POINT_SIZE_RANGE: |
| 160 | needed = 2; |
| 161 | break; |
| 162 | |
| 163 | case GL_BLEND_COLOR: |
| 164 | case GL_COLOR_CLEAR_VALUE: |
| 165 | case GL_COLOR_WRITEMASK: |
| 166 | case GL_SCISSOR_BOX: |
| 167 | case GL_VIEWPORT: |
| 168 | needed = 4; |
| 169 | break; |
| 170 | |
| 171 | case GL_COMPRESSED_TEXTURE_FORMATS: |
| 172 | glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed); |
| 173 | break; |
| 174 | |
| 175 | case GL_SHADER_BINARY_FORMATS: |
| 176 | glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed); |
| 177 | break; |
| 178 | } |
| 179 | #endif |
| 180 | |
| 181 | #ifdef GL_VERSION_ES_CM_1_1 |
| 182 | // GLES 1.x pnames |
| 183 | switch (pname) { |
| 184 | case GL_ALIASED_LINE_WIDTH_RANGE: |
| 185 | case GL_ALIASED_POINT_SIZE_RANGE: |
| 186 | case GL_DEPTH_RANGE: |
| 187 | case GL_SMOOTH_LINE_WIDTH_RANGE: |
| 188 | case GL_SMOOTH_POINT_SIZE_RANGE: |
| 189 | needed = 2; |
| 190 | break; |
| 191 | |
| 192 | case GL_CURRENT_NORMAL: |
| 193 | case GL_POINT_DISTANCE_ATTENUATION: |
| 194 | needed = 3; |
| 195 | break; |
| 196 | |
| 197 | case GL_COLOR_CLEAR_VALUE: |
| 198 | case GL_COLOR_WRITEMASK: |
| 199 | case GL_CURRENT_COLOR: |
| 200 | case GL_CURRENT_TEXTURE_COORDS: |
| 201 | case GL_FOG_COLOR: |
| 202 | case GL_LIGHT_MODEL_AMBIENT: |
| 203 | case GL_SCISSOR_BOX: |
| 204 | case GL_VIEWPORT: |
| 205 | needed = 4; |
| 206 | break; |
| 207 | |
| 208 | case GL_MODELVIEW_MATRIX: |
| 209 | case GL_PROJECTION_MATRIX: |
| 210 | case GL_TEXTURE_MATRIX: |
| 211 | needed = 16; |
| 212 | break; |
| 213 | |
| 214 | case GL_COMPRESSED_TEXTURE_FORMATS: |
| 215 | glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed); |
| 216 | break; |
| 217 | } |
| 218 | #endif |
| 219 | return needed; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 220 | } |
| 221 | |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 222 | template <typename JTYPEARRAY, typename CTYPE, void GET(GLenum, CTYPE*)> |
| 223 | static void |
| 224 | get |
| 225 | (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) { |
| 226 | jint _exception = 0; |
| 227 | const char * _exceptionType; |
| 228 | const char * _exceptionMessage; |
| 229 | CTYPE *params_base = (CTYPE *) 0; |
| 230 | jint _remaining; |
| 231 | CTYPE *params = (CTYPE *) 0; |
| 232 | int _needed = 0; |
| 233 | |
| 234 | if (!params_ref) { |
| 235 | _exception = 1; |
| 236 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 237 | _exceptionMessage = "params == null"; |
| 238 | goto exit; |
| 239 | } |
| 240 | if (offset < 0) { |
| 241 | _exception = 1; |
| 242 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 243 | _exceptionMessage = "offset < 0"; |
| 244 | goto exit; |
| 245 | } |
| 246 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 247 | _needed = getNeededCount(pname); |
| 248 | // if we didn't find this pname, we just assume the user passed |
| 249 | // an array of the right size -- this might happen with extensions |
| 250 | // or if we forget an enum here. |
| 251 | if (_remaining < _needed) { |
| 252 | _exception = 1; |
| 253 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 254 | _exceptionMessage = "length - offset < needed"; |
| 255 | goto exit; |
| 256 | } |
| 257 | params_base = (CTYPE *) |
| 258 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 259 | params = params_base + offset; |
| 260 | |
| 261 | GET( |
| 262 | (GLenum)pname, |
| 263 | (CTYPE *)params |
| 264 | ); |
| 265 | |
| 266 | exit: |
| 267 | if (params_base) { |
| 268 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 269 | _exception ? JNI_ABORT: 0); |
| 270 | } |
| 271 | if (_exception) { |
| 272 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | |
| 277 | template <typename CTYPE, void GET(GLenum, CTYPE*)> |
| 278 | static void |
| 279 | getarray |
| 280 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
| 281 | jint _exception = 0; |
| 282 | const char * _exceptionType; |
| 283 | const char * _exceptionMessage; |
| 284 | jarray _array = (jarray) 0; |
| 285 | jint _bufferOffset = (jint) 0; |
| 286 | jint _remaining; |
| 287 | CTYPE *params = (CTYPE *) 0; |
| 288 | int _needed = 0; |
| 289 | |
| 290 | params = (CTYPE *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
| 291 | _needed = getNeededCount(pname); |
| 292 | // if we didn't find this pname, we just assume the user passed |
| 293 | // an array of the right size -- this might happen with extensions |
| 294 | // or if we forget an enum here. |
| 295 | if (_needed>0 && _remaining < _needed) { |
| 296 | _exception = 1; |
| 297 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 298 | _exceptionMessage = "remaining() < needed"; |
| 299 | goto exit; |
| 300 | } |
| 301 | if (params == NULL) { |
| 302 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 303 | params = (CTYPE *) (_paramsBase + _bufferOffset); |
| 304 | } |
| 305 | GET( |
| 306 | (GLenum)pname, |
| 307 | (CTYPE *)params |
| 308 | ); |
| 309 | |
| 310 | exit: |
| 311 | if (_array) { |
| 312 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 313 | } |
| 314 | if (_exception) { |
| 315 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 316 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 317 | } |
| 318 | |
| 319 | // -------------------------------------------------------------------------- |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 320 | /* void glActiveTexture ( GLenum texture ) */ |
| 321 | static void |
| 322 | android_glActiveTexture__I |
| 323 | (JNIEnv *_env, jobject _this, jint texture) { |
| 324 | glActiveTexture( |
| 325 | (GLenum)texture |
| 326 | ); |
| 327 | } |
| 328 | |
| 329 | /* void glAttachShader ( GLuint program, GLuint shader ) */ |
| 330 | static void |
| 331 | android_glAttachShader__II |
| 332 | (JNIEnv *_env, jobject _this, jint program, jint shader) { |
| 333 | glAttachShader( |
| 334 | (GLuint)program, |
| 335 | (GLuint)shader |
| 336 | ); |
| 337 | } |
| 338 | |
| 339 | /* void glBindAttribLocation ( GLuint program, GLuint index, const char *name ) */ |
| 340 | static void |
| 341 | android_glBindAttribLocation__IILjava_lang_String_2 |
| 342 | (JNIEnv *_env, jobject _this, jint program, jint index, jstring name) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 343 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 344 | const char * _exceptionType = NULL; |
| 345 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 346 | const char* _nativename = 0; |
| 347 | |
| 348 | if (!name) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 349 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 350 | _exceptionMessage = "name == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 351 | goto exit; |
| 352 | } |
| 353 | _nativename = _env->GetStringUTFChars(name, 0); |
| 354 | |
| 355 | glBindAttribLocation( |
| 356 | (GLuint)program, |
| 357 | (GLuint)index, |
| 358 | (char *)_nativename |
| 359 | ); |
| 360 | |
| 361 | exit: |
| 362 | if (_nativename) { |
| 363 | _env->ReleaseStringUTFChars(name, _nativename); |
| 364 | } |
| 365 | |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 366 | if (_exception) { |
| 367 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 368 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 369 | } |
| 370 | |
| 371 | /* void glBindBuffer ( GLenum target, GLuint buffer ) */ |
| 372 | static void |
| 373 | android_glBindBuffer__II |
| 374 | (JNIEnv *_env, jobject _this, jint target, jint buffer) { |
| 375 | glBindBuffer( |
| 376 | (GLenum)target, |
| 377 | (GLuint)buffer |
| 378 | ); |
| 379 | } |
| 380 | |
| 381 | /* void glBindFramebuffer ( GLenum target, GLuint framebuffer ) */ |
| 382 | static void |
| 383 | android_glBindFramebuffer__II |
| 384 | (JNIEnv *_env, jobject _this, jint target, jint framebuffer) { |
| 385 | glBindFramebuffer( |
| 386 | (GLenum)target, |
| 387 | (GLuint)framebuffer |
| 388 | ); |
| 389 | } |
| 390 | |
| 391 | /* void glBindRenderbuffer ( GLenum target, GLuint renderbuffer ) */ |
| 392 | static void |
| 393 | android_glBindRenderbuffer__II |
| 394 | (JNIEnv *_env, jobject _this, jint target, jint renderbuffer) { |
| 395 | glBindRenderbuffer( |
| 396 | (GLenum)target, |
| 397 | (GLuint)renderbuffer |
| 398 | ); |
| 399 | } |
| 400 | |
| 401 | /* void glBindTexture ( GLenum target, GLuint texture ) */ |
| 402 | static void |
| 403 | android_glBindTexture__II |
| 404 | (JNIEnv *_env, jobject _this, jint target, jint texture) { |
| 405 | glBindTexture( |
| 406 | (GLenum)target, |
| 407 | (GLuint)texture |
| 408 | ); |
| 409 | } |
| 410 | |
| 411 | /* void glBlendColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */ |
| 412 | static void |
| 413 | android_glBlendColor__FFFF |
| 414 | (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) { |
| 415 | glBlendColor( |
| 416 | (GLclampf)red, |
| 417 | (GLclampf)green, |
| 418 | (GLclampf)blue, |
| 419 | (GLclampf)alpha |
| 420 | ); |
| 421 | } |
| 422 | |
| 423 | /* void glBlendEquation ( GLenum mode ) */ |
| 424 | static void |
| 425 | android_glBlendEquation__I |
| 426 | (JNIEnv *_env, jobject _this, jint mode) { |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 427 | glBlendEquation( |
| 428 | (GLenum)mode |
| 429 | ); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 430 | } |
| 431 | |
| 432 | /* void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha ) */ |
| 433 | static void |
| 434 | android_glBlendEquationSeparate__II |
| 435 | (JNIEnv *_env, jobject _this, jint modeRGB, jint modeAlpha) { |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 436 | glBlendEquationSeparate( |
| 437 | (GLenum)modeRGB, |
| 438 | (GLenum)modeAlpha |
| 439 | ); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 440 | } |
| 441 | |
| 442 | /* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */ |
| 443 | static void |
| 444 | android_glBlendFunc__II |
| 445 | (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) { |
| 446 | glBlendFunc( |
| 447 | (GLenum)sfactor, |
| 448 | (GLenum)dfactor |
| 449 | ); |
| 450 | } |
| 451 | |
| 452 | /* void glBlendFuncSeparate ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) */ |
| 453 | static void |
| 454 | android_glBlendFuncSeparate__IIII |
| 455 | (JNIEnv *_env, jobject _this, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) { |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 456 | glBlendFuncSeparate( |
| 457 | (GLenum)srcRGB, |
| 458 | (GLenum)dstRGB, |
| 459 | (GLenum)srcAlpha, |
| 460 | (GLenum)dstAlpha |
| 461 | ); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 462 | } |
| 463 | |
| 464 | /* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */ |
| 465 | static void |
| 466 | android_glBufferData__IILjava_nio_Buffer_2I |
| 467 | (JNIEnv *_env, jobject _this, jint target, jint size, jobject data_buf, jint usage) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 468 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 469 | const char * _exceptionType = NULL; |
| 470 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 471 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 472 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 473 | jint _remaining; |
| 474 | GLvoid *data = (GLvoid *) 0; |
| 475 | |
| 476 | if (data_buf) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 477 | data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 478 | if (_remaining < size) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 479 | _exception = 1; |
| 480 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 481 | _exceptionMessage = "remaining() < size < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 482 | goto exit; |
| 483 | } |
| 484 | } |
Thomas Tafertshofer | 37c9b49 | 2012-07-23 16:56:04 -0700 | [diff] [blame] | 485 | if (data_buf && data == NULL) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 486 | char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 487 | data = (GLvoid *) (_dataBase + _bufferOffset); |
| 488 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 489 | glBufferData( |
| 490 | (GLenum)target, |
| 491 | (GLsizeiptr)size, |
| 492 | (GLvoid *)data, |
| 493 | (GLenum)usage |
| 494 | ); |
| 495 | |
| 496 | exit: |
| 497 | if (_array) { |
| 498 | releasePointer(_env, _array, data, JNI_FALSE); |
| 499 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 500 | if (_exception) { |
| 501 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 502 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 503 | } |
| 504 | |
| 505 | /* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */ |
| 506 | static void |
| 507 | android_glBufferSubData__IIILjava_nio_Buffer_2 |
| 508 | (JNIEnv *_env, jobject _this, jint target, jint offset, jint size, jobject data_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 509 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 510 | const char * _exceptionType = NULL; |
| 511 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 512 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 513 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 514 | jint _remaining; |
| 515 | GLvoid *data = (GLvoid *) 0; |
| 516 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 517 | data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 518 | if (_remaining < size) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 519 | _exception = 1; |
| 520 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 521 | _exceptionMessage = "remaining() < size < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 522 | goto exit; |
| 523 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 524 | if (data == NULL) { |
| 525 | char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 526 | data = (GLvoid *) (_dataBase + _bufferOffset); |
| 527 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 528 | glBufferSubData( |
| 529 | (GLenum)target, |
| 530 | (GLintptr)offset, |
| 531 | (GLsizeiptr)size, |
| 532 | (GLvoid *)data |
| 533 | ); |
| 534 | |
| 535 | exit: |
| 536 | if (_array) { |
| 537 | releasePointer(_env, _array, data, JNI_FALSE); |
| 538 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 539 | if (_exception) { |
| 540 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 541 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 542 | } |
| 543 | |
| 544 | /* GLenum glCheckFramebufferStatus ( GLenum target ) */ |
| 545 | static jint |
| 546 | android_glCheckFramebufferStatus__I |
| 547 | (JNIEnv *_env, jobject _this, jint target) { |
| 548 | GLenum _returnValue; |
| 549 | _returnValue = glCheckFramebufferStatus( |
| 550 | (GLenum)target |
| 551 | ); |
| 552 | return _returnValue; |
| 553 | } |
| 554 | |
| 555 | /* void glClear ( GLbitfield mask ) */ |
| 556 | static void |
| 557 | android_glClear__I |
| 558 | (JNIEnv *_env, jobject _this, jint mask) { |
| 559 | glClear( |
| 560 | (GLbitfield)mask |
| 561 | ); |
| 562 | } |
| 563 | |
| 564 | /* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */ |
| 565 | static void |
| 566 | android_glClearColor__FFFF |
| 567 | (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) { |
| 568 | glClearColor( |
| 569 | (GLclampf)red, |
| 570 | (GLclampf)green, |
| 571 | (GLclampf)blue, |
| 572 | (GLclampf)alpha |
| 573 | ); |
| 574 | } |
| 575 | |
| 576 | /* void glClearDepthf ( GLclampf depth ) */ |
| 577 | static void |
| 578 | android_glClearDepthf__F |
| 579 | (JNIEnv *_env, jobject _this, jfloat depth) { |
| 580 | glClearDepthf( |
| 581 | (GLclampf)depth |
| 582 | ); |
| 583 | } |
| 584 | |
| 585 | /* void glClearStencil ( GLint s ) */ |
| 586 | static void |
| 587 | android_glClearStencil__I |
| 588 | (JNIEnv *_env, jobject _this, jint s) { |
| 589 | glClearStencil( |
| 590 | (GLint)s |
| 591 | ); |
| 592 | } |
| 593 | |
| 594 | /* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */ |
| 595 | static void |
| 596 | android_glColorMask__ZZZZ |
| 597 | (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) { |
| 598 | glColorMask( |
| 599 | (GLboolean)red, |
| 600 | (GLboolean)green, |
| 601 | (GLboolean)blue, |
| 602 | (GLboolean)alpha |
| 603 | ); |
| 604 | } |
| 605 | |
| 606 | /* void glCompileShader ( GLuint shader ) */ |
| 607 | static void |
| 608 | android_glCompileShader__I |
| 609 | (JNIEnv *_env, jobject _this, jint shader) { |
| 610 | glCompileShader( |
| 611 | (GLuint)shader |
| 612 | ); |
| 613 | } |
| 614 | |
| 615 | /* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */ |
| 616 | static void |
| 617 | android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 |
| 618 | (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) { |
| 619 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 620 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 621 | jint _remaining; |
| 622 | GLvoid *data = (GLvoid *) 0; |
| 623 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 624 | data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset); |
| 625 | if (data == NULL) { |
| 626 | char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 627 | data = (GLvoid *) (_dataBase + _bufferOffset); |
| 628 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 629 | glCompressedTexImage2D( |
| 630 | (GLenum)target, |
| 631 | (GLint)level, |
| 632 | (GLenum)internalformat, |
| 633 | (GLsizei)width, |
| 634 | (GLsizei)height, |
| 635 | (GLint)border, |
| 636 | (GLsizei)imageSize, |
| 637 | (GLvoid *)data |
| 638 | ); |
| 639 | if (_array) { |
| 640 | releasePointer(_env, _array, data, JNI_FALSE); |
| 641 | } |
| 642 | } |
| 643 | |
| 644 | /* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */ |
| 645 | static void |
| 646 | android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 |
| 647 | (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) { |
| 648 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 649 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 650 | jint _remaining; |
| 651 | GLvoid *data = (GLvoid *) 0; |
| 652 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 653 | data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset); |
| 654 | if (data == NULL) { |
| 655 | char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 656 | data = (GLvoid *) (_dataBase + _bufferOffset); |
| 657 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 658 | glCompressedTexSubImage2D( |
| 659 | (GLenum)target, |
| 660 | (GLint)level, |
| 661 | (GLint)xoffset, |
| 662 | (GLint)yoffset, |
| 663 | (GLsizei)width, |
| 664 | (GLsizei)height, |
| 665 | (GLenum)format, |
| 666 | (GLsizei)imageSize, |
| 667 | (GLvoid *)data |
| 668 | ); |
| 669 | if (_array) { |
| 670 | releasePointer(_env, _array, data, JNI_FALSE); |
| 671 | } |
| 672 | } |
| 673 | |
| 674 | /* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */ |
| 675 | static void |
| 676 | android_glCopyTexImage2D__IIIIIIII |
| 677 | (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) { |
| 678 | glCopyTexImage2D( |
| 679 | (GLenum)target, |
| 680 | (GLint)level, |
| 681 | (GLenum)internalformat, |
| 682 | (GLint)x, |
| 683 | (GLint)y, |
| 684 | (GLsizei)width, |
| 685 | (GLsizei)height, |
| 686 | (GLint)border |
| 687 | ); |
| 688 | } |
| 689 | |
| 690 | /* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */ |
| 691 | static void |
| 692 | android_glCopyTexSubImage2D__IIIIIIII |
| 693 | (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) { |
| 694 | glCopyTexSubImage2D( |
| 695 | (GLenum)target, |
| 696 | (GLint)level, |
| 697 | (GLint)xoffset, |
| 698 | (GLint)yoffset, |
| 699 | (GLint)x, |
| 700 | (GLint)y, |
| 701 | (GLsizei)width, |
| 702 | (GLsizei)height |
| 703 | ); |
| 704 | } |
| 705 | |
| 706 | /* GLuint glCreateProgram ( void ) */ |
| 707 | static jint |
| 708 | android_glCreateProgram__ |
| 709 | (JNIEnv *_env, jobject _this) { |
| 710 | GLuint _returnValue; |
| 711 | _returnValue = glCreateProgram(); |
| 712 | return _returnValue; |
| 713 | } |
| 714 | |
| 715 | /* GLuint glCreateShader ( GLenum type ) */ |
| 716 | static jint |
| 717 | android_glCreateShader__I |
| 718 | (JNIEnv *_env, jobject _this, jint type) { |
| 719 | GLuint _returnValue; |
| 720 | _returnValue = glCreateShader( |
| 721 | (GLenum)type |
| 722 | ); |
| 723 | return _returnValue; |
| 724 | } |
| 725 | |
| 726 | /* void glCullFace ( GLenum mode ) */ |
| 727 | static void |
| 728 | android_glCullFace__I |
| 729 | (JNIEnv *_env, jobject _this, jint mode) { |
| 730 | glCullFace( |
| 731 | (GLenum)mode |
| 732 | ); |
| 733 | } |
| 734 | |
| 735 | /* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */ |
| 736 | static void |
| 737 | android_glDeleteBuffers__I_3II |
| 738 | (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 739 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 740 | const char * _exceptionType = NULL; |
| 741 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 742 | GLuint *buffers_base = (GLuint *) 0; |
| 743 | jint _remaining; |
| 744 | GLuint *buffers = (GLuint *) 0; |
| 745 | |
| 746 | if (!buffers_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 747 | _exception = 1; |
| 748 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 749 | _exceptionMessage = "buffers == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 750 | goto exit; |
| 751 | } |
| 752 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 753 | _exception = 1; |
| 754 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 755 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 756 | goto exit; |
| 757 | } |
| 758 | _remaining = _env->GetArrayLength(buffers_ref) - offset; |
| 759 | if (_remaining < n) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 760 | _exception = 1; |
| 761 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 762 | _exceptionMessage = "length - offset < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 763 | goto exit; |
| 764 | } |
| 765 | buffers_base = (GLuint *) |
| 766 | _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0); |
| 767 | buffers = buffers_base + offset; |
| 768 | |
| 769 | glDeleteBuffers( |
| 770 | (GLsizei)n, |
| 771 | (GLuint *)buffers |
| 772 | ); |
| 773 | |
| 774 | exit: |
| 775 | if (buffers_base) { |
| 776 | _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base, |
| 777 | JNI_ABORT); |
| 778 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 779 | if (_exception) { |
| 780 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 781 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 782 | } |
| 783 | |
| 784 | /* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */ |
| 785 | static void |
| 786 | android_glDeleteBuffers__ILjava_nio_IntBuffer_2 |
| 787 | (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 788 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 789 | const char * _exceptionType = NULL; |
| 790 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 791 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 792 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 793 | jint _remaining; |
| 794 | GLuint *buffers = (GLuint *) 0; |
| 795 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 796 | buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 797 | if (_remaining < n) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 798 | _exception = 1; |
| 799 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 800 | _exceptionMessage = "remaining() < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 801 | goto exit; |
| 802 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 803 | if (buffers == NULL) { |
| 804 | char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 805 | buffers = (GLuint *) (_buffersBase + _bufferOffset); |
| 806 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 807 | glDeleteBuffers( |
| 808 | (GLsizei)n, |
| 809 | (GLuint *)buffers |
| 810 | ); |
| 811 | |
| 812 | exit: |
| 813 | if (_array) { |
| 814 | releasePointer(_env, _array, buffers, JNI_FALSE); |
| 815 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 816 | if (_exception) { |
| 817 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 818 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 819 | } |
| 820 | |
| 821 | /* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */ |
| 822 | static void |
| 823 | android_glDeleteFramebuffers__I_3II |
| 824 | (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 825 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 826 | const char * _exceptionType = NULL; |
| 827 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 828 | GLuint *framebuffers_base = (GLuint *) 0; |
| 829 | jint _remaining; |
| 830 | GLuint *framebuffers = (GLuint *) 0; |
| 831 | |
| 832 | if (!framebuffers_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 833 | _exception = 1; |
| 834 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 835 | _exceptionMessage = "framebuffers == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 836 | goto exit; |
| 837 | } |
| 838 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 839 | _exception = 1; |
| 840 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 841 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 842 | goto exit; |
| 843 | } |
| 844 | _remaining = _env->GetArrayLength(framebuffers_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 845 | if (_remaining < n) { |
| 846 | _exception = 1; |
| 847 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 848 | _exceptionMessage = "length - offset < n < needed"; |
| 849 | goto exit; |
| 850 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 851 | framebuffers_base = (GLuint *) |
| 852 | _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0); |
| 853 | framebuffers = framebuffers_base + offset; |
| 854 | |
| 855 | glDeleteFramebuffers( |
| 856 | (GLsizei)n, |
| 857 | (GLuint *)framebuffers |
| 858 | ); |
| 859 | |
| 860 | exit: |
| 861 | if (framebuffers_base) { |
| 862 | _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base, |
| 863 | JNI_ABORT); |
| 864 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 865 | if (_exception) { |
| 866 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 867 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 868 | } |
| 869 | |
| 870 | /* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */ |
| 871 | static void |
| 872 | android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2 |
| 873 | (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 874 | jint _exception = 0; |
| 875 | const char * _exceptionType = NULL; |
| 876 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 877 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 878 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 879 | jint _remaining; |
| 880 | GLuint *framebuffers = (GLuint *) 0; |
| 881 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 882 | framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 883 | if (_remaining < n) { |
| 884 | _exception = 1; |
| 885 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 886 | _exceptionMessage = "remaining() < n < needed"; |
| 887 | goto exit; |
| 888 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 889 | if (framebuffers == NULL) { |
| 890 | char * _framebuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 891 | framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset); |
| 892 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 893 | glDeleteFramebuffers( |
| 894 | (GLsizei)n, |
| 895 | (GLuint *)framebuffers |
| 896 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 897 | |
| 898 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 899 | if (_array) { |
| 900 | releasePointer(_env, _array, framebuffers, JNI_FALSE); |
| 901 | } |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 902 | if (_exception) { |
| 903 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 904 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 905 | } |
| 906 | |
| 907 | /* void glDeleteProgram ( GLuint program ) */ |
| 908 | static void |
| 909 | android_glDeleteProgram__I |
| 910 | (JNIEnv *_env, jobject _this, jint program) { |
| 911 | glDeleteProgram( |
| 912 | (GLuint)program |
| 913 | ); |
| 914 | } |
| 915 | |
| 916 | /* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */ |
| 917 | static void |
| 918 | android_glDeleteRenderbuffers__I_3II |
| 919 | (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 920 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 921 | const char * _exceptionType = NULL; |
| 922 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 923 | GLuint *renderbuffers_base = (GLuint *) 0; |
| 924 | jint _remaining; |
| 925 | GLuint *renderbuffers = (GLuint *) 0; |
| 926 | |
| 927 | if (!renderbuffers_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 928 | _exception = 1; |
| 929 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 930 | _exceptionMessage = "renderbuffers == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 931 | goto exit; |
| 932 | } |
| 933 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 934 | _exception = 1; |
| 935 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 936 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 937 | goto exit; |
| 938 | } |
| 939 | _remaining = _env->GetArrayLength(renderbuffers_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 940 | if (_remaining < n) { |
| 941 | _exception = 1; |
| 942 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 943 | _exceptionMessage = "length - offset < n < needed"; |
| 944 | goto exit; |
| 945 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 946 | renderbuffers_base = (GLuint *) |
| 947 | _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0); |
| 948 | renderbuffers = renderbuffers_base + offset; |
| 949 | |
| 950 | glDeleteRenderbuffers( |
| 951 | (GLsizei)n, |
| 952 | (GLuint *)renderbuffers |
| 953 | ); |
| 954 | |
| 955 | exit: |
| 956 | if (renderbuffers_base) { |
| 957 | _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base, |
| 958 | JNI_ABORT); |
| 959 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 960 | if (_exception) { |
| 961 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 962 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 963 | } |
| 964 | |
| 965 | /* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */ |
| 966 | static void |
| 967 | android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2 |
| 968 | (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 969 | jint _exception = 0; |
| 970 | const char * _exceptionType = NULL; |
| 971 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 972 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 973 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 974 | jint _remaining; |
| 975 | GLuint *renderbuffers = (GLuint *) 0; |
| 976 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 977 | renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 978 | if (_remaining < n) { |
| 979 | _exception = 1; |
| 980 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 981 | _exceptionMessage = "remaining() < n < needed"; |
| 982 | goto exit; |
| 983 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 984 | if (renderbuffers == NULL) { |
| 985 | char * _renderbuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 986 | renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset); |
| 987 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 988 | glDeleteRenderbuffers( |
| 989 | (GLsizei)n, |
| 990 | (GLuint *)renderbuffers |
| 991 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 992 | |
| 993 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 994 | if (_array) { |
| 995 | releasePointer(_env, _array, renderbuffers, JNI_FALSE); |
| 996 | } |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 997 | if (_exception) { |
| 998 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 999 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1000 | } |
| 1001 | |
| 1002 | /* void glDeleteShader ( GLuint shader ) */ |
| 1003 | static void |
| 1004 | android_glDeleteShader__I |
| 1005 | (JNIEnv *_env, jobject _this, jint shader) { |
| 1006 | glDeleteShader( |
| 1007 | (GLuint)shader |
| 1008 | ); |
| 1009 | } |
| 1010 | |
| 1011 | /* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */ |
| 1012 | static void |
| 1013 | android_glDeleteTextures__I_3II |
| 1014 | (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1015 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1016 | const char * _exceptionType = NULL; |
| 1017 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1018 | GLuint *textures_base = (GLuint *) 0; |
| 1019 | jint _remaining; |
| 1020 | GLuint *textures = (GLuint *) 0; |
| 1021 | |
| 1022 | if (!textures_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1023 | _exception = 1; |
| 1024 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1025 | _exceptionMessage = "textures == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1026 | goto exit; |
| 1027 | } |
| 1028 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1029 | _exception = 1; |
| 1030 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1031 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1032 | goto exit; |
| 1033 | } |
| 1034 | _remaining = _env->GetArrayLength(textures_ref) - offset; |
| 1035 | if (_remaining < n) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1036 | _exception = 1; |
| 1037 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1038 | _exceptionMessage = "length - offset < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1039 | goto exit; |
| 1040 | } |
| 1041 | textures_base = (GLuint *) |
| 1042 | _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0); |
| 1043 | textures = textures_base + offset; |
| 1044 | |
| 1045 | glDeleteTextures( |
| 1046 | (GLsizei)n, |
| 1047 | (GLuint *)textures |
| 1048 | ); |
| 1049 | |
| 1050 | exit: |
| 1051 | if (textures_base) { |
| 1052 | _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base, |
| 1053 | JNI_ABORT); |
| 1054 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1055 | if (_exception) { |
| 1056 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1057 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1058 | } |
| 1059 | |
| 1060 | /* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */ |
| 1061 | static void |
| 1062 | android_glDeleteTextures__ILjava_nio_IntBuffer_2 |
| 1063 | (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1064 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1065 | const char * _exceptionType = NULL; |
| 1066 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1067 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1068 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1069 | jint _remaining; |
| 1070 | GLuint *textures = (GLuint *) 0; |
| 1071 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1072 | textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1073 | if (_remaining < n) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1074 | _exception = 1; |
| 1075 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1076 | _exceptionMessage = "remaining() < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1077 | goto exit; |
| 1078 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1079 | if (textures == NULL) { |
| 1080 | char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1081 | textures = (GLuint *) (_texturesBase + _bufferOffset); |
| 1082 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1083 | glDeleteTextures( |
| 1084 | (GLsizei)n, |
| 1085 | (GLuint *)textures |
| 1086 | ); |
| 1087 | |
| 1088 | exit: |
| 1089 | if (_array) { |
| 1090 | releasePointer(_env, _array, textures, JNI_FALSE); |
| 1091 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1092 | if (_exception) { |
| 1093 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1094 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1095 | } |
| 1096 | |
| 1097 | /* void glDepthFunc ( GLenum func ) */ |
| 1098 | static void |
| 1099 | android_glDepthFunc__I |
| 1100 | (JNIEnv *_env, jobject _this, jint func) { |
| 1101 | glDepthFunc( |
| 1102 | (GLenum)func |
| 1103 | ); |
| 1104 | } |
| 1105 | |
| 1106 | /* void glDepthMask ( GLboolean flag ) */ |
| 1107 | static void |
| 1108 | android_glDepthMask__Z |
| 1109 | (JNIEnv *_env, jobject _this, jboolean flag) { |
| 1110 | glDepthMask( |
| 1111 | (GLboolean)flag |
| 1112 | ); |
| 1113 | } |
| 1114 | |
| 1115 | /* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */ |
| 1116 | static void |
| 1117 | android_glDepthRangef__FF |
| 1118 | (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) { |
| 1119 | glDepthRangef( |
| 1120 | (GLclampf)zNear, |
| 1121 | (GLclampf)zFar |
| 1122 | ); |
| 1123 | } |
| 1124 | |
| 1125 | /* void glDetachShader ( GLuint program, GLuint shader ) */ |
| 1126 | static void |
| 1127 | android_glDetachShader__II |
| 1128 | (JNIEnv *_env, jobject _this, jint program, jint shader) { |
| 1129 | glDetachShader( |
| 1130 | (GLuint)program, |
| 1131 | (GLuint)shader |
| 1132 | ); |
| 1133 | } |
| 1134 | |
| 1135 | /* void glDisable ( GLenum cap ) */ |
| 1136 | static void |
| 1137 | android_glDisable__I |
| 1138 | (JNIEnv *_env, jobject _this, jint cap) { |
| 1139 | glDisable( |
| 1140 | (GLenum)cap |
| 1141 | ); |
| 1142 | } |
| 1143 | |
| 1144 | /* void glDisableVertexAttribArray ( GLuint index ) */ |
| 1145 | static void |
| 1146 | android_glDisableVertexAttribArray__I |
| 1147 | (JNIEnv *_env, jobject _this, jint index) { |
| 1148 | glDisableVertexAttribArray( |
| 1149 | (GLuint)index |
| 1150 | ); |
| 1151 | } |
| 1152 | |
| 1153 | /* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */ |
| 1154 | static void |
| 1155 | android_glDrawArrays__III |
| 1156 | (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) { |
| 1157 | glDrawArrays( |
| 1158 | (GLenum)mode, |
| 1159 | (GLint)first, |
| 1160 | (GLsizei)count |
| 1161 | ); |
| 1162 | } |
| 1163 | |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 1164 | /* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */ |
| 1165 | static void |
| 1166 | android_glDrawElements__IIII |
| 1167 | (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1168 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1169 | const char * _exceptionType = NULL; |
| 1170 | const char * _exceptionMessage = NULL; |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 1171 | glDrawElements( |
| 1172 | (GLenum)mode, |
| 1173 | (GLsizei)count, |
| 1174 | (GLenum)type, |
| 1175 | (const GLvoid *)offset |
| 1176 | ); |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1177 | if (_exception) { |
| 1178 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1179 | } |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 1180 | } |
| 1181 | |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1182 | /* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */ |
| 1183 | static void |
| 1184 | android_glDrawElements__IIILjava_nio_Buffer_2 |
| 1185 | (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1186 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1187 | const char * _exceptionType = NULL; |
| 1188 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1189 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1190 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1191 | jint _remaining; |
| 1192 | GLvoid *indices = (GLvoid *) 0; |
| 1193 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1194 | indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1195 | if (_remaining < count) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1196 | _exception = 1; |
| 1197 | _exceptionType = "java/lang/ArrayIndexOutOfBoundsException"; |
| 1198 | _exceptionMessage = "remaining() < count < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1199 | goto exit; |
| 1200 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1201 | if (indices == NULL) { |
| 1202 | char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1203 | indices = (GLvoid *) (_indicesBase + _bufferOffset); |
| 1204 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1205 | glDrawElements( |
| 1206 | (GLenum)mode, |
| 1207 | (GLsizei)count, |
| 1208 | (GLenum)type, |
| 1209 | (GLvoid *)indices |
| 1210 | ); |
| 1211 | |
| 1212 | exit: |
| 1213 | if (_array) { |
| 1214 | releasePointer(_env, _array, indices, JNI_FALSE); |
| 1215 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1216 | if (_exception) { |
| 1217 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1218 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1219 | } |
| 1220 | |
| 1221 | /* void glEnable ( GLenum cap ) */ |
| 1222 | static void |
| 1223 | android_glEnable__I |
| 1224 | (JNIEnv *_env, jobject _this, jint cap) { |
| 1225 | glEnable( |
| 1226 | (GLenum)cap |
| 1227 | ); |
| 1228 | } |
| 1229 | |
| 1230 | /* void glEnableVertexAttribArray ( GLuint index ) */ |
| 1231 | static void |
| 1232 | android_glEnableVertexAttribArray__I |
| 1233 | (JNIEnv *_env, jobject _this, jint index) { |
| 1234 | glEnableVertexAttribArray( |
| 1235 | (GLuint)index |
| 1236 | ); |
| 1237 | } |
| 1238 | |
| 1239 | /* void glFinish ( void ) */ |
| 1240 | static void |
| 1241 | android_glFinish__ |
| 1242 | (JNIEnv *_env, jobject _this) { |
| 1243 | glFinish(); |
| 1244 | } |
| 1245 | |
| 1246 | /* void glFlush ( void ) */ |
| 1247 | static void |
| 1248 | android_glFlush__ |
| 1249 | (JNIEnv *_env, jobject _this) { |
| 1250 | glFlush(); |
| 1251 | } |
| 1252 | |
| 1253 | /* void glFramebufferRenderbuffer ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) */ |
| 1254 | static void |
| 1255 | android_glFramebufferRenderbuffer__IIII |
| 1256 | (JNIEnv *_env, jobject _this, jint target, jint attachment, jint renderbuffertarget, jint renderbuffer) { |
| 1257 | glFramebufferRenderbuffer( |
| 1258 | (GLenum)target, |
| 1259 | (GLenum)attachment, |
| 1260 | (GLenum)renderbuffertarget, |
| 1261 | (GLuint)renderbuffer |
| 1262 | ); |
| 1263 | } |
| 1264 | |
| 1265 | /* void glFramebufferTexture2D ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) */ |
| 1266 | static void |
| 1267 | android_glFramebufferTexture2D__IIIII |
| 1268 | (JNIEnv *_env, jobject _this, jint target, jint attachment, jint textarget, jint texture, jint level) { |
| 1269 | glFramebufferTexture2D( |
| 1270 | (GLenum)target, |
| 1271 | (GLenum)attachment, |
| 1272 | (GLenum)textarget, |
| 1273 | (GLuint)texture, |
| 1274 | (GLint)level |
| 1275 | ); |
| 1276 | } |
| 1277 | |
| 1278 | /* void glFrontFace ( GLenum mode ) */ |
| 1279 | static void |
| 1280 | android_glFrontFace__I |
| 1281 | (JNIEnv *_env, jobject _this, jint mode) { |
| 1282 | glFrontFace( |
| 1283 | (GLenum)mode |
| 1284 | ); |
| 1285 | } |
| 1286 | |
| 1287 | /* void glGenBuffers ( GLsizei n, GLuint *buffers ) */ |
| 1288 | static void |
| 1289 | android_glGenBuffers__I_3II |
| 1290 | (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) { |
| 1291 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1292 | const char * _exceptionType = NULL; |
| 1293 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1294 | GLuint *buffers_base = (GLuint *) 0; |
| 1295 | jint _remaining; |
| 1296 | GLuint *buffers = (GLuint *) 0; |
| 1297 | |
| 1298 | if (!buffers_ref) { |
| 1299 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1300 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1301 | _exceptionMessage = "buffers == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1302 | goto exit; |
| 1303 | } |
| 1304 | if (offset < 0) { |
| 1305 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1306 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1307 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1308 | goto exit; |
| 1309 | } |
| 1310 | _remaining = _env->GetArrayLength(buffers_ref) - offset; |
| 1311 | if (_remaining < n) { |
| 1312 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1313 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1314 | _exceptionMessage = "length - offset < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1315 | goto exit; |
| 1316 | } |
| 1317 | buffers_base = (GLuint *) |
| 1318 | _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0); |
| 1319 | buffers = buffers_base + offset; |
| 1320 | |
| 1321 | glGenBuffers( |
| 1322 | (GLsizei)n, |
| 1323 | (GLuint *)buffers |
| 1324 | ); |
| 1325 | |
| 1326 | exit: |
| 1327 | if (buffers_base) { |
| 1328 | _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base, |
| 1329 | _exception ? JNI_ABORT: 0); |
| 1330 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1331 | if (_exception) { |
| 1332 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1333 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1334 | } |
| 1335 | |
| 1336 | /* void glGenBuffers ( GLsizei n, GLuint *buffers ) */ |
| 1337 | static void |
| 1338 | android_glGenBuffers__ILjava_nio_IntBuffer_2 |
| 1339 | (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) { |
| 1340 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1341 | const char * _exceptionType = NULL; |
| 1342 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1343 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1344 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1345 | jint _remaining; |
| 1346 | GLuint *buffers = (GLuint *) 0; |
| 1347 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1348 | buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1349 | if (_remaining < n) { |
| 1350 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1351 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1352 | _exceptionMessage = "remaining() < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1353 | goto exit; |
| 1354 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1355 | if (buffers == NULL) { |
| 1356 | char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1357 | buffers = (GLuint *) (_buffersBase + _bufferOffset); |
| 1358 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1359 | glGenBuffers( |
| 1360 | (GLsizei)n, |
| 1361 | (GLuint *)buffers |
| 1362 | ); |
| 1363 | |
| 1364 | exit: |
| 1365 | if (_array) { |
| 1366 | releasePointer(_env, _array, buffers, _exception ? JNI_FALSE : JNI_TRUE); |
| 1367 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1368 | if (_exception) { |
| 1369 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1370 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1371 | } |
| 1372 | |
| 1373 | /* void glGenerateMipmap ( GLenum target ) */ |
| 1374 | static void |
| 1375 | android_glGenerateMipmap__I |
| 1376 | (JNIEnv *_env, jobject _this, jint target) { |
| 1377 | glGenerateMipmap( |
| 1378 | (GLenum)target |
| 1379 | ); |
| 1380 | } |
| 1381 | |
| 1382 | /* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */ |
| 1383 | static void |
| 1384 | android_glGenFramebuffers__I_3II |
| 1385 | (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) { |
| 1386 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1387 | const char * _exceptionType = NULL; |
| 1388 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1389 | GLuint *framebuffers_base = (GLuint *) 0; |
| 1390 | jint _remaining; |
| 1391 | GLuint *framebuffers = (GLuint *) 0; |
| 1392 | |
| 1393 | if (!framebuffers_ref) { |
| 1394 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1395 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1396 | _exceptionMessage = "framebuffers == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1397 | goto exit; |
| 1398 | } |
| 1399 | if (offset < 0) { |
| 1400 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1401 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1402 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1403 | goto exit; |
| 1404 | } |
| 1405 | _remaining = _env->GetArrayLength(framebuffers_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1406 | if (_remaining < n) { |
| 1407 | _exception = 1; |
| 1408 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1409 | _exceptionMessage = "length - offset < n < needed"; |
| 1410 | goto exit; |
| 1411 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1412 | framebuffers_base = (GLuint *) |
| 1413 | _env->GetPrimitiveArrayCritical(framebuffers_ref, (jboolean *)0); |
| 1414 | framebuffers = framebuffers_base + offset; |
| 1415 | |
| 1416 | glGenFramebuffers( |
| 1417 | (GLsizei)n, |
| 1418 | (GLuint *)framebuffers |
| 1419 | ); |
| 1420 | |
| 1421 | exit: |
| 1422 | if (framebuffers_base) { |
| 1423 | _env->ReleasePrimitiveArrayCritical(framebuffers_ref, framebuffers_base, |
| 1424 | _exception ? JNI_ABORT: 0); |
| 1425 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1426 | if (_exception) { |
| 1427 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1428 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1429 | } |
| 1430 | |
| 1431 | /* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */ |
| 1432 | static void |
| 1433 | android_glGenFramebuffers__ILjava_nio_IntBuffer_2 |
| 1434 | (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1435 | jint _exception = 0; |
| 1436 | const char * _exceptionType = NULL; |
| 1437 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1438 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1439 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1440 | jint _remaining; |
| 1441 | GLuint *framebuffers = (GLuint *) 0; |
| 1442 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1443 | framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1444 | if (_remaining < n) { |
| 1445 | _exception = 1; |
| 1446 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1447 | _exceptionMessage = "remaining() < n < needed"; |
| 1448 | goto exit; |
| 1449 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1450 | if (framebuffers == NULL) { |
| 1451 | char * _framebuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1452 | framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset); |
| 1453 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1454 | glGenFramebuffers( |
| 1455 | (GLsizei)n, |
| 1456 | (GLuint *)framebuffers |
| 1457 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1458 | |
| 1459 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1460 | if (_array) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1461 | releasePointer(_env, _array, framebuffers, _exception ? JNI_FALSE : JNI_TRUE); |
| 1462 | } |
| 1463 | if (_exception) { |
| 1464 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1465 | } |
| 1466 | } |
| 1467 | |
| 1468 | /* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */ |
| 1469 | static void |
| 1470 | android_glGenRenderbuffers__I_3II |
| 1471 | (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) { |
| 1472 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1473 | const char * _exceptionType = NULL; |
| 1474 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1475 | GLuint *renderbuffers_base = (GLuint *) 0; |
| 1476 | jint _remaining; |
| 1477 | GLuint *renderbuffers = (GLuint *) 0; |
| 1478 | |
| 1479 | if (!renderbuffers_ref) { |
| 1480 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1481 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1482 | _exceptionMessage = "renderbuffers == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1483 | goto exit; |
| 1484 | } |
| 1485 | if (offset < 0) { |
| 1486 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1487 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1488 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1489 | goto exit; |
| 1490 | } |
| 1491 | _remaining = _env->GetArrayLength(renderbuffers_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1492 | if (_remaining < n) { |
| 1493 | _exception = 1; |
| 1494 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1495 | _exceptionMessage = "length - offset < n < needed"; |
| 1496 | goto exit; |
| 1497 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1498 | renderbuffers_base = (GLuint *) |
| 1499 | _env->GetPrimitiveArrayCritical(renderbuffers_ref, (jboolean *)0); |
| 1500 | renderbuffers = renderbuffers_base + offset; |
| 1501 | |
| 1502 | glGenRenderbuffers( |
| 1503 | (GLsizei)n, |
| 1504 | (GLuint *)renderbuffers |
| 1505 | ); |
| 1506 | |
| 1507 | exit: |
| 1508 | if (renderbuffers_base) { |
| 1509 | _env->ReleasePrimitiveArrayCritical(renderbuffers_ref, renderbuffers_base, |
| 1510 | _exception ? JNI_ABORT: 0); |
| 1511 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1512 | if (_exception) { |
| 1513 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1514 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1515 | } |
| 1516 | |
| 1517 | /* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */ |
| 1518 | static void |
| 1519 | android_glGenRenderbuffers__ILjava_nio_IntBuffer_2 |
| 1520 | (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1521 | jint _exception = 0; |
| 1522 | const char * _exceptionType = NULL; |
| 1523 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1524 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1525 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1526 | jint _remaining; |
| 1527 | GLuint *renderbuffers = (GLuint *) 0; |
| 1528 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1529 | renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1530 | if (_remaining < n) { |
| 1531 | _exception = 1; |
| 1532 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1533 | _exceptionMessage = "remaining() < n < needed"; |
| 1534 | goto exit; |
| 1535 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1536 | if (renderbuffers == NULL) { |
| 1537 | char * _renderbuffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1538 | renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset); |
| 1539 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1540 | glGenRenderbuffers( |
| 1541 | (GLsizei)n, |
| 1542 | (GLuint *)renderbuffers |
| 1543 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1544 | |
| 1545 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1546 | if (_array) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1547 | releasePointer(_env, _array, renderbuffers, _exception ? JNI_FALSE : JNI_TRUE); |
| 1548 | } |
| 1549 | if (_exception) { |
| 1550 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1551 | } |
| 1552 | } |
| 1553 | |
| 1554 | /* void glGenTextures ( GLsizei n, GLuint *textures ) */ |
| 1555 | static void |
| 1556 | android_glGenTextures__I_3II |
| 1557 | (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) { |
| 1558 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1559 | const char * _exceptionType = NULL; |
| 1560 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1561 | GLuint *textures_base = (GLuint *) 0; |
| 1562 | jint _remaining; |
| 1563 | GLuint *textures = (GLuint *) 0; |
| 1564 | |
| 1565 | if (!textures_ref) { |
| 1566 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1567 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1568 | _exceptionMessage = "textures == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1569 | goto exit; |
| 1570 | } |
| 1571 | if (offset < 0) { |
| 1572 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1573 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1574 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1575 | goto exit; |
| 1576 | } |
| 1577 | _remaining = _env->GetArrayLength(textures_ref) - offset; |
| 1578 | if (_remaining < n) { |
| 1579 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1580 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1581 | _exceptionMessage = "length - offset < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1582 | goto exit; |
| 1583 | } |
| 1584 | textures_base = (GLuint *) |
| 1585 | _env->GetPrimitiveArrayCritical(textures_ref, (jboolean *)0); |
| 1586 | textures = textures_base + offset; |
| 1587 | |
| 1588 | glGenTextures( |
| 1589 | (GLsizei)n, |
| 1590 | (GLuint *)textures |
| 1591 | ); |
| 1592 | |
| 1593 | exit: |
| 1594 | if (textures_base) { |
| 1595 | _env->ReleasePrimitiveArrayCritical(textures_ref, textures_base, |
| 1596 | _exception ? JNI_ABORT: 0); |
| 1597 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1598 | if (_exception) { |
| 1599 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1600 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1601 | } |
| 1602 | |
| 1603 | /* void glGenTextures ( GLsizei n, GLuint *textures ) */ |
| 1604 | static void |
| 1605 | android_glGenTextures__ILjava_nio_IntBuffer_2 |
| 1606 | (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) { |
| 1607 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1608 | const char * _exceptionType = NULL; |
| 1609 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1610 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1611 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1612 | jint _remaining; |
| 1613 | GLuint *textures = (GLuint *) 0; |
| 1614 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1615 | textures = (GLuint *)getPointer(_env, textures_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1616 | if (_remaining < n) { |
| 1617 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1618 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1619 | _exceptionMessage = "remaining() < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1620 | goto exit; |
| 1621 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1622 | if (textures == NULL) { |
| 1623 | char * _texturesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1624 | textures = (GLuint *) (_texturesBase + _bufferOffset); |
| 1625 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1626 | glGenTextures( |
| 1627 | (GLsizei)n, |
| 1628 | (GLuint *)textures |
| 1629 | ); |
| 1630 | |
| 1631 | exit: |
| 1632 | if (_array) { |
| 1633 | releasePointer(_env, _array, textures, _exception ? JNI_FALSE : JNI_TRUE); |
| 1634 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1635 | if (_exception) { |
| 1636 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1637 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1638 | } |
| 1639 | |
| 1640 | /* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 1641 | static void |
| 1642 | android_glGetActiveAttrib__III_3II_3II_3II_3BI |
| 1643 | (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) { |
| 1644 | jint _exception = 0; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1645 | const char * _exceptionType; |
| 1646 | const char * _exceptionMessage; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1647 | GLsizei *length_base = (GLsizei *) 0; |
| 1648 | jint _lengthRemaining; |
| 1649 | GLsizei *length = (GLsizei *) 0; |
| 1650 | GLint *size_base = (GLint *) 0; |
| 1651 | jint _sizeRemaining; |
| 1652 | GLint *size = (GLint *) 0; |
| 1653 | GLenum *type_base = (GLenum *) 0; |
| 1654 | jint _typeRemaining; |
| 1655 | GLenum *type = (GLenum *) 0; |
| 1656 | char *name_base = (char *) 0; |
| 1657 | jint _nameRemaining; |
| 1658 | char *name = (char *) 0; |
| 1659 | |
| 1660 | if (!length_ref) { |
| 1661 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1662 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1663 | _exceptionMessage = "length == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1664 | goto exit; |
| 1665 | } |
| 1666 | if (lengthOffset < 0) { |
| 1667 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1668 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1669 | _exceptionMessage = "lengthOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1670 | goto exit; |
| 1671 | } |
| 1672 | _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; |
| 1673 | length_base = (GLsizei *) |
| 1674 | _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0); |
| 1675 | length = length_base + lengthOffset; |
| 1676 | |
| 1677 | if (!size_ref) { |
| 1678 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1679 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1680 | _exceptionMessage = "size == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1681 | goto exit; |
| 1682 | } |
| 1683 | if (sizeOffset < 0) { |
| 1684 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1685 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1686 | _exceptionMessage = "sizeOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1687 | goto exit; |
| 1688 | } |
| 1689 | _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; |
| 1690 | size_base = (GLint *) |
| 1691 | _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0); |
| 1692 | size = size_base + sizeOffset; |
| 1693 | |
| 1694 | if (!type_ref) { |
| 1695 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1696 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1697 | _exceptionMessage = "type == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1698 | goto exit; |
| 1699 | } |
| 1700 | if (typeOffset < 0) { |
| 1701 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1702 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1703 | _exceptionMessage = "typeOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1704 | goto exit; |
| 1705 | } |
| 1706 | _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; |
| 1707 | type_base = (GLenum *) |
| 1708 | _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0); |
| 1709 | type = type_base + typeOffset; |
| 1710 | |
| 1711 | if (!name_ref) { |
| 1712 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1713 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1714 | _exceptionMessage = "name == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1715 | goto exit; |
| 1716 | } |
| 1717 | if (nameOffset < 0) { |
| 1718 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1719 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1720 | _exceptionMessage = "nameOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1721 | goto exit; |
| 1722 | } |
| 1723 | _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset; |
| 1724 | name_base = (char *) |
| 1725 | _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0); |
| 1726 | name = name_base + nameOffset; |
| 1727 | |
| 1728 | glGetActiveAttrib( |
| 1729 | (GLuint)program, |
| 1730 | (GLuint)index, |
| 1731 | (GLsizei)bufsize, |
| 1732 | (GLsizei *)length, |
| 1733 | (GLint *)size, |
| 1734 | (GLenum *)type, |
| 1735 | (char *)name |
| 1736 | ); |
| 1737 | |
| 1738 | exit: |
| 1739 | if (name_base) { |
| 1740 | _env->ReleasePrimitiveArrayCritical(name_ref, name_base, |
| 1741 | _exception ? JNI_ABORT: 0); |
| 1742 | } |
| 1743 | if (type_base) { |
| 1744 | _env->ReleasePrimitiveArrayCritical(type_ref, type_base, |
| 1745 | _exception ? JNI_ABORT: 0); |
| 1746 | } |
| 1747 | if (size_base) { |
| 1748 | _env->ReleasePrimitiveArrayCritical(size_ref, size_base, |
| 1749 | _exception ? JNI_ABORT: 0); |
| 1750 | } |
| 1751 | if (length_base) { |
| 1752 | _env->ReleasePrimitiveArrayCritical(length_ref, length_base, |
| 1753 | _exception ? JNI_ABORT: 0); |
| 1754 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1755 | if (_exception) { |
| 1756 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1757 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1758 | } |
| 1759 | |
| 1760 | /* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 1761 | static void |
| 1762 | android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B |
| 1763 | (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) { |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1764 | jarray _lengthArray = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1765 | jint _lengthBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1766 | jarray _sizeArray = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1767 | jint _sizeBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1768 | jarray _typeArray = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1769 | jint _typeBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1770 | jint _lengthRemaining; |
| 1771 | GLsizei *length = (GLsizei *) 0; |
| 1772 | jint _sizeRemaining; |
| 1773 | GLint *size = (GLint *) 0; |
| 1774 | jint _typeRemaining; |
| 1775 | GLenum *type = (GLenum *) 0; |
| 1776 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1777 | length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset); |
| 1778 | size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset); |
| 1779 | type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset); |
| 1780 | if (length == NULL) { |
| 1781 | char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0); |
| 1782 | length = (GLsizei *) (_lengthBase + _lengthBufferOffset); |
| 1783 | } |
| 1784 | if (size == NULL) { |
| 1785 | char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0); |
| 1786 | size = (GLint *) (_sizeBase + _sizeBufferOffset); |
| 1787 | } |
| 1788 | if (type == NULL) { |
| 1789 | char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0); |
| 1790 | type = (GLenum *) (_typeBase + _typeBufferOffset); |
| 1791 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1792 | glGetActiveAttrib( |
| 1793 | (GLuint)program, |
| 1794 | (GLuint)index, |
| 1795 | (GLsizei)bufsize, |
| 1796 | (GLsizei *)length, |
| 1797 | (GLint *)size, |
| 1798 | (GLenum *)type, |
| 1799 | (char *)name |
| 1800 | ); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1801 | if (_typeArray) { |
| 1802 | releasePointer(_env, _typeArray, type, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1803 | } |
| 1804 | if (_sizeArray) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1805 | releasePointer(_env, _sizeArray, size, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1806 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1807 | if (_lengthArray) { |
| 1808 | releasePointer(_env, _lengthArray, length, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1809 | } |
| 1810 | } |
| 1811 | |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 1812 | /* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 1813 | static jstring |
| 1814 | android_glGetActiveAttrib1 |
| 1815 | (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) { |
| 1816 | jint _exception = 0; |
| 1817 | const char * _exceptionType; |
| 1818 | const char * _exceptionMessage; |
| 1819 | GLint *size_base = (GLint *) 0; |
| 1820 | jint _sizeRemaining; |
| 1821 | GLint *size = (GLint *) 0; |
| 1822 | GLenum *type_base = (GLenum *) 0; |
| 1823 | jint _typeRemaining; |
| 1824 | GLenum *type = (GLenum *) 0; |
| 1825 | |
| 1826 | jstring result = 0; |
| 1827 | |
| 1828 | GLint len = 0; |
| 1829 | glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len); |
| 1830 | if (!len) { |
| 1831 | return _env->NewStringUTF(""); |
| 1832 | } |
| 1833 | char* buf = (char*) malloc(len); |
| 1834 | |
| 1835 | if (buf == NULL) { |
| 1836 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 1837 | return NULL; |
| 1838 | } |
| 1839 | if (!size_ref) { |
| 1840 | _exception = 1; |
| 1841 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1842 | _exceptionMessage = "size == null"; |
| 1843 | goto exit; |
| 1844 | } |
| 1845 | if (sizeOffset < 0) { |
| 1846 | _exception = 1; |
| 1847 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1848 | _exceptionMessage = "sizeOffset < 0"; |
| 1849 | goto exit; |
| 1850 | } |
| 1851 | _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; |
| 1852 | size_base = (GLint *) |
| 1853 | _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0); |
| 1854 | size = size_base + sizeOffset; |
| 1855 | |
| 1856 | if (!type_ref) { |
| 1857 | _exception = 1; |
| 1858 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1859 | _exceptionMessage = "type == null"; |
| 1860 | goto exit; |
| 1861 | } |
| 1862 | if (typeOffset < 0) { |
| 1863 | _exception = 1; |
| 1864 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1865 | _exceptionMessage = "typeOffset < 0"; |
| 1866 | goto exit; |
| 1867 | } |
| 1868 | _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; |
| 1869 | type_base = (GLenum *) |
| 1870 | _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0); |
| 1871 | type = type_base + typeOffset; |
| 1872 | |
| 1873 | glGetActiveAttrib( |
| 1874 | (GLuint)program, |
| 1875 | (GLuint)index, |
| 1876 | (GLsizei)len, |
| 1877 | NULL, |
| 1878 | (GLint *)size, |
| 1879 | (GLenum *)type, |
| 1880 | (char *)buf |
| 1881 | ); |
| 1882 | exit: |
| 1883 | if (type_base) { |
| 1884 | _env->ReleasePrimitiveArrayCritical(type_ref, type_base, |
| 1885 | _exception ? JNI_ABORT: 0); |
| 1886 | } |
| 1887 | if (size_base) { |
| 1888 | _env->ReleasePrimitiveArrayCritical(size_ref, size_base, |
| 1889 | _exception ? JNI_ABORT: 0); |
| 1890 | } |
| 1891 | if (_exception != 1) { |
| 1892 | result = _env->NewStringUTF(buf); |
| 1893 | } |
| 1894 | if (buf) { |
| 1895 | free(buf); |
| 1896 | } |
| 1897 | if (_exception) { |
| 1898 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1899 | } |
| 1900 | if (result == 0) { |
| 1901 | result = _env->NewStringUTF(""); |
| 1902 | } |
| 1903 | |
| 1904 | return result; |
| 1905 | } |
| 1906 | |
| 1907 | /* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 1908 | static jstring |
| 1909 | android_glGetActiveAttrib2 |
| 1910 | (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) { |
| 1911 | jarray _sizeArray = (jarray) 0; |
| 1912 | jint _sizeBufferOffset = (jint) 0; |
| 1913 | jarray _typeArray = (jarray) 0; |
| 1914 | jint _typeBufferOffset = (jint) 0; |
| 1915 | jint _lengthRemaining; |
| 1916 | GLsizei *length = (GLsizei *) 0; |
| 1917 | jint _sizeRemaining; |
| 1918 | GLint *size = (GLint *) 0; |
| 1919 | jint _typeRemaining; |
| 1920 | GLenum *type = (GLenum *) 0; |
| 1921 | |
| 1922 | jstring result = 0; |
| 1923 | |
| 1924 | GLint len = 0; |
| 1925 | glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len); |
| 1926 | if (!len) { |
| 1927 | return _env->NewStringUTF(""); |
| 1928 | } |
| 1929 | char* buf = (char*) malloc(len); |
| 1930 | |
| 1931 | if (buf == NULL) { |
| 1932 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 1933 | return NULL; |
| 1934 | } |
| 1935 | |
| 1936 | size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset); |
| 1937 | type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset); |
| 1938 | if (size == NULL) { |
| 1939 | char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0); |
| 1940 | size = (GLint *) (_sizeBase + _sizeBufferOffset); |
| 1941 | } |
| 1942 | if (type == NULL) { |
| 1943 | char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0); |
| 1944 | type = (GLenum *) (_typeBase + _typeBufferOffset); |
| 1945 | } |
| 1946 | glGetActiveAttrib( |
| 1947 | (GLuint)program, |
| 1948 | (GLuint)index, |
| 1949 | (GLsizei)len, |
| 1950 | NULL, |
| 1951 | (GLint *)size, |
| 1952 | (GLenum *)type, |
| 1953 | (char *)buf |
| 1954 | ); |
| 1955 | |
| 1956 | if (_typeArray) { |
| 1957 | releasePointer(_env, _typeArray, type, JNI_TRUE); |
| 1958 | } |
| 1959 | if (_sizeArray) { |
| 1960 | releasePointer(_env, _sizeArray, size, JNI_TRUE); |
| 1961 | } |
| 1962 | result = _env->NewStringUTF(buf); |
| 1963 | if (buf) { |
| 1964 | free(buf); |
| 1965 | } |
| 1966 | return result; |
| 1967 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1968 | /* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 1969 | static void |
| 1970 | android_glGetActiveUniform__III_3II_3II_3II_3BI |
| 1971 | (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) { |
| 1972 | jint _exception = 0; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1973 | const char * _exceptionType; |
| 1974 | const char * _exceptionMessage; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1975 | GLsizei *length_base = (GLsizei *) 0; |
| 1976 | jint _lengthRemaining; |
| 1977 | GLsizei *length = (GLsizei *) 0; |
| 1978 | GLint *size_base = (GLint *) 0; |
| 1979 | jint _sizeRemaining; |
| 1980 | GLint *size = (GLint *) 0; |
| 1981 | GLenum *type_base = (GLenum *) 0; |
| 1982 | jint _typeRemaining; |
| 1983 | GLenum *type = (GLenum *) 0; |
| 1984 | char *name_base = (char *) 0; |
| 1985 | jint _nameRemaining; |
| 1986 | char *name = (char *) 0; |
| 1987 | |
| 1988 | if (!length_ref) { |
| 1989 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1990 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1991 | _exceptionMessage = "length == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1992 | goto exit; |
| 1993 | } |
| 1994 | if (lengthOffset < 0) { |
| 1995 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1996 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1997 | _exceptionMessage = "lengthOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1998 | goto exit; |
| 1999 | } |
| 2000 | _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; |
| 2001 | length_base = (GLsizei *) |
| 2002 | _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0); |
| 2003 | length = length_base + lengthOffset; |
| 2004 | |
| 2005 | if (!size_ref) { |
| 2006 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2007 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2008 | _exceptionMessage = "size == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2009 | goto exit; |
| 2010 | } |
| 2011 | if (sizeOffset < 0) { |
| 2012 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2013 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2014 | _exceptionMessage = "sizeOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2015 | goto exit; |
| 2016 | } |
| 2017 | _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; |
| 2018 | size_base = (GLint *) |
| 2019 | _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0); |
| 2020 | size = size_base + sizeOffset; |
| 2021 | |
| 2022 | if (!type_ref) { |
| 2023 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2024 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2025 | _exceptionMessage = "type == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2026 | goto exit; |
| 2027 | } |
| 2028 | if (typeOffset < 0) { |
| 2029 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2030 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2031 | _exceptionMessage = "typeOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2032 | goto exit; |
| 2033 | } |
| 2034 | _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; |
| 2035 | type_base = (GLenum *) |
| 2036 | _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0); |
| 2037 | type = type_base + typeOffset; |
| 2038 | |
| 2039 | if (!name_ref) { |
| 2040 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2041 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2042 | _exceptionMessage = "name == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2043 | goto exit; |
| 2044 | } |
| 2045 | if (nameOffset < 0) { |
| 2046 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2047 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2048 | _exceptionMessage = "nameOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2049 | goto exit; |
| 2050 | } |
| 2051 | _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset; |
| 2052 | name_base = (char *) |
| 2053 | _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0); |
| 2054 | name = name_base + nameOffset; |
| 2055 | |
| 2056 | glGetActiveUniform( |
| 2057 | (GLuint)program, |
| 2058 | (GLuint)index, |
| 2059 | (GLsizei)bufsize, |
| 2060 | (GLsizei *)length, |
| 2061 | (GLint *)size, |
| 2062 | (GLenum *)type, |
| 2063 | (char *)name |
| 2064 | ); |
| 2065 | |
| 2066 | exit: |
| 2067 | if (name_base) { |
| 2068 | _env->ReleasePrimitiveArrayCritical(name_ref, name_base, |
| 2069 | _exception ? JNI_ABORT: 0); |
| 2070 | } |
| 2071 | if (type_base) { |
| 2072 | _env->ReleasePrimitiveArrayCritical(type_ref, type_base, |
| 2073 | _exception ? JNI_ABORT: 0); |
| 2074 | } |
| 2075 | if (size_base) { |
| 2076 | _env->ReleasePrimitiveArrayCritical(size_ref, size_base, |
| 2077 | _exception ? JNI_ABORT: 0); |
| 2078 | } |
| 2079 | if (length_base) { |
| 2080 | _env->ReleasePrimitiveArrayCritical(length_ref, length_base, |
| 2081 | _exception ? JNI_ABORT: 0); |
| 2082 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2083 | if (_exception) { |
| 2084 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2085 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2086 | } |
| 2087 | |
| 2088 | /* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 2089 | static void |
| 2090 | android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B |
| 2091 | (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) { |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2092 | jarray _lengthArray = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2093 | jint _lengthBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2094 | jarray _sizeArray = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2095 | jint _sizeBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2096 | jarray _typeArray = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2097 | jint _typeBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2098 | jint _lengthRemaining; |
| 2099 | GLsizei *length = (GLsizei *) 0; |
| 2100 | jint _sizeRemaining; |
| 2101 | GLint *size = (GLint *) 0; |
| 2102 | jint _typeRemaining; |
| 2103 | GLenum *type = (GLenum *) 0; |
| 2104 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2105 | length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset); |
| 2106 | size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset); |
| 2107 | type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset); |
| 2108 | if (length == NULL) { |
| 2109 | char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0); |
| 2110 | length = (GLsizei *) (_lengthBase + _lengthBufferOffset); |
| 2111 | } |
| 2112 | if (size == NULL) { |
| 2113 | char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0); |
| 2114 | size = (GLint *) (_sizeBase + _sizeBufferOffset); |
| 2115 | } |
| 2116 | if (type == NULL) { |
| 2117 | char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0); |
| 2118 | type = (GLenum *) (_typeBase + _typeBufferOffset); |
| 2119 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2120 | glGetActiveUniform( |
| 2121 | (GLuint)program, |
| 2122 | (GLuint)index, |
| 2123 | (GLsizei)bufsize, |
| 2124 | (GLsizei *)length, |
| 2125 | (GLint *)size, |
| 2126 | (GLenum *)type, |
| 2127 | (char *)name |
| 2128 | ); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2129 | if (_typeArray) { |
| 2130 | releasePointer(_env, _typeArray, type, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2131 | } |
| 2132 | if (_sizeArray) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2133 | releasePointer(_env, _sizeArray, size, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2134 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2135 | if (_lengthArray) { |
| 2136 | releasePointer(_env, _lengthArray, length, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2137 | } |
| 2138 | } |
| 2139 | |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2140 | /* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 2141 | static jstring |
| 2142 | android_glGetActiveUniform1 |
| 2143 | (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) { |
| 2144 | jint _exception = 0; |
| 2145 | const char * _exceptionType; |
| 2146 | const char * _exceptionMessage; |
| 2147 | |
| 2148 | GLint *size_base = (GLint *) 0; |
| 2149 | jint _sizeRemaining; |
| 2150 | GLint *size = (GLint *) 0; |
| 2151 | |
| 2152 | GLenum *type_base = (GLenum *) 0; |
| 2153 | jint _typeRemaining; |
| 2154 | GLenum *type = (GLenum *) 0; |
| 2155 | |
| 2156 | jstring result = 0; |
| 2157 | |
| 2158 | GLint len = 0; |
| 2159 | glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len); |
| 2160 | if (!len) { |
| 2161 | return _env->NewStringUTF(""); |
| 2162 | } |
| 2163 | char* buf = (char*) malloc(len); |
| 2164 | |
| 2165 | if (buf == NULL) { |
| 2166 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 2167 | return NULL; |
| 2168 | } |
| 2169 | |
| 2170 | if (!size_ref) { |
| 2171 | _exception = 1; |
| 2172 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2173 | _exceptionMessage = "size == null"; |
| 2174 | goto exit; |
| 2175 | } |
| 2176 | if (sizeOffset < 0) { |
| 2177 | _exception = 1; |
| 2178 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2179 | _exceptionMessage = "sizeOffset < 0"; |
| 2180 | goto exit; |
| 2181 | } |
| 2182 | _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; |
| 2183 | size_base = (GLint *) |
| 2184 | _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0); |
| 2185 | size = size_base + sizeOffset; |
| 2186 | |
| 2187 | if (!type_ref) { |
| 2188 | _exception = 1; |
| 2189 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2190 | _exceptionMessage = "type == null"; |
| 2191 | goto exit; |
| 2192 | } |
| 2193 | if (typeOffset < 0) { |
| 2194 | _exception = 1; |
| 2195 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2196 | _exceptionMessage = "typeOffset < 0"; |
| 2197 | goto exit; |
| 2198 | } |
| 2199 | _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; |
| 2200 | type_base = (GLenum *) |
| 2201 | _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0); |
| 2202 | type = type_base + typeOffset; |
| 2203 | |
| 2204 | glGetActiveUniform( |
| 2205 | (GLuint)program, |
| 2206 | (GLuint)index, |
| 2207 | (GLsizei)len, |
| 2208 | NULL, |
| 2209 | (GLint *)size, |
| 2210 | (GLenum *)type, |
| 2211 | (char *)buf |
| 2212 | ); |
| 2213 | |
| 2214 | exit: |
| 2215 | if (type_base) { |
| 2216 | _env->ReleasePrimitiveArrayCritical(type_ref, type_base, |
| 2217 | _exception ? JNI_ABORT: 0); |
| 2218 | } |
| 2219 | if (size_base) { |
| 2220 | _env->ReleasePrimitiveArrayCritical(size_ref, size_base, |
| 2221 | _exception ? JNI_ABORT: 0); |
| 2222 | } |
| 2223 | if (_exception != 1) { |
| 2224 | result = _env->NewStringUTF(buf); |
| 2225 | } |
| 2226 | if (buf) { |
| 2227 | free(buf); |
| 2228 | } |
| 2229 | if (_exception) { |
| 2230 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2231 | } |
| 2232 | if (result == 0) { |
| 2233 | result = _env->NewStringUTF(""); |
| 2234 | } |
| 2235 | return result; |
| 2236 | } |
| 2237 | |
| 2238 | /* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 2239 | static jstring |
| 2240 | android_glGetActiveUniform2 |
| 2241 | (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) { |
| 2242 | jarray _sizeArray = (jarray) 0; |
| 2243 | jint _sizeBufferOffset = (jint) 0; |
| 2244 | jarray _typeArray = (jarray) 0; |
| 2245 | jint _typeBufferOffset = (jint) 0; |
| 2246 | jint _sizeRemaining; |
| 2247 | GLint *size = (GLint *) 0; |
| 2248 | jint _typeRemaining; |
| 2249 | GLenum *type = (GLenum *) 0; |
| 2250 | |
| 2251 | jstring result = 0; |
| 2252 | GLint len = 0; |
| 2253 | glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len); |
| 2254 | if (!len) { |
| 2255 | return _env->NewStringUTF(""); |
| 2256 | } |
| 2257 | char* buf = (char*) malloc(len); |
| 2258 | |
| 2259 | if (buf == NULL) { |
| 2260 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 2261 | return NULL; |
| 2262 | } |
| 2263 | |
| 2264 | size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset); |
| 2265 | type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset); |
| 2266 | |
| 2267 | if (size == NULL) { |
| 2268 | char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0); |
| 2269 | size = (GLint *) (_sizeBase + _sizeBufferOffset); |
| 2270 | } |
| 2271 | if (type == NULL) { |
| 2272 | char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0); |
| 2273 | type = (GLenum *) (_typeBase + _typeBufferOffset); |
| 2274 | } |
| 2275 | glGetActiveUniform( |
| 2276 | (GLuint)program, |
| 2277 | (GLuint)index, |
| 2278 | len, |
| 2279 | NULL, |
| 2280 | (GLint *)size, |
| 2281 | (GLenum *)type, |
| 2282 | (char *)buf |
| 2283 | ); |
| 2284 | |
| 2285 | if (_typeArray) { |
| 2286 | releasePointer(_env, _typeArray, type, JNI_TRUE); |
| 2287 | } |
| 2288 | if (_sizeArray) { |
| 2289 | releasePointer(_env, _sizeArray, size, JNI_TRUE); |
| 2290 | } |
| 2291 | result = _env->NewStringUTF(buf); |
| 2292 | if (buf) { |
| 2293 | free(buf); |
| 2294 | } |
| 2295 | return result; |
| 2296 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2297 | /* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */ |
| 2298 | static void |
| 2299 | android_glGetAttachedShaders__II_3II_3II |
| 2300 | (JNIEnv *_env, jobject _this, jint program, jint maxcount, jintArray count_ref, jint countOffset, jintArray shaders_ref, jint shadersOffset) { |
| 2301 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2302 | const char * _exceptionType = NULL; |
| 2303 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2304 | GLsizei *count_base = (GLsizei *) 0; |
| 2305 | jint _countRemaining; |
| 2306 | GLsizei *count = (GLsizei *) 0; |
| 2307 | GLuint *shaders_base = (GLuint *) 0; |
| 2308 | jint _shadersRemaining; |
| 2309 | GLuint *shaders = (GLuint *) 0; |
| 2310 | |
| 2311 | if (!count_ref) { |
| 2312 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2313 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2314 | _exceptionMessage = "count == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2315 | goto exit; |
| 2316 | } |
| 2317 | if (countOffset < 0) { |
| 2318 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2319 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2320 | _exceptionMessage = "countOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2321 | goto exit; |
| 2322 | } |
| 2323 | _countRemaining = _env->GetArrayLength(count_ref) - countOffset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2324 | if (_countRemaining < 1) { |
| 2325 | _exception = 1; |
| 2326 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2327 | _exceptionMessage = "length - countOffset < 1 < needed"; |
| 2328 | goto exit; |
| 2329 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2330 | count_base = (GLsizei *) |
| 2331 | _env->GetPrimitiveArrayCritical(count_ref, (jboolean *)0); |
| 2332 | count = count_base + countOffset; |
| 2333 | |
| 2334 | if (!shaders_ref) { |
| 2335 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2336 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2337 | _exceptionMessage = "shaders == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2338 | goto exit; |
| 2339 | } |
| 2340 | if (shadersOffset < 0) { |
| 2341 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2342 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2343 | _exceptionMessage = "shadersOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2344 | goto exit; |
| 2345 | } |
| 2346 | _shadersRemaining = _env->GetArrayLength(shaders_ref) - shadersOffset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2347 | if (_shadersRemaining < maxcount) { |
| 2348 | _exception = 1; |
| 2349 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2350 | _exceptionMessage = "length - shadersOffset < maxcount < needed"; |
| 2351 | goto exit; |
| 2352 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2353 | shaders_base = (GLuint *) |
| 2354 | _env->GetPrimitiveArrayCritical(shaders_ref, (jboolean *)0); |
| 2355 | shaders = shaders_base + shadersOffset; |
| 2356 | |
| 2357 | glGetAttachedShaders( |
| 2358 | (GLuint)program, |
| 2359 | (GLsizei)maxcount, |
| 2360 | (GLsizei *)count, |
| 2361 | (GLuint *)shaders |
| 2362 | ); |
| 2363 | |
| 2364 | exit: |
| 2365 | if (shaders_base) { |
| 2366 | _env->ReleasePrimitiveArrayCritical(shaders_ref, shaders_base, |
| 2367 | _exception ? JNI_ABORT: 0); |
| 2368 | } |
| 2369 | if (count_base) { |
| 2370 | _env->ReleasePrimitiveArrayCritical(count_ref, count_base, |
| 2371 | _exception ? JNI_ABORT: 0); |
| 2372 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2373 | if (_exception) { |
| 2374 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2375 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2376 | } |
| 2377 | |
| 2378 | /* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */ |
| 2379 | static void |
| 2380 | android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 |
| 2381 | (JNIEnv *_env, jobject _this, jint program, jint maxcount, jobject count_buf, jobject shaders_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2382 | jint _exception = 0; |
| 2383 | const char * _exceptionType = NULL; |
| 2384 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2385 | jarray _countArray = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2386 | jint _countBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2387 | jarray _shadersArray = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2388 | jint _shadersBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2389 | jint _countRemaining; |
| 2390 | GLsizei *count = (GLsizei *) 0; |
| 2391 | jint _shadersRemaining; |
| 2392 | GLuint *shaders = (GLuint *) 0; |
| 2393 | |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2394 | if (count_buf) { |
| 2395 | count = (GLsizei *)getPointer(_env, count_buf, &_countArray, &_countRemaining, &_countBufferOffset); |
| 2396 | if (_countRemaining < 1) { |
| 2397 | _exception = 1; |
| 2398 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2399 | _exceptionMessage = "remaining() < 1 < needed"; |
| 2400 | goto exit; |
| 2401 | } |
| 2402 | } |
| 2403 | if (shaders_buf) { |
| 2404 | shaders = (GLuint *)getPointer(_env, shaders_buf, &_shadersArray, &_shadersRemaining, &_shadersBufferOffset); |
| 2405 | if (_shadersRemaining < maxcount) { |
| 2406 | _exception = 1; |
| 2407 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2408 | _exceptionMessage = "remaining() < maxcount < needed"; |
| 2409 | goto exit; |
| 2410 | } |
| 2411 | } |
| 2412 | if (count_buf && count == NULL) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2413 | char * _countBase = (char *)_env->GetPrimitiveArrayCritical(_countArray, (jboolean *) 0); |
| 2414 | count = (GLsizei *) (_countBase + _countBufferOffset); |
| 2415 | } |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2416 | if (shaders_buf && shaders == NULL) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2417 | char * _shadersBase = (char *)_env->GetPrimitiveArrayCritical(_shadersArray, (jboolean *) 0); |
| 2418 | shaders = (GLuint *) (_shadersBase + _shadersBufferOffset); |
| 2419 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2420 | glGetAttachedShaders( |
| 2421 | (GLuint)program, |
| 2422 | (GLsizei)maxcount, |
| 2423 | (GLsizei *)count, |
| 2424 | (GLuint *)shaders |
| 2425 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2426 | |
| 2427 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2428 | if (_shadersArray) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2429 | releasePointer(_env, _shadersArray, shaders, _exception ? JNI_FALSE : JNI_TRUE); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2430 | } |
| 2431 | if (_countArray) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2432 | releasePointer(_env, _countArray, count, _exception ? JNI_FALSE : JNI_TRUE); |
| 2433 | } |
| 2434 | if (_exception) { |
| 2435 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2436 | } |
| 2437 | } |
| 2438 | |
Mathias Agopian | 89be00b | 2013-02-22 20:08:06 -0800 | [diff] [blame] | 2439 | /* GLint glGetAttribLocation ( GLuint program, const char *name ) */ |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2440 | static jint |
| 2441 | android_glGetAttribLocation__ILjava_lang_String_2 |
| 2442 | (JNIEnv *_env, jobject _this, jint program, jstring name) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2443 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2444 | const char * _exceptionType = NULL; |
| 2445 | const char * _exceptionMessage = NULL; |
Mathias Agopian | 89be00b | 2013-02-22 20:08:06 -0800 | [diff] [blame] | 2446 | GLint _returnValue = 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2447 | const char* _nativename = 0; |
| 2448 | |
| 2449 | if (!name) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2450 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2451 | _exceptionMessage = "name == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2452 | goto exit; |
| 2453 | } |
| 2454 | _nativename = _env->GetStringUTFChars(name, 0); |
| 2455 | |
| 2456 | _returnValue = glGetAttribLocation( |
| 2457 | (GLuint)program, |
| 2458 | (char *)_nativename |
| 2459 | ); |
| 2460 | |
| 2461 | exit: |
| 2462 | if (_nativename) { |
| 2463 | _env->ReleaseStringUTFChars(name, _nativename); |
| 2464 | } |
| 2465 | |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2466 | if (_exception) { |
| 2467 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2468 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2469 | return _returnValue; |
| 2470 | } |
| 2471 | |
| 2472 | /* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ |
| 2473 | static void |
| 2474 | android_glGetBooleanv__I_3ZI |
| 2475 | (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2476 | get<jbooleanArray, GLboolean, glGetBooleanv>(_env, _this, pname, params_ref, offset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2477 | } |
| 2478 | |
| 2479 | /* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ |
| 2480 | static void |
| 2481 | android_glGetBooleanv__ILjava_nio_IntBuffer_2 |
| 2482 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2483 | getarray<GLboolean, glGetBooleanv>(_env, _this, pname, params_buf); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2484 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2485 | /* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 2486 | static void |
| 2487 | android_glGetBufferParameteriv__II_3II |
| 2488 | (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2489 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2490 | const char * _exceptionType = NULL; |
| 2491 | const char * _exceptionMessage = NULL; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2492 | GLint *params_base = (GLint *) 0; |
| 2493 | jint _remaining; |
| 2494 | GLint *params = (GLint *) 0; |
| 2495 | |
| 2496 | if (!params_ref) { |
| 2497 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2498 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2499 | _exceptionMessage = "params == null"; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2500 | goto exit; |
| 2501 | } |
| 2502 | if (offset < 0) { |
| 2503 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2504 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2505 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2506 | goto exit; |
| 2507 | } |
| 2508 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2509 | if (_remaining < 1) { |
| 2510 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2511 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2512 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2513 | goto exit; |
| 2514 | } |
| 2515 | params_base = (GLint *) |
| 2516 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 2517 | params = params_base + offset; |
| 2518 | |
| 2519 | glGetBufferParameteriv( |
| 2520 | (GLenum)target, |
| 2521 | (GLenum)pname, |
| 2522 | (GLint *)params |
| 2523 | ); |
| 2524 | |
| 2525 | exit: |
| 2526 | if (params_base) { |
| 2527 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 2528 | _exception ? JNI_ABORT: 0); |
| 2529 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2530 | if (_exception) { |
| 2531 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2532 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2533 | } |
| 2534 | |
| 2535 | /* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 2536 | static void |
| 2537 | android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 |
| 2538 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2539 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2540 | const char * _exceptionType = NULL; |
| 2541 | const char * _exceptionMessage = NULL; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2542 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2543 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2544 | jint _remaining; |
| 2545 | GLint *params = (GLint *) 0; |
| 2546 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2547 | params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2548 | if (_remaining < 1) { |
| 2549 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2550 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2551 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2552 | goto exit; |
| 2553 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2554 | if (params == NULL) { |
| 2555 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2556 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 2557 | } |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2558 | glGetBufferParameteriv( |
| 2559 | (GLenum)target, |
| 2560 | (GLenum)pname, |
| 2561 | (GLint *)params |
| 2562 | ); |
| 2563 | |
| 2564 | exit: |
| 2565 | if (_array) { |
| 2566 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 2567 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2568 | if (_exception) { |
| 2569 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2570 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2571 | } |
| 2572 | |
| 2573 | /* GLenum glGetError ( void ) */ |
| 2574 | static jint |
| 2575 | android_glGetError__ |
| 2576 | (JNIEnv *_env, jobject _this) { |
| 2577 | GLenum _returnValue; |
| 2578 | _returnValue = glGetError(); |
| 2579 | return _returnValue; |
| 2580 | } |
| 2581 | |
| 2582 | /* void glGetFloatv ( GLenum pname, GLfloat *params ) */ |
| 2583 | static void |
| 2584 | android_glGetFloatv__I_3FI |
| 2585 | (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2586 | get<jfloatArray, GLfloat, glGetFloatv>(_env, _this, pname, params_ref, offset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2587 | } |
| 2588 | |
| 2589 | /* void glGetFloatv ( GLenum pname, GLfloat *params ) */ |
| 2590 | static void |
| 2591 | android_glGetFloatv__ILjava_nio_FloatBuffer_2 |
| 2592 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2593 | getarray<GLfloat, glGetFloatv>(_env, _this, pname, params_buf); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2594 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2595 | /* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */ |
| 2596 | static void |
| 2597 | android_glGetFramebufferAttachmentParameteriv__III_3II |
| 2598 | (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) { |
| 2599 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2600 | const char * _exceptionType = NULL; |
| 2601 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2602 | GLint *params_base = (GLint *) 0; |
| 2603 | jint _remaining; |
| 2604 | GLint *params = (GLint *) 0; |
| 2605 | |
| 2606 | if (!params_ref) { |
| 2607 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2608 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2609 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2610 | goto exit; |
| 2611 | } |
| 2612 | if (offset < 0) { |
| 2613 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2614 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2615 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2616 | goto exit; |
| 2617 | } |
| 2618 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2619 | params_base = (GLint *) |
| 2620 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 2621 | params = params_base + offset; |
| 2622 | |
| 2623 | glGetFramebufferAttachmentParameteriv( |
| 2624 | (GLenum)target, |
| 2625 | (GLenum)attachment, |
| 2626 | (GLenum)pname, |
| 2627 | (GLint *)params |
| 2628 | ); |
| 2629 | |
| 2630 | exit: |
| 2631 | if (params_base) { |
| 2632 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 2633 | _exception ? JNI_ABORT: 0); |
| 2634 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2635 | if (_exception) { |
| 2636 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2637 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2638 | } |
| 2639 | |
| 2640 | /* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */ |
| 2641 | static void |
| 2642 | android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 |
| 2643 | (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) { |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2644 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2645 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2646 | jint _remaining; |
| 2647 | GLint *params = (GLint *) 0; |
| 2648 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2649 | params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
| 2650 | if (params == NULL) { |
| 2651 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2652 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 2653 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2654 | glGetFramebufferAttachmentParameteriv( |
| 2655 | (GLenum)target, |
| 2656 | (GLenum)attachment, |
| 2657 | (GLenum)pname, |
| 2658 | (GLint *)params |
| 2659 | ); |
| 2660 | if (_array) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2661 | releasePointer(_env, _array, params, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2662 | } |
| 2663 | } |
| 2664 | |
| 2665 | /* void glGetIntegerv ( GLenum pname, GLint *params ) */ |
| 2666 | static void |
| 2667 | android_glGetIntegerv__I_3II |
| 2668 | (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2669 | get<jintArray, GLint, glGetIntegerv>(_env, _this, pname, params_ref, offset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2670 | } |
| 2671 | |
| 2672 | /* void glGetIntegerv ( GLenum pname, GLint *params ) */ |
| 2673 | static void |
| 2674 | android_glGetIntegerv__ILjava_nio_IntBuffer_2 |
| 2675 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2676 | getarray<GLint, glGetIntegerv>(_env, _this, pname, params_buf); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2677 | } |
| 2678 | |
| 2679 | /* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */ |
| 2680 | static void |
| 2681 | android_glGetProgramiv__II_3II |
| 2682 | (JNIEnv *_env, jobject _this, jint program, jint pname, jintArray params_ref, jint offset) { |
| 2683 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2684 | const char * _exceptionType = NULL; |
| 2685 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2686 | GLint *params_base = (GLint *) 0; |
| 2687 | jint _remaining; |
| 2688 | GLint *params = (GLint *) 0; |
| 2689 | |
| 2690 | if (!params_ref) { |
| 2691 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2692 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2693 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2694 | goto exit; |
| 2695 | } |
| 2696 | if (offset < 0) { |
| 2697 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2698 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2699 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2700 | goto exit; |
| 2701 | } |
| 2702 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2703 | if (_remaining < 1) { |
| 2704 | _exception = 1; |
| 2705 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2706 | _exceptionMessage = "length - offset < 1 < needed"; |
| 2707 | goto exit; |
| 2708 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2709 | params_base = (GLint *) |
| 2710 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 2711 | params = params_base + offset; |
| 2712 | |
| 2713 | glGetProgramiv( |
| 2714 | (GLuint)program, |
| 2715 | (GLenum)pname, |
| 2716 | (GLint *)params |
| 2717 | ); |
| 2718 | |
| 2719 | exit: |
| 2720 | if (params_base) { |
| 2721 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 2722 | _exception ? JNI_ABORT: 0); |
| 2723 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2724 | if (_exception) { |
| 2725 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2726 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2727 | } |
| 2728 | |
| 2729 | /* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */ |
| 2730 | static void |
| 2731 | android_glGetProgramiv__IILjava_nio_IntBuffer_2 |
| 2732 | (JNIEnv *_env, jobject _this, jint program, jint pname, jobject params_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2733 | jint _exception = 0; |
| 2734 | const char * _exceptionType = NULL; |
| 2735 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2736 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2737 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2738 | jint _remaining; |
| 2739 | GLint *params = (GLint *) 0; |
| 2740 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2741 | params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2742 | if (_remaining < 1) { |
| 2743 | _exception = 1; |
| 2744 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2745 | _exceptionMessage = "remaining() < 1 < needed"; |
| 2746 | goto exit; |
| 2747 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2748 | if (params == NULL) { |
| 2749 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2750 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 2751 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2752 | glGetProgramiv( |
| 2753 | (GLuint)program, |
| 2754 | (GLenum)pname, |
| 2755 | (GLint *)params |
| 2756 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2757 | |
| 2758 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2759 | if (_array) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2760 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 2761 | } |
| 2762 | if (_exception) { |
| 2763 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2764 | } |
| 2765 | } |
| 2766 | |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 2767 | #include <stdlib.h> |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2768 | |
| 2769 | /* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */ |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 2770 | static jstring android_glGetProgramInfoLog(JNIEnv *_env, jobject, jint shader) { |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2771 | GLint infoLen = 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2772 | glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen); |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 2773 | if (!infoLen) { |
| 2774 | return _env->NewStringUTF(""); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2775 | } |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 2776 | char* buf = (char*) malloc(infoLen); |
| 2777 | if (buf == NULL) { |
| 2778 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 2779 | return NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2780 | } |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 2781 | glGetProgramInfoLog(shader, infoLen, NULL, buf); |
| 2782 | jstring result = _env->NewStringUTF(buf); |
| 2783 | free(buf); |
| 2784 | return result; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2785 | } |
| 2786 | /* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 2787 | static void |
| 2788 | android_glGetRenderbufferParameteriv__II_3II |
| 2789 | (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { |
| 2790 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2791 | const char * _exceptionType = NULL; |
| 2792 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2793 | GLint *params_base = (GLint *) 0; |
| 2794 | jint _remaining; |
| 2795 | GLint *params = (GLint *) 0; |
| 2796 | |
| 2797 | if (!params_ref) { |
| 2798 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2799 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2800 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2801 | goto exit; |
| 2802 | } |
| 2803 | if (offset < 0) { |
| 2804 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2805 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2806 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2807 | goto exit; |
| 2808 | } |
| 2809 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2810 | if (_remaining < 1) { |
| 2811 | _exception = 1; |
| 2812 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2813 | _exceptionMessage = "length - offset < 1 < needed"; |
| 2814 | goto exit; |
| 2815 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2816 | params_base = (GLint *) |
| 2817 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 2818 | params = params_base + offset; |
| 2819 | |
| 2820 | glGetRenderbufferParameteriv( |
| 2821 | (GLenum)target, |
| 2822 | (GLenum)pname, |
| 2823 | (GLint *)params |
| 2824 | ); |
| 2825 | |
| 2826 | exit: |
| 2827 | if (params_base) { |
| 2828 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 2829 | _exception ? JNI_ABORT: 0); |
| 2830 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2831 | if (_exception) { |
| 2832 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2833 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2834 | } |
| 2835 | |
| 2836 | /* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 2837 | static void |
| 2838 | android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2 |
| 2839 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2840 | jint _exception = 0; |
| 2841 | const char * _exceptionType = NULL; |
| 2842 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2843 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2844 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2845 | jint _remaining; |
| 2846 | GLint *params = (GLint *) 0; |
| 2847 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2848 | params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2849 | if (_remaining < 1) { |
| 2850 | _exception = 1; |
| 2851 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2852 | _exceptionMessage = "remaining() < 1 < needed"; |
| 2853 | goto exit; |
| 2854 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2855 | if (params == NULL) { |
| 2856 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2857 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 2858 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2859 | glGetRenderbufferParameteriv( |
| 2860 | (GLenum)target, |
| 2861 | (GLenum)pname, |
| 2862 | (GLint *)params |
| 2863 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2864 | |
| 2865 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2866 | if (_array) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2867 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 2868 | } |
| 2869 | if (_exception) { |
| 2870 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2871 | } |
| 2872 | } |
| 2873 | |
| 2874 | /* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */ |
| 2875 | static void |
| 2876 | android_glGetShaderiv__II_3II |
| 2877 | (JNIEnv *_env, jobject _this, jint shader, jint pname, jintArray params_ref, jint offset) { |
| 2878 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2879 | const char * _exceptionType = NULL; |
| 2880 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2881 | GLint *params_base = (GLint *) 0; |
| 2882 | jint _remaining; |
| 2883 | GLint *params = (GLint *) 0; |
| 2884 | |
| 2885 | if (!params_ref) { |
| 2886 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2887 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2888 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2889 | goto exit; |
| 2890 | } |
| 2891 | if (offset < 0) { |
| 2892 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2893 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2894 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2895 | goto exit; |
| 2896 | } |
| 2897 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2898 | if (_remaining < 1) { |
| 2899 | _exception = 1; |
| 2900 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2901 | _exceptionMessage = "length - offset < 1 < needed"; |
| 2902 | goto exit; |
| 2903 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2904 | params_base = (GLint *) |
| 2905 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 2906 | params = params_base + offset; |
| 2907 | |
| 2908 | glGetShaderiv( |
| 2909 | (GLuint)shader, |
| 2910 | (GLenum)pname, |
| 2911 | (GLint *)params |
| 2912 | ); |
| 2913 | |
| 2914 | exit: |
| 2915 | if (params_base) { |
| 2916 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 2917 | _exception ? JNI_ABORT: 0); |
| 2918 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2919 | if (_exception) { |
| 2920 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2921 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2922 | } |
| 2923 | |
| 2924 | /* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */ |
| 2925 | static void |
| 2926 | android_glGetShaderiv__IILjava_nio_IntBuffer_2 |
| 2927 | (JNIEnv *_env, jobject _this, jint shader, jint pname, jobject params_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2928 | jint _exception = 0; |
| 2929 | const char * _exceptionType = NULL; |
| 2930 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2931 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2932 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2933 | jint _remaining; |
| 2934 | GLint *params = (GLint *) 0; |
| 2935 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2936 | params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2937 | if (_remaining < 1) { |
| 2938 | _exception = 1; |
| 2939 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2940 | _exceptionMessage = "remaining() < 1 < needed"; |
| 2941 | goto exit; |
| 2942 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2943 | if (params == NULL) { |
| 2944 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2945 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 2946 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2947 | glGetShaderiv( |
| 2948 | (GLuint)shader, |
| 2949 | (GLenum)pname, |
| 2950 | (GLint *)params |
| 2951 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2952 | |
| 2953 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2954 | if (_array) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2955 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 2956 | } |
| 2957 | if (_exception) { |
| 2958 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2959 | } |
| 2960 | } |
| 2961 | |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 2962 | #include <stdlib.h> |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2963 | |
| 2964 | /* void glGetShaderInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */ |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 2965 | static jstring android_glGetShaderInfoLog(JNIEnv *_env, jobject, jint shader) { |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2966 | GLint infoLen = 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2967 | glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen); |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 2968 | if (!infoLen) { |
| 2969 | return _env->NewStringUTF(""); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2970 | } |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 2971 | char* buf = (char*) malloc(infoLen); |
| 2972 | if (buf == NULL) { |
| 2973 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 2974 | return NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2975 | } |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 2976 | glGetShaderInfoLog(shader, infoLen, NULL, buf); |
| 2977 | jstring result = _env->NewStringUTF(buf); |
| 2978 | free(buf); |
| 2979 | return result; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2980 | } |
| 2981 | /* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */ |
| 2982 | static void |
| 2983 | android_glGetShaderPrecisionFormat__II_3II_3II |
| 2984 | (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jintArray range_ref, jint rangeOffset, jintArray precision_ref, jint precisionOffset) { |
| 2985 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2986 | const char * _exceptionType = NULL; |
| 2987 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2988 | GLint *range_base = (GLint *) 0; |
| 2989 | jint _rangeRemaining; |
| 2990 | GLint *range = (GLint *) 0; |
| 2991 | GLint *precision_base = (GLint *) 0; |
| 2992 | jint _precisionRemaining; |
| 2993 | GLint *precision = (GLint *) 0; |
| 2994 | |
| 2995 | if (!range_ref) { |
| 2996 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2997 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2998 | _exceptionMessage = "range == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2999 | goto exit; |
| 3000 | } |
| 3001 | if (rangeOffset < 0) { |
| 3002 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3003 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3004 | _exceptionMessage = "rangeOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3005 | goto exit; |
| 3006 | } |
| 3007 | _rangeRemaining = _env->GetArrayLength(range_ref) - rangeOffset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3008 | if (_rangeRemaining < 1) { |
| 3009 | _exception = 1; |
| 3010 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3011 | _exceptionMessage = "length - rangeOffset < 1 < needed"; |
| 3012 | goto exit; |
| 3013 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3014 | range_base = (GLint *) |
| 3015 | _env->GetPrimitiveArrayCritical(range_ref, (jboolean *)0); |
| 3016 | range = range_base + rangeOffset; |
| 3017 | |
| 3018 | if (!precision_ref) { |
| 3019 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3020 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3021 | _exceptionMessage = "precision == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3022 | goto exit; |
| 3023 | } |
| 3024 | if (precisionOffset < 0) { |
| 3025 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3026 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3027 | _exceptionMessage = "precisionOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3028 | goto exit; |
| 3029 | } |
| 3030 | _precisionRemaining = _env->GetArrayLength(precision_ref) - precisionOffset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3031 | if (_precisionRemaining < 1) { |
| 3032 | _exception = 1; |
| 3033 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3034 | _exceptionMessage = "length - precisionOffset < 1 < needed"; |
| 3035 | goto exit; |
| 3036 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3037 | precision_base = (GLint *) |
| 3038 | _env->GetPrimitiveArrayCritical(precision_ref, (jboolean *)0); |
| 3039 | precision = precision_base + precisionOffset; |
| 3040 | |
| 3041 | glGetShaderPrecisionFormat( |
| 3042 | (GLenum)shadertype, |
| 3043 | (GLenum)precisiontype, |
| 3044 | (GLint *)range, |
| 3045 | (GLint *)precision |
| 3046 | ); |
| 3047 | |
| 3048 | exit: |
| 3049 | if (precision_base) { |
| 3050 | _env->ReleasePrimitiveArrayCritical(precision_ref, precision_base, |
| 3051 | _exception ? JNI_ABORT: 0); |
| 3052 | } |
| 3053 | if (range_base) { |
| 3054 | _env->ReleasePrimitiveArrayCritical(range_ref, range_base, |
| 3055 | _exception ? JNI_ABORT: 0); |
| 3056 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3057 | if (_exception) { |
| 3058 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3059 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3060 | } |
| 3061 | |
| 3062 | /* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */ |
| 3063 | static void |
| 3064 | android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 |
| 3065 | (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jobject range_buf, jobject precision_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3066 | jint _exception = 0; |
| 3067 | const char * _exceptionType = NULL; |
| 3068 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3069 | jarray _rangeArray = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3070 | jint _rangeBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3071 | jarray _precisionArray = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3072 | jint _precisionBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3073 | jint _rangeRemaining; |
| 3074 | GLint *range = (GLint *) 0; |
| 3075 | jint _precisionRemaining; |
| 3076 | GLint *precision = (GLint *) 0; |
| 3077 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3078 | range = (GLint *)getPointer(_env, range_buf, &_rangeArray, &_rangeRemaining, &_rangeBufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3079 | if (_rangeRemaining < 1) { |
| 3080 | _exception = 1; |
| 3081 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3082 | _exceptionMessage = "remaining() < 1 < needed"; |
| 3083 | goto exit; |
| 3084 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3085 | precision = (GLint *)getPointer(_env, precision_buf, &_precisionArray, &_precisionRemaining, &_precisionBufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3086 | if (_precisionRemaining < 1) { |
| 3087 | _exception = 1; |
| 3088 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3089 | _exceptionMessage = "remaining() < 1 < needed"; |
| 3090 | goto exit; |
| 3091 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3092 | if (range == NULL) { |
| 3093 | char * _rangeBase = (char *)_env->GetPrimitiveArrayCritical(_rangeArray, (jboolean *) 0); |
| 3094 | range = (GLint *) (_rangeBase + _rangeBufferOffset); |
| 3095 | } |
| 3096 | if (precision == NULL) { |
| 3097 | char * _precisionBase = (char *)_env->GetPrimitiveArrayCritical(_precisionArray, (jboolean *) 0); |
| 3098 | precision = (GLint *) (_precisionBase + _precisionBufferOffset); |
| 3099 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3100 | glGetShaderPrecisionFormat( |
| 3101 | (GLenum)shadertype, |
| 3102 | (GLenum)precisiontype, |
| 3103 | (GLint *)range, |
| 3104 | (GLint *)precision |
| 3105 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3106 | |
| 3107 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3108 | if (_precisionArray) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3109 | releasePointer(_env, _precisionArray, precision, _exception ? JNI_FALSE : JNI_TRUE); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3110 | } |
| 3111 | if (_rangeArray) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3112 | releasePointer(_env, _rangeArray, range, _exception ? JNI_FALSE : JNI_TRUE); |
| 3113 | } |
| 3114 | if (_exception) { |
| 3115 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3116 | } |
| 3117 | } |
| 3118 | |
| 3119 | /* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */ |
| 3120 | static void |
| 3121 | android_glGetShaderSource__II_3II_3BI |
| 3122 | (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jintArray length_ref, jint lengthOffset, jbyteArray source_ref, jint sourceOffset) { |
| 3123 | jint _exception = 0; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3124 | const char * _exceptionType; |
| 3125 | const char * _exceptionMessage; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3126 | GLsizei *length_base = (GLsizei *) 0; |
| 3127 | jint _lengthRemaining; |
| 3128 | GLsizei *length = (GLsizei *) 0; |
| 3129 | char *source_base = (char *) 0; |
| 3130 | jint _sourceRemaining; |
| 3131 | char *source = (char *) 0; |
| 3132 | |
| 3133 | if (!length_ref) { |
| 3134 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3135 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3136 | _exceptionMessage = "length == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3137 | goto exit; |
| 3138 | } |
| 3139 | if (lengthOffset < 0) { |
| 3140 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3141 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3142 | _exceptionMessage = "lengthOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3143 | goto exit; |
| 3144 | } |
| 3145 | _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; |
| 3146 | length_base = (GLsizei *) |
| 3147 | _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0); |
| 3148 | length = length_base + lengthOffset; |
| 3149 | |
| 3150 | if (!source_ref) { |
| 3151 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3152 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3153 | _exceptionMessage = "source == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3154 | goto exit; |
| 3155 | } |
| 3156 | if (sourceOffset < 0) { |
| 3157 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3158 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3159 | _exceptionMessage = "sourceOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3160 | goto exit; |
| 3161 | } |
| 3162 | _sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset; |
| 3163 | source_base = (char *) |
| 3164 | _env->GetPrimitiveArrayCritical(source_ref, (jboolean *)0); |
| 3165 | source = source_base + sourceOffset; |
| 3166 | |
| 3167 | glGetShaderSource( |
| 3168 | (GLuint)shader, |
| 3169 | (GLsizei)bufsize, |
| 3170 | (GLsizei *)length, |
| 3171 | (char *)source |
| 3172 | ); |
| 3173 | |
| 3174 | exit: |
| 3175 | if (source_base) { |
| 3176 | _env->ReleasePrimitiveArrayCritical(source_ref, source_base, |
| 3177 | _exception ? JNI_ABORT: 0); |
| 3178 | } |
| 3179 | if (length_base) { |
| 3180 | _env->ReleasePrimitiveArrayCritical(length_ref, length_base, |
| 3181 | _exception ? JNI_ABORT: 0); |
| 3182 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3183 | if (_exception) { |
| 3184 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3185 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3186 | } |
| 3187 | |
| 3188 | /* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */ |
| 3189 | static void |
| 3190 | android_glGetShaderSource__IILjava_nio_IntBuffer_2B |
| 3191 | (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jobject length_buf, jbyte source) { |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3192 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3193 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3194 | jint _remaining; |
| 3195 | GLsizei *length = (GLsizei *) 0; |
| 3196 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3197 | length = (GLsizei *)getPointer(_env, length_buf, &_array, &_remaining, &_bufferOffset); |
| 3198 | if (length == NULL) { |
| 3199 | char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 3200 | length = (GLsizei *) (_lengthBase + _bufferOffset); |
| 3201 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3202 | glGetShaderSource( |
| 3203 | (GLuint)shader, |
| 3204 | (GLsizei)bufsize, |
| 3205 | (GLsizei *)length, |
| 3206 | (char *)source |
| 3207 | ); |
| 3208 | if (_array) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3209 | releasePointer(_env, _array, length, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3210 | } |
| 3211 | } |
| 3212 | |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 3213 | /* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */ |
| 3214 | static jstring android_glGetShaderSource(JNIEnv *_env, jobject, jint shader) { |
| 3215 | GLint shaderLen = 0; |
| 3216 | glGetShaderiv((GLuint)shader, GL_SHADER_SOURCE_LENGTH, &shaderLen); |
| 3217 | if (!shaderLen) { |
| 3218 | return _env->NewStringUTF(""); |
| 3219 | } |
| 3220 | char* buf = (char*) malloc(shaderLen); |
| 3221 | if (buf == NULL) { |
| 3222 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 3223 | return NULL; |
| 3224 | } |
| 3225 | glGetShaderSource(shader, shaderLen, NULL, buf); |
| 3226 | jstring result = _env->NewStringUTF(buf); |
| 3227 | free(buf); |
| 3228 | return result; |
| 3229 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3230 | /* const GLubyte * glGetString ( GLenum name ) */ |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 3231 | static jstring android_glGetString(JNIEnv* _env, jobject, jint name) { |
| 3232 | const char* chars = (const char*) glGetString((GLenum) name); |
| 3233 | return _env->NewStringUTF(chars); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3234 | } |
| 3235 | /* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */ |
| 3236 | static void |
| 3237 | android_glGetTexParameterfv__II_3FI |
| 3238 | (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) { |
| 3239 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3240 | const char * _exceptionType = NULL; |
| 3241 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3242 | GLfloat *params_base = (GLfloat *) 0; |
| 3243 | jint _remaining; |
| 3244 | GLfloat *params = (GLfloat *) 0; |
| 3245 | |
| 3246 | if (!params_ref) { |
| 3247 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3248 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3249 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3250 | goto exit; |
| 3251 | } |
| 3252 | if (offset < 0) { |
| 3253 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3254 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3255 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3256 | goto exit; |
| 3257 | } |
| 3258 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 3259 | if (_remaining < 1) { |
| 3260 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3261 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3262 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3263 | goto exit; |
| 3264 | } |
| 3265 | params_base = (GLfloat *) |
| 3266 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 3267 | params = params_base + offset; |
| 3268 | |
| 3269 | glGetTexParameterfv( |
| 3270 | (GLenum)target, |
| 3271 | (GLenum)pname, |
| 3272 | (GLfloat *)params |
| 3273 | ); |
| 3274 | |
| 3275 | exit: |
| 3276 | if (params_base) { |
| 3277 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 3278 | _exception ? JNI_ABORT: 0); |
| 3279 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3280 | if (_exception) { |
| 3281 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3282 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3283 | } |
| 3284 | |
| 3285 | /* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */ |
| 3286 | static void |
| 3287 | android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 |
| 3288 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
| 3289 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3290 | const char * _exceptionType = NULL; |
| 3291 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3292 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3293 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3294 | jint _remaining; |
| 3295 | GLfloat *params = (GLfloat *) 0; |
| 3296 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3297 | params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3298 | if (_remaining < 1) { |
| 3299 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3300 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3301 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3302 | goto exit; |
| 3303 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3304 | if (params == NULL) { |
| 3305 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 3306 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 3307 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3308 | glGetTexParameterfv( |
| 3309 | (GLenum)target, |
| 3310 | (GLenum)pname, |
| 3311 | (GLfloat *)params |
| 3312 | ); |
| 3313 | |
| 3314 | exit: |
| 3315 | if (_array) { |
| 3316 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 3317 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3318 | if (_exception) { |
| 3319 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3320 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3321 | } |
| 3322 | |
| 3323 | /* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 3324 | static void |
| 3325 | android_glGetTexParameteriv__II_3II |
| 3326 | (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { |
| 3327 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3328 | const char * _exceptionType = NULL; |
| 3329 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3330 | GLint *params_base = (GLint *) 0; |
| 3331 | jint _remaining; |
| 3332 | GLint *params = (GLint *) 0; |
| 3333 | |
| 3334 | if (!params_ref) { |
| 3335 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3336 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3337 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3338 | goto exit; |
| 3339 | } |
| 3340 | if (offset < 0) { |
| 3341 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3342 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3343 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3344 | goto exit; |
| 3345 | } |
| 3346 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 3347 | if (_remaining < 1) { |
| 3348 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3349 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3350 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3351 | goto exit; |
| 3352 | } |
| 3353 | params_base = (GLint *) |
| 3354 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 3355 | params = params_base + offset; |
| 3356 | |
| 3357 | glGetTexParameteriv( |
| 3358 | (GLenum)target, |
| 3359 | (GLenum)pname, |
| 3360 | (GLint *)params |
| 3361 | ); |
| 3362 | |
| 3363 | exit: |
| 3364 | if (params_base) { |
| 3365 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 3366 | _exception ? JNI_ABORT: 0); |
| 3367 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3368 | if (_exception) { |
| 3369 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3370 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3371 | } |
| 3372 | |
| 3373 | /* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 3374 | static void |
| 3375 | android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 |
| 3376 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
| 3377 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3378 | const char * _exceptionType = NULL; |
| 3379 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3380 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3381 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3382 | jint _remaining; |
| 3383 | GLint *params = (GLint *) 0; |
| 3384 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3385 | params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3386 | if (_remaining < 1) { |
| 3387 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3388 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3389 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3390 | goto exit; |
| 3391 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3392 | if (params == NULL) { |
| 3393 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 3394 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 3395 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3396 | glGetTexParameteriv( |
| 3397 | (GLenum)target, |
| 3398 | (GLenum)pname, |
| 3399 | (GLint *)params |
| 3400 | ); |
| 3401 | |
| 3402 | exit: |
| 3403 | if (_array) { |
| 3404 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 3405 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3406 | if (_exception) { |
| 3407 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3408 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3409 | } |
| 3410 | |
| 3411 | /* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */ |
| 3412 | static void |
| 3413 | android_glGetUniformfv__II_3FI |
| 3414 | (JNIEnv *_env, jobject _this, jint program, jint location, jfloatArray params_ref, jint offset) { |
| 3415 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3416 | const char * _exceptionType = NULL; |
| 3417 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3418 | GLfloat *params_base = (GLfloat *) 0; |
| 3419 | jint _remaining; |
| 3420 | GLfloat *params = (GLfloat *) 0; |
| 3421 | |
| 3422 | if (!params_ref) { |
| 3423 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3424 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3425 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3426 | goto exit; |
| 3427 | } |
| 3428 | if (offset < 0) { |
| 3429 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3430 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3431 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3432 | goto exit; |
| 3433 | } |
| 3434 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3435 | if (_remaining < 1) { |
| 3436 | _exception = 1; |
| 3437 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3438 | _exceptionMessage = "length - offset < 1 < needed"; |
| 3439 | goto exit; |
| 3440 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3441 | params_base = (GLfloat *) |
| 3442 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 3443 | params = params_base + offset; |
| 3444 | |
| 3445 | glGetUniformfv( |
| 3446 | (GLuint)program, |
| 3447 | (GLint)location, |
| 3448 | (GLfloat *)params |
| 3449 | ); |
| 3450 | |
| 3451 | exit: |
| 3452 | if (params_base) { |
| 3453 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 3454 | _exception ? JNI_ABORT: 0); |
| 3455 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3456 | if (_exception) { |
| 3457 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3458 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3459 | } |
| 3460 | |
| 3461 | /* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */ |
| 3462 | static void |
| 3463 | android_glGetUniformfv__IILjava_nio_FloatBuffer_2 |
| 3464 | (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3465 | jint _exception = 0; |
| 3466 | const char * _exceptionType = NULL; |
| 3467 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3468 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3469 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3470 | jint _remaining; |
| 3471 | GLfloat *params = (GLfloat *) 0; |
| 3472 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3473 | params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3474 | if (_remaining < 1) { |
| 3475 | _exception = 1; |
| 3476 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3477 | _exceptionMessage = "remaining() < 1 < needed"; |
| 3478 | goto exit; |
| 3479 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3480 | if (params == NULL) { |
| 3481 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 3482 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 3483 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3484 | glGetUniformfv( |
| 3485 | (GLuint)program, |
| 3486 | (GLint)location, |
| 3487 | (GLfloat *)params |
| 3488 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3489 | |
| 3490 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3491 | if (_array) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3492 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 3493 | } |
| 3494 | if (_exception) { |
| 3495 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3496 | } |
| 3497 | } |
| 3498 | |
| 3499 | /* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */ |
| 3500 | static void |
| 3501 | android_glGetUniformiv__II_3II |
| 3502 | (JNIEnv *_env, jobject _this, jint program, jint location, jintArray params_ref, jint offset) { |
| 3503 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3504 | const char * _exceptionType = NULL; |
| 3505 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3506 | GLint *params_base = (GLint *) 0; |
| 3507 | jint _remaining; |
| 3508 | GLint *params = (GLint *) 0; |
| 3509 | |
| 3510 | if (!params_ref) { |
| 3511 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3512 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3513 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3514 | goto exit; |
| 3515 | } |
| 3516 | if (offset < 0) { |
| 3517 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3518 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3519 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3520 | goto exit; |
| 3521 | } |
| 3522 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3523 | if (_remaining < 1) { |
| 3524 | _exception = 1; |
| 3525 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3526 | _exceptionMessage = "length - offset < 1 < needed"; |
| 3527 | goto exit; |
| 3528 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3529 | params_base = (GLint *) |
| 3530 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 3531 | params = params_base + offset; |
| 3532 | |
| 3533 | glGetUniformiv( |
| 3534 | (GLuint)program, |
| 3535 | (GLint)location, |
| 3536 | (GLint *)params |
| 3537 | ); |
| 3538 | |
| 3539 | exit: |
| 3540 | if (params_base) { |
| 3541 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 3542 | _exception ? JNI_ABORT: 0); |
| 3543 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3544 | if (_exception) { |
| 3545 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3546 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3547 | } |
| 3548 | |
| 3549 | /* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */ |
| 3550 | static void |
| 3551 | android_glGetUniformiv__IILjava_nio_IntBuffer_2 |
| 3552 | (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3553 | jint _exception = 0; |
| 3554 | const char * _exceptionType = NULL; |
| 3555 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3556 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3557 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3558 | jint _remaining; |
| 3559 | GLint *params = (GLint *) 0; |
| 3560 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3561 | params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3562 | if (_remaining < 1) { |
| 3563 | _exception = 1; |
| 3564 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3565 | _exceptionMessage = "remaining() < 1 < needed"; |
| 3566 | goto exit; |
| 3567 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3568 | if (params == NULL) { |
| 3569 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 3570 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 3571 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3572 | glGetUniformiv( |
| 3573 | (GLuint)program, |
| 3574 | (GLint)location, |
| 3575 | (GLint *)params |
| 3576 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3577 | |
| 3578 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3579 | if (_array) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3580 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 3581 | } |
| 3582 | if (_exception) { |
| 3583 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3584 | } |
| 3585 | } |
| 3586 | |
Mathias Agopian | 89be00b | 2013-02-22 20:08:06 -0800 | [diff] [blame] | 3587 | /* GLint glGetUniformLocation ( GLuint program, const char *name ) */ |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3588 | static jint |
| 3589 | android_glGetUniformLocation__ILjava_lang_String_2 |
| 3590 | (JNIEnv *_env, jobject _this, jint program, jstring name) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3591 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3592 | const char * _exceptionType = NULL; |
| 3593 | const char * _exceptionMessage = NULL; |
Mathias Agopian | 89be00b | 2013-02-22 20:08:06 -0800 | [diff] [blame] | 3594 | GLint _returnValue = 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3595 | const char* _nativename = 0; |
| 3596 | |
| 3597 | if (!name) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3598 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3599 | _exceptionMessage = "name == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3600 | goto exit; |
| 3601 | } |
| 3602 | _nativename = _env->GetStringUTFChars(name, 0); |
| 3603 | |
| 3604 | _returnValue = glGetUniformLocation( |
| 3605 | (GLuint)program, |
| 3606 | (char *)_nativename |
| 3607 | ); |
| 3608 | |
| 3609 | exit: |
| 3610 | if (_nativename) { |
| 3611 | _env->ReleaseStringUTFChars(name, _nativename); |
| 3612 | } |
| 3613 | |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3614 | if (_exception) { |
| 3615 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3616 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3617 | return _returnValue; |
| 3618 | } |
| 3619 | |
| 3620 | /* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */ |
| 3621 | static void |
| 3622 | android_glGetVertexAttribfv__II_3FI |
| 3623 | (JNIEnv *_env, jobject _this, jint index, jint pname, jfloatArray params_ref, jint offset) { |
| 3624 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3625 | const char * _exceptionType = NULL; |
| 3626 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3627 | GLfloat *params_base = (GLfloat *) 0; |
| 3628 | jint _remaining; |
| 3629 | GLfloat *params = (GLfloat *) 0; |
| 3630 | |
| 3631 | if (!params_ref) { |
| 3632 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3633 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3634 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3635 | goto exit; |
| 3636 | } |
| 3637 | if (offset < 0) { |
| 3638 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3639 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3640 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3641 | goto exit; |
| 3642 | } |
| 3643 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3644 | int _needed; |
| 3645 | switch (pname) { |
| 3646 | #if defined(GL_CURRENT_VERTEX_ATTRIB) |
| 3647 | case GL_CURRENT_VERTEX_ATTRIB: |
| 3648 | #endif // defined(GL_CURRENT_VERTEX_ATTRIB) |
| 3649 | _needed = 4; |
| 3650 | break; |
| 3651 | default: |
| 3652 | _needed = 1; |
| 3653 | break; |
| 3654 | } |
| 3655 | if (_remaining < _needed) { |
| 3656 | _exception = 1; |
| 3657 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3658 | _exceptionMessage = "length - offset < needed"; |
| 3659 | goto exit; |
| 3660 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3661 | params_base = (GLfloat *) |
| 3662 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 3663 | params = params_base + offset; |
| 3664 | |
| 3665 | glGetVertexAttribfv( |
| 3666 | (GLuint)index, |
| 3667 | (GLenum)pname, |
| 3668 | (GLfloat *)params |
| 3669 | ); |
| 3670 | |
| 3671 | exit: |
| 3672 | if (params_base) { |
| 3673 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 3674 | _exception ? JNI_ABORT: 0); |
| 3675 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3676 | if (_exception) { |
| 3677 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3678 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3679 | } |
| 3680 | |
| 3681 | /* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */ |
| 3682 | static void |
| 3683 | android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2 |
| 3684 | (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3685 | jint _exception = 0; |
| 3686 | const char * _exceptionType = NULL; |
| 3687 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3688 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3689 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3690 | jint _remaining; |
| 3691 | GLfloat *params = (GLfloat *) 0; |
| 3692 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3693 | params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3694 | int _needed; |
| 3695 | switch (pname) { |
| 3696 | #if defined(GL_CURRENT_VERTEX_ATTRIB) |
| 3697 | case GL_CURRENT_VERTEX_ATTRIB: |
| 3698 | #endif // defined(GL_CURRENT_VERTEX_ATTRIB) |
| 3699 | _needed = 4; |
| 3700 | break; |
| 3701 | default: |
| 3702 | _needed = 1; |
| 3703 | break; |
| 3704 | } |
| 3705 | if (_remaining < _needed) { |
| 3706 | _exception = 1; |
| 3707 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3708 | _exceptionMessage = "remaining() < needed"; |
| 3709 | goto exit; |
| 3710 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3711 | if (params == NULL) { |
| 3712 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 3713 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 3714 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3715 | glGetVertexAttribfv( |
| 3716 | (GLuint)index, |
| 3717 | (GLenum)pname, |
| 3718 | (GLfloat *)params |
| 3719 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3720 | |
| 3721 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3722 | if (_array) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3723 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 3724 | } |
| 3725 | if (_exception) { |
| 3726 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3727 | } |
| 3728 | } |
| 3729 | |
| 3730 | /* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */ |
| 3731 | static void |
| 3732 | android_glGetVertexAttribiv__II_3II |
| 3733 | (JNIEnv *_env, jobject _this, jint index, jint pname, jintArray params_ref, jint offset) { |
| 3734 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3735 | const char * _exceptionType = NULL; |
| 3736 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3737 | GLint *params_base = (GLint *) 0; |
| 3738 | jint _remaining; |
| 3739 | GLint *params = (GLint *) 0; |
| 3740 | |
| 3741 | if (!params_ref) { |
| 3742 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3743 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3744 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3745 | goto exit; |
| 3746 | } |
| 3747 | if (offset < 0) { |
| 3748 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3749 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3750 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3751 | goto exit; |
| 3752 | } |
| 3753 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3754 | int _needed; |
| 3755 | switch (pname) { |
| 3756 | #if defined(GL_CURRENT_VERTEX_ATTRIB) |
| 3757 | case GL_CURRENT_VERTEX_ATTRIB: |
| 3758 | #endif // defined(GL_CURRENT_VERTEX_ATTRIB) |
| 3759 | _needed = 4; |
| 3760 | break; |
| 3761 | default: |
| 3762 | _needed = 1; |
| 3763 | break; |
| 3764 | } |
| 3765 | if (_remaining < _needed) { |
| 3766 | _exception = 1; |
| 3767 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3768 | _exceptionMessage = "length - offset < needed"; |
| 3769 | goto exit; |
| 3770 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3771 | params_base = (GLint *) |
| 3772 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 3773 | params = params_base + offset; |
| 3774 | |
| 3775 | glGetVertexAttribiv( |
| 3776 | (GLuint)index, |
| 3777 | (GLenum)pname, |
| 3778 | (GLint *)params |
| 3779 | ); |
| 3780 | |
| 3781 | exit: |
| 3782 | if (params_base) { |
| 3783 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 3784 | _exception ? JNI_ABORT: 0); |
| 3785 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3786 | if (_exception) { |
| 3787 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3788 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3789 | } |
| 3790 | |
| 3791 | /* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */ |
| 3792 | static void |
| 3793 | android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2 |
| 3794 | (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3795 | jint _exception = 0; |
| 3796 | const char * _exceptionType = NULL; |
| 3797 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3798 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3799 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3800 | jint _remaining; |
| 3801 | GLint *params = (GLint *) 0; |
| 3802 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3803 | params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3804 | int _needed; |
| 3805 | switch (pname) { |
| 3806 | #if defined(GL_CURRENT_VERTEX_ATTRIB) |
| 3807 | case GL_CURRENT_VERTEX_ATTRIB: |
| 3808 | #endif // defined(GL_CURRENT_VERTEX_ATTRIB) |
| 3809 | _needed = 4; |
| 3810 | break; |
| 3811 | default: |
| 3812 | _needed = 1; |
| 3813 | break; |
| 3814 | } |
| 3815 | if (_remaining < _needed) { |
| 3816 | _exception = 1; |
| 3817 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3818 | _exceptionMessage = "remaining() < needed"; |
| 3819 | goto exit; |
| 3820 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3821 | if (params == NULL) { |
| 3822 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 3823 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 3824 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3825 | glGetVertexAttribiv( |
| 3826 | (GLuint)index, |
| 3827 | (GLenum)pname, |
| 3828 | (GLint *)params |
| 3829 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3830 | |
| 3831 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3832 | if (_array) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3833 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 3834 | } |
| 3835 | if (_exception) { |
| 3836 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3837 | } |
| 3838 | } |
| 3839 | |
| 3840 | /* void glHint ( GLenum target, GLenum mode ) */ |
| 3841 | static void |
| 3842 | android_glHint__II |
| 3843 | (JNIEnv *_env, jobject _this, jint target, jint mode) { |
| 3844 | glHint( |
| 3845 | (GLenum)target, |
| 3846 | (GLenum)mode |
| 3847 | ); |
| 3848 | } |
| 3849 | |
| 3850 | /* GLboolean glIsBuffer ( GLuint buffer ) */ |
| 3851 | static jboolean |
| 3852 | android_glIsBuffer__I |
| 3853 | (JNIEnv *_env, jobject _this, jint buffer) { |
| 3854 | GLboolean _returnValue; |
| 3855 | _returnValue = glIsBuffer( |
| 3856 | (GLuint)buffer |
| 3857 | ); |
| 3858 | return _returnValue; |
| 3859 | } |
| 3860 | |
| 3861 | /* GLboolean glIsEnabled ( GLenum cap ) */ |
| 3862 | static jboolean |
| 3863 | android_glIsEnabled__I |
| 3864 | (JNIEnv *_env, jobject _this, jint cap) { |
| 3865 | GLboolean _returnValue; |
| 3866 | _returnValue = glIsEnabled( |
| 3867 | (GLenum)cap |
| 3868 | ); |
| 3869 | return _returnValue; |
| 3870 | } |
| 3871 | |
| 3872 | /* GLboolean glIsFramebuffer ( GLuint framebuffer ) */ |
| 3873 | static jboolean |
| 3874 | android_glIsFramebuffer__I |
| 3875 | (JNIEnv *_env, jobject _this, jint framebuffer) { |
| 3876 | GLboolean _returnValue; |
| 3877 | _returnValue = glIsFramebuffer( |
| 3878 | (GLuint)framebuffer |
| 3879 | ); |
| 3880 | return _returnValue; |
| 3881 | } |
| 3882 | |
| 3883 | /* GLboolean glIsProgram ( GLuint program ) */ |
| 3884 | static jboolean |
| 3885 | android_glIsProgram__I |
| 3886 | (JNIEnv *_env, jobject _this, jint program) { |
| 3887 | GLboolean _returnValue; |
| 3888 | _returnValue = glIsProgram( |
| 3889 | (GLuint)program |
| 3890 | ); |
| 3891 | return _returnValue; |
| 3892 | } |
| 3893 | |
| 3894 | /* GLboolean glIsRenderbuffer ( GLuint renderbuffer ) */ |
| 3895 | static jboolean |
| 3896 | android_glIsRenderbuffer__I |
| 3897 | (JNIEnv *_env, jobject _this, jint renderbuffer) { |
| 3898 | GLboolean _returnValue; |
| 3899 | _returnValue = glIsRenderbuffer( |
| 3900 | (GLuint)renderbuffer |
| 3901 | ); |
| 3902 | return _returnValue; |
| 3903 | } |
| 3904 | |
| 3905 | /* GLboolean glIsShader ( GLuint shader ) */ |
| 3906 | static jboolean |
| 3907 | android_glIsShader__I |
| 3908 | (JNIEnv *_env, jobject _this, jint shader) { |
| 3909 | GLboolean _returnValue; |
| 3910 | _returnValue = glIsShader( |
| 3911 | (GLuint)shader |
| 3912 | ); |
| 3913 | return _returnValue; |
| 3914 | } |
| 3915 | |
| 3916 | /* GLboolean glIsTexture ( GLuint texture ) */ |
| 3917 | static jboolean |
| 3918 | android_glIsTexture__I |
| 3919 | (JNIEnv *_env, jobject _this, jint texture) { |
| 3920 | GLboolean _returnValue; |
| 3921 | _returnValue = glIsTexture( |
| 3922 | (GLuint)texture |
| 3923 | ); |
| 3924 | return _returnValue; |
| 3925 | } |
| 3926 | |
| 3927 | /* void glLineWidth ( GLfloat width ) */ |
| 3928 | static void |
| 3929 | android_glLineWidth__F |
| 3930 | (JNIEnv *_env, jobject _this, jfloat width) { |
| 3931 | glLineWidth( |
| 3932 | (GLfloat)width |
| 3933 | ); |
| 3934 | } |
| 3935 | |
| 3936 | /* void glLinkProgram ( GLuint program ) */ |
| 3937 | static void |
| 3938 | android_glLinkProgram__I |
| 3939 | (JNIEnv *_env, jobject _this, jint program) { |
| 3940 | glLinkProgram( |
| 3941 | (GLuint)program |
| 3942 | ); |
| 3943 | } |
| 3944 | |
| 3945 | /* void glPixelStorei ( GLenum pname, GLint param ) */ |
| 3946 | static void |
| 3947 | android_glPixelStorei__II |
| 3948 | (JNIEnv *_env, jobject _this, jint pname, jint param) { |
| 3949 | glPixelStorei( |
| 3950 | (GLenum)pname, |
| 3951 | (GLint)param |
| 3952 | ); |
| 3953 | } |
| 3954 | |
| 3955 | /* void glPolygonOffset ( GLfloat factor, GLfloat units ) */ |
| 3956 | static void |
| 3957 | android_glPolygonOffset__FF |
| 3958 | (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) { |
| 3959 | glPolygonOffset( |
| 3960 | (GLfloat)factor, |
| 3961 | (GLfloat)units |
| 3962 | ); |
| 3963 | } |
| 3964 | |
| 3965 | /* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */ |
| 3966 | static void |
| 3967 | android_glReadPixels__IIIIIILjava_nio_Buffer_2 |
| 3968 | (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) { |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3969 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3970 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3971 | jint _remaining; |
| 3972 | GLvoid *pixels = (GLvoid *) 0; |
| 3973 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3974 | pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset); |
| 3975 | if (pixels == NULL) { |
| 3976 | char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 3977 | pixels = (GLvoid *) (_pixelsBase + _bufferOffset); |
| 3978 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3979 | glReadPixels( |
| 3980 | (GLint)x, |
| 3981 | (GLint)y, |
| 3982 | (GLsizei)width, |
| 3983 | (GLsizei)height, |
| 3984 | (GLenum)format, |
| 3985 | (GLenum)type, |
| 3986 | (GLvoid *)pixels |
| 3987 | ); |
| 3988 | if (_array) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3989 | releasePointer(_env, _array, pixels, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3990 | } |
| 3991 | } |
| 3992 | |
| 3993 | /* void glReleaseShaderCompiler ( void ) */ |
| 3994 | static void |
| 3995 | android_glReleaseShaderCompiler__ |
| 3996 | (JNIEnv *_env, jobject _this) { |
| 3997 | glReleaseShaderCompiler(); |
| 3998 | } |
| 3999 | |
| 4000 | /* void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) */ |
| 4001 | static void |
| 4002 | android_glRenderbufferStorage__IIII |
| 4003 | (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint width, jint height) { |
| 4004 | glRenderbufferStorage( |
| 4005 | (GLenum)target, |
| 4006 | (GLenum)internalformat, |
| 4007 | (GLsizei)width, |
| 4008 | (GLsizei)height |
| 4009 | ); |
| 4010 | } |
| 4011 | |
| 4012 | /* void glSampleCoverage ( GLclampf value, GLboolean invert ) */ |
| 4013 | static void |
| 4014 | android_glSampleCoverage__FZ |
| 4015 | (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) { |
| 4016 | glSampleCoverage( |
| 4017 | (GLclampf)value, |
| 4018 | (GLboolean)invert |
| 4019 | ); |
| 4020 | } |
| 4021 | |
| 4022 | /* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */ |
| 4023 | static void |
| 4024 | android_glScissor__IIII |
| 4025 | (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) { |
| 4026 | glScissor( |
| 4027 | (GLint)x, |
| 4028 | (GLint)y, |
| 4029 | (GLsizei)width, |
| 4030 | (GLsizei)height |
| 4031 | ); |
| 4032 | } |
| 4033 | |
| 4034 | /* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */ |
| 4035 | static void |
| 4036 | android_glShaderBinary__I_3IIILjava_nio_Buffer_2I |
| 4037 | (JNIEnv *_env, jobject _this, jint n, jintArray shaders_ref, jint offset, jint binaryformat, jobject binary_buf, jint length) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4038 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4039 | const char * _exceptionType = NULL; |
| 4040 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4041 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4042 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4043 | GLuint *shaders_base = (GLuint *) 0; |
| 4044 | jint _shadersRemaining; |
| 4045 | GLuint *shaders = (GLuint *) 0; |
| 4046 | jint _binaryRemaining; |
| 4047 | GLvoid *binary = (GLvoid *) 0; |
| 4048 | |
| 4049 | if (!shaders_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4050 | _exception = 1; |
| 4051 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4052 | _exceptionMessage = "shaders == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4053 | goto exit; |
| 4054 | } |
| 4055 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4056 | _exception = 1; |
| 4057 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4058 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4059 | goto exit; |
| 4060 | } |
| 4061 | _shadersRemaining = _env->GetArrayLength(shaders_ref) - offset; |
| 4062 | shaders_base = (GLuint *) |
| 4063 | _env->GetPrimitiveArrayCritical(shaders_ref, (jboolean *)0); |
| 4064 | shaders = shaders_base + offset; |
| 4065 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4066 | binary = (GLvoid *)getPointer(_env, binary_buf, &_array, &_binaryRemaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4067 | if (_binaryRemaining < length) { |
| 4068 | _exception = 1; |
| 4069 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4070 | _exceptionMessage = "remaining() < length < needed"; |
| 4071 | goto exit; |
| 4072 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4073 | if (binary == NULL) { |
| 4074 | char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 4075 | binary = (GLvoid *) (_binaryBase + _bufferOffset); |
| 4076 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4077 | glShaderBinary( |
| 4078 | (GLsizei)n, |
| 4079 | (GLuint *)shaders, |
| 4080 | (GLenum)binaryformat, |
| 4081 | (GLvoid *)binary, |
| 4082 | (GLsizei)length |
| 4083 | ); |
| 4084 | |
| 4085 | exit: |
| 4086 | if (_array) { |
| 4087 | releasePointer(_env, _array, binary, JNI_FALSE); |
| 4088 | } |
| 4089 | if (shaders_base) { |
| 4090 | _env->ReleasePrimitiveArrayCritical(shaders_ref, shaders_base, |
| 4091 | JNI_ABORT); |
| 4092 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4093 | if (_exception) { |
| 4094 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4095 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4096 | } |
| 4097 | |
| 4098 | /* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */ |
| 4099 | static void |
| 4100 | android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I |
| 4101 | (JNIEnv *_env, jobject _this, jint n, jobject shaders_buf, jint binaryformat, jobject binary_buf, jint length) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4102 | jint _exception = 0; |
| 4103 | const char * _exceptionType = NULL; |
| 4104 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4105 | jarray _shadersArray = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4106 | jint _shadersBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4107 | jarray _binaryArray = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4108 | jint _binaryBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4109 | jint _shadersRemaining; |
| 4110 | GLuint *shaders = (GLuint *) 0; |
| 4111 | jint _binaryRemaining; |
| 4112 | GLvoid *binary = (GLvoid *) 0; |
| 4113 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4114 | shaders = (GLuint *)getPointer(_env, shaders_buf, &_shadersArray, &_shadersRemaining, &_shadersBufferOffset); |
| 4115 | binary = (GLvoid *)getPointer(_env, binary_buf, &_binaryArray, &_binaryRemaining, &_binaryBufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4116 | if (_binaryRemaining < length) { |
| 4117 | _exception = 1; |
| 4118 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4119 | _exceptionMessage = "remaining() < length < needed"; |
| 4120 | goto exit; |
| 4121 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4122 | if (shaders == NULL) { |
| 4123 | char * _shadersBase = (char *)_env->GetPrimitiveArrayCritical(_shadersArray, (jboolean *) 0); |
| 4124 | shaders = (GLuint *) (_shadersBase + _shadersBufferOffset); |
| 4125 | } |
| 4126 | if (binary == NULL) { |
| 4127 | char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_binaryArray, (jboolean *) 0); |
| 4128 | binary = (GLvoid *) (_binaryBase + _binaryBufferOffset); |
| 4129 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4130 | glShaderBinary( |
| 4131 | (GLsizei)n, |
| 4132 | (GLuint *)shaders, |
| 4133 | (GLenum)binaryformat, |
| 4134 | (GLvoid *)binary, |
| 4135 | (GLsizei)length |
| 4136 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4137 | |
| 4138 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4139 | if (_binaryArray) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4140 | releasePointer(_env, _binaryArray, binary, JNI_FALSE); |
| 4141 | } |
| 4142 | if (_shadersArray) { |
| 4143 | releasePointer(_env, _shadersArray, shaders, JNI_FALSE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4144 | } |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4145 | if (_exception) { |
| 4146 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4147 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4148 | } |
| 4149 | |
| 4150 | |
| 4151 | /* void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint * length ) */ |
| 4152 | static |
| 4153 | void |
| 4154 | android_glShaderSource |
| 4155 | (JNIEnv *_env, jobject _this, jint shader, jstring string) { |
| 4156 | |
| 4157 | if (!string) { |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 4158 | jniThrowException(_env, "java/lang/IllegalArgumentException", "string == null"); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4159 | return; |
| 4160 | } |
| 4161 | |
| 4162 | const char* nativeString = _env->GetStringUTFChars(string, 0); |
| 4163 | const char* strings[] = {nativeString}; |
| 4164 | glShaderSource(shader, 1, strings, 0); |
| 4165 | _env->ReleaseStringUTFChars(string, nativeString); |
| 4166 | } |
| 4167 | /* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */ |
| 4168 | static void |
| 4169 | android_glStencilFunc__III |
| 4170 | (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) { |
| 4171 | glStencilFunc( |
| 4172 | (GLenum)func, |
| 4173 | (GLint)ref, |
| 4174 | (GLuint)mask |
| 4175 | ); |
| 4176 | } |
| 4177 | |
| 4178 | /* void glStencilFuncSeparate ( GLenum face, GLenum func, GLint ref, GLuint mask ) */ |
| 4179 | static void |
| 4180 | android_glStencilFuncSeparate__IIII |
| 4181 | (JNIEnv *_env, jobject _this, jint face, jint func, jint ref, jint mask) { |
| 4182 | glStencilFuncSeparate( |
| 4183 | (GLenum)face, |
| 4184 | (GLenum)func, |
| 4185 | (GLint)ref, |
| 4186 | (GLuint)mask |
| 4187 | ); |
| 4188 | } |
| 4189 | |
| 4190 | /* void glStencilMask ( GLuint mask ) */ |
| 4191 | static void |
| 4192 | android_glStencilMask__I |
| 4193 | (JNIEnv *_env, jobject _this, jint mask) { |
| 4194 | glStencilMask( |
| 4195 | (GLuint)mask |
| 4196 | ); |
| 4197 | } |
| 4198 | |
| 4199 | /* void glStencilMaskSeparate ( GLenum face, GLuint mask ) */ |
| 4200 | static void |
| 4201 | android_glStencilMaskSeparate__II |
| 4202 | (JNIEnv *_env, jobject _this, jint face, jint mask) { |
| 4203 | glStencilMaskSeparate( |
| 4204 | (GLenum)face, |
| 4205 | (GLuint)mask |
| 4206 | ); |
| 4207 | } |
| 4208 | |
| 4209 | /* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */ |
| 4210 | static void |
| 4211 | android_glStencilOp__III |
| 4212 | (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) { |
| 4213 | glStencilOp( |
| 4214 | (GLenum)fail, |
| 4215 | (GLenum)zfail, |
| 4216 | (GLenum)zpass |
| 4217 | ); |
| 4218 | } |
| 4219 | |
| 4220 | /* void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) */ |
| 4221 | static void |
| 4222 | android_glStencilOpSeparate__IIII |
| 4223 | (JNIEnv *_env, jobject _this, jint face, jint fail, jint zfail, jint zpass) { |
| 4224 | glStencilOpSeparate( |
| 4225 | (GLenum)face, |
| 4226 | (GLenum)fail, |
| 4227 | (GLenum)zfail, |
| 4228 | (GLenum)zpass |
| 4229 | ); |
| 4230 | } |
| 4231 | |
| 4232 | /* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */ |
| 4233 | static void |
| 4234 | android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 |
| 4235 | (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) { |
| 4236 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4237 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4238 | jint _remaining; |
| 4239 | GLvoid *pixels = (GLvoid *) 0; |
| 4240 | |
| 4241 | if (pixels_buf) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4242 | pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset); |
| 4243 | } |
Thomas Tafertshofer | 37c9b49 | 2012-07-23 16:56:04 -0700 | [diff] [blame] | 4244 | if (pixels_buf && pixels == NULL) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4245 | char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 4246 | pixels = (GLvoid *) (_pixelsBase + _bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4247 | } |
| 4248 | glTexImage2D( |
| 4249 | (GLenum)target, |
| 4250 | (GLint)level, |
| 4251 | (GLint)internalformat, |
| 4252 | (GLsizei)width, |
| 4253 | (GLsizei)height, |
| 4254 | (GLint)border, |
| 4255 | (GLenum)format, |
| 4256 | (GLenum)type, |
| 4257 | (GLvoid *)pixels |
| 4258 | ); |
| 4259 | if (_array) { |
| 4260 | releasePointer(_env, _array, pixels, JNI_FALSE); |
| 4261 | } |
| 4262 | } |
| 4263 | |
| 4264 | /* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */ |
| 4265 | static void |
| 4266 | android_glTexParameterf__IIF |
| 4267 | (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) { |
| 4268 | glTexParameterf( |
| 4269 | (GLenum)target, |
| 4270 | (GLenum)pname, |
| 4271 | (GLfloat)param |
| 4272 | ); |
| 4273 | } |
| 4274 | |
| 4275 | /* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */ |
| 4276 | static void |
| 4277 | android_glTexParameterfv__II_3FI |
| 4278 | (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4279 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4280 | const char * _exceptionType = NULL; |
| 4281 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4282 | GLfloat *params_base = (GLfloat *) 0; |
| 4283 | jint _remaining; |
| 4284 | GLfloat *params = (GLfloat *) 0; |
| 4285 | |
| 4286 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4287 | _exception = 1; |
| 4288 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4289 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4290 | goto exit; |
| 4291 | } |
| 4292 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4293 | _exception = 1; |
| 4294 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4295 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4296 | goto exit; |
| 4297 | } |
| 4298 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 4299 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4300 | _exception = 1; |
| 4301 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4302 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4303 | goto exit; |
| 4304 | } |
| 4305 | params_base = (GLfloat *) |
| 4306 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 4307 | params = params_base + offset; |
| 4308 | |
| 4309 | glTexParameterfv( |
| 4310 | (GLenum)target, |
| 4311 | (GLenum)pname, |
| 4312 | (GLfloat *)params |
| 4313 | ); |
| 4314 | |
| 4315 | exit: |
| 4316 | if (params_base) { |
| 4317 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 4318 | JNI_ABORT); |
| 4319 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4320 | if (_exception) { |
| 4321 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4322 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4323 | } |
| 4324 | |
| 4325 | /* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */ |
| 4326 | static void |
| 4327 | android_glTexParameterfv__IILjava_nio_FloatBuffer_2 |
| 4328 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4329 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4330 | const char * _exceptionType = NULL; |
| 4331 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4332 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4333 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4334 | jint _remaining; |
| 4335 | GLfloat *params = (GLfloat *) 0; |
| 4336 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4337 | params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4338 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4339 | _exception = 1; |
| 4340 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4341 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4342 | goto exit; |
| 4343 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4344 | if (params == NULL) { |
| 4345 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 4346 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 4347 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4348 | glTexParameterfv( |
| 4349 | (GLenum)target, |
| 4350 | (GLenum)pname, |
| 4351 | (GLfloat *)params |
| 4352 | ); |
| 4353 | |
| 4354 | exit: |
| 4355 | if (_array) { |
| 4356 | releasePointer(_env, _array, params, JNI_FALSE); |
| 4357 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4358 | if (_exception) { |
| 4359 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4360 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4361 | } |
| 4362 | |
| 4363 | /* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */ |
| 4364 | static void |
| 4365 | android_glTexParameteri__III |
| 4366 | (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) { |
| 4367 | glTexParameteri( |
| 4368 | (GLenum)target, |
| 4369 | (GLenum)pname, |
| 4370 | (GLint)param |
| 4371 | ); |
| 4372 | } |
| 4373 | |
| 4374 | /* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */ |
| 4375 | static void |
| 4376 | android_glTexParameteriv__II_3II |
| 4377 | (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4378 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4379 | const char * _exceptionType = NULL; |
| 4380 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4381 | GLint *params_base = (GLint *) 0; |
| 4382 | jint _remaining; |
| 4383 | GLint *params = (GLint *) 0; |
| 4384 | |
| 4385 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4386 | _exception = 1; |
| 4387 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4388 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4389 | goto exit; |
| 4390 | } |
| 4391 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4392 | _exception = 1; |
| 4393 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4394 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4395 | goto exit; |
| 4396 | } |
| 4397 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 4398 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4399 | _exception = 1; |
| 4400 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4401 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4402 | goto exit; |
| 4403 | } |
| 4404 | params_base = (GLint *) |
| 4405 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 4406 | params = params_base + offset; |
| 4407 | |
| 4408 | glTexParameteriv( |
| 4409 | (GLenum)target, |
| 4410 | (GLenum)pname, |
| 4411 | (GLint *)params |
| 4412 | ); |
| 4413 | |
| 4414 | exit: |
| 4415 | if (params_base) { |
| 4416 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 4417 | JNI_ABORT); |
| 4418 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4419 | if (_exception) { |
| 4420 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4421 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4422 | } |
| 4423 | |
| 4424 | /* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */ |
| 4425 | static void |
| 4426 | android_glTexParameteriv__IILjava_nio_IntBuffer_2 |
| 4427 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4428 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4429 | const char * _exceptionType = NULL; |
| 4430 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4431 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4432 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4433 | jint _remaining; |
| 4434 | GLint *params = (GLint *) 0; |
| 4435 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4436 | params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4437 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4438 | _exception = 1; |
| 4439 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4440 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4441 | goto exit; |
| 4442 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4443 | if (params == NULL) { |
| 4444 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 4445 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 4446 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4447 | glTexParameteriv( |
| 4448 | (GLenum)target, |
| 4449 | (GLenum)pname, |
| 4450 | (GLint *)params |
| 4451 | ); |
| 4452 | |
| 4453 | exit: |
| 4454 | if (_array) { |
| 4455 | releasePointer(_env, _array, params, JNI_FALSE); |
| 4456 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4457 | if (_exception) { |
| 4458 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4459 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4460 | } |
| 4461 | |
| 4462 | /* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */ |
| 4463 | static void |
| 4464 | android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 |
| 4465 | (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) { |
| 4466 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4467 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4468 | jint _remaining; |
| 4469 | GLvoid *pixels = (GLvoid *) 0; |
| 4470 | |
| 4471 | if (pixels_buf) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4472 | pixels = (GLvoid *)getPointer(_env, pixels_buf, &_array, &_remaining, &_bufferOffset); |
| 4473 | } |
Thomas Tafertshofer | 37c9b49 | 2012-07-23 16:56:04 -0700 | [diff] [blame] | 4474 | if (pixels_buf && pixels == NULL) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4475 | char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 4476 | pixels = (GLvoid *) (_pixelsBase + _bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4477 | } |
| 4478 | glTexSubImage2D( |
| 4479 | (GLenum)target, |
| 4480 | (GLint)level, |
| 4481 | (GLint)xoffset, |
| 4482 | (GLint)yoffset, |
| 4483 | (GLsizei)width, |
| 4484 | (GLsizei)height, |
| 4485 | (GLenum)format, |
| 4486 | (GLenum)type, |
| 4487 | (GLvoid *)pixels |
| 4488 | ); |
| 4489 | if (_array) { |
| 4490 | releasePointer(_env, _array, pixels, JNI_FALSE); |
| 4491 | } |
| 4492 | } |
| 4493 | |
| 4494 | /* void glUniform1f ( GLint location, GLfloat x ) */ |
| 4495 | static void |
| 4496 | android_glUniform1f__IF |
| 4497 | (JNIEnv *_env, jobject _this, jint location, jfloat x) { |
| 4498 | glUniform1f( |
| 4499 | (GLint)location, |
| 4500 | (GLfloat)x |
| 4501 | ); |
| 4502 | } |
| 4503 | |
| 4504 | /* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 4505 | static void |
| 4506 | android_glUniform1fv__II_3FI |
| 4507 | (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4508 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4509 | const char * _exceptionType = NULL; |
| 4510 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4511 | GLfloat *v_base = (GLfloat *) 0; |
| 4512 | jint _remaining; |
| 4513 | GLfloat *v = (GLfloat *) 0; |
| 4514 | |
| 4515 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4516 | _exception = 1; |
| 4517 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4518 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4519 | goto exit; |
| 4520 | } |
| 4521 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4522 | _exception = 1; |
| 4523 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4524 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4525 | goto exit; |
| 4526 | } |
| 4527 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4528 | if (_remaining < count) { |
| 4529 | _exception = 1; |
| 4530 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4531 | _exceptionMessage = "length - offset < count < needed"; |
| 4532 | goto exit; |
| 4533 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4534 | v_base = (GLfloat *) |
| 4535 | _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0); |
| 4536 | v = v_base + offset; |
| 4537 | |
| 4538 | glUniform1fv( |
| 4539 | (GLint)location, |
| 4540 | (GLsizei)count, |
| 4541 | (GLfloat *)v |
| 4542 | ); |
| 4543 | |
| 4544 | exit: |
| 4545 | if (v_base) { |
| 4546 | _env->ReleasePrimitiveArrayCritical(v_ref, v_base, |
| 4547 | JNI_ABORT); |
| 4548 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4549 | if (_exception) { |
| 4550 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4551 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4552 | } |
| 4553 | |
| 4554 | /* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 4555 | static void |
| 4556 | android_glUniform1fv__IILjava_nio_FloatBuffer_2 |
| 4557 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4558 | jint _exception = 0; |
| 4559 | const char * _exceptionType = NULL; |
| 4560 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4561 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4562 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4563 | jint _remaining; |
| 4564 | GLfloat *v = (GLfloat *) 0; |
| 4565 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4566 | v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4567 | if (_remaining < count) { |
| 4568 | _exception = 1; |
| 4569 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4570 | _exceptionMessage = "remaining() < count < needed"; |
| 4571 | goto exit; |
| 4572 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4573 | if (v == NULL) { |
| 4574 | char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 4575 | v = (GLfloat *) (_vBase + _bufferOffset); |
| 4576 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4577 | glUniform1fv( |
| 4578 | (GLint)location, |
| 4579 | (GLsizei)count, |
| 4580 | (GLfloat *)v |
| 4581 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4582 | |
| 4583 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4584 | if (_array) { |
| 4585 | releasePointer(_env, _array, v, JNI_FALSE); |
| 4586 | } |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4587 | if (_exception) { |
| 4588 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4589 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4590 | } |
| 4591 | |
| 4592 | /* void glUniform1i ( GLint location, GLint x ) */ |
| 4593 | static void |
| 4594 | android_glUniform1i__II |
| 4595 | (JNIEnv *_env, jobject _this, jint location, jint x) { |
| 4596 | glUniform1i( |
| 4597 | (GLint)location, |
| 4598 | (GLint)x |
| 4599 | ); |
| 4600 | } |
| 4601 | |
| 4602 | /* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 4603 | static void |
| 4604 | android_glUniform1iv__II_3II |
| 4605 | (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4606 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4607 | const char * _exceptionType = NULL; |
| 4608 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4609 | GLint *v_base = (GLint *) 0; |
| 4610 | jint _remaining; |
| 4611 | GLint *v = (GLint *) 0; |
| 4612 | |
| 4613 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4614 | _exception = 1; |
| 4615 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4616 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4617 | goto exit; |
| 4618 | } |
| 4619 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4620 | _exception = 1; |
| 4621 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4622 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4623 | goto exit; |
| 4624 | } |
| 4625 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4626 | if (_remaining < count) { |
| 4627 | _exception = 1; |
| 4628 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4629 | _exceptionMessage = "length - offset < count < needed"; |
| 4630 | goto exit; |
| 4631 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4632 | v_base = (GLint *) |
| 4633 | _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0); |
| 4634 | v = v_base + offset; |
| 4635 | |
| 4636 | glUniform1iv( |
| 4637 | (GLint)location, |
| 4638 | (GLsizei)count, |
| 4639 | (GLint *)v |
| 4640 | ); |
| 4641 | |
| 4642 | exit: |
| 4643 | if (v_base) { |
| 4644 | _env->ReleasePrimitiveArrayCritical(v_ref, v_base, |
| 4645 | JNI_ABORT); |
| 4646 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4647 | if (_exception) { |
| 4648 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4649 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4650 | } |
| 4651 | |
| 4652 | /* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 4653 | static void |
| 4654 | android_glUniform1iv__IILjava_nio_IntBuffer_2 |
| 4655 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4656 | jint _exception = 0; |
| 4657 | const char * _exceptionType = NULL; |
| 4658 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4659 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4660 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4661 | jint _remaining; |
| 4662 | GLint *v = (GLint *) 0; |
| 4663 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4664 | v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4665 | if (_remaining < count) { |
| 4666 | _exception = 1; |
| 4667 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4668 | _exceptionMessage = "remaining() < count < needed"; |
| 4669 | goto exit; |
| 4670 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4671 | if (v == NULL) { |
| 4672 | char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 4673 | v = (GLint *) (_vBase + _bufferOffset); |
| 4674 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4675 | glUniform1iv( |
| 4676 | (GLint)location, |
| 4677 | (GLsizei)count, |
| 4678 | (GLint *)v |
| 4679 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4680 | |
| 4681 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4682 | if (_array) { |
| 4683 | releasePointer(_env, _array, v, JNI_FALSE); |
| 4684 | } |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4685 | if (_exception) { |
| 4686 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4687 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4688 | } |
| 4689 | |
| 4690 | /* void glUniform2f ( GLint location, GLfloat x, GLfloat y ) */ |
| 4691 | static void |
| 4692 | android_glUniform2f__IFF |
| 4693 | (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y) { |
| 4694 | glUniform2f( |
| 4695 | (GLint)location, |
| 4696 | (GLfloat)x, |
| 4697 | (GLfloat)y |
| 4698 | ); |
| 4699 | } |
| 4700 | |
| 4701 | /* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 4702 | static void |
| 4703 | android_glUniform2fv__II_3FI |
| 4704 | (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4705 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4706 | const char * _exceptionType = NULL; |
| 4707 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4708 | GLfloat *v_base = (GLfloat *) 0; |
| 4709 | jint _remaining; |
| 4710 | GLfloat *v = (GLfloat *) 0; |
| 4711 | |
| 4712 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4713 | _exception = 1; |
| 4714 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4715 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4716 | goto exit; |
| 4717 | } |
| 4718 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4719 | _exception = 1; |
| 4720 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4721 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4722 | goto exit; |
| 4723 | } |
| 4724 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4725 | if (_remaining < count*2) { |
| 4726 | _exception = 1; |
| 4727 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4728 | _exceptionMessage = "length - offset < count*2 < needed"; |
| 4729 | goto exit; |
| 4730 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4731 | v_base = (GLfloat *) |
| 4732 | _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0); |
| 4733 | v = v_base + offset; |
| 4734 | |
| 4735 | glUniform2fv( |
| 4736 | (GLint)location, |
| 4737 | (GLsizei)count, |
| 4738 | (GLfloat *)v |
| 4739 | ); |
| 4740 | |
| 4741 | exit: |
| 4742 | if (v_base) { |
| 4743 | _env->ReleasePrimitiveArrayCritical(v_ref, v_base, |
| 4744 | JNI_ABORT); |
| 4745 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4746 | if (_exception) { |
| 4747 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4748 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4749 | } |
| 4750 | |
| 4751 | /* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 4752 | static void |
| 4753 | android_glUniform2fv__IILjava_nio_FloatBuffer_2 |
| 4754 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4755 | jint _exception = 0; |
| 4756 | const char * _exceptionType = NULL; |
| 4757 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4758 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4759 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4760 | jint _remaining; |
| 4761 | GLfloat *v = (GLfloat *) 0; |
| 4762 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4763 | v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4764 | if (_remaining < count*2) { |
| 4765 | _exception = 1; |
| 4766 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4767 | _exceptionMessage = "remaining() < count*2 < needed"; |
| 4768 | goto exit; |
| 4769 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4770 | if (v == NULL) { |
| 4771 | char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 4772 | v = (GLfloat *) (_vBase + _bufferOffset); |
| 4773 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4774 | glUniform2fv( |
| 4775 | (GLint)location, |
| 4776 | (GLsizei)count, |
| 4777 | (GLfloat *)v |
| 4778 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4779 | |
| 4780 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4781 | if (_array) { |
| 4782 | releasePointer(_env, _array, v, JNI_FALSE); |
| 4783 | } |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4784 | if (_exception) { |
| 4785 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4786 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4787 | } |
| 4788 | |
| 4789 | /* void glUniform2i ( GLint location, GLint x, GLint y ) */ |
| 4790 | static void |
| 4791 | android_glUniform2i__III |
| 4792 | (JNIEnv *_env, jobject _this, jint location, jint x, jint y) { |
| 4793 | glUniform2i( |
| 4794 | (GLint)location, |
| 4795 | (GLint)x, |
| 4796 | (GLint)y |
| 4797 | ); |
| 4798 | } |
| 4799 | |
| 4800 | /* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 4801 | static void |
| 4802 | android_glUniform2iv__II_3II |
| 4803 | (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4804 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4805 | const char * _exceptionType = NULL; |
| 4806 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4807 | GLint *v_base = (GLint *) 0; |
| 4808 | jint _remaining; |
| 4809 | GLint *v = (GLint *) 0; |
| 4810 | |
| 4811 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4812 | _exception = 1; |
| 4813 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4814 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4815 | goto exit; |
| 4816 | } |
| 4817 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4818 | _exception = 1; |
| 4819 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4820 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4821 | goto exit; |
| 4822 | } |
| 4823 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4824 | if (_remaining < count*2) { |
| 4825 | _exception = 1; |
| 4826 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4827 | _exceptionMessage = "length - offset < count*2 < needed"; |
| 4828 | goto exit; |
| 4829 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4830 | v_base = (GLint *) |
| 4831 | _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0); |
| 4832 | v = v_base + offset; |
| 4833 | |
| 4834 | glUniform2iv( |
| 4835 | (GLint)location, |
| 4836 | (GLsizei)count, |
| 4837 | (GLint *)v |
| 4838 | ); |
| 4839 | |
| 4840 | exit: |
| 4841 | if (v_base) { |
| 4842 | _env->ReleasePrimitiveArrayCritical(v_ref, v_base, |
| 4843 | JNI_ABORT); |
| 4844 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4845 | if (_exception) { |
| 4846 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4847 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4848 | } |
| 4849 | |
| 4850 | /* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 4851 | static void |
| 4852 | android_glUniform2iv__IILjava_nio_IntBuffer_2 |
| 4853 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4854 | jint _exception = 0; |
| 4855 | const char * _exceptionType = NULL; |
| 4856 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4857 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4858 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4859 | jint _remaining; |
| 4860 | GLint *v = (GLint *) 0; |
| 4861 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4862 | v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4863 | if (_remaining < count*2) { |
| 4864 | _exception = 1; |
| 4865 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4866 | _exceptionMessage = "remaining() < count*2 < needed"; |
| 4867 | goto exit; |
| 4868 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4869 | if (v == NULL) { |
| 4870 | char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 4871 | v = (GLint *) (_vBase + _bufferOffset); |
| 4872 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4873 | glUniform2iv( |
| 4874 | (GLint)location, |
| 4875 | (GLsizei)count, |
| 4876 | (GLint *)v |
| 4877 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4878 | |
| 4879 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4880 | if (_array) { |
| 4881 | releasePointer(_env, _array, v, JNI_FALSE); |
| 4882 | } |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4883 | if (_exception) { |
| 4884 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4885 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4886 | } |
| 4887 | |
| 4888 | /* void glUniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z ) */ |
| 4889 | static void |
| 4890 | android_glUniform3f__IFFF |
| 4891 | (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z) { |
| 4892 | glUniform3f( |
| 4893 | (GLint)location, |
| 4894 | (GLfloat)x, |
| 4895 | (GLfloat)y, |
| 4896 | (GLfloat)z |
| 4897 | ); |
| 4898 | } |
| 4899 | |
| 4900 | /* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 4901 | static void |
| 4902 | android_glUniform3fv__II_3FI |
| 4903 | (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4904 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4905 | const char * _exceptionType = NULL; |
| 4906 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4907 | GLfloat *v_base = (GLfloat *) 0; |
| 4908 | jint _remaining; |
| 4909 | GLfloat *v = (GLfloat *) 0; |
| 4910 | |
| 4911 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4912 | _exception = 1; |
| 4913 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4914 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4915 | goto exit; |
| 4916 | } |
| 4917 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4918 | _exception = 1; |
| 4919 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4920 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4921 | goto exit; |
| 4922 | } |
| 4923 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4924 | if (_remaining < count*3) { |
| 4925 | _exception = 1; |
| 4926 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4927 | _exceptionMessage = "length - offset < count*3 < needed"; |
| 4928 | goto exit; |
| 4929 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4930 | v_base = (GLfloat *) |
| 4931 | _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0); |
| 4932 | v = v_base + offset; |
| 4933 | |
| 4934 | glUniform3fv( |
| 4935 | (GLint)location, |
| 4936 | (GLsizei)count, |
| 4937 | (GLfloat *)v |
| 4938 | ); |
| 4939 | |
| 4940 | exit: |
| 4941 | if (v_base) { |
| 4942 | _env->ReleasePrimitiveArrayCritical(v_ref, v_base, |
| 4943 | JNI_ABORT); |
| 4944 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4945 | if (_exception) { |
| 4946 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4947 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4948 | } |
| 4949 | |
| 4950 | /* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 4951 | static void |
| 4952 | android_glUniform3fv__IILjava_nio_FloatBuffer_2 |
| 4953 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4954 | jint _exception = 0; |
| 4955 | const char * _exceptionType = NULL; |
| 4956 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4957 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4958 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4959 | jint _remaining; |
| 4960 | GLfloat *v = (GLfloat *) 0; |
| 4961 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4962 | v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4963 | if (_remaining < count*3) { |
| 4964 | _exception = 1; |
| 4965 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4966 | _exceptionMessage = "remaining() < count*3 < needed"; |
| 4967 | goto exit; |
| 4968 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4969 | if (v == NULL) { |
| 4970 | char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 4971 | v = (GLfloat *) (_vBase + _bufferOffset); |
| 4972 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4973 | glUniform3fv( |
| 4974 | (GLint)location, |
| 4975 | (GLsizei)count, |
| 4976 | (GLfloat *)v |
| 4977 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4978 | |
| 4979 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4980 | if (_array) { |
| 4981 | releasePointer(_env, _array, v, JNI_FALSE); |
| 4982 | } |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4983 | if (_exception) { |
| 4984 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4985 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4986 | } |
| 4987 | |
| 4988 | /* void glUniform3i ( GLint location, GLint x, GLint y, GLint z ) */ |
| 4989 | static void |
| 4990 | android_glUniform3i__IIII |
| 4991 | (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z) { |
| 4992 | glUniform3i( |
| 4993 | (GLint)location, |
| 4994 | (GLint)x, |
| 4995 | (GLint)y, |
| 4996 | (GLint)z |
| 4997 | ); |
| 4998 | } |
| 4999 | |
| 5000 | /* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 5001 | static void |
| 5002 | android_glUniform3iv__II_3II |
| 5003 | (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5004 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5005 | const char * _exceptionType = NULL; |
| 5006 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5007 | GLint *v_base = (GLint *) 0; |
| 5008 | jint _remaining; |
| 5009 | GLint *v = (GLint *) 0; |
| 5010 | |
| 5011 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5012 | _exception = 1; |
| 5013 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5014 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5015 | goto exit; |
| 5016 | } |
| 5017 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5018 | _exception = 1; |
| 5019 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5020 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5021 | goto exit; |
| 5022 | } |
| 5023 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5024 | if (_remaining < count*3) { |
| 5025 | _exception = 1; |
| 5026 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5027 | _exceptionMessage = "length - offset < count*3 < needed"; |
| 5028 | goto exit; |
| 5029 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5030 | v_base = (GLint *) |
| 5031 | _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0); |
| 5032 | v = v_base + offset; |
| 5033 | |
| 5034 | glUniform3iv( |
| 5035 | (GLint)location, |
| 5036 | (GLsizei)count, |
| 5037 | (GLint *)v |
| 5038 | ); |
| 5039 | |
| 5040 | exit: |
| 5041 | if (v_base) { |
| 5042 | _env->ReleasePrimitiveArrayCritical(v_ref, v_base, |
| 5043 | JNI_ABORT); |
| 5044 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5045 | if (_exception) { |
| 5046 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5047 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5048 | } |
| 5049 | |
| 5050 | /* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 5051 | static void |
| 5052 | android_glUniform3iv__IILjava_nio_IntBuffer_2 |
| 5053 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5054 | jint _exception = 0; |
| 5055 | const char * _exceptionType = NULL; |
| 5056 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5057 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5058 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5059 | jint _remaining; |
| 5060 | GLint *v = (GLint *) 0; |
| 5061 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5062 | v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5063 | if (_remaining < count*3) { |
| 5064 | _exception = 1; |
| 5065 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5066 | _exceptionMessage = "remaining() < count*3 < needed"; |
| 5067 | goto exit; |
| 5068 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5069 | if (v == NULL) { |
| 5070 | char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 5071 | v = (GLint *) (_vBase + _bufferOffset); |
| 5072 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5073 | glUniform3iv( |
| 5074 | (GLint)location, |
| 5075 | (GLsizei)count, |
| 5076 | (GLint *)v |
| 5077 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5078 | |
| 5079 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5080 | if (_array) { |
| 5081 | releasePointer(_env, _array, v, JNI_FALSE); |
| 5082 | } |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5083 | if (_exception) { |
| 5084 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5085 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5086 | } |
| 5087 | |
| 5088 | /* void glUniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */ |
| 5089 | static void |
| 5090 | android_glUniform4f__IFFFF |
| 5091 | (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z, jfloat w) { |
| 5092 | glUniform4f( |
| 5093 | (GLint)location, |
| 5094 | (GLfloat)x, |
| 5095 | (GLfloat)y, |
| 5096 | (GLfloat)z, |
| 5097 | (GLfloat)w |
| 5098 | ); |
| 5099 | } |
| 5100 | |
| 5101 | /* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 5102 | static void |
| 5103 | android_glUniform4fv__II_3FI |
| 5104 | (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5105 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5106 | const char * _exceptionType = NULL; |
| 5107 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5108 | GLfloat *v_base = (GLfloat *) 0; |
| 5109 | jint _remaining; |
| 5110 | GLfloat *v = (GLfloat *) 0; |
| 5111 | |
| 5112 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5113 | _exception = 1; |
| 5114 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5115 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5116 | goto exit; |
| 5117 | } |
| 5118 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5119 | _exception = 1; |
| 5120 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5121 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5122 | goto exit; |
| 5123 | } |
| 5124 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5125 | if (_remaining < count*4) { |
| 5126 | _exception = 1; |
| 5127 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5128 | _exceptionMessage = "length - offset < count*4 < needed"; |
| 5129 | goto exit; |
| 5130 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5131 | v_base = (GLfloat *) |
| 5132 | _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0); |
| 5133 | v = v_base + offset; |
| 5134 | |
| 5135 | glUniform4fv( |
| 5136 | (GLint)location, |
| 5137 | (GLsizei)count, |
| 5138 | (GLfloat *)v |
| 5139 | ); |
| 5140 | |
| 5141 | exit: |
| 5142 | if (v_base) { |
| 5143 | _env->ReleasePrimitiveArrayCritical(v_ref, v_base, |
| 5144 | JNI_ABORT); |
| 5145 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5146 | if (_exception) { |
| 5147 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5148 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5149 | } |
| 5150 | |
| 5151 | /* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 5152 | static void |
| 5153 | android_glUniform4fv__IILjava_nio_FloatBuffer_2 |
| 5154 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5155 | jint _exception = 0; |
| 5156 | const char * _exceptionType = NULL; |
| 5157 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5158 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5159 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5160 | jint _remaining; |
| 5161 | GLfloat *v = (GLfloat *) 0; |
| 5162 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5163 | v = (GLfloat *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5164 | if (_remaining < count*4) { |
| 5165 | _exception = 1; |
| 5166 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5167 | _exceptionMessage = "remaining() < count*4 < needed"; |
| 5168 | goto exit; |
| 5169 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5170 | if (v == NULL) { |
| 5171 | char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 5172 | v = (GLfloat *) (_vBase + _bufferOffset); |
| 5173 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5174 | glUniform4fv( |
| 5175 | (GLint)location, |
| 5176 | (GLsizei)count, |
| 5177 | (GLfloat *)v |
| 5178 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5179 | |
| 5180 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5181 | if (_array) { |
| 5182 | releasePointer(_env, _array, v, JNI_FALSE); |
| 5183 | } |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5184 | if (_exception) { |
| 5185 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5186 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5187 | } |
| 5188 | |
| 5189 | /* void glUniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w ) */ |
| 5190 | static void |
| 5191 | android_glUniform4i__IIIII |
| 5192 | (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z, jint w) { |
| 5193 | glUniform4i( |
| 5194 | (GLint)location, |
| 5195 | (GLint)x, |
| 5196 | (GLint)y, |
| 5197 | (GLint)z, |
| 5198 | (GLint)w |
| 5199 | ); |
| 5200 | } |
| 5201 | |
| 5202 | /* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 5203 | static void |
| 5204 | android_glUniform4iv__II_3II |
| 5205 | (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5206 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5207 | const char * _exceptionType = NULL; |
| 5208 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5209 | GLint *v_base = (GLint *) 0; |
| 5210 | jint _remaining; |
| 5211 | GLint *v = (GLint *) 0; |
| 5212 | |
| 5213 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5214 | _exception = 1; |
| 5215 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5216 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5217 | goto exit; |
| 5218 | } |
| 5219 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5220 | _exception = 1; |
| 5221 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5222 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5223 | goto exit; |
| 5224 | } |
| 5225 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5226 | if (_remaining < count*4) { |
| 5227 | _exception = 1; |
| 5228 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5229 | _exceptionMessage = "length - offset < count*4 < needed"; |
| 5230 | goto exit; |
| 5231 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5232 | v_base = (GLint *) |
| 5233 | _env->GetPrimitiveArrayCritical(v_ref, (jboolean *)0); |
| 5234 | v = v_base + offset; |
| 5235 | |
| 5236 | glUniform4iv( |
| 5237 | (GLint)location, |
| 5238 | (GLsizei)count, |
| 5239 | (GLint *)v |
| 5240 | ); |
| 5241 | |
| 5242 | exit: |
| 5243 | if (v_base) { |
| 5244 | _env->ReleasePrimitiveArrayCritical(v_ref, v_base, |
| 5245 | JNI_ABORT); |
| 5246 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5247 | if (_exception) { |
| 5248 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5249 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5250 | } |
| 5251 | |
| 5252 | /* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 5253 | static void |
| 5254 | android_glUniform4iv__IILjava_nio_IntBuffer_2 |
| 5255 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5256 | jint _exception = 0; |
| 5257 | const char * _exceptionType = NULL; |
| 5258 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5259 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5260 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5261 | jint _remaining; |
| 5262 | GLint *v = (GLint *) 0; |
| 5263 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5264 | v = (GLint *)getPointer(_env, v_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5265 | if (_remaining < count*4) { |
| 5266 | _exception = 1; |
| 5267 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5268 | _exceptionMessage = "remaining() < count*4 < needed"; |
| 5269 | goto exit; |
| 5270 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5271 | if (v == NULL) { |
| 5272 | char * _vBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 5273 | v = (GLint *) (_vBase + _bufferOffset); |
| 5274 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5275 | glUniform4iv( |
| 5276 | (GLint)location, |
| 5277 | (GLsizei)count, |
| 5278 | (GLint *)v |
| 5279 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5280 | |
| 5281 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5282 | if (_array) { |
| 5283 | releasePointer(_env, _array, v, JNI_FALSE); |
| 5284 | } |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5285 | if (_exception) { |
| 5286 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5287 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5288 | } |
| 5289 | |
| 5290 | /* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ |
| 5291 | static void |
| 5292 | android_glUniformMatrix2fv__IIZ_3FI |
| 5293 | (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5294 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5295 | const char * _exceptionType = NULL; |
| 5296 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5297 | GLfloat *value_base = (GLfloat *) 0; |
| 5298 | jint _remaining; |
| 5299 | GLfloat *value = (GLfloat *) 0; |
| 5300 | |
| 5301 | if (!value_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5302 | _exception = 1; |
| 5303 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5304 | _exceptionMessage = "value == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5305 | goto exit; |
| 5306 | } |
| 5307 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5308 | _exception = 1; |
| 5309 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5310 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5311 | goto exit; |
| 5312 | } |
| 5313 | _remaining = _env->GetArrayLength(value_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5314 | if (_remaining < count*4) { |
| 5315 | _exception = 1; |
| 5316 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5317 | _exceptionMessage = "length - offset < count*4 < needed"; |
| 5318 | goto exit; |
| 5319 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5320 | value_base = (GLfloat *) |
| 5321 | _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0); |
| 5322 | value = value_base + offset; |
| 5323 | |
| 5324 | glUniformMatrix2fv( |
| 5325 | (GLint)location, |
| 5326 | (GLsizei)count, |
| 5327 | (GLboolean)transpose, |
| 5328 | (GLfloat *)value |
| 5329 | ); |
| 5330 | |
| 5331 | exit: |
| 5332 | if (value_base) { |
| 5333 | _env->ReleasePrimitiveArrayCritical(value_ref, value_base, |
| 5334 | JNI_ABORT); |
| 5335 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5336 | if (_exception) { |
| 5337 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5338 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5339 | } |
| 5340 | |
| 5341 | /* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ |
| 5342 | static void |
| 5343 | android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 |
| 5344 | (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5345 | jint _exception = 0; |
| 5346 | const char * _exceptionType = NULL; |
| 5347 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5348 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5349 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5350 | jint _remaining; |
| 5351 | GLfloat *value = (GLfloat *) 0; |
| 5352 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5353 | value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5354 | if (_remaining < count*4) { |
| 5355 | _exception = 1; |
| 5356 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5357 | _exceptionMessage = "remaining() < count*4 < needed"; |
| 5358 | goto exit; |
| 5359 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5360 | if (value == NULL) { |
| 5361 | char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 5362 | value = (GLfloat *) (_valueBase + _bufferOffset); |
| 5363 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5364 | glUniformMatrix2fv( |
| 5365 | (GLint)location, |
| 5366 | (GLsizei)count, |
| 5367 | (GLboolean)transpose, |
| 5368 | (GLfloat *)value |
| 5369 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5370 | |
| 5371 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5372 | if (_array) { |
| 5373 | releasePointer(_env, _array, value, JNI_FALSE); |
| 5374 | } |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5375 | if (_exception) { |
| 5376 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5377 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5378 | } |
| 5379 | |
| 5380 | /* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ |
| 5381 | static void |
| 5382 | android_glUniformMatrix3fv__IIZ_3FI |
| 5383 | (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5384 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5385 | const char * _exceptionType = NULL; |
| 5386 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5387 | GLfloat *value_base = (GLfloat *) 0; |
| 5388 | jint _remaining; |
| 5389 | GLfloat *value = (GLfloat *) 0; |
| 5390 | |
| 5391 | if (!value_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5392 | _exception = 1; |
| 5393 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5394 | _exceptionMessage = "value == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5395 | goto exit; |
| 5396 | } |
| 5397 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5398 | _exception = 1; |
| 5399 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5400 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5401 | goto exit; |
| 5402 | } |
| 5403 | _remaining = _env->GetArrayLength(value_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5404 | if (_remaining < count*9) { |
| 5405 | _exception = 1; |
| 5406 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5407 | _exceptionMessage = "length - offset < count*9 < needed"; |
| 5408 | goto exit; |
| 5409 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5410 | value_base = (GLfloat *) |
| 5411 | _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0); |
| 5412 | value = value_base + offset; |
| 5413 | |
| 5414 | glUniformMatrix3fv( |
| 5415 | (GLint)location, |
| 5416 | (GLsizei)count, |
| 5417 | (GLboolean)transpose, |
| 5418 | (GLfloat *)value |
| 5419 | ); |
| 5420 | |
| 5421 | exit: |
| 5422 | if (value_base) { |
| 5423 | _env->ReleasePrimitiveArrayCritical(value_ref, value_base, |
| 5424 | JNI_ABORT); |
| 5425 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5426 | if (_exception) { |
| 5427 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5428 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5429 | } |
| 5430 | |
| 5431 | /* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ |
| 5432 | static void |
| 5433 | android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 |
| 5434 | (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5435 | jint _exception = 0; |
| 5436 | const char * _exceptionType = NULL; |
| 5437 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5438 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5439 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5440 | jint _remaining; |
| 5441 | GLfloat *value = (GLfloat *) 0; |
| 5442 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5443 | value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5444 | if (_remaining < count*9) { |
| 5445 | _exception = 1; |
| 5446 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5447 | _exceptionMessage = "remaining() < count*9 < needed"; |
| 5448 | goto exit; |
| 5449 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5450 | if (value == NULL) { |
| 5451 | char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 5452 | value = (GLfloat *) (_valueBase + _bufferOffset); |
| 5453 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5454 | glUniformMatrix3fv( |
| 5455 | (GLint)location, |
| 5456 | (GLsizei)count, |
| 5457 | (GLboolean)transpose, |
| 5458 | (GLfloat *)value |
| 5459 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5460 | |
| 5461 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5462 | if (_array) { |
| 5463 | releasePointer(_env, _array, value, JNI_FALSE); |
| 5464 | } |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5465 | if (_exception) { |
| 5466 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5467 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5468 | } |
| 5469 | |
| 5470 | /* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ |
| 5471 | static void |
| 5472 | android_glUniformMatrix4fv__IIZ_3FI |
| 5473 | (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5474 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5475 | const char * _exceptionType = NULL; |
| 5476 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5477 | GLfloat *value_base = (GLfloat *) 0; |
| 5478 | jint _remaining; |
| 5479 | GLfloat *value = (GLfloat *) 0; |
| 5480 | |
| 5481 | if (!value_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5482 | _exception = 1; |
| 5483 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5484 | _exceptionMessage = "value == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5485 | goto exit; |
| 5486 | } |
| 5487 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5488 | _exception = 1; |
| 5489 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5490 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5491 | goto exit; |
| 5492 | } |
| 5493 | _remaining = _env->GetArrayLength(value_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5494 | if (_remaining < count*16) { |
| 5495 | _exception = 1; |
| 5496 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5497 | _exceptionMessage = "length - offset < count*16 < needed"; |
| 5498 | goto exit; |
| 5499 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5500 | value_base = (GLfloat *) |
| 5501 | _env->GetPrimitiveArrayCritical(value_ref, (jboolean *)0); |
| 5502 | value = value_base + offset; |
| 5503 | |
| 5504 | glUniformMatrix4fv( |
| 5505 | (GLint)location, |
| 5506 | (GLsizei)count, |
| 5507 | (GLboolean)transpose, |
| 5508 | (GLfloat *)value |
| 5509 | ); |
| 5510 | |
| 5511 | exit: |
| 5512 | if (value_base) { |
| 5513 | _env->ReleasePrimitiveArrayCritical(value_ref, value_base, |
| 5514 | JNI_ABORT); |
| 5515 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5516 | if (_exception) { |
| 5517 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5518 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5519 | } |
| 5520 | |
| 5521 | /* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ |
| 5522 | static void |
| 5523 | android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2 |
| 5524 | (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5525 | jint _exception = 0; |
| 5526 | const char * _exceptionType = NULL; |
| 5527 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5528 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5529 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5530 | jint _remaining; |
| 5531 | GLfloat *value = (GLfloat *) 0; |
| 5532 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5533 | value = (GLfloat *)getPointer(_env, value_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5534 | if (_remaining < count*16) { |
| 5535 | _exception = 1; |
| 5536 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5537 | _exceptionMessage = "remaining() < count*16 < needed"; |
| 5538 | goto exit; |
| 5539 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5540 | if (value == NULL) { |
| 5541 | char * _valueBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 5542 | value = (GLfloat *) (_valueBase + _bufferOffset); |
| 5543 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5544 | glUniformMatrix4fv( |
| 5545 | (GLint)location, |
| 5546 | (GLsizei)count, |
| 5547 | (GLboolean)transpose, |
| 5548 | (GLfloat *)value |
| 5549 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5550 | |
| 5551 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5552 | if (_array) { |
| 5553 | releasePointer(_env, _array, value, JNI_FALSE); |
| 5554 | } |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5555 | if (_exception) { |
| 5556 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5557 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5558 | } |
| 5559 | |
| 5560 | /* void glUseProgram ( GLuint program ) */ |
| 5561 | static void |
| 5562 | android_glUseProgram__I |
| 5563 | (JNIEnv *_env, jobject _this, jint program) { |
| 5564 | glUseProgram( |
| 5565 | (GLuint)program |
| 5566 | ); |
| 5567 | } |
| 5568 | |
| 5569 | /* void glValidateProgram ( GLuint program ) */ |
| 5570 | static void |
| 5571 | android_glValidateProgram__I |
| 5572 | (JNIEnv *_env, jobject _this, jint program) { |
| 5573 | glValidateProgram( |
| 5574 | (GLuint)program |
| 5575 | ); |
| 5576 | } |
| 5577 | |
| 5578 | /* void glVertexAttrib1f ( GLuint indx, GLfloat x ) */ |
| 5579 | static void |
| 5580 | android_glVertexAttrib1f__IF |
| 5581 | (JNIEnv *_env, jobject _this, jint indx, jfloat x) { |
| 5582 | glVertexAttrib1f( |
| 5583 | (GLuint)indx, |
| 5584 | (GLfloat)x |
| 5585 | ); |
| 5586 | } |
| 5587 | |
| 5588 | /* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */ |
| 5589 | static void |
| 5590 | android_glVertexAttrib1fv__I_3FI |
| 5591 | (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5592 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5593 | const char * _exceptionType = NULL; |
| 5594 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5595 | GLfloat *values_base = (GLfloat *) 0; |
| 5596 | jint _remaining; |
| 5597 | GLfloat *values = (GLfloat *) 0; |
| 5598 | |
| 5599 | if (!values_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5600 | _exception = 1; |
| 5601 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5602 | _exceptionMessage = "values == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5603 | goto exit; |
| 5604 | } |
| 5605 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5606 | _exception = 1; |
| 5607 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5608 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5609 | goto exit; |
| 5610 | } |
| 5611 | _remaining = _env->GetArrayLength(values_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5612 | if (_remaining < 1) { |
| 5613 | _exception = 1; |
| 5614 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5615 | _exceptionMessage = "length - offset < 1 < needed"; |
| 5616 | goto exit; |
| 5617 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5618 | values_base = (GLfloat *) |
| 5619 | _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0); |
| 5620 | values = values_base + offset; |
| 5621 | |
| 5622 | glVertexAttrib1fv( |
| 5623 | (GLuint)indx, |
| 5624 | (GLfloat *)values |
| 5625 | ); |
| 5626 | |
| 5627 | exit: |
| 5628 | if (values_base) { |
| 5629 | _env->ReleasePrimitiveArrayCritical(values_ref, values_base, |
| 5630 | JNI_ABORT); |
| 5631 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5632 | if (_exception) { |
| 5633 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5634 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5635 | } |
| 5636 | |
| 5637 | /* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */ |
| 5638 | static void |
| 5639 | android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2 |
| 5640 | (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5641 | jint _exception = 0; |
| 5642 | const char * _exceptionType = NULL; |
| 5643 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5644 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5645 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5646 | jint _remaining; |
| 5647 | GLfloat *values = (GLfloat *) 0; |
| 5648 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5649 | values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5650 | if (_remaining < 1) { |
| 5651 | _exception = 1; |
| 5652 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5653 | _exceptionMessage = "remaining() < 1 < needed"; |
| 5654 | goto exit; |
| 5655 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5656 | if (values == NULL) { |
| 5657 | char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 5658 | values = (GLfloat *) (_valuesBase + _bufferOffset); |
| 5659 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5660 | glVertexAttrib1fv( |
| 5661 | (GLuint)indx, |
| 5662 | (GLfloat *)values |
| 5663 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5664 | |
| 5665 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5666 | if (_array) { |
| 5667 | releasePointer(_env, _array, values, JNI_FALSE); |
| 5668 | } |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5669 | if (_exception) { |
| 5670 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5671 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5672 | } |
| 5673 | |
| 5674 | /* void glVertexAttrib2f ( GLuint indx, GLfloat x, GLfloat y ) */ |
| 5675 | static void |
| 5676 | android_glVertexAttrib2f__IFF |
| 5677 | (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y) { |
| 5678 | glVertexAttrib2f( |
| 5679 | (GLuint)indx, |
| 5680 | (GLfloat)x, |
| 5681 | (GLfloat)y |
| 5682 | ); |
| 5683 | } |
| 5684 | |
| 5685 | /* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */ |
| 5686 | static void |
| 5687 | android_glVertexAttrib2fv__I_3FI |
| 5688 | (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5689 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5690 | const char * _exceptionType = NULL; |
| 5691 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5692 | GLfloat *values_base = (GLfloat *) 0; |
| 5693 | jint _remaining; |
| 5694 | GLfloat *values = (GLfloat *) 0; |
| 5695 | |
| 5696 | if (!values_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5697 | _exception = 1; |
| 5698 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5699 | _exceptionMessage = "values == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5700 | goto exit; |
| 5701 | } |
| 5702 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5703 | _exception = 1; |
| 5704 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5705 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5706 | goto exit; |
| 5707 | } |
| 5708 | _remaining = _env->GetArrayLength(values_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5709 | if (_remaining < 2) { |
| 5710 | _exception = 1; |
| 5711 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5712 | _exceptionMessage = "length - offset < 2 < needed"; |
| 5713 | goto exit; |
| 5714 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5715 | values_base = (GLfloat *) |
| 5716 | _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0); |
| 5717 | values = values_base + offset; |
| 5718 | |
| 5719 | glVertexAttrib2fv( |
| 5720 | (GLuint)indx, |
| 5721 | (GLfloat *)values |
| 5722 | ); |
| 5723 | |
| 5724 | exit: |
| 5725 | if (values_base) { |
| 5726 | _env->ReleasePrimitiveArrayCritical(values_ref, values_base, |
| 5727 | JNI_ABORT); |
| 5728 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5729 | if (_exception) { |
| 5730 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5731 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5732 | } |
| 5733 | |
| 5734 | /* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */ |
| 5735 | static void |
| 5736 | android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2 |
| 5737 | (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5738 | jint _exception = 0; |
| 5739 | const char * _exceptionType = NULL; |
| 5740 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5741 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5742 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5743 | jint _remaining; |
| 5744 | GLfloat *values = (GLfloat *) 0; |
| 5745 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5746 | values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5747 | if (_remaining < 2) { |
| 5748 | _exception = 1; |
| 5749 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5750 | _exceptionMessage = "remaining() < 2 < needed"; |
| 5751 | goto exit; |
| 5752 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5753 | if (values == NULL) { |
| 5754 | char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 5755 | values = (GLfloat *) (_valuesBase + _bufferOffset); |
| 5756 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5757 | glVertexAttrib2fv( |
| 5758 | (GLuint)indx, |
| 5759 | (GLfloat *)values |
| 5760 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5761 | |
| 5762 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5763 | if (_array) { |
| 5764 | releasePointer(_env, _array, values, JNI_FALSE); |
| 5765 | } |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5766 | if (_exception) { |
| 5767 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5768 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5769 | } |
| 5770 | |
| 5771 | /* void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z ) */ |
| 5772 | static void |
| 5773 | android_glVertexAttrib3f__IFFF |
| 5774 | (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z) { |
| 5775 | glVertexAttrib3f( |
| 5776 | (GLuint)indx, |
| 5777 | (GLfloat)x, |
| 5778 | (GLfloat)y, |
| 5779 | (GLfloat)z |
| 5780 | ); |
| 5781 | } |
| 5782 | |
| 5783 | /* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */ |
| 5784 | static void |
| 5785 | android_glVertexAttrib3fv__I_3FI |
| 5786 | (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5787 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5788 | const char * _exceptionType = NULL; |
| 5789 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5790 | GLfloat *values_base = (GLfloat *) 0; |
| 5791 | jint _remaining; |
| 5792 | GLfloat *values = (GLfloat *) 0; |
| 5793 | |
| 5794 | if (!values_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5795 | _exception = 1; |
| 5796 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5797 | _exceptionMessage = "values == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5798 | goto exit; |
| 5799 | } |
| 5800 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5801 | _exception = 1; |
| 5802 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5803 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5804 | goto exit; |
| 5805 | } |
| 5806 | _remaining = _env->GetArrayLength(values_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5807 | if (_remaining < 3) { |
| 5808 | _exception = 1; |
| 5809 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5810 | _exceptionMessage = "length - offset < 3 < needed"; |
| 5811 | goto exit; |
| 5812 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5813 | values_base = (GLfloat *) |
| 5814 | _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0); |
| 5815 | values = values_base + offset; |
| 5816 | |
| 5817 | glVertexAttrib3fv( |
| 5818 | (GLuint)indx, |
| 5819 | (GLfloat *)values |
| 5820 | ); |
| 5821 | |
| 5822 | exit: |
| 5823 | if (values_base) { |
| 5824 | _env->ReleasePrimitiveArrayCritical(values_ref, values_base, |
| 5825 | JNI_ABORT); |
| 5826 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5827 | if (_exception) { |
| 5828 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5829 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5830 | } |
| 5831 | |
| 5832 | /* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */ |
| 5833 | static void |
| 5834 | android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2 |
| 5835 | (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5836 | jint _exception = 0; |
| 5837 | const char * _exceptionType = NULL; |
| 5838 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5839 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5840 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5841 | jint _remaining; |
| 5842 | GLfloat *values = (GLfloat *) 0; |
| 5843 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5844 | values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5845 | if (_remaining < 3) { |
| 5846 | _exception = 1; |
| 5847 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5848 | _exceptionMessage = "remaining() < 3 < needed"; |
| 5849 | goto exit; |
| 5850 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5851 | if (values == NULL) { |
| 5852 | char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 5853 | values = (GLfloat *) (_valuesBase + _bufferOffset); |
| 5854 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5855 | glVertexAttrib3fv( |
| 5856 | (GLuint)indx, |
| 5857 | (GLfloat *)values |
| 5858 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5859 | |
| 5860 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5861 | if (_array) { |
| 5862 | releasePointer(_env, _array, values, JNI_FALSE); |
| 5863 | } |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5864 | if (_exception) { |
| 5865 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5866 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5867 | } |
| 5868 | |
| 5869 | /* void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */ |
| 5870 | static void |
| 5871 | android_glVertexAttrib4f__IFFFF |
| 5872 | (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z, jfloat w) { |
| 5873 | glVertexAttrib4f( |
| 5874 | (GLuint)indx, |
| 5875 | (GLfloat)x, |
| 5876 | (GLfloat)y, |
| 5877 | (GLfloat)z, |
| 5878 | (GLfloat)w |
| 5879 | ); |
| 5880 | } |
| 5881 | |
| 5882 | /* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */ |
| 5883 | static void |
| 5884 | android_glVertexAttrib4fv__I_3FI |
| 5885 | (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5886 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5887 | const char * _exceptionType = NULL; |
| 5888 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5889 | GLfloat *values_base = (GLfloat *) 0; |
| 5890 | jint _remaining; |
| 5891 | GLfloat *values = (GLfloat *) 0; |
| 5892 | |
| 5893 | if (!values_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5894 | _exception = 1; |
| 5895 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5896 | _exceptionMessage = "values == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5897 | goto exit; |
| 5898 | } |
| 5899 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5900 | _exception = 1; |
| 5901 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5902 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5903 | goto exit; |
| 5904 | } |
| 5905 | _remaining = _env->GetArrayLength(values_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5906 | if (_remaining < 4) { |
| 5907 | _exception = 1; |
| 5908 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5909 | _exceptionMessage = "length - offset < 4 < needed"; |
| 5910 | goto exit; |
| 5911 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5912 | values_base = (GLfloat *) |
| 5913 | _env->GetPrimitiveArrayCritical(values_ref, (jboolean *)0); |
| 5914 | values = values_base + offset; |
| 5915 | |
| 5916 | glVertexAttrib4fv( |
| 5917 | (GLuint)indx, |
| 5918 | (GLfloat *)values |
| 5919 | ); |
| 5920 | |
| 5921 | exit: |
| 5922 | if (values_base) { |
| 5923 | _env->ReleasePrimitiveArrayCritical(values_ref, values_base, |
| 5924 | JNI_ABORT); |
| 5925 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5926 | if (_exception) { |
| 5927 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5928 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5929 | } |
| 5930 | |
| 5931 | /* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */ |
| 5932 | static void |
| 5933 | android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 |
| 5934 | (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5935 | jint _exception = 0; |
| 5936 | const char * _exceptionType = NULL; |
| 5937 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5938 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5939 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5940 | jint _remaining; |
| 5941 | GLfloat *values = (GLfloat *) 0; |
| 5942 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5943 | values = (GLfloat *)getPointer(_env, values_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5944 | if (_remaining < 4) { |
| 5945 | _exception = 1; |
| 5946 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5947 | _exceptionMessage = "remaining() < 4 < needed"; |
| 5948 | goto exit; |
| 5949 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5950 | if (values == NULL) { |
| 5951 | char * _valuesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 5952 | values = (GLfloat *) (_valuesBase + _bufferOffset); |
| 5953 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5954 | glVertexAttrib4fv( |
| 5955 | (GLuint)indx, |
| 5956 | (GLfloat *)values |
| 5957 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5958 | |
| 5959 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5960 | if (_array) { |
| 5961 | releasePointer(_env, _array, values, JNI_FALSE); |
| 5962 | } |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5963 | if (_exception) { |
| 5964 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5965 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5966 | } |
| 5967 | |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 5968 | /* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint offset ) */ |
| 5969 | static void |
| 5970 | android_glVertexAttribPointer__IIIZII |
| 5971 | (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jint offset) { |
| 5972 | glVertexAttribPointer( |
| 5973 | (GLuint)indx, |
| 5974 | (GLint)size, |
| 5975 | (GLenum)type, |
| 5976 | (GLboolean)normalized, |
| 5977 | (GLsizei)stride, |
| 5978 | (const GLvoid *)offset |
| 5979 | ); |
| 5980 | } |
| 5981 | |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5982 | /* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr ) */ |
| 5983 | static void |
| 5984 | android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I |
| 5985 | (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jobject ptr_buf, jint remaining) { |
| 5986 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5987 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5988 | jint _remaining; |
| 5989 | GLvoid *ptr = (GLvoid *) 0; |
| 5990 | |
| 5991 | if (ptr_buf) { |
| 5992 | ptr = (GLvoid *) getDirectBufferPointer(_env, ptr_buf); |
| 5993 | if ( ! ptr ) { |
| 5994 | return; |
| 5995 | } |
| 5996 | } |
| 5997 | glVertexAttribPointerBounds( |
| 5998 | (GLuint)indx, |
| 5999 | (GLint)size, |
| 6000 | (GLenum)type, |
| 6001 | (GLboolean)normalized, |
| 6002 | (GLsizei)stride, |
| 6003 | (GLvoid *)ptr, |
| 6004 | (GLsizei)remaining |
| 6005 | ); |
| 6006 | } |
| 6007 | |
| 6008 | /* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */ |
| 6009 | static void |
| 6010 | android_glViewport__IIII |
| 6011 | (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) { |
| 6012 | glViewport( |
| 6013 | (GLint)x, |
| 6014 | (GLint)y, |
| 6015 | (GLsizei)width, |
| 6016 | (GLsizei)height |
| 6017 | ); |
| 6018 | } |
| 6019 | |
| 6020 | static const char *classPathName = "android/opengl/GLES20"; |
| 6021 | |
| 6022 | static JNINativeMethod methods[] = { |
| 6023 | {"_nativeClassInit", "()V", (void*)nativeClassInit }, |
| 6024 | {"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I }, |
| 6025 | {"glAttachShader", "(II)V", (void *) android_glAttachShader__II }, |
| 6026 | {"glBindAttribLocation", "(IILjava/lang/String;)V", (void *) android_glBindAttribLocation__IILjava_lang_String_2 }, |
| 6027 | {"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II }, |
| 6028 | {"glBindFramebuffer", "(II)V", (void *) android_glBindFramebuffer__II }, |
| 6029 | {"glBindRenderbuffer", "(II)V", (void *) android_glBindRenderbuffer__II }, |
| 6030 | {"glBindTexture", "(II)V", (void *) android_glBindTexture__II }, |
| 6031 | {"glBlendColor", "(FFFF)V", (void *) android_glBlendColor__FFFF }, |
| 6032 | {"glBlendEquation", "(I)V", (void *) android_glBlendEquation__I }, |
| 6033 | {"glBlendEquationSeparate", "(II)V", (void *) android_glBlendEquationSeparate__II }, |
| 6034 | {"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II }, |
| 6035 | {"glBlendFuncSeparate", "(IIII)V", (void *) android_glBlendFuncSeparate__IIII }, |
| 6036 | {"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I }, |
| 6037 | {"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 }, |
| 6038 | {"glCheckFramebufferStatus", "(I)I", (void *) android_glCheckFramebufferStatus__I }, |
| 6039 | {"glClear", "(I)V", (void *) android_glClear__I }, |
| 6040 | {"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF }, |
| 6041 | {"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F }, |
| 6042 | {"glClearStencil", "(I)V", (void *) android_glClearStencil__I }, |
| 6043 | {"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ }, |
| 6044 | {"glCompileShader", "(I)V", (void *) android_glCompileShader__I }, |
| 6045 | {"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 }, |
| 6046 | {"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 }, |
| 6047 | {"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII }, |
| 6048 | {"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII }, |
| 6049 | {"glCreateProgram", "()I", (void *) android_glCreateProgram__ }, |
| 6050 | {"glCreateShader", "(I)I", (void *) android_glCreateShader__I }, |
| 6051 | {"glCullFace", "(I)V", (void *) android_glCullFace__I }, |
| 6052 | {"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II }, |
| 6053 | {"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 }, |
| 6054 | {"glDeleteFramebuffers", "(I[II)V", (void *) android_glDeleteFramebuffers__I_3II }, |
| 6055 | {"glDeleteFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2 }, |
| 6056 | {"glDeleteProgram", "(I)V", (void *) android_glDeleteProgram__I }, |
| 6057 | {"glDeleteRenderbuffers", "(I[II)V", (void *) android_glDeleteRenderbuffers__I_3II }, |
| 6058 | {"glDeleteRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2 }, |
| 6059 | {"glDeleteShader", "(I)V", (void *) android_glDeleteShader__I }, |
| 6060 | {"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II }, |
| 6061 | {"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 }, |
| 6062 | {"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I }, |
| 6063 | {"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z }, |
| 6064 | {"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF }, |
| 6065 | {"glDetachShader", "(II)V", (void *) android_glDetachShader__II }, |
| 6066 | {"glDisable", "(I)V", (void *) android_glDisable__I }, |
| 6067 | {"glDisableVertexAttribArray", "(I)V", (void *) android_glDisableVertexAttribArray__I }, |
| 6068 | {"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III }, |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 6069 | {"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII }, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6070 | {"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 }, |
| 6071 | {"glEnable", "(I)V", (void *) android_glEnable__I }, |
| 6072 | {"glEnableVertexAttribArray", "(I)V", (void *) android_glEnableVertexAttribArray__I }, |
| 6073 | {"glFinish", "()V", (void *) android_glFinish__ }, |
| 6074 | {"glFlush", "()V", (void *) android_glFlush__ }, |
| 6075 | {"glFramebufferRenderbuffer", "(IIII)V", (void *) android_glFramebufferRenderbuffer__IIII }, |
| 6076 | {"glFramebufferTexture2D", "(IIIII)V", (void *) android_glFramebufferTexture2D__IIIII }, |
| 6077 | {"glFrontFace", "(I)V", (void *) android_glFrontFace__I }, |
| 6078 | {"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II }, |
| 6079 | {"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 }, |
| 6080 | {"glGenerateMipmap", "(I)V", (void *) android_glGenerateMipmap__I }, |
| 6081 | {"glGenFramebuffers", "(I[II)V", (void *) android_glGenFramebuffers__I_3II }, |
| 6082 | {"glGenFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenFramebuffers__ILjava_nio_IntBuffer_2 }, |
| 6083 | {"glGenRenderbuffers", "(I[II)V", (void *) android_glGenRenderbuffers__I_3II }, |
| 6084 | {"glGenRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenRenderbuffers__ILjava_nio_IntBuffer_2 }, |
| 6085 | {"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II }, |
| 6086 | {"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 }, |
| 6087 | {"glGetActiveAttrib", "(III[II[II[II[BI)V", (void *) android_glGetActiveAttrib__III_3II_3II_3II_3BI }, |
| 6088 | {"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 Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 6089 | {"glGetActiveAttrib", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveAttrib1 }, |
| 6090 | {"glGetActiveAttrib", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveAttrib2 }, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6091 | {"glGetActiveUniform", "(III[II[II[II[BI)V", (void *) android_glGetActiveUniform__III_3II_3II_3II_3BI }, |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 6092 | {"glGetActiveUniform", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveUniform1 }, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6093 | {"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 Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 6094 | {"glGetActiveUniform", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveUniform2 }, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6095 | {"glGetAttachedShaders", "(II[II[II)V", (void *) android_glGetAttachedShaders__II_3II_3II }, |
| 6096 | {"glGetAttachedShaders", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 }, |
| 6097 | {"glGetAttribLocation", "(ILjava/lang/String;)I", (void *) android_glGetAttribLocation__ILjava_lang_String_2 }, |
| 6098 | {"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI }, |
| 6099 | {"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 }, |
| 6100 | {"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II }, |
| 6101 | {"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 }, |
| 6102 | {"glGetError", "()I", (void *) android_glGetError__ }, |
| 6103 | {"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI }, |
| 6104 | {"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 }, |
| 6105 | {"glGetFramebufferAttachmentParameteriv", "(III[II)V", (void *) android_glGetFramebufferAttachmentParameteriv__III_3II }, |
| 6106 | {"glGetFramebufferAttachmentParameteriv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 }, |
| 6107 | {"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II }, |
| 6108 | {"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 }, |
| 6109 | {"glGetProgramiv", "(II[II)V", (void *) android_glGetProgramiv__II_3II }, |
| 6110 | {"glGetProgramiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetProgramiv__IILjava_nio_IntBuffer_2 }, |
| 6111 | {"glGetProgramInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetProgramInfoLog }, |
| 6112 | {"glGetRenderbufferParameteriv", "(II[II)V", (void *) android_glGetRenderbufferParameteriv__II_3II }, |
| 6113 | {"glGetRenderbufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2 }, |
| 6114 | {"glGetShaderiv", "(II[II)V", (void *) android_glGetShaderiv__II_3II }, |
| 6115 | {"glGetShaderiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetShaderiv__IILjava_nio_IntBuffer_2 }, |
| 6116 | {"glGetShaderInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetShaderInfoLog }, |
| 6117 | {"glGetShaderPrecisionFormat", "(II[II[II)V", (void *) android_glGetShaderPrecisionFormat__II_3II_3II }, |
| 6118 | {"glGetShaderPrecisionFormat", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 }, |
| 6119 | {"glGetShaderSource", "(II[II[BI)V", (void *) android_glGetShaderSource__II_3II_3BI }, |
| 6120 | {"glGetShaderSource", "(IILjava/nio/IntBuffer;B)V", (void *) android_glGetShaderSource__IILjava_nio_IntBuffer_2B }, |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 6121 | {"glGetShaderSource", "(I)Ljava/lang/String;", (void *) android_glGetShaderSource }, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6122 | {"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString }, |
| 6123 | {"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI }, |
| 6124 | {"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 }, |
| 6125 | {"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II }, |
| 6126 | {"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 }, |
| 6127 | {"glGetUniformfv", "(II[FI)V", (void *) android_glGetUniformfv__II_3FI }, |
| 6128 | {"glGetUniformfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetUniformfv__IILjava_nio_FloatBuffer_2 }, |
| 6129 | {"glGetUniformiv", "(II[II)V", (void *) android_glGetUniformiv__II_3II }, |
| 6130 | {"glGetUniformiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetUniformiv__IILjava_nio_IntBuffer_2 }, |
| 6131 | {"glGetUniformLocation", "(ILjava/lang/String;)I", (void *) android_glGetUniformLocation__ILjava_lang_String_2 }, |
| 6132 | {"glGetVertexAttribfv", "(II[FI)V", (void *) android_glGetVertexAttribfv__II_3FI }, |
| 6133 | {"glGetVertexAttribfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2 }, |
| 6134 | {"glGetVertexAttribiv", "(II[II)V", (void *) android_glGetVertexAttribiv__II_3II }, |
| 6135 | {"glGetVertexAttribiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2 }, |
| 6136 | {"glHint", "(II)V", (void *) android_glHint__II }, |
| 6137 | {"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I }, |
| 6138 | {"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I }, |
| 6139 | {"glIsFramebuffer", "(I)Z", (void *) android_glIsFramebuffer__I }, |
| 6140 | {"glIsProgram", "(I)Z", (void *) android_glIsProgram__I }, |
| 6141 | {"glIsRenderbuffer", "(I)Z", (void *) android_glIsRenderbuffer__I }, |
| 6142 | {"glIsShader", "(I)Z", (void *) android_glIsShader__I }, |
| 6143 | {"glIsTexture", "(I)Z", (void *) android_glIsTexture__I }, |
| 6144 | {"glLineWidth", "(F)V", (void *) android_glLineWidth__F }, |
| 6145 | {"glLinkProgram", "(I)V", (void *) android_glLinkProgram__I }, |
| 6146 | {"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II }, |
| 6147 | {"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF }, |
| 6148 | {"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 }, |
| 6149 | {"glReleaseShaderCompiler", "()V", (void *) android_glReleaseShaderCompiler__ }, |
| 6150 | {"glRenderbufferStorage", "(IIII)V", (void *) android_glRenderbufferStorage__IIII }, |
| 6151 | {"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ }, |
| 6152 | {"glScissor", "(IIII)V", (void *) android_glScissor__IIII }, |
| 6153 | {"glShaderBinary", "(I[IIILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__I_3IIILjava_nio_Buffer_2I }, |
| 6154 | {"glShaderBinary", "(ILjava/nio/IntBuffer;ILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I }, |
| 6155 | {"glShaderSource", "(ILjava/lang/String;)V", (void *) android_glShaderSource }, |
| 6156 | {"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III }, |
| 6157 | {"glStencilFuncSeparate", "(IIII)V", (void *) android_glStencilFuncSeparate__IIII }, |
| 6158 | {"glStencilMask", "(I)V", (void *) android_glStencilMask__I }, |
| 6159 | {"glStencilMaskSeparate", "(II)V", (void *) android_glStencilMaskSeparate__II }, |
| 6160 | {"glStencilOp", "(III)V", (void *) android_glStencilOp__III }, |
| 6161 | {"glStencilOpSeparate", "(IIII)V", (void *) android_glStencilOpSeparate__IIII }, |
| 6162 | {"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 }, |
| 6163 | {"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF }, |
| 6164 | {"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI }, |
| 6165 | {"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 }, |
| 6166 | {"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III }, |
| 6167 | {"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II }, |
| 6168 | {"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 }, |
| 6169 | {"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 }, |
| 6170 | {"glUniform1f", "(IF)V", (void *) android_glUniform1f__IF }, |
| 6171 | {"glUniform1fv", "(II[FI)V", (void *) android_glUniform1fv__II_3FI }, |
| 6172 | {"glUniform1fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform1fv__IILjava_nio_FloatBuffer_2 }, |
| 6173 | {"glUniform1i", "(II)V", (void *) android_glUniform1i__II }, |
| 6174 | {"glUniform1iv", "(II[II)V", (void *) android_glUniform1iv__II_3II }, |
| 6175 | {"glUniform1iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform1iv__IILjava_nio_IntBuffer_2 }, |
| 6176 | {"glUniform2f", "(IFF)V", (void *) android_glUniform2f__IFF }, |
| 6177 | {"glUniform2fv", "(II[FI)V", (void *) android_glUniform2fv__II_3FI }, |
| 6178 | {"glUniform2fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform2fv__IILjava_nio_FloatBuffer_2 }, |
| 6179 | {"glUniform2i", "(III)V", (void *) android_glUniform2i__III }, |
| 6180 | {"glUniform2iv", "(II[II)V", (void *) android_glUniform2iv__II_3II }, |
| 6181 | {"glUniform2iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform2iv__IILjava_nio_IntBuffer_2 }, |
| 6182 | {"glUniform3f", "(IFFF)V", (void *) android_glUniform3f__IFFF }, |
| 6183 | {"glUniform3fv", "(II[FI)V", (void *) android_glUniform3fv__II_3FI }, |
| 6184 | {"glUniform3fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform3fv__IILjava_nio_FloatBuffer_2 }, |
| 6185 | {"glUniform3i", "(IIII)V", (void *) android_glUniform3i__IIII }, |
| 6186 | {"glUniform3iv", "(II[II)V", (void *) android_glUniform3iv__II_3II }, |
| 6187 | {"glUniform3iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform3iv__IILjava_nio_IntBuffer_2 }, |
| 6188 | {"glUniform4f", "(IFFFF)V", (void *) android_glUniform4f__IFFFF }, |
| 6189 | {"glUniform4fv", "(II[FI)V", (void *) android_glUniform4fv__II_3FI }, |
| 6190 | {"glUniform4fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform4fv__IILjava_nio_FloatBuffer_2 }, |
| 6191 | {"glUniform4i", "(IIIII)V", (void *) android_glUniform4i__IIIII }, |
| 6192 | {"glUniform4iv", "(II[II)V", (void *) android_glUniform4iv__II_3II }, |
| 6193 | {"glUniform4iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform4iv__IILjava_nio_IntBuffer_2 }, |
| 6194 | {"glUniformMatrix2fv", "(IIZ[FI)V", (void *) android_glUniformMatrix2fv__IIZ_3FI }, |
| 6195 | {"glUniformMatrix2fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 }, |
| 6196 | {"glUniformMatrix3fv", "(IIZ[FI)V", (void *) android_glUniformMatrix3fv__IIZ_3FI }, |
| 6197 | {"glUniformMatrix3fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 }, |
| 6198 | {"glUniformMatrix4fv", "(IIZ[FI)V", (void *) android_glUniformMatrix4fv__IIZ_3FI }, |
| 6199 | {"glUniformMatrix4fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2 }, |
| 6200 | {"glUseProgram", "(I)V", (void *) android_glUseProgram__I }, |
| 6201 | {"glValidateProgram", "(I)V", (void *) android_glValidateProgram__I }, |
| 6202 | {"glVertexAttrib1f", "(IF)V", (void *) android_glVertexAttrib1f__IF }, |
| 6203 | {"glVertexAttrib1fv", "(I[FI)V", (void *) android_glVertexAttrib1fv__I_3FI }, |
| 6204 | {"glVertexAttrib1fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2 }, |
| 6205 | {"glVertexAttrib2f", "(IFF)V", (void *) android_glVertexAttrib2f__IFF }, |
| 6206 | {"glVertexAttrib2fv", "(I[FI)V", (void *) android_glVertexAttrib2fv__I_3FI }, |
| 6207 | {"glVertexAttrib2fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2 }, |
| 6208 | {"glVertexAttrib3f", "(IFFF)V", (void *) android_glVertexAttrib3f__IFFF }, |
| 6209 | {"glVertexAttrib3fv", "(I[FI)V", (void *) android_glVertexAttrib3fv__I_3FI }, |
| 6210 | {"glVertexAttrib3fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2 }, |
| 6211 | {"glVertexAttrib4f", "(IFFFF)V", (void *) android_glVertexAttrib4f__IFFFF }, |
| 6212 | {"glVertexAttrib4fv", "(I[FI)V", (void *) android_glVertexAttrib4fv__I_3FI }, |
| 6213 | {"glVertexAttrib4fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 }, |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 6214 | {"glVertexAttribPointer", "(IIIZII)V", (void *) android_glVertexAttribPointer__IIIZII }, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6215 | {"glVertexAttribPointerBounds", "(IIIZILjava/nio/Buffer;I)V", (void *) android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I }, |
| 6216 | {"glViewport", "(IIII)V", (void *) android_glViewport__IIII }, |
| 6217 | }; |
| 6218 | |
| 6219 | int register_android_opengl_jni_GLES20(JNIEnv *_env) |
| 6220 | { |
| 6221 | int err; |
| 6222 | err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods)); |
| 6223 | return err; |
| 6224 | } |