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