Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1 | /* |
| 2 | ** |
| 3 | ** Copyright 2009, The Android Open Source Project |
| 4 | ** |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | ** you may not use this file except in compliance with the License. |
| 7 | ** You may obtain a copy of the License at |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 8 | ** |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 9 | ** http://www.apache.org/licenses/LICENSE-2.0 |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 10 | ** |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 11 | ** Unless required by applicable law or agreed to in writing, software |
| 12 | ** distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | ** See the License for the specific language governing permissions and |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | // This source file is automatically generated |
| 19 | |
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 <GLES/gl.h> |
| 24 | #include <GLES/glext.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 | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 28 | #include <android_runtime/AndroidRuntime.h> |
| 29 | #include <utils/misc.h> |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 30 | #include <assert.h> |
Jack Palevich | be6eac8 | 2009-12-08 15:43:51 +0800 | [diff] [blame] | 31 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 32 | static int initialized = 0; |
| 33 | |
| 34 | static jclass nioAccessClass; |
| 35 | static jclass bufferClass; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [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 | 27f8002 | 2009-04-15 19:13:17 -0700 | [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 | 27f8002 | 2009-04-15 19:13:17 -0700 | [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 | 27f8002 | 2009-04-15 19:13:17 -0700 | [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 | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 103 | { |
| 104 | jint position; |
| 105 | jint limit; |
| 106 | jint elementSizeShift; |
| 107 | jlong pointer; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [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 | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 118 | } |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 119 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [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 | 27f8002 | 2009-04-15 19:13:17 -0700 | [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 | 27f8002 | 2009-04-15 19:13:17 -0700 | [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 | 27f8002 | 2009-04-15 19:13:17 -0700 | [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 | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 243 | } |
| 244 | |
Jack Palevich | be6eac8 | 2009-12-08 15:43:51 +0800 | [diff] [blame] | 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 | be6eac8 | 2009-12-08 15:43:51 +0800 | [diff] [blame] | 255 | } |
| 256 | return (void*) buf; |
| 257 | } |
| 258 | |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 259 | // -------------------------------------------------------------------------- |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 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; |
| 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 | } |
| 454 | } |
| 455 | |
| 456 | // -------------------------------------------------------------------------- |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 457 | /* void glBindBuffer ( GLenum target, GLuint buffer ) */ |
| 458 | static void |
| 459 | android_glBindBuffer__II |
| 460 | (JNIEnv *_env, jobject _this, jint target, jint buffer) { |
| 461 | glBindBuffer( |
| 462 | (GLenum)target, |
| 463 | (GLuint)buffer |
| 464 | ); |
| 465 | } |
| 466 | |
| 467 | /* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */ |
| 468 | static void |
| 469 | android_glBufferData__IILjava_nio_Buffer_2I |
| 470 | (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] | 471 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 472 | const char * _exceptionType = NULL; |
| 473 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 474 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 475 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 476 | jint _remaining; |
| 477 | GLvoid *data = (GLvoid *) 0; |
| 478 | |
| 479 | if (data_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 480 | data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | c620a52 | 2009-10-21 11:02:44 -0700 | [diff] [blame] | 481 | if (_remaining < size) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 482 | _exception = 1; |
| 483 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 484 | _exceptionMessage = "remaining() < size < needed"; |
Jack Palevich | c620a52 | 2009-10-21 11:02:44 -0700 | [diff] [blame] | 485 | goto exit; |
| 486 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 487 | } |
Thomas Tafertshofer | 37c9b49 | 2012-07-23 16:56:04 -0700 | [diff] [blame] | 488 | if (data_buf && data == NULL) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 489 | char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 490 | data = (GLvoid *) (_dataBase + _bufferOffset); |
| 491 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 492 | glBufferData( |
| 493 | (GLenum)target, |
| 494 | (GLsizeiptr)size, |
| 495 | (GLvoid *)data, |
| 496 | (GLenum)usage |
| 497 | ); |
Jack Palevich | c620a52 | 2009-10-21 11:02:44 -0700 | [diff] [blame] | 498 | |
| 499 | exit: |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 500 | if (_array) { |
| 501 | releasePointer(_env, _array, data, JNI_FALSE); |
| 502 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 503 | if (_exception) { |
| 504 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 505 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 506 | } |
| 507 | |
| 508 | /* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */ |
| 509 | static void |
| 510 | android_glBufferSubData__IIILjava_nio_Buffer_2 |
| 511 | (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] | 512 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 513 | const char * _exceptionType = NULL; |
| 514 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 515 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 516 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 517 | jint _remaining; |
| 518 | GLvoid *data = (GLvoid *) 0; |
| 519 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 520 | if (!data_buf) { |
| 521 | _exception = 1; |
| 522 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 523 | _exceptionMessage = "data == null"; |
| 524 | goto exit; |
| 525 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 526 | data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | c620a52 | 2009-10-21 11:02:44 -0700 | [diff] [blame] | 527 | if (_remaining < size) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 528 | _exception = 1; |
| 529 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 530 | _exceptionMessage = "remaining() < size < needed"; |
Jack Palevich | c620a52 | 2009-10-21 11:02:44 -0700 | [diff] [blame] | 531 | goto exit; |
| 532 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 533 | if (data == NULL) { |
| 534 | char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 535 | data = (GLvoid *) (_dataBase + _bufferOffset); |
| 536 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 537 | glBufferSubData( |
| 538 | (GLenum)target, |
| 539 | (GLintptr)offset, |
| 540 | (GLsizeiptr)size, |
| 541 | (GLvoid *)data |
| 542 | ); |
Jack Palevich | c620a52 | 2009-10-21 11:02:44 -0700 | [diff] [blame] | 543 | |
| 544 | exit: |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 545 | if (_array) { |
| 546 | releasePointer(_env, _array, data, JNI_FALSE); |
| 547 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 548 | if (_exception) { |
| 549 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 550 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 551 | } |
| 552 | |
| 553 | /* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */ |
| 554 | static void |
| 555 | android_glClipPlanef__I_3FI |
| 556 | (JNIEnv *_env, jobject _this, jint plane, jfloatArray equation_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 557 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 558 | const char * _exceptionType = NULL; |
| 559 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 560 | GLfloat *equation_base = (GLfloat *) 0; |
| 561 | jint _remaining; |
| 562 | GLfloat *equation = (GLfloat *) 0; |
| 563 | |
| 564 | if (!equation_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 565 | _exception = 1; |
| 566 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 567 | _exceptionMessage = "equation == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 568 | goto exit; |
| 569 | } |
| 570 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 571 | _exception = 1; |
| 572 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 573 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 574 | goto exit; |
| 575 | } |
| 576 | _remaining = _env->GetArrayLength(equation_ref) - offset; |
| 577 | equation_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 578 | _env->GetFloatArrayElements(equation_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 579 | equation = equation_base + offset; |
| 580 | |
| 581 | glClipPlanef( |
| 582 | (GLenum)plane, |
| 583 | (GLfloat *)equation |
| 584 | ); |
| 585 | |
| 586 | exit: |
| 587 | if (equation_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 588 | _env->ReleaseFloatArrayElements(equation_ref, (jfloat*)equation_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 589 | JNI_ABORT); |
| 590 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 591 | if (_exception) { |
| 592 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 593 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 594 | } |
| 595 | |
| 596 | /* void glClipPlanef ( GLenum plane, const GLfloat *equation ) */ |
| 597 | static void |
| 598 | android_glClipPlanef__ILjava_nio_FloatBuffer_2 |
| 599 | (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 600 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 601 | const char * _exceptionType = NULL; |
| 602 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 603 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 604 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 605 | jint _remaining; |
| 606 | GLfloat *equation = (GLfloat *) 0; |
| 607 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 608 | if (!equation_buf) { |
| 609 | _exception = 1; |
| 610 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 611 | _exceptionMessage = "equation == null"; |
| 612 | goto exit; |
| 613 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 614 | equation = (GLfloat *)getPointer(_env, equation_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 615 | if (equation == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 616 | char * _equationBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 617 | equation = (GLfloat *) (_equationBase + _bufferOffset); |
| 618 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 619 | glClipPlanef( |
| 620 | (GLenum)plane, |
| 621 | (GLfloat *)equation |
| 622 | ); |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 623 | |
| 624 | exit: |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 625 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 626 | _env->ReleaseFloatArrayElements(_array, (jfloat*)equation, JNI_ABORT); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 627 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 628 | if (_exception) { |
| 629 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 630 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 631 | } |
| 632 | |
| 633 | /* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */ |
| 634 | static void |
| 635 | android_glClipPlanex__I_3II |
| 636 | (JNIEnv *_env, jobject _this, jint plane, jintArray equation_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 637 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 638 | const char * _exceptionType = NULL; |
| 639 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 640 | GLfixed *equation_base = (GLfixed *) 0; |
| 641 | jint _remaining; |
| 642 | GLfixed *equation = (GLfixed *) 0; |
| 643 | |
| 644 | if (!equation_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 645 | _exception = 1; |
| 646 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 647 | _exceptionMessage = "equation == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 648 | goto exit; |
| 649 | } |
| 650 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 651 | _exception = 1; |
| 652 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 653 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 654 | goto exit; |
| 655 | } |
| 656 | _remaining = _env->GetArrayLength(equation_ref) - offset; |
| 657 | equation_base = (GLfixed *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 658 | _env->GetIntArrayElements(equation_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 659 | equation = equation_base + offset; |
| 660 | |
| 661 | glClipPlanex( |
| 662 | (GLenum)plane, |
| 663 | (GLfixed *)equation |
| 664 | ); |
| 665 | |
| 666 | exit: |
| 667 | if (equation_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 668 | _env->ReleaseIntArrayElements(equation_ref, (jint*)equation_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 669 | JNI_ABORT); |
| 670 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 671 | if (_exception) { |
| 672 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 673 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 674 | } |
| 675 | |
| 676 | /* void glClipPlanex ( GLenum plane, const GLfixed *equation ) */ |
| 677 | static void |
| 678 | android_glClipPlanex__ILjava_nio_IntBuffer_2 |
| 679 | (JNIEnv *_env, jobject _this, jint plane, jobject equation_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 680 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 681 | const char * _exceptionType = NULL; |
| 682 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 683 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 684 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 685 | jint _remaining; |
| 686 | GLfixed *equation = (GLfixed *) 0; |
| 687 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 688 | if (!equation_buf) { |
| 689 | _exception = 1; |
| 690 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 691 | _exceptionMessage = "equation == null"; |
| 692 | goto exit; |
| 693 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 694 | equation = (GLfixed *)getPointer(_env, equation_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 695 | if (equation == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 696 | char * _equationBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 697 | equation = (GLfixed *) (_equationBase + _bufferOffset); |
| 698 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 699 | glClipPlanex( |
| 700 | (GLenum)plane, |
| 701 | (GLfixed *)equation |
| 702 | ); |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 703 | |
| 704 | exit: |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 705 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 706 | _env->ReleaseIntArrayElements(_array, (jint*)equation, JNI_ABORT); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 707 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 708 | if (_exception) { |
| 709 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 710 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 711 | } |
| 712 | |
| 713 | /* void glColor4ub ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ) */ |
| 714 | static void |
| 715 | android_glColor4ub__BBBB |
| 716 | (JNIEnv *_env, jobject _this, jbyte red, jbyte green, jbyte blue, jbyte alpha) { |
| 717 | glColor4ub( |
| 718 | (GLubyte)red, |
| 719 | (GLubyte)green, |
| 720 | (GLubyte)blue, |
| 721 | (GLubyte)alpha |
| 722 | ); |
| 723 | } |
| 724 | |
| 725 | /* void glColorPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */ |
| 726 | static void |
| 727 | android_glColorPointer__IIII |
| 728 | (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) { |
| 729 | glColorPointer( |
| 730 | (GLint)size, |
| 731 | (GLenum)type, |
| 732 | (GLsizei)stride, |
Ashok Bhat | 01c26ea | 2014-02-24 09:49:07 +0000 | [diff] [blame] | 733 | reinterpret_cast<GLvoid *>(offset) |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 734 | ); |
| 735 | } |
| 736 | |
| 737 | /* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */ |
| 738 | static void |
| 739 | android_glDeleteBuffers__I_3II |
| 740 | (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 741 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 742 | const char * _exceptionType = NULL; |
| 743 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 744 | GLuint *buffers_base = (GLuint *) 0; |
| 745 | jint _remaining; |
| 746 | GLuint *buffers = (GLuint *) 0; |
| 747 | |
| 748 | if (!buffers_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 749 | _exception = 1; |
| 750 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 751 | _exceptionMessage = "buffers == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 752 | goto exit; |
| 753 | } |
| 754 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 755 | _exception = 1; |
| 756 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 757 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 758 | goto exit; |
| 759 | } |
| 760 | _remaining = _env->GetArrayLength(buffers_ref) - offset; |
| 761 | if (_remaining < n) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 762 | _exception = 1; |
| 763 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 764 | _exceptionMessage = "length - offset < n < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 765 | goto exit; |
| 766 | } |
| 767 | buffers_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 768 | _env->GetIntArrayElements(buffers_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 769 | buffers = buffers_base + offset; |
| 770 | |
| 771 | glDeleteBuffers( |
| 772 | (GLsizei)n, |
| 773 | (GLuint *)buffers |
| 774 | ); |
| 775 | |
| 776 | exit: |
| 777 | if (buffers_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 778 | _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 779 | JNI_ABORT); |
| 780 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 781 | if (_exception) { |
| 782 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 783 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 784 | } |
| 785 | |
| 786 | /* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */ |
| 787 | static void |
| 788 | android_glDeleteBuffers__ILjava_nio_IntBuffer_2 |
| 789 | (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 790 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 791 | const char * _exceptionType = NULL; |
| 792 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 793 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 794 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 795 | jint _remaining; |
| 796 | GLuint *buffers = (GLuint *) 0; |
| 797 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 798 | if (!buffers_buf) { |
| 799 | _exception = 1; |
| 800 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 801 | _exceptionMessage = "buffers == null"; |
| 802 | goto exit; |
| 803 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 804 | buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 805 | if (_remaining < n) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 806 | _exception = 1; |
| 807 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 808 | _exceptionMessage = "remaining() < n < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 809 | goto exit; |
| 810 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 811 | if (buffers == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 812 | char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 813 | buffers = (GLuint *) (_buffersBase + _bufferOffset); |
| 814 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 815 | glDeleteBuffers( |
| 816 | (GLsizei)n, |
| 817 | (GLuint *)buffers |
| 818 | ); |
| 819 | |
| 820 | exit: |
| 821 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 822 | _env->ReleaseIntArrayElements(_array, (jint*)buffers, JNI_ABORT); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 823 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 824 | if (_exception) { |
| 825 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 826 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 827 | } |
| 828 | |
| 829 | /* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */ |
| 830 | static void |
| 831 | android_glDrawElements__IIII |
| 832 | (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 833 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 834 | const char * _exceptionType = NULL; |
| 835 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 836 | glDrawElements( |
| 837 | (GLenum)mode, |
| 838 | (GLsizei)count, |
| 839 | (GLenum)type, |
Ashok Bhat | 01c26ea | 2014-02-24 09:49:07 +0000 | [diff] [blame] | 840 | reinterpret_cast<GLvoid *>(offset) |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 841 | ); |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 842 | if (_exception) { |
| 843 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 844 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 845 | } |
| 846 | |
| 847 | /* void glGenBuffers ( GLsizei n, GLuint *buffers ) */ |
| 848 | static void |
| 849 | android_glGenBuffers__I_3II |
| 850 | (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) { |
| 851 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 852 | const char * _exceptionType = NULL; |
| 853 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 854 | GLuint *buffers_base = (GLuint *) 0; |
| 855 | jint _remaining; |
| 856 | GLuint *buffers = (GLuint *) 0; |
| 857 | |
| 858 | if (!buffers_ref) { |
| 859 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 860 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 861 | _exceptionMessage = "buffers == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 862 | goto exit; |
| 863 | } |
| 864 | if (offset < 0) { |
| 865 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 866 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 867 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 868 | goto exit; |
| 869 | } |
| 870 | _remaining = _env->GetArrayLength(buffers_ref) - offset; |
| 871 | if (_remaining < n) { |
| 872 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 873 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 874 | _exceptionMessage = "length - offset < n < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 875 | goto exit; |
| 876 | } |
| 877 | buffers_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 878 | _env->GetIntArrayElements(buffers_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 879 | buffers = buffers_base + offset; |
| 880 | |
| 881 | glGenBuffers( |
| 882 | (GLsizei)n, |
| 883 | (GLuint *)buffers |
| 884 | ); |
| 885 | |
| 886 | exit: |
| 887 | if (buffers_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 888 | _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 889 | _exception ? JNI_ABORT: 0); |
| 890 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 891 | if (_exception) { |
| 892 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 893 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 894 | } |
| 895 | |
| 896 | /* void glGenBuffers ( GLsizei n, GLuint *buffers ) */ |
| 897 | static void |
| 898 | android_glGenBuffers__ILjava_nio_IntBuffer_2 |
| 899 | (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) { |
| 900 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 901 | const char * _exceptionType = NULL; |
| 902 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 903 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 904 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 905 | jint _remaining; |
| 906 | GLuint *buffers = (GLuint *) 0; |
| 907 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 908 | if (!buffers_buf) { |
| 909 | _exception = 1; |
| 910 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 911 | _exceptionMessage = "buffers == null"; |
| 912 | goto exit; |
| 913 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 914 | buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 915 | if (_remaining < n) { |
| 916 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 917 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 918 | _exceptionMessage = "remaining() < n < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 919 | goto exit; |
| 920 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 921 | if (buffers == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 922 | char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 923 | buffers = (GLuint *) (_buffersBase + _bufferOffset); |
| 924 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 925 | glGenBuffers( |
| 926 | (GLsizei)n, |
| 927 | (GLuint *)buffers |
| 928 | ); |
| 929 | |
| 930 | exit: |
| 931 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 932 | _env->ReleaseIntArrayElements(_array, (jint*)buffers, _exception ? JNI_ABORT : 0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 933 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 934 | if (_exception) { |
| 935 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 936 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 937 | } |
| 938 | |
| 939 | /* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ |
| 940 | static void |
| 941 | android_glGetBooleanv__I_3ZI |
| 942 | (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 943 | get<jbooleanArray, BooleanArrayGetter, jboolean*, BooleanArrayReleaser, GLboolean, glGetBooleanv>( |
| 944 | _env, _this, pname, params_ref, offset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 945 | } |
| 946 | |
| 947 | /* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ |
| 948 | static void |
| 949 | android_glGetBooleanv__ILjava_nio_IntBuffer_2 |
| 950 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 951 | getarray<GLboolean, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetBooleanv>( |
| 952 | _env, _this, pname, params_buf); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 953 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 954 | /* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 955 | static void |
| 956 | android_glGetBufferParameteriv__II_3II |
| 957 | (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] | 958 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 959 | const char * _exceptionType = NULL; |
| 960 | const char * _exceptionMessage = NULL; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 961 | GLint *params_base = (GLint *) 0; |
| 962 | jint _remaining; |
| 963 | GLint *params = (GLint *) 0; |
| 964 | |
| 965 | if (!params_ref) { |
| 966 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 967 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 968 | _exceptionMessage = "params == null"; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 969 | goto exit; |
| 970 | } |
| 971 | if (offset < 0) { |
| 972 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 973 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 974 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 975 | goto exit; |
| 976 | } |
| 977 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 978 | if (_remaining < 1) { |
| 979 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 980 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 981 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 982 | goto exit; |
| 983 | } |
| 984 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 985 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 986 | params = params_base + offset; |
| 987 | |
| 988 | glGetBufferParameteriv( |
| 989 | (GLenum)target, |
| 990 | (GLenum)pname, |
| 991 | (GLint *)params |
| 992 | ); |
| 993 | |
| 994 | exit: |
| 995 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 996 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 997 | _exception ? JNI_ABORT: 0); |
| 998 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 999 | if (_exception) { |
| 1000 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1001 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1002 | } |
| 1003 | |
| 1004 | /* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 1005 | static void |
| 1006 | android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 |
| 1007 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 1008 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1009 | const char * _exceptionType = NULL; |
| 1010 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1011 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1012 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 1013 | jint _remaining; |
| 1014 | GLint *params = (GLint *) 0; |
| 1015 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1016 | if (!params_buf) { |
| 1017 | _exception = 1; |
| 1018 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1019 | _exceptionMessage = "params == null"; |
| 1020 | goto exit; |
| 1021 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1022 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 1023 | if (_remaining < 1) { |
| 1024 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1025 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1026 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 1027 | goto exit; |
| 1028 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1029 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1030 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1031 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 1032 | } |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 1033 | glGetBufferParameteriv( |
| 1034 | (GLenum)target, |
| 1035 | (GLenum)pname, |
| 1036 | (GLint *)params |
| 1037 | ); |
| 1038 | |
| 1039 | exit: |
| 1040 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1041 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 1042 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1043 | if (_exception) { |
| 1044 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1045 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1046 | } |
| 1047 | |
| 1048 | /* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */ |
| 1049 | static void |
| 1050 | android_glGetClipPlanef__I_3FI |
| 1051 | (JNIEnv *_env, jobject _this, jint pname, jfloatArray eqn_ref, jint offset) { |
| 1052 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1053 | const char * _exceptionType = NULL; |
| 1054 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1055 | GLfloat *eqn_base = (GLfloat *) 0; |
| 1056 | jint _remaining; |
| 1057 | GLfloat *eqn = (GLfloat *) 0; |
| 1058 | |
| 1059 | if (!eqn_ref) { |
| 1060 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1061 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1062 | _exceptionMessage = "eqn == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1063 | goto exit; |
| 1064 | } |
| 1065 | if (offset < 0) { |
| 1066 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1067 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1068 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1069 | goto exit; |
| 1070 | } |
| 1071 | _remaining = _env->GetArrayLength(eqn_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1072 | if (_remaining < 4) { |
| 1073 | _exception = 1; |
| 1074 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1075 | _exceptionMessage = "length - offset < 4 < needed"; |
| 1076 | goto exit; |
| 1077 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1078 | eqn_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1079 | _env->GetFloatArrayElements(eqn_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1080 | eqn = eqn_base + offset; |
| 1081 | |
| 1082 | glGetClipPlanef( |
| 1083 | (GLenum)pname, |
| 1084 | (GLfloat *)eqn |
| 1085 | ); |
| 1086 | |
| 1087 | exit: |
| 1088 | if (eqn_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1089 | _env->ReleaseFloatArrayElements(eqn_ref, (jfloat*)eqn_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1090 | _exception ? JNI_ABORT: 0); |
| 1091 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1092 | if (_exception) { |
| 1093 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1094 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1095 | } |
| 1096 | |
| 1097 | /* void glGetClipPlanef ( GLenum pname, GLfloat *eqn ) */ |
| 1098 | static void |
| 1099 | android_glGetClipPlanef__ILjava_nio_FloatBuffer_2 |
| 1100 | (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1101 | jint _exception = 0; |
| 1102 | const char * _exceptionType = NULL; |
| 1103 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1104 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1105 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1106 | jint _remaining; |
| 1107 | GLfloat *eqn = (GLfloat *) 0; |
| 1108 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1109 | if (!eqn_buf) { |
| 1110 | _exception = 1; |
| 1111 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1112 | _exceptionMessage = "eqn == null"; |
| 1113 | goto exit; |
| 1114 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1115 | eqn = (GLfloat *)getPointer(_env, eqn_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1116 | if (_remaining < 4) { |
| 1117 | _exception = 1; |
| 1118 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1119 | _exceptionMessage = "remaining() < 4 < needed"; |
| 1120 | goto exit; |
| 1121 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1122 | if (eqn == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1123 | char * _eqnBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1124 | eqn = (GLfloat *) (_eqnBase + _bufferOffset); |
| 1125 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1126 | glGetClipPlanef( |
| 1127 | (GLenum)pname, |
| 1128 | (GLfloat *)eqn |
| 1129 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1130 | |
| 1131 | exit: |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1132 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1133 | _env->ReleaseFloatArrayElements(_array, (jfloat*)eqn, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1134 | } |
| 1135 | if (_exception) { |
| 1136 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1137 | } |
| 1138 | } |
| 1139 | |
| 1140 | /* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */ |
| 1141 | static void |
| 1142 | android_glGetClipPlanex__I_3II |
| 1143 | (JNIEnv *_env, jobject _this, jint pname, jintArray eqn_ref, jint offset) { |
| 1144 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1145 | const char * _exceptionType = NULL; |
| 1146 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1147 | GLfixed *eqn_base = (GLfixed *) 0; |
| 1148 | jint _remaining; |
| 1149 | GLfixed *eqn = (GLfixed *) 0; |
| 1150 | |
| 1151 | if (!eqn_ref) { |
| 1152 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1153 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1154 | _exceptionMessage = "eqn == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1155 | goto exit; |
| 1156 | } |
| 1157 | if (offset < 0) { |
| 1158 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1159 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1160 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1161 | goto exit; |
| 1162 | } |
| 1163 | _remaining = _env->GetArrayLength(eqn_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1164 | if (_remaining < 4) { |
| 1165 | _exception = 1; |
| 1166 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1167 | _exceptionMessage = "length - offset < 4 < needed"; |
| 1168 | goto exit; |
| 1169 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1170 | eqn_base = (GLfixed *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1171 | _env->GetIntArrayElements(eqn_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1172 | eqn = eqn_base + offset; |
| 1173 | |
| 1174 | glGetClipPlanex( |
| 1175 | (GLenum)pname, |
| 1176 | (GLfixed *)eqn |
| 1177 | ); |
| 1178 | |
| 1179 | exit: |
| 1180 | if (eqn_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1181 | _env->ReleaseIntArrayElements(eqn_ref, (jint*)eqn_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1182 | _exception ? JNI_ABORT: 0); |
| 1183 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1184 | if (_exception) { |
| 1185 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1186 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1187 | } |
| 1188 | |
| 1189 | /* void glGetClipPlanex ( GLenum pname, GLfixed *eqn ) */ |
| 1190 | static void |
| 1191 | android_glGetClipPlanex__ILjava_nio_IntBuffer_2 |
| 1192 | (JNIEnv *_env, jobject _this, jint pname, jobject eqn_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1193 | jint _exception = 0; |
| 1194 | const char * _exceptionType = NULL; |
| 1195 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1196 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1197 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1198 | jint _remaining; |
| 1199 | GLfixed *eqn = (GLfixed *) 0; |
| 1200 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1201 | if (!eqn_buf) { |
| 1202 | _exception = 1; |
| 1203 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1204 | _exceptionMessage = "eqn == null"; |
| 1205 | goto exit; |
| 1206 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1207 | eqn = (GLfixed *)getPointer(_env, eqn_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1208 | if (_remaining < 4) { |
| 1209 | _exception = 1; |
| 1210 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1211 | _exceptionMessage = "remaining() < 4 < needed"; |
| 1212 | goto exit; |
| 1213 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1214 | if (eqn == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1215 | char * _eqnBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1216 | eqn = (GLfixed *) (_eqnBase + _bufferOffset); |
| 1217 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1218 | glGetClipPlanex( |
| 1219 | (GLenum)pname, |
| 1220 | (GLfixed *)eqn |
| 1221 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1222 | |
| 1223 | exit: |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1224 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1225 | _env->ReleaseIntArrayElements(_array, (jint*)eqn, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1226 | } |
| 1227 | if (_exception) { |
| 1228 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1229 | } |
| 1230 | } |
| 1231 | |
| 1232 | /* void glGetFixedv ( GLenum pname, GLfixed *params ) */ |
| 1233 | static void |
| 1234 | android_glGetFixedv__I_3II |
| 1235 | (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { |
| 1236 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1237 | const char * _exceptionType = NULL; |
| 1238 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1239 | GLfixed *params_base = (GLfixed *) 0; |
| 1240 | jint _remaining; |
| 1241 | GLfixed *params = (GLfixed *) 0; |
| 1242 | |
| 1243 | if (!params_ref) { |
| 1244 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1245 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1246 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1247 | goto exit; |
| 1248 | } |
| 1249 | if (offset < 0) { |
| 1250 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1251 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1252 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1253 | goto exit; |
| 1254 | } |
| 1255 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 1256 | params_base = (GLfixed *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1257 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1258 | params = params_base + offset; |
| 1259 | |
| 1260 | glGetFixedv( |
| 1261 | (GLenum)pname, |
| 1262 | (GLfixed *)params |
| 1263 | ); |
| 1264 | |
| 1265 | exit: |
| 1266 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1267 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1268 | _exception ? JNI_ABORT: 0); |
| 1269 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1270 | if (_exception) { |
| 1271 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1272 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1273 | } |
| 1274 | |
| 1275 | /* void glGetFixedv ( GLenum pname, GLfixed *params ) */ |
| 1276 | static void |
| 1277 | android_glGetFixedv__ILjava_nio_IntBuffer_2 |
| 1278 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1279 | jint _exception = 0; |
| 1280 | const char * _exceptionType = NULL; |
| 1281 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1282 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1283 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1284 | jint _remaining; |
| 1285 | GLfixed *params = (GLfixed *) 0; |
| 1286 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1287 | if (!params_buf) { |
| 1288 | _exception = 1; |
| 1289 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1290 | _exceptionMessage = "params == null"; |
| 1291 | goto exit; |
| 1292 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1293 | params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1294 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1295 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1296 | params = (GLfixed *) (_paramsBase + _bufferOffset); |
| 1297 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1298 | glGetFixedv( |
| 1299 | (GLenum)pname, |
| 1300 | (GLfixed *)params |
| 1301 | ); |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1302 | |
| 1303 | exit: |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1304 | if (_array) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1305 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
| 1306 | } |
| 1307 | if (_exception) { |
| 1308 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1309 | } |
| 1310 | } |
| 1311 | |
| 1312 | /* void glGetFloatv ( GLenum pname, GLfloat *params ) */ |
| 1313 | static void |
| 1314 | android_glGetFloatv__I_3FI |
| 1315 | (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1316 | get<jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, GLfloat, glGetFloatv>( |
| 1317 | _env, _this, pname, params_ref, offset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1318 | } |
| 1319 | |
| 1320 | /* void glGetFloatv ( GLenum pname, GLfloat *params ) */ |
| 1321 | static void |
| 1322 | android_glGetFloatv__ILjava_nio_FloatBuffer_2 |
| 1323 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1324 | getarray<GLfloat, jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, glGetFloatv>( |
| 1325 | _env, _this, pname, params_buf); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1326 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1327 | /* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */ |
| 1328 | static void |
| 1329 | android_glGetLightfv__II_3FI |
| 1330 | (JNIEnv *_env, jobject _this, jint light, jint pname, jfloatArray params_ref, jint offset) { |
| 1331 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1332 | const char * _exceptionType = NULL; |
| 1333 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1334 | GLfloat *params_base = (GLfloat *) 0; |
| 1335 | jint _remaining; |
| 1336 | GLfloat *params = (GLfloat *) 0; |
| 1337 | |
| 1338 | if (!params_ref) { |
| 1339 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1340 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1341 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1342 | goto exit; |
| 1343 | } |
| 1344 | if (offset < 0) { |
| 1345 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1346 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1347 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1348 | goto exit; |
| 1349 | } |
| 1350 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 1351 | int _needed; |
| 1352 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1353 | #if defined(GL_SPOT_DIRECTION) |
| 1354 | case GL_SPOT_DIRECTION: |
| 1355 | #endif // defined(GL_SPOT_DIRECTION) |
| 1356 | _needed = 3; |
| 1357 | break; |
| 1358 | #if defined(GL_AMBIENT) |
| 1359 | case GL_AMBIENT: |
| 1360 | #endif // defined(GL_AMBIENT) |
| 1361 | #if defined(GL_DIFFUSE) |
| 1362 | case GL_DIFFUSE: |
| 1363 | #endif // defined(GL_DIFFUSE) |
| 1364 | #if defined(GL_SPECULAR) |
| 1365 | case GL_SPECULAR: |
| 1366 | #endif // defined(GL_SPECULAR) |
| 1367 | #if defined(GL_EMISSION) |
| 1368 | case GL_EMISSION: |
| 1369 | #endif // defined(GL_EMISSION) |
| 1370 | _needed = 4; |
| 1371 | break; |
| 1372 | default: |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1373 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1374 | break; |
| 1375 | } |
| 1376 | if (_remaining < _needed) { |
| 1377 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1378 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1379 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1380 | goto exit; |
| 1381 | } |
| 1382 | params_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1383 | _env->GetFloatArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1384 | params = params_base + offset; |
| 1385 | |
| 1386 | glGetLightfv( |
| 1387 | (GLenum)light, |
| 1388 | (GLenum)pname, |
| 1389 | (GLfloat *)params |
| 1390 | ); |
| 1391 | |
| 1392 | exit: |
| 1393 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1394 | _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1395 | _exception ? JNI_ABORT: 0); |
| 1396 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1397 | if (_exception) { |
| 1398 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1399 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1400 | } |
| 1401 | |
| 1402 | /* void glGetLightfv ( GLenum light, GLenum pname, GLfloat *params ) */ |
| 1403 | static void |
| 1404 | android_glGetLightfv__IILjava_nio_FloatBuffer_2 |
| 1405 | (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { |
| 1406 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1407 | const char * _exceptionType = NULL; |
| 1408 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1409 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1410 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1411 | jint _remaining; |
| 1412 | GLfloat *params = (GLfloat *) 0; |
| 1413 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1414 | if (!params_buf) { |
| 1415 | _exception = 1; |
| 1416 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1417 | _exceptionMessage = "params == null"; |
| 1418 | goto exit; |
| 1419 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1420 | params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1421 | int _needed; |
| 1422 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1423 | #if defined(GL_SPOT_DIRECTION) |
| 1424 | case GL_SPOT_DIRECTION: |
| 1425 | #endif // defined(GL_SPOT_DIRECTION) |
| 1426 | _needed = 3; |
| 1427 | break; |
| 1428 | #if defined(GL_AMBIENT) |
| 1429 | case GL_AMBIENT: |
| 1430 | #endif // defined(GL_AMBIENT) |
| 1431 | #if defined(GL_DIFFUSE) |
| 1432 | case GL_DIFFUSE: |
| 1433 | #endif // defined(GL_DIFFUSE) |
| 1434 | #if defined(GL_SPECULAR) |
| 1435 | case GL_SPECULAR: |
| 1436 | #endif // defined(GL_SPECULAR) |
| 1437 | #if defined(GL_EMISSION) |
| 1438 | case GL_EMISSION: |
| 1439 | #endif // defined(GL_EMISSION) |
| 1440 | _needed = 4; |
| 1441 | break; |
| 1442 | default: |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1443 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1444 | break; |
| 1445 | } |
| 1446 | if (_remaining < _needed) { |
| 1447 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1448 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1449 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1450 | goto exit; |
| 1451 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1452 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1453 | char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1454 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 1455 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1456 | glGetLightfv( |
| 1457 | (GLenum)light, |
| 1458 | (GLenum)pname, |
| 1459 | (GLfloat *)params |
| 1460 | ); |
| 1461 | |
| 1462 | exit: |
| 1463 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1464 | _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1465 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1466 | if (_exception) { |
| 1467 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1468 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1469 | } |
| 1470 | |
| 1471 | /* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */ |
| 1472 | static void |
| 1473 | android_glGetLightxv__II_3II |
| 1474 | (JNIEnv *_env, jobject _this, jint light, jint pname, jintArray params_ref, jint offset) { |
| 1475 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1476 | const char * _exceptionType = NULL; |
| 1477 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1478 | GLfixed *params_base = (GLfixed *) 0; |
| 1479 | jint _remaining; |
| 1480 | GLfixed *params = (GLfixed *) 0; |
| 1481 | |
| 1482 | if (!params_ref) { |
| 1483 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1484 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1485 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1486 | goto exit; |
| 1487 | } |
| 1488 | if (offset < 0) { |
| 1489 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1490 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1491 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1492 | goto exit; |
| 1493 | } |
| 1494 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 1495 | int _needed; |
| 1496 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1497 | #if defined(GL_SPOT_DIRECTION) |
| 1498 | case GL_SPOT_DIRECTION: |
| 1499 | #endif // defined(GL_SPOT_DIRECTION) |
| 1500 | _needed = 3; |
| 1501 | break; |
| 1502 | #if defined(GL_AMBIENT) |
| 1503 | case GL_AMBIENT: |
| 1504 | #endif // defined(GL_AMBIENT) |
| 1505 | #if defined(GL_DIFFUSE) |
| 1506 | case GL_DIFFUSE: |
| 1507 | #endif // defined(GL_DIFFUSE) |
| 1508 | #if defined(GL_SPECULAR) |
| 1509 | case GL_SPECULAR: |
| 1510 | #endif // defined(GL_SPECULAR) |
| 1511 | #if defined(GL_EMISSION) |
| 1512 | case GL_EMISSION: |
| 1513 | #endif // defined(GL_EMISSION) |
| 1514 | _needed = 4; |
| 1515 | break; |
| 1516 | default: |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1517 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1518 | break; |
| 1519 | } |
| 1520 | if (_remaining < _needed) { |
| 1521 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1522 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1523 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1524 | goto exit; |
| 1525 | } |
| 1526 | params_base = (GLfixed *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1527 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1528 | params = params_base + offset; |
| 1529 | |
| 1530 | glGetLightxv( |
| 1531 | (GLenum)light, |
| 1532 | (GLenum)pname, |
| 1533 | (GLfixed *)params |
| 1534 | ); |
| 1535 | |
| 1536 | exit: |
| 1537 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1538 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1539 | _exception ? JNI_ABORT: 0); |
| 1540 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1541 | if (_exception) { |
| 1542 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1543 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1544 | } |
| 1545 | |
| 1546 | /* void glGetLightxv ( GLenum light, GLenum pname, GLfixed *params ) */ |
| 1547 | static void |
| 1548 | android_glGetLightxv__IILjava_nio_IntBuffer_2 |
| 1549 | (JNIEnv *_env, jobject _this, jint light, jint pname, jobject params_buf) { |
| 1550 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1551 | const char * _exceptionType = NULL; |
| 1552 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1553 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1554 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1555 | jint _remaining; |
| 1556 | GLfixed *params = (GLfixed *) 0; |
| 1557 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1558 | if (!params_buf) { |
| 1559 | _exception = 1; |
| 1560 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1561 | _exceptionMessage = "params == null"; |
| 1562 | goto exit; |
| 1563 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1564 | params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1565 | int _needed; |
| 1566 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1567 | #if defined(GL_SPOT_DIRECTION) |
| 1568 | case GL_SPOT_DIRECTION: |
| 1569 | #endif // defined(GL_SPOT_DIRECTION) |
| 1570 | _needed = 3; |
| 1571 | break; |
| 1572 | #if defined(GL_AMBIENT) |
| 1573 | case GL_AMBIENT: |
| 1574 | #endif // defined(GL_AMBIENT) |
| 1575 | #if defined(GL_DIFFUSE) |
| 1576 | case GL_DIFFUSE: |
| 1577 | #endif // defined(GL_DIFFUSE) |
| 1578 | #if defined(GL_SPECULAR) |
| 1579 | case GL_SPECULAR: |
| 1580 | #endif // defined(GL_SPECULAR) |
| 1581 | #if defined(GL_EMISSION) |
| 1582 | case GL_EMISSION: |
| 1583 | #endif // defined(GL_EMISSION) |
| 1584 | _needed = 4; |
| 1585 | break; |
| 1586 | default: |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1587 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1588 | break; |
| 1589 | } |
| 1590 | if (_remaining < _needed) { |
| 1591 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1592 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1593 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1594 | goto exit; |
| 1595 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1596 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1597 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1598 | params = (GLfixed *) (_paramsBase + _bufferOffset); |
| 1599 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1600 | glGetLightxv( |
| 1601 | (GLenum)light, |
| 1602 | (GLenum)pname, |
| 1603 | (GLfixed *)params |
| 1604 | ); |
| 1605 | |
| 1606 | exit: |
| 1607 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1608 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1609 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1610 | if (_exception) { |
| 1611 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1612 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1613 | } |
| 1614 | |
| 1615 | /* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */ |
| 1616 | static void |
| 1617 | android_glGetMaterialfv__II_3FI |
| 1618 | (JNIEnv *_env, jobject _this, jint face, jint pname, jfloatArray params_ref, jint offset) { |
| 1619 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1620 | const char * _exceptionType = NULL; |
| 1621 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1622 | GLfloat *params_base = (GLfloat *) 0; |
| 1623 | jint _remaining; |
| 1624 | GLfloat *params = (GLfloat *) 0; |
| 1625 | |
| 1626 | if (!params_ref) { |
| 1627 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1628 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1629 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1630 | goto exit; |
| 1631 | } |
| 1632 | if (offset < 0) { |
| 1633 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1634 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1635 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1636 | goto exit; |
| 1637 | } |
| 1638 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 1639 | int _needed; |
| 1640 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1641 | #if defined(GL_AMBIENT) |
| 1642 | case GL_AMBIENT: |
| 1643 | #endif // defined(GL_AMBIENT) |
| 1644 | #if defined(GL_DIFFUSE) |
| 1645 | case GL_DIFFUSE: |
| 1646 | #endif // defined(GL_DIFFUSE) |
| 1647 | #if defined(GL_SPECULAR) |
| 1648 | case GL_SPECULAR: |
| 1649 | #endif // defined(GL_SPECULAR) |
| 1650 | #if defined(GL_EMISSION) |
| 1651 | case GL_EMISSION: |
| 1652 | #endif // defined(GL_EMISSION) |
| 1653 | #if defined(GL_AMBIENT_AND_DIFFUSE) |
| 1654 | case GL_AMBIENT_AND_DIFFUSE: |
| 1655 | #endif // defined(GL_AMBIENT_AND_DIFFUSE) |
| 1656 | _needed = 4; |
| 1657 | break; |
| 1658 | default: |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1659 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1660 | break; |
| 1661 | } |
| 1662 | if (_remaining < _needed) { |
| 1663 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1664 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1665 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1666 | goto exit; |
| 1667 | } |
| 1668 | params_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1669 | _env->GetFloatArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1670 | params = params_base + offset; |
| 1671 | |
| 1672 | glGetMaterialfv( |
| 1673 | (GLenum)face, |
| 1674 | (GLenum)pname, |
| 1675 | (GLfloat *)params |
| 1676 | ); |
| 1677 | |
| 1678 | exit: |
| 1679 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1680 | _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1681 | _exception ? JNI_ABORT: 0); |
| 1682 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1683 | if (_exception) { |
| 1684 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1685 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1686 | } |
| 1687 | |
| 1688 | /* void glGetMaterialfv ( GLenum face, GLenum pname, GLfloat *params ) */ |
| 1689 | static void |
| 1690 | android_glGetMaterialfv__IILjava_nio_FloatBuffer_2 |
| 1691 | (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { |
| 1692 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1693 | const char * _exceptionType = NULL; |
| 1694 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1695 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1696 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1697 | jint _remaining; |
| 1698 | GLfloat *params = (GLfloat *) 0; |
| 1699 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1700 | if (!params_buf) { |
| 1701 | _exception = 1; |
| 1702 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1703 | _exceptionMessage = "params == null"; |
| 1704 | goto exit; |
| 1705 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1706 | params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1707 | int _needed; |
| 1708 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1709 | #if defined(GL_AMBIENT) |
| 1710 | case GL_AMBIENT: |
| 1711 | #endif // defined(GL_AMBIENT) |
| 1712 | #if defined(GL_DIFFUSE) |
| 1713 | case GL_DIFFUSE: |
| 1714 | #endif // defined(GL_DIFFUSE) |
| 1715 | #if defined(GL_SPECULAR) |
| 1716 | case GL_SPECULAR: |
| 1717 | #endif // defined(GL_SPECULAR) |
| 1718 | #if defined(GL_EMISSION) |
| 1719 | case GL_EMISSION: |
| 1720 | #endif // defined(GL_EMISSION) |
| 1721 | #if defined(GL_AMBIENT_AND_DIFFUSE) |
| 1722 | case GL_AMBIENT_AND_DIFFUSE: |
| 1723 | #endif // defined(GL_AMBIENT_AND_DIFFUSE) |
| 1724 | _needed = 4; |
| 1725 | break; |
| 1726 | default: |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1727 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1728 | break; |
| 1729 | } |
| 1730 | if (_remaining < _needed) { |
| 1731 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1732 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1733 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1734 | goto exit; |
| 1735 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1736 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1737 | char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1738 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 1739 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1740 | glGetMaterialfv( |
| 1741 | (GLenum)face, |
| 1742 | (GLenum)pname, |
| 1743 | (GLfloat *)params |
| 1744 | ); |
| 1745 | |
| 1746 | exit: |
| 1747 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1748 | _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1749 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1750 | if (_exception) { |
| 1751 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1752 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1753 | } |
| 1754 | |
| 1755 | /* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */ |
| 1756 | static void |
| 1757 | android_glGetMaterialxv__II_3II |
| 1758 | (JNIEnv *_env, jobject _this, jint face, jint pname, jintArray params_ref, jint offset) { |
| 1759 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1760 | const char * _exceptionType = NULL; |
| 1761 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1762 | GLfixed *params_base = (GLfixed *) 0; |
| 1763 | jint _remaining; |
| 1764 | GLfixed *params = (GLfixed *) 0; |
| 1765 | |
| 1766 | if (!params_ref) { |
| 1767 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1768 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1769 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1770 | goto exit; |
| 1771 | } |
| 1772 | if (offset < 0) { |
| 1773 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1774 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1775 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1776 | goto exit; |
| 1777 | } |
| 1778 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 1779 | int _needed; |
| 1780 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1781 | #if defined(GL_AMBIENT) |
| 1782 | case GL_AMBIENT: |
| 1783 | #endif // defined(GL_AMBIENT) |
| 1784 | #if defined(GL_DIFFUSE) |
| 1785 | case GL_DIFFUSE: |
| 1786 | #endif // defined(GL_DIFFUSE) |
| 1787 | #if defined(GL_SPECULAR) |
| 1788 | case GL_SPECULAR: |
| 1789 | #endif // defined(GL_SPECULAR) |
| 1790 | #if defined(GL_EMISSION) |
| 1791 | case GL_EMISSION: |
| 1792 | #endif // defined(GL_EMISSION) |
| 1793 | #if defined(GL_AMBIENT_AND_DIFFUSE) |
| 1794 | case GL_AMBIENT_AND_DIFFUSE: |
| 1795 | #endif // defined(GL_AMBIENT_AND_DIFFUSE) |
| 1796 | _needed = 4; |
| 1797 | break; |
| 1798 | default: |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1799 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1800 | break; |
| 1801 | } |
| 1802 | if (_remaining < _needed) { |
| 1803 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1804 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1805 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1806 | goto exit; |
| 1807 | } |
| 1808 | params_base = (GLfixed *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1809 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1810 | params = params_base + offset; |
| 1811 | |
| 1812 | glGetMaterialxv( |
| 1813 | (GLenum)face, |
| 1814 | (GLenum)pname, |
| 1815 | (GLfixed *)params |
| 1816 | ); |
| 1817 | |
| 1818 | exit: |
| 1819 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1820 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1821 | _exception ? JNI_ABORT: 0); |
| 1822 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1823 | if (_exception) { |
| 1824 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1825 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1826 | } |
| 1827 | |
| 1828 | /* void glGetMaterialxv ( GLenum face, GLenum pname, GLfixed *params ) */ |
| 1829 | static void |
| 1830 | android_glGetMaterialxv__IILjava_nio_IntBuffer_2 |
| 1831 | (JNIEnv *_env, jobject _this, jint face, jint pname, jobject params_buf) { |
| 1832 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1833 | const char * _exceptionType = NULL; |
| 1834 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1835 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1836 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1837 | jint _remaining; |
| 1838 | GLfixed *params = (GLfixed *) 0; |
| 1839 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1840 | if (!params_buf) { |
| 1841 | _exception = 1; |
| 1842 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1843 | _exceptionMessage = "params == null"; |
| 1844 | goto exit; |
| 1845 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1846 | params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1847 | int _needed; |
| 1848 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1849 | #if defined(GL_AMBIENT) |
| 1850 | case GL_AMBIENT: |
| 1851 | #endif // defined(GL_AMBIENT) |
| 1852 | #if defined(GL_DIFFUSE) |
| 1853 | case GL_DIFFUSE: |
| 1854 | #endif // defined(GL_DIFFUSE) |
| 1855 | #if defined(GL_SPECULAR) |
| 1856 | case GL_SPECULAR: |
| 1857 | #endif // defined(GL_SPECULAR) |
| 1858 | #if defined(GL_EMISSION) |
| 1859 | case GL_EMISSION: |
| 1860 | #endif // defined(GL_EMISSION) |
| 1861 | #if defined(GL_AMBIENT_AND_DIFFUSE) |
| 1862 | case GL_AMBIENT_AND_DIFFUSE: |
| 1863 | #endif // defined(GL_AMBIENT_AND_DIFFUSE) |
| 1864 | _needed = 4; |
| 1865 | break; |
| 1866 | default: |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1867 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1868 | break; |
| 1869 | } |
| 1870 | if (_remaining < _needed) { |
| 1871 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1872 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1873 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1874 | goto exit; |
| 1875 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1876 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1877 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1878 | params = (GLfixed *) (_paramsBase + _bufferOffset); |
| 1879 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1880 | glGetMaterialxv( |
| 1881 | (GLenum)face, |
| 1882 | (GLenum)pname, |
| 1883 | (GLfixed *)params |
| 1884 | ); |
| 1885 | |
| 1886 | exit: |
| 1887 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1888 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1889 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1890 | if (_exception) { |
| 1891 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1892 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1893 | } |
| 1894 | |
| 1895 | /* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */ |
| 1896 | static void |
| 1897 | android_glGetTexEnvfv__II_3FI |
| 1898 | (JNIEnv *_env, jobject _this, jint env, jint pname, jfloatArray params_ref, jint offset) { |
| 1899 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1900 | const char * _exceptionType = NULL; |
| 1901 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1902 | GLfloat *params_base = (GLfloat *) 0; |
| 1903 | jint _remaining; |
| 1904 | GLfloat *params = (GLfloat *) 0; |
| 1905 | |
| 1906 | if (!params_ref) { |
| 1907 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1908 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1909 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1910 | goto exit; |
| 1911 | } |
| 1912 | if (offset < 0) { |
| 1913 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1914 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1915 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1916 | goto exit; |
| 1917 | } |
| 1918 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 1919 | int _needed; |
| 1920 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1921 | #if defined(GL_TEXTURE_ENV_COLOR) |
| 1922 | case GL_TEXTURE_ENV_COLOR: |
| 1923 | #endif // defined(GL_TEXTURE_ENV_COLOR) |
| 1924 | _needed = 4; |
| 1925 | break; |
| 1926 | default: |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1927 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1928 | break; |
| 1929 | } |
| 1930 | if (_remaining < _needed) { |
| 1931 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1932 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1933 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1934 | goto exit; |
| 1935 | } |
| 1936 | params_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1937 | _env->GetFloatArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1938 | params = params_base + offset; |
| 1939 | |
| 1940 | glGetTexEnvfv( |
| 1941 | (GLenum)env, |
| 1942 | (GLenum)pname, |
| 1943 | (GLfloat *)params |
| 1944 | ); |
| 1945 | |
| 1946 | exit: |
| 1947 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1948 | _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1949 | _exception ? JNI_ABORT: 0); |
| 1950 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1951 | if (_exception) { |
| 1952 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1953 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1954 | } |
| 1955 | |
| 1956 | /* void glGetTexEnvfv ( GLenum env, GLenum pname, GLfloat *params ) */ |
| 1957 | static void |
| 1958 | android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2 |
| 1959 | (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) { |
| 1960 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1961 | const char * _exceptionType = NULL; |
| 1962 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1963 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1964 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1965 | jint _remaining; |
| 1966 | GLfloat *params = (GLfloat *) 0; |
| 1967 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1968 | if (!params_buf) { |
| 1969 | _exception = 1; |
| 1970 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1971 | _exceptionMessage = "params == null"; |
| 1972 | goto exit; |
| 1973 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1974 | params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1975 | int _needed; |
| 1976 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1977 | #if defined(GL_TEXTURE_ENV_COLOR) |
| 1978 | case GL_TEXTURE_ENV_COLOR: |
| 1979 | #endif // defined(GL_TEXTURE_ENV_COLOR) |
| 1980 | _needed = 4; |
| 1981 | break; |
| 1982 | default: |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1983 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1984 | break; |
| 1985 | } |
| 1986 | if (_remaining < _needed) { |
| 1987 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1988 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1989 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1990 | goto exit; |
| 1991 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1992 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1993 | char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1994 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 1995 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 1996 | glGetTexEnvfv( |
| 1997 | (GLenum)env, |
| 1998 | (GLenum)pname, |
| 1999 | (GLfloat *)params |
| 2000 | ); |
| 2001 | |
| 2002 | exit: |
| 2003 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2004 | _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2005 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2006 | if (_exception) { |
| 2007 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2008 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2009 | } |
| 2010 | |
| 2011 | /* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */ |
| 2012 | static void |
| 2013 | android_glGetTexEnviv__II_3II |
| 2014 | (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) { |
| 2015 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2016 | const char * _exceptionType = NULL; |
| 2017 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2018 | GLint *params_base = (GLint *) 0; |
| 2019 | jint _remaining; |
| 2020 | GLint *params = (GLint *) 0; |
| 2021 | |
| 2022 | if (!params_ref) { |
| 2023 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2024 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2025 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2026 | goto exit; |
| 2027 | } |
| 2028 | if (offset < 0) { |
| 2029 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2030 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2031 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2032 | goto exit; |
| 2033 | } |
| 2034 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2035 | int _needed; |
| 2036 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2037 | #if defined(GL_TEXTURE_ENV_COLOR) |
| 2038 | case GL_TEXTURE_ENV_COLOR: |
| 2039 | #endif // defined(GL_TEXTURE_ENV_COLOR) |
| 2040 | _needed = 4; |
| 2041 | break; |
| 2042 | default: |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2043 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2044 | break; |
| 2045 | } |
| 2046 | if (_remaining < _needed) { |
| 2047 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2048 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2049 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2050 | goto exit; |
| 2051 | } |
| 2052 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2053 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2054 | params = params_base + offset; |
| 2055 | |
| 2056 | glGetTexEnviv( |
| 2057 | (GLenum)env, |
| 2058 | (GLenum)pname, |
| 2059 | (GLint *)params |
| 2060 | ); |
| 2061 | |
| 2062 | exit: |
| 2063 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2064 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2065 | _exception ? JNI_ABORT: 0); |
| 2066 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2067 | if (_exception) { |
| 2068 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2069 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2070 | } |
| 2071 | |
| 2072 | /* void glGetTexEnviv ( GLenum env, GLenum pname, GLint *params ) */ |
| 2073 | static void |
| 2074 | android_glGetTexEnviv__IILjava_nio_IntBuffer_2 |
| 2075 | (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) { |
| 2076 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2077 | const char * _exceptionType = NULL; |
| 2078 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2079 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2080 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2081 | jint _remaining; |
| 2082 | GLint *params = (GLint *) 0; |
| 2083 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2084 | if (!params_buf) { |
| 2085 | _exception = 1; |
| 2086 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2087 | _exceptionMessage = "params == null"; |
| 2088 | goto exit; |
| 2089 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2090 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2091 | int _needed; |
| 2092 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2093 | #if defined(GL_TEXTURE_ENV_COLOR) |
| 2094 | case GL_TEXTURE_ENV_COLOR: |
| 2095 | #endif // defined(GL_TEXTURE_ENV_COLOR) |
| 2096 | _needed = 4; |
| 2097 | break; |
| 2098 | default: |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2099 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2100 | break; |
| 2101 | } |
| 2102 | if (_remaining < _needed) { |
| 2103 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2104 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2105 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2106 | goto exit; |
| 2107 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2108 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2109 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2110 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 2111 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2112 | glGetTexEnviv( |
| 2113 | (GLenum)env, |
| 2114 | (GLenum)pname, |
| 2115 | (GLint *)params |
| 2116 | ); |
| 2117 | |
| 2118 | exit: |
| 2119 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2120 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2121 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2122 | if (_exception) { |
| 2123 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2124 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2125 | } |
| 2126 | |
| 2127 | /* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */ |
| 2128 | static void |
| 2129 | android_glGetTexEnvxv__II_3II |
| 2130 | (JNIEnv *_env, jobject _this, jint env, jint pname, jintArray params_ref, jint offset) { |
| 2131 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2132 | const char * _exceptionType = NULL; |
| 2133 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2134 | GLfixed *params_base = (GLfixed *) 0; |
| 2135 | jint _remaining; |
| 2136 | GLfixed *params = (GLfixed *) 0; |
| 2137 | |
| 2138 | if (!params_ref) { |
| 2139 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2140 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2141 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2142 | goto exit; |
| 2143 | } |
| 2144 | if (offset < 0) { |
| 2145 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2146 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2147 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2148 | goto exit; |
| 2149 | } |
| 2150 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2151 | int _needed; |
| 2152 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2153 | #if defined(GL_TEXTURE_ENV_COLOR) |
| 2154 | case GL_TEXTURE_ENV_COLOR: |
| 2155 | #endif // defined(GL_TEXTURE_ENV_COLOR) |
| 2156 | _needed = 4; |
| 2157 | break; |
| 2158 | default: |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2159 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2160 | break; |
| 2161 | } |
| 2162 | if (_remaining < _needed) { |
| 2163 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2164 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2165 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2166 | goto exit; |
| 2167 | } |
| 2168 | params_base = (GLfixed *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2169 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2170 | params = params_base + offset; |
| 2171 | |
| 2172 | glGetTexEnvxv( |
| 2173 | (GLenum)env, |
| 2174 | (GLenum)pname, |
| 2175 | (GLfixed *)params |
| 2176 | ); |
| 2177 | |
| 2178 | exit: |
| 2179 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2180 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2181 | _exception ? JNI_ABORT: 0); |
| 2182 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2183 | if (_exception) { |
| 2184 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2185 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2186 | } |
| 2187 | |
| 2188 | /* void glGetTexEnvxv ( GLenum env, GLenum pname, GLfixed *params ) */ |
| 2189 | static void |
| 2190 | android_glGetTexEnvxv__IILjava_nio_IntBuffer_2 |
| 2191 | (JNIEnv *_env, jobject _this, jint env, jint pname, jobject params_buf) { |
| 2192 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2193 | const char * _exceptionType = NULL; |
| 2194 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2195 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2196 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2197 | jint _remaining; |
| 2198 | GLfixed *params = (GLfixed *) 0; |
| 2199 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2200 | if (!params_buf) { |
| 2201 | _exception = 1; |
| 2202 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2203 | _exceptionMessage = "params == null"; |
| 2204 | goto exit; |
| 2205 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2206 | params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2207 | int _needed; |
| 2208 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2209 | #if defined(GL_TEXTURE_ENV_COLOR) |
| 2210 | case GL_TEXTURE_ENV_COLOR: |
| 2211 | #endif // defined(GL_TEXTURE_ENV_COLOR) |
| 2212 | _needed = 4; |
| 2213 | break; |
| 2214 | default: |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2215 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2216 | break; |
| 2217 | } |
| 2218 | if (_remaining < _needed) { |
| 2219 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2220 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2221 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2222 | goto exit; |
| 2223 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2224 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2225 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2226 | params = (GLfixed *) (_paramsBase + _bufferOffset); |
| 2227 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2228 | glGetTexEnvxv( |
| 2229 | (GLenum)env, |
| 2230 | (GLenum)pname, |
| 2231 | (GLfixed *)params |
| 2232 | ); |
| 2233 | |
| 2234 | exit: |
| 2235 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2236 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2237 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2238 | if (_exception) { |
| 2239 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2240 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2241 | } |
| 2242 | |
| 2243 | /* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */ |
| 2244 | static void |
| 2245 | android_glGetTexParameterfv__II_3FI |
| 2246 | (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) { |
| 2247 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2248 | const char * _exceptionType = NULL; |
| 2249 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2250 | GLfloat *params_base = (GLfloat *) 0; |
| 2251 | jint _remaining; |
| 2252 | GLfloat *params = (GLfloat *) 0; |
| 2253 | |
| 2254 | if (!params_ref) { |
| 2255 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2256 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2257 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2258 | goto exit; |
| 2259 | } |
| 2260 | if (offset < 0) { |
| 2261 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2262 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2263 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2264 | goto exit; |
| 2265 | } |
| 2266 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2267 | if (_remaining < 1) { |
| 2268 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2269 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2270 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2271 | goto exit; |
| 2272 | } |
| 2273 | params_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2274 | _env->GetFloatArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2275 | params = params_base + offset; |
| 2276 | |
| 2277 | glGetTexParameterfv( |
| 2278 | (GLenum)target, |
| 2279 | (GLenum)pname, |
| 2280 | (GLfloat *)params |
| 2281 | ); |
| 2282 | |
| 2283 | exit: |
| 2284 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2285 | _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2286 | _exception ? JNI_ABORT: 0); |
| 2287 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2288 | if (_exception) { |
| 2289 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2290 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2291 | } |
| 2292 | |
| 2293 | /* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */ |
| 2294 | static void |
| 2295 | android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 |
| 2296 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
| 2297 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2298 | const char * _exceptionType = NULL; |
| 2299 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2300 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2301 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2302 | jint _remaining; |
| 2303 | GLfloat *params = (GLfloat *) 0; |
| 2304 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2305 | if (!params_buf) { |
| 2306 | _exception = 1; |
| 2307 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2308 | _exceptionMessage = "params == null"; |
| 2309 | goto exit; |
| 2310 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2311 | params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2312 | if (_remaining < 1) { |
| 2313 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2314 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2315 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2316 | goto exit; |
| 2317 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2318 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2319 | char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2320 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 2321 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2322 | glGetTexParameterfv( |
| 2323 | (GLenum)target, |
| 2324 | (GLenum)pname, |
| 2325 | (GLfloat *)params |
| 2326 | ); |
| 2327 | |
| 2328 | exit: |
| 2329 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2330 | _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2331 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2332 | if (_exception) { |
| 2333 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2334 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2335 | } |
| 2336 | |
| 2337 | /* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 2338 | static void |
| 2339 | android_glGetTexParameteriv__II_3II |
| 2340 | (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { |
| 2341 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2342 | const char * _exceptionType = NULL; |
| 2343 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2344 | GLint *params_base = (GLint *) 0; |
| 2345 | jint _remaining; |
| 2346 | GLint *params = (GLint *) 0; |
| 2347 | |
| 2348 | if (!params_ref) { |
| 2349 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2350 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2351 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2352 | goto exit; |
| 2353 | } |
| 2354 | if (offset < 0) { |
| 2355 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2356 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2357 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2358 | goto exit; |
| 2359 | } |
| 2360 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2361 | if (_remaining < 1) { |
| 2362 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2363 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2364 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2365 | goto exit; |
| 2366 | } |
| 2367 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2368 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2369 | params = params_base + offset; |
| 2370 | |
| 2371 | glGetTexParameteriv( |
| 2372 | (GLenum)target, |
| 2373 | (GLenum)pname, |
| 2374 | (GLint *)params |
| 2375 | ); |
| 2376 | |
| 2377 | exit: |
| 2378 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2379 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2380 | _exception ? JNI_ABORT: 0); |
| 2381 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2382 | if (_exception) { |
| 2383 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2384 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2385 | } |
| 2386 | |
| 2387 | /* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 2388 | static void |
| 2389 | android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 |
| 2390 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
| 2391 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2392 | const char * _exceptionType = NULL; |
| 2393 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2394 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2395 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2396 | jint _remaining; |
| 2397 | GLint *params = (GLint *) 0; |
| 2398 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2399 | if (!params_buf) { |
| 2400 | _exception = 1; |
| 2401 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2402 | _exceptionMessage = "params == null"; |
| 2403 | goto exit; |
| 2404 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2405 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2406 | if (_remaining < 1) { |
| 2407 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2408 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2409 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2410 | goto exit; |
| 2411 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2412 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2413 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2414 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 2415 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2416 | glGetTexParameteriv( |
| 2417 | (GLenum)target, |
| 2418 | (GLenum)pname, |
| 2419 | (GLint *)params |
| 2420 | ); |
| 2421 | |
| 2422 | exit: |
| 2423 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2424 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2425 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2426 | if (_exception) { |
| 2427 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2428 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2429 | } |
| 2430 | |
| 2431 | /* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */ |
| 2432 | static void |
| 2433 | android_glGetTexParameterxv__II_3II |
| 2434 | (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { |
| 2435 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2436 | const char * _exceptionType = NULL; |
| 2437 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2438 | GLfixed *params_base = (GLfixed *) 0; |
| 2439 | jint _remaining; |
| 2440 | GLfixed *params = (GLfixed *) 0; |
| 2441 | |
| 2442 | if (!params_ref) { |
| 2443 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2444 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2445 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2446 | goto exit; |
| 2447 | } |
| 2448 | if (offset < 0) { |
| 2449 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2450 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2451 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2452 | goto exit; |
| 2453 | } |
| 2454 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2455 | if (_remaining < 1) { |
| 2456 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2457 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2458 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2459 | goto exit; |
| 2460 | } |
| 2461 | params_base = (GLfixed *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2462 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2463 | params = params_base + offset; |
| 2464 | |
| 2465 | glGetTexParameterxv( |
| 2466 | (GLenum)target, |
| 2467 | (GLenum)pname, |
| 2468 | (GLfixed *)params |
| 2469 | ); |
| 2470 | |
| 2471 | exit: |
| 2472 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2473 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2474 | _exception ? JNI_ABORT: 0); |
| 2475 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2476 | if (_exception) { |
| 2477 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2478 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2479 | } |
| 2480 | |
| 2481 | /* void glGetTexParameterxv ( GLenum target, GLenum pname, GLfixed *params ) */ |
| 2482 | static void |
| 2483 | android_glGetTexParameterxv__IILjava_nio_IntBuffer_2 |
| 2484 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
| 2485 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2486 | const char * _exceptionType = NULL; |
| 2487 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2488 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2489 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2490 | jint _remaining; |
| 2491 | GLfixed *params = (GLfixed *) 0; |
| 2492 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2493 | if (!params_buf) { |
| 2494 | _exception = 1; |
| 2495 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2496 | _exceptionMessage = "params == null"; |
| 2497 | goto exit; |
| 2498 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2499 | params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2500 | if (_remaining < 1) { |
| 2501 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2502 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2503 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2504 | goto exit; |
| 2505 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2506 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2507 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2508 | params = (GLfixed *) (_paramsBase + _bufferOffset); |
| 2509 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2510 | glGetTexParameterxv( |
| 2511 | (GLenum)target, |
| 2512 | (GLenum)pname, |
| 2513 | (GLfixed *)params |
| 2514 | ); |
| 2515 | |
| 2516 | exit: |
| 2517 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2518 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2519 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2520 | if (_exception) { |
| 2521 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2522 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2523 | } |
| 2524 | |
| 2525 | /* GLboolean glIsBuffer ( GLuint buffer ) */ |
| 2526 | static jboolean |
| 2527 | android_glIsBuffer__I |
| 2528 | (JNIEnv *_env, jobject _this, jint buffer) { |
| 2529 | GLboolean _returnValue; |
| 2530 | _returnValue = glIsBuffer( |
| 2531 | (GLuint)buffer |
| 2532 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 2533 | return (jboolean)_returnValue; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2534 | } |
| 2535 | |
| 2536 | /* GLboolean glIsEnabled ( GLenum cap ) */ |
| 2537 | static jboolean |
| 2538 | android_glIsEnabled__I |
| 2539 | (JNIEnv *_env, jobject _this, jint cap) { |
| 2540 | GLboolean _returnValue; |
| 2541 | _returnValue = glIsEnabled( |
| 2542 | (GLenum)cap |
| 2543 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 2544 | return (jboolean)_returnValue; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2545 | } |
| 2546 | |
| 2547 | /* GLboolean glIsTexture ( GLuint texture ) */ |
| 2548 | static jboolean |
| 2549 | android_glIsTexture__I |
| 2550 | (JNIEnv *_env, jobject _this, jint texture) { |
| 2551 | GLboolean _returnValue; |
| 2552 | _returnValue = glIsTexture( |
| 2553 | (GLuint)texture |
| 2554 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 2555 | return (jboolean)_returnValue; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2556 | } |
| 2557 | |
| 2558 | /* void glNormalPointer ( GLenum type, GLsizei stride, GLint offset ) */ |
| 2559 | static void |
| 2560 | android_glNormalPointer__III |
| 2561 | (JNIEnv *_env, jobject _this, jint type, jint stride, jint offset) { |
| 2562 | glNormalPointer( |
| 2563 | (GLenum)type, |
| 2564 | (GLsizei)stride, |
Ashok Bhat | 01c26ea | 2014-02-24 09:49:07 +0000 | [diff] [blame] | 2565 | reinterpret_cast<GLvoid *>(offset) |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2566 | ); |
| 2567 | } |
| 2568 | |
| 2569 | /* void glPointParameterf ( GLenum pname, GLfloat param ) */ |
| 2570 | static void |
| 2571 | android_glPointParameterf__IF |
| 2572 | (JNIEnv *_env, jobject _this, jint pname, jfloat param) { |
| 2573 | glPointParameterf( |
| 2574 | (GLenum)pname, |
| 2575 | (GLfloat)param |
| 2576 | ); |
| 2577 | } |
| 2578 | |
| 2579 | /* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */ |
| 2580 | static void |
| 2581 | android_glPointParameterfv__I_3FI |
| 2582 | (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2583 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2584 | const char * _exceptionType = NULL; |
| 2585 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2586 | GLfloat *params_base = (GLfloat *) 0; |
| 2587 | jint _remaining; |
| 2588 | GLfloat *params = (GLfloat *) 0; |
| 2589 | |
| 2590 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2591 | _exception = 1; |
| 2592 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2593 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2594 | goto exit; |
| 2595 | } |
| 2596 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2597 | _exception = 1; |
| 2598 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2599 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2600 | goto exit; |
| 2601 | } |
| 2602 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2603 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2604 | _exception = 1; |
| 2605 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2606 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2607 | goto exit; |
| 2608 | } |
| 2609 | params_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2610 | _env->GetFloatArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2611 | params = params_base + offset; |
| 2612 | |
| 2613 | glPointParameterfv( |
| 2614 | (GLenum)pname, |
| 2615 | (GLfloat *)params |
| 2616 | ); |
| 2617 | |
| 2618 | exit: |
| 2619 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2620 | _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2621 | JNI_ABORT); |
| 2622 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2623 | if (_exception) { |
| 2624 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2625 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2626 | } |
| 2627 | |
| 2628 | /* void glPointParameterfv ( GLenum pname, const GLfloat *params ) */ |
| 2629 | static void |
| 2630 | android_glPointParameterfv__ILjava_nio_FloatBuffer_2 |
| 2631 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2632 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2633 | const char * _exceptionType = NULL; |
| 2634 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2635 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2636 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2637 | jint _remaining; |
| 2638 | GLfloat *params = (GLfloat *) 0; |
| 2639 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2640 | if (!params_buf) { |
| 2641 | _exception = 1; |
| 2642 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2643 | _exceptionMessage = "params == null"; |
| 2644 | goto exit; |
| 2645 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2646 | params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2647 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2648 | _exception = 1; |
| 2649 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2650 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2651 | goto exit; |
| 2652 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2653 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2654 | char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2655 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 2656 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2657 | glPointParameterfv( |
| 2658 | (GLenum)pname, |
| 2659 | (GLfloat *)params |
| 2660 | ); |
| 2661 | |
| 2662 | exit: |
| 2663 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2664 | _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2665 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2666 | if (_exception) { |
| 2667 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2668 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2669 | } |
| 2670 | |
| 2671 | /* void glPointParameterx ( GLenum pname, GLfixed param ) */ |
| 2672 | static void |
| 2673 | android_glPointParameterx__II |
| 2674 | (JNIEnv *_env, jobject _this, jint pname, jint param) { |
| 2675 | glPointParameterx( |
| 2676 | (GLenum)pname, |
| 2677 | (GLfixed)param |
| 2678 | ); |
| 2679 | } |
| 2680 | |
| 2681 | /* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */ |
| 2682 | static void |
| 2683 | android_glPointParameterxv__I_3II |
| 2684 | (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2685 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2686 | const char * _exceptionType = NULL; |
| 2687 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2688 | GLfixed *params_base = (GLfixed *) 0; |
| 2689 | jint _remaining; |
| 2690 | GLfixed *params = (GLfixed *) 0; |
| 2691 | |
| 2692 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2693 | _exception = 1; |
| 2694 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2695 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2696 | goto exit; |
| 2697 | } |
| 2698 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2699 | _exception = 1; |
| 2700 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2701 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2702 | goto exit; |
| 2703 | } |
| 2704 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2705 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2706 | _exception = 1; |
| 2707 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2708 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2709 | goto exit; |
| 2710 | } |
| 2711 | params_base = (GLfixed *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2712 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2713 | params = params_base + offset; |
| 2714 | |
| 2715 | glPointParameterxv( |
| 2716 | (GLenum)pname, |
| 2717 | (GLfixed *)params |
| 2718 | ); |
| 2719 | |
| 2720 | exit: |
| 2721 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2722 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2723 | JNI_ABORT); |
| 2724 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2725 | if (_exception) { |
| 2726 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2727 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2728 | } |
| 2729 | |
| 2730 | /* void glPointParameterxv ( GLenum pname, const GLfixed *params ) */ |
| 2731 | static void |
| 2732 | android_glPointParameterxv__ILjava_nio_IntBuffer_2 |
| 2733 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2734 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2735 | const char * _exceptionType = NULL; |
| 2736 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2737 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2738 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2739 | jint _remaining; |
| 2740 | GLfixed *params = (GLfixed *) 0; |
| 2741 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2742 | if (!params_buf) { |
| 2743 | _exception = 1; |
| 2744 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2745 | _exceptionMessage = "params == null"; |
| 2746 | goto exit; |
| 2747 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2748 | params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2749 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2750 | _exception = 1; |
| 2751 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2752 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2753 | goto exit; |
| 2754 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2755 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2756 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2757 | params = (GLfixed *) (_paramsBase + _bufferOffset); |
| 2758 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2759 | glPointParameterxv( |
| 2760 | (GLenum)pname, |
| 2761 | (GLfixed *)params |
| 2762 | ); |
| 2763 | |
| 2764 | exit: |
| 2765 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2766 | _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2767 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2768 | if (_exception) { |
| 2769 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2770 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2771 | } |
| 2772 | |
| 2773 | /* void glPointSizePointerOES ( GLenum type, GLsizei stride, const GLvoid *pointer ) */ |
| 2774 | static void |
Jack Palevich | be6eac8 | 2009-12-08 15:43:51 +0800 | [diff] [blame] | 2775 | android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I |
| 2776 | (JNIEnv *_env, jobject _this, jint type, jint stride, jobject pointer_buf, jint remaining) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2777 | jint _exception = 0; |
| 2778 | const char * _exceptionType = NULL; |
| 2779 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2780 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2781 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2782 | jint _remaining; |
| 2783 | GLvoid *pointer = (GLvoid *) 0; |
| 2784 | |
Jack Palevich | be6eac8 | 2009-12-08 15:43:51 +0800 | [diff] [blame] | 2785 | if (pointer_buf) { |
| 2786 | pointer = (GLvoid *) getDirectBufferPointer(_env, pointer_buf); |
| 2787 | if ( ! pointer ) { |
| 2788 | return; |
| 2789 | } |
| 2790 | } |
| 2791 | glPointSizePointerOESBounds( |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2792 | (GLenum)type, |
| 2793 | (GLsizei)stride, |
Jack Palevich | be6eac8 | 2009-12-08 15:43:51 +0800 | [diff] [blame] | 2794 | (GLvoid *)pointer, |
| 2795 | (GLsizei)remaining |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2796 | ); |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2797 | if (_exception) { |
| 2798 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2799 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2800 | } |
| 2801 | |
| 2802 | /* void glTexCoordPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */ |
| 2803 | static void |
| 2804 | android_glTexCoordPointer__IIII |
| 2805 | (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) { |
| 2806 | glTexCoordPointer( |
| 2807 | (GLint)size, |
| 2808 | (GLenum)type, |
| 2809 | (GLsizei)stride, |
Ashok Bhat | 01c26ea | 2014-02-24 09:49:07 +0000 | [diff] [blame] | 2810 | reinterpret_cast<GLvoid *>(offset) |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2811 | ); |
| 2812 | } |
| 2813 | |
| 2814 | /* void glTexEnvi ( GLenum target, GLenum pname, GLint param ) */ |
| 2815 | static void |
| 2816 | android_glTexEnvi__III |
| 2817 | (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) { |
| 2818 | glTexEnvi( |
| 2819 | (GLenum)target, |
| 2820 | (GLenum)pname, |
| 2821 | (GLint)param |
| 2822 | ); |
| 2823 | } |
| 2824 | |
| 2825 | /* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */ |
| 2826 | static void |
| 2827 | android_glTexEnviv__II_3II |
| 2828 | (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] | 2829 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2830 | const char * _exceptionType = NULL; |
| 2831 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2832 | GLint *params_base = (GLint *) 0; |
| 2833 | jint _remaining; |
| 2834 | GLint *params = (GLint *) 0; |
| 2835 | |
| 2836 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2837 | _exception = 1; |
| 2838 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2839 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2840 | goto exit; |
| 2841 | } |
| 2842 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2843 | _exception = 1; |
| 2844 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2845 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2846 | goto exit; |
| 2847 | } |
| 2848 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2849 | int _needed; |
| 2850 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2851 | #if defined(GL_TEXTURE_ENV_COLOR) |
| 2852 | case GL_TEXTURE_ENV_COLOR: |
| 2853 | #endif // defined(GL_TEXTURE_ENV_COLOR) |
| 2854 | _needed = 4; |
| 2855 | break; |
| 2856 | default: |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2857 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2858 | break; |
| 2859 | } |
| 2860 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2861 | _exception = 1; |
| 2862 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2863 | _exceptionMessage = "length - offset < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2864 | goto exit; |
| 2865 | } |
| 2866 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2867 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2868 | params = params_base + offset; |
| 2869 | |
| 2870 | glTexEnviv( |
| 2871 | (GLenum)target, |
| 2872 | (GLenum)pname, |
| 2873 | (GLint *)params |
| 2874 | ); |
| 2875 | |
| 2876 | exit: |
| 2877 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2878 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2879 | JNI_ABORT); |
| 2880 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2881 | if (_exception) { |
| 2882 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2883 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2884 | } |
| 2885 | |
| 2886 | /* void glTexEnviv ( GLenum target, GLenum pname, const GLint *params ) */ |
| 2887 | static void |
| 2888 | android_glTexEnviv__IILjava_nio_IntBuffer_2 |
| 2889 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2890 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2891 | const char * _exceptionType = NULL; |
| 2892 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2893 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2894 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2895 | jint _remaining; |
| 2896 | GLint *params = (GLint *) 0; |
| 2897 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2898 | if (!params_buf) { |
| 2899 | _exception = 1; |
| 2900 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2901 | _exceptionMessage = "params == null"; |
| 2902 | goto exit; |
| 2903 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2904 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2905 | int _needed; |
| 2906 | switch (pname) { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2907 | #if defined(GL_TEXTURE_ENV_COLOR) |
| 2908 | case GL_TEXTURE_ENV_COLOR: |
| 2909 | #endif // defined(GL_TEXTURE_ENV_COLOR) |
| 2910 | _needed = 4; |
| 2911 | break; |
| 2912 | default: |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2913 | _needed = 1; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2914 | break; |
| 2915 | } |
| 2916 | if (_remaining < _needed) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2917 | _exception = 1; |
| 2918 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2919 | _exceptionMessage = "remaining() < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2920 | goto exit; |
| 2921 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2922 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2923 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2924 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 2925 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2926 | glTexEnviv( |
| 2927 | (GLenum)target, |
| 2928 | (GLenum)pname, |
| 2929 | (GLint *)params |
| 2930 | ); |
| 2931 | |
| 2932 | exit: |
| 2933 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2934 | _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2935 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2936 | if (_exception) { |
| 2937 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2938 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2939 | } |
| 2940 | |
| 2941 | /* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */ |
| 2942 | static void |
| 2943 | android_glTexParameterfv__II_3FI |
| 2944 | (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] | 2945 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2946 | const char * _exceptionType = NULL; |
| 2947 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2948 | GLfloat *params_base = (GLfloat *) 0; |
| 2949 | jint _remaining; |
| 2950 | GLfloat *params = (GLfloat *) 0; |
| 2951 | |
| 2952 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2953 | _exception = 1; |
| 2954 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2955 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2956 | goto exit; |
| 2957 | } |
| 2958 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2959 | _exception = 1; |
| 2960 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2961 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2962 | goto exit; |
| 2963 | } |
| 2964 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2965 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2966 | _exception = 1; |
| 2967 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2968 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2969 | goto exit; |
| 2970 | } |
| 2971 | params_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2972 | _env->GetFloatArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2973 | params = params_base + offset; |
| 2974 | |
| 2975 | glTexParameterfv( |
| 2976 | (GLenum)target, |
| 2977 | (GLenum)pname, |
| 2978 | (GLfloat *)params |
| 2979 | ); |
| 2980 | |
| 2981 | exit: |
| 2982 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2983 | _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2984 | JNI_ABORT); |
| 2985 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2986 | if (_exception) { |
| 2987 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2988 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 2989 | } |
| 2990 | |
| 2991 | /* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */ |
| 2992 | static void |
| 2993 | android_glTexParameterfv__IILjava_nio_FloatBuffer_2 |
| 2994 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2995 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2996 | const char * _exceptionType = NULL; |
| 2997 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2998 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2999 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3000 | jint _remaining; |
| 3001 | GLfloat *params = (GLfloat *) 0; |
| 3002 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3003 | if (!params_buf) { |
| 3004 | _exception = 1; |
| 3005 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3006 | _exceptionMessage = "params == null"; |
| 3007 | goto exit; |
| 3008 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3009 | params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3010 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3011 | _exception = 1; |
| 3012 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3013 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3014 | goto exit; |
| 3015 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3016 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3017 | char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3018 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 3019 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3020 | glTexParameterfv( |
| 3021 | (GLenum)target, |
| 3022 | (GLenum)pname, |
| 3023 | (GLfloat *)params |
| 3024 | ); |
| 3025 | |
| 3026 | exit: |
| 3027 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3028 | _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3029 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3030 | if (_exception) { |
| 3031 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3032 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3033 | } |
| 3034 | |
| 3035 | /* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */ |
| 3036 | static void |
| 3037 | android_glTexParameteri__III |
| 3038 | (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) { |
| 3039 | glTexParameteri( |
| 3040 | (GLenum)target, |
| 3041 | (GLenum)pname, |
| 3042 | (GLint)param |
| 3043 | ); |
| 3044 | } |
| 3045 | |
| 3046 | /* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */ |
| 3047 | static void |
| 3048 | android_glTexParameteriv__II_3II |
| 3049 | (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] | 3050 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3051 | const char * _exceptionType = NULL; |
| 3052 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3053 | GLint *params_base = (GLint *) 0; |
| 3054 | jint _remaining; |
| 3055 | GLint *params = (GLint *) 0; |
| 3056 | |
| 3057 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3058 | _exception = 1; |
| 3059 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3060 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3061 | goto exit; |
| 3062 | } |
| 3063 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3064 | _exception = 1; |
| 3065 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3066 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3067 | goto exit; |
| 3068 | } |
| 3069 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 3070 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3071 | _exception = 1; |
| 3072 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3073 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3074 | goto exit; |
| 3075 | } |
| 3076 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3077 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3078 | params = params_base + offset; |
| 3079 | |
| 3080 | glTexParameteriv( |
| 3081 | (GLenum)target, |
| 3082 | (GLenum)pname, |
| 3083 | (GLint *)params |
| 3084 | ); |
| 3085 | |
| 3086 | exit: |
| 3087 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3088 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3089 | JNI_ABORT); |
| 3090 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3091 | if (_exception) { |
| 3092 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3093 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3094 | } |
| 3095 | |
| 3096 | /* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */ |
| 3097 | static void |
| 3098 | android_glTexParameteriv__IILjava_nio_IntBuffer_2 |
| 3099 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3100 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3101 | const char * _exceptionType = NULL; |
| 3102 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3103 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3104 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3105 | jint _remaining; |
| 3106 | GLint *params = (GLint *) 0; |
| 3107 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3108 | if (!params_buf) { |
| 3109 | _exception = 1; |
| 3110 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3111 | _exceptionMessage = "params == null"; |
| 3112 | goto exit; |
| 3113 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3114 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3115 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3116 | _exception = 1; |
| 3117 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3118 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3119 | goto exit; |
| 3120 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3121 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3122 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3123 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 3124 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3125 | glTexParameteriv( |
| 3126 | (GLenum)target, |
| 3127 | (GLenum)pname, |
| 3128 | (GLint *)params |
| 3129 | ); |
| 3130 | |
| 3131 | exit: |
| 3132 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3133 | _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3134 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3135 | if (_exception) { |
| 3136 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3137 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3138 | } |
| 3139 | |
| 3140 | /* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */ |
| 3141 | static void |
| 3142 | android_glTexParameterxv__II_3II |
| 3143 | (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] | 3144 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3145 | const char * _exceptionType = NULL; |
| 3146 | const char * _exceptionMessage = NULL; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3147 | GLfixed *params_base = (GLfixed *) 0; |
| 3148 | jint _remaining; |
| 3149 | GLfixed *params = (GLfixed *) 0; |
| 3150 | |
| 3151 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3152 | _exception = 1; |
| 3153 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3154 | _exceptionMessage = "params == null"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3155 | goto exit; |
| 3156 | } |
| 3157 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3158 | _exception = 1; |
| 3159 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3160 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3161 | goto exit; |
| 3162 | } |
| 3163 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 3164 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3165 | _exception = 1; |
| 3166 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3167 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3168 | goto exit; |
| 3169 | } |
| 3170 | params_base = (GLfixed *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3171 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3172 | params = params_base + offset; |
| 3173 | |
| 3174 | glTexParameterxv( |
| 3175 | (GLenum)target, |
| 3176 | (GLenum)pname, |
| 3177 | (GLfixed *)params |
| 3178 | ); |
| 3179 | |
| 3180 | exit: |
| 3181 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3182 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3183 | JNI_ABORT); |
| 3184 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3185 | if (_exception) { |
| 3186 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3187 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3188 | } |
| 3189 | |
| 3190 | /* void glTexParameterxv ( GLenum target, GLenum pname, const GLfixed *params ) */ |
| 3191 | static void |
| 3192 | android_glTexParameterxv__IILjava_nio_IntBuffer_2 |
| 3193 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3194 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3195 | const char * _exceptionType = NULL; |
| 3196 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3197 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3198 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3199 | jint _remaining; |
| 3200 | GLfixed *params = (GLfixed *) 0; |
| 3201 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3202 | if (!params_buf) { |
| 3203 | _exception = 1; |
| 3204 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3205 | _exceptionMessage = "params == null"; |
| 3206 | goto exit; |
| 3207 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3208 | params = (GLfixed *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3209 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3210 | _exception = 1; |
| 3211 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3212 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3213 | goto exit; |
| 3214 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3215 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3216 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3217 | params = (GLfixed *) (_paramsBase + _bufferOffset); |
| 3218 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3219 | glTexParameterxv( |
| 3220 | (GLenum)target, |
| 3221 | (GLenum)pname, |
| 3222 | (GLfixed *)params |
| 3223 | ); |
| 3224 | |
| 3225 | exit: |
| 3226 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3227 | _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT); |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3228 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3229 | if (_exception) { |
| 3230 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3231 | } |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3232 | } |
| 3233 | |
| 3234 | /* void glVertexPointer ( GLint size, GLenum type, GLsizei stride, GLint offset ) */ |
| 3235 | static void |
| 3236 | android_glVertexPointer__IIII |
| 3237 | (JNIEnv *_env, jobject _this, jint size, jint type, jint stride, jint offset) { |
| 3238 | glVertexPointer( |
| 3239 | (GLint)size, |
| 3240 | (GLenum)type, |
| 3241 | (GLsizei)stride, |
Ashok Bhat | 01c26ea | 2014-02-24 09:49:07 +0000 | [diff] [blame] | 3242 | reinterpret_cast<GLvoid *>(offset) |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3243 | ); |
| 3244 | } |
| 3245 | |
| 3246 | static const char *classPathName = "android/opengl/GLES11"; |
| 3247 | |
Daniel Micay | 76f6a86 | 2015-09-19 17:31:01 -0400 | [diff] [blame] | 3248 | static const JNINativeMethod methods[] = { |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3249 | {"_nativeClassInit", "()V", (void*)nativeClassInit }, |
| 3250 | {"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II }, |
| 3251 | {"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I }, |
| 3252 | {"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 }, |
| 3253 | {"glClipPlanef", "(I[FI)V", (void *) android_glClipPlanef__I_3FI }, |
| 3254 | {"glClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glClipPlanef__ILjava_nio_FloatBuffer_2 }, |
| 3255 | {"glClipPlanex", "(I[II)V", (void *) android_glClipPlanex__I_3II }, |
| 3256 | {"glClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glClipPlanex__ILjava_nio_IntBuffer_2 }, |
| 3257 | {"glColor4ub", "(BBBB)V", (void *) android_glColor4ub__BBBB }, |
| 3258 | {"glColorPointer", "(IIII)V", (void *) android_glColorPointer__IIII }, |
| 3259 | {"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II }, |
| 3260 | {"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 }, |
| 3261 | {"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII }, |
| 3262 | {"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II }, |
| 3263 | {"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 }, |
| 3264 | {"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI }, |
| 3265 | {"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 }, |
| 3266 | {"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II }, |
| 3267 | {"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 }, |
| 3268 | {"glGetClipPlanef", "(I[FI)V", (void *) android_glGetClipPlanef__I_3FI }, |
| 3269 | {"glGetClipPlanef", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetClipPlanef__ILjava_nio_FloatBuffer_2 }, |
| 3270 | {"glGetClipPlanex", "(I[II)V", (void *) android_glGetClipPlanex__I_3II }, |
| 3271 | {"glGetClipPlanex", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetClipPlanex__ILjava_nio_IntBuffer_2 }, |
| 3272 | {"glGetFixedv", "(I[II)V", (void *) android_glGetFixedv__I_3II }, |
| 3273 | {"glGetFixedv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetFixedv__ILjava_nio_IntBuffer_2 }, |
| 3274 | {"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI }, |
| 3275 | {"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 }, |
| 3276 | {"glGetLightfv", "(II[FI)V", (void *) android_glGetLightfv__II_3FI }, |
| 3277 | {"glGetLightfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetLightfv__IILjava_nio_FloatBuffer_2 }, |
| 3278 | {"glGetLightxv", "(II[II)V", (void *) android_glGetLightxv__II_3II }, |
| 3279 | {"glGetLightxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetLightxv__IILjava_nio_IntBuffer_2 }, |
| 3280 | {"glGetMaterialfv", "(II[FI)V", (void *) android_glGetMaterialfv__II_3FI }, |
| 3281 | {"glGetMaterialfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetMaterialfv__IILjava_nio_FloatBuffer_2 }, |
| 3282 | {"glGetMaterialxv", "(II[II)V", (void *) android_glGetMaterialxv__II_3II }, |
| 3283 | {"glGetMaterialxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetMaterialxv__IILjava_nio_IntBuffer_2 }, |
| 3284 | {"glGetTexEnvfv", "(II[FI)V", (void *) android_glGetTexEnvfv__II_3FI }, |
| 3285 | {"glGetTexEnvfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexEnvfv__IILjava_nio_FloatBuffer_2 }, |
| 3286 | {"glGetTexEnviv", "(II[II)V", (void *) android_glGetTexEnviv__II_3II }, |
| 3287 | {"glGetTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnviv__IILjava_nio_IntBuffer_2 }, |
| 3288 | {"glGetTexEnvxv", "(II[II)V", (void *) android_glGetTexEnvxv__II_3II }, |
| 3289 | {"glGetTexEnvxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexEnvxv__IILjava_nio_IntBuffer_2 }, |
| 3290 | {"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI }, |
| 3291 | {"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 }, |
| 3292 | {"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II }, |
| 3293 | {"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 }, |
| 3294 | {"glGetTexParameterxv", "(II[II)V", (void *) android_glGetTexParameterxv__II_3II }, |
| 3295 | {"glGetTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameterxv__IILjava_nio_IntBuffer_2 }, |
| 3296 | {"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I }, |
| 3297 | {"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I }, |
| 3298 | {"glIsTexture", "(I)Z", (void *) android_glIsTexture__I }, |
| 3299 | {"glNormalPointer", "(III)V", (void *) android_glNormalPointer__III }, |
| 3300 | {"glPointParameterf", "(IF)V", (void *) android_glPointParameterf__IF }, |
| 3301 | {"glPointParameterfv", "(I[FI)V", (void *) android_glPointParameterfv__I_3FI }, |
| 3302 | {"glPointParameterfv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glPointParameterfv__ILjava_nio_FloatBuffer_2 }, |
| 3303 | {"glPointParameterx", "(II)V", (void *) android_glPointParameterx__II }, |
| 3304 | {"glPointParameterxv", "(I[II)V", (void *) android_glPointParameterxv__I_3II }, |
| 3305 | {"glPointParameterxv", "(ILjava/nio/IntBuffer;)V", (void *) android_glPointParameterxv__ILjava_nio_IntBuffer_2 }, |
Jack Palevich | be6eac8 | 2009-12-08 15:43:51 +0800 | [diff] [blame] | 3306 | {"glPointSizePointerOESBounds", "(IILjava/nio/Buffer;I)V", (void *) android_glPointSizePointerOESBounds__IILjava_nio_Buffer_2I }, |
Jack Palevich | 27f8002 | 2009-04-15 19:13:17 -0700 | [diff] [blame] | 3307 | {"glTexCoordPointer", "(IIII)V", (void *) android_glTexCoordPointer__IIII }, |
| 3308 | {"glTexEnvi", "(III)V", (void *) android_glTexEnvi__III }, |
| 3309 | {"glTexEnviv", "(II[II)V", (void *) android_glTexEnviv__II_3II }, |
| 3310 | {"glTexEnviv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexEnviv__IILjava_nio_IntBuffer_2 }, |
| 3311 | {"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI }, |
| 3312 | {"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 }, |
| 3313 | {"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III }, |
| 3314 | {"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II }, |
| 3315 | {"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 }, |
| 3316 | {"glTexParameterxv", "(II[II)V", (void *) android_glTexParameterxv__II_3II }, |
| 3317 | {"glTexParameterxv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameterxv__IILjava_nio_IntBuffer_2 }, |
| 3318 | {"glVertexPointer", "(IIII)V", (void *) android_glVertexPointer__IIII }, |
| 3319 | }; |
| 3320 | |
| 3321 | int register_android_opengl_jni_GLES11(JNIEnv *_env) |
| 3322 | { |
| 3323 | int err; |
| 3324 | err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods)); |
| 3325 | return err; |
| 3326 | } |