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