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 | |
Andreas Gampe | bfe6333 | 2014-11-12 14:12:45 -0800 | [diff] [blame] | 20 | #pragma GCC diagnostic ignored "-Wunused-variable" |
Andreas Gampe | bfe6333 | 2014-11-12 14:12:45 -0800 | [diff] [blame] | 21 | #pragma GCC diagnostic ignored "-Wunused-function" |
| 22 | |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 23 | #include <GLES2/gl2.h> |
| 24 | #include <GLES2/gl2ext.h> |
| 25 | |
Jesse Hall | 9626f82 | 2014-05-19 20:57:49 -0700 | [diff] [blame] | 26 | #include <jni.h> |
Steven Moreland | 2279b25 | 2017-07-19 09:50:45 -0700 | [diff] [blame] | 27 | #include <nativehelper/JNIHelp.h> |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 28 | #include <android_runtime/AndroidRuntime.h> |
| 29 | #include <utils/misc.h> |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 30 | #include <assert.h> |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 31 | |
| 32 | static int initialized = 0; |
| 33 | |
| 34 | static jclass nioAccessClass; |
| 35 | static jclass bufferClass; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 36 | static jmethodID getBasePointerID; |
| 37 | static jmethodID getBaseArrayID; |
| 38 | static jmethodID getBaseArrayOffsetID; |
| 39 | static jfieldID positionID; |
| 40 | static jfieldID limitID; |
| 41 | static jfieldID elementSizeShiftID; |
| 42 | |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 43 | |
| 44 | /* special calls implemented in Android's GLES wrapper used to more |
| 45 | * efficiently bound-check passed arrays */ |
| 46 | extern "C" { |
| 47 | #ifdef GL_VERSION_ES_CM_1_1 |
| 48 | GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride, |
| 49 | const GLvoid *ptr, GLsizei count); |
| 50 | GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride, |
| 51 | const GLvoid *pointer, GLsizei count); |
| 52 | GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type, |
| 53 | GLsizei stride, const GLvoid *pointer, GLsizei count); |
| 54 | GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type, |
| 55 | GLsizei stride, const GLvoid *pointer, GLsizei count); |
| 56 | GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, |
| 57 | GLsizei stride, const GLvoid *pointer, GLsizei count); |
| 58 | GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, |
| 59 | GLsizei stride, const GLvoid *pointer, GLsizei count); |
| 60 | GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, |
| 61 | GLsizei stride, const GLvoid *pointer, GLsizei count); |
| 62 | #endif |
| 63 | #ifdef GL_ES_VERSION_2_0 |
| 64 | static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type, |
| 65 | GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) { |
| 66 | glVertexAttribPointer(indx, size, type, normalized, stride, pointer); |
| 67 | } |
| 68 | #endif |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 69 | #ifdef GL_ES_VERSION_3_0 |
| 70 | static void glVertexAttribIPointerBounds(GLuint indx, GLint size, GLenum type, |
| 71 | GLsizei stride, const GLvoid *pointer, GLsizei count) { |
| 72 | glVertexAttribIPointer(indx, size, type, stride, pointer); |
| 73 | } |
| 74 | #endif |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 75 | } |
| 76 | |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 77 | /* Cache method IDs each time the class is loaded. */ |
| 78 | |
| 79 | static void |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 80 | nativeClassInit(JNIEnv *_env, jclass glImplClass) |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 81 | { |
| 82 | jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); |
| 83 | nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); |
| 84 | |
| 85 | jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); |
| 86 | bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); |
| 87 | |
| 88 | getBasePointerID = _env->GetStaticMethodID(nioAccessClass, |
| 89 | "getBasePointer", "(Ljava/nio/Buffer;)J"); |
| 90 | getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, |
| 91 | "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); |
| 92 | getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, |
| 93 | "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); |
| 94 | |
| 95 | positionID = _env->GetFieldID(bufferClass, "position", "I"); |
| 96 | limitID = _env->GetFieldID(bufferClass, "limit", "I"); |
| 97 | elementSizeShiftID = |
| 98 | _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); |
| 99 | } |
| 100 | |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 101 | static void * |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 102 | getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset) |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 103 | { |
| 104 | jint position; |
| 105 | jint limit; |
| 106 | jint elementSizeShift; |
| 107 | jlong pointer; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 108 | |
| 109 | position = _env->GetIntField(buffer, positionID); |
| 110 | limit = _env->GetIntField(buffer, limitID); |
| 111 | elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); |
| 112 | *remaining = (limit - position) << elementSizeShift; |
| 113 | pointer = _env->CallStaticLongMethod(nioAccessClass, |
| 114 | getBasePointerID, buffer); |
| 115 | if (pointer != 0L) { |
| 116 | *array = NULL; |
Ashok Bhat | 01c26ea | 2014-02-24 09:49:07 +0000 | [diff] [blame] | 117 | return reinterpret_cast<void*>(pointer); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 118 | } |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 119 | |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 120 | *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, |
| 121 | getBaseArrayID, buffer); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 122 | *offset = _env->CallStaticIntMethod(nioAccessClass, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 123 | getBaseArrayOffsetID, buffer); |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 124 | |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 125 | return NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 126 | } |
| 127 | |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 128 | class ByteArrayGetter { |
| 129 | public: |
| 130 | static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) { |
| 131 | return _env->GetByteArrayElements(array, is_copy); |
| 132 | } |
| 133 | }; |
| 134 | class BooleanArrayGetter { |
| 135 | public: |
| 136 | static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) { |
| 137 | return _env->GetBooleanArrayElements(array, is_copy); |
| 138 | } |
| 139 | }; |
| 140 | class CharArrayGetter { |
| 141 | public: |
| 142 | static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) { |
| 143 | return _env->GetCharArrayElements(array, is_copy); |
| 144 | } |
| 145 | }; |
| 146 | class ShortArrayGetter { |
| 147 | public: |
| 148 | static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) { |
| 149 | return _env->GetShortArrayElements(array, is_copy); |
| 150 | } |
| 151 | }; |
| 152 | class IntArrayGetter { |
| 153 | public: |
| 154 | static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) { |
| 155 | return _env->GetIntArrayElements(array, is_copy); |
| 156 | } |
| 157 | }; |
| 158 | class LongArrayGetter { |
| 159 | public: |
| 160 | static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) { |
| 161 | return _env->GetLongArrayElements(array, is_copy); |
| 162 | } |
| 163 | }; |
| 164 | class FloatArrayGetter { |
| 165 | public: |
| 166 | static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) { |
| 167 | return _env->GetFloatArrayElements(array, is_copy); |
| 168 | } |
| 169 | }; |
| 170 | class DoubleArrayGetter { |
| 171 | public: |
| 172 | static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) { |
| 173 | return _env->GetDoubleArrayElements(array, is_copy); |
| 174 | } |
| 175 | }; |
| 176 | |
| 177 | template<typename JTYPEARRAY, typename ARRAYGETTER> |
| 178 | static void* |
| 179 | getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) { |
| 180 | return ARRAYGETTER::Get(_env, array, is_copy); |
| 181 | } |
| 182 | |
| 183 | class ByteArrayReleaser { |
| 184 | public: |
| 185 | static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) { |
| 186 | _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT); |
| 187 | } |
| 188 | }; |
| 189 | class BooleanArrayReleaser { |
| 190 | public: |
| 191 | static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) { |
| 192 | _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT); |
| 193 | } |
| 194 | }; |
| 195 | class CharArrayReleaser { |
| 196 | public: |
| 197 | static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) { |
| 198 | _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT); |
| 199 | } |
| 200 | }; |
| 201 | class ShortArrayReleaser { |
| 202 | public: |
| 203 | static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) { |
| 204 | _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT); |
| 205 | } |
| 206 | }; |
| 207 | class IntArrayReleaser { |
| 208 | public: |
| 209 | static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) { |
| 210 | _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT); |
| 211 | } |
| 212 | }; |
| 213 | class LongArrayReleaser { |
| 214 | public: |
| 215 | static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) { |
| 216 | _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT); |
| 217 | } |
| 218 | }; |
| 219 | class FloatArrayReleaser { |
| 220 | public: |
| 221 | static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) { |
| 222 | _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT); |
| 223 | } |
| 224 | }; |
| 225 | class DoubleArrayReleaser { |
| 226 | public: |
| 227 | static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) { |
| 228 | _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT); |
| 229 | } |
| 230 | }; |
| 231 | |
| 232 | template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER> |
| 233 | static void |
| 234 | releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) { |
| 235 | ARRAYRELEASER::Release(_env, array, data, commit); |
| 236 | } |
| 237 | |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 238 | static void |
| 239 | releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) |
| 240 | { |
| 241 | _env->ReleasePrimitiveArrayCritical(array, data, |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 242 | commit ? 0 : JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 243 | } |
| 244 | |
| 245 | static void * |
| 246 | getDirectBufferPointer(JNIEnv *_env, jobject buffer) { |
| 247 | char* buf = (char*) _env->GetDirectBufferAddress(buffer); |
| 248 | if (buf) { |
| 249 | jint position = _env->GetIntField(buffer, positionID); |
| 250 | jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); |
| 251 | buf += position << elementSizeShift; |
| 252 | } else { |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 253 | jniThrowException(_env, "java/lang/IllegalArgumentException", |
| 254 | "Must use a native order direct Buffer"); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 255 | } |
| 256 | return (void*) buf; |
| 257 | } |
| 258 | |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 259 | // -------------------------------------------------------------------------- |
| 260 | |
| 261 | /* |
| 262 | * returns the number of values glGet returns for a given pname. |
| 263 | * |
| 264 | * The code below is written such that pnames requiring only one values |
| 265 | * are the default (and are not explicitely tested for). This makes the |
| 266 | * checking code much shorter/readable/efficient. |
| 267 | * |
| 268 | * This means that unknown pnames (e.g.: extensions) will default to 1. If |
| 269 | * that unknown pname needs more than 1 value, then the validation check |
| 270 | * is incomplete and the app may crash if it passed the wrong number params. |
| 271 | */ |
| 272 | static int getNeededCount(GLint pname) { |
| 273 | int needed = 1; |
Romain Guy | dc43a6c | 2017-02-17 19:54:25 -0800 | [diff] [blame] | 274 | #ifdef GL_ES_VERSION_3_0 |
| 275 | // GLES 3.x pnames |
| 276 | switch (pname) { |
| 277 | case GL_MAX_VIEWPORT_DIMS: |
| 278 | needed = 2; |
| 279 | break; |
| 280 | |
| 281 | case GL_PROGRAM_BINARY_FORMATS: |
| 282 | glGetIntegerv(GL_NUM_PROGRAM_BINARY_FORMATS, &needed); |
| 283 | break; |
| 284 | } |
| 285 | #endif |
| 286 | |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 287 | #ifdef GL_ES_VERSION_2_0 |
| 288 | // GLES 2.x pnames |
| 289 | switch (pname) { |
| 290 | case GL_ALIASED_LINE_WIDTH_RANGE: |
| 291 | case GL_ALIASED_POINT_SIZE_RANGE: |
| 292 | needed = 2; |
| 293 | break; |
| 294 | |
| 295 | case GL_BLEND_COLOR: |
| 296 | case GL_COLOR_CLEAR_VALUE: |
| 297 | case GL_COLOR_WRITEMASK: |
| 298 | case GL_SCISSOR_BOX: |
| 299 | case GL_VIEWPORT: |
| 300 | needed = 4; |
| 301 | break; |
| 302 | |
| 303 | case GL_COMPRESSED_TEXTURE_FORMATS: |
| 304 | glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed); |
| 305 | break; |
| 306 | |
| 307 | case GL_SHADER_BINARY_FORMATS: |
| 308 | glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed); |
| 309 | break; |
| 310 | } |
| 311 | #endif |
| 312 | |
| 313 | #ifdef GL_VERSION_ES_CM_1_1 |
| 314 | // GLES 1.x pnames |
| 315 | switch (pname) { |
| 316 | case GL_ALIASED_LINE_WIDTH_RANGE: |
| 317 | case GL_ALIASED_POINT_SIZE_RANGE: |
| 318 | case GL_DEPTH_RANGE: |
| 319 | case GL_SMOOTH_LINE_WIDTH_RANGE: |
| 320 | case GL_SMOOTH_POINT_SIZE_RANGE: |
| 321 | needed = 2; |
| 322 | break; |
| 323 | |
| 324 | case GL_CURRENT_NORMAL: |
| 325 | case GL_POINT_DISTANCE_ATTENUATION: |
| 326 | needed = 3; |
| 327 | break; |
| 328 | |
| 329 | case GL_COLOR_CLEAR_VALUE: |
| 330 | case GL_COLOR_WRITEMASK: |
| 331 | case GL_CURRENT_COLOR: |
| 332 | case GL_CURRENT_TEXTURE_COORDS: |
| 333 | case GL_FOG_COLOR: |
| 334 | case GL_LIGHT_MODEL_AMBIENT: |
| 335 | case GL_SCISSOR_BOX: |
| 336 | case GL_VIEWPORT: |
| 337 | needed = 4; |
| 338 | break; |
| 339 | |
| 340 | case GL_MODELVIEW_MATRIX: |
| 341 | case GL_PROJECTION_MATRIX: |
| 342 | case GL_TEXTURE_MATRIX: |
| 343 | needed = 16; |
| 344 | break; |
| 345 | |
| 346 | case GL_COMPRESSED_TEXTURE_FORMATS: |
| 347 | glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed); |
| 348 | break; |
| 349 | } |
| 350 | #endif |
| 351 | return needed; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 352 | } |
| 353 | |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 354 | template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY, |
| 355 | typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)> |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 356 | static void |
| 357 | get |
| 358 | (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) { |
| 359 | jint _exception = 0; |
| 360 | const char * _exceptionType; |
| 361 | const char * _exceptionMessage; |
| 362 | CTYPE *params_base = (CTYPE *) 0; |
| 363 | jint _remaining; |
| 364 | CTYPE *params = (CTYPE *) 0; |
| 365 | int _needed = 0; |
| 366 | |
| 367 | if (!params_ref) { |
| 368 | _exception = 1; |
| 369 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 370 | _exceptionMessage = "params == null"; |
| 371 | goto exit; |
| 372 | } |
| 373 | if (offset < 0) { |
| 374 | _exception = 1; |
| 375 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 376 | _exceptionMessage = "offset < 0"; |
| 377 | goto exit; |
| 378 | } |
| 379 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 380 | _needed = getNeededCount(pname); |
| 381 | // if we didn't find this pname, we just assume the user passed |
| 382 | // an array of the right size -- this might happen with extensions |
| 383 | // or if we forget an enum here. |
| 384 | if (_remaining < _needed) { |
| 385 | _exception = 1; |
| 386 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 387 | _exceptionMessage = "length - offset < needed"; |
| 388 | goto exit; |
| 389 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 390 | params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>( |
| 391 | _env, params_ref, (jboolean *)0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 392 | params = params_base + offset; |
| 393 | |
| 394 | GET( |
| 395 | (GLenum)pname, |
| 396 | (CTYPE *)params |
| 397 | ); |
| 398 | |
| 399 | exit: |
| 400 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 401 | releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>( |
| 402 | _env, params_ref, params_base, !_exception); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 403 | } |
| 404 | if (_exception) { |
| 405 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 406 | } |
| 407 | } |
| 408 | |
| 409 | |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 410 | template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY, |
| 411 | typename ARRAYRELEASER, void GET(GLenum, CTYPE*)> |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 412 | static void |
| 413 | getarray |
| 414 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
| 415 | jint _exception = 0; |
| 416 | const char * _exceptionType; |
| 417 | const char * _exceptionMessage; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 418 | JTYPEARRAY _array = (JTYPEARRAY) 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 419 | jint _bufferOffset = (jint) 0; |
| 420 | jint _remaining; |
| 421 | CTYPE *params = (CTYPE *) 0; |
| 422 | int _needed = 0; |
| 423 | |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 424 | params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 425 | _remaining /= sizeof(CTYPE); // convert from bytes to item count |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 426 | _needed = getNeededCount(pname); |
| 427 | // if we didn't find this pname, we just assume the user passed |
| 428 | // an array of the right size -- this might happen with extensions |
| 429 | // or if we forget an enum here. |
| 430 | if (_needed>0 && _remaining < _needed) { |
| 431 | _exception = 1; |
| 432 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 433 | _exceptionMessage = "remaining() < needed"; |
| 434 | goto exit; |
| 435 | } |
| 436 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 437 | char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>( |
| 438 | _env, _array, (jboolean *) 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 439 | params = (CTYPE *) (_paramsBase + _bufferOffset); |
| 440 | } |
| 441 | GET( |
| 442 | (GLenum)pname, |
| 443 | (CTYPE *)params |
| 444 | ); |
| 445 | |
| 446 | exit: |
| 447 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 448 | releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>( |
| 449 | _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 450 | } |
| 451 | if (_exception) { |
| 452 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 453 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 454 | } |
| 455 | |
| 456 | // -------------------------------------------------------------------------- |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 457 | /* void glActiveTexture ( GLenum texture ) */ |
| 458 | static void |
| 459 | android_glActiveTexture__I |
| 460 | (JNIEnv *_env, jobject _this, jint texture) { |
| 461 | glActiveTexture( |
| 462 | (GLenum)texture |
| 463 | ); |
| 464 | } |
| 465 | |
| 466 | /* void glAttachShader ( GLuint program, GLuint shader ) */ |
| 467 | static void |
| 468 | android_glAttachShader__II |
| 469 | (JNIEnv *_env, jobject _this, jint program, jint shader) { |
| 470 | glAttachShader( |
| 471 | (GLuint)program, |
| 472 | (GLuint)shader |
| 473 | ); |
| 474 | } |
| 475 | |
| 476 | /* void glBindAttribLocation ( GLuint program, GLuint index, const char *name ) */ |
| 477 | static void |
| 478 | android_glBindAttribLocation__IILjava_lang_String_2 |
| 479 | (JNIEnv *_env, jobject _this, jint program, jint index, jstring name) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 480 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 481 | const char * _exceptionType = NULL; |
| 482 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 483 | const char* _nativename = 0; |
| 484 | |
| 485 | if (!name) { |
Elliott Hughes | 428d3fc | 2013-09-24 17:15:41 -0700 | [diff] [blame] | 486 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 487 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 488 | _exceptionMessage = "name == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 489 | goto exit; |
| 490 | } |
| 491 | _nativename = _env->GetStringUTFChars(name, 0); |
| 492 | |
| 493 | glBindAttribLocation( |
| 494 | (GLuint)program, |
| 495 | (GLuint)index, |
| 496 | (char *)_nativename |
| 497 | ); |
| 498 | |
| 499 | exit: |
| 500 | if (_nativename) { |
| 501 | _env->ReleaseStringUTFChars(name, _nativename); |
| 502 | } |
| 503 | |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 504 | if (_exception) { |
| 505 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 506 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 507 | } |
| 508 | |
| 509 | /* void glBindBuffer ( GLenum target, GLuint buffer ) */ |
| 510 | static void |
| 511 | android_glBindBuffer__II |
| 512 | (JNIEnv *_env, jobject _this, jint target, jint buffer) { |
| 513 | glBindBuffer( |
| 514 | (GLenum)target, |
| 515 | (GLuint)buffer |
| 516 | ); |
| 517 | } |
| 518 | |
| 519 | /* void glBindFramebuffer ( GLenum target, GLuint framebuffer ) */ |
| 520 | static void |
| 521 | android_glBindFramebuffer__II |
| 522 | (JNIEnv *_env, jobject _this, jint target, jint framebuffer) { |
| 523 | glBindFramebuffer( |
| 524 | (GLenum)target, |
| 525 | (GLuint)framebuffer |
| 526 | ); |
| 527 | } |
| 528 | |
| 529 | /* void glBindRenderbuffer ( GLenum target, GLuint renderbuffer ) */ |
| 530 | static void |
| 531 | android_glBindRenderbuffer__II |
| 532 | (JNIEnv *_env, jobject _this, jint target, jint renderbuffer) { |
| 533 | glBindRenderbuffer( |
| 534 | (GLenum)target, |
| 535 | (GLuint)renderbuffer |
| 536 | ); |
| 537 | } |
| 538 | |
| 539 | /* void glBindTexture ( GLenum target, GLuint texture ) */ |
| 540 | static void |
| 541 | android_glBindTexture__II |
| 542 | (JNIEnv *_env, jobject _this, jint target, jint texture) { |
| 543 | glBindTexture( |
| 544 | (GLenum)target, |
| 545 | (GLuint)texture |
| 546 | ); |
| 547 | } |
| 548 | |
| 549 | /* void glBlendColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */ |
| 550 | static void |
| 551 | android_glBlendColor__FFFF |
| 552 | (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) { |
| 553 | glBlendColor( |
| 554 | (GLclampf)red, |
| 555 | (GLclampf)green, |
| 556 | (GLclampf)blue, |
| 557 | (GLclampf)alpha |
| 558 | ); |
| 559 | } |
| 560 | |
| 561 | /* void glBlendEquation ( GLenum mode ) */ |
| 562 | static void |
| 563 | android_glBlendEquation__I |
| 564 | (JNIEnv *_env, jobject _this, jint mode) { |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 565 | glBlendEquation( |
| 566 | (GLenum)mode |
| 567 | ); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 568 | } |
| 569 | |
| 570 | /* void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha ) */ |
| 571 | static void |
| 572 | android_glBlendEquationSeparate__II |
| 573 | (JNIEnv *_env, jobject _this, jint modeRGB, jint modeAlpha) { |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 574 | glBlendEquationSeparate( |
| 575 | (GLenum)modeRGB, |
| 576 | (GLenum)modeAlpha |
| 577 | ); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 578 | } |
| 579 | |
| 580 | /* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */ |
| 581 | static void |
| 582 | android_glBlendFunc__II |
| 583 | (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) { |
| 584 | glBlendFunc( |
| 585 | (GLenum)sfactor, |
| 586 | (GLenum)dfactor |
| 587 | ); |
| 588 | } |
| 589 | |
| 590 | /* void glBlendFuncSeparate ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) */ |
| 591 | static void |
| 592 | android_glBlendFuncSeparate__IIII |
| 593 | (JNIEnv *_env, jobject _this, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) { |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 594 | glBlendFuncSeparate( |
| 595 | (GLenum)srcRGB, |
| 596 | (GLenum)dstRGB, |
| 597 | (GLenum)srcAlpha, |
| 598 | (GLenum)dstAlpha |
| 599 | ); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 600 | } |
| 601 | |
| 602 | /* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */ |
| 603 | static void |
| 604 | android_glBufferData__IILjava_nio_Buffer_2I |
| 605 | (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] | 606 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 607 | const char * _exceptionType = NULL; |
| 608 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 609 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 610 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 611 | jint _remaining; |
| 612 | GLvoid *data = (GLvoid *) 0; |
| 613 | |
| 614 | if (data_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 615 | data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 616 | if (_remaining < size) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 617 | _exception = 1; |
| 618 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 619 | _exceptionMessage = "remaining() < size < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 620 | goto exit; |
| 621 | } |
| 622 | } |
Thomas Tafertshofer | 37c9b49 | 2012-07-23 16:56:04 -0700 | [diff] [blame] | 623 | if (data_buf && data == NULL) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 624 | char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 625 | data = (GLvoid *) (_dataBase + _bufferOffset); |
| 626 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 627 | glBufferData( |
| 628 | (GLenum)target, |
| 629 | (GLsizeiptr)size, |
| 630 | (GLvoid *)data, |
| 631 | (GLenum)usage |
| 632 | ); |
| 633 | |
| 634 | exit: |
| 635 | if (_array) { |
| 636 | releasePointer(_env, _array, data, JNI_FALSE); |
| 637 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 638 | if (_exception) { |
| 639 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 640 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 641 | } |
| 642 | |
| 643 | /* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */ |
| 644 | static void |
| 645 | android_glBufferSubData__IIILjava_nio_Buffer_2 |
| 646 | (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] | 647 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 648 | const char * _exceptionType = NULL; |
| 649 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 650 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 651 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 652 | jint _remaining; |
| 653 | GLvoid *data = (GLvoid *) 0; |
| 654 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 655 | if (!data_buf) { |
| 656 | _exception = 1; |
| 657 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 658 | _exceptionMessage = "data == null"; |
| 659 | goto exit; |
| 660 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 661 | data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 662 | if (_remaining < size) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 663 | _exception = 1; |
| 664 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 665 | _exceptionMessage = "remaining() < size < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 666 | goto exit; |
| 667 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 668 | if (data == NULL) { |
| 669 | char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 670 | data = (GLvoid *) (_dataBase + _bufferOffset); |
| 671 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 672 | glBufferSubData( |
| 673 | (GLenum)target, |
| 674 | (GLintptr)offset, |
| 675 | (GLsizeiptr)size, |
| 676 | (GLvoid *)data |
| 677 | ); |
| 678 | |
| 679 | exit: |
| 680 | if (_array) { |
| 681 | releasePointer(_env, _array, data, JNI_FALSE); |
| 682 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 683 | if (_exception) { |
| 684 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 685 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 686 | } |
| 687 | |
| 688 | /* GLenum glCheckFramebufferStatus ( GLenum target ) */ |
| 689 | static jint |
| 690 | android_glCheckFramebufferStatus__I |
| 691 | (JNIEnv *_env, jobject _this, jint target) { |
| 692 | GLenum _returnValue; |
| 693 | _returnValue = glCheckFramebufferStatus( |
| 694 | (GLenum)target |
| 695 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 696 | return (jint)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 697 | } |
| 698 | |
| 699 | /* void glClear ( GLbitfield mask ) */ |
| 700 | static void |
| 701 | android_glClear__I |
| 702 | (JNIEnv *_env, jobject _this, jint mask) { |
| 703 | glClear( |
| 704 | (GLbitfield)mask |
| 705 | ); |
| 706 | } |
| 707 | |
| 708 | /* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */ |
| 709 | static void |
| 710 | android_glClearColor__FFFF |
| 711 | (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) { |
| 712 | glClearColor( |
| 713 | (GLclampf)red, |
| 714 | (GLclampf)green, |
| 715 | (GLclampf)blue, |
| 716 | (GLclampf)alpha |
| 717 | ); |
| 718 | } |
| 719 | |
| 720 | /* void glClearDepthf ( GLclampf depth ) */ |
| 721 | static void |
| 722 | android_glClearDepthf__F |
| 723 | (JNIEnv *_env, jobject _this, jfloat depth) { |
| 724 | glClearDepthf( |
| 725 | (GLclampf)depth |
| 726 | ); |
| 727 | } |
| 728 | |
| 729 | /* void glClearStencil ( GLint s ) */ |
| 730 | static void |
| 731 | android_glClearStencil__I |
| 732 | (JNIEnv *_env, jobject _this, jint s) { |
| 733 | glClearStencil( |
| 734 | (GLint)s |
| 735 | ); |
| 736 | } |
| 737 | |
| 738 | /* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */ |
| 739 | static void |
| 740 | android_glColorMask__ZZZZ |
| 741 | (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) { |
| 742 | glColorMask( |
| 743 | (GLboolean)red, |
| 744 | (GLboolean)green, |
| 745 | (GLboolean)blue, |
| 746 | (GLboolean)alpha |
| 747 | ); |
| 748 | } |
| 749 | |
| 750 | /* void glCompileShader ( GLuint shader ) */ |
| 751 | static void |
| 752 | android_glCompileShader__I |
| 753 | (JNIEnv *_env, jobject _this, jint shader) { |
| 754 | glCompileShader( |
| 755 | (GLuint)shader |
| 756 | ); |
| 757 | } |
| 758 | |
| 759 | /* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */ |
| 760 | static void |
| 761 | android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 |
| 762 | (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 763 | jint _exception = 0; |
| 764 | const char * _exceptionType = NULL; |
| 765 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 766 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 767 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 768 | jint _remaining; |
| 769 | GLvoid *data = (GLvoid *) 0; |
| 770 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 771 | if (!data_buf) { |
| 772 | _exception = 1; |
| 773 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 774 | _exceptionMessage = "data == null"; |
| 775 | goto exit; |
| 776 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 777 | data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 778 | if (data == NULL) { |
| 779 | char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 780 | data = (GLvoid *) (_dataBase + _bufferOffset); |
| 781 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 782 | glCompressedTexImage2D( |
| 783 | (GLenum)target, |
| 784 | (GLint)level, |
| 785 | (GLenum)internalformat, |
| 786 | (GLsizei)width, |
| 787 | (GLsizei)height, |
| 788 | (GLint)border, |
| 789 | (GLsizei)imageSize, |
| 790 | (GLvoid *)data |
| 791 | ); |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 792 | |
| 793 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 794 | if (_array) { |
| 795 | releasePointer(_env, _array, data, JNI_FALSE); |
| 796 | } |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 797 | if (_exception) { |
| 798 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 799 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 800 | } |
| 801 | |
| 802 | /* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */ |
| 803 | static void |
| 804 | android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 |
| 805 | (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 806 | jint _exception = 0; |
| 807 | const char * _exceptionType = NULL; |
| 808 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 809 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 810 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 811 | jint _remaining; |
| 812 | GLvoid *data = (GLvoid *) 0; |
| 813 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 814 | if (!data_buf) { |
| 815 | _exception = 1; |
| 816 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 817 | _exceptionMessage = "data == null"; |
| 818 | goto exit; |
| 819 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 820 | data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 821 | if (data == NULL) { |
| 822 | char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 823 | data = (GLvoid *) (_dataBase + _bufferOffset); |
| 824 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 825 | glCompressedTexSubImage2D( |
| 826 | (GLenum)target, |
| 827 | (GLint)level, |
| 828 | (GLint)xoffset, |
| 829 | (GLint)yoffset, |
| 830 | (GLsizei)width, |
| 831 | (GLsizei)height, |
| 832 | (GLenum)format, |
| 833 | (GLsizei)imageSize, |
| 834 | (GLvoid *)data |
| 835 | ); |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 836 | |
| 837 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 838 | if (_array) { |
| 839 | releasePointer(_env, _array, data, JNI_FALSE); |
| 840 | } |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 841 | if (_exception) { |
| 842 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 843 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 844 | } |
| 845 | |
| 846 | /* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */ |
| 847 | static void |
| 848 | android_glCopyTexImage2D__IIIIIIII |
| 849 | (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) { |
| 850 | glCopyTexImage2D( |
| 851 | (GLenum)target, |
| 852 | (GLint)level, |
| 853 | (GLenum)internalformat, |
| 854 | (GLint)x, |
| 855 | (GLint)y, |
| 856 | (GLsizei)width, |
| 857 | (GLsizei)height, |
| 858 | (GLint)border |
| 859 | ); |
| 860 | } |
| 861 | |
| 862 | /* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */ |
| 863 | static void |
| 864 | android_glCopyTexSubImage2D__IIIIIIII |
| 865 | (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) { |
| 866 | glCopyTexSubImage2D( |
| 867 | (GLenum)target, |
| 868 | (GLint)level, |
| 869 | (GLint)xoffset, |
| 870 | (GLint)yoffset, |
| 871 | (GLint)x, |
| 872 | (GLint)y, |
| 873 | (GLsizei)width, |
| 874 | (GLsizei)height |
| 875 | ); |
| 876 | } |
| 877 | |
| 878 | /* GLuint glCreateProgram ( void ) */ |
| 879 | static jint |
| 880 | android_glCreateProgram__ |
| 881 | (JNIEnv *_env, jobject _this) { |
| 882 | GLuint _returnValue; |
| 883 | _returnValue = glCreateProgram(); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 884 | return (jint)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 885 | } |
| 886 | |
| 887 | /* GLuint glCreateShader ( GLenum type ) */ |
| 888 | static jint |
| 889 | android_glCreateShader__I |
| 890 | (JNIEnv *_env, jobject _this, jint type) { |
| 891 | GLuint _returnValue; |
| 892 | _returnValue = glCreateShader( |
| 893 | (GLenum)type |
| 894 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 895 | return (jint)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 896 | } |
| 897 | |
| 898 | /* void glCullFace ( GLenum mode ) */ |
| 899 | static void |
| 900 | android_glCullFace__I |
| 901 | (JNIEnv *_env, jobject _this, jint mode) { |
| 902 | glCullFace( |
| 903 | (GLenum)mode |
| 904 | ); |
| 905 | } |
| 906 | |
| 907 | /* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */ |
| 908 | static void |
| 909 | android_glDeleteBuffers__I_3II |
| 910 | (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 911 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 912 | const char * _exceptionType = NULL; |
| 913 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 914 | GLuint *buffers_base = (GLuint *) 0; |
| 915 | jint _remaining; |
| 916 | GLuint *buffers = (GLuint *) 0; |
| 917 | |
| 918 | if (!buffers_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 919 | _exception = 1; |
| 920 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 921 | _exceptionMessage = "buffers == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 922 | goto exit; |
| 923 | } |
| 924 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 925 | _exception = 1; |
| 926 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 927 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 928 | goto exit; |
| 929 | } |
| 930 | _remaining = _env->GetArrayLength(buffers_ref) - offset; |
| 931 | if (_remaining < n) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 932 | _exception = 1; |
| 933 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 934 | _exceptionMessage = "length - offset < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 935 | goto exit; |
| 936 | } |
| 937 | buffers_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 938 | _env->GetIntArrayElements(buffers_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 939 | buffers = buffers_base + offset; |
| 940 | |
| 941 | glDeleteBuffers( |
| 942 | (GLsizei)n, |
| 943 | (GLuint *)buffers |
| 944 | ); |
| 945 | |
| 946 | exit: |
| 947 | if (buffers_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 948 | _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 949 | JNI_ABORT); |
| 950 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 951 | if (_exception) { |
| 952 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 953 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 954 | } |
| 955 | |
| 956 | /* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */ |
| 957 | static void |
| 958 | android_glDeleteBuffers__ILjava_nio_IntBuffer_2 |
| 959 | (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 960 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 961 | const char * _exceptionType = NULL; |
| 962 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 963 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 964 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 965 | jint _remaining; |
| 966 | GLuint *buffers = (GLuint *) 0; |
| 967 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 968 | if (!buffers_buf) { |
| 969 | _exception = 1; |
| 970 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 971 | _exceptionMessage = "buffers == null"; |
| 972 | goto exit; |
| 973 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 974 | buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 975 | if (_remaining < n) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 976 | _exception = 1; |
| 977 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 978 | _exceptionMessage = "remaining() < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 979 | goto exit; |
| 980 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 981 | if (buffers == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 982 | char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 983 | buffers = (GLuint *) (_buffersBase + _bufferOffset); |
| 984 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 985 | glDeleteBuffers( |
| 986 | (GLsizei)n, |
| 987 | (GLuint *)buffers |
| 988 | ); |
| 989 | |
| 990 | exit: |
| 991 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 992 | _env->ReleaseIntArrayElements(_array, (jint*)buffers, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 993 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 994 | if (_exception) { |
| 995 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 996 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 997 | } |
| 998 | |
| 999 | /* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */ |
| 1000 | static void |
| 1001 | android_glDeleteFramebuffers__I_3II |
| 1002 | (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1003 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1004 | const char * _exceptionType = NULL; |
| 1005 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1006 | GLuint *framebuffers_base = (GLuint *) 0; |
| 1007 | jint _remaining; |
| 1008 | GLuint *framebuffers = (GLuint *) 0; |
| 1009 | |
| 1010 | if (!framebuffers_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1011 | _exception = 1; |
| 1012 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1013 | _exceptionMessage = "framebuffers == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1014 | goto exit; |
| 1015 | } |
| 1016 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1017 | _exception = 1; |
| 1018 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1019 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1020 | goto exit; |
| 1021 | } |
| 1022 | _remaining = _env->GetArrayLength(framebuffers_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1023 | if (_remaining < n) { |
| 1024 | _exception = 1; |
| 1025 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1026 | _exceptionMessage = "length - offset < n < needed"; |
| 1027 | goto exit; |
| 1028 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1029 | framebuffers_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1030 | _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1031 | framebuffers = framebuffers_base + offset; |
| 1032 | |
| 1033 | glDeleteFramebuffers( |
| 1034 | (GLsizei)n, |
| 1035 | (GLuint *)framebuffers |
| 1036 | ); |
| 1037 | |
| 1038 | exit: |
| 1039 | if (framebuffers_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1040 | _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1041 | JNI_ABORT); |
| 1042 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1043 | if (_exception) { |
| 1044 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1045 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1046 | } |
| 1047 | |
| 1048 | /* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */ |
| 1049 | static void |
| 1050 | android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2 |
| 1051 | (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1052 | jint _exception = 0; |
| 1053 | const char * _exceptionType = NULL; |
| 1054 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1055 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1056 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1057 | jint _remaining; |
| 1058 | GLuint *framebuffers = (GLuint *) 0; |
| 1059 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1060 | if (!framebuffers_buf) { |
| 1061 | _exception = 1; |
| 1062 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1063 | _exceptionMessage = "framebuffers == null"; |
| 1064 | goto exit; |
| 1065 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1066 | framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1067 | if (_remaining < n) { |
| 1068 | _exception = 1; |
| 1069 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1070 | _exceptionMessage = "remaining() < n < needed"; |
| 1071 | goto exit; |
| 1072 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1073 | if (framebuffers == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1074 | char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1075 | framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset); |
| 1076 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1077 | glDeleteFramebuffers( |
| 1078 | (GLsizei)n, |
| 1079 | (GLuint *)framebuffers |
| 1080 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1081 | |
| 1082 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1083 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1084 | _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1085 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1086 | if (_exception) { |
| 1087 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1088 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1089 | } |
| 1090 | |
| 1091 | /* void glDeleteProgram ( GLuint program ) */ |
| 1092 | static void |
| 1093 | android_glDeleteProgram__I |
| 1094 | (JNIEnv *_env, jobject _this, jint program) { |
| 1095 | glDeleteProgram( |
| 1096 | (GLuint)program |
| 1097 | ); |
| 1098 | } |
| 1099 | |
| 1100 | /* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */ |
| 1101 | static void |
| 1102 | android_glDeleteRenderbuffers__I_3II |
| 1103 | (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1104 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1105 | const char * _exceptionType = NULL; |
| 1106 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1107 | GLuint *renderbuffers_base = (GLuint *) 0; |
| 1108 | jint _remaining; |
| 1109 | GLuint *renderbuffers = (GLuint *) 0; |
| 1110 | |
| 1111 | if (!renderbuffers_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1112 | _exception = 1; |
| 1113 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1114 | _exceptionMessage = "renderbuffers == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1115 | goto exit; |
| 1116 | } |
| 1117 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1118 | _exception = 1; |
| 1119 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1120 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1121 | goto exit; |
| 1122 | } |
| 1123 | _remaining = _env->GetArrayLength(renderbuffers_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1124 | if (_remaining < n) { |
| 1125 | _exception = 1; |
| 1126 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1127 | _exceptionMessage = "length - offset < n < needed"; |
| 1128 | goto exit; |
| 1129 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1130 | renderbuffers_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1131 | _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1132 | renderbuffers = renderbuffers_base + offset; |
| 1133 | |
| 1134 | glDeleteRenderbuffers( |
| 1135 | (GLsizei)n, |
| 1136 | (GLuint *)renderbuffers |
| 1137 | ); |
| 1138 | |
| 1139 | exit: |
| 1140 | if (renderbuffers_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1141 | _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1142 | JNI_ABORT); |
| 1143 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1144 | if (_exception) { |
| 1145 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1146 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1147 | } |
| 1148 | |
| 1149 | /* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */ |
| 1150 | static void |
| 1151 | android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2 |
| 1152 | (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1153 | jint _exception = 0; |
| 1154 | const char * _exceptionType = NULL; |
| 1155 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1156 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1157 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1158 | jint _remaining; |
| 1159 | GLuint *renderbuffers = (GLuint *) 0; |
| 1160 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1161 | if (!renderbuffers_buf) { |
| 1162 | _exception = 1; |
| 1163 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1164 | _exceptionMessage = "renderbuffers == null"; |
| 1165 | goto exit; |
| 1166 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1167 | renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1168 | if (_remaining < n) { |
| 1169 | _exception = 1; |
| 1170 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1171 | _exceptionMessage = "remaining() < n < needed"; |
| 1172 | goto exit; |
| 1173 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1174 | if (renderbuffers == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1175 | char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1176 | renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset); |
| 1177 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1178 | glDeleteRenderbuffers( |
| 1179 | (GLsizei)n, |
| 1180 | (GLuint *)renderbuffers |
| 1181 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1182 | |
| 1183 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1184 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1185 | _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1186 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [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 glDeleteShader ( GLuint shader ) */ |
| 1193 | static void |
| 1194 | android_glDeleteShader__I |
| 1195 | (JNIEnv *_env, jobject _this, jint shader) { |
| 1196 | glDeleteShader( |
| 1197 | (GLuint)shader |
| 1198 | ); |
| 1199 | } |
| 1200 | |
| 1201 | /* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */ |
| 1202 | static void |
| 1203 | android_glDeleteTextures__I_3II |
| 1204 | (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1205 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1206 | const char * _exceptionType = NULL; |
| 1207 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1208 | GLuint *textures_base = (GLuint *) 0; |
| 1209 | jint _remaining; |
| 1210 | GLuint *textures = (GLuint *) 0; |
| 1211 | |
| 1212 | if (!textures_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1213 | _exception = 1; |
| 1214 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1215 | _exceptionMessage = "textures == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1216 | goto exit; |
| 1217 | } |
| 1218 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1219 | _exception = 1; |
| 1220 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1221 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1222 | goto exit; |
| 1223 | } |
| 1224 | _remaining = _env->GetArrayLength(textures_ref) - offset; |
| 1225 | if (_remaining < n) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1226 | _exception = 1; |
| 1227 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1228 | _exceptionMessage = "length - offset < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1229 | goto exit; |
| 1230 | } |
| 1231 | textures_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1232 | _env->GetIntArrayElements(textures_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1233 | textures = textures_base + offset; |
| 1234 | |
| 1235 | glDeleteTextures( |
| 1236 | (GLsizei)n, |
| 1237 | (GLuint *)textures |
| 1238 | ); |
| 1239 | |
| 1240 | exit: |
| 1241 | if (textures_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1242 | _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1243 | JNI_ABORT); |
| 1244 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1245 | if (_exception) { |
| 1246 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1247 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1248 | } |
| 1249 | |
| 1250 | /* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */ |
| 1251 | static void |
| 1252 | android_glDeleteTextures__ILjava_nio_IntBuffer_2 |
| 1253 | (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1254 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1255 | const char * _exceptionType = NULL; |
| 1256 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1257 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1258 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1259 | jint _remaining; |
| 1260 | GLuint *textures = (GLuint *) 0; |
| 1261 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1262 | if (!textures_buf) { |
| 1263 | _exception = 1; |
| 1264 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1265 | _exceptionMessage = "textures == null"; |
| 1266 | goto exit; |
| 1267 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1268 | textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1269 | if (_remaining < n) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1270 | _exception = 1; |
| 1271 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1272 | _exceptionMessage = "remaining() < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1273 | goto exit; |
| 1274 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1275 | if (textures == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1276 | char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1277 | textures = (GLuint *) (_texturesBase + _bufferOffset); |
| 1278 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1279 | glDeleteTextures( |
| 1280 | (GLsizei)n, |
| 1281 | (GLuint *)textures |
| 1282 | ); |
| 1283 | |
| 1284 | exit: |
| 1285 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1286 | _env->ReleaseIntArrayElements(_array, (jint*)textures, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1287 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1288 | if (_exception) { |
| 1289 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1290 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1291 | } |
| 1292 | |
| 1293 | /* void glDepthFunc ( GLenum func ) */ |
| 1294 | static void |
| 1295 | android_glDepthFunc__I |
| 1296 | (JNIEnv *_env, jobject _this, jint func) { |
| 1297 | glDepthFunc( |
| 1298 | (GLenum)func |
| 1299 | ); |
| 1300 | } |
| 1301 | |
| 1302 | /* void glDepthMask ( GLboolean flag ) */ |
| 1303 | static void |
| 1304 | android_glDepthMask__Z |
| 1305 | (JNIEnv *_env, jobject _this, jboolean flag) { |
| 1306 | glDepthMask( |
| 1307 | (GLboolean)flag |
| 1308 | ); |
| 1309 | } |
| 1310 | |
| 1311 | /* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */ |
| 1312 | static void |
| 1313 | android_glDepthRangef__FF |
| 1314 | (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) { |
| 1315 | glDepthRangef( |
| 1316 | (GLclampf)zNear, |
| 1317 | (GLclampf)zFar |
| 1318 | ); |
| 1319 | } |
| 1320 | |
| 1321 | /* void glDetachShader ( GLuint program, GLuint shader ) */ |
| 1322 | static void |
| 1323 | android_glDetachShader__II |
| 1324 | (JNIEnv *_env, jobject _this, jint program, jint shader) { |
| 1325 | glDetachShader( |
| 1326 | (GLuint)program, |
| 1327 | (GLuint)shader |
| 1328 | ); |
| 1329 | } |
| 1330 | |
| 1331 | /* void glDisable ( GLenum cap ) */ |
| 1332 | static void |
| 1333 | android_glDisable__I |
| 1334 | (JNIEnv *_env, jobject _this, jint cap) { |
| 1335 | glDisable( |
| 1336 | (GLenum)cap |
| 1337 | ); |
| 1338 | } |
| 1339 | |
| 1340 | /* void glDisableVertexAttribArray ( GLuint index ) */ |
| 1341 | static void |
| 1342 | android_glDisableVertexAttribArray__I |
| 1343 | (JNIEnv *_env, jobject _this, jint index) { |
| 1344 | glDisableVertexAttribArray( |
| 1345 | (GLuint)index |
| 1346 | ); |
| 1347 | } |
| 1348 | |
| 1349 | /* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */ |
| 1350 | static void |
| 1351 | android_glDrawArrays__III |
| 1352 | (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) { |
| 1353 | glDrawArrays( |
| 1354 | (GLenum)mode, |
| 1355 | (GLint)first, |
| 1356 | (GLsizei)count |
| 1357 | ); |
| 1358 | } |
| 1359 | |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 1360 | /* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */ |
| 1361 | static void |
| 1362 | android_glDrawElements__IIII |
| 1363 | (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1364 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1365 | const char * _exceptionType = NULL; |
| 1366 | const char * _exceptionMessage = NULL; |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 1367 | glDrawElements( |
| 1368 | (GLenum)mode, |
| 1369 | (GLsizei)count, |
| 1370 | (GLenum)type, |
Ashok Bhat | 01c26ea | 2014-02-24 09:49:07 +0000 | [diff] [blame] | 1371 | reinterpret_cast<GLvoid *>(offset) |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 1372 | ); |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1373 | if (_exception) { |
| 1374 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1375 | } |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 1376 | } |
| 1377 | |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1378 | /* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */ |
| 1379 | static void |
| 1380 | android_glDrawElements__IIILjava_nio_Buffer_2 |
| 1381 | (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] | 1382 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1383 | const char * _exceptionType = NULL; |
| 1384 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1385 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1386 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1387 | jint _remaining; |
| 1388 | GLvoid *indices = (GLvoid *) 0; |
| 1389 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1390 | if (!indices_buf) { |
| 1391 | _exception = 1; |
| 1392 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1393 | _exceptionMessage = "indices == null"; |
| 1394 | goto exit; |
| 1395 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1396 | indices = (GLvoid *)getPointer(_env, indices_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1397 | if (_remaining < count) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1398 | _exception = 1; |
| 1399 | _exceptionType = "java/lang/ArrayIndexOutOfBoundsException"; |
| 1400 | _exceptionMessage = "remaining() < count < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1401 | goto exit; |
| 1402 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1403 | if (indices == NULL) { |
| 1404 | char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1405 | indices = (GLvoid *) (_indicesBase + _bufferOffset); |
| 1406 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1407 | glDrawElements( |
| 1408 | (GLenum)mode, |
| 1409 | (GLsizei)count, |
| 1410 | (GLenum)type, |
| 1411 | (GLvoid *)indices |
| 1412 | ); |
| 1413 | |
| 1414 | exit: |
| 1415 | if (_array) { |
| 1416 | releasePointer(_env, _array, indices, JNI_FALSE); |
| 1417 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1418 | if (_exception) { |
| 1419 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1420 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1421 | } |
| 1422 | |
| 1423 | /* void glEnable ( GLenum cap ) */ |
| 1424 | static void |
| 1425 | android_glEnable__I |
| 1426 | (JNIEnv *_env, jobject _this, jint cap) { |
| 1427 | glEnable( |
| 1428 | (GLenum)cap |
| 1429 | ); |
| 1430 | } |
| 1431 | |
| 1432 | /* void glEnableVertexAttribArray ( GLuint index ) */ |
| 1433 | static void |
| 1434 | android_glEnableVertexAttribArray__I |
| 1435 | (JNIEnv *_env, jobject _this, jint index) { |
| 1436 | glEnableVertexAttribArray( |
| 1437 | (GLuint)index |
| 1438 | ); |
| 1439 | } |
| 1440 | |
| 1441 | /* void glFinish ( void ) */ |
| 1442 | static void |
| 1443 | android_glFinish__ |
| 1444 | (JNIEnv *_env, jobject _this) { |
| 1445 | glFinish(); |
| 1446 | } |
| 1447 | |
| 1448 | /* void glFlush ( void ) */ |
| 1449 | static void |
| 1450 | android_glFlush__ |
| 1451 | (JNIEnv *_env, jobject _this) { |
| 1452 | glFlush(); |
| 1453 | } |
| 1454 | |
| 1455 | /* void glFramebufferRenderbuffer ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) */ |
| 1456 | static void |
| 1457 | android_glFramebufferRenderbuffer__IIII |
| 1458 | (JNIEnv *_env, jobject _this, jint target, jint attachment, jint renderbuffertarget, jint renderbuffer) { |
| 1459 | glFramebufferRenderbuffer( |
| 1460 | (GLenum)target, |
| 1461 | (GLenum)attachment, |
| 1462 | (GLenum)renderbuffertarget, |
| 1463 | (GLuint)renderbuffer |
| 1464 | ); |
| 1465 | } |
| 1466 | |
| 1467 | /* void glFramebufferTexture2D ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) */ |
| 1468 | static void |
| 1469 | android_glFramebufferTexture2D__IIIII |
| 1470 | (JNIEnv *_env, jobject _this, jint target, jint attachment, jint textarget, jint texture, jint level) { |
| 1471 | glFramebufferTexture2D( |
| 1472 | (GLenum)target, |
| 1473 | (GLenum)attachment, |
| 1474 | (GLenum)textarget, |
| 1475 | (GLuint)texture, |
| 1476 | (GLint)level |
| 1477 | ); |
| 1478 | } |
| 1479 | |
| 1480 | /* void glFrontFace ( GLenum mode ) */ |
| 1481 | static void |
| 1482 | android_glFrontFace__I |
| 1483 | (JNIEnv *_env, jobject _this, jint mode) { |
| 1484 | glFrontFace( |
| 1485 | (GLenum)mode |
| 1486 | ); |
| 1487 | } |
| 1488 | |
| 1489 | /* void glGenBuffers ( GLsizei n, GLuint *buffers ) */ |
| 1490 | static void |
| 1491 | android_glGenBuffers__I_3II |
| 1492 | (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) { |
| 1493 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1494 | const char * _exceptionType = NULL; |
| 1495 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1496 | GLuint *buffers_base = (GLuint *) 0; |
| 1497 | jint _remaining; |
| 1498 | GLuint *buffers = (GLuint *) 0; |
| 1499 | |
| 1500 | if (!buffers_ref) { |
| 1501 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1502 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1503 | _exceptionMessage = "buffers == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1504 | goto exit; |
| 1505 | } |
| 1506 | if (offset < 0) { |
| 1507 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1508 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1509 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1510 | goto exit; |
| 1511 | } |
| 1512 | _remaining = _env->GetArrayLength(buffers_ref) - offset; |
| 1513 | if (_remaining < n) { |
| 1514 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1515 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1516 | _exceptionMessage = "length - offset < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1517 | goto exit; |
| 1518 | } |
| 1519 | buffers_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1520 | _env->GetIntArrayElements(buffers_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1521 | buffers = buffers_base + offset; |
| 1522 | |
| 1523 | glGenBuffers( |
| 1524 | (GLsizei)n, |
| 1525 | (GLuint *)buffers |
| 1526 | ); |
| 1527 | |
| 1528 | exit: |
| 1529 | if (buffers_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1530 | _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1531 | _exception ? JNI_ABORT: 0); |
| 1532 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1533 | if (_exception) { |
| 1534 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1535 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1536 | } |
| 1537 | |
| 1538 | /* void glGenBuffers ( GLsizei n, GLuint *buffers ) */ |
| 1539 | static void |
| 1540 | android_glGenBuffers__ILjava_nio_IntBuffer_2 |
| 1541 | (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) { |
| 1542 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1543 | const char * _exceptionType = NULL; |
| 1544 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1545 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1546 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1547 | jint _remaining; |
| 1548 | GLuint *buffers = (GLuint *) 0; |
| 1549 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1550 | if (!buffers_buf) { |
| 1551 | _exception = 1; |
| 1552 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1553 | _exceptionMessage = "buffers == null"; |
| 1554 | goto exit; |
| 1555 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1556 | buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1557 | if (_remaining < n) { |
| 1558 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1559 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1560 | _exceptionMessage = "remaining() < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1561 | goto exit; |
| 1562 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1563 | if (buffers == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1564 | char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1565 | buffers = (GLuint *) (_buffersBase + _bufferOffset); |
| 1566 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1567 | glGenBuffers( |
| 1568 | (GLsizei)n, |
| 1569 | (GLuint *)buffers |
| 1570 | ); |
| 1571 | |
| 1572 | exit: |
| 1573 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1574 | _env->ReleaseIntArrayElements(_array, (jint*)buffers, _exception ? JNI_ABORT : 0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1575 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1576 | if (_exception) { |
| 1577 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1578 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1579 | } |
| 1580 | |
| 1581 | /* void glGenerateMipmap ( GLenum target ) */ |
| 1582 | static void |
| 1583 | android_glGenerateMipmap__I |
| 1584 | (JNIEnv *_env, jobject _this, jint target) { |
| 1585 | glGenerateMipmap( |
| 1586 | (GLenum)target |
| 1587 | ); |
| 1588 | } |
| 1589 | |
| 1590 | /* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */ |
| 1591 | static void |
| 1592 | android_glGenFramebuffers__I_3II |
| 1593 | (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) { |
| 1594 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1595 | const char * _exceptionType = NULL; |
| 1596 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1597 | GLuint *framebuffers_base = (GLuint *) 0; |
| 1598 | jint _remaining; |
| 1599 | GLuint *framebuffers = (GLuint *) 0; |
| 1600 | |
| 1601 | if (!framebuffers_ref) { |
| 1602 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1603 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1604 | _exceptionMessage = "framebuffers == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1605 | goto exit; |
| 1606 | } |
| 1607 | if (offset < 0) { |
| 1608 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1609 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1610 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1611 | goto exit; |
| 1612 | } |
| 1613 | _remaining = _env->GetArrayLength(framebuffers_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1614 | if (_remaining < n) { |
| 1615 | _exception = 1; |
| 1616 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1617 | _exceptionMessage = "length - offset < n < needed"; |
| 1618 | goto exit; |
| 1619 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1620 | framebuffers_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1621 | _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1622 | framebuffers = framebuffers_base + offset; |
| 1623 | |
| 1624 | glGenFramebuffers( |
| 1625 | (GLsizei)n, |
| 1626 | (GLuint *)framebuffers |
| 1627 | ); |
| 1628 | |
| 1629 | exit: |
| 1630 | if (framebuffers_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1631 | _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1632 | _exception ? JNI_ABORT: 0); |
| 1633 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1634 | if (_exception) { |
| 1635 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1636 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1637 | } |
| 1638 | |
| 1639 | /* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */ |
| 1640 | static void |
| 1641 | android_glGenFramebuffers__ILjava_nio_IntBuffer_2 |
| 1642 | (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1643 | jint _exception = 0; |
| 1644 | const char * _exceptionType = NULL; |
| 1645 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1646 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1647 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1648 | jint _remaining; |
| 1649 | GLuint *framebuffers = (GLuint *) 0; |
| 1650 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1651 | if (!framebuffers_buf) { |
| 1652 | _exception = 1; |
| 1653 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1654 | _exceptionMessage = "framebuffers == null"; |
| 1655 | goto exit; |
| 1656 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1657 | framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1658 | if (_remaining < n) { |
| 1659 | _exception = 1; |
| 1660 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1661 | _exceptionMessage = "remaining() < n < needed"; |
| 1662 | goto exit; |
| 1663 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1664 | if (framebuffers == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1665 | char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1666 | framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset); |
| 1667 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1668 | glGenFramebuffers( |
| 1669 | (GLsizei)n, |
| 1670 | (GLuint *)framebuffers |
| 1671 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1672 | |
| 1673 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1674 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1675 | _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1676 | } |
| 1677 | if (_exception) { |
| 1678 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1679 | } |
| 1680 | } |
| 1681 | |
| 1682 | /* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */ |
| 1683 | static void |
| 1684 | android_glGenRenderbuffers__I_3II |
| 1685 | (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) { |
| 1686 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1687 | const char * _exceptionType = NULL; |
| 1688 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1689 | GLuint *renderbuffers_base = (GLuint *) 0; |
| 1690 | jint _remaining; |
| 1691 | GLuint *renderbuffers = (GLuint *) 0; |
| 1692 | |
| 1693 | if (!renderbuffers_ref) { |
| 1694 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1695 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1696 | _exceptionMessage = "renderbuffers == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1697 | goto exit; |
| 1698 | } |
| 1699 | if (offset < 0) { |
| 1700 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1701 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1702 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1703 | goto exit; |
| 1704 | } |
| 1705 | _remaining = _env->GetArrayLength(renderbuffers_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1706 | if (_remaining < n) { |
| 1707 | _exception = 1; |
| 1708 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1709 | _exceptionMessage = "length - offset < n < needed"; |
| 1710 | goto exit; |
| 1711 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1712 | renderbuffers_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1713 | _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1714 | renderbuffers = renderbuffers_base + offset; |
| 1715 | |
| 1716 | glGenRenderbuffers( |
| 1717 | (GLsizei)n, |
| 1718 | (GLuint *)renderbuffers |
| 1719 | ); |
| 1720 | |
| 1721 | exit: |
| 1722 | if (renderbuffers_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1723 | _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1724 | _exception ? JNI_ABORT: 0); |
| 1725 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1726 | if (_exception) { |
| 1727 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1728 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1729 | } |
| 1730 | |
| 1731 | /* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */ |
| 1732 | static void |
| 1733 | android_glGenRenderbuffers__ILjava_nio_IntBuffer_2 |
| 1734 | (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1735 | jint _exception = 0; |
| 1736 | const char * _exceptionType = NULL; |
| 1737 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1738 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1739 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1740 | jint _remaining; |
| 1741 | GLuint *renderbuffers = (GLuint *) 0; |
| 1742 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1743 | if (!renderbuffers_buf) { |
| 1744 | _exception = 1; |
| 1745 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1746 | _exceptionMessage = "renderbuffers == null"; |
| 1747 | goto exit; |
| 1748 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1749 | renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1750 | if (_remaining < n) { |
| 1751 | _exception = 1; |
| 1752 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1753 | _exceptionMessage = "remaining() < n < needed"; |
| 1754 | goto exit; |
| 1755 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1756 | if (renderbuffers == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1757 | char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1758 | renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset); |
| 1759 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1760 | glGenRenderbuffers( |
| 1761 | (GLsizei)n, |
| 1762 | (GLuint *)renderbuffers |
| 1763 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1764 | |
| 1765 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1766 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1767 | _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1768 | } |
| 1769 | if (_exception) { |
| 1770 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1771 | } |
| 1772 | } |
| 1773 | |
| 1774 | /* void glGenTextures ( GLsizei n, GLuint *textures ) */ |
| 1775 | static void |
| 1776 | android_glGenTextures__I_3II |
| 1777 | (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) { |
| 1778 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1779 | const char * _exceptionType = NULL; |
| 1780 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1781 | GLuint *textures_base = (GLuint *) 0; |
| 1782 | jint _remaining; |
| 1783 | GLuint *textures = (GLuint *) 0; |
| 1784 | |
| 1785 | if (!textures_ref) { |
| 1786 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1787 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1788 | _exceptionMessage = "textures == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1789 | goto exit; |
| 1790 | } |
| 1791 | if (offset < 0) { |
| 1792 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1793 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1794 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1795 | goto exit; |
| 1796 | } |
| 1797 | _remaining = _env->GetArrayLength(textures_ref) - offset; |
| 1798 | if (_remaining < n) { |
| 1799 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1800 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1801 | _exceptionMessage = "length - offset < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1802 | goto exit; |
| 1803 | } |
| 1804 | textures_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1805 | _env->GetIntArrayElements(textures_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1806 | textures = textures_base + offset; |
| 1807 | |
| 1808 | glGenTextures( |
| 1809 | (GLsizei)n, |
| 1810 | (GLuint *)textures |
| 1811 | ); |
| 1812 | |
| 1813 | exit: |
| 1814 | if (textures_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1815 | _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1816 | _exception ? JNI_ABORT: 0); |
| 1817 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1818 | if (_exception) { |
| 1819 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1820 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1821 | } |
| 1822 | |
| 1823 | /* void glGenTextures ( GLsizei n, GLuint *textures ) */ |
| 1824 | static void |
| 1825 | android_glGenTextures__ILjava_nio_IntBuffer_2 |
| 1826 | (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) { |
| 1827 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1828 | const char * _exceptionType = NULL; |
| 1829 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1830 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1831 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1832 | jint _remaining; |
| 1833 | GLuint *textures = (GLuint *) 0; |
| 1834 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1835 | if (!textures_buf) { |
| 1836 | _exception = 1; |
| 1837 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1838 | _exceptionMessage = "textures == null"; |
| 1839 | goto exit; |
| 1840 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1841 | textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1842 | if (_remaining < n) { |
| 1843 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1844 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1845 | _exceptionMessage = "remaining() < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1846 | goto exit; |
| 1847 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1848 | if (textures == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1849 | char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1850 | textures = (GLuint *) (_texturesBase + _bufferOffset); |
| 1851 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1852 | glGenTextures( |
| 1853 | (GLsizei)n, |
| 1854 | (GLuint *)textures |
| 1855 | ); |
| 1856 | |
| 1857 | exit: |
| 1858 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1859 | _env->ReleaseIntArrayElements(_array, (jint*)textures, _exception ? JNI_ABORT : 0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1860 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1861 | if (_exception) { |
| 1862 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1863 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1864 | } |
| 1865 | |
| 1866 | /* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 1867 | static void |
| 1868 | android_glGetActiveAttrib__III_3II_3II_3II_3BI |
| 1869 | (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) { |
| 1870 | jint _exception = 0; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1871 | const char * _exceptionType; |
| 1872 | const char * _exceptionMessage; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1873 | GLsizei *length_base = (GLsizei *) 0; |
| 1874 | jint _lengthRemaining; |
| 1875 | GLsizei *length = (GLsizei *) 0; |
| 1876 | GLint *size_base = (GLint *) 0; |
| 1877 | jint _sizeRemaining; |
| 1878 | GLint *size = (GLint *) 0; |
| 1879 | GLenum *type_base = (GLenum *) 0; |
| 1880 | jint _typeRemaining; |
| 1881 | GLenum *type = (GLenum *) 0; |
| 1882 | char *name_base = (char *) 0; |
| 1883 | jint _nameRemaining; |
| 1884 | char *name = (char *) 0; |
| 1885 | |
Pablo Ceballos | 6aff906 | 2015-10-01 18:35:39 -0700 | [diff] [blame] | 1886 | if (length_ref) { |
| 1887 | if (lengthOffset < 0) { |
| 1888 | _exception = 1; |
| 1889 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1890 | _exceptionMessage = "lengthOffset < 0"; |
| 1891 | goto exit; |
| 1892 | } |
| 1893 | _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; |
| 1894 | length_base = (GLsizei *) |
| 1895 | _env->GetIntArrayElements(length_ref, (jboolean *)0); |
| 1896 | length = length_base + lengthOffset; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1897 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1898 | |
| 1899 | if (!size_ref) { |
| 1900 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1901 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1902 | _exceptionMessage = "size == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1903 | goto exit; |
| 1904 | } |
| 1905 | if (sizeOffset < 0) { |
| 1906 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1907 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1908 | _exceptionMessage = "sizeOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1909 | goto exit; |
| 1910 | } |
| 1911 | _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; |
| 1912 | size_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1913 | _env->GetIntArrayElements(size_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1914 | size = size_base + sizeOffset; |
| 1915 | |
| 1916 | if (!type_ref) { |
| 1917 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1918 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1919 | _exceptionMessage = "type == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1920 | goto exit; |
| 1921 | } |
| 1922 | if (typeOffset < 0) { |
| 1923 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1924 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1925 | _exceptionMessage = "typeOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1926 | goto exit; |
| 1927 | } |
| 1928 | _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; |
| 1929 | type_base = (GLenum *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1930 | _env->GetIntArrayElements(type_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1931 | type = type_base + typeOffset; |
| 1932 | |
| 1933 | if (!name_ref) { |
| 1934 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1935 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1936 | _exceptionMessage = "name == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1937 | goto exit; |
| 1938 | } |
| 1939 | if (nameOffset < 0) { |
| 1940 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1941 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1942 | _exceptionMessage = "nameOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1943 | goto exit; |
| 1944 | } |
| 1945 | _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset; |
| 1946 | name_base = (char *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1947 | _env->GetByteArrayElements(name_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1948 | name = name_base + nameOffset; |
| 1949 | |
| 1950 | glGetActiveAttrib( |
| 1951 | (GLuint)program, |
| 1952 | (GLuint)index, |
| 1953 | (GLsizei)bufsize, |
| 1954 | (GLsizei *)length, |
| 1955 | (GLint *)size, |
| 1956 | (GLenum *)type, |
| 1957 | (char *)name |
| 1958 | ); |
| 1959 | |
| 1960 | exit: |
| 1961 | if (name_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1962 | _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1963 | _exception ? JNI_ABORT: 0); |
| 1964 | } |
| 1965 | if (type_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1966 | _env->ReleaseIntArrayElements(type_ref, (jint*)type_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1967 | _exception ? JNI_ABORT: 0); |
| 1968 | } |
| 1969 | if (size_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1970 | _env->ReleaseIntArrayElements(size_ref, (jint*)size_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1971 | _exception ? JNI_ABORT: 0); |
| 1972 | } |
| 1973 | if (length_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1974 | _env->ReleaseIntArrayElements(length_ref, (jint*)length_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1975 | _exception ? JNI_ABORT: 0); |
| 1976 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1977 | if (_exception) { |
| 1978 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1979 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1980 | } |
| 1981 | |
| 1982 | /* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 1983 | static void |
| 1984 | android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B |
| 1985 | (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1986 | jintArray _lengthArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1987 | jint _lengthBufferOffset = (jint) 0; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1988 | jintArray _sizeArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1989 | jint _sizeBufferOffset = (jint) 0; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1990 | jintArray _typeArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1991 | jint _typeBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1992 | jint _lengthRemaining; |
| 1993 | GLsizei *length = (GLsizei *) 0; |
| 1994 | jint _sizeRemaining; |
| 1995 | GLint *size = (GLint *) 0; |
| 1996 | jint _typeRemaining; |
| 1997 | GLenum *type = (GLenum *) 0; |
| 1998 | |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1999 | length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset); |
| 2000 | size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset); |
| 2001 | type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2002 | if (length == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2003 | char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2004 | length = (GLsizei *) (_lengthBase + _lengthBufferOffset); |
| 2005 | } |
| 2006 | if (size == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2007 | char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2008 | size = (GLint *) (_sizeBase + _sizeBufferOffset); |
| 2009 | } |
| 2010 | if (type == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2011 | char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2012 | type = (GLenum *) (_typeBase + _typeBufferOffset); |
| 2013 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2014 | glGetActiveAttrib( |
| 2015 | (GLuint)program, |
| 2016 | (GLuint)index, |
| 2017 | (GLsizei)bufsize, |
| 2018 | (GLsizei *)length, |
| 2019 | (GLint *)size, |
| 2020 | (GLenum *)type, |
Ashok Bhat | 01c26ea | 2014-02-24 09:49:07 +0000 | [diff] [blame] | 2021 | reinterpret_cast<char *>(name) |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2022 | ); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2023 | if (_typeArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2024 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2025 | } |
| 2026 | if (_sizeArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2027 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2028 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2029 | if (_lengthArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2030 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2031 | } |
| 2032 | } |
| 2033 | |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2034 | /* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 2035 | static jstring |
| 2036 | android_glGetActiveAttrib1 |
| 2037 | (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) { |
| 2038 | jint _exception = 0; |
| 2039 | const char * _exceptionType; |
| 2040 | const char * _exceptionMessage; |
| 2041 | GLint *size_base = (GLint *) 0; |
| 2042 | jint _sizeRemaining; |
| 2043 | GLint *size = (GLint *) 0; |
| 2044 | GLenum *type_base = (GLenum *) 0; |
| 2045 | jint _typeRemaining; |
| 2046 | GLenum *type = (GLenum *) 0; |
| 2047 | |
| 2048 | jstring result = 0; |
| 2049 | |
| 2050 | GLint len = 0; |
| 2051 | glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len); |
| 2052 | if (!len) { |
| 2053 | return _env->NewStringUTF(""); |
| 2054 | } |
| 2055 | char* buf = (char*) malloc(len); |
| 2056 | |
| 2057 | if (buf == NULL) { |
| 2058 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 2059 | return NULL; |
| 2060 | } |
| 2061 | if (!size_ref) { |
| 2062 | _exception = 1; |
| 2063 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2064 | _exceptionMessage = "size == null"; |
| 2065 | goto exit; |
| 2066 | } |
| 2067 | if (sizeOffset < 0) { |
| 2068 | _exception = 1; |
| 2069 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2070 | _exceptionMessage = "sizeOffset < 0"; |
| 2071 | goto exit; |
| 2072 | } |
| 2073 | _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; |
| 2074 | size_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2075 | _env->GetIntArrayElements(size_ref, (jboolean *)0); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2076 | size = size_base + sizeOffset; |
| 2077 | |
| 2078 | if (!type_ref) { |
| 2079 | _exception = 1; |
| 2080 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2081 | _exceptionMessage = "type == null"; |
| 2082 | goto exit; |
| 2083 | } |
| 2084 | if (typeOffset < 0) { |
| 2085 | _exception = 1; |
| 2086 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2087 | _exceptionMessage = "typeOffset < 0"; |
| 2088 | goto exit; |
| 2089 | } |
| 2090 | _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; |
| 2091 | type_base = (GLenum *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2092 | _env->GetIntArrayElements(type_ref, (jboolean *)0); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2093 | type = type_base + typeOffset; |
| 2094 | |
| 2095 | glGetActiveAttrib( |
| 2096 | (GLuint)program, |
| 2097 | (GLuint)index, |
| 2098 | (GLsizei)len, |
| 2099 | NULL, |
| 2100 | (GLint *)size, |
| 2101 | (GLenum *)type, |
| 2102 | (char *)buf |
| 2103 | ); |
| 2104 | exit: |
| 2105 | if (type_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2106 | _env->ReleaseIntArrayElements(type_ref, (jint*)type_base, |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2107 | _exception ? JNI_ABORT: 0); |
| 2108 | } |
| 2109 | if (size_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2110 | _env->ReleaseIntArrayElements(size_ref, (jint*)size_base, |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2111 | _exception ? JNI_ABORT: 0); |
| 2112 | } |
| 2113 | if (_exception != 1) { |
| 2114 | result = _env->NewStringUTF(buf); |
| 2115 | } |
| 2116 | if (buf) { |
| 2117 | free(buf); |
| 2118 | } |
| 2119 | if (_exception) { |
| 2120 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2121 | } |
| 2122 | if (result == 0) { |
| 2123 | result = _env->NewStringUTF(""); |
| 2124 | } |
| 2125 | |
| 2126 | return result; |
| 2127 | } |
| 2128 | |
| 2129 | /* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 2130 | static jstring |
| 2131 | android_glGetActiveAttrib2 |
| 2132 | (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2133 | jintArray _sizeArray = (jintArray) 0; |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2134 | jint _sizeBufferOffset = (jint) 0; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2135 | jintArray _typeArray = (jintArray) 0; |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2136 | jint _typeBufferOffset = (jint) 0; |
| 2137 | jint _lengthRemaining; |
| 2138 | GLsizei *length = (GLsizei *) 0; |
| 2139 | jint _sizeRemaining; |
| 2140 | GLint *size = (GLint *) 0; |
| 2141 | jint _typeRemaining; |
| 2142 | GLenum *type = (GLenum *) 0; |
| 2143 | |
| 2144 | jstring result = 0; |
| 2145 | |
| 2146 | GLint len = 0; |
| 2147 | glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len); |
| 2148 | if (!len) { |
| 2149 | return _env->NewStringUTF(""); |
| 2150 | } |
| 2151 | char* buf = (char*) malloc(len); |
| 2152 | |
| 2153 | if (buf == NULL) { |
| 2154 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 2155 | return NULL; |
| 2156 | } |
| 2157 | |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2158 | size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset); |
| 2159 | type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2160 | if (size == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2161 | char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2162 | size = (GLint *) (_sizeBase + _sizeBufferOffset); |
| 2163 | } |
| 2164 | if (type == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2165 | char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2166 | type = (GLenum *) (_typeBase + _typeBufferOffset); |
| 2167 | } |
| 2168 | glGetActiveAttrib( |
| 2169 | (GLuint)program, |
| 2170 | (GLuint)index, |
| 2171 | (GLsizei)len, |
| 2172 | NULL, |
| 2173 | (GLint *)size, |
| 2174 | (GLenum *)type, |
| 2175 | (char *)buf |
| 2176 | ); |
| 2177 | |
| 2178 | if (_typeArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2179 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2180 | } |
| 2181 | if (_sizeArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2182 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2183 | } |
| 2184 | result = _env->NewStringUTF(buf); |
| 2185 | if (buf) { |
| 2186 | free(buf); |
| 2187 | } |
| 2188 | return result; |
| 2189 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2190 | /* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 2191 | static void |
| 2192 | android_glGetActiveUniform__III_3II_3II_3II_3BI |
| 2193 | (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) { |
| 2194 | jint _exception = 0; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2195 | const char * _exceptionType; |
| 2196 | const char * _exceptionMessage; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2197 | GLsizei *length_base = (GLsizei *) 0; |
| 2198 | jint _lengthRemaining; |
| 2199 | GLsizei *length = (GLsizei *) 0; |
| 2200 | GLint *size_base = (GLint *) 0; |
| 2201 | jint _sizeRemaining; |
| 2202 | GLint *size = (GLint *) 0; |
| 2203 | GLenum *type_base = (GLenum *) 0; |
| 2204 | jint _typeRemaining; |
| 2205 | GLenum *type = (GLenum *) 0; |
| 2206 | char *name_base = (char *) 0; |
| 2207 | jint _nameRemaining; |
| 2208 | char *name = (char *) 0; |
| 2209 | |
Pablo Ceballos | 6aff906 | 2015-10-01 18:35:39 -0700 | [diff] [blame] | 2210 | if (length_ref) { |
| 2211 | if (lengthOffset < 0) { |
| 2212 | _exception = 1; |
| 2213 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2214 | _exceptionMessage = "lengthOffset < 0"; |
| 2215 | goto exit; |
| 2216 | } |
| 2217 | _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; |
| 2218 | length_base = (GLsizei *) |
| 2219 | _env->GetIntArrayElements(length_ref, (jboolean *)0); |
| 2220 | length = length_base + lengthOffset; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2221 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2222 | |
| 2223 | if (!size_ref) { |
| 2224 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2225 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2226 | _exceptionMessage = "size == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2227 | goto exit; |
| 2228 | } |
| 2229 | if (sizeOffset < 0) { |
| 2230 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2231 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2232 | _exceptionMessage = "sizeOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2233 | goto exit; |
| 2234 | } |
| 2235 | _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; |
| 2236 | size_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2237 | _env->GetIntArrayElements(size_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2238 | size = size_base + sizeOffset; |
| 2239 | |
| 2240 | if (!type_ref) { |
| 2241 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2242 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2243 | _exceptionMessage = "type == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2244 | goto exit; |
| 2245 | } |
| 2246 | if (typeOffset < 0) { |
| 2247 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2248 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2249 | _exceptionMessage = "typeOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2250 | goto exit; |
| 2251 | } |
| 2252 | _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; |
| 2253 | type_base = (GLenum *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2254 | _env->GetIntArrayElements(type_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2255 | type = type_base + typeOffset; |
| 2256 | |
| 2257 | if (!name_ref) { |
| 2258 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2259 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2260 | _exceptionMessage = "name == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2261 | goto exit; |
| 2262 | } |
| 2263 | if (nameOffset < 0) { |
| 2264 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2265 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2266 | _exceptionMessage = "nameOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2267 | goto exit; |
| 2268 | } |
| 2269 | _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset; |
| 2270 | name_base = (char *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2271 | _env->GetByteArrayElements(name_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2272 | name = name_base + nameOffset; |
| 2273 | |
| 2274 | glGetActiveUniform( |
| 2275 | (GLuint)program, |
| 2276 | (GLuint)index, |
| 2277 | (GLsizei)bufsize, |
| 2278 | (GLsizei *)length, |
| 2279 | (GLint *)size, |
| 2280 | (GLenum *)type, |
| 2281 | (char *)name |
| 2282 | ); |
| 2283 | |
| 2284 | exit: |
| 2285 | if (name_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2286 | _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2287 | _exception ? JNI_ABORT: 0); |
| 2288 | } |
| 2289 | if (type_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2290 | _env->ReleaseIntArrayElements(type_ref, (jint*)type_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2291 | _exception ? JNI_ABORT: 0); |
| 2292 | } |
| 2293 | if (size_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2294 | _env->ReleaseIntArrayElements(size_ref, (jint*)size_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2295 | _exception ? JNI_ABORT: 0); |
| 2296 | } |
| 2297 | if (length_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2298 | _env->ReleaseIntArrayElements(length_ref, (jint*)length_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2299 | _exception ? JNI_ABORT: 0); |
| 2300 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2301 | if (_exception) { |
| 2302 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2303 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2304 | } |
| 2305 | |
| 2306 | /* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 2307 | static void |
| 2308 | android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B |
| 2309 | (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2310 | jintArray _lengthArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2311 | jint _lengthBufferOffset = (jint) 0; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2312 | jintArray _sizeArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2313 | jint _sizeBufferOffset = (jint) 0; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2314 | jintArray _typeArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2315 | jint _typeBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2316 | jint _lengthRemaining; |
| 2317 | GLsizei *length = (GLsizei *) 0; |
| 2318 | jint _sizeRemaining; |
| 2319 | GLint *size = (GLint *) 0; |
| 2320 | jint _typeRemaining; |
| 2321 | GLenum *type = (GLenum *) 0; |
| 2322 | |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2323 | length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset); |
| 2324 | size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset); |
| 2325 | type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2326 | if (length == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2327 | char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2328 | length = (GLsizei *) (_lengthBase + _lengthBufferOffset); |
| 2329 | } |
| 2330 | if (size == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2331 | char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2332 | size = (GLint *) (_sizeBase + _sizeBufferOffset); |
| 2333 | } |
| 2334 | if (type == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2335 | char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2336 | type = (GLenum *) (_typeBase + _typeBufferOffset); |
| 2337 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2338 | glGetActiveUniform( |
| 2339 | (GLuint)program, |
| 2340 | (GLuint)index, |
| 2341 | (GLsizei)bufsize, |
| 2342 | (GLsizei *)length, |
| 2343 | (GLint *)size, |
| 2344 | (GLenum *)type, |
Ashok Bhat | 01c26ea | 2014-02-24 09:49:07 +0000 | [diff] [blame] | 2345 | reinterpret_cast<char *>(name) |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2346 | ); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2347 | if (_typeArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2348 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2349 | } |
| 2350 | if (_sizeArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2351 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2352 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2353 | if (_lengthArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2354 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2355 | } |
| 2356 | } |
| 2357 | |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2358 | /* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 2359 | static jstring |
| 2360 | android_glGetActiveUniform1 |
| 2361 | (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) { |
| 2362 | jint _exception = 0; |
| 2363 | const char * _exceptionType; |
| 2364 | const char * _exceptionMessage; |
| 2365 | |
| 2366 | GLint *size_base = (GLint *) 0; |
| 2367 | jint _sizeRemaining; |
| 2368 | GLint *size = (GLint *) 0; |
| 2369 | |
| 2370 | GLenum *type_base = (GLenum *) 0; |
| 2371 | jint _typeRemaining; |
| 2372 | GLenum *type = (GLenum *) 0; |
| 2373 | |
| 2374 | jstring result = 0; |
| 2375 | |
| 2376 | GLint len = 0; |
| 2377 | glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len); |
| 2378 | if (!len) { |
| 2379 | return _env->NewStringUTF(""); |
| 2380 | } |
| 2381 | char* buf = (char*) malloc(len); |
| 2382 | |
| 2383 | if (buf == NULL) { |
| 2384 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 2385 | return NULL; |
| 2386 | } |
| 2387 | |
| 2388 | if (!size_ref) { |
| 2389 | _exception = 1; |
| 2390 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2391 | _exceptionMessage = "size == null"; |
| 2392 | goto exit; |
| 2393 | } |
| 2394 | if (sizeOffset < 0) { |
| 2395 | _exception = 1; |
| 2396 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2397 | _exceptionMessage = "sizeOffset < 0"; |
| 2398 | goto exit; |
| 2399 | } |
| 2400 | _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; |
| 2401 | size_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2402 | _env->GetIntArrayElements(size_ref, (jboolean *)0); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2403 | size = size_base + sizeOffset; |
| 2404 | |
| 2405 | if (!type_ref) { |
| 2406 | _exception = 1; |
| 2407 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2408 | _exceptionMessage = "type == null"; |
| 2409 | goto exit; |
| 2410 | } |
| 2411 | if (typeOffset < 0) { |
| 2412 | _exception = 1; |
| 2413 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2414 | _exceptionMessage = "typeOffset < 0"; |
| 2415 | goto exit; |
| 2416 | } |
| 2417 | _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; |
| 2418 | type_base = (GLenum *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2419 | _env->GetIntArrayElements(type_ref, (jboolean *)0); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2420 | type = type_base + typeOffset; |
| 2421 | |
| 2422 | glGetActiveUniform( |
| 2423 | (GLuint)program, |
| 2424 | (GLuint)index, |
| 2425 | (GLsizei)len, |
| 2426 | NULL, |
| 2427 | (GLint *)size, |
| 2428 | (GLenum *)type, |
| 2429 | (char *)buf |
| 2430 | ); |
| 2431 | |
| 2432 | exit: |
| 2433 | if (type_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2434 | _env->ReleaseIntArrayElements(type_ref, (jint*)type_base, |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2435 | _exception ? JNI_ABORT: 0); |
| 2436 | } |
| 2437 | if (size_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2438 | _env->ReleaseIntArrayElements(size_ref, (jint*)size_base, |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2439 | _exception ? JNI_ABORT: 0); |
| 2440 | } |
| 2441 | if (_exception != 1) { |
| 2442 | result = _env->NewStringUTF(buf); |
| 2443 | } |
| 2444 | if (buf) { |
| 2445 | free(buf); |
| 2446 | } |
| 2447 | if (_exception) { |
| 2448 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2449 | } |
| 2450 | if (result == 0) { |
| 2451 | result = _env->NewStringUTF(""); |
| 2452 | } |
| 2453 | return result; |
| 2454 | } |
| 2455 | |
| 2456 | /* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 2457 | static jstring |
| 2458 | android_glGetActiveUniform2 |
| 2459 | (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2460 | jintArray _sizeArray = (jintArray) 0; |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2461 | jint _sizeBufferOffset = (jint) 0; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2462 | jintArray _typeArray = (jintArray) 0; |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2463 | jint _typeBufferOffset = (jint) 0; |
| 2464 | jint _sizeRemaining; |
| 2465 | GLint *size = (GLint *) 0; |
| 2466 | jint _typeRemaining; |
| 2467 | GLenum *type = (GLenum *) 0; |
| 2468 | |
| 2469 | jstring result = 0; |
| 2470 | GLint len = 0; |
| 2471 | glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len); |
| 2472 | if (!len) { |
| 2473 | return _env->NewStringUTF(""); |
| 2474 | } |
| 2475 | char* buf = (char*) malloc(len); |
| 2476 | |
| 2477 | if (buf == NULL) { |
| 2478 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 2479 | return NULL; |
| 2480 | } |
| 2481 | |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2482 | size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset); |
| 2483 | type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2484 | |
| 2485 | if (size == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2486 | char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2487 | size = (GLint *) (_sizeBase + _sizeBufferOffset); |
| 2488 | } |
| 2489 | if (type == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2490 | char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2491 | type = (GLenum *) (_typeBase + _typeBufferOffset); |
| 2492 | } |
| 2493 | glGetActiveUniform( |
| 2494 | (GLuint)program, |
| 2495 | (GLuint)index, |
| 2496 | len, |
| 2497 | NULL, |
| 2498 | (GLint *)size, |
| 2499 | (GLenum *)type, |
| 2500 | (char *)buf |
| 2501 | ); |
| 2502 | |
| 2503 | if (_typeArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2504 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2505 | } |
| 2506 | if (_sizeArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2507 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2508 | } |
| 2509 | result = _env->NewStringUTF(buf); |
| 2510 | if (buf) { |
| 2511 | free(buf); |
| 2512 | } |
| 2513 | return result; |
| 2514 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2515 | /* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */ |
| 2516 | static void |
| 2517 | android_glGetAttachedShaders__II_3II_3II |
| 2518 | (JNIEnv *_env, jobject _this, jint program, jint maxcount, jintArray count_ref, jint countOffset, jintArray shaders_ref, jint shadersOffset) { |
| 2519 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2520 | const char * _exceptionType = NULL; |
| 2521 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2522 | GLsizei *count_base = (GLsizei *) 0; |
| 2523 | jint _countRemaining; |
| 2524 | GLsizei *count = (GLsizei *) 0; |
| 2525 | GLuint *shaders_base = (GLuint *) 0; |
| 2526 | jint _shadersRemaining; |
| 2527 | GLuint *shaders = (GLuint *) 0; |
| 2528 | |
Pablo Ceballos | 6aff906 | 2015-10-01 18:35:39 -0700 | [diff] [blame] | 2529 | if (count_ref) { |
| 2530 | if (countOffset < 0) { |
| 2531 | _exception = 1; |
| 2532 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2533 | _exceptionMessage = "countOffset < 0"; |
| 2534 | goto exit; |
| 2535 | } |
| 2536 | _countRemaining = _env->GetArrayLength(count_ref) - countOffset; |
| 2537 | if (_countRemaining < 1) { |
| 2538 | _exception = 1; |
| 2539 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2540 | _exceptionMessage = "length - countOffset < 1 < needed"; |
| 2541 | goto exit; |
| 2542 | } |
| 2543 | count_base = (GLsizei *) |
| 2544 | _env->GetIntArrayElements(count_ref, (jboolean *)0); |
| 2545 | count = count_base + countOffset; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2546 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2547 | |
| 2548 | if (!shaders_ref) { |
| 2549 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2550 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2551 | _exceptionMessage = "shaders == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2552 | goto exit; |
| 2553 | } |
| 2554 | if (shadersOffset < 0) { |
| 2555 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2556 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2557 | _exceptionMessage = "shadersOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2558 | goto exit; |
| 2559 | } |
| 2560 | _shadersRemaining = _env->GetArrayLength(shaders_ref) - shadersOffset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2561 | if (_shadersRemaining < maxcount) { |
| 2562 | _exception = 1; |
| 2563 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2564 | _exceptionMessage = "length - shadersOffset < maxcount < needed"; |
| 2565 | goto exit; |
| 2566 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2567 | shaders_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2568 | _env->GetIntArrayElements(shaders_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2569 | shaders = shaders_base + shadersOffset; |
| 2570 | |
| 2571 | glGetAttachedShaders( |
| 2572 | (GLuint)program, |
| 2573 | (GLsizei)maxcount, |
| 2574 | (GLsizei *)count, |
| 2575 | (GLuint *)shaders |
| 2576 | ); |
| 2577 | |
| 2578 | exit: |
| 2579 | if (shaders_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2580 | _env->ReleaseIntArrayElements(shaders_ref, (jint*)shaders_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2581 | _exception ? JNI_ABORT: 0); |
| 2582 | } |
| 2583 | if (count_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2584 | _env->ReleaseIntArrayElements(count_ref, (jint*)count_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2585 | _exception ? JNI_ABORT: 0); |
| 2586 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2587 | if (_exception) { |
| 2588 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2589 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2590 | } |
| 2591 | |
| 2592 | /* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */ |
| 2593 | static void |
| 2594 | android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 |
| 2595 | (JNIEnv *_env, jobject _this, jint program, jint maxcount, jobject count_buf, jobject shaders_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2596 | jint _exception = 0; |
| 2597 | const char * _exceptionType = NULL; |
| 2598 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2599 | jintArray _countArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2600 | jint _countBufferOffset = (jint) 0; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2601 | jintArray _shadersArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2602 | jint _shadersBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2603 | jint _countRemaining; |
| 2604 | GLsizei *count = (GLsizei *) 0; |
| 2605 | jint _shadersRemaining; |
| 2606 | GLuint *shaders = (GLuint *) 0; |
| 2607 | |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2608 | if (count_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2609 | count = (GLsizei *)getPointer(_env, count_buf, (jarray*)&_countArray, &_countRemaining, &_countBufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2610 | if (_countRemaining < 1) { |
| 2611 | _exception = 1; |
| 2612 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2613 | _exceptionMessage = "remaining() < 1 < needed"; |
| 2614 | goto exit; |
| 2615 | } |
| 2616 | } |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2617 | if (!shaders_buf) { |
| 2618 | _exception = 1; |
| 2619 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2620 | _exceptionMessage = "shaders == null"; |
| 2621 | goto exit; |
| 2622 | } |
Pablo Ceballos | 6aff906 | 2015-10-01 18:35:39 -0700 | [diff] [blame] | 2623 | shaders = (GLuint *)getPointer(_env, shaders_buf, (jarray*)&_shadersArray, &_shadersRemaining, &_shadersBufferOffset); |
| 2624 | if (_shadersRemaining < maxcount) { |
| 2625 | _exception = 1; |
| 2626 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2627 | _exceptionMessage = "remaining() < maxcount < needed"; |
| 2628 | goto exit; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2629 | } |
| 2630 | if (count_buf && count == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2631 | char * _countBase = (char *)_env->GetIntArrayElements(_countArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2632 | count = (GLsizei *) (_countBase + _countBufferOffset); |
| 2633 | } |
Pablo Ceballos | 6aff906 | 2015-10-01 18:35:39 -0700 | [diff] [blame] | 2634 | if (shaders == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2635 | char * _shadersBase = (char *)_env->GetIntArrayElements(_shadersArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2636 | shaders = (GLuint *) (_shadersBase + _shadersBufferOffset); |
| 2637 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2638 | glGetAttachedShaders( |
| 2639 | (GLuint)program, |
| 2640 | (GLsizei)maxcount, |
| 2641 | (GLsizei *)count, |
| 2642 | (GLuint *)shaders |
| 2643 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2644 | |
| 2645 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2646 | if (_shadersArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2647 | _env->ReleaseIntArrayElements(_shadersArray, (jint*)shaders, _exception ? JNI_ABORT : 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2648 | } |
| 2649 | if (_countArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2650 | _env->ReleaseIntArrayElements(_countArray, (jint*)count, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2651 | } |
| 2652 | if (_exception) { |
| 2653 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2654 | } |
| 2655 | } |
| 2656 | |
Mathias Agopian | 89be00b | 2013-02-22 20:08:06 -0800 | [diff] [blame] | 2657 | /* GLint glGetAttribLocation ( GLuint program, const char *name ) */ |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2658 | static jint |
| 2659 | android_glGetAttribLocation__ILjava_lang_String_2 |
| 2660 | (JNIEnv *_env, jobject _this, jint program, jstring name) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2661 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2662 | const char * _exceptionType = NULL; |
| 2663 | const char * _exceptionMessage = NULL; |
Mathias Agopian | 89be00b | 2013-02-22 20:08:06 -0800 | [diff] [blame] | 2664 | GLint _returnValue = 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2665 | const char* _nativename = 0; |
| 2666 | |
| 2667 | if (!name) { |
Elliott Hughes | 428d3fc | 2013-09-24 17:15:41 -0700 | [diff] [blame] | 2668 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2669 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2670 | _exceptionMessage = "name == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2671 | goto exit; |
| 2672 | } |
| 2673 | _nativename = _env->GetStringUTFChars(name, 0); |
| 2674 | |
| 2675 | _returnValue = glGetAttribLocation( |
| 2676 | (GLuint)program, |
| 2677 | (char *)_nativename |
| 2678 | ); |
| 2679 | |
| 2680 | exit: |
| 2681 | if (_nativename) { |
| 2682 | _env->ReleaseStringUTFChars(name, _nativename); |
| 2683 | } |
| 2684 | |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2685 | if (_exception) { |
| 2686 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2687 | } |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 2688 | return (jint)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2689 | } |
| 2690 | |
| 2691 | /* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ |
| 2692 | static void |
| 2693 | android_glGetBooleanv__I_3ZI |
| 2694 | (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2695 | get<jbooleanArray, BooleanArrayGetter, jboolean*, BooleanArrayReleaser, GLboolean, glGetBooleanv>( |
| 2696 | _env, _this, pname, params_ref, offset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2697 | } |
| 2698 | |
| 2699 | /* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ |
| 2700 | static void |
| 2701 | android_glGetBooleanv__ILjava_nio_IntBuffer_2 |
| 2702 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2703 | getarray<GLboolean, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetBooleanv>( |
| 2704 | _env, _this, pname, params_buf); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2705 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2706 | /* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 2707 | static void |
| 2708 | android_glGetBufferParameteriv__II_3II |
| 2709 | (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] | 2710 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2711 | const char * _exceptionType = NULL; |
| 2712 | const char * _exceptionMessage = NULL; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2713 | GLint *params_base = (GLint *) 0; |
| 2714 | jint _remaining; |
| 2715 | GLint *params = (GLint *) 0; |
| 2716 | |
| 2717 | if (!params_ref) { |
| 2718 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2719 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2720 | _exceptionMessage = "params == null"; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2721 | goto exit; |
| 2722 | } |
| 2723 | if (offset < 0) { |
| 2724 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2725 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2726 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2727 | goto exit; |
| 2728 | } |
| 2729 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2730 | if (_remaining < 1) { |
| 2731 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2732 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2733 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2734 | goto exit; |
| 2735 | } |
| 2736 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2737 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2738 | params = params_base + offset; |
| 2739 | |
| 2740 | glGetBufferParameteriv( |
| 2741 | (GLenum)target, |
| 2742 | (GLenum)pname, |
| 2743 | (GLint *)params |
| 2744 | ); |
| 2745 | |
| 2746 | exit: |
| 2747 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2748 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2749 | _exception ? JNI_ABORT: 0); |
| 2750 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2751 | if (_exception) { |
| 2752 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2753 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2754 | } |
| 2755 | |
| 2756 | /* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 2757 | static void |
| 2758 | android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 |
| 2759 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2760 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2761 | const char * _exceptionType = NULL; |
| 2762 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2763 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2764 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2765 | jint _remaining; |
| 2766 | GLint *params = (GLint *) 0; |
| 2767 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2768 | if (!params_buf) { |
| 2769 | _exception = 1; |
| 2770 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2771 | _exceptionMessage = "params == null"; |
| 2772 | goto exit; |
| 2773 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2774 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2775 | if (_remaining < 1) { |
| 2776 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2777 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2778 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2779 | goto exit; |
| 2780 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2781 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2782 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2783 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 2784 | } |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2785 | glGetBufferParameteriv( |
| 2786 | (GLenum)target, |
| 2787 | (GLenum)pname, |
| 2788 | (GLint *)params |
| 2789 | ); |
| 2790 | |
| 2791 | exit: |
| 2792 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2793 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2794 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2795 | if (_exception) { |
| 2796 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2797 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2798 | } |
| 2799 | |
| 2800 | /* GLenum glGetError ( void ) */ |
| 2801 | static jint |
| 2802 | android_glGetError__ |
| 2803 | (JNIEnv *_env, jobject _this) { |
| 2804 | GLenum _returnValue; |
| 2805 | _returnValue = glGetError(); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 2806 | return (jint)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2807 | } |
| 2808 | |
| 2809 | /* void glGetFloatv ( GLenum pname, GLfloat *params ) */ |
| 2810 | static void |
| 2811 | android_glGetFloatv__I_3FI |
| 2812 | (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2813 | get<jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, GLfloat, glGetFloatv>( |
| 2814 | _env, _this, pname, params_ref, offset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2815 | } |
| 2816 | |
| 2817 | /* void glGetFloatv ( GLenum pname, GLfloat *params ) */ |
| 2818 | static void |
| 2819 | android_glGetFloatv__ILjava_nio_FloatBuffer_2 |
| 2820 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2821 | getarray<GLfloat, jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, glGetFloatv>( |
| 2822 | _env, _this, pname, params_buf); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2823 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2824 | /* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */ |
| 2825 | static void |
| 2826 | android_glGetFramebufferAttachmentParameteriv__III_3II |
| 2827 | (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) { |
| 2828 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2829 | const char * _exceptionType = NULL; |
| 2830 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2831 | GLint *params_base = (GLint *) 0; |
| 2832 | jint _remaining; |
| 2833 | GLint *params = (GLint *) 0; |
| 2834 | |
| 2835 | if (!params_ref) { |
| 2836 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2837 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2838 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2839 | goto exit; |
| 2840 | } |
| 2841 | if (offset < 0) { |
| 2842 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2843 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2844 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2845 | goto exit; |
| 2846 | } |
| 2847 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2848 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2849 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2850 | params = params_base + offset; |
| 2851 | |
| 2852 | glGetFramebufferAttachmentParameteriv( |
| 2853 | (GLenum)target, |
| 2854 | (GLenum)attachment, |
| 2855 | (GLenum)pname, |
| 2856 | (GLint *)params |
| 2857 | ); |
| 2858 | |
| 2859 | exit: |
| 2860 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2861 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2862 | _exception ? JNI_ABORT: 0); |
| 2863 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2864 | if (_exception) { |
| 2865 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2866 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2867 | } |
| 2868 | |
| 2869 | /* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */ |
| 2870 | static void |
| 2871 | android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 |
| 2872 | (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2873 | jint _exception = 0; |
| 2874 | const char * _exceptionType = NULL; |
| 2875 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2876 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2877 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2878 | jint _remaining; |
| 2879 | GLint *params = (GLint *) 0; |
| 2880 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2881 | if (!params_buf) { |
| 2882 | _exception = 1; |
| 2883 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2884 | _exceptionMessage = "params == null"; |
| 2885 | goto exit; |
| 2886 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2887 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2888 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2889 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2890 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 2891 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2892 | glGetFramebufferAttachmentParameteriv( |
| 2893 | (GLenum)target, |
| 2894 | (GLenum)attachment, |
| 2895 | (GLenum)pname, |
| 2896 | (GLint *)params |
| 2897 | ); |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2898 | |
| 2899 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2900 | if (_array) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2901 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
| 2902 | } |
| 2903 | if (_exception) { |
| 2904 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2905 | } |
| 2906 | } |
| 2907 | |
| 2908 | /* void glGetIntegerv ( GLenum pname, GLint *params ) */ |
| 2909 | static void |
| 2910 | android_glGetIntegerv__I_3II |
| 2911 | (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2912 | get<jintArray, IntArrayGetter, jint*, IntArrayReleaser, GLint, glGetIntegerv>( |
| 2913 | _env, _this, pname, params_ref, offset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2914 | } |
| 2915 | |
| 2916 | /* void glGetIntegerv ( GLenum pname, GLint *params ) */ |
| 2917 | static void |
| 2918 | android_glGetIntegerv__ILjava_nio_IntBuffer_2 |
| 2919 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2920 | getarray<GLint, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetIntegerv>( |
| 2921 | _env, _this, pname, params_buf); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2922 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2923 | /* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */ |
| 2924 | static void |
| 2925 | android_glGetProgramiv__II_3II |
| 2926 | (JNIEnv *_env, jobject _this, jint program, jint pname, jintArray params_ref, jint offset) { |
| 2927 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2928 | const char * _exceptionType = NULL; |
| 2929 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2930 | GLint *params_base = (GLint *) 0; |
| 2931 | jint _remaining; |
| 2932 | GLint *params = (GLint *) 0; |
| 2933 | |
| 2934 | if (!params_ref) { |
| 2935 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2936 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2937 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2938 | goto exit; |
| 2939 | } |
| 2940 | if (offset < 0) { |
| 2941 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2942 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2943 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2944 | goto exit; |
| 2945 | } |
| 2946 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2947 | if (_remaining < 1) { |
| 2948 | _exception = 1; |
| 2949 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2950 | _exceptionMessage = "length - offset < 1 < needed"; |
| 2951 | goto exit; |
| 2952 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2953 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2954 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2955 | params = params_base + offset; |
| 2956 | |
| 2957 | glGetProgramiv( |
| 2958 | (GLuint)program, |
| 2959 | (GLenum)pname, |
| 2960 | (GLint *)params |
| 2961 | ); |
| 2962 | |
| 2963 | exit: |
| 2964 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2965 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2966 | _exception ? JNI_ABORT: 0); |
| 2967 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2968 | if (_exception) { |
| 2969 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2970 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2971 | } |
| 2972 | |
| 2973 | /* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */ |
| 2974 | static void |
| 2975 | android_glGetProgramiv__IILjava_nio_IntBuffer_2 |
| 2976 | (JNIEnv *_env, jobject _this, jint program, jint pname, jobject params_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2977 | jint _exception = 0; |
| 2978 | const char * _exceptionType = NULL; |
| 2979 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2980 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2981 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2982 | jint _remaining; |
| 2983 | GLint *params = (GLint *) 0; |
| 2984 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2985 | if (!params_buf) { |
| 2986 | _exception = 1; |
| 2987 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2988 | _exceptionMessage = "params == null"; |
| 2989 | goto exit; |
| 2990 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2991 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2992 | if (_remaining < 1) { |
| 2993 | _exception = 1; |
| 2994 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2995 | _exceptionMessage = "remaining() < 1 < needed"; |
| 2996 | goto exit; |
| 2997 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2998 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2999 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3000 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 3001 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3002 | glGetProgramiv( |
| 3003 | (GLuint)program, |
| 3004 | (GLenum)pname, |
| 3005 | (GLint *)params |
| 3006 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3007 | |
| 3008 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3009 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3010 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3011 | } |
| 3012 | if (_exception) { |
| 3013 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3014 | } |
| 3015 | } |
| 3016 | |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 3017 | #include <stdlib.h> |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3018 | |
| 3019 | /* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */ |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 3020 | static jstring android_glGetProgramInfoLog(JNIEnv *_env, jobject, jint shader) { |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3021 | GLint infoLen = 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3022 | glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen); |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 3023 | if (!infoLen) { |
| 3024 | return _env->NewStringUTF(""); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3025 | } |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 3026 | char* buf = (char*) malloc(infoLen); |
| 3027 | if (buf == NULL) { |
| 3028 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 3029 | return NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3030 | } |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 3031 | glGetProgramInfoLog(shader, infoLen, NULL, buf); |
| 3032 | jstring result = _env->NewStringUTF(buf); |
| 3033 | free(buf); |
| 3034 | return result; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3035 | } |
| 3036 | /* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 3037 | static void |
| 3038 | android_glGetRenderbufferParameteriv__II_3II |
| 3039 | (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { |
| 3040 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3041 | const char * _exceptionType = NULL; |
| 3042 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3043 | GLint *params_base = (GLint *) 0; |
| 3044 | jint _remaining; |
| 3045 | GLint *params = (GLint *) 0; |
| 3046 | |
| 3047 | if (!params_ref) { |
| 3048 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3049 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3050 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3051 | goto exit; |
| 3052 | } |
| 3053 | if (offset < 0) { |
| 3054 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3055 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3056 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3057 | goto exit; |
| 3058 | } |
| 3059 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3060 | if (_remaining < 1) { |
| 3061 | _exception = 1; |
| 3062 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3063 | _exceptionMessage = "length - offset < 1 < needed"; |
| 3064 | goto exit; |
| 3065 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3066 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3067 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3068 | params = params_base + offset; |
| 3069 | |
| 3070 | glGetRenderbufferParameteriv( |
| 3071 | (GLenum)target, |
| 3072 | (GLenum)pname, |
| 3073 | (GLint *)params |
| 3074 | ); |
| 3075 | |
| 3076 | exit: |
| 3077 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3078 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3079 | _exception ? JNI_ABORT: 0); |
| 3080 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3081 | if (_exception) { |
| 3082 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3083 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3084 | } |
| 3085 | |
| 3086 | /* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 3087 | static void |
| 3088 | android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2 |
| 3089 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3090 | jint _exception = 0; |
| 3091 | const char * _exceptionType = NULL; |
| 3092 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3093 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3094 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3095 | jint _remaining; |
| 3096 | GLint *params = (GLint *) 0; |
| 3097 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3098 | if (!params_buf) { |
| 3099 | _exception = 1; |
| 3100 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3101 | _exceptionMessage = "params == null"; |
| 3102 | goto exit; |
| 3103 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3104 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3105 | if (_remaining < 1) { |
| 3106 | _exception = 1; |
| 3107 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3108 | _exceptionMessage = "remaining() < 1 < needed"; |
| 3109 | goto exit; |
| 3110 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3111 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3112 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3113 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 3114 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3115 | glGetRenderbufferParameteriv( |
| 3116 | (GLenum)target, |
| 3117 | (GLenum)pname, |
| 3118 | (GLint *)params |
| 3119 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3120 | |
| 3121 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3122 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3123 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3124 | } |
| 3125 | if (_exception) { |
| 3126 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3127 | } |
| 3128 | } |
| 3129 | |
| 3130 | /* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */ |
| 3131 | static void |
| 3132 | android_glGetShaderiv__II_3II |
| 3133 | (JNIEnv *_env, jobject _this, jint shader, jint pname, jintArray params_ref, jint offset) { |
| 3134 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3135 | const char * _exceptionType = NULL; |
| 3136 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3137 | GLint *params_base = (GLint *) 0; |
| 3138 | jint _remaining; |
| 3139 | GLint *params = (GLint *) 0; |
| 3140 | |
| 3141 | if (!params_ref) { |
| 3142 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3143 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3144 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3145 | goto exit; |
| 3146 | } |
| 3147 | if (offset < 0) { |
| 3148 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3149 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3150 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3151 | goto exit; |
| 3152 | } |
| 3153 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3154 | if (_remaining < 1) { |
| 3155 | _exception = 1; |
| 3156 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3157 | _exceptionMessage = "length - offset < 1 < needed"; |
| 3158 | goto exit; |
| 3159 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3160 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3161 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3162 | params = params_base + offset; |
| 3163 | |
| 3164 | glGetShaderiv( |
| 3165 | (GLuint)shader, |
| 3166 | (GLenum)pname, |
| 3167 | (GLint *)params |
| 3168 | ); |
| 3169 | |
| 3170 | exit: |
| 3171 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3172 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3173 | _exception ? JNI_ABORT: 0); |
| 3174 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3175 | if (_exception) { |
| 3176 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3177 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3178 | } |
| 3179 | |
| 3180 | /* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */ |
| 3181 | static void |
| 3182 | android_glGetShaderiv__IILjava_nio_IntBuffer_2 |
| 3183 | (JNIEnv *_env, jobject _this, jint shader, jint pname, jobject params_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3184 | jint _exception = 0; |
| 3185 | const char * _exceptionType = NULL; |
| 3186 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3187 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3188 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3189 | jint _remaining; |
| 3190 | GLint *params = (GLint *) 0; |
| 3191 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3192 | if (!params_buf) { |
| 3193 | _exception = 1; |
| 3194 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3195 | _exceptionMessage = "params == null"; |
| 3196 | goto exit; |
| 3197 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3198 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3199 | if (_remaining < 1) { |
| 3200 | _exception = 1; |
| 3201 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3202 | _exceptionMessage = "remaining() < 1 < needed"; |
| 3203 | goto exit; |
| 3204 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3205 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3206 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3207 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 3208 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3209 | glGetShaderiv( |
| 3210 | (GLuint)shader, |
| 3211 | (GLenum)pname, |
| 3212 | (GLint *)params |
| 3213 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3214 | |
| 3215 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3216 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3217 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3218 | } |
| 3219 | if (_exception) { |
| 3220 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3221 | } |
| 3222 | } |
| 3223 | |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 3224 | #include <stdlib.h> |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3225 | |
| 3226 | /* void glGetShaderInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */ |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 3227 | static jstring android_glGetShaderInfoLog(JNIEnv *_env, jobject, jint shader) { |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3228 | GLint infoLen = 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3229 | glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen); |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 3230 | if (!infoLen) { |
Romain Guy | e842e50 | 2016-11-29 19:26:29 -0800 | [diff] [blame] | 3231 | infoLen = 512; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3232 | } |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 3233 | char* buf = (char*) malloc(infoLen); |
| 3234 | if (buf == NULL) { |
| 3235 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 3236 | return NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3237 | } |
Romain Guy | e842e50 | 2016-11-29 19:26:29 -0800 | [diff] [blame] | 3238 | GLsizei outLen = 0; |
| 3239 | glGetShaderInfoLog(shader, infoLen, &outLen, buf); |
| 3240 | jstring result = _env->NewStringUTF(outLen == 0 ? "" : buf); |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 3241 | free(buf); |
| 3242 | return result; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3243 | } |
| 3244 | /* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */ |
| 3245 | static void |
| 3246 | android_glGetShaderPrecisionFormat__II_3II_3II |
| 3247 | (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jintArray range_ref, jint rangeOffset, jintArray precision_ref, jint precisionOffset) { |
| 3248 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3249 | const char * _exceptionType = NULL; |
| 3250 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3251 | GLint *range_base = (GLint *) 0; |
| 3252 | jint _rangeRemaining; |
| 3253 | GLint *range = (GLint *) 0; |
| 3254 | GLint *precision_base = (GLint *) 0; |
| 3255 | jint _precisionRemaining; |
| 3256 | GLint *precision = (GLint *) 0; |
| 3257 | |
| 3258 | if (!range_ref) { |
| 3259 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3260 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3261 | _exceptionMessage = "range == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3262 | goto exit; |
| 3263 | } |
| 3264 | if (rangeOffset < 0) { |
| 3265 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3266 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3267 | _exceptionMessage = "rangeOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3268 | goto exit; |
| 3269 | } |
| 3270 | _rangeRemaining = _env->GetArrayLength(range_ref) - rangeOffset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3271 | if (_rangeRemaining < 1) { |
| 3272 | _exception = 1; |
| 3273 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3274 | _exceptionMessage = "length - rangeOffset < 1 < needed"; |
| 3275 | goto exit; |
| 3276 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3277 | range_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3278 | _env->GetIntArrayElements(range_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3279 | range = range_base + rangeOffset; |
| 3280 | |
| 3281 | if (!precision_ref) { |
| 3282 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3283 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3284 | _exceptionMessage = "precision == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3285 | goto exit; |
| 3286 | } |
| 3287 | if (precisionOffset < 0) { |
| 3288 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3289 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3290 | _exceptionMessage = "precisionOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3291 | goto exit; |
| 3292 | } |
| 3293 | _precisionRemaining = _env->GetArrayLength(precision_ref) - precisionOffset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3294 | if (_precisionRemaining < 1) { |
| 3295 | _exception = 1; |
| 3296 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3297 | _exceptionMessage = "length - precisionOffset < 1 < needed"; |
| 3298 | goto exit; |
| 3299 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3300 | precision_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3301 | _env->GetIntArrayElements(precision_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3302 | precision = precision_base + precisionOffset; |
| 3303 | |
| 3304 | glGetShaderPrecisionFormat( |
| 3305 | (GLenum)shadertype, |
| 3306 | (GLenum)precisiontype, |
| 3307 | (GLint *)range, |
| 3308 | (GLint *)precision |
| 3309 | ); |
| 3310 | |
| 3311 | exit: |
| 3312 | if (precision_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3313 | _env->ReleaseIntArrayElements(precision_ref, (jint*)precision_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3314 | _exception ? JNI_ABORT: 0); |
| 3315 | } |
| 3316 | if (range_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3317 | _env->ReleaseIntArrayElements(range_ref, (jint*)range_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3318 | _exception ? JNI_ABORT: 0); |
| 3319 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3320 | if (_exception) { |
| 3321 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3322 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3323 | } |
| 3324 | |
| 3325 | /* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */ |
| 3326 | static void |
| 3327 | android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 |
| 3328 | (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jobject range_buf, jobject precision_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3329 | jint _exception = 0; |
| 3330 | const char * _exceptionType = NULL; |
| 3331 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3332 | jintArray _rangeArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3333 | jint _rangeBufferOffset = (jint) 0; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3334 | jintArray _precisionArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3335 | jint _precisionBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3336 | jint _rangeRemaining; |
| 3337 | GLint *range = (GLint *) 0; |
| 3338 | jint _precisionRemaining; |
| 3339 | GLint *precision = (GLint *) 0; |
| 3340 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3341 | if (!range_buf) { |
| 3342 | _exception = 1; |
| 3343 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3344 | _exceptionMessage = "range == null"; |
| 3345 | goto exit; |
| 3346 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3347 | range = (GLint *)getPointer(_env, range_buf, (jarray*)&_rangeArray, &_rangeRemaining, &_rangeBufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3348 | if (_rangeRemaining < 1) { |
| 3349 | _exception = 1; |
| 3350 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3351 | _exceptionMessage = "remaining() < 1 < needed"; |
| 3352 | goto exit; |
| 3353 | } |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3354 | if (!precision_buf) { |
| 3355 | _exception = 1; |
| 3356 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3357 | _exceptionMessage = "precision == null"; |
| 3358 | goto exit; |
| 3359 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3360 | precision = (GLint *)getPointer(_env, precision_buf, (jarray*)&_precisionArray, &_precisionRemaining, &_precisionBufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3361 | if (_precisionRemaining < 1) { |
| 3362 | _exception = 1; |
| 3363 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3364 | _exceptionMessage = "remaining() < 1 < needed"; |
| 3365 | goto exit; |
| 3366 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3367 | if (range == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3368 | char * _rangeBase = (char *)_env->GetIntArrayElements(_rangeArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3369 | range = (GLint *) (_rangeBase + _rangeBufferOffset); |
| 3370 | } |
| 3371 | if (precision == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3372 | char * _precisionBase = (char *)_env->GetIntArrayElements(_precisionArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3373 | precision = (GLint *) (_precisionBase + _precisionBufferOffset); |
| 3374 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3375 | glGetShaderPrecisionFormat( |
| 3376 | (GLenum)shadertype, |
| 3377 | (GLenum)precisiontype, |
| 3378 | (GLint *)range, |
| 3379 | (GLint *)precision |
| 3380 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3381 | |
| 3382 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3383 | if (_precisionArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3384 | _env->ReleaseIntArrayElements(_precisionArray, (jint*)precision, _exception ? JNI_ABORT : 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3385 | } |
| 3386 | if (_rangeArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3387 | _env->ReleaseIntArrayElements(_rangeArray, (jint*)range, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3388 | } |
| 3389 | if (_exception) { |
| 3390 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3391 | } |
| 3392 | } |
| 3393 | |
| 3394 | /* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */ |
| 3395 | static void |
| 3396 | android_glGetShaderSource__II_3II_3BI |
| 3397 | (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jintArray length_ref, jint lengthOffset, jbyteArray source_ref, jint sourceOffset) { |
| 3398 | jint _exception = 0; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3399 | const char * _exceptionType; |
| 3400 | const char * _exceptionMessage; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3401 | GLsizei *length_base = (GLsizei *) 0; |
| 3402 | jint _lengthRemaining; |
| 3403 | GLsizei *length = (GLsizei *) 0; |
| 3404 | char *source_base = (char *) 0; |
| 3405 | jint _sourceRemaining; |
| 3406 | char *source = (char *) 0; |
| 3407 | |
Pablo Ceballos | 6aff906 | 2015-10-01 18:35:39 -0700 | [diff] [blame] | 3408 | if (length_ref) { |
| 3409 | if (lengthOffset < 0) { |
| 3410 | _exception = 1; |
| 3411 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3412 | _exceptionMessage = "lengthOffset < 0"; |
| 3413 | goto exit; |
| 3414 | } |
| 3415 | _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; |
| 3416 | length_base = (GLsizei *) |
| 3417 | _env->GetIntArrayElements(length_ref, (jboolean *)0); |
| 3418 | length = length_base + lengthOffset; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3419 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3420 | |
| 3421 | if (!source_ref) { |
| 3422 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3423 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3424 | _exceptionMessage = "source == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3425 | goto exit; |
| 3426 | } |
| 3427 | if (sourceOffset < 0) { |
| 3428 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3429 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3430 | _exceptionMessage = "sourceOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3431 | goto exit; |
| 3432 | } |
| 3433 | _sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset; |
| 3434 | source_base = (char *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3435 | _env->GetByteArrayElements(source_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3436 | source = source_base + sourceOffset; |
| 3437 | |
| 3438 | glGetShaderSource( |
| 3439 | (GLuint)shader, |
| 3440 | (GLsizei)bufsize, |
| 3441 | (GLsizei *)length, |
| 3442 | (char *)source |
| 3443 | ); |
| 3444 | |
| 3445 | exit: |
| 3446 | if (source_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3447 | _env->ReleaseByteArrayElements(source_ref, (jbyte*)source_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3448 | _exception ? JNI_ABORT: 0); |
| 3449 | } |
| 3450 | if (length_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3451 | _env->ReleaseIntArrayElements(length_ref, (jint*)length_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3452 | _exception ? JNI_ABORT: 0); |
| 3453 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3454 | if (_exception) { |
| 3455 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3456 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3457 | } |
| 3458 | |
| 3459 | /* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */ |
| 3460 | static void |
| 3461 | android_glGetShaderSource__IILjava_nio_IntBuffer_2B |
| 3462 | (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jobject length_buf, jbyte source) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3463 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3464 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3465 | jint _remaining; |
| 3466 | GLsizei *length = (GLsizei *) 0; |
| 3467 | |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3468 | length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3469 | if (length == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3470 | char * _lengthBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3471 | length = (GLsizei *) (_lengthBase + _bufferOffset); |
| 3472 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3473 | glGetShaderSource( |
| 3474 | (GLuint)shader, |
| 3475 | (GLsizei)bufsize, |
| 3476 | (GLsizei *)length, |
Ashok Bhat | 01c26ea | 2014-02-24 09:49:07 +0000 | [diff] [blame] | 3477 | reinterpret_cast<char *>(source) |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3478 | ); |
| 3479 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3480 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _array, (jint*)length, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3481 | } |
| 3482 | } |
| 3483 | |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 3484 | /* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */ |
| 3485 | static jstring android_glGetShaderSource(JNIEnv *_env, jobject, jint shader) { |
| 3486 | GLint shaderLen = 0; |
| 3487 | glGetShaderiv((GLuint)shader, GL_SHADER_SOURCE_LENGTH, &shaderLen); |
| 3488 | if (!shaderLen) { |
| 3489 | return _env->NewStringUTF(""); |
| 3490 | } |
| 3491 | char* buf = (char*) malloc(shaderLen); |
| 3492 | if (buf == NULL) { |
| 3493 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 3494 | return NULL; |
| 3495 | } |
| 3496 | glGetShaderSource(shader, shaderLen, NULL, buf); |
| 3497 | jstring result = _env->NewStringUTF(buf); |
| 3498 | free(buf); |
| 3499 | return result; |
| 3500 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3501 | /* const GLubyte * glGetString ( GLenum name ) */ |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 3502 | static jstring android_glGetString(JNIEnv* _env, jobject, jint name) { |
| 3503 | const char* chars = (const char*) glGetString((GLenum) name); |
| 3504 | return _env->NewStringUTF(chars); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3505 | } |
| 3506 | /* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */ |
| 3507 | static void |
| 3508 | android_glGetTexParameterfv__II_3FI |
| 3509 | (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) { |
| 3510 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3511 | const char * _exceptionType = NULL; |
| 3512 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3513 | GLfloat *params_base = (GLfloat *) 0; |
| 3514 | jint _remaining; |
| 3515 | GLfloat *params = (GLfloat *) 0; |
| 3516 | |
| 3517 | if (!params_ref) { |
| 3518 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3519 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3520 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3521 | goto exit; |
| 3522 | } |
| 3523 | if (offset < 0) { |
| 3524 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3525 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3526 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3527 | goto exit; |
| 3528 | } |
| 3529 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 3530 | if (_remaining < 1) { |
| 3531 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3532 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3533 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3534 | goto exit; |
| 3535 | } |
| 3536 | params_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3537 | _env->GetFloatArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3538 | params = params_base + offset; |
| 3539 | |
| 3540 | glGetTexParameterfv( |
| 3541 | (GLenum)target, |
| 3542 | (GLenum)pname, |
| 3543 | (GLfloat *)params |
| 3544 | ); |
| 3545 | |
| 3546 | exit: |
| 3547 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3548 | _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3549 | _exception ? JNI_ABORT: 0); |
| 3550 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3551 | if (_exception) { |
| 3552 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3553 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3554 | } |
| 3555 | |
| 3556 | /* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */ |
| 3557 | static void |
| 3558 | android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 |
| 3559 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
| 3560 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3561 | const char * _exceptionType = NULL; |
| 3562 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3563 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3564 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3565 | jint _remaining; |
| 3566 | GLfloat *params = (GLfloat *) 0; |
| 3567 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3568 | if (!params_buf) { |
| 3569 | _exception = 1; |
| 3570 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3571 | _exceptionMessage = "params == null"; |
| 3572 | goto exit; |
| 3573 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3574 | params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3575 | if (_remaining < 1) { |
| 3576 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3577 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3578 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3579 | goto exit; |
| 3580 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3581 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3582 | char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3583 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 3584 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3585 | glGetTexParameterfv( |
| 3586 | (GLenum)target, |
| 3587 | (GLenum)pname, |
| 3588 | (GLfloat *)params |
| 3589 | ); |
| 3590 | |
| 3591 | exit: |
| 3592 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3593 | _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3594 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3595 | if (_exception) { |
| 3596 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3597 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3598 | } |
| 3599 | |
| 3600 | /* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 3601 | static void |
| 3602 | android_glGetTexParameteriv__II_3II |
| 3603 | (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { |
| 3604 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3605 | const char * _exceptionType = NULL; |
| 3606 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3607 | GLint *params_base = (GLint *) 0; |
| 3608 | jint _remaining; |
| 3609 | GLint *params = (GLint *) 0; |
| 3610 | |
| 3611 | if (!params_ref) { |
| 3612 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3613 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3614 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3615 | goto exit; |
| 3616 | } |
| 3617 | if (offset < 0) { |
| 3618 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3619 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3620 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3621 | goto exit; |
| 3622 | } |
| 3623 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 3624 | if (_remaining < 1) { |
| 3625 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3626 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3627 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3628 | goto exit; |
| 3629 | } |
| 3630 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3631 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3632 | params = params_base + offset; |
| 3633 | |
| 3634 | glGetTexParameteriv( |
| 3635 | (GLenum)target, |
| 3636 | (GLenum)pname, |
| 3637 | (GLint *)params |
| 3638 | ); |
| 3639 | |
| 3640 | exit: |
| 3641 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3642 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3643 | _exception ? JNI_ABORT: 0); |
| 3644 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3645 | if (_exception) { |
| 3646 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3647 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3648 | } |
| 3649 | |
| 3650 | /* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 3651 | static void |
| 3652 | android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 |
| 3653 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
| 3654 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3655 | const char * _exceptionType = NULL; |
| 3656 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3657 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3658 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3659 | jint _remaining; |
| 3660 | GLint *params = (GLint *) 0; |
| 3661 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3662 | if (!params_buf) { |
| 3663 | _exception = 1; |
| 3664 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3665 | _exceptionMessage = "params == null"; |
| 3666 | goto exit; |
| 3667 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3668 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3669 | if (_remaining < 1) { |
| 3670 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3671 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3672 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3673 | goto exit; |
| 3674 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3675 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3676 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3677 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 3678 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3679 | glGetTexParameteriv( |
| 3680 | (GLenum)target, |
| 3681 | (GLenum)pname, |
| 3682 | (GLint *)params |
| 3683 | ); |
| 3684 | |
| 3685 | exit: |
| 3686 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3687 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3688 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3689 | if (_exception) { |
| 3690 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3691 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3692 | } |
| 3693 | |
| 3694 | /* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */ |
| 3695 | static void |
| 3696 | android_glGetUniformfv__II_3FI |
| 3697 | (JNIEnv *_env, jobject _this, jint program, jint location, jfloatArray params_ref, jint offset) { |
| 3698 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3699 | const char * _exceptionType = NULL; |
| 3700 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3701 | GLfloat *params_base = (GLfloat *) 0; |
| 3702 | jint _remaining; |
| 3703 | GLfloat *params = (GLfloat *) 0; |
| 3704 | |
| 3705 | if (!params_ref) { |
| 3706 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3707 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3708 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3709 | goto exit; |
| 3710 | } |
| 3711 | if (offset < 0) { |
| 3712 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3713 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3714 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3715 | goto exit; |
| 3716 | } |
| 3717 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3718 | if (_remaining < 1) { |
| 3719 | _exception = 1; |
| 3720 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3721 | _exceptionMessage = "length - offset < 1 < needed"; |
| 3722 | goto exit; |
| 3723 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3724 | params_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3725 | _env->GetFloatArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3726 | params = params_base + offset; |
| 3727 | |
| 3728 | glGetUniformfv( |
| 3729 | (GLuint)program, |
| 3730 | (GLint)location, |
| 3731 | (GLfloat *)params |
| 3732 | ); |
| 3733 | |
| 3734 | exit: |
| 3735 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3736 | _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3737 | _exception ? JNI_ABORT: 0); |
| 3738 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3739 | if (_exception) { |
| 3740 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3741 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3742 | } |
| 3743 | |
| 3744 | /* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */ |
| 3745 | static void |
| 3746 | android_glGetUniformfv__IILjava_nio_FloatBuffer_2 |
| 3747 | (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3748 | jint _exception = 0; |
| 3749 | const char * _exceptionType = NULL; |
| 3750 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3751 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3752 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3753 | jint _remaining; |
| 3754 | GLfloat *params = (GLfloat *) 0; |
| 3755 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3756 | if (!params_buf) { |
| 3757 | _exception = 1; |
| 3758 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3759 | _exceptionMessage = "params == null"; |
| 3760 | goto exit; |
| 3761 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3762 | params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3763 | if (_remaining < 1) { |
| 3764 | _exception = 1; |
| 3765 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3766 | _exceptionMessage = "remaining() < 1 < needed"; |
| 3767 | goto exit; |
| 3768 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3769 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3770 | char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3771 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 3772 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3773 | glGetUniformfv( |
| 3774 | (GLuint)program, |
| 3775 | (GLint)location, |
| 3776 | (GLfloat *)params |
| 3777 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3778 | |
| 3779 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3780 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3781 | _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3782 | } |
| 3783 | if (_exception) { |
| 3784 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3785 | } |
| 3786 | } |
| 3787 | |
| 3788 | /* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */ |
| 3789 | static void |
| 3790 | android_glGetUniformiv__II_3II |
| 3791 | (JNIEnv *_env, jobject _this, jint program, jint location, jintArray params_ref, jint offset) { |
| 3792 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3793 | const char * _exceptionType = NULL; |
| 3794 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3795 | GLint *params_base = (GLint *) 0; |
| 3796 | jint _remaining; |
| 3797 | GLint *params = (GLint *) 0; |
| 3798 | |
| 3799 | if (!params_ref) { |
| 3800 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3801 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3802 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3803 | goto exit; |
| 3804 | } |
| 3805 | if (offset < 0) { |
| 3806 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3807 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3808 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3809 | goto exit; |
| 3810 | } |
| 3811 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3812 | if (_remaining < 1) { |
| 3813 | _exception = 1; |
| 3814 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3815 | _exceptionMessage = "length - offset < 1 < needed"; |
| 3816 | goto exit; |
| 3817 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3818 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3819 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3820 | params = params_base + offset; |
| 3821 | |
| 3822 | glGetUniformiv( |
| 3823 | (GLuint)program, |
| 3824 | (GLint)location, |
| 3825 | (GLint *)params |
| 3826 | ); |
| 3827 | |
| 3828 | exit: |
| 3829 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3830 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3831 | _exception ? JNI_ABORT: 0); |
| 3832 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3833 | if (_exception) { |
| 3834 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3835 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3836 | } |
| 3837 | |
| 3838 | /* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */ |
| 3839 | static void |
| 3840 | android_glGetUniformiv__IILjava_nio_IntBuffer_2 |
| 3841 | (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3842 | jint _exception = 0; |
| 3843 | const char * _exceptionType = NULL; |
| 3844 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3845 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3846 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3847 | jint _remaining; |
| 3848 | GLint *params = (GLint *) 0; |
| 3849 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3850 | if (!params_buf) { |
| 3851 | _exception = 1; |
| 3852 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3853 | _exceptionMessage = "params == null"; |
| 3854 | goto exit; |
| 3855 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3856 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3857 | if (_remaining < 1) { |
| 3858 | _exception = 1; |
| 3859 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3860 | _exceptionMessage = "remaining() < 1 < needed"; |
| 3861 | goto exit; |
| 3862 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3863 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3864 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3865 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 3866 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3867 | glGetUniformiv( |
| 3868 | (GLuint)program, |
| 3869 | (GLint)location, |
| 3870 | (GLint *)params |
| 3871 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3872 | |
| 3873 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3874 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3875 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3876 | } |
| 3877 | if (_exception) { |
| 3878 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3879 | } |
| 3880 | } |
| 3881 | |
Mathias Agopian | 89be00b | 2013-02-22 20:08:06 -0800 | [diff] [blame] | 3882 | /* GLint glGetUniformLocation ( GLuint program, const char *name ) */ |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3883 | static jint |
| 3884 | android_glGetUniformLocation__ILjava_lang_String_2 |
| 3885 | (JNIEnv *_env, jobject _this, jint program, jstring name) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3886 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3887 | const char * _exceptionType = NULL; |
| 3888 | const char * _exceptionMessage = NULL; |
Mathias Agopian | 89be00b | 2013-02-22 20:08:06 -0800 | [diff] [blame] | 3889 | GLint _returnValue = 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3890 | const char* _nativename = 0; |
| 3891 | |
| 3892 | if (!name) { |
Elliott Hughes | 428d3fc | 2013-09-24 17:15:41 -0700 | [diff] [blame] | 3893 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3894 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3895 | _exceptionMessage = "name == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3896 | goto exit; |
| 3897 | } |
| 3898 | _nativename = _env->GetStringUTFChars(name, 0); |
| 3899 | |
| 3900 | _returnValue = glGetUniformLocation( |
| 3901 | (GLuint)program, |
| 3902 | (char *)_nativename |
| 3903 | ); |
| 3904 | |
| 3905 | exit: |
| 3906 | if (_nativename) { |
| 3907 | _env->ReleaseStringUTFChars(name, _nativename); |
| 3908 | } |
| 3909 | |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3910 | if (_exception) { |
| 3911 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3912 | } |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 3913 | return (jint)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3914 | } |
| 3915 | |
| 3916 | /* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */ |
| 3917 | static void |
| 3918 | android_glGetVertexAttribfv__II_3FI |
| 3919 | (JNIEnv *_env, jobject _this, jint index, jint pname, jfloatArray params_ref, jint offset) { |
| 3920 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3921 | const char * _exceptionType = NULL; |
| 3922 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3923 | GLfloat *params_base = (GLfloat *) 0; |
| 3924 | jint _remaining; |
| 3925 | GLfloat *params = (GLfloat *) 0; |
| 3926 | |
| 3927 | if (!params_ref) { |
| 3928 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3929 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3930 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3931 | goto exit; |
| 3932 | } |
| 3933 | if (offset < 0) { |
| 3934 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3935 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3936 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3937 | goto exit; |
| 3938 | } |
| 3939 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3940 | int _needed; |
| 3941 | switch (pname) { |
| 3942 | #if defined(GL_CURRENT_VERTEX_ATTRIB) |
| 3943 | case GL_CURRENT_VERTEX_ATTRIB: |
| 3944 | #endif // defined(GL_CURRENT_VERTEX_ATTRIB) |
| 3945 | _needed = 4; |
| 3946 | break; |
| 3947 | default: |
| 3948 | _needed = 1; |
| 3949 | break; |
| 3950 | } |
| 3951 | if (_remaining < _needed) { |
| 3952 | _exception = 1; |
| 3953 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3954 | _exceptionMessage = "length - offset < needed"; |
| 3955 | goto exit; |
| 3956 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3957 | params_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3958 | _env->GetFloatArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3959 | params = params_base + offset; |
| 3960 | |
| 3961 | glGetVertexAttribfv( |
| 3962 | (GLuint)index, |
| 3963 | (GLenum)pname, |
| 3964 | (GLfloat *)params |
| 3965 | ); |
| 3966 | |
| 3967 | exit: |
| 3968 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3969 | _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3970 | _exception ? JNI_ABORT: 0); |
| 3971 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3972 | if (_exception) { |
| 3973 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3974 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3975 | } |
| 3976 | |
| 3977 | /* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */ |
| 3978 | static void |
| 3979 | android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2 |
| 3980 | (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3981 | jint _exception = 0; |
| 3982 | const char * _exceptionType = NULL; |
| 3983 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3984 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3985 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3986 | jint _remaining; |
| 3987 | GLfloat *params = (GLfloat *) 0; |
| 3988 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3989 | if (!params_buf) { |
| 3990 | _exception = 1; |
| 3991 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3992 | _exceptionMessage = "params == null"; |
| 3993 | goto exit; |
| 3994 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3995 | params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3996 | int _needed; |
| 3997 | switch (pname) { |
| 3998 | #if defined(GL_CURRENT_VERTEX_ATTRIB) |
| 3999 | case GL_CURRENT_VERTEX_ATTRIB: |
| 4000 | #endif // defined(GL_CURRENT_VERTEX_ATTRIB) |
| 4001 | _needed = 4; |
| 4002 | break; |
| 4003 | default: |
| 4004 | _needed = 1; |
| 4005 | break; |
| 4006 | } |
| 4007 | if (_remaining < _needed) { |
| 4008 | _exception = 1; |
| 4009 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4010 | _exceptionMessage = "remaining() < needed"; |
| 4011 | goto exit; |
| 4012 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4013 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4014 | char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4015 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 4016 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4017 | glGetVertexAttribfv( |
| 4018 | (GLuint)index, |
| 4019 | (GLenum)pname, |
| 4020 | (GLfloat *)params |
| 4021 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4022 | |
| 4023 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4024 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4025 | _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4026 | } |
| 4027 | if (_exception) { |
| 4028 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4029 | } |
| 4030 | } |
| 4031 | |
| 4032 | /* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */ |
| 4033 | static void |
| 4034 | android_glGetVertexAttribiv__II_3II |
| 4035 | (JNIEnv *_env, jobject _this, jint index, jint pname, jintArray params_ref, jint offset) { |
| 4036 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4037 | const char * _exceptionType = NULL; |
| 4038 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4039 | GLint *params_base = (GLint *) 0; |
| 4040 | jint _remaining; |
| 4041 | GLint *params = (GLint *) 0; |
| 4042 | |
| 4043 | if (!params_ref) { |
| 4044 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4045 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4046 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4047 | goto exit; |
| 4048 | } |
| 4049 | if (offset < 0) { |
| 4050 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4051 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4052 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4053 | goto exit; |
| 4054 | } |
| 4055 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4056 | int _needed; |
| 4057 | switch (pname) { |
| 4058 | #if defined(GL_CURRENT_VERTEX_ATTRIB) |
| 4059 | case GL_CURRENT_VERTEX_ATTRIB: |
| 4060 | #endif // defined(GL_CURRENT_VERTEX_ATTRIB) |
| 4061 | _needed = 4; |
| 4062 | break; |
| 4063 | default: |
| 4064 | _needed = 1; |
| 4065 | break; |
| 4066 | } |
| 4067 | if (_remaining < _needed) { |
| 4068 | _exception = 1; |
| 4069 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4070 | _exceptionMessage = "length - offset < needed"; |
| 4071 | goto exit; |
| 4072 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4073 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4074 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4075 | params = params_base + offset; |
| 4076 | |
| 4077 | glGetVertexAttribiv( |
| 4078 | (GLuint)index, |
| 4079 | (GLenum)pname, |
| 4080 | (GLint *)params |
| 4081 | ); |
| 4082 | |
| 4083 | exit: |
| 4084 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4085 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4086 | _exception ? JNI_ABORT: 0); |
| 4087 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4088 | if (_exception) { |
| 4089 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4090 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4091 | } |
| 4092 | |
| 4093 | /* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */ |
| 4094 | static void |
| 4095 | android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2 |
| 4096 | (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4097 | jint _exception = 0; |
| 4098 | const char * _exceptionType = NULL; |
| 4099 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4100 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4101 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4102 | jint _remaining; |
| 4103 | GLint *params = (GLint *) 0; |
| 4104 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4105 | if (!params_buf) { |
| 4106 | _exception = 1; |
| 4107 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4108 | _exceptionMessage = "params == null"; |
| 4109 | goto exit; |
| 4110 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4111 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4112 | int _needed; |
| 4113 | switch (pname) { |
| 4114 | #if defined(GL_CURRENT_VERTEX_ATTRIB) |
| 4115 | case GL_CURRENT_VERTEX_ATTRIB: |
| 4116 | #endif // defined(GL_CURRENT_VERTEX_ATTRIB) |
| 4117 | _needed = 4; |
| 4118 | break; |
| 4119 | default: |
| 4120 | _needed = 1; |
| 4121 | break; |
| 4122 | } |
| 4123 | if (_remaining < _needed) { |
| 4124 | _exception = 1; |
| 4125 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4126 | _exceptionMessage = "remaining() < needed"; |
| 4127 | goto exit; |
| 4128 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4129 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4130 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4131 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 4132 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4133 | glGetVertexAttribiv( |
| 4134 | (GLuint)index, |
| 4135 | (GLenum)pname, |
| 4136 | (GLint *)params |
| 4137 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4138 | |
| 4139 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4140 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4141 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4142 | } |
| 4143 | if (_exception) { |
| 4144 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4145 | } |
| 4146 | } |
| 4147 | |
| 4148 | /* void glHint ( GLenum target, GLenum mode ) */ |
| 4149 | static void |
| 4150 | android_glHint__II |
| 4151 | (JNIEnv *_env, jobject _this, jint target, jint mode) { |
| 4152 | glHint( |
| 4153 | (GLenum)target, |
| 4154 | (GLenum)mode |
| 4155 | ); |
| 4156 | } |
| 4157 | |
| 4158 | /* GLboolean glIsBuffer ( GLuint buffer ) */ |
| 4159 | static jboolean |
| 4160 | android_glIsBuffer__I |
| 4161 | (JNIEnv *_env, jobject _this, jint buffer) { |
| 4162 | GLboolean _returnValue; |
| 4163 | _returnValue = glIsBuffer( |
| 4164 | (GLuint)buffer |
| 4165 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 4166 | return (jboolean)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4167 | } |
| 4168 | |
| 4169 | /* GLboolean glIsEnabled ( GLenum cap ) */ |
| 4170 | static jboolean |
| 4171 | android_glIsEnabled__I |
| 4172 | (JNIEnv *_env, jobject _this, jint cap) { |
| 4173 | GLboolean _returnValue; |
| 4174 | _returnValue = glIsEnabled( |
| 4175 | (GLenum)cap |
| 4176 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 4177 | return (jboolean)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4178 | } |
| 4179 | |
| 4180 | /* GLboolean glIsFramebuffer ( GLuint framebuffer ) */ |
| 4181 | static jboolean |
| 4182 | android_glIsFramebuffer__I |
| 4183 | (JNIEnv *_env, jobject _this, jint framebuffer) { |
| 4184 | GLboolean _returnValue; |
| 4185 | _returnValue = glIsFramebuffer( |
| 4186 | (GLuint)framebuffer |
| 4187 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 4188 | return (jboolean)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4189 | } |
| 4190 | |
| 4191 | /* GLboolean glIsProgram ( GLuint program ) */ |
| 4192 | static jboolean |
| 4193 | android_glIsProgram__I |
| 4194 | (JNIEnv *_env, jobject _this, jint program) { |
| 4195 | GLboolean _returnValue; |
| 4196 | _returnValue = glIsProgram( |
| 4197 | (GLuint)program |
| 4198 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 4199 | return (jboolean)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4200 | } |
| 4201 | |
| 4202 | /* GLboolean glIsRenderbuffer ( GLuint renderbuffer ) */ |
| 4203 | static jboolean |
| 4204 | android_glIsRenderbuffer__I |
| 4205 | (JNIEnv *_env, jobject _this, jint renderbuffer) { |
| 4206 | GLboolean _returnValue; |
| 4207 | _returnValue = glIsRenderbuffer( |
| 4208 | (GLuint)renderbuffer |
| 4209 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 4210 | return (jboolean)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4211 | } |
| 4212 | |
| 4213 | /* GLboolean glIsShader ( GLuint shader ) */ |
| 4214 | static jboolean |
| 4215 | android_glIsShader__I |
| 4216 | (JNIEnv *_env, jobject _this, jint shader) { |
| 4217 | GLboolean _returnValue; |
| 4218 | _returnValue = glIsShader( |
| 4219 | (GLuint)shader |
| 4220 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 4221 | return (jboolean)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4222 | } |
| 4223 | |
| 4224 | /* GLboolean glIsTexture ( GLuint texture ) */ |
| 4225 | static jboolean |
| 4226 | android_glIsTexture__I |
| 4227 | (JNIEnv *_env, jobject _this, jint texture) { |
| 4228 | GLboolean _returnValue; |
| 4229 | _returnValue = glIsTexture( |
| 4230 | (GLuint)texture |
| 4231 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 4232 | return (jboolean)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4233 | } |
| 4234 | |
| 4235 | /* void glLineWidth ( GLfloat width ) */ |
| 4236 | static void |
| 4237 | android_glLineWidth__F |
| 4238 | (JNIEnv *_env, jobject _this, jfloat width) { |
| 4239 | glLineWidth( |
| 4240 | (GLfloat)width |
| 4241 | ); |
| 4242 | } |
| 4243 | |
| 4244 | /* void glLinkProgram ( GLuint program ) */ |
| 4245 | static void |
| 4246 | android_glLinkProgram__I |
| 4247 | (JNIEnv *_env, jobject _this, jint program) { |
| 4248 | glLinkProgram( |
| 4249 | (GLuint)program |
| 4250 | ); |
| 4251 | } |
| 4252 | |
| 4253 | /* void glPixelStorei ( GLenum pname, GLint param ) */ |
| 4254 | static void |
| 4255 | android_glPixelStorei__II |
| 4256 | (JNIEnv *_env, jobject _this, jint pname, jint param) { |
| 4257 | glPixelStorei( |
| 4258 | (GLenum)pname, |
| 4259 | (GLint)param |
| 4260 | ); |
| 4261 | } |
| 4262 | |
| 4263 | /* void glPolygonOffset ( GLfloat factor, GLfloat units ) */ |
| 4264 | static void |
| 4265 | android_glPolygonOffset__FF |
| 4266 | (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) { |
| 4267 | glPolygonOffset( |
| 4268 | (GLfloat)factor, |
| 4269 | (GLfloat)units |
| 4270 | ); |
| 4271 | } |
| 4272 | |
| 4273 | /* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */ |
| 4274 | static void |
| 4275 | android_glReadPixels__IIIIIILjava_nio_Buffer_2 |
| 4276 | (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4277 | jint _exception = 0; |
| 4278 | const char * _exceptionType = NULL; |
| 4279 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4280 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4281 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4282 | jint _remaining; |
| 4283 | GLvoid *pixels = (GLvoid *) 0; |
| 4284 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4285 | if (!pixels_buf) { |
| 4286 | _exception = 1; |
| 4287 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4288 | _exceptionMessage = "pixels == null"; |
| 4289 | goto exit; |
| 4290 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4291 | pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4292 | if (pixels == NULL) { |
| 4293 | char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 4294 | pixels = (GLvoid *) (_pixelsBase + _bufferOffset); |
| 4295 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4296 | glReadPixels( |
| 4297 | (GLint)x, |
| 4298 | (GLint)y, |
| 4299 | (GLsizei)width, |
| 4300 | (GLsizei)height, |
| 4301 | (GLenum)format, |
| 4302 | (GLenum)type, |
| 4303 | (GLvoid *)pixels |
| 4304 | ); |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4305 | |
| 4306 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4307 | if (_array) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4308 | releasePointer(_env, _array, pixels, _exception ? JNI_FALSE : JNI_TRUE); |
| 4309 | } |
| 4310 | if (_exception) { |
| 4311 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4312 | } |
| 4313 | } |
| 4314 | |
| 4315 | /* void glReleaseShaderCompiler ( void ) */ |
| 4316 | static void |
| 4317 | android_glReleaseShaderCompiler__ |
| 4318 | (JNIEnv *_env, jobject _this) { |
| 4319 | glReleaseShaderCompiler(); |
| 4320 | } |
| 4321 | |
| 4322 | /* void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) */ |
| 4323 | static void |
| 4324 | android_glRenderbufferStorage__IIII |
| 4325 | (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint width, jint height) { |
| 4326 | glRenderbufferStorage( |
| 4327 | (GLenum)target, |
| 4328 | (GLenum)internalformat, |
| 4329 | (GLsizei)width, |
| 4330 | (GLsizei)height |
| 4331 | ); |
| 4332 | } |
| 4333 | |
| 4334 | /* void glSampleCoverage ( GLclampf value, GLboolean invert ) */ |
| 4335 | static void |
| 4336 | android_glSampleCoverage__FZ |
| 4337 | (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) { |
| 4338 | glSampleCoverage( |
| 4339 | (GLclampf)value, |
| 4340 | (GLboolean)invert |
| 4341 | ); |
| 4342 | } |
| 4343 | |
| 4344 | /* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */ |
| 4345 | static void |
| 4346 | android_glScissor__IIII |
| 4347 | (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) { |
| 4348 | glScissor( |
| 4349 | (GLint)x, |
| 4350 | (GLint)y, |
| 4351 | (GLsizei)width, |
| 4352 | (GLsizei)height |
| 4353 | ); |
| 4354 | } |
| 4355 | |
| 4356 | /* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */ |
| 4357 | static void |
| 4358 | android_glShaderBinary__I_3IIILjava_nio_Buffer_2I |
| 4359 | (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] | 4360 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4361 | const char * _exceptionType = NULL; |
| 4362 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4363 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4364 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4365 | GLuint *shaders_base = (GLuint *) 0; |
| 4366 | jint _shadersRemaining; |
| 4367 | GLuint *shaders = (GLuint *) 0; |
| 4368 | jint _binaryRemaining; |
| 4369 | GLvoid *binary = (GLvoid *) 0; |
| 4370 | |
| 4371 | if (!shaders_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4372 | _exception = 1; |
| 4373 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4374 | _exceptionMessage = "shaders == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4375 | goto exit; |
| 4376 | } |
| 4377 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4378 | _exception = 1; |
| 4379 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4380 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4381 | goto exit; |
| 4382 | } |
| 4383 | _shadersRemaining = _env->GetArrayLength(shaders_ref) - offset; |
| 4384 | shaders_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4385 | _env->GetIntArrayElements(shaders_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4386 | shaders = shaders_base + offset; |
| 4387 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4388 | if (!binary_buf) { |
| 4389 | _exception = 1; |
| 4390 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4391 | _exceptionMessage = "binary == null"; |
| 4392 | goto exit; |
| 4393 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4394 | binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_array, &_binaryRemaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4395 | if (_binaryRemaining < length) { |
| 4396 | _exception = 1; |
| 4397 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4398 | _exceptionMessage = "remaining() < length < needed"; |
| 4399 | goto exit; |
| 4400 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4401 | if (binary == NULL) { |
| 4402 | char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 4403 | binary = (GLvoid *) (_binaryBase + _bufferOffset); |
| 4404 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4405 | glShaderBinary( |
| 4406 | (GLsizei)n, |
| 4407 | (GLuint *)shaders, |
| 4408 | (GLenum)binaryformat, |
| 4409 | (GLvoid *)binary, |
| 4410 | (GLsizei)length |
| 4411 | ); |
| 4412 | |
| 4413 | exit: |
| 4414 | if (_array) { |
| 4415 | releasePointer(_env, _array, binary, JNI_FALSE); |
| 4416 | } |
| 4417 | if (shaders_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4418 | _env->ReleaseIntArrayElements(shaders_ref, (jint*)shaders_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4419 | JNI_ABORT); |
| 4420 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4421 | if (_exception) { |
| 4422 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4423 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4424 | } |
| 4425 | |
| 4426 | /* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */ |
| 4427 | static void |
| 4428 | android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I |
| 4429 | (JNIEnv *_env, jobject _this, jint n, jobject shaders_buf, jint binaryformat, jobject binary_buf, jint length) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4430 | jint _exception = 0; |
| 4431 | const char * _exceptionType = NULL; |
| 4432 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4433 | jintArray _shadersArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4434 | jint _shadersBufferOffset = (jint) 0; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4435 | jintArray _binaryArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4436 | jint _binaryBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4437 | jint _shadersRemaining; |
| 4438 | GLuint *shaders = (GLuint *) 0; |
| 4439 | jint _binaryRemaining; |
| 4440 | GLvoid *binary = (GLvoid *) 0; |
| 4441 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4442 | if (!shaders_buf) { |
| 4443 | _exception = 1; |
| 4444 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4445 | _exceptionMessage = "shaders == null"; |
| 4446 | goto exit; |
| 4447 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4448 | shaders = (GLuint *)getPointer(_env, shaders_buf, (jarray*)&_shadersArray, &_shadersRemaining, &_shadersBufferOffset); |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4449 | if (!binary_buf) { |
| 4450 | _exception = 1; |
| 4451 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4452 | _exceptionMessage = "binary == null"; |
| 4453 | goto exit; |
| 4454 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4455 | binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_binaryArray, &_binaryRemaining, &_binaryBufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4456 | if (_binaryRemaining < length) { |
| 4457 | _exception = 1; |
| 4458 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4459 | _exceptionMessage = "remaining() < length < needed"; |
| 4460 | goto exit; |
| 4461 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4462 | if (shaders == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4463 | char * _shadersBase = (char *)_env->GetIntArrayElements(_shadersArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4464 | shaders = (GLuint *) (_shadersBase + _shadersBufferOffset); |
| 4465 | } |
| 4466 | if (binary == NULL) { |
| 4467 | char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_binaryArray, (jboolean *) 0); |
| 4468 | binary = (GLvoid *) (_binaryBase + _binaryBufferOffset); |
| 4469 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4470 | glShaderBinary( |
| 4471 | (GLsizei)n, |
| 4472 | (GLuint *)shaders, |
| 4473 | (GLenum)binaryformat, |
| 4474 | (GLvoid *)binary, |
| 4475 | (GLsizei)length |
| 4476 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4477 | |
| 4478 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4479 | if (_binaryArray) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4480 | releasePointer(_env, _binaryArray, binary, JNI_FALSE); |
| 4481 | } |
| 4482 | if (_shadersArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4483 | _env->ReleaseIntArrayElements(_shadersArray, (jint*)shaders, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4484 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4485 | if (_exception) { |
| 4486 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4487 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4488 | } |
| 4489 | |
| 4490 | |
| 4491 | /* void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint * length ) */ |
| 4492 | static |
| 4493 | void |
| 4494 | android_glShaderSource |
| 4495 | (JNIEnv *_env, jobject _this, jint shader, jstring string) { |
| 4496 | |
| 4497 | if (!string) { |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 4498 | jniThrowException(_env, "java/lang/IllegalArgumentException", "string == null"); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4499 | return; |
| 4500 | } |
| 4501 | |
| 4502 | const char* nativeString = _env->GetStringUTFChars(string, 0); |
| 4503 | const char* strings[] = {nativeString}; |
| 4504 | glShaderSource(shader, 1, strings, 0); |
| 4505 | _env->ReleaseStringUTFChars(string, nativeString); |
| 4506 | } |
| 4507 | /* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */ |
| 4508 | static void |
| 4509 | android_glStencilFunc__III |
| 4510 | (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) { |
| 4511 | glStencilFunc( |
| 4512 | (GLenum)func, |
| 4513 | (GLint)ref, |
| 4514 | (GLuint)mask |
| 4515 | ); |
| 4516 | } |
| 4517 | |
| 4518 | /* void glStencilFuncSeparate ( GLenum face, GLenum func, GLint ref, GLuint mask ) */ |
| 4519 | static void |
| 4520 | android_glStencilFuncSeparate__IIII |
| 4521 | (JNIEnv *_env, jobject _this, jint face, jint func, jint ref, jint mask) { |
| 4522 | glStencilFuncSeparate( |
| 4523 | (GLenum)face, |
| 4524 | (GLenum)func, |
| 4525 | (GLint)ref, |
| 4526 | (GLuint)mask |
| 4527 | ); |
| 4528 | } |
| 4529 | |
| 4530 | /* void glStencilMask ( GLuint mask ) */ |
| 4531 | static void |
| 4532 | android_glStencilMask__I |
| 4533 | (JNIEnv *_env, jobject _this, jint mask) { |
| 4534 | glStencilMask( |
| 4535 | (GLuint)mask |
| 4536 | ); |
| 4537 | } |
| 4538 | |
| 4539 | /* void glStencilMaskSeparate ( GLenum face, GLuint mask ) */ |
| 4540 | static void |
| 4541 | android_glStencilMaskSeparate__II |
| 4542 | (JNIEnv *_env, jobject _this, jint face, jint mask) { |
| 4543 | glStencilMaskSeparate( |
| 4544 | (GLenum)face, |
| 4545 | (GLuint)mask |
| 4546 | ); |
| 4547 | } |
| 4548 | |
| 4549 | /* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */ |
| 4550 | static void |
| 4551 | android_glStencilOp__III |
| 4552 | (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) { |
| 4553 | glStencilOp( |
| 4554 | (GLenum)fail, |
| 4555 | (GLenum)zfail, |
| 4556 | (GLenum)zpass |
| 4557 | ); |
| 4558 | } |
| 4559 | |
| 4560 | /* void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) */ |
| 4561 | static void |
| 4562 | android_glStencilOpSeparate__IIII |
| 4563 | (JNIEnv *_env, jobject _this, jint face, jint fail, jint zfail, jint zpass) { |
| 4564 | glStencilOpSeparate( |
| 4565 | (GLenum)face, |
| 4566 | (GLenum)fail, |
| 4567 | (GLenum)zfail, |
| 4568 | (GLenum)zpass |
| 4569 | ); |
| 4570 | } |
| 4571 | |
| 4572 | /* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */ |
| 4573 | static void |
| 4574 | android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 |
| 4575 | (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4576 | jint _exception = 0; |
| 4577 | const char * _exceptionType = NULL; |
| 4578 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4579 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4580 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4581 | jint _remaining; |
| 4582 | GLvoid *pixels = (GLvoid *) 0; |
| 4583 | |
| 4584 | if (pixels_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4585 | pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4586 | } |
Thomas Tafertshofer | 37c9b49 | 2012-07-23 16:56:04 -0700 | [diff] [blame] | 4587 | if (pixels_buf && pixels == NULL) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4588 | char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 4589 | pixels = (GLvoid *) (_pixelsBase + _bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4590 | } |
| 4591 | glTexImage2D( |
| 4592 | (GLenum)target, |
| 4593 | (GLint)level, |
| 4594 | (GLint)internalformat, |
| 4595 | (GLsizei)width, |
| 4596 | (GLsizei)height, |
| 4597 | (GLint)border, |
| 4598 | (GLenum)format, |
| 4599 | (GLenum)type, |
| 4600 | (GLvoid *)pixels |
| 4601 | ); |
| 4602 | if (_array) { |
| 4603 | releasePointer(_env, _array, pixels, JNI_FALSE); |
| 4604 | } |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4605 | if (_exception) { |
| 4606 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4607 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4608 | } |
| 4609 | |
| 4610 | /* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */ |
| 4611 | static void |
| 4612 | android_glTexParameterf__IIF |
| 4613 | (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) { |
| 4614 | glTexParameterf( |
| 4615 | (GLenum)target, |
| 4616 | (GLenum)pname, |
| 4617 | (GLfloat)param |
| 4618 | ); |
| 4619 | } |
| 4620 | |
| 4621 | /* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */ |
| 4622 | static void |
| 4623 | android_glTexParameterfv__II_3FI |
| 4624 | (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] | 4625 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4626 | const char * _exceptionType = NULL; |
| 4627 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4628 | GLfloat *params_base = (GLfloat *) 0; |
| 4629 | jint _remaining; |
| 4630 | GLfloat *params = (GLfloat *) 0; |
| 4631 | |
| 4632 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4633 | _exception = 1; |
| 4634 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4635 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4636 | goto exit; |
| 4637 | } |
| 4638 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4639 | _exception = 1; |
| 4640 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4641 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4642 | goto exit; |
| 4643 | } |
| 4644 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 4645 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4646 | _exception = 1; |
| 4647 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4648 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4649 | goto exit; |
| 4650 | } |
| 4651 | params_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4652 | _env->GetFloatArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4653 | params = params_base + offset; |
| 4654 | |
| 4655 | glTexParameterfv( |
| 4656 | (GLenum)target, |
| 4657 | (GLenum)pname, |
| 4658 | (GLfloat *)params |
| 4659 | ); |
| 4660 | |
| 4661 | exit: |
| 4662 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4663 | _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4664 | JNI_ABORT); |
| 4665 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4666 | if (_exception) { |
| 4667 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4668 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4669 | } |
| 4670 | |
| 4671 | /* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */ |
| 4672 | static void |
| 4673 | android_glTexParameterfv__IILjava_nio_FloatBuffer_2 |
| 4674 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4675 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4676 | const char * _exceptionType = NULL; |
| 4677 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4678 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4679 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4680 | jint _remaining; |
| 4681 | GLfloat *params = (GLfloat *) 0; |
| 4682 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4683 | if (!params_buf) { |
| 4684 | _exception = 1; |
| 4685 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4686 | _exceptionMessage = "params == null"; |
| 4687 | goto exit; |
| 4688 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4689 | params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4690 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4691 | _exception = 1; |
| 4692 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4693 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4694 | goto exit; |
| 4695 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4696 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4697 | char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4698 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 4699 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4700 | glTexParameterfv( |
| 4701 | (GLenum)target, |
| 4702 | (GLenum)pname, |
| 4703 | (GLfloat *)params |
| 4704 | ); |
| 4705 | |
| 4706 | exit: |
| 4707 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4708 | _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4709 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4710 | if (_exception) { |
| 4711 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4712 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4713 | } |
| 4714 | |
| 4715 | /* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */ |
| 4716 | static void |
| 4717 | android_glTexParameteri__III |
| 4718 | (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) { |
| 4719 | glTexParameteri( |
| 4720 | (GLenum)target, |
| 4721 | (GLenum)pname, |
| 4722 | (GLint)param |
| 4723 | ); |
| 4724 | } |
| 4725 | |
| 4726 | /* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */ |
| 4727 | static void |
| 4728 | android_glTexParameteriv__II_3II |
| 4729 | (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] | 4730 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4731 | const char * _exceptionType = NULL; |
| 4732 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4733 | GLint *params_base = (GLint *) 0; |
| 4734 | jint _remaining; |
| 4735 | GLint *params = (GLint *) 0; |
| 4736 | |
| 4737 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4738 | _exception = 1; |
| 4739 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4740 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4741 | goto exit; |
| 4742 | } |
| 4743 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4744 | _exception = 1; |
| 4745 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4746 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4747 | goto exit; |
| 4748 | } |
| 4749 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 4750 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4751 | _exception = 1; |
| 4752 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4753 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4754 | goto exit; |
| 4755 | } |
| 4756 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4757 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4758 | params = params_base + offset; |
| 4759 | |
| 4760 | glTexParameteriv( |
| 4761 | (GLenum)target, |
| 4762 | (GLenum)pname, |
| 4763 | (GLint *)params |
| 4764 | ); |
| 4765 | |
| 4766 | exit: |
| 4767 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4768 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4769 | JNI_ABORT); |
| 4770 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4771 | if (_exception) { |
| 4772 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4773 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4774 | } |
| 4775 | |
| 4776 | /* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */ |
| 4777 | static void |
| 4778 | android_glTexParameteriv__IILjava_nio_IntBuffer_2 |
| 4779 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4780 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4781 | const char * _exceptionType = NULL; |
| 4782 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4783 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4784 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4785 | jint _remaining; |
| 4786 | GLint *params = (GLint *) 0; |
| 4787 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4788 | if (!params_buf) { |
| 4789 | _exception = 1; |
| 4790 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4791 | _exceptionMessage = "params == null"; |
| 4792 | goto exit; |
| 4793 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4794 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4795 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4796 | _exception = 1; |
| 4797 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4798 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4799 | goto exit; |
| 4800 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4801 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4802 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4803 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 4804 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4805 | glTexParameteriv( |
| 4806 | (GLenum)target, |
| 4807 | (GLenum)pname, |
| 4808 | (GLint *)params |
| 4809 | ); |
| 4810 | |
| 4811 | exit: |
| 4812 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4813 | _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4814 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4815 | if (_exception) { |
| 4816 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4817 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4818 | } |
| 4819 | |
| 4820 | /* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */ |
| 4821 | static void |
| 4822 | android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 |
| 4823 | (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4824 | jint _exception = 0; |
| 4825 | const char * _exceptionType = NULL; |
| 4826 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4827 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4828 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4829 | jint _remaining; |
| 4830 | GLvoid *pixels = (GLvoid *) 0; |
| 4831 | |
| 4832 | if (pixels_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4833 | pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4834 | } |
Thomas Tafertshofer | 37c9b49 | 2012-07-23 16:56:04 -0700 | [diff] [blame] | 4835 | if (pixels_buf && pixels == NULL) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4836 | char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 4837 | pixels = (GLvoid *) (_pixelsBase + _bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4838 | } |
| 4839 | glTexSubImage2D( |
| 4840 | (GLenum)target, |
| 4841 | (GLint)level, |
| 4842 | (GLint)xoffset, |
| 4843 | (GLint)yoffset, |
| 4844 | (GLsizei)width, |
| 4845 | (GLsizei)height, |
| 4846 | (GLenum)format, |
| 4847 | (GLenum)type, |
| 4848 | (GLvoid *)pixels |
| 4849 | ); |
| 4850 | if (_array) { |
| 4851 | releasePointer(_env, _array, pixels, JNI_FALSE); |
| 4852 | } |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4853 | if (_exception) { |
| 4854 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4855 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4856 | } |
| 4857 | |
| 4858 | /* void glUniform1f ( GLint location, GLfloat x ) */ |
| 4859 | static void |
| 4860 | android_glUniform1f__IF |
| 4861 | (JNIEnv *_env, jobject _this, jint location, jfloat x) { |
| 4862 | glUniform1f( |
| 4863 | (GLint)location, |
| 4864 | (GLfloat)x |
| 4865 | ); |
| 4866 | } |
| 4867 | |
| 4868 | /* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 4869 | static void |
| 4870 | android_glUniform1fv__II_3FI |
| 4871 | (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] | 4872 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4873 | const char * _exceptionType = NULL; |
| 4874 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4875 | GLfloat *v_base = (GLfloat *) 0; |
| 4876 | jint _remaining; |
| 4877 | GLfloat *v = (GLfloat *) 0; |
| 4878 | |
| 4879 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4880 | _exception = 1; |
| 4881 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4882 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4883 | goto exit; |
| 4884 | } |
| 4885 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4886 | _exception = 1; |
| 4887 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4888 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4889 | goto exit; |
| 4890 | } |
| 4891 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4892 | if (_remaining < count) { |
| 4893 | _exception = 1; |
| 4894 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4895 | _exceptionMessage = "length - offset < count < needed"; |
| 4896 | goto exit; |
| 4897 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4898 | v_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4899 | _env->GetFloatArrayElements(v_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4900 | v = v_base + offset; |
| 4901 | |
| 4902 | glUniform1fv( |
| 4903 | (GLint)location, |
| 4904 | (GLsizei)count, |
| 4905 | (GLfloat *)v |
| 4906 | ); |
| 4907 | |
| 4908 | exit: |
| 4909 | if (v_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4910 | _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4911 | JNI_ABORT); |
| 4912 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4913 | if (_exception) { |
| 4914 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4915 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4916 | } |
| 4917 | |
| 4918 | /* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 4919 | static void |
| 4920 | android_glUniform1fv__IILjava_nio_FloatBuffer_2 |
| 4921 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4922 | jint _exception = 0; |
| 4923 | const char * _exceptionType = NULL; |
| 4924 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4925 | jfloatArray _array = (jfloatArray) 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 | GLfloat *v = (GLfloat *) 0; |
| 4929 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4930 | if (!v_buf) { |
| 4931 | _exception = 1; |
| 4932 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4933 | _exceptionMessage = "v == null"; |
| 4934 | goto exit; |
| 4935 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4936 | v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4937 | if (_remaining < count) { |
| 4938 | _exception = 1; |
| 4939 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4940 | _exceptionMessage = "remaining() < count < needed"; |
| 4941 | goto exit; |
| 4942 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4943 | if (v == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4944 | char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4945 | v = (GLfloat *) (_vBase + _bufferOffset); |
| 4946 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4947 | glUniform1fv( |
| 4948 | (GLint)location, |
| 4949 | (GLsizei)count, |
| 4950 | (GLfloat *)v |
| 4951 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4952 | |
| 4953 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4954 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4955 | _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4956 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4957 | if (_exception) { |
| 4958 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4959 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4960 | } |
| 4961 | |
| 4962 | /* void glUniform1i ( GLint location, GLint x ) */ |
| 4963 | static void |
| 4964 | android_glUniform1i__II |
| 4965 | (JNIEnv *_env, jobject _this, jint location, jint x) { |
| 4966 | glUniform1i( |
| 4967 | (GLint)location, |
| 4968 | (GLint)x |
| 4969 | ); |
| 4970 | } |
| 4971 | |
| 4972 | /* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 4973 | static void |
| 4974 | android_glUniform1iv__II_3II |
| 4975 | (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] | 4976 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4977 | const char * _exceptionType = NULL; |
| 4978 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4979 | GLint *v_base = (GLint *) 0; |
| 4980 | jint _remaining; |
| 4981 | GLint *v = (GLint *) 0; |
| 4982 | |
| 4983 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4984 | _exception = 1; |
| 4985 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4986 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4987 | goto exit; |
| 4988 | } |
| 4989 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4990 | _exception = 1; |
| 4991 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4992 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4993 | goto exit; |
| 4994 | } |
| 4995 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4996 | if (_remaining < count) { |
| 4997 | _exception = 1; |
| 4998 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4999 | _exceptionMessage = "length - offset < count < needed"; |
| 5000 | goto exit; |
| 5001 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5002 | v_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5003 | _env->GetIntArrayElements(v_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5004 | v = v_base + offset; |
| 5005 | |
| 5006 | glUniform1iv( |
| 5007 | (GLint)location, |
| 5008 | (GLsizei)count, |
| 5009 | (GLint *)v |
| 5010 | ); |
| 5011 | |
| 5012 | exit: |
| 5013 | if (v_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5014 | _env->ReleaseIntArrayElements(v_ref, (jint*)v_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5015 | JNI_ABORT); |
| 5016 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5017 | if (_exception) { |
| 5018 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5019 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5020 | } |
| 5021 | |
| 5022 | /* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 5023 | static void |
| 5024 | android_glUniform1iv__IILjava_nio_IntBuffer_2 |
| 5025 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5026 | jint _exception = 0; |
| 5027 | const char * _exceptionType = NULL; |
| 5028 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5029 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5030 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5031 | jint _remaining; |
| 5032 | GLint *v = (GLint *) 0; |
| 5033 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 5034 | if (!v_buf) { |
| 5035 | _exception = 1; |
| 5036 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5037 | _exceptionMessage = "v == null"; |
| 5038 | goto exit; |
| 5039 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5040 | v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5041 | if (_remaining < count) { |
| 5042 | _exception = 1; |
| 5043 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5044 | _exceptionMessage = "remaining() < count < needed"; |
| 5045 | goto exit; |
| 5046 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5047 | if (v == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5048 | char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5049 | v = (GLint *) (_vBase + _bufferOffset); |
| 5050 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5051 | glUniform1iv( |
| 5052 | (GLint)location, |
| 5053 | (GLsizei)count, |
| 5054 | (GLint *)v |
| 5055 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5056 | |
| 5057 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5058 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5059 | _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5060 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5061 | if (_exception) { |
| 5062 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5063 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5064 | } |
| 5065 | |
| 5066 | /* void glUniform2f ( GLint location, GLfloat x, GLfloat y ) */ |
| 5067 | static void |
| 5068 | android_glUniform2f__IFF |
| 5069 | (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y) { |
| 5070 | glUniform2f( |
| 5071 | (GLint)location, |
| 5072 | (GLfloat)x, |
| 5073 | (GLfloat)y |
| 5074 | ); |
| 5075 | } |
| 5076 | |
| 5077 | /* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 5078 | static void |
| 5079 | android_glUniform2fv__II_3FI |
| 5080 | (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] | 5081 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5082 | const char * _exceptionType = NULL; |
| 5083 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5084 | GLfloat *v_base = (GLfloat *) 0; |
| 5085 | jint _remaining; |
| 5086 | GLfloat *v = (GLfloat *) 0; |
| 5087 | |
| 5088 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5089 | _exception = 1; |
| 5090 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5091 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5092 | goto exit; |
| 5093 | } |
| 5094 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5095 | _exception = 1; |
| 5096 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5097 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5098 | goto exit; |
| 5099 | } |
| 5100 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5101 | if (_remaining < count*2) { |
| 5102 | _exception = 1; |
| 5103 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5104 | _exceptionMessage = "length - offset < count*2 < needed"; |
| 5105 | goto exit; |
| 5106 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5107 | v_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5108 | _env->GetFloatArrayElements(v_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5109 | v = v_base + offset; |
| 5110 | |
| 5111 | glUniform2fv( |
| 5112 | (GLint)location, |
| 5113 | (GLsizei)count, |
| 5114 | (GLfloat *)v |
| 5115 | ); |
| 5116 | |
| 5117 | exit: |
| 5118 | if (v_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5119 | _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5120 | JNI_ABORT); |
| 5121 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5122 | if (_exception) { |
| 5123 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5124 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5125 | } |
| 5126 | |
| 5127 | /* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 5128 | static void |
| 5129 | android_glUniform2fv__IILjava_nio_FloatBuffer_2 |
| 5130 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5131 | jint _exception = 0; |
| 5132 | const char * _exceptionType = NULL; |
| 5133 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5134 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5135 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5136 | jint _remaining; |
| 5137 | GLfloat *v = (GLfloat *) 0; |
| 5138 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 5139 | if (!v_buf) { |
| 5140 | _exception = 1; |
| 5141 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5142 | _exceptionMessage = "v == null"; |
| 5143 | goto exit; |
| 5144 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5145 | v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5146 | if (_remaining < count*2) { |
| 5147 | _exception = 1; |
| 5148 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5149 | _exceptionMessage = "remaining() < count*2 < needed"; |
| 5150 | goto exit; |
| 5151 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5152 | if (v == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5153 | char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5154 | v = (GLfloat *) (_vBase + _bufferOffset); |
| 5155 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5156 | glUniform2fv( |
| 5157 | (GLint)location, |
| 5158 | (GLsizei)count, |
| 5159 | (GLfloat *)v |
| 5160 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5161 | |
| 5162 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5163 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5164 | _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5165 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5166 | if (_exception) { |
| 5167 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5168 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5169 | } |
| 5170 | |
| 5171 | /* void glUniform2i ( GLint location, GLint x, GLint y ) */ |
| 5172 | static void |
| 5173 | android_glUniform2i__III |
| 5174 | (JNIEnv *_env, jobject _this, jint location, jint x, jint y) { |
| 5175 | glUniform2i( |
| 5176 | (GLint)location, |
| 5177 | (GLint)x, |
| 5178 | (GLint)y |
| 5179 | ); |
| 5180 | } |
| 5181 | |
| 5182 | /* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 5183 | static void |
| 5184 | android_glUniform2iv__II_3II |
| 5185 | (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] | 5186 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5187 | const char * _exceptionType = NULL; |
| 5188 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5189 | GLint *v_base = (GLint *) 0; |
| 5190 | jint _remaining; |
| 5191 | GLint *v = (GLint *) 0; |
| 5192 | |
| 5193 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5194 | _exception = 1; |
| 5195 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5196 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5197 | goto exit; |
| 5198 | } |
| 5199 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5200 | _exception = 1; |
| 5201 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5202 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5203 | goto exit; |
| 5204 | } |
| 5205 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5206 | if (_remaining < count*2) { |
| 5207 | _exception = 1; |
| 5208 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5209 | _exceptionMessage = "length - offset < count*2 < needed"; |
| 5210 | goto exit; |
| 5211 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5212 | v_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5213 | _env->GetIntArrayElements(v_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5214 | v = v_base + offset; |
| 5215 | |
| 5216 | glUniform2iv( |
| 5217 | (GLint)location, |
| 5218 | (GLsizei)count, |
| 5219 | (GLint *)v |
| 5220 | ); |
| 5221 | |
| 5222 | exit: |
| 5223 | if (v_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5224 | _env->ReleaseIntArrayElements(v_ref, (jint*)v_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5225 | JNI_ABORT); |
| 5226 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5227 | if (_exception) { |
| 5228 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5229 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5230 | } |
| 5231 | |
| 5232 | /* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 5233 | static void |
| 5234 | android_glUniform2iv__IILjava_nio_IntBuffer_2 |
| 5235 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5236 | jint _exception = 0; |
| 5237 | const char * _exceptionType = NULL; |
| 5238 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5239 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5240 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5241 | jint _remaining; |
| 5242 | GLint *v = (GLint *) 0; |
| 5243 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 5244 | if (!v_buf) { |
| 5245 | _exception = 1; |
| 5246 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5247 | _exceptionMessage = "v == null"; |
| 5248 | goto exit; |
| 5249 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5250 | v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5251 | if (_remaining < count*2) { |
| 5252 | _exception = 1; |
| 5253 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5254 | _exceptionMessage = "remaining() < count*2 < needed"; |
| 5255 | goto exit; |
| 5256 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5257 | if (v == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5258 | char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5259 | v = (GLint *) (_vBase + _bufferOffset); |
| 5260 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5261 | glUniform2iv( |
| 5262 | (GLint)location, |
| 5263 | (GLsizei)count, |
| 5264 | (GLint *)v |
| 5265 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5266 | |
| 5267 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5268 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5269 | _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5270 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5271 | if (_exception) { |
| 5272 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5273 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5274 | } |
| 5275 | |
| 5276 | /* void glUniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z ) */ |
| 5277 | static void |
| 5278 | android_glUniform3f__IFFF |
| 5279 | (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z) { |
| 5280 | glUniform3f( |
| 5281 | (GLint)location, |
| 5282 | (GLfloat)x, |
| 5283 | (GLfloat)y, |
| 5284 | (GLfloat)z |
| 5285 | ); |
| 5286 | } |
| 5287 | |
| 5288 | /* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 5289 | static void |
| 5290 | android_glUniform3fv__II_3FI |
| 5291 | (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] | 5292 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5293 | const char * _exceptionType = NULL; |
| 5294 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5295 | GLfloat *v_base = (GLfloat *) 0; |
| 5296 | jint _remaining; |
| 5297 | GLfloat *v = (GLfloat *) 0; |
| 5298 | |
| 5299 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5300 | _exception = 1; |
| 5301 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5302 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5303 | goto exit; |
| 5304 | } |
| 5305 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5306 | _exception = 1; |
| 5307 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5308 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5309 | goto exit; |
| 5310 | } |
| 5311 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5312 | if (_remaining < count*3) { |
| 5313 | _exception = 1; |
| 5314 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5315 | _exceptionMessage = "length - offset < count*3 < needed"; |
| 5316 | goto exit; |
| 5317 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5318 | v_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5319 | _env->GetFloatArrayElements(v_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5320 | v = v_base + offset; |
| 5321 | |
| 5322 | glUniform3fv( |
| 5323 | (GLint)location, |
| 5324 | (GLsizei)count, |
| 5325 | (GLfloat *)v |
| 5326 | ); |
| 5327 | |
| 5328 | exit: |
| 5329 | if (v_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5330 | _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5331 | JNI_ABORT); |
| 5332 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5333 | if (_exception) { |
| 5334 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5335 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5336 | } |
| 5337 | |
| 5338 | /* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 5339 | static void |
| 5340 | android_glUniform3fv__IILjava_nio_FloatBuffer_2 |
| 5341 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5342 | jint _exception = 0; |
| 5343 | const char * _exceptionType = NULL; |
| 5344 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5345 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5346 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5347 | jint _remaining; |
| 5348 | GLfloat *v = (GLfloat *) 0; |
| 5349 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 5350 | if (!v_buf) { |
| 5351 | _exception = 1; |
| 5352 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5353 | _exceptionMessage = "v == null"; |
| 5354 | goto exit; |
| 5355 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5356 | v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5357 | if (_remaining < count*3) { |
| 5358 | _exception = 1; |
| 5359 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5360 | _exceptionMessage = "remaining() < count*3 < needed"; |
| 5361 | goto exit; |
| 5362 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5363 | if (v == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5364 | char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5365 | v = (GLfloat *) (_vBase + _bufferOffset); |
| 5366 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5367 | glUniform3fv( |
| 5368 | (GLint)location, |
| 5369 | (GLsizei)count, |
| 5370 | (GLfloat *)v |
| 5371 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5372 | |
| 5373 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5374 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5375 | _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5376 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5377 | if (_exception) { |
| 5378 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5379 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5380 | } |
| 5381 | |
| 5382 | /* void glUniform3i ( GLint location, GLint x, GLint y, GLint z ) */ |
| 5383 | static void |
| 5384 | android_glUniform3i__IIII |
| 5385 | (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z) { |
| 5386 | glUniform3i( |
| 5387 | (GLint)location, |
| 5388 | (GLint)x, |
| 5389 | (GLint)y, |
| 5390 | (GLint)z |
| 5391 | ); |
| 5392 | } |
| 5393 | |
| 5394 | /* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 5395 | static void |
| 5396 | android_glUniform3iv__II_3II |
| 5397 | (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] | 5398 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5399 | const char * _exceptionType = NULL; |
| 5400 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5401 | GLint *v_base = (GLint *) 0; |
| 5402 | jint _remaining; |
| 5403 | GLint *v = (GLint *) 0; |
| 5404 | |
| 5405 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5406 | _exception = 1; |
| 5407 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5408 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5409 | goto exit; |
| 5410 | } |
| 5411 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5412 | _exception = 1; |
| 5413 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5414 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5415 | goto exit; |
| 5416 | } |
| 5417 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5418 | if (_remaining < count*3) { |
| 5419 | _exception = 1; |
| 5420 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5421 | _exceptionMessage = "length - offset < count*3 < needed"; |
| 5422 | goto exit; |
| 5423 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5424 | v_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5425 | _env->GetIntArrayElements(v_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5426 | v = v_base + offset; |
| 5427 | |
| 5428 | glUniform3iv( |
| 5429 | (GLint)location, |
| 5430 | (GLsizei)count, |
| 5431 | (GLint *)v |
| 5432 | ); |
| 5433 | |
| 5434 | exit: |
| 5435 | if (v_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5436 | _env->ReleaseIntArrayElements(v_ref, (jint*)v_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5437 | JNI_ABORT); |
| 5438 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5439 | if (_exception) { |
| 5440 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5441 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5442 | } |
| 5443 | |
| 5444 | /* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 5445 | static void |
| 5446 | android_glUniform3iv__IILjava_nio_IntBuffer_2 |
| 5447 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5448 | jint _exception = 0; |
| 5449 | const char * _exceptionType = NULL; |
| 5450 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5451 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5452 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5453 | jint _remaining; |
| 5454 | GLint *v = (GLint *) 0; |
| 5455 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 5456 | if (!v_buf) { |
| 5457 | _exception = 1; |
| 5458 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5459 | _exceptionMessage = "v == null"; |
| 5460 | goto exit; |
| 5461 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5462 | v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5463 | if (_remaining < count*3) { |
| 5464 | _exception = 1; |
| 5465 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5466 | _exceptionMessage = "remaining() < count*3 < needed"; |
| 5467 | goto exit; |
| 5468 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5469 | if (v == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5470 | char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5471 | v = (GLint *) (_vBase + _bufferOffset); |
| 5472 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5473 | glUniform3iv( |
| 5474 | (GLint)location, |
| 5475 | (GLsizei)count, |
| 5476 | (GLint *)v |
| 5477 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5478 | |
| 5479 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5480 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5481 | _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5482 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5483 | if (_exception) { |
| 5484 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5485 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5486 | } |
| 5487 | |
| 5488 | /* void glUniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */ |
| 5489 | static void |
| 5490 | android_glUniform4f__IFFFF |
| 5491 | (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z, jfloat w) { |
| 5492 | glUniform4f( |
| 5493 | (GLint)location, |
| 5494 | (GLfloat)x, |
| 5495 | (GLfloat)y, |
| 5496 | (GLfloat)z, |
| 5497 | (GLfloat)w |
| 5498 | ); |
| 5499 | } |
| 5500 | |
| 5501 | /* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 5502 | static void |
| 5503 | android_glUniform4fv__II_3FI |
| 5504 | (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] | 5505 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5506 | const char * _exceptionType = NULL; |
| 5507 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5508 | GLfloat *v_base = (GLfloat *) 0; |
| 5509 | jint _remaining; |
| 5510 | GLfloat *v = (GLfloat *) 0; |
| 5511 | |
| 5512 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5513 | _exception = 1; |
| 5514 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5515 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5516 | goto exit; |
| 5517 | } |
| 5518 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5519 | _exception = 1; |
| 5520 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5521 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5522 | goto exit; |
| 5523 | } |
| 5524 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5525 | if (_remaining < count*4) { |
| 5526 | _exception = 1; |
| 5527 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5528 | _exceptionMessage = "length - offset < count*4 < needed"; |
| 5529 | goto exit; |
| 5530 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5531 | v_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5532 | _env->GetFloatArrayElements(v_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5533 | v = v_base + offset; |
| 5534 | |
| 5535 | glUniform4fv( |
| 5536 | (GLint)location, |
| 5537 | (GLsizei)count, |
| 5538 | (GLfloat *)v |
| 5539 | ); |
| 5540 | |
| 5541 | exit: |
| 5542 | if (v_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5543 | _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5544 | JNI_ABORT); |
| 5545 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5546 | if (_exception) { |
| 5547 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5548 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5549 | } |
| 5550 | |
| 5551 | /* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 5552 | static void |
| 5553 | android_glUniform4fv__IILjava_nio_FloatBuffer_2 |
| 5554 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5555 | jint _exception = 0; |
| 5556 | const char * _exceptionType = NULL; |
| 5557 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5558 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5559 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5560 | jint _remaining; |
| 5561 | GLfloat *v = (GLfloat *) 0; |
| 5562 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 5563 | if (!v_buf) { |
| 5564 | _exception = 1; |
| 5565 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5566 | _exceptionMessage = "v == null"; |
| 5567 | goto exit; |
| 5568 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5569 | v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5570 | if (_remaining < count*4) { |
| 5571 | _exception = 1; |
| 5572 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5573 | _exceptionMessage = "remaining() < count*4 < needed"; |
| 5574 | goto exit; |
| 5575 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5576 | if (v == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5577 | char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5578 | v = (GLfloat *) (_vBase + _bufferOffset); |
| 5579 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5580 | glUniform4fv( |
| 5581 | (GLint)location, |
| 5582 | (GLsizei)count, |
| 5583 | (GLfloat *)v |
| 5584 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5585 | |
| 5586 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5587 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5588 | _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5589 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5590 | if (_exception) { |
| 5591 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5592 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5593 | } |
| 5594 | |
| 5595 | /* void glUniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w ) */ |
| 5596 | static void |
| 5597 | android_glUniform4i__IIIII |
| 5598 | (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z, jint w) { |
| 5599 | glUniform4i( |
| 5600 | (GLint)location, |
| 5601 | (GLint)x, |
| 5602 | (GLint)y, |
| 5603 | (GLint)z, |
| 5604 | (GLint)w |
| 5605 | ); |
| 5606 | } |
| 5607 | |
| 5608 | /* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 5609 | static void |
| 5610 | android_glUniform4iv__II_3II |
| 5611 | (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] | 5612 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5613 | const char * _exceptionType = NULL; |
| 5614 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5615 | GLint *v_base = (GLint *) 0; |
| 5616 | jint _remaining; |
| 5617 | GLint *v = (GLint *) 0; |
| 5618 | |
| 5619 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5620 | _exception = 1; |
| 5621 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5622 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5623 | goto exit; |
| 5624 | } |
| 5625 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5626 | _exception = 1; |
| 5627 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5628 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5629 | goto exit; |
| 5630 | } |
| 5631 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5632 | if (_remaining < count*4) { |
| 5633 | _exception = 1; |
| 5634 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5635 | _exceptionMessage = "length - offset < count*4 < needed"; |
| 5636 | goto exit; |
| 5637 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5638 | v_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5639 | _env->GetIntArrayElements(v_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5640 | v = v_base + offset; |
| 5641 | |
| 5642 | glUniform4iv( |
| 5643 | (GLint)location, |
| 5644 | (GLsizei)count, |
| 5645 | (GLint *)v |
| 5646 | ); |
| 5647 | |
| 5648 | exit: |
| 5649 | if (v_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5650 | _env->ReleaseIntArrayElements(v_ref, (jint*)v_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5651 | JNI_ABORT); |
| 5652 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5653 | if (_exception) { |
| 5654 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5655 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5656 | } |
| 5657 | |
| 5658 | /* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 5659 | static void |
| 5660 | android_glUniform4iv__IILjava_nio_IntBuffer_2 |
| 5661 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5662 | jint _exception = 0; |
| 5663 | const char * _exceptionType = NULL; |
| 5664 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5665 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5666 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5667 | jint _remaining; |
| 5668 | GLint *v = (GLint *) 0; |
| 5669 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 5670 | if (!v_buf) { |
| 5671 | _exception = 1; |
| 5672 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5673 | _exceptionMessage = "v == null"; |
| 5674 | goto exit; |
| 5675 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5676 | v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5677 | if (_remaining < count*4) { |
| 5678 | _exception = 1; |
| 5679 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5680 | _exceptionMessage = "remaining() < count*4 < needed"; |
| 5681 | goto exit; |
| 5682 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5683 | if (v == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5684 | char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5685 | v = (GLint *) (_vBase + _bufferOffset); |
| 5686 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5687 | glUniform4iv( |
| 5688 | (GLint)location, |
| 5689 | (GLsizei)count, |
| 5690 | (GLint *)v |
| 5691 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5692 | |
| 5693 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5694 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5695 | _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5696 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5697 | if (_exception) { |
| 5698 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5699 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5700 | } |
| 5701 | |
| 5702 | /* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ |
| 5703 | static void |
| 5704 | android_glUniformMatrix2fv__IIZ_3FI |
| 5705 | (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] | 5706 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5707 | const char * _exceptionType = NULL; |
| 5708 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5709 | GLfloat *value_base = (GLfloat *) 0; |
| 5710 | jint _remaining; |
| 5711 | GLfloat *value = (GLfloat *) 0; |
| 5712 | |
| 5713 | if (!value_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5714 | _exception = 1; |
| 5715 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5716 | _exceptionMessage = "value == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5717 | goto exit; |
| 5718 | } |
| 5719 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5720 | _exception = 1; |
| 5721 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5722 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5723 | goto exit; |
| 5724 | } |
| 5725 | _remaining = _env->GetArrayLength(value_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5726 | if (_remaining < count*4) { |
| 5727 | _exception = 1; |
| 5728 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5729 | _exceptionMessage = "length - offset < count*4 < needed"; |
| 5730 | goto exit; |
| 5731 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5732 | value_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5733 | _env->GetFloatArrayElements(value_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5734 | value = value_base + offset; |
| 5735 | |
| 5736 | glUniformMatrix2fv( |
| 5737 | (GLint)location, |
| 5738 | (GLsizei)count, |
| 5739 | (GLboolean)transpose, |
| 5740 | (GLfloat *)value |
| 5741 | ); |
| 5742 | |
| 5743 | exit: |
| 5744 | if (value_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5745 | _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5746 | JNI_ABORT); |
| 5747 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5748 | if (_exception) { |
| 5749 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5750 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5751 | } |
| 5752 | |
| 5753 | /* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ |
| 5754 | static void |
| 5755 | android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 |
| 5756 | (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5757 | jint _exception = 0; |
| 5758 | const char * _exceptionType = NULL; |
| 5759 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5760 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5761 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5762 | jint _remaining; |
| 5763 | GLfloat *value = (GLfloat *) 0; |
| 5764 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 5765 | if (!value_buf) { |
| 5766 | _exception = 1; |
| 5767 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5768 | _exceptionMessage = "value == null"; |
| 5769 | goto exit; |
| 5770 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5771 | value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5772 | if (_remaining < count*4) { |
| 5773 | _exception = 1; |
| 5774 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5775 | _exceptionMessage = "remaining() < count*4 < needed"; |
| 5776 | goto exit; |
| 5777 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5778 | if (value == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5779 | char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5780 | value = (GLfloat *) (_valueBase + _bufferOffset); |
| 5781 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5782 | glUniformMatrix2fv( |
| 5783 | (GLint)location, |
| 5784 | (GLsizei)count, |
| 5785 | (GLboolean)transpose, |
| 5786 | (GLfloat *)value |
| 5787 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5788 | |
| 5789 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5790 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5791 | _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5792 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5793 | if (_exception) { |
| 5794 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5795 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5796 | } |
| 5797 | |
| 5798 | /* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ |
| 5799 | static void |
| 5800 | android_glUniformMatrix3fv__IIZ_3FI |
| 5801 | (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] | 5802 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5803 | const char * _exceptionType = NULL; |
| 5804 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5805 | GLfloat *value_base = (GLfloat *) 0; |
| 5806 | jint _remaining; |
| 5807 | GLfloat *value = (GLfloat *) 0; |
| 5808 | |
| 5809 | if (!value_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5810 | _exception = 1; |
| 5811 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5812 | _exceptionMessage = "value == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5813 | goto exit; |
| 5814 | } |
| 5815 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5816 | _exception = 1; |
| 5817 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5818 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5819 | goto exit; |
| 5820 | } |
| 5821 | _remaining = _env->GetArrayLength(value_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5822 | if (_remaining < count*9) { |
| 5823 | _exception = 1; |
| 5824 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5825 | _exceptionMessage = "length - offset < count*9 < needed"; |
| 5826 | goto exit; |
| 5827 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5828 | value_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5829 | _env->GetFloatArrayElements(value_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5830 | value = value_base + offset; |
| 5831 | |
| 5832 | glUniformMatrix3fv( |
| 5833 | (GLint)location, |
| 5834 | (GLsizei)count, |
| 5835 | (GLboolean)transpose, |
| 5836 | (GLfloat *)value |
| 5837 | ); |
| 5838 | |
| 5839 | exit: |
| 5840 | if (value_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5841 | _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5842 | JNI_ABORT); |
| 5843 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5844 | if (_exception) { |
| 5845 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5846 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5847 | } |
| 5848 | |
| 5849 | /* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ |
| 5850 | static void |
| 5851 | android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 |
| 5852 | (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5853 | jint _exception = 0; |
| 5854 | const char * _exceptionType = NULL; |
| 5855 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5856 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5857 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5858 | jint _remaining; |
| 5859 | GLfloat *value = (GLfloat *) 0; |
| 5860 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 5861 | if (!value_buf) { |
| 5862 | _exception = 1; |
| 5863 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5864 | _exceptionMessage = "value == null"; |
| 5865 | goto exit; |
| 5866 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5867 | value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5868 | if (_remaining < count*9) { |
| 5869 | _exception = 1; |
| 5870 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5871 | _exceptionMessage = "remaining() < count*9 < needed"; |
| 5872 | goto exit; |
| 5873 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5874 | if (value == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5875 | char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5876 | value = (GLfloat *) (_valueBase + _bufferOffset); |
| 5877 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5878 | glUniformMatrix3fv( |
| 5879 | (GLint)location, |
| 5880 | (GLsizei)count, |
| 5881 | (GLboolean)transpose, |
| 5882 | (GLfloat *)value |
| 5883 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5884 | |
| 5885 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5886 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5887 | _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5888 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5889 | if (_exception) { |
| 5890 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5891 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5892 | } |
| 5893 | |
| 5894 | /* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ |
| 5895 | static void |
| 5896 | android_glUniformMatrix4fv__IIZ_3FI |
| 5897 | (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] | 5898 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5899 | const char * _exceptionType = NULL; |
| 5900 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5901 | GLfloat *value_base = (GLfloat *) 0; |
| 5902 | jint _remaining; |
| 5903 | GLfloat *value = (GLfloat *) 0; |
| 5904 | |
| 5905 | if (!value_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5906 | _exception = 1; |
| 5907 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5908 | _exceptionMessage = "value == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5909 | goto exit; |
| 5910 | } |
| 5911 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5912 | _exception = 1; |
| 5913 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5914 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5915 | goto exit; |
| 5916 | } |
| 5917 | _remaining = _env->GetArrayLength(value_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5918 | if (_remaining < count*16) { |
| 5919 | _exception = 1; |
| 5920 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5921 | _exceptionMessage = "length - offset < count*16 < needed"; |
| 5922 | goto exit; |
| 5923 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5924 | value_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5925 | _env->GetFloatArrayElements(value_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5926 | value = value_base + offset; |
| 5927 | |
| 5928 | glUniformMatrix4fv( |
| 5929 | (GLint)location, |
| 5930 | (GLsizei)count, |
| 5931 | (GLboolean)transpose, |
| 5932 | (GLfloat *)value |
| 5933 | ); |
| 5934 | |
| 5935 | exit: |
| 5936 | if (value_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5937 | _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5938 | JNI_ABORT); |
| 5939 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5940 | if (_exception) { |
| 5941 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5942 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5943 | } |
| 5944 | |
| 5945 | /* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ |
| 5946 | static void |
| 5947 | android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2 |
| 5948 | (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5949 | jint _exception = 0; |
| 5950 | const char * _exceptionType = NULL; |
| 5951 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5952 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5953 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5954 | jint _remaining; |
| 5955 | GLfloat *value = (GLfloat *) 0; |
| 5956 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 5957 | if (!value_buf) { |
| 5958 | _exception = 1; |
| 5959 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5960 | _exceptionMessage = "value == null"; |
| 5961 | goto exit; |
| 5962 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5963 | value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5964 | if (_remaining < count*16) { |
| 5965 | _exception = 1; |
| 5966 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5967 | _exceptionMessage = "remaining() < count*16 < needed"; |
| 5968 | goto exit; |
| 5969 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5970 | if (value == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5971 | char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5972 | value = (GLfloat *) (_valueBase + _bufferOffset); |
| 5973 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5974 | glUniformMatrix4fv( |
| 5975 | (GLint)location, |
| 5976 | (GLsizei)count, |
| 5977 | (GLboolean)transpose, |
| 5978 | (GLfloat *)value |
| 5979 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5980 | |
| 5981 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5982 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5983 | _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5984 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5985 | if (_exception) { |
| 5986 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5987 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5988 | } |
| 5989 | |
| 5990 | /* void glUseProgram ( GLuint program ) */ |
| 5991 | static void |
| 5992 | android_glUseProgram__I |
| 5993 | (JNIEnv *_env, jobject _this, jint program) { |
| 5994 | glUseProgram( |
| 5995 | (GLuint)program |
| 5996 | ); |
| 5997 | } |
| 5998 | |
| 5999 | /* void glValidateProgram ( GLuint program ) */ |
| 6000 | static void |
| 6001 | android_glValidateProgram__I |
| 6002 | (JNIEnv *_env, jobject _this, jint program) { |
| 6003 | glValidateProgram( |
| 6004 | (GLuint)program |
| 6005 | ); |
| 6006 | } |
| 6007 | |
| 6008 | /* void glVertexAttrib1f ( GLuint indx, GLfloat x ) */ |
| 6009 | static void |
| 6010 | android_glVertexAttrib1f__IF |
| 6011 | (JNIEnv *_env, jobject _this, jint indx, jfloat x) { |
| 6012 | glVertexAttrib1f( |
| 6013 | (GLuint)indx, |
| 6014 | (GLfloat)x |
| 6015 | ); |
| 6016 | } |
| 6017 | |
| 6018 | /* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */ |
| 6019 | static void |
| 6020 | android_glVertexAttrib1fv__I_3FI |
| 6021 | (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6022 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6023 | const char * _exceptionType = NULL; |
| 6024 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6025 | GLfloat *values_base = (GLfloat *) 0; |
| 6026 | jint _remaining; |
| 6027 | GLfloat *values = (GLfloat *) 0; |
| 6028 | |
| 6029 | if (!values_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6030 | _exception = 1; |
| 6031 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6032 | _exceptionMessage = "values == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6033 | goto exit; |
| 6034 | } |
| 6035 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6036 | _exception = 1; |
| 6037 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6038 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6039 | goto exit; |
| 6040 | } |
| 6041 | _remaining = _env->GetArrayLength(values_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6042 | if (_remaining < 1) { |
| 6043 | _exception = 1; |
| 6044 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6045 | _exceptionMessage = "length - offset < 1 < needed"; |
| 6046 | goto exit; |
| 6047 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6048 | values_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6049 | _env->GetFloatArrayElements(values_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6050 | values = values_base + offset; |
| 6051 | |
| 6052 | glVertexAttrib1fv( |
| 6053 | (GLuint)indx, |
| 6054 | (GLfloat *)values |
| 6055 | ); |
| 6056 | |
| 6057 | exit: |
| 6058 | if (values_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6059 | _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6060 | JNI_ABORT); |
| 6061 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6062 | if (_exception) { |
| 6063 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 6064 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6065 | } |
| 6066 | |
| 6067 | /* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */ |
| 6068 | static void |
| 6069 | android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2 |
| 6070 | (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6071 | jint _exception = 0; |
| 6072 | const char * _exceptionType = NULL; |
| 6073 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6074 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6075 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6076 | jint _remaining; |
| 6077 | GLfloat *values = (GLfloat *) 0; |
| 6078 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 6079 | if (!values_buf) { |
| 6080 | _exception = 1; |
| 6081 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6082 | _exceptionMessage = "values == null"; |
| 6083 | goto exit; |
| 6084 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6085 | values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6086 | if (_remaining < 1) { |
| 6087 | _exception = 1; |
| 6088 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6089 | _exceptionMessage = "remaining() < 1 < needed"; |
| 6090 | goto exit; |
| 6091 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6092 | if (values == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6093 | char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6094 | values = (GLfloat *) (_valuesBase + _bufferOffset); |
| 6095 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6096 | glVertexAttrib1fv( |
| 6097 | (GLuint)indx, |
| 6098 | (GLfloat *)values |
| 6099 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6100 | |
| 6101 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6102 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6103 | _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6104 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6105 | if (_exception) { |
| 6106 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 6107 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6108 | } |
| 6109 | |
| 6110 | /* void glVertexAttrib2f ( GLuint indx, GLfloat x, GLfloat y ) */ |
| 6111 | static void |
| 6112 | android_glVertexAttrib2f__IFF |
| 6113 | (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y) { |
| 6114 | glVertexAttrib2f( |
| 6115 | (GLuint)indx, |
| 6116 | (GLfloat)x, |
| 6117 | (GLfloat)y |
| 6118 | ); |
| 6119 | } |
| 6120 | |
| 6121 | /* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */ |
| 6122 | static void |
| 6123 | android_glVertexAttrib2fv__I_3FI |
| 6124 | (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6125 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6126 | const char * _exceptionType = NULL; |
| 6127 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6128 | GLfloat *values_base = (GLfloat *) 0; |
| 6129 | jint _remaining; |
| 6130 | GLfloat *values = (GLfloat *) 0; |
| 6131 | |
| 6132 | if (!values_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6133 | _exception = 1; |
| 6134 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6135 | _exceptionMessage = "values == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6136 | goto exit; |
| 6137 | } |
| 6138 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6139 | _exception = 1; |
| 6140 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6141 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6142 | goto exit; |
| 6143 | } |
| 6144 | _remaining = _env->GetArrayLength(values_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6145 | if (_remaining < 2) { |
| 6146 | _exception = 1; |
| 6147 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6148 | _exceptionMessage = "length - offset < 2 < needed"; |
| 6149 | goto exit; |
| 6150 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6151 | values_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6152 | _env->GetFloatArrayElements(values_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6153 | values = values_base + offset; |
| 6154 | |
| 6155 | glVertexAttrib2fv( |
| 6156 | (GLuint)indx, |
| 6157 | (GLfloat *)values |
| 6158 | ); |
| 6159 | |
| 6160 | exit: |
| 6161 | if (values_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6162 | _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6163 | JNI_ABORT); |
| 6164 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6165 | if (_exception) { |
| 6166 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 6167 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6168 | } |
| 6169 | |
| 6170 | /* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */ |
| 6171 | static void |
| 6172 | android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2 |
| 6173 | (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6174 | jint _exception = 0; |
| 6175 | const char * _exceptionType = NULL; |
| 6176 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6177 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6178 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6179 | jint _remaining; |
| 6180 | GLfloat *values = (GLfloat *) 0; |
| 6181 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 6182 | if (!values_buf) { |
| 6183 | _exception = 1; |
| 6184 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6185 | _exceptionMessage = "values == null"; |
| 6186 | goto exit; |
| 6187 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6188 | values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6189 | if (_remaining < 2) { |
| 6190 | _exception = 1; |
| 6191 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6192 | _exceptionMessage = "remaining() < 2 < needed"; |
| 6193 | goto exit; |
| 6194 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6195 | if (values == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6196 | char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6197 | values = (GLfloat *) (_valuesBase + _bufferOffset); |
| 6198 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6199 | glVertexAttrib2fv( |
| 6200 | (GLuint)indx, |
| 6201 | (GLfloat *)values |
| 6202 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6203 | |
| 6204 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6205 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6206 | _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6207 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6208 | if (_exception) { |
| 6209 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 6210 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6211 | } |
| 6212 | |
| 6213 | /* void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z ) */ |
| 6214 | static void |
| 6215 | android_glVertexAttrib3f__IFFF |
| 6216 | (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z) { |
| 6217 | glVertexAttrib3f( |
| 6218 | (GLuint)indx, |
| 6219 | (GLfloat)x, |
| 6220 | (GLfloat)y, |
| 6221 | (GLfloat)z |
| 6222 | ); |
| 6223 | } |
| 6224 | |
| 6225 | /* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */ |
| 6226 | static void |
| 6227 | android_glVertexAttrib3fv__I_3FI |
| 6228 | (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6229 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6230 | const char * _exceptionType = NULL; |
| 6231 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6232 | GLfloat *values_base = (GLfloat *) 0; |
| 6233 | jint _remaining; |
| 6234 | GLfloat *values = (GLfloat *) 0; |
| 6235 | |
| 6236 | if (!values_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6237 | _exception = 1; |
| 6238 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6239 | _exceptionMessage = "values == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6240 | goto exit; |
| 6241 | } |
| 6242 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6243 | _exception = 1; |
| 6244 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6245 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6246 | goto exit; |
| 6247 | } |
| 6248 | _remaining = _env->GetArrayLength(values_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6249 | if (_remaining < 3) { |
| 6250 | _exception = 1; |
| 6251 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6252 | _exceptionMessage = "length - offset < 3 < needed"; |
| 6253 | goto exit; |
| 6254 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6255 | values_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6256 | _env->GetFloatArrayElements(values_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6257 | values = values_base + offset; |
| 6258 | |
| 6259 | glVertexAttrib3fv( |
| 6260 | (GLuint)indx, |
| 6261 | (GLfloat *)values |
| 6262 | ); |
| 6263 | |
| 6264 | exit: |
| 6265 | if (values_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6266 | _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6267 | JNI_ABORT); |
| 6268 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6269 | if (_exception) { |
| 6270 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 6271 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6272 | } |
| 6273 | |
| 6274 | /* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */ |
| 6275 | static void |
| 6276 | android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2 |
| 6277 | (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6278 | jint _exception = 0; |
| 6279 | const char * _exceptionType = NULL; |
| 6280 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6281 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6282 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6283 | jint _remaining; |
| 6284 | GLfloat *values = (GLfloat *) 0; |
| 6285 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 6286 | if (!values_buf) { |
| 6287 | _exception = 1; |
| 6288 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6289 | _exceptionMessage = "values == null"; |
| 6290 | goto exit; |
| 6291 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6292 | values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6293 | if (_remaining < 3) { |
| 6294 | _exception = 1; |
| 6295 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6296 | _exceptionMessage = "remaining() < 3 < needed"; |
| 6297 | goto exit; |
| 6298 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6299 | if (values == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6300 | char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6301 | values = (GLfloat *) (_valuesBase + _bufferOffset); |
| 6302 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6303 | glVertexAttrib3fv( |
| 6304 | (GLuint)indx, |
| 6305 | (GLfloat *)values |
| 6306 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6307 | |
| 6308 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6309 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6310 | _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6311 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6312 | if (_exception) { |
| 6313 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 6314 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6315 | } |
| 6316 | |
| 6317 | /* void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */ |
| 6318 | static void |
| 6319 | android_glVertexAttrib4f__IFFFF |
| 6320 | (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z, jfloat w) { |
| 6321 | glVertexAttrib4f( |
| 6322 | (GLuint)indx, |
| 6323 | (GLfloat)x, |
| 6324 | (GLfloat)y, |
| 6325 | (GLfloat)z, |
| 6326 | (GLfloat)w |
| 6327 | ); |
| 6328 | } |
| 6329 | |
| 6330 | /* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */ |
| 6331 | static void |
| 6332 | android_glVertexAttrib4fv__I_3FI |
| 6333 | (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6334 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6335 | const char * _exceptionType = NULL; |
| 6336 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6337 | GLfloat *values_base = (GLfloat *) 0; |
| 6338 | jint _remaining; |
| 6339 | GLfloat *values = (GLfloat *) 0; |
| 6340 | |
| 6341 | if (!values_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6342 | _exception = 1; |
| 6343 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6344 | _exceptionMessage = "values == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6345 | goto exit; |
| 6346 | } |
| 6347 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6348 | _exception = 1; |
| 6349 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6350 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6351 | goto exit; |
| 6352 | } |
| 6353 | _remaining = _env->GetArrayLength(values_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6354 | if (_remaining < 4) { |
| 6355 | _exception = 1; |
| 6356 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6357 | _exceptionMessage = "length - offset < 4 < needed"; |
| 6358 | goto exit; |
| 6359 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6360 | values_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6361 | _env->GetFloatArrayElements(values_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6362 | values = values_base + offset; |
| 6363 | |
| 6364 | glVertexAttrib4fv( |
| 6365 | (GLuint)indx, |
| 6366 | (GLfloat *)values |
| 6367 | ); |
| 6368 | |
| 6369 | exit: |
| 6370 | if (values_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6371 | _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6372 | JNI_ABORT); |
| 6373 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6374 | if (_exception) { |
| 6375 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 6376 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6377 | } |
| 6378 | |
| 6379 | /* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */ |
| 6380 | static void |
| 6381 | android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 |
| 6382 | (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6383 | jint _exception = 0; |
| 6384 | const char * _exceptionType = NULL; |
| 6385 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6386 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6387 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6388 | jint _remaining; |
| 6389 | GLfloat *values = (GLfloat *) 0; |
| 6390 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 6391 | if (!values_buf) { |
| 6392 | _exception = 1; |
| 6393 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6394 | _exceptionMessage = "values == null"; |
| 6395 | goto exit; |
| 6396 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6397 | values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6398 | if (_remaining < 4) { |
| 6399 | _exception = 1; |
| 6400 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6401 | _exceptionMessage = "remaining() < 4 < needed"; |
| 6402 | goto exit; |
| 6403 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6404 | if (values == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6405 | char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6406 | values = (GLfloat *) (_valuesBase + _bufferOffset); |
| 6407 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6408 | glVertexAttrib4fv( |
| 6409 | (GLuint)indx, |
| 6410 | (GLfloat *)values |
| 6411 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6412 | |
| 6413 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6414 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6415 | _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6416 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6417 | if (_exception) { |
| 6418 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 6419 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6420 | } |
| 6421 | |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 6422 | /* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint offset ) */ |
| 6423 | static void |
| 6424 | android_glVertexAttribPointer__IIIZII |
| 6425 | (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jint offset) { |
| 6426 | glVertexAttribPointer( |
| 6427 | (GLuint)indx, |
| 6428 | (GLint)size, |
| 6429 | (GLenum)type, |
| 6430 | (GLboolean)normalized, |
| 6431 | (GLsizei)stride, |
Ashok Bhat | 01c26ea | 2014-02-24 09:49:07 +0000 | [diff] [blame] | 6432 | reinterpret_cast<GLvoid *>(offset) |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 6433 | ); |
| 6434 | } |
| 6435 | |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6436 | /* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr ) */ |
| 6437 | static void |
| 6438 | android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I |
| 6439 | (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jobject ptr_buf, jint remaining) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 6440 | jint _exception = 0; |
| 6441 | const char * _exceptionType = NULL; |
| 6442 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6443 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6444 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6445 | jint _remaining; |
| 6446 | GLvoid *ptr = (GLvoid *) 0; |
| 6447 | |
| 6448 | if (ptr_buf) { |
| 6449 | ptr = (GLvoid *) getDirectBufferPointer(_env, ptr_buf); |
| 6450 | if ( ! ptr ) { |
| 6451 | return; |
| 6452 | } |
| 6453 | } |
| 6454 | glVertexAttribPointerBounds( |
| 6455 | (GLuint)indx, |
| 6456 | (GLint)size, |
| 6457 | (GLenum)type, |
| 6458 | (GLboolean)normalized, |
| 6459 | (GLsizei)stride, |
| 6460 | (GLvoid *)ptr, |
| 6461 | (GLsizei)remaining |
| 6462 | ); |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 6463 | if (_exception) { |
| 6464 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 6465 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6466 | } |
| 6467 | |
| 6468 | /* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */ |
| 6469 | static void |
| 6470 | android_glViewport__IIII |
| 6471 | (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) { |
| 6472 | glViewport( |
| 6473 | (GLint)x, |
| 6474 | (GLint)y, |
| 6475 | (GLsizei)width, |
| 6476 | (GLsizei)height |
| 6477 | ); |
| 6478 | } |
| 6479 | |
| 6480 | static const char *classPathName = "android/opengl/GLES20"; |
| 6481 | |
Daniel Micay | 76f6a86 | 2015-09-19 17:31:01 -0400 | [diff] [blame] | 6482 | static const JNINativeMethod methods[] = { |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6483 | {"_nativeClassInit", "()V", (void*)nativeClassInit }, |
| 6484 | {"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I }, |
| 6485 | {"glAttachShader", "(II)V", (void *) android_glAttachShader__II }, |
| 6486 | {"glBindAttribLocation", "(IILjava/lang/String;)V", (void *) android_glBindAttribLocation__IILjava_lang_String_2 }, |
| 6487 | {"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II }, |
| 6488 | {"glBindFramebuffer", "(II)V", (void *) android_glBindFramebuffer__II }, |
| 6489 | {"glBindRenderbuffer", "(II)V", (void *) android_glBindRenderbuffer__II }, |
| 6490 | {"glBindTexture", "(II)V", (void *) android_glBindTexture__II }, |
| 6491 | {"glBlendColor", "(FFFF)V", (void *) android_glBlendColor__FFFF }, |
| 6492 | {"glBlendEquation", "(I)V", (void *) android_glBlendEquation__I }, |
| 6493 | {"glBlendEquationSeparate", "(II)V", (void *) android_glBlendEquationSeparate__II }, |
| 6494 | {"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II }, |
| 6495 | {"glBlendFuncSeparate", "(IIII)V", (void *) android_glBlendFuncSeparate__IIII }, |
| 6496 | {"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I }, |
| 6497 | {"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 }, |
| 6498 | {"glCheckFramebufferStatus", "(I)I", (void *) android_glCheckFramebufferStatus__I }, |
| 6499 | {"glClear", "(I)V", (void *) android_glClear__I }, |
| 6500 | {"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF }, |
| 6501 | {"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F }, |
| 6502 | {"glClearStencil", "(I)V", (void *) android_glClearStencil__I }, |
| 6503 | {"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ }, |
| 6504 | {"glCompileShader", "(I)V", (void *) android_glCompileShader__I }, |
| 6505 | {"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 }, |
| 6506 | {"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 }, |
| 6507 | {"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII }, |
| 6508 | {"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII }, |
| 6509 | {"glCreateProgram", "()I", (void *) android_glCreateProgram__ }, |
| 6510 | {"glCreateShader", "(I)I", (void *) android_glCreateShader__I }, |
| 6511 | {"glCullFace", "(I)V", (void *) android_glCullFace__I }, |
| 6512 | {"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II }, |
| 6513 | {"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 }, |
| 6514 | {"glDeleteFramebuffers", "(I[II)V", (void *) android_glDeleteFramebuffers__I_3II }, |
| 6515 | {"glDeleteFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2 }, |
| 6516 | {"glDeleteProgram", "(I)V", (void *) android_glDeleteProgram__I }, |
| 6517 | {"glDeleteRenderbuffers", "(I[II)V", (void *) android_glDeleteRenderbuffers__I_3II }, |
| 6518 | {"glDeleteRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2 }, |
| 6519 | {"glDeleteShader", "(I)V", (void *) android_glDeleteShader__I }, |
| 6520 | {"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II }, |
| 6521 | {"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 }, |
| 6522 | {"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I }, |
| 6523 | {"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z }, |
| 6524 | {"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF }, |
| 6525 | {"glDetachShader", "(II)V", (void *) android_glDetachShader__II }, |
| 6526 | {"glDisable", "(I)V", (void *) android_glDisable__I }, |
| 6527 | {"glDisableVertexAttribArray", "(I)V", (void *) android_glDisableVertexAttribArray__I }, |
| 6528 | {"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III }, |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 6529 | {"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII }, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6530 | {"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 }, |
| 6531 | {"glEnable", "(I)V", (void *) android_glEnable__I }, |
| 6532 | {"glEnableVertexAttribArray", "(I)V", (void *) android_glEnableVertexAttribArray__I }, |
| 6533 | {"glFinish", "()V", (void *) android_glFinish__ }, |
| 6534 | {"glFlush", "()V", (void *) android_glFlush__ }, |
| 6535 | {"glFramebufferRenderbuffer", "(IIII)V", (void *) android_glFramebufferRenderbuffer__IIII }, |
| 6536 | {"glFramebufferTexture2D", "(IIIII)V", (void *) android_glFramebufferTexture2D__IIIII }, |
| 6537 | {"glFrontFace", "(I)V", (void *) android_glFrontFace__I }, |
| 6538 | {"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II }, |
| 6539 | {"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 }, |
| 6540 | {"glGenerateMipmap", "(I)V", (void *) android_glGenerateMipmap__I }, |
| 6541 | {"glGenFramebuffers", "(I[II)V", (void *) android_glGenFramebuffers__I_3II }, |
| 6542 | {"glGenFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenFramebuffers__ILjava_nio_IntBuffer_2 }, |
| 6543 | {"glGenRenderbuffers", "(I[II)V", (void *) android_glGenRenderbuffers__I_3II }, |
| 6544 | {"glGenRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenRenderbuffers__ILjava_nio_IntBuffer_2 }, |
| 6545 | {"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II }, |
| 6546 | {"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 }, |
| 6547 | {"glGetActiveAttrib", "(III[II[II[II[BI)V", (void *) android_glGetActiveAttrib__III_3II_3II_3II_3BI }, |
| 6548 | {"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] | 6549 | {"glGetActiveAttrib", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveAttrib1 }, |
| 6550 | {"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] | 6551 | {"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] | 6552 | {"glGetActiveUniform", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveUniform1 }, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6553 | {"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] | 6554 | {"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] | 6555 | {"glGetAttachedShaders", "(II[II[II)V", (void *) android_glGetAttachedShaders__II_3II_3II }, |
| 6556 | {"glGetAttachedShaders", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 }, |
| 6557 | {"glGetAttribLocation", "(ILjava/lang/String;)I", (void *) android_glGetAttribLocation__ILjava_lang_String_2 }, |
| 6558 | {"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI }, |
| 6559 | {"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 }, |
| 6560 | {"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II }, |
| 6561 | {"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 }, |
| 6562 | {"glGetError", "()I", (void *) android_glGetError__ }, |
| 6563 | {"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI }, |
| 6564 | {"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 }, |
| 6565 | {"glGetFramebufferAttachmentParameteriv", "(III[II)V", (void *) android_glGetFramebufferAttachmentParameteriv__III_3II }, |
| 6566 | {"glGetFramebufferAttachmentParameteriv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 }, |
| 6567 | {"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II }, |
| 6568 | {"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 }, |
| 6569 | {"glGetProgramiv", "(II[II)V", (void *) android_glGetProgramiv__II_3II }, |
| 6570 | {"glGetProgramiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetProgramiv__IILjava_nio_IntBuffer_2 }, |
| 6571 | {"glGetProgramInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetProgramInfoLog }, |
| 6572 | {"glGetRenderbufferParameteriv", "(II[II)V", (void *) android_glGetRenderbufferParameteriv__II_3II }, |
| 6573 | {"glGetRenderbufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2 }, |
| 6574 | {"glGetShaderiv", "(II[II)V", (void *) android_glGetShaderiv__II_3II }, |
| 6575 | {"glGetShaderiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetShaderiv__IILjava_nio_IntBuffer_2 }, |
| 6576 | {"glGetShaderInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetShaderInfoLog }, |
| 6577 | {"glGetShaderPrecisionFormat", "(II[II[II)V", (void *) android_glGetShaderPrecisionFormat__II_3II_3II }, |
| 6578 | {"glGetShaderPrecisionFormat", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 }, |
| 6579 | {"glGetShaderSource", "(II[II[BI)V", (void *) android_glGetShaderSource__II_3II_3BI }, |
| 6580 | {"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] | 6581 | {"glGetShaderSource", "(I)Ljava/lang/String;", (void *) android_glGetShaderSource }, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6582 | {"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString }, |
| 6583 | {"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI }, |
| 6584 | {"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 }, |
| 6585 | {"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II }, |
| 6586 | {"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 }, |
| 6587 | {"glGetUniformfv", "(II[FI)V", (void *) android_glGetUniformfv__II_3FI }, |
| 6588 | {"glGetUniformfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetUniformfv__IILjava_nio_FloatBuffer_2 }, |
| 6589 | {"glGetUniformiv", "(II[II)V", (void *) android_glGetUniformiv__II_3II }, |
| 6590 | {"glGetUniformiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetUniformiv__IILjava_nio_IntBuffer_2 }, |
| 6591 | {"glGetUniformLocation", "(ILjava/lang/String;)I", (void *) android_glGetUniformLocation__ILjava_lang_String_2 }, |
| 6592 | {"glGetVertexAttribfv", "(II[FI)V", (void *) android_glGetVertexAttribfv__II_3FI }, |
| 6593 | {"glGetVertexAttribfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2 }, |
| 6594 | {"glGetVertexAttribiv", "(II[II)V", (void *) android_glGetVertexAttribiv__II_3II }, |
| 6595 | {"glGetVertexAttribiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2 }, |
| 6596 | {"glHint", "(II)V", (void *) android_glHint__II }, |
| 6597 | {"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I }, |
| 6598 | {"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I }, |
| 6599 | {"glIsFramebuffer", "(I)Z", (void *) android_glIsFramebuffer__I }, |
| 6600 | {"glIsProgram", "(I)Z", (void *) android_glIsProgram__I }, |
| 6601 | {"glIsRenderbuffer", "(I)Z", (void *) android_glIsRenderbuffer__I }, |
| 6602 | {"glIsShader", "(I)Z", (void *) android_glIsShader__I }, |
| 6603 | {"glIsTexture", "(I)Z", (void *) android_glIsTexture__I }, |
| 6604 | {"glLineWidth", "(F)V", (void *) android_glLineWidth__F }, |
| 6605 | {"glLinkProgram", "(I)V", (void *) android_glLinkProgram__I }, |
| 6606 | {"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II }, |
| 6607 | {"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF }, |
| 6608 | {"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 }, |
| 6609 | {"glReleaseShaderCompiler", "()V", (void *) android_glReleaseShaderCompiler__ }, |
| 6610 | {"glRenderbufferStorage", "(IIII)V", (void *) android_glRenderbufferStorage__IIII }, |
| 6611 | {"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ }, |
| 6612 | {"glScissor", "(IIII)V", (void *) android_glScissor__IIII }, |
| 6613 | {"glShaderBinary", "(I[IIILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__I_3IIILjava_nio_Buffer_2I }, |
| 6614 | {"glShaderBinary", "(ILjava/nio/IntBuffer;ILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I }, |
| 6615 | {"glShaderSource", "(ILjava/lang/String;)V", (void *) android_glShaderSource }, |
| 6616 | {"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III }, |
| 6617 | {"glStencilFuncSeparate", "(IIII)V", (void *) android_glStencilFuncSeparate__IIII }, |
| 6618 | {"glStencilMask", "(I)V", (void *) android_glStencilMask__I }, |
| 6619 | {"glStencilMaskSeparate", "(II)V", (void *) android_glStencilMaskSeparate__II }, |
| 6620 | {"glStencilOp", "(III)V", (void *) android_glStencilOp__III }, |
| 6621 | {"glStencilOpSeparate", "(IIII)V", (void *) android_glStencilOpSeparate__IIII }, |
| 6622 | {"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 }, |
| 6623 | {"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF }, |
| 6624 | {"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI }, |
| 6625 | {"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 }, |
| 6626 | {"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III }, |
| 6627 | {"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II }, |
| 6628 | {"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 }, |
| 6629 | {"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 }, |
| 6630 | {"glUniform1f", "(IF)V", (void *) android_glUniform1f__IF }, |
| 6631 | {"glUniform1fv", "(II[FI)V", (void *) android_glUniform1fv__II_3FI }, |
| 6632 | {"glUniform1fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform1fv__IILjava_nio_FloatBuffer_2 }, |
| 6633 | {"glUniform1i", "(II)V", (void *) android_glUniform1i__II }, |
| 6634 | {"glUniform1iv", "(II[II)V", (void *) android_glUniform1iv__II_3II }, |
| 6635 | {"glUniform1iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform1iv__IILjava_nio_IntBuffer_2 }, |
| 6636 | {"glUniform2f", "(IFF)V", (void *) android_glUniform2f__IFF }, |
| 6637 | {"glUniform2fv", "(II[FI)V", (void *) android_glUniform2fv__II_3FI }, |
| 6638 | {"glUniform2fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform2fv__IILjava_nio_FloatBuffer_2 }, |
| 6639 | {"glUniform2i", "(III)V", (void *) android_glUniform2i__III }, |
| 6640 | {"glUniform2iv", "(II[II)V", (void *) android_glUniform2iv__II_3II }, |
| 6641 | {"glUniform2iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform2iv__IILjava_nio_IntBuffer_2 }, |
| 6642 | {"glUniform3f", "(IFFF)V", (void *) android_glUniform3f__IFFF }, |
| 6643 | {"glUniform3fv", "(II[FI)V", (void *) android_glUniform3fv__II_3FI }, |
| 6644 | {"glUniform3fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform3fv__IILjava_nio_FloatBuffer_2 }, |
| 6645 | {"glUniform3i", "(IIII)V", (void *) android_glUniform3i__IIII }, |
| 6646 | {"glUniform3iv", "(II[II)V", (void *) android_glUniform3iv__II_3II }, |
| 6647 | {"glUniform3iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform3iv__IILjava_nio_IntBuffer_2 }, |
| 6648 | {"glUniform4f", "(IFFFF)V", (void *) android_glUniform4f__IFFFF }, |
| 6649 | {"glUniform4fv", "(II[FI)V", (void *) android_glUniform4fv__II_3FI }, |
| 6650 | {"glUniform4fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform4fv__IILjava_nio_FloatBuffer_2 }, |
| 6651 | {"glUniform4i", "(IIIII)V", (void *) android_glUniform4i__IIIII }, |
| 6652 | {"glUniform4iv", "(II[II)V", (void *) android_glUniform4iv__II_3II }, |
| 6653 | {"glUniform4iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform4iv__IILjava_nio_IntBuffer_2 }, |
| 6654 | {"glUniformMatrix2fv", "(IIZ[FI)V", (void *) android_glUniformMatrix2fv__IIZ_3FI }, |
| 6655 | {"glUniformMatrix2fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 }, |
| 6656 | {"glUniformMatrix3fv", "(IIZ[FI)V", (void *) android_glUniformMatrix3fv__IIZ_3FI }, |
| 6657 | {"glUniformMatrix3fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 }, |
| 6658 | {"glUniformMatrix4fv", "(IIZ[FI)V", (void *) android_glUniformMatrix4fv__IIZ_3FI }, |
| 6659 | {"glUniformMatrix4fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2 }, |
| 6660 | {"glUseProgram", "(I)V", (void *) android_glUseProgram__I }, |
| 6661 | {"glValidateProgram", "(I)V", (void *) android_glValidateProgram__I }, |
| 6662 | {"glVertexAttrib1f", "(IF)V", (void *) android_glVertexAttrib1f__IF }, |
| 6663 | {"glVertexAttrib1fv", "(I[FI)V", (void *) android_glVertexAttrib1fv__I_3FI }, |
| 6664 | {"glVertexAttrib1fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2 }, |
| 6665 | {"glVertexAttrib2f", "(IFF)V", (void *) android_glVertexAttrib2f__IFF }, |
| 6666 | {"glVertexAttrib2fv", "(I[FI)V", (void *) android_glVertexAttrib2fv__I_3FI }, |
| 6667 | {"glVertexAttrib2fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2 }, |
| 6668 | {"glVertexAttrib3f", "(IFFF)V", (void *) android_glVertexAttrib3f__IFFF }, |
| 6669 | {"glVertexAttrib3fv", "(I[FI)V", (void *) android_glVertexAttrib3fv__I_3FI }, |
| 6670 | {"glVertexAttrib3fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2 }, |
| 6671 | {"glVertexAttrib4f", "(IFFFF)V", (void *) android_glVertexAttrib4f__IFFFF }, |
| 6672 | {"glVertexAttrib4fv", "(I[FI)V", (void *) android_glVertexAttrib4fv__I_3FI }, |
| 6673 | {"glVertexAttrib4fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 }, |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 6674 | {"glVertexAttribPointer", "(IIIZII)V", (void *) android_glVertexAttribPointer__IIIZII }, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6675 | {"glVertexAttribPointerBounds", "(IIIZILjava/nio/Buffer;I)V", (void *) android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I }, |
| 6676 | {"glViewport", "(IIII)V", (void *) android_glViewport__IIII }, |
| 6677 | }; |
| 6678 | |
| 6679 | int register_android_opengl_jni_GLES20(JNIEnv *_env) |
| 6680 | { |
| 6681 | int err; |
| 6682 | err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods)); |
| 6683 | return err; |
| 6684 | } |