Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [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 | 27f8002 | 2009-04-15 19:13:17 -0700 | [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 | 27f8002 | 2009-04-15 19:13:17 -0700 | [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 | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | // This source file is automatically generated |
| 19 | |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 20 | #include <GLES/gl.h> |
| 21 | #include <GLES/glext.h> |
| 22 | |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 23 | #include "jni.h" |
| 24 | #include "JNIHelp.h" |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 25 | #include <android_runtime/AndroidRuntime.h> |
| 26 | #include <utils/misc.h> |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 27 | #include <assert.h> |
Jack Palevich | be6eac8 | 2009-12-08 15:43:51 +0800 | [diff] [blame] | 28 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 29 | static int initialized = 0; |
| 30 | |
| 31 | static jclass nioAccessClass; |
| 32 | static jclass bufferClass; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 33 | static jmethodID getBasePointerID; |
| 34 | static jmethodID getBaseArrayID; |
| 35 | static jmethodID getBaseArrayOffsetID; |
| 36 | static jfieldID positionID; |
| 37 | static jfieldID limitID; |
| 38 | static jfieldID elementSizeShiftID; |
| 39 | |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 40 | |
| 41 | /* special calls implemented in Android's GLES wrapper used to more |
| 42 | * efficiently bound-check passed arrays */ |
| 43 | extern "C" { |
| 44 | #ifdef GL_VERSION_ES_CM_1_1 |
| 45 | GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride, |
| 46 | const GLvoid *ptr, GLsizei count); |
| 47 | GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride, |
| 48 | const GLvoid *pointer, GLsizei count); |
| 49 | GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type, |
| 50 | GLsizei stride, const GLvoid *pointer, GLsizei count); |
| 51 | GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type, |
| 52 | GLsizei stride, const GLvoid *pointer, GLsizei count); |
| 53 | GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, |
| 54 | GLsizei stride, const GLvoid *pointer, GLsizei count); |
| 55 | GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, |
| 56 | GLsizei stride, const GLvoid *pointer, GLsizei count); |
| 57 | GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, |
| 58 | GLsizei stride, const GLvoid *pointer, GLsizei count); |
| 59 | #endif |
| 60 | #ifdef GL_ES_VERSION_2_0 |
| 61 | static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type, |
| 62 | GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) { |
| 63 | glVertexAttribPointer(indx, size, type, normalized, stride, pointer); |
| 64 | } |
| 65 | #endif |
| 66 | } |
| 67 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 68 | /* Cache method IDs each time the class is loaded. */ |
| 69 | |
| 70 | static void |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 71 | nativeClassInit(JNIEnv *_env, jclass glImplClass) |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 72 | { |
| 73 | jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); |
| 74 | nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); |
| 75 | |
| 76 | jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); |
| 77 | bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); |
| 78 | |
| 79 | getBasePointerID = _env->GetStaticMethodID(nioAccessClass, |
| 80 | "getBasePointer", "(Ljava/nio/Buffer;)J"); |
| 81 | getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, |
| 82 | "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); |
| 83 | getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, |
| 84 | "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); |
| 85 | |
| 86 | positionID = _env->GetFieldID(bufferClass, "position", "I"); |
| 87 | limitID = _env->GetFieldID(bufferClass, "limit", "I"); |
| 88 | elementSizeShiftID = |
| 89 | _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); |
| 90 | } |
| 91 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 92 | static void * |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 93 | getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset) |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 94 | { |
| 95 | jint position; |
| 96 | jint limit; |
| 97 | jint elementSizeShift; |
| 98 | jlong pointer; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 99 | |
| 100 | position = _env->GetIntField(buffer, positionID); |
| 101 | limit = _env->GetIntField(buffer, limitID); |
| 102 | elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); |
| 103 | *remaining = (limit - position) << elementSizeShift; |
| 104 | pointer = _env->CallStaticLongMethod(nioAccessClass, |
| 105 | getBasePointerID, buffer); |
| 106 | if (pointer != 0L) { |
| 107 | *array = NULL; |
| 108 | return (void *) (jint) pointer; |
| 109 | } |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 110 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 111 | *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, |
| 112 | getBaseArrayID, buffer); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 113 | *offset = _env->CallStaticIntMethod(nioAccessClass, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 114 | getBaseArrayOffsetID, buffer); |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 115 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 116 | return NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 117 | } |
| 118 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 119 | static void |
| 120 | releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) |
| 121 | { |
| 122 | _env->ReleasePrimitiveArrayCritical(array, data, |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 123 | commit ? 0 : JNI_ABORT); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 124 | } |
| 125 | |
Jack Palevich | be6eac8 | 2009-12-08 15:43:51 +0800 | [diff] [blame] | 126 | static void * |
| 127 | getDirectBufferPointer(JNIEnv *_env, jobject buffer) { |
| 128 | char* buf = (char*) _env->GetDirectBufferAddress(buffer); |
| 129 | if (buf) { |
| 130 | jint position = _env->GetIntField(buffer, positionID); |
| 131 | jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); |
| 132 | buf += position << elementSizeShift; |
| 133 | } else { |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 134 | jniThrowException(_env, "java/lang/IllegalArgumentException", |
| 135 | "Must use a native order direct Buffer"); |
Jack Palevich | be6eac8 | 2009-12-08 15:43:51 +0800 | [diff] [blame] | 136 | } |
| 137 | return (void*) buf; |
| 138 | } |
| 139 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 140 | // -------------------------------------------------------------------------- |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 141 | |
| 142 | /* |
| 143 | * returns the number of values glGet returns for a given pname. |
| 144 | * |
| 145 | * The code below is written such that pnames requiring only one values |
| 146 | * are the default (and are not explicitely tested for). This makes the |
| 147 | * checking code much shorter/readable/efficient. |
| 148 | * |
| 149 | * This means that unknown pnames (e.g.: extensions) will default to 1. If |
| 150 | * that unknown pname needs more than 1 value, then the validation check |
| 151 | * is incomplete and the app may crash if it passed the wrong number params. |
| 152 | */ |
| 153 | static int getNeededCount(GLint pname) { |
| 154 | int needed = 1; |
| 155 | #ifdef GL_ES_VERSION_2_0 |
| 156 | // GLES 2.x pnames |
| 157 | switch (pname) { |
| 158 | case GL_ALIASED_LINE_WIDTH_RANGE: |
| 159 | case GL_ALIASED_POINT_SIZE_RANGE: |
| 160 | needed = 2; |
| 161 | break; |
| 162 | |
| 163 | case GL_BLEND_COLOR: |
| 164 | case GL_COLOR_CLEAR_VALUE: |
| 165 | case GL_COLOR_WRITEMASK: |
| 166 | case GL_SCISSOR_BOX: |
| 167 | case GL_VIEWPORT: |
| 168 | needed = 4; |
| 169 | break; |
| 170 | |
| 171 | case GL_COMPRESSED_TEXTURE_FORMATS: |
| 172 | glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed); |
| 173 | break; |
| 174 | |
| 175 | case GL_SHADER_BINARY_FORMATS: |
| 176 | glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed); |
| 177 | break; |
| 178 | } |
| 179 | #endif |
| 180 | |
| 181 | #ifdef GL_VERSION_ES_CM_1_1 |
| 182 | // GLES 1.x pnames |
| 183 | switch (pname) { |
| 184 | case GL_ALIASED_LINE_WIDTH_RANGE: |
| 185 | case GL_ALIASED_POINT_SIZE_RANGE: |
| 186 | case GL_DEPTH_RANGE: |
| 187 | case GL_SMOOTH_LINE_WIDTH_RANGE: |
| 188 | case GL_SMOOTH_POINT_SIZE_RANGE: |
| 189 | needed = 2; |
| 190 | break; |
| 191 | |
| 192 | case GL_CURRENT_NORMAL: |
| 193 | case GL_POINT_DISTANCE_ATTENUATION: |
| 194 | needed = 3; |
| 195 | break; |
| 196 | |
| 197 | case GL_COLOR_CLEAR_VALUE: |
| 198 | case GL_COLOR_WRITEMASK: |
| 199 | case GL_CURRENT_COLOR: |
| 200 | case GL_CURRENT_TEXTURE_COORDS: |
| 201 | case GL_FOG_COLOR: |
| 202 | case GL_LIGHT_MODEL_AMBIENT: |
| 203 | case GL_SCISSOR_BOX: |
| 204 | case GL_VIEWPORT: |
| 205 | needed = 4; |
| 206 | break; |
| 207 | |
| 208 | case GL_MODELVIEW_MATRIX: |
| 209 | case GL_PROJECTION_MATRIX: |
| 210 | case GL_TEXTURE_MATRIX: |
| 211 | needed = 16; |
| 212 | break; |
| 213 | |
| 214 | case GL_COMPRESSED_TEXTURE_FORMATS: |
| 215 | glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed); |
| 216 | break; |
| 217 | } |
| 218 | #endif |
| 219 | return needed; |
| 220 | } |
| 221 | |
| 222 | template <typename JTYPEARRAY, typename CTYPE, void GET(GLenum, CTYPE*)> |
| 223 | static void |
| 224 | get |
| 225 | (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) { |
| 226 | jint _exception = 0; |
| 227 | const char * _exceptionType; |
| 228 | const char * _exceptionMessage; |
| 229 | CTYPE *params_base = (CTYPE *) 0; |
| 230 | jint _remaining; |
| 231 | CTYPE *params = (CTYPE *) 0; |
| 232 | int _needed = 0; |
| 233 | |
| 234 | if (!params_ref) { |
| 235 | _exception = 1; |
| 236 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 237 | _exceptionMessage = "params == null"; |
| 238 | goto exit; |
| 239 | } |
| 240 | if (offset < 0) { |
| 241 | _exception = 1; |
| 242 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 243 | _exceptionMessage = "offset < 0"; |
| 244 | goto exit; |
| 245 | } |
| 246 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 247 | _needed = getNeededCount(pname); |
| 248 | // if we didn't find this pname, we just assume the user passed |
| 249 | // an array of the right size -- this might happen with extensions |
| 250 | // or if we forget an enum here. |
| 251 | if (_remaining < _needed) { |
| 252 | _exception = 1; |
| 253 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 254 | _exceptionMessage = "length - offset < needed"; |
| 255 | goto exit; |
| 256 | } |
| 257 | params_base = (CTYPE *) |
| 258 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 259 | params = params_base + offset; |
| 260 | |
| 261 | GET( |
| 262 | (GLenum)pname, |
| 263 | (CTYPE *)params |
| 264 | ); |
| 265 | |
| 266 | exit: |
| 267 | if (params_base) { |
| 268 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 269 | _exception ? JNI_ABORT: 0); |
| 270 | } |
| 271 | if (_exception) { |
| 272 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | |
| 277 | template <typename CTYPE, void GET(GLenum, CTYPE*)> |
| 278 | static void |
| 279 | getarray |
| 280 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
| 281 | jint _exception = 0; |
| 282 | const char * _exceptionType; |
| 283 | const char * _exceptionMessage; |
| 284 | jarray _array = (jarray) 0; |
| 285 | jint _bufferOffset = (jint) 0; |
| 286 | jint _remaining; |
| 287 | CTYPE *params = (CTYPE *) 0; |
| 288 | int _needed = 0; |
| 289 | |
| 290 | params = (CTYPE *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
| 291 | _needed = getNeededCount(pname); |
| 292 | // if we didn't find this pname, we just assume the user passed |
| 293 | // an array of the right size -- this might happen with extensions |
| 294 | // or if we forget an enum here. |
| 295 | if (_needed>0 && _remaining < _needed) { |
| 296 | _exception = 1; |
| 297 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 298 | _exceptionMessage = "remaining() < needed"; |
| 299 | goto exit; |
| 300 | } |
| 301 | if (params == NULL) { |
| 302 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 303 | params = (CTYPE *) (_paramsBase + _bufferOffset); |
| 304 | } |
| 305 | GET( |
| 306 | (GLenum)pname, |
| 307 | (CTYPE *)params |
| 308 | ); |
| 309 | |
| 310 | exit: |
| 311 | if (_array) { |
| 312 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 313 | } |
| 314 | if (_exception) { |
| 315 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 316 | } |
| 317 | } |
| 318 | |
| 319 | // -------------------------------------------------------------------------- |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 320 | /* void glBindBuffer ( GLenum target, GLuint buffer ) */ |
| 321 | static void |
| 322 | android_glBindBuffer__II |
| 323 | (JNIEnv *_env, jobject _this, jint target, jint buffer) { |
| 324 | glBindBuffer( |
| 325 | (GLenum)target, |
| 326 | (GLuint)buffer |
| 327 | ); |
| 328 | } |
| 329 | |
| 330 | /* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */ |
| 331 | static void |
| 332 | android_glBufferData__IILjava_nio_Buffer_2I |
| 333 | (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] | 334 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 335 | const char * _exceptionType = NULL; |
| 336 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 337 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 338 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 339 | jint _remaining; |
| 340 | GLvoid *data = (GLvoid *) 0; |
| 341 | |
| 342 | if (data_buf) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 343 | data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | c620a52 | 2009-10-21 11:02:44 -0700 | [diff] [blame] | 344 | if (_remaining < size) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 345 | _exception = 1; |
| 346 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 347 | _exceptionMessage = "remaining() < size < needed"; |
Jack Palevich | c620a52 | 2009-10-21 11:02:44 -0700 | [diff] [blame] | 348 | goto exit; |
| 349 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 350 | } |
Thomas Tafertshofer | 37c9b49 | 2012-07-23 16:56:04 -0700 | [diff] [blame] | 351 | if (data_buf && data == NULL) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 352 | char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 353 | data = (GLvoid *) (_dataBase + _bufferOffset); |
| 354 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 355 | glBufferData( |
| 356 | (GLenum)target, |
| 357 | (GLsizeiptr)size, |
| 358 | (GLvoid *)data, |
| 359 | (GLenum)usage |
| 360 | ); |
Jack Palevich | c620a52 | 2009-10-21 11:02:44 -0700 | [diff] [blame] | 361 | |
| 362 | exit: |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 363 | if (_array) { |
| 364 | releasePointer(_env, _array, data, JNI_FALSE); |
| 365 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 366 | if (_exception) { |
| 367 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 368 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 369 | } |
| 370 | |
| 371 | /* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */ |
| 372 | static void |
| 373 | android_glBufferSubData__IIILjava_nio_Buffer_2 |
| 374 | (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] | 375 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 376 | const char * _exceptionType = NULL; |
| 377 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 378 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 379 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 380 | jint _remaining; |
| 381 | GLvoid *data = (GLvoid *) 0; |
| 382 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 383 | data = (GLvoid *)getPointer(_env, data_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | c620a52 | 2009-10-21 11:02:44 -0700 | [diff] [blame] | 384 | if (_remaining < size) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 385 | _exception = 1; |
| 386 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 387 | _exceptionMessage = "remaining() < size < needed"; |
Jack Palevich | c620a52 | 2009-10-21 11:02:44 -0700 | [diff] [blame] | 388 | goto exit; |
| 389 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 390 | if (data == NULL) { |
| 391 | char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 392 | data = (GLvoid *) (_dataBase + _bufferOffset); |
| 393 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 394 | glBufferSubData( |
| 395 | (GLenum)target, |
| 396 | (GLintptr)offset, |
| 397 | (GLsizeiptr)size, |
| 398 | (GLvoid *)data |
| 399 | ); |
Jack Palevich | c620a52 | 2009-10-21 11:02:44 -0700 | [diff] [blame] | 400 | |
| 401 | exit: |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 402 | if (_array) { |
| 403 | releasePointer(_env, _array, data, JNI_FALSE); |
| 404 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 405 | if (_exception) { |
| 406 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 407 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 408 | } |
| 409 | |
| 410 | /* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */ |
| 411 | static void |
| 412 | android_glClipPlanef__I_3FI |
| 413 | (JNIEnv *_env, jobject _this, jint plane, jfloatArray equation_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 414 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 415 | const char * _exceptionType = NULL; |
| 416 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 417 | GLfloat *equation_base = (GLfloat *) 0; |
| 418 | jint _remaining; |
| 419 | GLfloat *equation = (GLfloat *) 0; |
| 420 | |
| 421 | if (!equation_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 422 | _exception = 1; |
| 423 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 424 | _exceptionMessage = "equation == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 425 | goto exit; |
| 426 | } |
| 427 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 428 | _exception = 1; |
| 429 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 430 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 431 | goto exit; |
| 432 | } |
| 433 | _remaining = _env->GetArrayLength(equation_ref) - offset; |
| 434 | equation_base = (GLfloat *) |
| 435 | _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0); |
| 436 | equation = equation_base + offset; |
| 437 | |
| 438 | glClipPlanef( |
| 439 | (GLenum)plane, |
| 440 | (GLfloat *)equation |
| 441 | ); |
| 442 | |
| 443 | exit: |
| 444 | if (equation_base) { |
| 445 | _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base, |
| 446 | JNI_ABORT); |
| 447 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 448 | if (_exception) { |
| 449 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 450 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 451 | } |
| 452 | |
| 453 | /* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */ |
| 454 | static void |
| 455 | android_glClipPlanef__ILjava_nio_FloatBuffer_2 |
| 456 | (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 457 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 458 | const char * _exceptionType = NULL; |
| 459 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 460 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 461 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 462 | jint _remaining; |
| 463 | GLfloat *equation = (GLfloat *) 0; |
| 464 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 465 | equation = (GLfloat *)getPointer(_env, equation_buf, &_array, &_remaining, &_bufferOffset); |
| 466 | if (equation == NULL) { |
| 467 | char * _equationBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 468 | equation = (GLfloat *) (_equationBase + _bufferOffset); |
| 469 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 470 | glClipPlanef( |
| 471 | (GLenum)plane, |
| 472 | (GLfloat *)equation |
| 473 | ); |
| 474 | if (_array) { |
| 475 | releasePointer(_env, _array, equation, JNI_FALSE); |
| 476 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 477 | if (_exception) { |
| 478 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 479 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 480 | } |
| 481 | |
| 482 | /* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */ |
| 483 | static void |
| 484 | android_glClipPlanex__I_3II |
| 485 | (JNIEnv *_env, jobject _this, jint plane, jintArray equation_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 486 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 487 | const char * _exceptionType = NULL; |
| 488 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 489 | GLfixed *equation_base = (GLfixed *) 0; |
| 490 | jint _remaining; |
| 491 | GLfixed *equation = (GLfixed *) 0; |
| 492 | |
| 493 | if (!equation_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 494 | _exception = 1; |
| 495 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 496 | _exceptionMessage = "equation == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 497 | goto exit; |
| 498 | } |
| 499 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 500 | _exception = 1; |
| 501 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 502 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 503 | goto exit; |
| 504 | } |
| 505 | _remaining = _env->GetArrayLength(equation_ref) - offset; |
| 506 | equation_base = (GLfixed *) |
| 507 | _env->GetPrimitiveArrayCritical(equation_ref, (jboolean *)0); |
| 508 | equation = equation_base + offset; |
| 509 | |
| 510 | glClipPlanex( |
| 511 | (GLenum)plane, |
| 512 | (GLfixed *)equation |
| 513 | ); |
| 514 | |
| 515 | exit: |
| 516 | if (equation_base) { |
| 517 | _env->ReleasePrimitiveArrayCritical(equation_ref, equation_base, |
| 518 | JNI_ABORT); |
| 519 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 520 | if (_exception) { |
| 521 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 522 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 523 | } |
| 524 | |
| 525 | /* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */ |
| 526 | static void |
| 527 | android_glClipPlanex__ILjava_nio_IntBuffer_2 |
| 528 | (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 529 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 530 | const char * _exceptionType = NULL; |
| 531 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 532 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 533 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 534 | jint _remaining; |
| 535 | GLfixed *equation = (GLfixed *) 0; |
| 536 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 537 | equation = (GLfixed *)getPointer(_env, equation_buf, &_array, &_remaining, &_bufferOffset); |
| 538 | if (equation == NULL) { |
| 539 | char * _equationBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 540 | equation = (GLfixed *) (_equationBase + _bufferOffset); |
| 541 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 542 | glClipPlanex( |
| 543 | (GLenum)plane, |
| 544 | (GLfixed *)equation |
| 545 | ); |
| 546 | if (_array) { |
| 547 | releasePointer(_env, _array, equation, JNI_FALSE); |
| 548 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 549 | if (_exception) { |
| 550 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 551 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 552 | } |
| 553 | |
| 554 | /* void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) */ |
| 555 | static void |
| 556 | android_glColor4ub__BBBB |
| 557 | (JNIEnv *_env, jobject _this, jbyte red, jbyte green, jbyte blue, jbyte alpha) { |
| 558 | glColor4ub( |
| 559 | (GLubyte)red, |
| 560 | (GLubyte)green, |
| 561 | (GLubyte)blue, |
| 562 | (GLubyte)alpha |
| 563 | ); |
| 564 | } |
| 565 | |
| 566 | /* void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */ |
| 567 | static void |
| 568 | android_glColorPointer__IIII |
| 569 | (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) { |
| 570 | glColorPointer( |
| 571 | (GLint)size, |
| 572 | (GLenum)type, |
| 573 | (GLsizei)stride, |
| 574 | (const GLvoid *)offset |
| 575 | ); |
| 576 | } |
| 577 | |
| 578 | /* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */ |
| 579 | static void |
| 580 | android_glDeleteBuffers__I_3II |
| 581 | (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 582 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 583 | const char * _exceptionType = NULL; |
| 584 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 585 | GLuint *buffers_base = (GLuint *) 0; |
| 586 | jint _remaining; |
| 587 | GLuint *buffers = (GLuint *) 0; |
| 588 | |
| 589 | if (!buffers_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 590 | _exception = 1; |
| 591 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 592 | _exceptionMessage = "buffers == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 593 | goto exit; |
| 594 | } |
| 595 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 596 | _exception = 1; |
| 597 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 598 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 599 | goto exit; |
| 600 | } |
| 601 | _remaining = _env->GetArrayLength(buffers_ref) - offset; |
| 602 | if (_remaining < n) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 603 | _exception = 1; |
| 604 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 605 | _exceptionMessage = "length - offset < n < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 606 | goto exit; |
| 607 | } |
| 608 | buffers_base = (GLuint *) |
| 609 | _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0); |
| 610 | buffers = buffers_base + offset; |
| 611 | |
| 612 | glDeleteBuffers( |
| 613 | (GLsizei)n, |
| 614 | (GLuint *)buffers |
| 615 | ); |
| 616 | |
| 617 | exit: |
| 618 | if (buffers_base) { |
| 619 | _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base, |
| 620 | JNI_ABORT); |
| 621 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 622 | if (_exception) { |
| 623 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 624 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 625 | } |
| 626 | |
| 627 | /* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */ |
| 628 | static void |
| 629 | android_glDeleteBuffers__ILjava_nio_IntBuffer_2 |
| 630 | (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 631 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 632 | const char * _exceptionType = NULL; |
| 633 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 634 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 635 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 636 | jint _remaining; |
| 637 | GLuint *buffers = (GLuint *) 0; |
| 638 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 639 | buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 640 | if (_remaining < n) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 641 | _exception = 1; |
| 642 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 643 | _exceptionMessage = "remaining() < n < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 644 | goto exit; |
| 645 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 646 | if (buffers == NULL) { |
| 647 | char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 648 | buffers = (GLuint *) (_buffersBase + _bufferOffset); |
| 649 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 650 | glDeleteBuffers( |
| 651 | (GLsizei)n, |
| 652 | (GLuint *)buffers |
| 653 | ); |
| 654 | |
| 655 | exit: |
| 656 | if (_array) { |
| 657 | releasePointer(_env, _array, buffers, JNI_FALSE); |
| 658 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 659 | if (_exception) { |
| 660 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 661 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 662 | } |
| 663 | |
| 664 | /* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */ |
| 665 | static void |
| 666 | android_glDrawElements__IIII |
| 667 | (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 668 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 669 | const char * _exceptionType = NULL; |
| 670 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 671 | glDrawElements( |
| 672 | (GLenum)mode, |
| 673 | (GLsizei)count, |
| 674 | (GLenum)type, |
| 675 | (const GLvoid *)offset |
| 676 | ); |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 677 | if (_exception) { |
| 678 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 679 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 680 | } |
| 681 | |
| 682 | /* void glGenBuffers ( GLsizei n, GLuint *buffers ) */ |
| 683 | static void |
| 684 | android_glGenBuffers__I_3II |
| 685 | (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) { |
| 686 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 687 | const char * _exceptionType = NULL; |
| 688 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 689 | GLuint *buffers_base = (GLuint *) 0; |
| 690 | jint _remaining; |
| 691 | GLuint *buffers = (GLuint *) 0; |
| 692 | |
| 693 | if (!buffers_ref) { |
| 694 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 695 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 696 | _exceptionMessage = "buffers == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 697 | goto exit; |
| 698 | } |
| 699 | if (offset < 0) { |
| 700 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 701 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 702 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 703 | goto exit; |
| 704 | } |
| 705 | _remaining = _env->GetArrayLength(buffers_ref) - offset; |
| 706 | if (_remaining < n) { |
| 707 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 708 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 709 | _exceptionMessage = "length - offset < n < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 710 | goto exit; |
| 711 | } |
| 712 | buffers_base = (GLuint *) |
| 713 | _env->GetPrimitiveArrayCritical(buffers_ref, (jboolean *)0); |
| 714 | buffers = buffers_base + offset; |
| 715 | |
| 716 | glGenBuffers( |
| 717 | (GLsizei)n, |
| 718 | (GLuint *)buffers |
| 719 | ); |
| 720 | |
| 721 | exit: |
| 722 | if (buffers_base) { |
| 723 | _env->ReleasePrimitiveArrayCritical(buffers_ref, buffers_base, |
| 724 | _exception ? JNI_ABORT: 0); |
| 725 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 726 | if (_exception) { |
| 727 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 728 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 729 | } |
| 730 | |
| 731 | /* void glGenBuffers ( GLsizei n, GLuint *buffers ) */ |
| 732 | static void |
| 733 | android_glGenBuffers__ILjava_nio_IntBuffer_2 |
| 734 | (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) { |
| 735 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 736 | const char * _exceptionType = NULL; |
| 737 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 738 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 739 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 740 | jint _remaining; |
| 741 | GLuint *buffers = (GLuint *) 0; |
| 742 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 743 | buffers = (GLuint *)getPointer(_env, buffers_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 744 | if (_remaining < n) { |
| 745 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 746 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 747 | _exceptionMessage = "remaining() < n < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 748 | goto exit; |
| 749 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 750 | if (buffers == NULL) { |
| 751 | char * _buffersBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 752 | buffers = (GLuint *) (_buffersBase + _bufferOffset); |
| 753 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 754 | glGenBuffers( |
| 755 | (GLsizei)n, |
| 756 | (GLuint *)buffers |
| 757 | ); |
| 758 | |
| 759 | exit: |
| 760 | if (_array) { |
| 761 | releasePointer(_env, _array, buffers, _exception ? JNI_FALSE : JNI_TRUE); |
| 762 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 763 | if (_exception) { |
| 764 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 765 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 766 | } |
| 767 | |
| 768 | /* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ |
| 769 | static void |
| 770 | android_glGetBooleanv__I_3ZI |
| 771 | (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 772 | get<jbooleanArray, GLboolean, glGetBooleanv>(_env, _this, pname, params_ref, offset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 773 | } |
| 774 | |
| 775 | /* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ |
| 776 | static void |
| 777 | android_glGetBooleanv__ILjava_nio_IntBuffer_2 |
| 778 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 779 | getarray<GLboolean, glGetBooleanv>(_env, _this, pname, params_buf); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 780 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 781 | /* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 782 | static void |
| 783 | android_glGetBufferParameteriv__II_3II |
| 784 | (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] | 785 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 786 | const char * _exceptionType = NULL; |
| 787 | const char * _exceptionMessage = NULL; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 788 | GLint *params_base = (GLint *) 0; |
| 789 | jint _remaining; |
| 790 | GLint *params = (GLint *) 0; |
| 791 | |
| 792 | if (!params_ref) { |
| 793 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 794 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 795 | _exceptionMessage = "params == null"; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 796 | goto exit; |
| 797 | } |
| 798 | if (offset < 0) { |
| 799 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 800 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 801 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 802 | goto exit; |
| 803 | } |
| 804 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 805 | if (_remaining < 1) { |
| 806 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 807 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 808 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 809 | goto exit; |
| 810 | } |
| 811 | params_base = (GLint *) |
| 812 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 813 | params = params_base + offset; |
| 814 | |
| 815 | glGetBufferParameteriv( |
| 816 | (GLenum)target, |
| 817 | (GLenum)pname, |
| 818 | (GLint *)params |
| 819 | ); |
| 820 | |
| 821 | exit: |
| 822 | if (params_base) { |
| 823 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 824 | _exception ? JNI_ABORT: 0); |
| 825 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 826 | if (_exception) { |
| 827 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 828 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 829 | } |
| 830 | |
| 831 | /* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 832 | static void |
| 833 | android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 |
| 834 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 835 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 836 | const char * _exceptionType = NULL; |
| 837 | const char * _exceptionMessage = NULL; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 838 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 839 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 840 | jint _remaining; |
| 841 | GLint *params = (GLint *) 0; |
| 842 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 843 | params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 844 | if (_remaining < 1) { |
| 845 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 846 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 847 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 848 | goto exit; |
| 849 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 850 | if (params == NULL) { |
| 851 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 852 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 853 | } |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 854 | glGetBufferParameteriv( |
| 855 | (GLenum)target, |
| 856 | (GLenum)pname, |
| 857 | (GLint *)params |
| 858 | ); |
| 859 | |
| 860 | exit: |
| 861 | if (_array) { |
| 862 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 863 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 864 | if (_exception) { |
| 865 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 866 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 867 | } |
| 868 | |
| 869 | /* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */ |
| 870 | static void |
| 871 | android_glGetClipPlanef__I_3FI |
| 872 | (JNIEnv *_env, jobject _this, jint pname, jfloatArray eqn_ref, jint offset) { |
| 873 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 874 | const char * _exceptionType = NULL; |
| 875 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 876 | GLfloat *eqn_base = (GLfloat *) 0; |
| 877 | jint _remaining; |
| 878 | GLfloat *eqn = (GLfloat *) 0; |
| 879 | |
| 880 | if (!eqn_ref) { |
| 881 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 882 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 883 | _exceptionMessage = "eqn == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 884 | goto exit; |
| 885 | } |
| 886 | if (offset < 0) { |
| 887 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 888 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 889 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 890 | goto exit; |
| 891 | } |
| 892 | _remaining = _env->GetArrayLength(eqn_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 893 | if (_remaining < 4) { |
| 894 | _exception = 1; |
| 895 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 896 | _exceptionMessage = "length - offset < 4 < needed"; |
| 897 | goto exit; |
| 898 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 899 | eqn_base = (GLfloat *) |
| 900 | _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0); |
| 901 | eqn = eqn_base + offset; |
| 902 | |
| 903 | glGetClipPlanef( |
| 904 | (GLenum)pname, |
| 905 | (GLfloat *)eqn |
| 906 | ); |
| 907 | |
| 908 | exit: |
| 909 | if (eqn_base) { |
| 910 | _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base, |
| 911 | _exception ? JNI_ABORT: 0); |
| 912 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 913 | if (_exception) { |
| 914 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 915 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 916 | } |
| 917 | |
| 918 | /* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */ |
| 919 | static void |
| 920 | android_glGetClipPlanef__ILjava_nio_FloatBuffer_2 |
| 921 | (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 922 | jint _exception = 0; |
| 923 | const char * _exceptionType = NULL; |
| 924 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 925 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 926 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 927 | jint _remaining; |
| 928 | GLfloat *eqn = (GLfloat *) 0; |
| 929 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 930 | eqn = (GLfloat *)getPointer(_env, eqn_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 931 | if (_remaining < 4) { |
| 932 | _exception = 1; |
| 933 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 934 | _exceptionMessage = "remaining() < 4 < needed"; |
| 935 | goto exit; |
| 936 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 937 | if (eqn == NULL) { |
| 938 | char * _eqnBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 939 | eqn = (GLfloat *) (_eqnBase + _bufferOffset); |
| 940 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 941 | glGetClipPlanef( |
| 942 | (GLenum)pname, |
| 943 | (GLfloat *)eqn |
| 944 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 945 | |
| 946 | exit: |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 947 | if (_array) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 948 | releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE); |
| 949 | } |
| 950 | if (_exception) { |
| 951 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 952 | } |
| 953 | } |
| 954 | |
| 955 | /* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */ |
| 956 | static void |
| 957 | android_glGetClipPlanex__I_3II |
| 958 | (JNIEnv *_env, jobject _this, jint pname, jintArray eqn_ref, jint offset) { |
| 959 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 960 | const char * _exceptionType = NULL; |
| 961 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 962 | GLfixed *eqn_base = (GLfixed *) 0; |
| 963 | jint _remaining; |
| 964 | GLfixed *eqn = (GLfixed *) 0; |
| 965 | |
| 966 | if (!eqn_ref) { |
| 967 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 968 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 969 | _exceptionMessage = "eqn == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 970 | goto exit; |
| 971 | } |
| 972 | if (offset < 0) { |
| 973 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 974 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 975 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 976 | goto exit; |
| 977 | } |
| 978 | _remaining = _env->GetArrayLength(eqn_ref) - offset; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 979 | if (_remaining < 4) { |
| 980 | _exception = 1; |
| 981 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 982 | _exceptionMessage = "length - offset < 4 < needed"; |
| 983 | goto exit; |
| 984 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 985 | eqn_base = (GLfixed *) |
| 986 | _env->GetPrimitiveArrayCritical(eqn_ref, (jboolean *)0); |
| 987 | eqn = eqn_base + offset; |
| 988 | |
| 989 | glGetClipPlanex( |
| 990 | (GLenum)pname, |
| 991 | (GLfixed *)eqn |
| 992 | ); |
| 993 | |
| 994 | exit: |
| 995 | if (eqn_base) { |
| 996 | _env->ReleasePrimitiveArrayCritical(eqn_ref, eqn_base, |
| 997 | _exception ? JNI_ABORT: 0); |
| 998 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 999 | if (_exception) { |
| 1000 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1001 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1002 | } |
| 1003 | |
| 1004 | /* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */ |
| 1005 | static void |
| 1006 | android_glGetClipPlanex__ILjava_nio_IntBuffer_2 |
| 1007 | (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1008 | jint _exception = 0; |
| 1009 | const char * _exceptionType = NULL; |
| 1010 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1011 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1012 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1013 | jint _remaining; |
| 1014 | GLfixed *eqn = (GLfixed *) 0; |
| 1015 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1016 | eqn = (GLfixed *)getPointer(_env, eqn_buf, &_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1017 | if (_remaining < 4) { |
| 1018 | _exception = 1; |
| 1019 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1020 | _exceptionMessage = "remaining() < 4 < needed"; |
| 1021 | goto exit; |
| 1022 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1023 | if (eqn == NULL) { |
| 1024 | char * _eqnBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1025 | eqn = (GLfixed *) (_eqnBase + _bufferOffset); |
| 1026 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1027 | glGetClipPlanex( |
| 1028 | (GLenum)pname, |
| 1029 | (GLfixed *)eqn |
| 1030 | ); |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1031 | |
| 1032 | exit: |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1033 | if (_array) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1034 | releasePointer(_env, _array, eqn, _exception ? JNI_FALSE : JNI_TRUE); |
| 1035 | } |
| 1036 | if (_exception) { |
| 1037 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1038 | } |
| 1039 | } |
| 1040 | |
| 1041 | /* void glGetFixedv ( GLenum pname, GLfixed *params ) */ |
| 1042 | static void |
| 1043 | android_glGetFixedv__I_3II |
| 1044 | (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { |
| 1045 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1046 | const char * _exceptionType = NULL; |
| 1047 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1048 | GLfixed *params_base = (GLfixed *) 0; |
| 1049 | jint _remaining; |
| 1050 | GLfixed *params = (GLfixed *) 0; |
| 1051 | |
| 1052 | if (!params_ref) { |
| 1053 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1054 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1055 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1056 | goto exit; |
| 1057 | } |
| 1058 | if (offset < 0) { |
| 1059 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1060 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1061 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1062 | goto exit; |
| 1063 | } |
| 1064 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 1065 | params_base = (GLfixed *) |
| 1066 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 1067 | params = params_base + offset; |
| 1068 | |
| 1069 | glGetFixedv( |
| 1070 | (GLenum)pname, |
| 1071 | (GLfixed *)params |
| 1072 | ); |
| 1073 | |
| 1074 | exit: |
| 1075 | if (params_base) { |
| 1076 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 1077 | _exception ? JNI_ABORT: 0); |
| 1078 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1079 | if (_exception) { |
| 1080 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1081 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1082 | } |
| 1083 | |
| 1084 | /* void glGetFixedv ( GLenum pname, GLfixed *params ) */ |
| 1085 | static void |
| 1086 | android_glGetFixedv__ILjava_nio_IntBuffer_2 |
| 1087 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1088 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1089 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1090 | jint _remaining; |
| 1091 | GLfixed *params = (GLfixed *) 0; |
| 1092 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1093 | params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
| 1094 | if (params == NULL) { |
| 1095 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1096 | params = (GLfixed *) (_paramsBase + _bufferOffset); |
| 1097 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1098 | glGetFixedv( |
| 1099 | (GLenum)pname, |
| 1100 | (GLfixed *)params |
| 1101 | ); |
| 1102 | if (_array) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1103 | releasePointer(_env, _array, params, JNI_TRUE); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1104 | } |
| 1105 | } |
| 1106 | |
| 1107 | /* void glGetFloatv ( GLenum pname, GLfloat *params ) */ |
| 1108 | static void |
| 1109 | android_glGetFloatv__I_3FI |
| 1110 | (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1111 | get<jfloatArray, GLfloat, glGetFloatv>(_env, _this, pname, params_ref, offset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1112 | } |
| 1113 | |
| 1114 | /* void glGetFloatv ( GLenum pname, GLfloat *params ) */ |
| 1115 | static void |
| 1116 | android_glGetFloatv__ILjava_nio_FloatBuffer_2 |
| 1117 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1118 | getarray<GLfloat, glGetFloatv>(_env, _this, pname, params_buf); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1119 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1120 | /* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */ |
| 1121 | static void |
| 1122 | android_glGetLightfv__II_3FI |
| 1123 | (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) { |
| 1124 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1125 | const char * _exceptionType = NULL; |
| 1126 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1127 | GLfloat *params_base = (GLfloat *) 0; |
| 1128 | jint _remaining; |
| 1129 | GLfloat *params = (GLfloat *) 0; |
| 1130 | |
| 1131 | if (!params_ref) { |
| 1132 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1133 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1134 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1135 | goto exit; |
| 1136 | } |
| 1137 | if (offset < 0) { |
| 1138 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1139 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1140 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1141 | goto exit; |
| 1142 | } |
| 1143 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 1144 | int _needed; |
| 1145 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1146 | #if defined(GL_SPOT_DIRECTION) |
| 1147 | case GL_SPOT_DIRECTION: |
| 1148 | #endif // defined(GL_SPOT_DIRECTION) |
| 1149 | _needed = 3; |
| 1150 | break; |
| 1151 | #if defined(GL_AMBIENT) |
| 1152 | case GL_AMBIENT: |
| 1153 | #endif // defined(GL_AMBIENT) |
| 1154 | #if defined(GL_DIFFUSE) |
| 1155 | case GL_DIFFUSE: |
| 1156 | #endif // defined(GL_DIFFUSE) |
| 1157 | #if defined(GL_SPECULAR) |
| 1158 | case GL_SPECULAR: |
| 1159 | #endif // defined(GL_SPECULAR) |
| 1160 | #if defined(GL_EMISSION) |
| 1161 | case GL_EMISSION: |
| 1162 | #endif // defined(GL_EMISSION) |
| 1163 | _needed = 4; |
| 1164 | break; |
| 1165 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1166 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1167 | break; |
| 1168 | } |
| 1169 | if (_remaining < _needed) { |
| 1170 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1171 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1172 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1173 | goto exit; |
| 1174 | } |
| 1175 | params_base = (GLfloat *) |
| 1176 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 1177 | params = params_base + offset; |
| 1178 | |
| 1179 | glGetLightfv( |
| 1180 | (GLenum)light, |
| 1181 | (GLenum)pname, |
| 1182 | (GLfloat *)params |
| 1183 | ); |
| 1184 | |
| 1185 | exit: |
| 1186 | if (params_base) { |
| 1187 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 1188 | _exception ? JNI_ABORT: 0); |
| 1189 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1190 | if (_exception) { |
| 1191 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1192 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1193 | } |
| 1194 | |
| 1195 | /* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */ |
| 1196 | static void |
| 1197 | android_glGetLightfv__IILjava_nio_FloatBuffer_2 |
| 1198 | (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { |
| 1199 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1200 | const char * _exceptionType = NULL; |
| 1201 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1202 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1203 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1204 | jint _remaining; |
| 1205 | GLfloat *params = (GLfloat *) 0; |
| 1206 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1207 | params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1208 | int _needed; |
| 1209 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1210 | #if defined(GL_SPOT_DIRECTION) |
| 1211 | case GL_SPOT_DIRECTION: |
| 1212 | #endif // defined(GL_SPOT_DIRECTION) |
| 1213 | _needed = 3; |
| 1214 | break; |
| 1215 | #if defined(GL_AMBIENT) |
| 1216 | case GL_AMBIENT: |
| 1217 | #endif // defined(GL_AMBIENT) |
| 1218 | #if defined(GL_DIFFUSE) |
| 1219 | case GL_DIFFUSE: |
| 1220 | #endif // defined(GL_DIFFUSE) |
| 1221 | #if defined(GL_SPECULAR) |
| 1222 | case GL_SPECULAR: |
| 1223 | #endif // defined(GL_SPECULAR) |
| 1224 | #if defined(GL_EMISSION) |
| 1225 | case GL_EMISSION: |
| 1226 | #endif // defined(GL_EMISSION) |
| 1227 | _needed = 4; |
| 1228 | break; |
| 1229 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1230 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1231 | break; |
| 1232 | } |
| 1233 | if (_remaining < _needed) { |
| 1234 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1235 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1236 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1237 | goto exit; |
| 1238 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1239 | if (params == NULL) { |
| 1240 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1241 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 1242 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1243 | glGetLightfv( |
| 1244 | (GLenum)light, |
| 1245 | (GLenum)pname, |
| 1246 | (GLfloat *)params |
| 1247 | ); |
| 1248 | |
| 1249 | exit: |
| 1250 | if (_array) { |
| 1251 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 1252 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1253 | if (_exception) { |
| 1254 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1255 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1256 | } |
| 1257 | |
| 1258 | /* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */ |
| 1259 | static void |
| 1260 | android_glGetLightxv__II_3II |
| 1261 | (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) { |
| 1262 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1263 | const char * _exceptionType = NULL; |
| 1264 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1265 | GLfixed *params_base = (GLfixed *) 0; |
| 1266 | jint _remaining; |
| 1267 | GLfixed *params = (GLfixed *) 0; |
| 1268 | |
| 1269 | if (!params_ref) { |
| 1270 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1271 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1272 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1273 | goto exit; |
| 1274 | } |
| 1275 | if (offset < 0) { |
| 1276 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1277 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1278 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1279 | goto exit; |
| 1280 | } |
| 1281 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 1282 | int _needed; |
| 1283 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1284 | #if defined(GL_SPOT_DIRECTION) |
| 1285 | case GL_SPOT_DIRECTION: |
| 1286 | #endif // defined(GL_SPOT_DIRECTION) |
| 1287 | _needed = 3; |
| 1288 | break; |
| 1289 | #if defined(GL_AMBIENT) |
| 1290 | case GL_AMBIENT: |
| 1291 | #endif // defined(GL_AMBIENT) |
| 1292 | #if defined(GL_DIFFUSE) |
| 1293 | case GL_DIFFUSE: |
| 1294 | #endif // defined(GL_DIFFUSE) |
| 1295 | #if defined(GL_SPECULAR) |
| 1296 | case GL_SPECULAR: |
| 1297 | #endif // defined(GL_SPECULAR) |
| 1298 | #if defined(GL_EMISSION) |
| 1299 | case GL_EMISSION: |
| 1300 | #endif // defined(GL_EMISSION) |
| 1301 | _needed = 4; |
| 1302 | break; |
| 1303 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1304 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1305 | break; |
| 1306 | } |
| 1307 | if (_remaining < _needed) { |
| 1308 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1309 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1310 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1311 | goto exit; |
| 1312 | } |
| 1313 | params_base = (GLfixed *) |
| 1314 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 1315 | params = params_base + offset; |
| 1316 | |
| 1317 | glGetLightxv( |
| 1318 | (GLenum)light, |
| 1319 | (GLenum)pname, |
| 1320 | (GLfixed *)params |
| 1321 | ); |
| 1322 | |
| 1323 | exit: |
| 1324 | if (params_base) { |
| 1325 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 1326 | _exception ? JNI_ABORT: 0); |
| 1327 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1328 | if (_exception) { |
| 1329 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1330 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1331 | } |
| 1332 | |
| 1333 | /* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */ |
| 1334 | static void |
| 1335 | android_glGetLightxv__IILjava_nio_IntBuffer_2 |
| 1336 | (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { |
| 1337 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1338 | const char * _exceptionType = NULL; |
| 1339 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1340 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1341 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1342 | jint _remaining; |
| 1343 | GLfixed *params = (GLfixed *) 0; |
| 1344 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1345 | params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1346 | int _needed; |
| 1347 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1348 | #if defined(GL_SPOT_DIRECTION) |
| 1349 | case GL_SPOT_DIRECTION: |
| 1350 | #endif // defined(GL_SPOT_DIRECTION) |
| 1351 | _needed = 3; |
| 1352 | break; |
| 1353 | #if defined(GL_AMBIENT) |
| 1354 | case GL_AMBIENT: |
| 1355 | #endif // defined(GL_AMBIENT) |
| 1356 | #if defined(GL_DIFFUSE) |
| 1357 | case GL_DIFFUSE: |
| 1358 | #endif // defined(GL_DIFFUSE) |
| 1359 | #if defined(GL_SPECULAR) |
| 1360 | case GL_SPECULAR: |
| 1361 | #endif // defined(GL_SPECULAR) |
| 1362 | #if defined(GL_EMISSION) |
| 1363 | case GL_EMISSION: |
| 1364 | #endif // defined(GL_EMISSION) |
| 1365 | _needed = 4; |
| 1366 | break; |
| 1367 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1368 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1369 | break; |
| 1370 | } |
| 1371 | if (_remaining < _needed) { |
| 1372 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1373 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1374 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1375 | goto exit; |
| 1376 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1377 | if (params == NULL) { |
| 1378 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1379 | params = (GLfixed *) (_paramsBase + _bufferOffset); |
| 1380 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1381 | glGetLightxv( |
| 1382 | (GLenum)light, |
| 1383 | (GLenum)pname, |
| 1384 | (GLfixed *)params |
| 1385 | ); |
| 1386 | |
| 1387 | exit: |
| 1388 | if (_array) { |
| 1389 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 1390 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1391 | if (_exception) { |
| 1392 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1393 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1394 | } |
| 1395 | |
| 1396 | /* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */ |
| 1397 | static void |
| 1398 | android_glGetMaterialfv__II_3FI |
| 1399 | (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) { |
| 1400 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1401 | const char * _exceptionType = NULL; |
| 1402 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1403 | GLfloat *params_base = (GLfloat *) 0; |
| 1404 | jint _remaining; |
| 1405 | GLfloat *params = (GLfloat *) 0; |
| 1406 | |
| 1407 | if (!params_ref) { |
| 1408 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1409 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1410 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1411 | goto exit; |
| 1412 | } |
| 1413 | if (offset < 0) { |
| 1414 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1415 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1416 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1417 | goto exit; |
| 1418 | } |
| 1419 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 1420 | int _needed; |
| 1421 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1422 | #if defined(GL_AMBIENT) |
| 1423 | case GL_AMBIENT: |
| 1424 | #endif // defined(GL_AMBIENT) |
| 1425 | #if defined(GL_DIFFUSE) |
| 1426 | case GL_DIFFUSE: |
| 1427 | #endif // defined(GL_DIFFUSE) |
| 1428 | #if defined(GL_SPECULAR) |
| 1429 | case GL_SPECULAR: |
| 1430 | #endif // defined(GL_SPECULAR) |
| 1431 | #if defined(GL_EMISSION) |
| 1432 | case GL_EMISSION: |
| 1433 | #endif // defined(GL_EMISSION) |
| 1434 | #if defined(GL_AMBIENT_AND_DIFFUSE) |
| 1435 | case GL_AMBIENT_AND_DIFFUSE: |
| 1436 | #endif // defined(GL_AMBIENT_AND_DIFFUSE) |
| 1437 | _needed = 4; |
| 1438 | break; |
| 1439 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1440 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1441 | break; |
| 1442 | } |
| 1443 | if (_remaining < _needed) { |
| 1444 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1445 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1446 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1447 | goto exit; |
| 1448 | } |
| 1449 | params_base = (GLfloat *) |
| 1450 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 1451 | params = params_base + offset; |
| 1452 | |
| 1453 | glGetMaterialfv( |
| 1454 | (GLenum)face, |
| 1455 | (GLenum)pname, |
| 1456 | (GLfloat *)params |
| 1457 | ); |
| 1458 | |
| 1459 | exit: |
| 1460 | if (params_base) { |
| 1461 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 1462 | _exception ? JNI_ABORT: 0); |
| 1463 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1464 | if (_exception) { |
| 1465 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1466 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1467 | } |
| 1468 | |
| 1469 | /* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */ |
| 1470 | static void |
| 1471 | android_glGetMaterialfv__IILjava_nio_FloatBuffer_2 |
| 1472 | (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { |
| 1473 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1474 | const char * _exceptionType = NULL; |
| 1475 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1476 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1477 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1478 | jint _remaining; |
| 1479 | GLfloat *params = (GLfloat *) 0; |
| 1480 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1481 | params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1482 | int _needed; |
| 1483 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1484 | #if defined(GL_AMBIENT) |
| 1485 | case GL_AMBIENT: |
| 1486 | #endif // defined(GL_AMBIENT) |
| 1487 | #if defined(GL_DIFFUSE) |
| 1488 | case GL_DIFFUSE: |
| 1489 | #endif // defined(GL_DIFFUSE) |
| 1490 | #if defined(GL_SPECULAR) |
| 1491 | case GL_SPECULAR: |
| 1492 | #endif // defined(GL_SPECULAR) |
| 1493 | #if defined(GL_EMISSION) |
| 1494 | case GL_EMISSION: |
| 1495 | #endif // defined(GL_EMISSION) |
| 1496 | #if defined(GL_AMBIENT_AND_DIFFUSE) |
| 1497 | case GL_AMBIENT_AND_DIFFUSE: |
| 1498 | #endif // defined(GL_AMBIENT_AND_DIFFUSE) |
| 1499 | _needed = 4; |
| 1500 | break; |
| 1501 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1502 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1503 | break; |
| 1504 | } |
| 1505 | if (_remaining < _needed) { |
| 1506 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1507 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1508 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1509 | goto exit; |
| 1510 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1511 | if (params == NULL) { |
| 1512 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1513 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 1514 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1515 | glGetMaterialfv( |
| 1516 | (GLenum)face, |
| 1517 | (GLenum)pname, |
| 1518 | (GLfloat *)params |
| 1519 | ); |
| 1520 | |
| 1521 | exit: |
| 1522 | if (_array) { |
| 1523 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 1524 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1525 | if (_exception) { |
| 1526 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1527 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1528 | } |
| 1529 | |
| 1530 | /* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */ |
| 1531 | static void |
| 1532 | android_glGetMaterialxv__II_3II |
| 1533 | (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) { |
| 1534 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1535 | const char * _exceptionType = NULL; |
| 1536 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1537 | GLfixed *params_base = (GLfixed *) 0; |
| 1538 | jint _remaining; |
| 1539 | GLfixed *params = (GLfixed *) 0; |
| 1540 | |
| 1541 | if (!params_ref) { |
| 1542 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1543 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1544 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1545 | goto exit; |
| 1546 | } |
| 1547 | if (offset < 0) { |
| 1548 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1549 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1550 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1551 | goto exit; |
| 1552 | } |
| 1553 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 1554 | int _needed; |
| 1555 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1556 | #if defined(GL_AMBIENT) |
| 1557 | case GL_AMBIENT: |
| 1558 | #endif // defined(GL_AMBIENT) |
| 1559 | #if defined(GL_DIFFUSE) |
| 1560 | case GL_DIFFUSE: |
| 1561 | #endif // defined(GL_DIFFUSE) |
| 1562 | #if defined(GL_SPECULAR) |
| 1563 | case GL_SPECULAR: |
| 1564 | #endif // defined(GL_SPECULAR) |
| 1565 | #if defined(GL_EMISSION) |
| 1566 | case GL_EMISSION: |
| 1567 | #endif // defined(GL_EMISSION) |
| 1568 | #if defined(GL_AMBIENT_AND_DIFFUSE) |
| 1569 | case GL_AMBIENT_AND_DIFFUSE: |
| 1570 | #endif // defined(GL_AMBIENT_AND_DIFFUSE) |
| 1571 | _needed = 4; |
| 1572 | break; |
| 1573 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1574 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1575 | break; |
| 1576 | } |
| 1577 | if (_remaining < _needed) { |
| 1578 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1579 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1580 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1581 | goto exit; |
| 1582 | } |
| 1583 | params_base = (GLfixed *) |
| 1584 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 1585 | params = params_base + offset; |
| 1586 | |
| 1587 | glGetMaterialxv( |
| 1588 | (GLenum)face, |
| 1589 | (GLenum)pname, |
| 1590 | (GLfixed *)params |
| 1591 | ); |
| 1592 | |
| 1593 | exit: |
| 1594 | if (params_base) { |
| 1595 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 1596 | _exception ? JNI_ABORT: 0); |
| 1597 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1598 | if (_exception) { |
| 1599 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1600 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1601 | } |
| 1602 | |
| 1603 | /* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */ |
| 1604 | static void |
| 1605 | android_glGetMaterialxv__IILjava_nio_IntBuffer_2 |
| 1606 | (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { |
| 1607 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1608 | const char * _exceptionType = NULL; |
| 1609 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1610 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1611 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1612 | jint _remaining; |
| 1613 | GLfixed *params = (GLfixed *) 0; |
| 1614 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1615 | params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1616 | int _needed; |
| 1617 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1618 | #if defined(GL_AMBIENT) |
| 1619 | case GL_AMBIENT: |
| 1620 | #endif // defined(GL_AMBIENT) |
| 1621 | #if defined(GL_DIFFUSE) |
| 1622 | case GL_DIFFUSE: |
| 1623 | #endif // defined(GL_DIFFUSE) |
| 1624 | #if defined(GL_SPECULAR) |
| 1625 | case GL_SPECULAR: |
| 1626 | #endif // defined(GL_SPECULAR) |
| 1627 | #if defined(GL_EMISSION) |
| 1628 | case GL_EMISSION: |
| 1629 | #endif // defined(GL_EMISSION) |
| 1630 | #if defined(GL_AMBIENT_AND_DIFFUSE) |
| 1631 | case GL_AMBIENT_AND_DIFFUSE: |
| 1632 | #endif // defined(GL_AMBIENT_AND_DIFFUSE) |
| 1633 | _needed = 4; |
| 1634 | break; |
| 1635 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1636 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1637 | break; |
| 1638 | } |
| 1639 | if (_remaining < _needed) { |
| 1640 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1641 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1642 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1643 | goto exit; |
| 1644 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1645 | if (params == NULL) { |
| 1646 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1647 | params = (GLfixed *) (_paramsBase + _bufferOffset); |
| 1648 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1649 | glGetMaterialxv( |
| 1650 | (GLenum)face, |
| 1651 | (GLenum)pname, |
| 1652 | (GLfixed *)params |
| 1653 | ); |
| 1654 | |
| 1655 | exit: |
| 1656 | if (_array) { |
| 1657 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 1658 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1659 | if (_exception) { |
| 1660 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1661 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1662 | } |
| 1663 | |
| 1664 | /* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */ |
| 1665 | static void |
| 1666 | android_glGetTexEnvfv__II_3FI |
| 1667 | (JNIEnv *_env, jobject _this, jint env, jint pname, jfloatArray params_ref, jint offset) { |
| 1668 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1669 | const char * _exceptionType = NULL; |
| 1670 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1671 | GLfloat *params_base = (GLfloat *) 0; |
| 1672 | jint _remaining; |
| 1673 | GLfloat *params = (GLfloat *) 0; |
| 1674 | |
| 1675 | if (!params_ref) { |
| 1676 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1677 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1678 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1679 | goto exit; |
| 1680 | } |
| 1681 | if (offset < 0) { |
| 1682 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1683 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1684 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1685 | goto exit; |
| 1686 | } |
| 1687 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 1688 | int _needed; |
| 1689 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1690 | #if defined(GL_TEXTURE_ENV_COLOR) |
| 1691 | case GL_TEXTURE_ENV_COLOR: |
| 1692 | #endif // defined(GL_TEXTURE_ENV_COLOR) |
| 1693 | _needed = 4; |
| 1694 | break; |
| 1695 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1696 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1697 | break; |
| 1698 | } |
| 1699 | if (_remaining < _needed) { |
| 1700 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1701 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1702 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1703 | goto exit; |
| 1704 | } |
| 1705 | params_base = (GLfloat *) |
| 1706 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 1707 | params = params_base + offset; |
| 1708 | |
| 1709 | glGetTexEnvfv( |
| 1710 | (GLenum)env, |
| 1711 | (GLenum)pname, |
| 1712 | (GLfloat *)params |
| 1713 | ); |
| 1714 | |
| 1715 | exit: |
| 1716 | if (params_base) { |
| 1717 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 1718 | _exception ? JNI_ABORT: 0); |
| 1719 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1720 | if (_exception) { |
| 1721 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1722 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1723 | } |
| 1724 | |
| 1725 | /* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */ |
| 1726 | static void |
| 1727 | android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2 |
| 1728 | (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) { |
| 1729 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1730 | const char * _exceptionType = NULL; |
| 1731 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1732 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1733 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1734 | jint _remaining; |
| 1735 | GLfloat *params = (GLfloat *) 0; |
| 1736 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1737 | params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1738 | int _needed; |
| 1739 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1740 | #if defined(GL_TEXTURE_ENV_COLOR) |
| 1741 | case GL_TEXTURE_ENV_COLOR: |
| 1742 | #endif // defined(GL_TEXTURE_ENV_COLOR) |
| 1743 | _needed = 4; |
| 1744 | break; |
| 1745 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1746 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1747 | break; |
| 1748 | } |
| 1749 | if (_remaining < _needed) { |
| 1750 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1751 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1752 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1753 | goto exit; |
| 1754 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1755 | if (params == NULL) { |
| 1756 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1757 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 1758 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1759 | glGetTexEnvfv( |
| 1760 | (GLenum)env, |
| 1761 | (GLenum)pname, |
| 1762 | (GLfloat *)params |
| 1763 | ); |
| 1764 | |
| 1765 | exit: |
| 1766 | if (_array) { |
| 1767 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 1768 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1769 | if (_exception) { |
| 1770 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1771 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1772 | } |
| 1773 | |
| 1774 | /* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */ |
| 1775 | static void |
| 1776 | android_glGetTexEnviv__II_3II |
| 1777 | (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) { |
| 1778 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1779 | const char * _exceptionType = NULL; |
| 1780 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1781 | GLint *params_base = (GLint *) 0; |
| 1782 | jint _remaining; |
| 1783 | GLint *params = (GLint *) 0; |
| 1784 | |
| 1785 | if (!params_ref) { |
| 1786 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1787 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1788 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1789 | goto exit; |
| 1790 | } |
| 1791 | if (offset < 0) { |
| 1792 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1793 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1794 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1795 | goto exit; |
| 1796 | } |
| 1797 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 1798 | int _needed; |
| 1799 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1800 | #if defined(GL_TEXTURE_ENV_COLOR) |
| 1801 | case GL_TEXTURE_ENV_COLOR: |
| 1802 | #endif // defined(GL_TEXTURE_ENV_COLOR) |
| 1803 | _needed = 4; |
| 1804 | break; |
| 1805 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1806 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1807 | break; |
| 1808 | } |
| 1809 | if (_remaining < _needed) { |
| 1810 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1811 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1812 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1813 | goto exit; |
| 1814 | } |
| 1815 | params_base = (GLint *) |
| 1816 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 1817 | params = params_base + offset; |
| 1818 | |
| 1819 | glGetTexEnviv( |
| 1820 | (GLenum)env, |
| 1821 | (GLenum)pname, |
| 1822 | (GLint *)params |
| 1823 | ); |
| 1824 | |
| 1825 | exit: |
| 1826 | if (params_base) { |
| 1827 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 1828 | _exception ? JNI_ABORT: 0); |
| 1829 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1830 | if (_exception) { |
| 1831 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1832 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1833 | } |
| 1834 | |
| 1835 | /* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */ |
| 1836 | static void |
| 1837 | android_glGetTexEnviv__IILjava_nio_IntBuffer_2 |
| 1838 | (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) { |
| 1839 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1840 | const char * _exceptionType = NULL; |
| 1841 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1842 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1843 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1844 | jint _remaining; |
| 1845 | GLint *params = (GLint *) 0; |
| 1846 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1847 | params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1848 | int _needed; |
| 1849 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1850 | #if defined(GL_TEXTURE_ENV_COLOR) |
| 1851 | case GL_TEXTURE_ENV_COLOR: |
| 1852 | #endif // defined(GL_TEXTURE_ENV_COLOR) |
| 1853 | _needed = 4; |
| 1854 | break; |
| 1855 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1856 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1857 | break; |
| 1858 | } |
| 1859 | if (_remaining < _needed) { |
| 1860 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1861 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1862 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1863 | goto exit; |
| 1864 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1865 | if (params == NULL) { |
| 1866 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1867 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 1868 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1869 | glGetTexEnviv( |
| 1870 | (GLenum)env, |
| 1871 | (GLenum)pname, |
| 1872 | (GLint *)params |
| 1873 | ); |
| 1874 | |
| 1875 | exit: |
| 1876 | if (_array) { |
| 1877 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 1878 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1879 | if (_exception) { |
| 1880 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1881 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1882 | } |
| 1883 | |
| 1884 | /* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */ |
| 1885 | static void |
| 1886 | android_glGetTexEnvxv__II_3II |
| 1887 | (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) { |
| 1888 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1889 | const char * _exceptionType = NULL; |
| 1890 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1891 | GLfixed *params_base = (GLfixed *) 0; |
| 1892 | jint _remaining; |
| 1893 | GLfixed *params = (GLfixed *) 0; |
| 1894 | |
| 1895 | if (!params_ref) { |
| 1896 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1897 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1898 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1899 | goto exit; |
| 1900 | } |
| 1901 | if (offset < 0) { |
| 1902 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1903 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1904 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1905 | goto exit; |
| 1906 | } |
| 1907 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 1908 | int _needed; |
| 1909 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1910 | #if defined(GL_TEXTURE_ENV_COLOR) |
| 1911 | case GL_TEXTURE_ENV_COLOR: |
| 1912 | #endif // defined(GL_TEXTURE_ENV_COLOR) |
| 1913 | _needed = 4; |
| 1914 | break; |
| 1915 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1916 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1917 | break; |
| 1918 | } |
| 1919 | if (_remaining < _needed) { |
| 1920 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1921 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1922 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1923 | goto exit; |
| 1924 | } |
| 1925 | params_base = (GLfixed *) |
| 1926 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 1927 | params = params_base + offset; |
| 1928 | |
| 1929 | glGetTexEnvxv( |
| 1930 | (GLenum)env, |
| 1931 | (GLenum)pname, |
| 1932 | (GLfixed *)params |
| 1933 | ); |
| 1934 | |
| 1935 | exit: |
| 1936 | if (params_base) { |
| 1937 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 1938 | _exception ? JNI_ABORT: 0); |
| 1939 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1940 | if (_exception) { |
| 1941 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1942 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1943 | } |
| 1944 | |
| 1945 | /* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */ |
| 1946 | static void |
| 1947 | android_glGetTexEnvxv__IILjava_nio_IntBuffer_2 |
| 1948 | (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) { |
| 1949 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1950 | const char * _exceptionType = NULL; |
| 1951 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1952 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1953 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1954 | jint _remaining; |
| 1955 | GLfixed *params = (GLfixed *) 0; |
| 1956 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1957 | params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1958 | int _needed; |
| 1959 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1960 | #if defined(GL_TEXTURE_ENV_COLOR) |
| 1961 | case GL_TEXTURE_ENV_COLOR: |
| 1962 | #endif // defined(GL_TEXTURE_ENV_COLOR) |
| 1963 | _needed = 4; |
| 1964 | break; |
| 1965 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1966 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1967 | break; |
| 1968 | } |
| 1969 | if (_remaining < _needed) { |
| 1970 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1971 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1972 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1973 | goto exit; |
| 1974 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1975 | if (params == NULL) { |
| 1976 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1977 | params = (GLfixed *) (_paramsBase + _bufferOffset); |
| 1978 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1979 | glGetTexEnvxv( |
| 1980 | (GLenum)env, |
| 1981 | (GLenum)pname, |
| 1982 | (GLfixed *)params |
| 1983 | ); |
| 1984 | |
| 1985 | exit: |
| 1986 | if (_array) { |
| 1987 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 1988 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1989 | if (_exception) { |
| 1990 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1991 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1992 | } |
| 1993 | |
| 1994 | /* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */ |
| 1995 | static void |
| 1996 | android_glGetTexParameterfv__II_3FI |
| 1997 | (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) { |
| 1998 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1999 | const char * _exceptionType = NULL; |
| 2000 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2001 | GLfloat *params_base = (GLfloat *) 0; |
| 2002 | jint _remaining; |
| 2003 | GLfloat *params = (GLfloat *) 0; |
| 2004 | |
| 2005 | if (!params_ref) { |
| 2006 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2007 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2008 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2009 | goto exit; |
| 2010 | } |
| 2011 | if (offset < 0) { |
| 2012 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2013 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2014 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2015 | goto exit; |
| 2016 | } |
| 2017 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2018 | if (_remaining < 1) { |
| 2019 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2020 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2021 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2022 | goto exit; |
| 2023 | } |
| 2024 | params_base = (GLfloat *) |
| 2025 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 2026 | params = params_base + offset; |
| 2027 | |
| 2028 | glGetTexParameterfv( |
| 2029 | (GLenum)target, |
| 2030 | (GLenum)pname, |
| 2031 | (GLfloat *)params |
| 2032 | ); |
| 2033 | |
| 2034 | exit: |
| 2035 | if (params_base) { |
| 2036 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 2037 | _exception ? JNI_ABORT: 0); |
| 2038 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2039 | if (_exception) { |
| 2040 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2041 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2042 | } |
| 2043 | |
| 2044 | /* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */ |
| 2045 | static void |
| 2046 | android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 |
| 2047 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
| 2048 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2049 | const char * _exceptionType = NULL; |
| 2050 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2051 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2052 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2053 | jint _remaining; |
| 2054 | GLfloat *params = (GLfloat *) 0; |
| 2055 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2056 | params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2057 | if (_remaining < 1) { |
| 2058 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2059 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2060 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2061 | goto exit; |
| 2062 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2063 | if (params == NULL) { |
| 2064 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2065 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 2066 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2067 | glGetTexParameterfv( |
| 2068 | (GLenum)target, |
| 2069 | (GLenum)pname, |
| 2070 | (GLfloat *)params |
| 2071 | ); |
| 2072 | |
| 2073 | exit: |
| 2074 | if (_array) { |
| 2075 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 2076 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2077 | if (_exception) { |
| 2078 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2079 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2080 | } |
| 2081 | |
| 2082 | /* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 2083 | static void |
| 2084 | android_glGetTexParameteriv__II_3II |
| 2085 | (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { |
| 2086 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2087 | const char * _exceptionType = NULL; |
| 2088 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2089 | GLint *params_base = (GLint *) 0; |
| 2090 | jint _remaining; |
| 2091 | GLint *params = (GLint *) 0; |
| 2092 | |
| 2093 | if (!params_ref) { |
| 2094 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2095 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2096 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2097 | goto exit; |
| 2098 | } |
| 2099 | if (offset < 0) { |
| 2100 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2101 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2102 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2103 | goto exit; |
| 2104 | } |
| 2105 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2106 | if (_remaining < 1) { |
| 2107 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2108 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2109 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2110 | goto exit; |
| 2111 | } |
| 2112 | params_base = (GLint *) |
| 2113 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 2114 | params = params_base + offset; |
| 2115 | |
| 2116 | glGetTexParameteriv( |
| 2117 | (GLenum)target, |
| 2118 | (GLenum)pname, |
| 2119 | (GLint *)params |
| 2120 | ); |
| 2121 | |
| 2122 | exit: |
| 2123 | if (params_base) { |
| 2124 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 2125 | _exception ? JNI_ABORT: 0); |
| 2126 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2127 | if (_exception) { |
| 2128 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2129 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2130 | } |
| 2131 | |
| 2132 | /* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 2133 | static void |
| 2134 | android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 |
| 2135 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
| 2136 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2137 | const char * _exceptionType = NULL; |
| 2138 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2139 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2140 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2141 | jint _remaining; |
| 2142 | GLint *params = (GLint *) 0; |
| 2143 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2144 | params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2145 | if (_remaining < 1) { |
| 2146 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2147 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2148 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2149 | goto exit; |
| 2150 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2151 | if (params == NULL) { |
| 2152 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2153 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 2154 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2155 | glGetTexParameteriv( |
| 2156 | (GLenum)target, |
| 2157 | (GLenum)pname, |
| 2158 | (GLint *)params |
| 2159 | ); |
| 2160 | |
| 2161 | exit: |
| 2162 | if (_array) { |
| 2163 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 2164 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2165 | if (_exception) { |
| 2166 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2167 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2168 | } |
| 2169 | |
| 2170 | /* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */ |
| 2171 | static void |
| 2172 | android_glGetTexParameterxv__II_3II |
| 2173 | (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { |
| 2174 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2175 | const char * _exceptionType = NULL; |
| 2176 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2177 | GLfixed *params_base = (GLfixed *) 0; |
| 2178 | jint _remaining; |
| 2179 | GLfixed *params = (GLfixed *) 0; |
| 2180 | |
| 2181 | if (!params_ref) { |
| 2182 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2183 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2184 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2185 | goto exit; |
| 2186 | } |
| 2187 | if (offset < 0) { |
| 2188 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2189 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2190 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2191 | goto exit; |
| 2192 | } |
| 2193 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2194 | if (_remaining < 1) { |
| 2195 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2196 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2197 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2198 | goto exit; |
| 2199 | } |
| 2200 | params_base = (GLfixed *) |
| 2201 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 2202 | params = params_base + offset; |
| 2203 | |
| 2204 | glGetTexParameterxv( |
| 2205 | (GLenum)target, |
| 2206 | (GLenum)pname, |
| 2207 | (GLfixed *)params |
| 2208 | ); |
| 2209 | |
| 2210 | exit: |
| 2211 | if (params_base) { |
| 2212 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 2213 | _exception ? JNI_ABORT: 0); |
| 2214 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2215 | if (_exception) { |
| 2216 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2217 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2218 | } |
| 2219 | |
| 2220 | /* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */ |
| 2221 | static void |
| 2222 | android_glGetTexParameterxv__IILjava_nio_IntBuffer_2 |
| 2223 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
| 2224 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2225 | const char * _exceptionType = NULL; |
| 2226 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2227 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2228 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2229 | jint _remaining; |
| 2230 | GLfixed *params = (GLfixed *) 0; |
| 2231 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2232 | params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2233 | if (_remaining < 1) { |
| 2234 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2235 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2236 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2237 | goto exit; |
| 2238 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2239 | if (params == NULL) { |
| 2240 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2241 | params = (GLfixed *) (_paramsBase + _bufferOffset); |
| 2242 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2243 | glGetTexParameterxv( |
| 2244 | (GLenum)target, |
| 2245 | (GLenum)pname, |
| 2246 | (GLfixed *)params |
| 2247 | ); |
| 2248 | |
| 2249 | exit: |
| 2250 | if (_array) { |
| 2251 | releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE); |
| 2252 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2253 | if (_exception) { |
| 2254 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2255 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2256 | } |
| 2257 | |
| 2258 | /* GLboolean glIsBuffer ( GLuint buffer ) */ |
| 2259 | static jboolean |
| 2260 | android_glIsBuffer__I |
| 2261 | (JNIEnv *_env, jobject _this, jint buffer) { |
| 2262 | GLboolean _returnValue; |
| 2263 | _returnValue = glIsBuffer( |
| 2264 | (GLuint)buffer |
| 2265 | ); |
| 2266 | return _returnValue; |
| 2267 | } |
| 2268 | |
| 2269 | /* GLboolean glIsEnabled ( GLenum cap ) */ |
| 2270 | static jboolean |
| 2271 | android_glIsEnabled__I |
| 2272 | (JNIEnv *_env, jobject _this, jint cap) { |
| 2273 | GLboolean _returnValue; |
| 2274 | _returnValue = glIsEnabled( |
| 2275 | (GLenum)cap |
| 2276 | ); |
| 2277 | return _returnValue; |
| 2278 | } |
| 2279 | |
| 2280 | /* GLboolean glIsTexture ( GLuint texture ) */ |
| 2281 | static jboolean |
| 2282 | android_glIsTexture__I |
| 2283 | (JNIEnv *_env, jobject _this, jint texture) { |
| 2284 | GLboolean _returnValue; |
| 2285 | _returnValue = glIsTexture( |
| 2286 | (GLuint)texture |
| 2287 | ); |
| 2288 | return _returnValue; |
| 2289 | } |
| 2290 | |
| 2291 | /* void glNormalPointer ( GLenum type, GLsizei stride, GLint offset ) */ |
| 2292 | static void |
| 2293 | android_glNormalPointer__III |
| 2294 | (JNIEnv *_env, jobject _this, jint type, jint stride, jint offset) { |
| 2295 | glNormalPointer( |
| 2296 | (GLenum)type, |
| 2297 | (GLsizei)stride, |
| 2298 | (const GLvoid *)offset |
| 2299 | ); |
| 2300 | } |
| 2301 | |
| 2302 | /* void glPointParameterf ( GLenum pname, GLfloat param ) */ |
| 2303 | static void |
| 2304 | android_glPointParameterf__IF |
| 2305 | (JNIEnv *_env, jobject _this, jint pname, jfloat param) { |
| 2306 | glPointParameterf( |
| 2307 | (GLenum)pname, |
| 2308 | (GLfloat)param |
| 2309 | ); |
| 2310 | } |
| 2311 | |
| 2312 | /* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */ |
| 2313 | static void |
| 2314 | android_glPointParameterfv__I_3FI |
| 2315 | (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2316 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2317 | const char * _exceptionType = NULL; |
| 2318 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2319 | GLfloat *params_base = (GLfloat *) 0; |
| 2320 | jint _remaining; |
| 2321 | GLfloat *params = (GLfloat *) 0; |
| 2322 | |
| 2323 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2324 | _exception = 1; |
| 2325 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2326 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2327 | goto exit; |
| 2328 | } |
| 2329 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2330 | _exception = 1; |
| 2331 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2332 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2333 | goto exit; |
| 2334 | } |
| 2335 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2336 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2337 | _exception = 1; |
| 2338 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2339 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2340 | goto exit; |
| 2341 | } |
| 2342 | params_base = (GLfloat *) |
| 2343 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 2344 | params = params_base + offset; |
| 2345 | |
| 2346 | glPointParameterfv( |
| 2347 | (GLenum)pname, |
| 2348 | (GLfloat *)params |
| 2349 | ); |
| 2350 | |
| 2351 | exit: |
| 2352 | if (params_base) { |
| 2353 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 2354 | JNI_ABORT); |
| 2355 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2356 | if (_exception) { |
| 2357 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2358 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2359 | } |
| 2360 | |
| 2361 | /* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */ |
| 2362 | static void |
| 2363 | android_glPointParameterfv__ILjava_nio_FloatBuffer_2 |
| 2364 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2365 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2366 | const char * _exceptionType = NULL; |
| 2367 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2368 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2369 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2370 | jint _remaining; |
| 2371 | GLfloat *params = (GLfloat *) 0; |
| 2372 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2373 | params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2374 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2375 | _exception = 1; |
| 2376 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2377 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2378 | goto exit; |
| 2379 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2380 | if (params == NULL) { |
| 2381 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2382 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 2383 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2384 | glPointParameterfv( |
| 2385 | (GLenum)pname, |
| 2386 | (GLfloat *)params |
| 2387 | ); |
| 2388 | |
| 2389 | exit: |
| 2390 | if (_array) { |
| 2391 | releasePointer(_env, _array, params, JNI_FALSE); |
| 2392 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2393 | if (_exception) { |
| 2394 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2395 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2396 | } |
| 2397 | |
| 2398 | /* void glPointParameterx ( GLenum pname, GLfixed param ) */ |
| 2399 | static void |
| 2400 | android_glPointParameterx__II |
| 2401 | (JNIEnv *_env, jobject _this, jint pname, jint param) { |
| 2402 | glPointParameterx( |
| 2403 | (GLenum)pname, |
| 2404 | (GLfixed)param |
| 2405 | ); |
| 2406 | } |
| 2407 | |
| 2408 | /* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */ |
| 2409 | static void |
| 2410 | android_glPointParameterxv__I_3II |
| 2411 | (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2412 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2413 | const char * _exceptionType = NULL; |
| 2414 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2415 | GLfixed *params_base = (GLfixed *) 0; |
| 2416 | jint _remaining; |
| 2417 | GLfixed *params = (GLfixed *) 0; |
| 2418 | |
| 2419 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2420 | _exception = 1; |
| 2421 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2422 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2423 | goto exit; |
| 2424 | } |
| 2425 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2426 | _exception = 1; |
| 2427 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2428 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2429 | goto exit; |
| 2430 | } |
| 2431 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2432 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2433 | _exception = 1; |
| 2434 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2435 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2436 | goto exit; |
| 2437 | } |
| 2438 | params_base = (GLfixed *) |
| 2439 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 2440 | params = params_base + offset; |
| 2441 | |
| 2442 | glPointParameterxv( |
| 2443 | (GLenum)pname, |
| 2444 | (GLfixed *)params |
| 2445 | ); |
| 2446 | |
| 2447 | exit: |
| 2448 | if (params_base) { |
| 2449 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 2450 | JNI_ABORT); |
| 2451 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2452 | if (_exception) { |
| 2453 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2454 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2455 | } |
| 2456 | |
| 2457 | /* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */ |
| 2458 | static void |
| 2459 | android_glPointParameterxv__ILjava_nio_IntBuffer_2 |
| 2460 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2461 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2462 | const char * _exceptionType = NULL; |
| 2463 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2464 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2465 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2466 | jint _remaining; |
| 2467 | GLfixed *params = (GLfixed *) 0; |
| 2468 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2469 | params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2470 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2471 | _exception = 1; |
| 2472 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2473 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2474 | goto exit; |
| 2475 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2476 | if (params == NULL) { |
| 2477 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2478 | params = (GLfixed *) (_paramsBase + _bufferOffset); |
| 2479 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2480 | glPointParameterxv( |
| 2481 | (GLenum)pname, |
| 2482 | (GLfixed *)params |
| 2483 | ); |
| 2484 | |
| 2485 | exit: |
| 2486 | if (_array) { |
| 2487 | releasePointer(_env, _array, params, JNI_FALSE); |
| 2488 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2489 | if (_exception) { |
| 2490 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2491 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2492 | } |
| 2493 | |
| 2494 | /* void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) */ |
| 2495 | static void |
Jack Palevich | be6eac8 | 2009-12-08 15:43:51 +0800 | [diff] [blame] | 2496 | android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I |
| 2497 | (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2498 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2499 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2500 | jint _remaining; |
| 2501 | GLvoid *pointer = (GLvoid *) 0; |
| 2502 | |
Jack Palevich | be6eac8 | 2009-12-08 15:43:51 +0800 | [diff] [blame] | 2503 | if (pointer_buf) { |
| 2504 | pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf); |
| 2505 | if ( ! pointer ) { |
| 2506 | return; |
| 2507 | } |
| 2508 | } |
| 2509 | glPointSizePointerOESBounds( |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2510 | (GLenum)type, |
| 2511 | (GLsizei)stride, |
Jack Palevich | be6eac8 | 2009-12-08 15:43:51 +0800 | [diff] [blame] | 2512 | (GLvoid *)pointer, |
| 2513 | (GLsizei)remaining |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2514 | ); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2515 | } |
| 2516 | |
| 2517 | /* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */ |
| 2518 | static void |
| 2519 | android_glTexCoordPointer__IIII |
| 2520 | (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) { |
| 2521 | glTexCoordPointer( |
| 2522 | (GLint)size, |
| 2523 | (GLenum)type, |
| 2524 | (GLsizei)stride, |
| 2525 | (const GLvoid *)offset |
| 2526 | ); |
| 2527 | } |
| 2528 | |
| 2529 | /* void glTexEnvi ( GLenum target, GLenum pname, GLint param ) */ |
| 2530 | static void |
| 2531 | android_glTexEnvi__III |
| 2532 | (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) { |
| 2533 | glTexEnvi( |
| 2534 | (GLenum)target, |
| 2535 | (GLenum)pname, |
| 2536 | (GLint)param |
| 2537 | ); |
| 2538 | } |
| 2539 | |
| 2540 | /* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */ |
| 2541 | static void |
| 2542 | android_glTexEnviv__II_3II |
| 2543 | (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] | 2544 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2545 | const char * _exceptionType = NULL; |
| 2546 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2547 | GLint *params_base = (GLint *) 0; |
| 2548 | jint _remaining; |
| 2549 | GLint *params = (GLint *) 0; |
| 2550 | |
| 2551 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2552 | _exception = 1; |
| 2553 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2554 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2555 | goto exit; |
| 2556 | } |
| 2557 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2558 | _exception = 1; |
| 2559 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2560 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2561 | goto exit; |
| 2562 | } |
| 2563 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2564 | int _needed; |
| 2565 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2566 | #if defined(GL_TEXTURE_ENV_COLOR) |
| 2567 | case GL_TEXTURE_ENV_COLOR: |
| 2568 | #endif // defined(GL_TEXTURE_ENV_COLOR) |
| 2569 | _needed = 4; |
| 2570 | break; |
| 2571 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2572 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2573 | break; |
| 2574 | } |
| 2575 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2576 | _exception = 1; |
| 2577 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2578 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2579 | goto exit; |
| 2580 | } |
| 2581 | params_base = (GLint *) |
| 2582 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 2583 | params = params_base + offset; |
| 2584 | |
| 2585 | glTexEnviv( |
| 2586 | (GLenum)target, |
| 2587 | (GLenum)pname, |
| 2588 | (GLint *)params |
| 2589 | ); |
| 2590 | |
| 2591 | exit: |
| 2592 | if (params_base) { |
| 2593 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 2594 | JNI_ABORT); |
| 2595 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2596 | if (_exception) { |
| 2597 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2598 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2599 | } |
| 2600 | |
| 2601 | /* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */ |
| 2602 | static void |
| 2603 | android_glTexEnviv__IILjava_nio_IntBuffer_2 |
| 2604 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2605 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2606 | const char * _exceptionType = NULL; |
| 2607 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2608 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2609 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2610 | jint _remaining; |
| 2611 | GLint *params = (GLint *) 0; |
| 2612 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2613 | params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2614 | int _needed; |
| 2615 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2616 | #if defined(GL_TEXTURE_ENV_COLOR) |
| 2617 | case GL_TEXTURE_ENV_COLOR: |
| 2618 | #endif // defined(GL_TEXTURE_ENV_COLOR) |
| 2619 | _needed = 4; |
| 2620 | break; |
| 2621 | default: |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2622 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2623 | break; |
| 2624 | } |
| 2625 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2626 | _exception = 1; |
| 2627 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2628 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2629 | goto exit; |
| 2630 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2631 | if (params == NULL) { |
| 2632 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2633 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 2634 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2635 | glTexEnviv( |
| 2636 | (GLenum)target, |
| 2637 | (GLenum)pname, |
| 2638 | (GLint *)params |
| 2639 | ); |
| 2640 | |
| 2641 | exit: |
| 2642 | if (_array) { |
| 2643 | releasePointer(_env, _array, params, JNI_FALSE); |
| 2644 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2645 | if (_exception) { |
| 2646 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2647 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2648 | } |
| 2649 | |
| 2650 | /* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */ |
| 2651 | static void |
| 2652 | android_glTexParameterfv__II_3FI |
| 2653 | (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] | 2654 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2655 | const char * _exceptionType = NULL; |
| 2656 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2657 | GLfloat *params_base = (GLfloat *) 0; |
| 2658 | jint _remaining; |
| 2659 | GLfloat *params = (GLfloat *) 0; |
| 2660 | |
| 2661 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2662 | _exception = 1; |
| 2663 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2664 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2665 | goto exit; |
| 2666 | } |
| 2667 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2668 | _exception = 1; |
| 2669 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2670 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2671 | goto exit; |
| 2672 | } |
| 2673 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2674 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2675 | _exception = 1; |
| 2676 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2677 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2678 | goto exit; |
| 2679 | } |
| 2680 | params_base = (GLfloat *) |
| 2681 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 2682 | params = params_base + offset; |
| 2683 | |
| 2684 | glTexParameterfv( |
| 2685 | (GLenum)target, |
| 2686 | (GLenum)pname, |
| 2687 | (GLfloat *)params |
| 2688 | ); |
| 2689 | |
| 2690 | exit: |
| 2691 | if (params_base) { |
| 2692 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 2693 | JNI_ABORT); |
| 2694 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2695 | if (_exception) { |
| 2696 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2697 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2698 | } |
| 2699 | |
| 2700 | /* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */ |
| 2701 | static void |
| 2702 | android_glTexParameterfv__IILjava_nio_FloatBuffer_2 |
| 2703 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2704 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2705 | const char * _exceptionType = NULL; |
| 2706 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2707 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2708 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2709 | jint _remaining; |
| 2710 | GLfloat *params = (GLfloat *) 0; |
| 2711 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2712 | params = (GLfloat *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2713 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2714 | _exception = 1; |
| 2715 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2716 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2717 | goto exit; |
| 2718 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2719 | if (params == NULL) { |
| 2720 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2721 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 2722 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2723 | glTexParameterfv( |
| 2724 | (GLenum)target, |
| 2725 | (GLenum)pname, |
| 2726 | (GLfloat *)params |
| 2727 | ); |
| 2728 | |
| 2729 | exit: |
| 2730 | if (_array) { |
| 2731 | releasePointer(_env, _array, params, JNI_FALSE); |
| 2732 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2733 | if (_exception) { |
| 2734 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2735 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2736 | } |
| 2737 | |
| 2738 | /* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */ |
| 2739 | static void |
| 2740 | android_glTexParameteri__III |
| 2741 | (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) { |
| 2742 | glTexParameteri( |
| 2743 | (GLenum)target, |
| 2744 | (GLenum)pname, |
| 2745 | (GLint)param |
| 2746 | ); |
| 2747 | } |
| 2748 | |
| 2749 | /* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */ |
| 2750 | static void |
| 2751 | android_glTexParameteriv__II_3II |
| 2752 | (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] | 2753 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2754 | const char * _exceptionType = NULL; |
| 2755 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2756 | GLint *params_base = (GLint *) 0; |
| 2757 | jint _remaining; |
| 2758 | GLint *params = (GLint *) 0; |
| 2759 | |
| 2760 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2761 | _exception = 1; |
| 2762 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2763 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2764 | goto exit; |
| 2765 | } |
| 2766 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2767 | _exception = 1; |
| 2768 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2769 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2770 | goto exit; |
| 2771 | } |
| 2772 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2773 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2774 | _exception = 1; |
| 2775 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2776 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2777 | goto exit; |
| 2778 | } |
| 2779 | params_base = (GLint *) |
| 2780 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 2781 | params = params_base + offset; |
| 2782 | |
| 2783 | glTexParameteriv( |
| 2784 | (GLenum)target, |
| 2785 | (GLenum)pname, |
| 2786 | (GLint *)params |
| 2787 | ); |
| 2788 | |
| 2789 | exit: |
| 2790 | if (params_base) { |
| 2791 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 2792 | JNI_ABORT); |
| 2793 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2794 | if (_exception) { |
| 2795 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2796 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2797 | } |
| 2798 | |
| 2799 | /* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */ |
| 2800 | static void |
| 2801 | android_glTexParameteriv__IILjava_nio_IntBuffer_2 |
| 2802 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2803 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2804 | const char * _exceptionType = NULL; |
| 2805 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2806 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2807 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2808 | jint _remaining; |
| 2809 | GLint *params = (GLint *) 0; |
| 2810 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2811 | params = (GLint *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2812 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2813 | _exception = 1; |
| 2814 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2815 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2816 | goto exit; |
| 2817 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2818 | if (params == NULL) { |
| 2819 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2820 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 2821 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2822 | glTexParameteriv( |
| 2823 | (GLenum)target, |
| 2824 | (GLenum)pname, |
| 2825 | (GLint *)params |
| 2826 | ); |
| 2827 | |
| 2828 | exit: |
| 2829 | if (_array) { |
| 2830 | releasePointer(_env, _array, params, JNI_FALSE); |
| 2831 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2832 | if (_exception) { |
| 2833 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2834 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2835 | } |
| 2836 | |
| 2837 | /* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */ |
| 2838 | static void |
| 2839 | android_glTexParameterxv__II_3II |
| 2840 | (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] | 2841 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2842 | const char * _exceptionType = NULL; |
| 2843 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2844 | GLfixed *params_base = (GLfixed *) 0; |
| 2845 | jint _remaining; |
| 2846 | GLfixed *params = (GLfixed *) 0; |
| 2847 | |
| 2848 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2849 | _exception = 1; |
| 2850 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2851 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2852 | goto exit; |
| 2853 | } |
| 2854 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2855 | _exception = 1; |
| 2856 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2857 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2858 | goto exit; |
| 2859 | } |
| 2860 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2861 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2862 | _exception = 1; |
| 2863 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2864 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2865 | goto exit; |
| 2866 | } |
| 2867 | params_base = (GLfixed *) |
| 2868 | _env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0); |
| 2869 | params = params_base + offset; |
| 2870 | |
| 2871 | glTexParameterxv( |
| 2872 | (GLenum)target, |
| 2873 | (GLenum)pname, |
| 2874 | (GLfixed *)params |
| 2875 | ); |
| 2876 | |
| 2877 | exit: |
| 2878 | if (params_base) { |
| 2879 | _env->ReleasePrimitiveArrayCritical(params_ref, params_base, |
| 2880 | JNI_ABORT); |
| 2881 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2882 | if (_exception) { |
| 2883 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2884 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2885 | } |
| 2886 | |
| 2887 | /* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */ |
| 2888 | static void |
| 2889 | android_glTexParameterxv__IILjava_nio_IntBuffer_2 |
| 2890 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2891 | jint _exception = 0; |
Mathias Agopian | 15284de | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2892 | const char * _exceptionType = NULL; |
| 2893 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2894 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2895 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2896 | jint _remaining; |
| 2897 | GLfixed *params = (GLfixed *) 0; |
| 2898 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2899 | params = (GLfixed *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2900 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2901 | _exception = 1; |
| 2902 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2903 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2904 | goto exit; |
| 2905 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2906 | if (params == NULL) { |
| 2907 | char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 2908 | params = (GLfixed *) (_paramsBase + _bufferOffset); |
| 2909 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2910 | glTexParameterxv( |
| 2911 | (GLenum)target, |
| 2912 | (GLenum)pname, |
| 2913 | (GLfixed *)params |
| 2914 | ); |
| 2915 | |
| 2916 | exit: |
| 2917 | if (_array) { |
| 2918 | releasePointer(_env, _array, params, JNI_FALSE); |
| 2919 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2920 | if (_exception) { |
| 2921 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2922 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2923 | } |
| 2924 | |
| 2925 | /* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */ |
| 2926 | static void |
| 2927 | android_glVertexPointer__IIII |
| 2928 | (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) { |
| 2929 | glVertexPointer( |
| 2930 | (GLint)size, |
| 2931 | (GLenum)type, |
| 2932 | (GLsizei)stride, |
| 2933 | (const GLvoid *)offset |
| 2934 | ); |
| 2935 | } |
| 2936 | |
| 2937 | static const char *classPathName = "android/opengl/GLES11"; |
| 2938 | |
| 2939 | static JNINativeMethod methods[] = { |
| 2940 | {"_nativeClassInit", "()V", (void*)nativeClassInit }, |
| 2941 | {"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II }, |
| 2942 | {"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I }, |
| 2943 | {"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 }, |
| 2944 | {"glClipPlanef", "(I[FI)V", (void *) android_glClipPlanef__I_3FI }, |
| 2945 | {"glClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glClipPlanef__ILjava_nio_FloatBuffer_2 }, |
| 2946 | {"glClipPlanex", "(I[II)V", (void *) android_glClipPlanex__I_3II }, |
| 2947 | {"glClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glClipPlanex__ILjava_nio_IntBuffer_2 }, |
| 2948 | {"glColor4ub", "(BBBB)V", (void *) android_glColor4ub__BBBB }, |
| 2949 | {"glColorPointer", "(IIII)V", (void *) android_glColorPointer__IIII }, |
| 2950 | {"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II }, |
| 2951 | {"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 }, |
| 2952 | {"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII }, |
| 2953 | {"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II }, |
| 2954 | {"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 }, |
| 2955 | {"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI }, |
| 2956 | {"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 }, |
| 2957 | {"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II }, |
| 2958 | {"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 }, |
| 2959 | {"glGetClipPlanef", "(I[FI)V", (void *) android_glGetClipPlanef__I_3FI }, |
| 2960 | {"glGetClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetClipPlanef__ILjava_nio_FloatBuffer_2 }, |
| 2961 | {"glGetClipPlanex", "(I[II)V", (void *) android_glGetClipPlanex__I_3II }, |
| 2962 | {"glGetClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetClipPlanex__ILjava_nio_IntBuffer_2 }, |
| 2963 | {"glGetFixedv", "(I[II)V", (void *) android_glGetFixedv__I_3II }, |
| 2964 | {"glGetFixedv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetFixedv__ILjava_nio_IntBuffer_2 }, |
| 2965 | {"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI }, |
| 2966 | {"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 }, |
| 2967 | {"glGetLightfv", "(II[FI)V", (void *) android_glGetLightfv__II_3FI }, |
| 2968 | {"glGetLightfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetLightfv__IILjava_nio_FloatBuffer_2 }, |
| 2969 | {"glGetLightxv", "(II[II)V", (void *) android_glGetLightxv__II_3II }, |
| 2970 | {"glGetLightxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetLightxv__IILjava_nio_IntBuffer_2 }, |
| 2971 | {"glGetMaterialfv", "(II[FI)V", (void *) android_glGetMaterialfv__II_3FI }, |
| 2972 | {"glGetMaterialfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetMaterialfv__IILjava_nio_FloatBuffer_2 }, |
| 2973 | {"glGetMaterialxv", "(II[II)V", (void *) android_glGetMaterialxv__II_3II }, |
| 2974 | {"glGetMaterialxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetMaterialxv__IILjava_nio_IntBuffer_2 }, |
| 2975 | {"glGetTexEnvfv", "(II[FI)V", (void *) android_glGetTexEnvfv__II_3FI }, |
| 2976 | {"glGetTexEnvfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2 }, |
| 2977 | {"glGetTexEnviv", "(II[II)V", (void *) android_glGetTexEnviv__II_3II }, |
| 2978 | {"glGetTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnviv__IILjava_nio_IntBuffer_2 }, |
| 2979 | {"glGetTexEnvxv", "(II[II)V", (void *) android_glGetTexEnvxv__II_3II }, |
| 2980 | {"glGetTexEnvxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnvxv__IILjava_nio_IntBuffer_2 }, |
| 2981 | {"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI }, |
| 2982 | {"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 }, |
| 2983 | {"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II }, |
| 2984 | {"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 }, |
| 2985 | {"glGetTexParameterxv", "(II[II)V", (void *) android_glGetTexParameterxv__II_3II }, |
| 2986 | {"glGetTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameterxv__IILjava_nio_IntBuffer_2 }, |
| 2987 | {"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I }, |
| 2988 | {"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I }, |
| 2989 | {"glIsTexture", "(I)Z", (void *) android_glIsTexture__I }, |
| 2990 | {"glNormalPointer", "(III)V", (void *) android_glNormalPointer__III }, |
| 2991 | {"glPointParameterf", "(IF)V", (void *) android_glPointParameterf__IF }, |
| 2992 | {"glPointParameterfv", "(I[FI)V", (void *) android_glPointParameterfv__I_3FI }, |
| 2993 | {"glPointParameterfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glPointParameterfv__ILjava_nio_FloatBuffer_2 }, |
| 2994 | {"glPointParameterx", "(II)V", (void *) android_glPointParameterx__II }, |
| 2995 | {"glPointParameterxv", "(I[II)V", (void *) android_glPointParameterxv__I_3II }, |
| 2996 | {"glPointParameterxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glPointParameterxv__ILjava_nio_IntBuffer_2 }, |
Jack Palevich | be6eac8 | 2009-12-08 15:43:51 +0800 | [diff] [blame] | 2997 | {"glPointSizePointerOESBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I }, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2998 | {"glTexCoordPointer", "(IIII)V", (void *) android_glTexCoordPointer__IIII }, |
| 2999 | {"glTexEnvi", "(III)V", (void *) android_glTexEnvi__III }, |
| 3000 | {"glTexEnviv", "(II[II)V", (void *) android_glTexEnviv__II_3II }, |
| 3001 | {"glTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexEnviv__IILjava_nio_IntBuffer_2 }, |
| 3002 | {"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI }, |
| 3003 | {"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 }, |
| 3004 | {"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III }, |
| 3005 | {"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II }, |
| 3006 | {"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 }, |
| 3007 | {"glTexParameterxv", "(II[II)V", (void *) android_glTexParameterxv__II_3II }, |
| 3008 | {"glTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameterxv__IILjava_nio_IntBuffer_2 }, |
| 3009 | {"glVertexPointer", "(IIII)V", (void *) android_glVertexPointer__IIII }, |
| 3010 | }; |
| 3011 | |
| 3012 | int register_android_opengl_jni_GLES11(JNIEnv *_env) |
| 3013 | { |
| 3014 | int err; |
| 3015 | err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods)); |
| 3016 | return err; |
| 3017 | } |