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