Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1 | /* |
| 2 | ** |
| 3 | ** Copyright 2009, The Android Open Source Project |
| 4 | ** |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 5 | ** Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | ** you may not use this file except in compliance with the License. |
| 7 | ** You may obtain a copy of the License at |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 8 | ** |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 9 | ** http://www.apache.org/licenses/LICENSE-2.0 |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 10 | ** |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 11 | ** Unless required by applicable law or agreed to in writing, software |
| 12 | ** distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | ** See the License for the specific language governing permissions and |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 15 | ** limitations under the License. |
| 16 | */ |
| 17 | |
| 18 | // This source file is automatically generated |
| 19 | |
Andreas Gampe | bfe6333 | 2014-11-12 14:12:45 -0800 | [diff] [blame] | 20 | #pragma GCC diagnostic ignored "-Wunused-variable" |
Andreas Gampe | bfe6333 | 2014-11-12 14:12:45 -0800 | [diff] [blame] | 21 | #pragma GCC diagnostic ignored "-Wunused-function" |
| 22 | |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 23 | #include <GLES2/gl2.h> |
| 24 | #include <GLES2/gl2ext.h> |
| 25 | |
Jesse Hall | 9626f82 | 2014-05-19 20:57:49 -0700 | [diff] [blame] | 26 | #include <jni.h> |
Steven Moreland | 2279b25 | 2017-07-19 09:50:45 -0700 | [diff] [blame] | 27 | #include <nativehelper/JNIHelp.h> |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 28 | #include <android_runtime/AndroidRuntime.h> |
| 29 | #include <utils/misc.h> |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 30 | #include <assert.h> |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 31 | |
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 | 560814f | 2009-11-19 16:34:55 +0800 | [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 | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 68 | { |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 69 | } |
| 70 | |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [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 | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 73 | { |
| 74 | jint position; |
| 75 | jint limit; |
| 76 | jint elementSizeShift; |
| 77 | jlong pointer; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [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 | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 80 | *remaining = (limit - position) << elementSizeShift; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [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 | 560814f | 2009-11-19 16:34:55 +0800 | [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 | 560814f | 2009-11-19 16:34:55 +0800 | [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 | 560814f | 2009-11-19 16:34:55 +0800 | [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 | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 207 | } |
| 208 | |
| 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 | 560814f | 2009-11-19 16:34:55 +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 | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 223 | } |
| 224 | |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 225 | // -------------------------------------------------------------------------- |
| 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; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 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 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 420 | } |
| 421 | |
| 422 | // -------------------------------------------------------------------------- |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 423 | /* void glActiveTexture ( GLenum texture ) */ |
| 424 | static void |
| 425 | android_glActiveTexture__I |
| 426 | (JNIEnv *_env, jobject _this, jint texture) { |
| 427 | glActiveTexture( |
| 428 | (GLenum)texture |
| 429 | ); |
| 430 | } |
| 431 | |
| 432 | /* void glAttachShader ( GLuint program, GLuint shader ) */ |
| 433 | static void |
| 434 | android_glAttachShader__II |
| 435 | (JNIEnv *_env, jobject _this, jint program, jint shader) { |
| 436 | glAttachShader( |
| 437 | (GLuint)program, |
| 438 | (GLuint)shader |
| 439 | ); |
| 440 | } |
| 441 | |
| 442 | /* void glBindAttribLocation ( GLuint program, GLuint index, const char *name ) */ |
| 443 | static void |
| 444 | android_glBindAttribLocation__IILjava_lang_String_2 |
| 445 | (JNIEnv *_env, jobject _this, jint program, jint index, jstring name) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 446 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 447 | const char * _exceptionType = NULL; |
| 448 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 449 | const char* _nativename = 0; |
| 450 | |
| 451 | if (!name) { |
Elliott Hughes | 428d3fc | 2013-09-24 17:15:41 -0700 | [diff] [blame] | 452 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 453 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 454 | _exceptionMessage = "name == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 455 | goto exit; |
| 456 | } |
| 457 | _nativename = _env->GetStringUTFChars(name, 0); |
| 458 | |
| 459 | glBindAttribLocation( |
| 460 | (GLuint)program, |
| 461 | (GLuint)index, |
| 462 | (char *)_nativename |
| 463 | ); |
| 464 | |
| 465 | exit: |
| 466 | if (_nativename) { |
| 467 | _env->ReleaseStringUTFChars(name, _nativename); |
| 468 | } |
| 469 | |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 470 | if (_exception) { |
| 471 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 472 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 473 | } |
| 474 | |
| 475 | /* void glBindBuffer ( GLenum target, GLuint buffer ) */ |
| 476 | static void |
| 477 | android_glBindBuffer__II |
| 478 | (JNIEnv *_env, jobject _this, jint target, jint buffer) { |
| 479 | glBindBuffer( |
| 480 | (GLenum)target, |
| 481 | (GLuint)buffer |
| 482 | ); |
| 483 | } |
| 484 | |
| 485 | /* void glBindFramebuffer ( GLenum target, GLuint framebuffer ) */ |
| 486 | static void |
| 487 | android_glBindFramebuffer__II |
| 488 | (JNIEnv *_env, jobject _this, jint target, jint framebuffer) { |
| 489 | glBindFramebuffer( |
| 490 | (GLenum)target, |
| 491 | (GLuint)framebuffer |
| 492 | ); |
| 493 | } |
| 494 | |
| 495 | /* void glBindRenderbuffer ( GLenum target, GLuint renderbuffer ) */ |
| 496 | static void |
| 497 | android_glBindRenderbuffer__II |
| 498 | (JNIEnv *_env, jobject _this, jint target, jint renderbuffer) { |
| 499 | glBindRenderbuffer( |
| 500 | (GLenum)target, |
| 501 | (GLuint)renderbuffer |
| 502 | ); |
| 503 | } |
| 504 | |
| 505 | /* void glBindTexture ( GLenum target, GLuint texture ) */ |
| 506 | static void |
| 507 | android_glBindTexture__II |
| 508 | (JNIEnv *_env, jobject _this, jint target, jint texture) { |
| 509 | glBindTexture( |
| 510 | (GLenum)target, |
| 511 | (GLuint)texture |
| 512 | ); |
| 513 | } |
| 514 | |
| 515 | /* void glBlendColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */ |
| 516 | static void |
| 517 | android_glBlendColor__FFFF |
| 518 | (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) { |
| 519 | glBlendColor( |
| 520 | (GLclampf)red, |
| 521 | (GLclampf)green, |
| 522 | (GLclampf)blue, |
| 523 | (GLclampf)alpha |
| 524 | ); |
| 525 | } |
| 526 | |
| 527 | /* void glBlendEquation ( GLenum mode ) */ |
| 528 | static void |
| 529 | android_glBlendEquation__I |
| 530 | (JNIEnv *_env, jobject _this, jint mode) { |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 531 | glBlendEquation( |
| 532 | (GLenum)mode |
| 533 | ); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 534 | } |
| 535 | |
| 536 | /* void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha ) */ |
| 537 | static void |
| 538 | android_glBlendEquationSeparate__II |
| 539 | (JNIEnv *_env, jobject _this, jint modeRGB, jint modeAlpha) { |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 540 | glBlendEquationSeparate( |
| 541 | (GLenum)modeRGB, |
| 542 | (GLenum)modeAlpha |
| 543 | ); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 544 | } |
| 545 | |
| 546 | /* void glBlendFunc ( GLenum sfactor, GLenum dfactor ) */ |
| 547 | static void |
| 548 | android_glBlendFunc__II |
| 549 | (JNIEnv *_env, jobject _this, jint sfactor, jint dfactor) { |
| 550 | glBlendFunc( |
| 551 | (GLenum)sfactor, |
| 552 | (GLenum)dfactor |
| 553 | ); |
| 554 | } |
| 555 | |
| 556 | /* void glBlendFuncSeparate ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) */ |
| 557 | static void |
| 558 | android_glBlendFuncSeparate__IIII |
| 559 | (JNIEnv *_env, jobject _this, jint srcRGB, jint dstRGB, jint srcAlpha, jint dstAlpha) { |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 560 | glBlendFuncSeparate( |
| 561 | (GLenum)srcRGB, |
| 562 | (GLenum)dstRGB, |
| 563 | (GLenum)srcAlpha, |
| 564 | (GLenum)dstAlpha |
| 565 | ); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 566 | } |
| 567 | |
| 568 | /* void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) */ |
| 569 | static void |
| 570 | android_glBufferData__IILjava_nio_Buffer_2I |
| 571 | (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] | 572 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 573 | const char * _exceptionType = NULL; |
| 574 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 575 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 576 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 577 | jint _remaining; |
| 578 | GLvoid *data = (GLvoid *) 0; |
| 579 | |
| 580 | if (data_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 581 | data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 582 | if (_remaining < size) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 583 | _exception = 1; |
| 584 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 585 | _exceptionMessage = "remaining() < size < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 586 | goto exit; |
| 587 | } |
| 588 | } |
Thomas Tafertshofer | 37c9b49 | 2012-07-23 16:56:04 -0700 | [diff] [blame] | 589 | if (data_buf && data == NULL) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 590 | char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 591 | data = (GLvoid *) (_dataBase + _bufferOffset); |
| 592 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 593 | glBufferData( |
| 594 | (GLenum)target, |
| 595 | (GLsizeiptr)size, |
| 596 | (GLvoid *)data, |
| 597 | (GLenum)usage |
| 598 | ); |
| 599 | |
| 600 | exit: |
| 601 | if (_array) { |
| 602 | releasePointer(_env, _array, data, JNI_FALSE); |
| 603 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 604 | if (_exception) { |
| 605 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 606 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 607 | } |
| 608 | |
| 609 | /* void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) */ |
| 610 | static void |
| 611 | android_glBufferSubData__IIILjava_nio_Buffer_2 |
| 612 | (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] | 613 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 614 | const char * _exceptionType = NULL; |
| 615 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 616 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 617 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 618 | jint _remaining; |
| 619 | GLvoid *data = (GLvoid *) 0; |
| 620 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 621 | if (!data_buf) { |
| 622 | _exception = 1; |
| 623 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 624 | _exceptionMessage = "data == null"; |
| 625 | goto exit; |
| 626 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 627 | data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 628 | if (_remaining < size) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 629 | _exception = 1; |
| 630 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 631 | _exceptionMessage = "remaining() < size < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 632 | goto exit; |
| 633 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 634 | if (data == NULL) { |
| 635 | char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 636 | data = (GLvoid *) (_dataBase + _bufferOffset); |
| 637 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 638 | glBufferSubData( |
| 639 | (GLenum)target, |
| 640 | (GLintptr)offset, |
| 641 | (GLsizeiptr)size, |
| 642 | (GLvoid *)data |
| 643 | ); |
| 644 | |
| 645 | exit: |
| 646 | if (_array) { |
| 647 | releasePointer(_env, _array, data, JNI_FALSE); |
| 648 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 649 | if (_exception) { |
| 650 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 651 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 652 | } |
| 653 | |
| 654 | /* GLenum glCheckFramebufferStatus ( GLenum target ) */ |
| 655 | static jint |
| 656 | android_glCheckFramebufferStatus__I |
| 657 | (JNIEnv *_env, jobject _this, jint target) { |
| 658 | GLenum _returnValue; |
| 659 | _returnValue = glCheckFramebufferStatus( |
| 660 | (GLenum)target |
| 661 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 662 | return (jint)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 663 | } |
| 664 | |
| 665 | /* void glClear ( GLbitfield mask ) */ |
| 666 | static void |
| 667 | android_glClear__I |
| 668 | (JNIEnv *_env, jobject _this, jint mask) { |
| 669 | glClear( |
| 670 | (GLbitfield)mask |
| 671 | ); |
| 672 | } |
| 673 | |
| 674 | /* void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) */ |
| 675 | static void |
| 676 | android_glClearColor__FFFF |
| 677 | (JNIEnv *_env, jobject _this, jfloat red, jfloat green, jfloat blue, jfloat alpha) { |
| 678 | glClearColor( |
| 679 | (GLclampf)red, |
| 680 | (GLclampf)green, |
| 681 | (GLclampf)blue, |
| 682 | (GLclampf)alpha |
| 683 | ); |
| 684 | } |
| 685 | |
| 686 | /* void glClearDepthf ( GLclampf depth ) */ |
| 687 | static void |
| 688 | android_glClearDepthf__F |
| 689 | (JNIEnv *_env, jobject _this, jfloat depth) { |
| 690 | glClearDepthf( |
| 691 | (GLclampf)depth |
| 692 | ); |
| 693 | } |
| 694 | |
| 695 | /* void glClearStencil ( GLint s ) */ |
| 696 | static void |
| 697 | android_glClearStencil__I |
| 698 | (JNIEnv *_env, jobject _this, jint s) { |
| 699 | glClearStencil( |
| 700 | (GLint)s |
| 701 | ); |
| 702 | } |
| 703 | |
| 704 | /* void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) */ |
| 705 | static void |
| 706 | android_glColorMask__ZZZZ |
| 707 | (JNIEnv *_env, jobject _this, jboolean red, jboolean green, jboolean blue, jboolean alpha) { |
| 708 | glColorMask( |
| 709 | (GLboolean)red, |
| 710 | (GLboolean)green, |
| 711 | (GLboolean)blue, |
| 712 | (GLboolean)alpha |
| 713 | ); |
| 714 | } |
| 715 | |
| 716 | /* void glCompileShader ( GLuint shader ) */ |
| 717 | static void |
| 718 | android_glCompileShader__I |
| 719 | (JNIEnv *_env, jobject _this, jint shader) { |
| 720 | glCompileShader( |
| 721 | (GLuint)shader |
| 722 | ); |
| 723 | } |
| 724 | |
| 725 | /* void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) */ |
| 726 | static void |
| 727 | android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 |
| 728 | (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint imageSize, jobject data_buf) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 729 | jint _exception = 0; |
| 730 | const char * _exceptionType = NULL; |
| 731 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 732 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 733 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 734 | jint _remaining; |
| 735 | GLvoid *data = (GLvoid *) 0; |
| 736 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 737 | if (!data_buf) { |
| 738 | _exception = 1; |
| 739 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 740 | _exceptionMessage = "data == null"; |
| 741 | goto exit; |
| 742 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 743 | data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 744 | if (data == NULL) { |
| 745 | char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 746 | data = (GLvoid *) (_dataBase + _bufferOffset); |
| 747 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 748 | glCompressedTexImage2D( |
| 749 | (GLenum)target, |
| 750 | (GLint)level, |
| 751 | (GLenum)internalformat, |
| 752 | (GLsizei)width, |
| 753 | (GLsizei)height, |
| 754 | (GLint)border, |
| 755 | (GLsizei)imageSize, |
| 756 | (GLvoid *)data |
| 757 | ); |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 758 | |
| 759 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 760 | if (_array) { |
| 761 | releasePointer(_env, _array, data, JNI_FALSE); |
| 762 | } |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 763 | if (_exception) { |
| 764 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 765 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 766 | } |
| 767 | |
| 768 | /* void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) */ |
| 769 | static void |
| 770 | android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 |
| 771 | (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint imageSize, jobject data_buf) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 772 | jint _exception = 0; |
| 773 | const char * _exceptionType = NULL; |
| 774 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 775 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 776 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 777 | jint _remaining; |
| 778 | GLvoid *data = (GLvoid *) 0; |
| 779 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 780 | if (!data_buf) { |
| 781 | _exception = 1; |
| 782 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 783 | _exceptionMessage = "data == null"; |
| 784 | goto exit; |
| 785 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 786 | data = (GLvoid *)getPointer(_env, data_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 787 | if (data == NULL) { |
| 788 | char * _dataBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 789 | data = (GLvoid *) (_dataBase + _bufferOffset); |
| 790 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 791 | glCompressedTexSubImage2D( |
| 792 | (GLenum)target, |
| 793 | (GLint)level, |
| 794 | (GLint)xoffset, |
| 795 | (GLint)yoffset, |
| 796 | (GLsizei)width, |
| 797 | (GLsizei)height, |
| 798 | (GLenum)format, |
| 799 | (GLsizei)imageSize, |
| 800 | (GLvoid *)data |
| 801 | ); |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 802 | |
| 803 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 804 | if (_array) { |
| 805 | releasePointer(_env, _array, data, JNI_FALSE); |
| 806 | } |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 807 | if (_exception) { |
| 808 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 809 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 810 | } |
| 811 | |
| 812 | /* void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) */ |
| 813 | static void |
| 814 | android_glCopyTexImage2D__IIIIIIII |
| 815 | (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint x, jint y, jint width, jint height, jint border) { |
| 816 | glCopyTexImage2D( |
| 817 | (GLenum)target, |
| 818 | (GLint)level, |
| 819 | (GLenum)internalformat, |
| 820 | (GLint)x, |
| 821 | (GLint)y, |
| 822 | (GLsizei)width, |
| 823 | (GLsizei)height, |
| 824 | (GLint)border |
| 825 | ); |
| 826 | } |
| 827 | |
| 828 | /* void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) */ |
| 829 | static void |
| 830 | android_glCopyTexSubImage2D__IIIIIIII |
| 831 | (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint x, jint y, jint width, jint height) { |
| 832 | glCopyTexSubImage2D( |
| 833 | (GLenum)target, |
| 834 | (GLint)level, |
| 835 | (GLint)xoffset, |
| 836 | (GLint)yoffset, |
| 837 | (GLint)x, |
| 838 | (GLint)y, |
| 839 | (GLsizei)width, |
| 840 | (GLsizei)height |
| 841 | ); |
| 842 | } |
| 843 | |
| 844 | /* GLuint glCreateProgram ( void ) */ |
| 845 | static jint |
| 846 | android_glCreateProgram__ |
| 847 | (JNIEnv *_env, jobject _this) { |
| 848 | GLuint _returnValue; |
| 849 | _returnValue = glCreateProgram(); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 850 | return (jint)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 851 | } |
| 852 | |
| 853 | /* GLuint glCreateShader ( GLenum type ) */ |
| 854 | static jint |
| 855 | android_glCreateShader__I |
| 856 | (JNIEnv *_env, jobject _this, jint type) { |
| 857 | GLuint _returnValue; |
| 858 | _returnValue = glCreateShader( |
| 859 | (GLenum)type |
| 860 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 861 | return (jint)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 862 | } |
| 863 | |
| 864 | /* void glCullFace ( GLenum mode ) */ |
| 865 | static void |
| 866 | android_glCullFace__I |
| 867 | (JNIEnv *_env, jobject _this, jint mode) { |
| 868 | glCullFace( |
| 869 | (GLenum)mode |
| 870 | ); |
| 871 | } |
| 872 | |
| 873 | /* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */ |
| 874 | static void |
| 875 | android_glDeleteBuffers__I_3II |
| 876 | (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 877 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 878 | const char * _exceptionType = NULL; |
| 879 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 880 | GLuint *buffers_base = (GLuint *) 0; |
| 881 | jint _remaining; |
| 882 | GLuint *buffers = (GLuint *) 0; |
| 883 | |
| 884 | if (!buffers_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 885 | _exception = 1; |
| 886 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 887 | _exceptionMessage = "buffers == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 888 | goto exit; |
| 889 | } |
| 890 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 891 | _exception = 1; |
| 892 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 893 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 894 | goto exit; |
| 895 | } |
| 896 | _remaining = _env->GetArrayLength(buffers_ref) - offset; |
| 897 | if (_remaining < n) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 898 | _exception = 1; |
| 899 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 900 | _exceptionMessage = "length - offset < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 901 | goto exit; |
| 902 | } |
| 903 | buffers_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 904 | _env->GetIntArrayElements(buffers_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 905 | buffers = buffers_base + offset; |
| 906 | |
| 907 | glDeleteBuffers( |
| 908 | (GLsizei)n, |
| 909 | (GLuint *)buffers |
| 910 | ); |
| 911 | |
| 912 | exit: |
| 913 | if (buffers_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 914 | _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 915 | JNI_ABORT); |
| 916 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 917 | if (_exception) { |
| 918 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 919 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 920 | } |
| 921 | |
| 922 | /* void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) */ |
| 923 | static void |
| 924 | android_glDeleteBuffers__ILjava_nio_IntBuffer_2 |
| 925 | (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 926 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 927 | const char * _exceptionType = NULL; |
| 928 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 929 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 930 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 931 | jint _remaining; |
| 932 | GLuint *buffers = (GLuint *) 0; |
| 933 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 934 | if (!buffers_buf) { |
| 935 | _exception = 1; |
| 936 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 937 | _exceptionMessage = "buffers == null"; |
| 938 | goto exit; |
| 939 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 940 | buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 941 | if (_remaining < n) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 942 | _exception = 1; |
| 943 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 944 | _exceptionMessage = "remaining() < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 945 | goto exit; |
| 946 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 947 | if (buffers == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 948 | char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 949 | buffers = (GLuint *) (_buffersBase + _bufferOffset); |
| 950 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 951 | glDeleteBuffers( |
| 952 | (GLsizei)n, |
| 953 | (GLuint *)buffers |
| 954 | ); |
| 955 | |
| 956 | exit: |
| 957 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 958 | _env->ReleaseIntArrayElements(_array, (jint*)buffers, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 959 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 960 | if (_exception) { |
| 961 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 962 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 963 | } |
| 964 | |
| 965 | /* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */ |
| 966 | static void |
| 967 | android_glDeleteFramebuffers__I_3II |
| 968 | (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 969 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 970 | const char * _exceptionType = NULL; |
| 971 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 972 | GLuint *framebuffers_base = (GLuint *) 0; |
| 973 | jint _remaining; |
| 974 | GLuint *framebuffers = (GLuint *) 0; |
| 975 | |
| 976 | if (!framebuffers_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 977 | _exception = 1; |
| 978 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 979 | _exceptionMessage = "framebuffers == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 980 | goto exit; |
| 981 | } |
| 982 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 983 | _exception = 1; |
| 984 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 985 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 986 | goto exit; |
| 987 | } |
| 988 | _remaining = _env->GetArrayLength(framebuffers_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 989 | if (_remaining < n) { |
| 990 | _exception = 1; |
| 991 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 992 | _exceptionMessage = "length - offset < n < needed"; |
| 993 | goto exit; |
| 994 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 995 | framebuffers_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 996 | _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 997 | framebuffers = framebuffers_base + offset; |
| 998 | |
| 999 | glDeleteFramebuffers( |
| 1000 | (GLsizei)n, |
| 1001 | (GLuint *)framebuffers |
| 1002 | ); |
| 1003 | |
| 1004 | exit: |
| 1005 | if (framebuffers_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1006 | _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1007 | JNI_ABORT); |
| 1008 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1009 | if (_exception) { |
| 1010 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1011 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1012 | } |
| 1013 | |
| 1014 | /* void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) */ |
| 1015 | static void |
| 1016 | android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2 |
| 1017 | (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1018 | jint _exception = 0; |
| 1019 | const char * _exceptionType = NULL; |
| 1020 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1021 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1022 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1023 | jint _remaining; |
| 1024 | GLuint *framebuffers = (GLuint *) 0; |
| 1025 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1026 | if (!framebuffers_buf) { |
| 1027 | _exception = 1; |
| 1028 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1029 | _exceptionMessage = "framebuffers == null"; |
| 1030 | goto exit; |
| 1031 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1032 | framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1033 | if (_remaining < n) { |
| 1034 | _exception = 1; |
| 1035 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1036 | _exceptionMessage = "remaining() < n < needed"; |
| 1037 | goto exit; |
| 1038 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1039 | if (framebuffers == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1040 | char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1041 | framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset); |
| 1042 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1043 | glDeleteFramebuffers( |
| 1044 | (GLsizei)n, |
| 1045 | (GLuint *)framebuffers |
| 1046 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1047 | |
| 1048 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1049 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1050 | _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1051 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1052 | if (_exception) { |
| 1053 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1054 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1055 | } |
| 1056 | |
| 1057 | /* void glDeleteProgram ( GLuint program ) */ |
| 1058 | static void |
| 1059 | android_glDeleteProgram__I |
| 1060 | (JNIEnv *_env, jobject _this, jint program) { |
| 1061 | glDeleteProgram( |
| 1062 | (GLuint)program |
| 1063 | ); |
| 1064 | } |
| 1065 | |
| 1066 | /* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */ |
| 1067 | static void |
| 1068 | android_glDeleteRenderbuffers__I_3II |
| 1069 | (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1070 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1071 | const char * _exceptionType = NULL; |
| 1072 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1073 | GLuint *renderbuffers_base = (GLuint *) 0; |
| 1074 | jint _remaining; |
| 1075 | GLuint *renderbuffers = (GLuint *) 0; |
| 1076 | |
| 1077 | if (!renderbuffers_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1078 | _exception = 1; |
| 1079 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1080 | _exceptionMessage = "renderbuffers == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1081 | goto exit; |
| 1082 | } |
| 1083 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1084 | _exception = 1; |
| 1085 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1086 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1087 | goto exit; |
| 1088 | } |
| 1089 | _remaining = _env->GetArrayLength(renderbuffers_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1090 | if (_remaining < n) { |
| 1091 | _exception = 1; |
| 1092 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1093 | _exceptionMessage = "length - offset < n < needed"; |
| 1094 | goto exit; |
| 1095 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1096 | renderbuffers_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1097 | _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1098 | renderbuffers = renderbuffers_base + offset; |
| 1099 | |
| 1100 | glDeleteRenderbuffers( |
| 1101 | (GLsizei)n, |
| 1102 | (GLuint *)renderbuffers |
| 1103 | ); |
| 1104 | |
| 1105 | exit: |
| 1106 | if (renderbuffers_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1107 | _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1108 | JNI_ABORT); |
| 1109 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1110 | if (_exception) { |
| 1111 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1112 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1113 | } |
| 1114 | |
| 1115 | /* void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) */ |
| 1116 | static void |
| 1117 | android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2 |
| 1118 | (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1119 | jint _exception = 0; |
| 1120 | const char * _exceptionType = NULL; |
| 1121 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1122 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1123 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1124 | jint _remaining; |
| 1125 | GLuint *renderbuffers = (GLuint *) 0; |
| 1126 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1127 | if (!renderbuffers_buf) { |
| 1128 | _exception = 1; |
| 1129 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1130 | _exceptionMessage = "renderbuffers == null"; |
| 1131 | goto exit; |
| 1132 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1133 | renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1134 | if (_remaining < n) { |
| 1135 | _exception = 1; |
| 1136 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1137 | _exceptionMessage = "remaining() < n < needed"; |
| 1138 | goto exit; |
| 1139 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1140 | if (renderbuffers == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1141 | char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1142 | renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset); |
| 1143 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1144 | glDeleteRenderbuffers( |
| 1145 | (GLsizei)n, |
| 1146 | (GLuint *)renderbuffers |
| 1147 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1148 | |
| 1149 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1150 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1151 | _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1152 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1153 | if (_exception) { |
| 1154 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1155 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1156 | } |
| 1157 | |
| 1158 | /* void glDeleteShader ( GLuint shader ) */ |
| 1159 | static void |
| 1160 | android_glDeleteShader__I |
| 1161 | (JNIEnv *_env, jobject _this, jint shader) { |
| 1162 | glDeleteShader( |
| 1163 | (GLuint)shader |
| 1164 | ); |
| 1165 | } |
| 1166 | |
| 1167 | /* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */ |
| 1168 | static void |
| 1169 | android_glDeleteTextures__I_3II |
| 1170 | (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1171 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1172 | const char * _exceptionType = NULL; |
| 1173 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1174 | GLuint *textures_base = (GLuint *) 0; |
| 1175 | jint _remaining; |
| 1176 | GLuint *textures = (GLuint *) 0; |
| 1177 | |
| 1178 | if (!textures_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1179 | _exception = 1; |
| 1180 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1181 | _exceptionMessage = "textures == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1182 | goto exit; |
| 1183 | } |
| 1184 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1185 | _exception = 1; |
| 1186 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1187 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1188 | goto exit; |
| 1189 | } |
| 1190 | _remaining = _env->GetArrayLength(textures_ref) - offset; |
| 1191 | if (_remaining < n) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1192 | _exception = 1; |
| 1193 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1194 | _exceptionMessage = "length - offset < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1195 | goto exit; |
| 1196 | } |
| 1197 | textures_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1198 | _env->GetIntArrayElements(textures_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1199 | textures = textures_base + offset; |
| 1200 | |
| 1201 | glDeleteTextures( |
| 1202 | (GLsizei)n, |
| 1203 | (GLuint *)textures |
| 1204 | ); |
| 1205 | |
| 1206 | exit: |
| 1207 | if (textures_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1208 | _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1209 | JNI_ABORT); |
| 1210 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1211 | if (_exception) { |
| 1212 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1213 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1214 | } |
| 1215 | |
| 1216 | /* void glDeleteTextures ( GLsizei n, const GLuint *textures ) */ |
| 1217 | static void |
| 1218 | android_glDeleteTextures__ILjava_nio_IntBuffer_2 |
| 1219 | (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1220 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1221 | const char * _exceptionType = NULL; |
| 1222 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1223 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1224 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1225 | jint _remaining; |
| 1226 | GLuint *textures = (GLuint *) 0; |
| 1227 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1228 | if (!textures_buf) { |
| 1229 | _exception = 1; |
| 1230 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1231 | _exceptionMessage = "textures == null"; |
| 1232 | goto exit; |
| 1233 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1234 | textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1235 | if (_remaining < n) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1236 | _exception = 1; |
| 1237 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1238 | _exceptionMessage = "remaining() < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1239 | goto exit; |
| 1240 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1241 | if (textures == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1242 | char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1243 | textures = (GLuint *) (_texturesBase + _bufferOffset); |
| 1244 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1245 | glDeleteTextures( |
| 1246 | (GLsizei)n, |
| 1247 | (GLuint *)textures |
| 1248 | ); |
| 1249 | |
| 1250 | exit: |
| 1251 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1252 | _env->ReleaseIntArrayElements(_array, (jint*)textures, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1253 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1254 | if (_exception) { |
| 1255 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1256 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1257 | } |
| 1258 | |
| 1259 | /* void glDepthFunc ( GLenum func ) */ |
| 1260 | static void |
| 1261 | android_glDepthFunc__I |
| 1262 | (JNIEnv *_env, jobject _this, jint func) { |
| 1263 | glDepthFunc( |
| 1264 | (GLenum)func |
| 1265 | ); |
| 1266 | } |
| 1267 | |
| 1268 | /* void glDepthMask ( GLboolean flag ) */ |
| 1269 | static void |
| 1270 | android_glDepthMask__Z |
| 1271 | (JNIEnv *_env, jobject _this, jboolean flag) { |
| 1272 | glDepthMask( |
| 1273 | (GLboolean)flag |
| 1274 | ); |
| 1275 | } |
| 1276 | |
| 1277 | /* void glDepthRangef ( GLclampf zNear, GLclampf zFar ) */ |
| 1278 | static void |
| 1279 | android_glDepthRangef__FF |
| 1280 | (JNIEnv *_env, jobject _this, jfloat zNear, jfloat zFar) { |
| 1281 | glDepthRangef( |
| 1282 | (GLclampf)zNear, |
| 1283 | (GLclampf)zFar |
| 1284 | ); |
| 1285 | } |
| 1286 | |
| 1287 | /* void glDetachShader ( GLuint program, GLuint shader ) */ |
| 1288 | static void |
| 1289 | android_glDetachShader__II |
| 1290 | (JNIEnv *_env, jobject _this, jint program, jint shader) { |
| 1291 | glDetachShader( |
| 1292 | (GLuint)program, |
| 1293 | (GLuint)shader |
| 1294 | ); |
| 1295 | } |
| 1296 | |
| 1297 | /* void glDisable ( GLenum cap ) */ |
| 1298 | static void |
| 1299 | android_glDisable__I |
| 1300 | (JNIEnv *_env, jobject _this, jint cap) { |
| 1301 | glDisable( |
| 1302 | (GLenum)cap |
| 1303 | ); |
| 1304 | } |
| 1305 | |
| 1306 | /* void glDisableVertexAttribArray ( GLuint index ) */ |
| 1307 | static void |
| 1308 | android_glDisableVertexAttribArray__I |
| 1309 | (JNIEnv *_env, jobject _this, jint index) { |
| 1310 | glDisableVertexAttribArray( |
| 1311 | (GLuint)index |
| 1312 | ); |
| 1313 | } |
| 1314 | |
| 1315 | /* void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) */ |
| 1316 | static void |
| 1317 | android_glDrawArrays__III |
| 1318 | (JNIEnv *_env, jobject _this, jint mode, jint first, jint count) { |
| 1319 | glDrawArrays( |
| 1320 | (GLenum)mode, |
| 1321 | (GLint)first, |
| 1322 | (GLsizei)count |
| 1323 | ); |
| 1324 | } |
| 1325 | |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 1326 | /* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) */ |
| 1327 | static void |
| 1328 | android_glDrawElements__IIII |
| 1329 | (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1330 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1331 | const char * _exceptionType = NULL; |
| 1332 | const char * _exceptionMessage = NULL; |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 1333 | glDrawElements( |
| 1334 | (GLenum)mode, |
| 1335 | (GLsizei)count, |
| 1336 | (GLenum)type, |
Ashok Bhat | 01c26ea | 2014-02-24 09:49:07 +0000 | [diff] [blame] | 1337 | reinterpret_cast<GLvoid *>(offset) |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 1338 | ); |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1339 | if (_exception) { |
| 1340 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1341 | } |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 1342 | } |
| 1343 | |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1344 | /* void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) */ |
| 1345 | static void |
| 1346 | android_glDrawElements__IIILjava_nio_Buffer_2 |
| 1347 | (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1348 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1349 | const char * _exceptionType = NULL; |
| 1350 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1351 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1352 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1353 | jint _remaining; |
| 1354 | GLvoid *indices = (GLvoid *) 0; |
| 1355 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1356 | if (!indices_buf) { |
| 1357 | _exception = 1; |
| 1358 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1359 | _exceptionMessage = "indices == null"; |
| 1360 | goto exit; |
| 1361 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1362 | indices = (GLvoid *)getPointer(_env, indices_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1363 | if (_remaining < count) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1364 | _exception = 1; |
| 1365 | _exceptionType = "java/lang/ArrayIndexOutOfBoundsException"; |
| 1366 | _exceptionMessage = "remaining() < count < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1367 | goto exit; |
| 1368 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1369 | if (indices == NULL) { |
| 1370 | char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 1371 | indices = (GLvoid *) (_indicesBase + _bufferOffset); |
| 1372 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1373 | glDrawElements( |
| 1374 | (GLenum)mode, |
| 1375 | (GLsizei)count, |
| 1376 | (GLenum)type, |
| 1377 | (GLvoid *)indices |
| 1378 | ); |
| 1379 | |
| 1380 | exit: |
| 1381 | if (_array) { |
| 1382 | releasePointer(_env, _array, indices, JNI_FALSE); |
| 1383 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1384 | if (_exception) { |
| 1385 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1386 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1387 | } |
| 1388 | |
| 1389 | /* void glEnable ( GLenum cap ) */ |
| 1390 | static void |
| 1391 | android_glEnable__I |
| 1392 | (JNIEnv *_env, jobject _this, jint cap) { |
| 1393 | glEnable( |
| 1394 | (GLenum)cap |
| 1395 | ); |
| 1396 | } |
| 1397 | |
| 1398 | /* void glEnableVertexAttribArray ( GLuint index ) */ |
| 1399 | static void |
| 1400 | android_glEnableVertexAttribArray__I |
| 1401 | (JNIEnv *_env, jobject _this, jint index) { |
| 1402 | glEnableVertexAttribArray( |
| 1403 | (GLuint)index |
| 1404 | ); |
| 1405 | } |
| 1406 | |
| 1407 | /* void glFinish ( void ) */ |
| 1408 | static void |
| 1409 | android_glFinish__ |
| 1410 | (JNIEnv *_env, jobject _this) { |
| 1411 | glFinish(); |
| 1412 | } |
| 1413 | |
| 1414 | /* void glFlush ( void ) */ |
| 1415 | static void |
| 1416 | android_glFlush__ |
| 1417 | (JNIEnv *_env, jobject _this) { |
| 1418 | glFlush(); |
| 1419 | } |
| 1420 | |
| 1421 | /* void glFramebufferRenderbuffer ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) */ |
| 1422 | static void |
| 1423 | android_glFramebufferRenderbuffer__IIII |
| 1424 | (JNIEnv *_env, jobject _this, jint target, jint attachment, jint renderbuffertarget, jint renderbuffer) { |
| 1425 | glFramebufferRenderbuffer( |
| 1426 | (GLenum)target, |
| 1427 | (GLenum)attachment, |
| 1428 | (GLenum)renderbuffertarget, |
| 1429 | (GLuint)renderbuffer |
| 1430 | ); |
| 1431 | } |
| 1432 | |
| 1433 | /* void glFramebufferTexture2D ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) */ |
| 1434 | static void |
| 1435 | android_glFramebufferTexture2D__IIIII |
| 1436 | (JNIEnv *_env, jobject _this, jint target, jint attachment, jint textarget, jint texture, jint level) { |
| 1437 | glFramebufferTexture2D( |
| 1438 | (GLenum)target, |
| 1439 | (GLenum)attachment, |
| 1440 | (GLenum)textarget, |
| 1441 | (GLuint)texture, |
| 1442 | (GLint)level |
| 1443 | ); |
| 1444 | } |
| 1445 | |
| 1446 | /* void glFrontFace ( GLenum mode ) */ |
| 1447 | static void |
| 1448 | android_glFrontFace__I |
| 1449 | (JNIEnv *_env, jobject _this, jint mode) { |
| 1450 | glFrontFace( |
| 1451 | (GLenum)mode |
| 1452 | ); |
| 1453 | } |
| 1454 | |
| 1455 | /* void glGenBuffers ( GLsizei n, GLuint *buffers ) */ |
| 1456 | static void |
| 1457 | android_glGenBuffers__I_3II |
| 1458 | (JNIEnv *_env, jobject _this, jint n, jintArray buffers_ref, jint offset) { |
| 1459 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1460 | const char * _exceptionType = NULL; |
| 1461 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1462 | GLuint *buffers_base = (GLuint *) 0; |
| 1463 | jint _remaining; |
| 1464 | GLuint *buffers = (GLuint *) 0; |
| 1465 | |
| 1466 | if (!buffers_ref) { |
| 1467 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1468 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1469 | _exceptionMessage = "buffers == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1470 | goto exit; |
| 1471 | } |
| 1472 | if (offset < 0) { |
| 1473 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1474 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1475 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1476 | goto exit; |
| 1477 | } |
| 1478 | _remaining = _env->GetArrayLength(buffers_ref) - offset; |
| 1479 | if (_remaining < n) { |
| 1480 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1481 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1482 | _exceptionMessage = "length - offset < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1483 | goto exit; |
| 1484 | } |
| 1485 | buffers_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1486 | _env->GetIntArrayElements(buffers_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1487 | buffers = buffers_base + offset; |
| 1488 | |
| 1489 | glGenBuffers( |
| 1490 | (GLsizei)n, |
| 1491 | (GLuint *)buffers |
| 1492 | ); |
| 1493 | |
| 1494 | exit: |
| 1495 | if (buffers_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1496 | _env->ReleaseIntArrayElements(buffers_ref, (jint*)buffers_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1497 | _exception ? JNI_ABORT: 0); |
| 1498 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1499 | if (_exception) { |
| 1500 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1501 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1502 | } |
| 1503 | |
| 1504 | /* void glGenBuffers ( GLsizei n, GLuint *buffers ) */ |
| 1505 | static void |
| 1506 | android_glGenBuffers__ILjava_nio_IntBuffer_2 |
| 1507 | (JNIEnv *_env, jobject _this, jint n, jobject buffers_buf) { |
| 1508 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1509 | const char * _exceptionType = NULL; |
| 1510 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1511 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1512 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1513 | jint _remaining; |
| 1514 | GLuint *buffers = (GLuint *) 0; |
| 1515 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1516 | if (!buffers_buf) { |
| 1517 | _exception = 1; |
| 1518 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1519 | _exceptionMessage = "buffers == null"; |
| 1520 | goto exit; |
| 1521 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1522 | buffers = (GLuint *)getPointer(_env, buffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1523 | if (_remaining < n) { |
| 1524 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1525 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1526 | _exceptionMessage = "remaining() < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1527 | goto exit; |
| 1528 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1529 | if (buffers == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1530 | char * _buffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1531 | buffers = (GLuint *) (_buffersBase + _bufferOffset); |
| 1532 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1533 | glGenBuffers( |
| 1534 | (GLsizei)n, |
| 1535 | (GLuint *)buffers |
| 1536 | ); |
| 1537 | |
| 1538 | exit: |
| 1539 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1540 | _env->ReleaseIntArrayElements(_array, (jint*)buffers, _exception ? JNI_ABORT : 0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1541 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1542 | if (_exception) { |
| 1543 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1544 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1545 | } |
| 1546 | |
| 1547 | /* void glGenerateMipmap ( GLenum target ) */ |
| 1548 | static void |
| 1549 | android_glGenerateMipmap__I |
| 1550 | (JNIEnv *_env, jobject _this, jint target) { |
| 1551 | glGenerateMipmap( |
| 1552 | (GLenum)target |
| 1553 | ); |
| 1554 | } |
| 1555 | |
| 1556 | /* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */ |
| 1557 | static void |
| 1558 | android_glGenFramebuffers__I_3II |
| 1559 | (JNIEnv *_env, jobject _this, jint n, jintArray framebuffers_ref, jint offset) { |
| 1560 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1561 | const char * _exceptionType = NULL; |
| 1562 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1563 | GLuint *framebuffers_base = (GLuint *) 0; |
| 1564 | jint _remaining; |
| 1565 | GLuint *framebuffers = (GLuint *) 0; |
| 1566 | |
| 1567 | if (!framebuffers_ref) { |
| 1568 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1569 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1570 | _exceptionMessage = "framebuffers == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1571 | goto exit; |
| 1572 | } |
| 1573 | if (offset < 0) { |
| 1574 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1575 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1576 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1577 | goto exit; |
| 1578 | } |
| 1579 | _remaining = _env->GetArrayLength(framebuffers_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1580 | if (_remaining < n) { |
| 1581 | _exception = 1; |
| 1582 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1583 | _exceptionMessage = "length - offset < n < needed"; |
| 1584 | goto exit; |
| 1585 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1586 | framebuffers_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1587 | _env->GetIntArrayElements(framebuffers_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1588 | framebuffers = framebuffers_base + offset; |
| 1589 | |
| 1590 | glGenFramebuffers( |
| 1591 | (GLsizei)n, |
| 1592 | (GLuint *)framebuffers |
| 1593 | ); |
| 1594 | |
| 1595 | exit: |
| 1596 | if (framebuffers_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1597 | _env->ReleaseIntArrayElements(framebuffers_ref, (jint*)framebuffers_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1598 | _exception ? JNI_ABORT: 0); |
| 1599 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1600 | if (_exception) { |
| 1601 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1602 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1603 | } |
| 1604 | |
| 1605 | /* void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) */ |
| 1606 | static void |
| 1607 | android_glGenFramebuffers__ILjava_nio_IntBuffer_2 |
| 1608 | (JNIEnv *_env, jobject _this, jint n, jobject framebuffers_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1609 | jint _exception = 0; |
| 1610 | const char * _exceptionType = NULL; |
| 1611 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1612 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1613 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1614 | jint _remaining; |
| 1615 | GLuint *framebuffers = (GLuint *) 0; |
| 1616 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1617 | if (!framebuffers_buf) { |
| 1618 | _exception = 1; |
| 1619 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1620 | _exceptionMessage = "framebuffers == null"; |
| 1621 | goto exit; |
| 1622 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1623 | framebuffers = (GLuint *)getPointer(_env, framebuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1624 | if (_remaining < n) { |
| 1625 | _exception = 1; |
| 1626 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1627 | _exceptionMessage = "remaining() < n < needed"; |
| 1628 | goto exit; |
| 1629 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1630 | if (framebuffers == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1631 | char * _framebuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1632 | framebuffers = (GLuint *) (_framebuffersBase + _bufferOffset); |
| 1633 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1634 | glGenFramebuffers( |
| 1635 | (GLsizei)n, |
| 1636 | (GLuint *)framebuffers |
| 1637 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1638 | |
| 1639 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1640 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1641 | _env->ReleaseIntArrayElements(_array, (jint*)framebuffers, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1642 | } |
| 1643 | if (_exception) { |
| 1644 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1645 | } |
| 1646 | } |
| 1647 | |
| 1648 | /* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */ |
| 1649 | static void |
| 1650 | android_glGenRenderbuffers__I_3II |
| 1651 | (JNIEnv *_env, jobject _this, jint n, jintArray renderbuffers_ref, jint offset) { |
| 1652 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1653 | const char * _exceptionType = NULL; |
| 1654 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1655 | GLuint *renderbuffers_base = (GLuint *) 0; |
| 1656 | jint _remaining; |
| 1657 | GLuint *renderbuffers = (GLuint *) 0; |
| 1658 | |
| 1659 | if (!renderbuffers_ref) { |
| 1660 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1661 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1662 | _exceptionMessage = "renderbuffers == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1663 | goto exit; |
| 1664 | } |
| 1665 | if (offset < 0) { |
| 1666 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1667 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1668 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1669 | goto exit; |
| 1670 | } |
| 1671 | _remaining = _env->GetArrayLength(renderbuffers_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1672 | if (_remaining < n) { |
| 1673 | _exception = 1; |
| 1674 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1675 | _exceptionMessage = "length - offset < n < needed"; |
| 1676 | goto exit; |
| 1677 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1678 | renderbuffers_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1679 | _env->GetIntArrayElements(renderbuffers_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1680 | renderbuffers = renderbuffers_base + offset; |
| 1681 | |
| 1682 | glGenRenderbuffers( |
| 1683 | (GLsizei)n, |
| 1684 | (GLuint *)renderbuffers |
| 1685 | ); |
| 1686 | |
| 1687 | exit: |
| 1688 | if (renderbuffers_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1689 | _env->ReleaseIntArrayElements(renderbuffers_ref, (jint*)renderbuffers_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1690 | _exception ? JNI_ABORT: 0); |
| 1691 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1692 | if (_exception) { |
| 1693 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1694 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1695 | } |
| 1696 | |
| 1697 | /* void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) */ |
| 1698 | static void |
| 1699 | android_glGenRenderbuffers__ILjava_nio_IntBuffer_2 |
| 1700 | (JNIEnv *_env, jobject _this, jint n, jobject renderbuffers_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1701 | jint _exception = 0; |
| 1702 | const char * _exceptionType = NULL; |
| 1703 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1704 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1705 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1706 | jint _remaining; |
| 1707 | GLuint *renderbuffers = (GLuint *) 0; |
| 1708 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1709 | if (!renderbuffers_buf) { |
| 1710 | _exception = 1; |
| 1711 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1712 | _exceptionMessage = "renderbuffers == null"; |
| 1713 | goto exit; |
| 1714 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1715 | renderbuffers = (GLuint *)getPointer(_env, renderbuffers_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1716 | if (_remaining < n) { |
| 1717 | _exception = 1; |
| 1718 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1719 | _exceptionMessage = "remaining() < n < needed"; |
| 1720 | goto exit; |
| 1721 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1722 | if (renderbuffers == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1723 | char * _renderbuffersBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1724 | renderbuffers = (GLuint *) (_renderbuffersBase + _bufferOffset); |
| 1725 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1726 | glGenRenderbuffers( |
| 1727 | (GLsizei)n, |
| 1728 | (GLuint *)renderbuffers |
| 1729 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1730 | |
| 1731 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1732 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1733 | _env->ReleaseIntArrayElements(_array, (jint*)renderbuffers, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1734 | } |
| 1735 | if (_exception) { |
| 1736 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1737 | } |
| 1738 | } |
| 1739 | |
| 1740 | /* void glGenTextures ( GLsizei n, GLuint *textures ) */ |
| 1741 | static void |
| 1742 | android_glGenTextures__I_3II |
| 1743 | (JNIEnv *_env, jobject _this, jint n, jintArray textures_ref, jint offset) { |
| 1744 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1745 | const char * _exceptionType = NULL; |
| 1746 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1747 | GLuint *textures_base = (GLuint *) 0; |
| 1748 | jint _remaining; |
| 1749 | GLuint *textures = (GLuint *) 0; |
| 1750 | |
| 1751 | if (!textures_ref) { |
| 1752 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1753 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1754 | _exceptionMessage = "textures == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1755 | goto exit; |
| 1756 | } |
| 1757 | if (offset < 0) { |
| 1758 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1759 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1760 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1761 | goto exit; |
| 1762 | } |
| 1763 | _remaining = _env->GetArrayLength(textures_ref) - offset; |
| 1764 | if (_remaining < n) { |
| 1765 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1766 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1767 | _exceptionMessage = "length - offset < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1768 | goto exit; |
| 1769 | } |
| 1770 | textures_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1771 | _env->GetIntArrayElements(textures_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1772 | textures = textures_base + offset; |
| 1773 | |
| 1774 | glGenTextures( |
| 1775 | (GLsizei)n, |
| 1776 | (GLuint *)textures |
| 1777 | ); |
| 1778 | |
| 1779 | exit: |
| 1780 | if (textures_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1781 | _env->ReleaseIntArrayElements(textures_ref, (jint*)textures_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1782 | _exception ? JNI_ABORT: 0); |
| 1783 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1784 | if (_exception) { |
| 1785 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1786 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1787 | } |
| 1788 | |
| 1789 | /* void glGenTextures ( GLsizei n, GLuint *textures ) */ |
| 1790 | static void |
| 1791 | android_glGenTextures__ILjava_nio_IntBuffer_2 |
| 1792 | (JNIEnv *_env, jobject _this, jint n, jobject textures_buf) { |
| 1793 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 1794 | const char * _exceptionType = NULL; |
| 1795 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1796 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1797 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1798 | jint _remaining; |
| 1799 | GLuint *textures = (GLuint *) 0; |
| 1800 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 1801 | if (!textures_buf) { |
| 1802 | _exception = 1; |
| 1803 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1804 | _exceptionMessage = "textures == null"; |
| 1805 | goto exit; |
| 1806 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1807 | textures = (GLuint *)getPointer(_env, textures_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1808 | if (_remaining < n) { |
| 1809 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1810 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1811 | _exceptionMessage = "remaining() < n < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1812 | goto exit; |
| 1813 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1814 | if (textures == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1815 | char * _texturesBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1816 | textures = (GLuint *) (_texturesBase + _bufferOffset); |
| 1817 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1818 | glGenTextures( |
| 1819 | (GLsizei)n, |
| 1820 | (GLuint *)textures |
| 1821 | ); |
| 1822 | |
| 1823 | exit: |
| 1824 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1825 | _env->ReleaseIntArrayElements(_array, (jint*)textures, _exception ? JNI_ABORT : 0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1826 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1827 | if (_exception) { |
| 1828 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1829 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1830 | } |
| 1831 | |
| 1832 | /* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 1833 | static void |
| 1834 | android_glGetActiveAttrib__III_3II_3II_3II_3BI |
| 1835 | (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) { |
| 1836 | jint _exception = 0; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1837 | const char * _exceptionType; |
| 1838 | const char * _exceptionMessage; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1839 | GLsizei *length_base = (GLsizei *) 0; |
| 1840 | jint _lengthRemaining; |
| 1841 | GLsizei *length = (GLsizei *) 0; |
| 1842 | GLint *size_base = (GLint *) 0; |
| 1843 | jint _sizeRemaining; |
| 1844 | GLint *size = (GLint *) 0; |
| 1845 | GLenum *type_base = (GLenum *) 0; |
| 1846 | jint _typeRemaining; |
| 1847 | GLenum *type = (GLenum *) 0; |
| 1848 | char *name_base = (char *) 0; |
| 1849 | jint _nameRemaining; |
| 1850 | char *name = (char *) 0; |
| 1851 | |
Pablo Ceballos | 6aff906 | 2015-10-01 18:35:39 -0700 | [diff] [blame] | 1852 | if (length_ref) { |
| 1853 | if (lengthOffset < 0) { |
| 1854 | _exception = 1; |
| 1855 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1856 | _exceptionMessage = "lengthOffset < 0"; |
| 1857 | goto exit; |
| 1858 | } |
| 1859 | _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; |
| 1860 | length_base = (GLsizei *) |
| 1861 | _env->GetIntArrayElements(length_ref, (jboolean *)0); |
| 1862 | length = length_base + lengthOffset; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1863 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1864 | |
| 1865 | if (!size_ref) { |
| 1866 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1867 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1868 | _exceptionMessage = "size == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1869 | goto exit; |
| 1870 | } |
| 1871 | if (sizeOffset < 0) { |
| 1872 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1873 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1874 | _exceptionMessage = "sizeOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1875 | goto exit; |
| 1876 | } |
| 1877 | _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; |
| 1878 | size_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1879 | _env->GetIntArrayElements(size_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1880 | size = size_base + sizeOffset; |
| 1881 | |
| 1882 | if (!type_ref) { |
| 1883 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1884 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1885 | _exceptionMessage = "type == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1886 | goto exit; |
| 1887 | } |
| 1888 | if (typeOffset < 0) { |
| 1889 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1890 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1891 | _exceptionMessage = "typeOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1892 | goto exit; |
| 1893 | } |
| 1894 | _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; |
| 1895 | type_base = (GLenum *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1896 | _env->GetIntArrayElements(type_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1897 | type = type_base + typeOffset; |
| 1898 | |
| 1899 | if (!name_ref) { |
| 1900 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1901 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1902 | _exceptionMessage = "name == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1903 | goto exit; |
| 1904 | } |
| 1905 | if (nameOffset < 0) { |
| 1906 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1907 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 1908 | _exceptionMessage = "nameOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1909 | goto exit; |
| 1910 | } |
| 1911 | _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset; |
| 1912 | name_base = (char *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1913 | _env->GetByteArrayElements(name_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1914 | name = name_base + nameOffset; |
| 1915 | |
| 1916 | glGetActiveAttrib( |
| 1917 | (GLuint)program, |
| 1918 | (GLuint)index, |
| 1919 | (GLsizei)bufsize, |
| 1920 | (GLsizei *)length, |
| 1921 | (GLint *)size, |
| 1922 | (GLenum *)type, |
| 1923 | (char *)name |
| 1924 | ); |
| 1925 | |
| 1926 | exit: |
| 1927 | if (name_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1928 | _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1929 | _exception ? JNI_ABORT: 0); |
| 1930 | } |
| 1931 | if (type_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1932 | _env->ReleaseIntArrayElements(type_ref, (jint*)type_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1933 | _exception ? JNI_ABORT: 0); |
| 1934 | } |
| 1935 | if (size_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1936 | _env->ReleaseIntArrayElements(size_ref, (jint*)size_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1937 | _exception ? JNI_ABORT: 0); |
| 1938 | } |
| 1939 | if (length_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1940 | _env->ReleaseIntArrayElements(length_ref, (jint*)length_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1941 | _exception ? JNI_ABORT: 0); |
| 1942 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 1943 | if (_exception) { |
| 1944 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 1945 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1946 | } |
| 1947 | |
| 1948 | /* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 1949 | static void |
| 1950 | android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B |
| 1951 | (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1952 | jintArray _lengthArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1953 | jint _lengthBufferOffset = (jint) 0; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1954 | jintArray _sizeArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1955 | jint _sizeBufferOffset = (jint) 0; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1956 | jintArray _typeArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1957 | jint _typeBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1958 | jint _lengthRemaining; |
| 1959 | GLsizei *length = (GLsizei *) 0; |
| 1960 | jint _sizeRemaining; |
| 1961 | GLint *size = (GLint *) 0; |
| 1962 | jint _typeRemaining; |
| 1963 | GLenum *type = (GLenum *) 0; |
| 1964 | |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1965 | length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset); |
| 1966 | size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset); |
| 1967 | type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1968 | if (length == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1969 | char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1970 | length = (GLsizei *) (_lengthBase + _lengthBufferOffset); |
| 1971 | } |
| 1972 | if (size == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1973 | char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1974 | size = (GLint *) (_sizeBase + _sizeBufferOffset); |
| 1975 | } |
| 1976 | if (type == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1977 | char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1978 | type = (GLenum *) (_typeBase + _typeBufferOffset); |
| 1979 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1980 | glGetActiveAttrib( |
| 1981 | (GLuint)program, |
| 1982 | (GLuint)index, |
| 1983 | (GLsizei)bufsize, |
| 1984 | (GLsizei *)length, |
| 1985 | (GLint *)size, |
| 1986 | (GLenum *)type, |
Ashok Bhat | 01c26ea | 2014-02-24 09:49:07 +0000 | [diff] [blame] | 1987 | reinterpret_cast<char *>(name) |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1988 | ); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1989 | if (_typeArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1990 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1991 | } |
| 1992 | if (_sizeArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1993 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1994 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 1995 | if (_lengthArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 1996 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 1997 | } |
| 1998 | } |
| 1999 | |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2000 | /* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 2001 | static jstring |
| 2002 | android_glGetActiveAttrib1 |
| 2003 | (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) { |
| 2004 | jint _exception = 0; |
| 2005 | const char * _exceptionType; |
| 2006 | const char * _exceptionMessage; |
| 2007 | GLint *size_base = (GLint *) 0; |
| 2008 | jint _sizeRemaining; |
| 2009 | GLint *size = (GLint *) 0; |
| 2010 | GLenum *type_base = (GLenum *) 0; |
| 2011 | jint _typeRemaining; |
| 2012 | GLenum *type = (GLenum *) 0; |
| 2013 | |
| 2014 | jstring result = 0; |
| 2015 | |
| 2016 | GLint len = 0; |
| 2017 | glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len); |
| 2018 | if (!len) { |
| 2019 | return _env->NewStringUTF(""); |
| 2020 | } |
| 2021 | char* buf = (char*) malloc(len); |
| 2022 | |
| 2023 | if (buf == NULL) { |
| 2024 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 2025 | return NULL; |
| 2026 | } |
| 2027 | if (!size_ref) { |
| 2028 | _exception = 1; |
| 2029 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2030 | _exceptionMessage = "size == null"; |
| 2031 | goto exit; |
| 2032 | } |
| 2033 | if (sizeOffset < 0) { |
| 2034 | _exception = 1; |
| 2035 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2036 | _exceptionMessage = "sizeOffset < 0"; |
| 2037 | goto exit; |
| 2038 | } |
| 2039 | _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; |
| 2040 | size_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2041 | _env->GetIntArrayElements(size_ref, (jboolean *)0); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2042 | size = size_base + sizeOffset; |
| 2043 | |
| 2044 | if (!type_ref) { |
| 2045 | _exception = 1; |
| 2046 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2047 | _exceptionMessage = "type == null"; |
| 2048 | goto exit; |
| 2049 | } |
| 2050 | if (typeOffset < 0) { |
| 2051 | _exception = 1; |
| 2052 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2053 | _exceptionMessage = "typeOffset < 0"; |
| 2054 | goto exit; |
| 2055 | } |
| 2056 | _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; |
| 2057 | type_base = (GLenum *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2058 | _env->GetIntArrayElements(type_ref, (jboolean *)0); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2059 | type = type_base + typeOffset; |
| 2060 | |
| 2061 | glGetActiveAttrib( |
| 2062 | (GLuint)program, |
| 2063 | (GLuint)index, |
| 2064 | (GLsizei)len, |
| 2065 | NULL, |
| 2066 | (GLint *)size, |
| 2067 | (GLenum *)type, |
| 2068 | (char *)buf |
| 2069 | ); |
| 2070 | exit: |
| 2071 | if (type_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2072 | _env->ReleaseIntArrayElements(type_ref, (jint*)type_base, |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2073 | _exception ? JNI_ABORT: 0); |
| 2074 | } |
| 2075 | if (size_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2076 | _env->ReleaseIntArrayElements(size_ref, (jint*)size_base, |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2077 | _exception ? JNI_ABORT: 0); |
| 2078 | } |
| 2079 | if (_exception != 1) { |
| 2080 | result = _env->NewStringUTF(buf); |
| 2081 | } |
| 2082 | if (buf) { |
| 2083 | free(buf); |
| 2084 | } |
| 2085 | if (_exception) { |
| 2086 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2087 | } |
| 2088 | if (result == 0) { |
| 2089 | result = _env->NewStringUTF(""); |
| 2090 | } |
| 2091 | |
| 2092 | return result; |
| 2093 | } |
| 2094 | |
| 2095 | /* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 2096 | static jstring |
| 2097 | android_glGetActiveAttrib2 |
| 2098 | (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2099 | jintArray _sizeArray = (jintArray) 0; |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2100 | jint _sizeBufferOffset = (jint) 0; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2101 | jintArray _typeArray = (jintArray) 0; |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2102 | jint _typeBufferOffset = (jint) 0; |
| 2103 | jint _lengthRemaining; |
| 2104 | GLsizei *length = (GLsizei *) 0; |
| 2105 | jint _sizeRemaining; |
| 2106 | GLint *size = (GLint *) 0; |
| 2107 | jint _typeRemaining; |
| 2108 | GLenum *type = (GLenum *) 0; |
| 2109 | |
| 2110 | jstring result = 0; |
| 2111 | |
| 2112 | GLint len = 0; |
| 2113 | glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len); |
| 2114 | if (!len) { |
| 2115 | return _env->NewStringUTF(""); |
| 2116 | } |
| 2117 | char* buf = (char*) malloc(len); |
| 2118 | |
| 2119 | if (buf == NULL) { |
| 2120 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 2121 | return NULL; |
| 2122 | } |
| 2123 | |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2124 | size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset); |
| 2125 | type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2126 | if (size == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2127 | char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2128 | size = (GLint *) (_sizeBase + _sizeBufferOffset); |
| 2129 | } |
| 2130 | if (type == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2131 | char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2132 | type = (GLenum *) (_typeBase + _typeBufferOffset); |
| 2133 | } |
| 2134 | glGetActiveAttrib( |
| 2135 | (GLuint)program, |
| 2136 | (GLuint)index, |
| 2137 | (GLsizei)len, |
| 2138 | NULL, |
| 2139 | (GLint *)size, |
| 2140 | (GLenum *)type, |
| 2141 | (char *)buf |
| 2142 | ); |
| 2143 | |
| 2144 | if (_typeArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2145 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2146 | } |
| 2147 | if (_sizeArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2148 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2149 | } |
| 2150 | result = _env->NewStringUTF(buf); |
| 2151 | if (buf) { |
| 2152 | free(buf); |
| 2153 | } |
| 2154 | return result; |
| 2155 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2156 | /* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 2157 | static void |
| 2158 | android_glGetActiveUniform__III_3II_3II_3II_3BI |
| 2159 | (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) { |
| 2160 | jint _exception = 0; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2161 | const char * _exceptionType; |
| 2162 | const char * _exceptionMessage; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2163 | GLsizei *length_base = (GLsizei *) 0; |
| 2164 | jint _lengthRemaining; |
| 2165 | GLsizei *length = (GLsizei *) 0; |
| 2166 | GLint *size_base = (GLint *) 0; |
| 2167 | jint _sizeRemaining; |
| 2168 | GLint *size = (GLint *) 0; |
| 2169 | GLenum *type_base = (GLenum *) 0; |
| 2170 | jint _typeRemaining; |
| 2171 | GLenum *type = (GLenum *) 0; |
| 2172 | char *name_base = (char *) 0; |
| 2173 | jint _nameRemaining; |
| 2174 | char *name = (char *) 0; |
| 2175 | |
Pablo Ceballos | 6aff906 | 2015-10-01 18:35:39 -0700 | [diff] [blame] | 2176 | if (length_ref) { |
| 2177 | if (lengthOffset < 0) { |
| 2178 | _exception = 1; |
| 2179 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2180 | _exceptionMessage = "lengthOffset < 0"; |
| 2181 | goto exit; |
| 2182 | } |
| 2183 | _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; |
| 2184 | length_base = (GLsizei *) |
| 2185 | _env->GetIntArrayElements(length_ref, (jboolean *)0); |
| 2186 | length = length_base + lengthOffset; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2187 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2188 | |
| 2189 | if (!size_ref) { |
| 2190 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2191 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2192 | _exceptionMessage = "size == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2193 | goto exit; |
| 2194 | } |
| 2195 | if (sizeOffset < 0) { |
| 2196 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2197 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2198 | _exceptionMessage = "sizeOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2199 | goto exit; |
| 2200 | } |
| 2201 | _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; |
| 2202 | size_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2203 | _env->GetIntArrayElements(size_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2204 | size = size_base + sizeOffset; |
| 2205 | |
| 2206 | if (!type_ref) { |
| 2207 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2208 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2209 | _exceptionMessage = "type == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2210 | goto exit; |
| 2211 | } |
| 2212 | if (typeOffset < 0) { |
| 2213 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2214 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2215 | _exceptionMessage = "typeOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2216 | goto exit; |
| 2217 | } |
| 2218 | _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; |
| 2219 | type_base = (GLenum *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2220 | _env->GetIntArrayElements(type_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2221 | type = type_base + typeOffset; |
| 2222 | |
| 2223 | if (!name_ref) { |
| 2224 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2225 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2226 | _exceptionMessage = "name == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2227 | goto exit; |
| 2228 | } |
| 2229 | if (nameOffset < 0) { |
| 2230 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2231 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2232 | _exceptionMessage = "nameOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2233 | goto exit; |
| 2234 | } |
| 2235 | _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset; |
| 2236 | name_base = (char *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2237 | _env->GetByteArrayElements(name_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2238 | name = name_base + nameOffset; |
| 2239 | |
| 2240 | glGetActiveUniform( |
| 2241 | (GLuint)program, |
| 2242 | (GLuint)index, |
| 2243 | (GLsizei)bufsize, |
| 2244 | (GLsizei *)length, |
| 2245 | (GLint *)size, |
| 2246 | (GLenum *)type, |
| 2247 | (char *)name |
| 2248 | ); |
| 2249 | |
| 2250 | exit: |
| 2251 | if (name_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2252 | _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2253 | _exception ? JNI_ABORT: 0); |
| 2254 | } |
| 2255 | if (type_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2256 | _env->ReleaseIntArrayElements(type_ref, (jint*)type_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2257 | _exception ? JNI_ABORT: 0); |
| 2258 | } |
| 2259 | if (size_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2260 | _env->ReleaseIntArrayElements(size_ref, (jint*)size_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2261 | _exception ? JNI_ABORT: 0); |
| 2262 | } |
| 2263 | if (length_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2264 | _env->ReleaseIntArrayElements(length_ref, (jint*)length_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2265 | _exception ? JNI_ABORT: 0); |
| 2266 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2267 | if (_exception) { |
| 2268 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2269 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2270 | } |
| 2271 | |
| 2272 | /* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 2273 | static void |
| 2274 | android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B |
| 2275 | (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2276 | jintArray _lengthArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2277 | jint _lengthBufferOffset = (jint) 0; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2278 | jintArray _sizeArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2279 | jint _sizeBufferOffset = (jint) 0; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2280 | jintArray _typeArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2281 | jint _typeBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2282 | jint _lengthRemaining; |
| 2283 | GLsizei *length = (GLsizei *) 0; |
| 2284 | jint _sizeRemaining; |
| 2285 | GLint *size = (GLint *) 0; |
| 2286 | jint _typeRemaining; |
| 2287 | GLenum *type = (GLenum *) 0; |
| 2288 | |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2289 | length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset); |
| 2290 | size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset); |
| 2291 | type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2292 | if (length == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2293 | char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2294 | length = (GLsizei *) (_lengthBase + _lengthBufferOffset); |
| 2295 | } |
| 2296 | if (size == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2297 | char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2298 | size = (GLint *) (_sizeBase + _sizeBufferOffset); |
| 2299 | } |
| 2300 | if (type == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2301 | char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2302 | type = (GLenum *) (_typeBase + _typeBufferOffset); |
| 2303 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2304 | glGetActiveUniform( |
| 2305 | (GLuint)program, |
| 2306 | (GLuint)index, |
| 2307 | (GLsizei)bufsize, |
| 2308 | (GLsizei *)length, |
| 2309 | (GLint *)size, |
| 2310 | (GLenum *)type, |
Ashok Bhat | 01c26ea | 2014-02-24 09:49:07 +0000 | [diff] [blame] | 2311 | reinterpret_cast<char *>(name) |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2312 | ); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2313 | if (_typeArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2314 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2315 | } |
| 2316 | if (_sizeArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2317 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2318 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2319 | if (_lengthArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2320 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2321 | } |
| 2322 | } |
| 2323 | |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2324 | /* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 2325 | static jstring |
| 2326 | android_glGetActiveUniform1 |
| 2327 | (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) { |
| 2328 | jint _exception = 0; |
| 2329 | const char * _exceptionType; |
| 2330 | const char * _exceptionMessage; |
| 2331 | |
| 2332 | GLint *size_base = (GLint *) 0; |
| 2333 | jint _sizeRemaining; |
| 2334 | GLint *size = (GLint *) 0; |
| 2335 | |
| 2336 | GLenum *type_base = (GLenum *) 0; |
| 2337 | jint _typeRemaining; |
| 2338 | GLenum *type = (GLenum *) 0; |
| 2339 | |
| 2340 | jstring result = 0; |
| 2341 | |
| 2342 | GLint len = 0; |
| 2343 | glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len); |
| 2344 | if (!len) { |
| 2345 | return _env->NewStringUTF(""); |
| 2346 | } |
| 2347 | char* buf = (char*) malloc(len); |
| 2348 | |
| 2349 | if (buf == NULL) { |
| 2350 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 2351 | return NULL; |
| 2352 | } |
| 2353 | |
| 2354 | if (!size_ref) { |
| 2355 | _exception = 1; |
| 2356 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2357 | _exceptionMessage = "size == null"; |
| 2358 | goto exit; |
| 2359 | } |
| 2360 | if (sizeOffset < 0) { |
| 2361 | _exception = 1; |
| 2362 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2363 | _exceptionMessage = "sizeOffset < 0"; |
| 2364 | goto exit; |
| 2365 | } |
| 2366 | _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; |
| 2367 | size_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2368 | _env->GetIntArrayElements(size_ref, (jboolean *)0); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2369 | size = size_base + sizeOffset; |
| 2370 | |
| 2371 | if (!type_ref) { |
| 2372 | _exception = 1; |
| 2373 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2374 | _exceptionMessage = "type == null"; |
| 2375 | goto exit; |
| 2376 | } |
| 2377 | if (typeOffset < 0) { |
| 2378 | _exception = 1; |
| 2379 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2380 | _exceptionMessage = "typeOffset < 0"; |
| 2381 | goto exit; |
| 2382 | } |
| 2383 | _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; |
| 2384 | type_base = (GLenum *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2385 | _env->GetIntArrayElements(type_ref, (jboolean *)0); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2386 | type = type_base + typeOffset; |
| 2387 | |
| 2388 | glGetActiveUniform( |
| 2389 | (GLuint)program, |
| 2390 | (GLuint)index, |
| 2391 | (GLsizei)len, |
| 2392 | NULL, |
| 2393 | (GLint *)size, |
| 2394 | (GLenum *)type, |
| 2395 | (char *)buf |
| 2396 | ); |
| 2397 | |
| 2398 | exit: |
| 2399 | if (type_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2400 | _env->ReleaseIntArrayElements(type_ref, (jint*)type_base, |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2401 | _exception ? JNI_ABORT: 0); |
| 2402 | } |
| 2403 | if (size_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2404 | _env->ReleaseIntArrayElements(size_ref, (jint*)size_base, |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2405 | _exception ? JNI_ABORT: 0); |
| 2406 | } |
| 2407 | if (_exception != 1) { |
| 2408 | result = _env->NewStringUTF(buf); |
| 2409 | } |
| 2410 | if (buf) { |
| 2411 | free(buf); |
| 2412 | } |
| 2413 | if (_exception) { |
| 2414 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2415 | } |
| 2416 | if (result == 0) { |
| 2417 | result = _env->NewStringUTF(""); |
| 2418 | } |
| 2419 | return result; |
| 2420 | } |
| 2421 | |
| 2422 | /* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ |
| 2423 | static jstring |
| 2424 | android_glGetActiveUniform2 |
| 2425 | (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2426 | jintArray _sizeArray = (jintArray) 0; |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2427 | jint _sizeBufferOffset = (jint) 0; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2428 | jintArray _typeArray = (jintArray) 0; |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2429 | jint _typeBufferOffset = (jint) 0; |
| 2430 | jint _sizeRemaining; |
| 2431 | GLint *size = (GLint *) 0; |
| 2432 | jint _typeRemaining; |
| 2433 | GLenum *type = (GLenum *) 0; |
| 2434 | |
| 2435 | jstring result = 0; |
| 2436 | GLint len = 0; |
| 2437 | glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len); |
| 2438 | if (!len) { |
| 2439 | return _env->NewStringUTF(""); |
| 2440 | } |
| 2441 | char* buf = (char*) malloc(len); |
| 2442 | |
| 2443 | if (buf == NULL) { |
| 2444 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 2445 | return NULL; |
| 2446 | } |
| 2447 | |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2448 | size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset); |
| 2449 | type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2450 | |
| 2451 | if (size == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2452 | char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2453 | size = (GLint *) (_sizeBase + _sizeBufferOffset); |
| 2454 | } |
| 2455 | if (type == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2456 | char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2457 | type = (GLenum *) (_typeBase + _typeBufferOffset); |
| 2458 | } |
| 2459 | glGetActiveUniform( |
| 2460 | (GLuint)program, |
| 2461 | (GLuint)index, |
| 2462 | len, |
| 2463 | NULL, |
| 2464 | (GLint *)size, |
| 2465 | (GLenum *)type, |
| 2466 | (char *)buf |
| 2467 | ); |
| 2468 | |
| 2469 | if (_typeArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2470 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2471 | } |
| 2472 | if (_sizeArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2473 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE); |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 2474 | } |
| 2475 | result = _env->NewStringUTF(buf); |
| 2476 | if (buf) { |
| 2477 | free(buf); |
| 2478 | } |
| 2479 | return result; |
| 2480 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2481 | /* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */ |
| 2482 | static void |
| 2483 | android_glGetAttachedShaders__II_3II_3II |
| 2484 | (JNIEnv *_env, jobject _this, jint program, jint maxcount, jintArray count_ref, jint countOffset, jintArray shaders_ref, jint shadersOffset) { |
| 2485 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2486 | const char * _exceptionType = NULL; |
| 2487 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2488 | GLsizei *count_base = (GLsizei *) 0; |
| 2489 | jint _countRemaining; |
| 2490 | GLsizei *count = (GLsizei *) 0; |
| 2491 | GLuint *shaders_base = (GLuint *) 0; |
| 2492 | jint _shadersRemaining; |
| 2493 | GLuint *shaders = (GLuint *) 0; |
| 2494 | |
Pablo Ceballos | 6aff906 | 2015-10-01 18:35:39 -0700 | [diff] [blame] | 2495 | if (count_ref) { |
| 2496 | if (countOffset < 0) { |
| 2497 | _exception = 1; |
| 2498 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2499 | _exceptionMessage = "countOffset < 0"; |
| 2500 | goto exit; |
| 2501 | } |
| 2502 | _countRemaining = _env->GetArrayLength(count_ref) - countOffset; |
| 2503 | if (_countRemaining < 1) { |
| 2504 | _exception = 1; |
| 2505 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2506 | _exceptionMessage = "length - countOffset < 1 < needed"; |
| 2507 | goto exit; |
| 2508 | } |
| 2509 | count_base = (GLsizei *) |
| 2510 | _env->GetIntArrayElements(count_ref, (jboolean *)0); |
| 2511 | count = count_base + countOffset; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2512 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2513 | |
| 2514 | if (!shaders_ref) { |
| 2515 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2516 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2517 | _exceptionMessage = "shaders == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2518 | goto exit; |
| 2519 | } |
| 2520 | if (shadersOffset < 0) { |
| 2521 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2522 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2523 | _exceptionMessage = "shadersOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2524 | goto exit; |
| 2525 | } |
| 2526 | _shadersRemaining = _env->GetArrayLength(shaders_ref) - shadersOffset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2527 | if (_shadersRemaining < maxcount) { |
| 2528 | _exception = 1; |
| 2529 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2530 | _exceptionMessage = "length - shadersOffset < maxcount < needed"; |
| 2531 | goto exit; |
| 2532 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2533 | shaders_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2534 | _env->GetIntArrayElements(shaders_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2535 | shaders = shaders_base + shadersOffset; |
| 2536 | |
| 2537 | glGetAttachedShaders( |
| 2538 | (GLuint)program, |
| 2539 | (GLsizei)maxcount, |
| 2540 | (GLsizei *)count, |
| 2541 | (GLuint *)shaders |
| 2542 | ); |
| 2543 | |
| 2544 | exit: |
| 2545 | if (shaders_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2546 | _env->ReleaseIntArrayElements(shaders_ref, (jint*)shaders_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2547 | _exception ? JNI_ABORT: 0); |
| 2548 | } |
| 2549 | if (count_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2550 | _env->ReleaseIntArrayElements(count_ref, (jint*)count_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2551 | _exception ? JNI_ABORT: 0); |
| 2552 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2553 | if (_exception) { |
| 2554 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2555 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2556 | } |
| 2557 | |
| 2558 | /* void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) */ |
| 2559 | static void |
| 2560 | android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 |
| 2561 | (JNIEnv *_env, jobject _this, jint program, jint maxcount, jobject count_buf, jobject shaders_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2562 | jint _exception = 0; |
| 2563 | const char * _exceptionType = NULL; |
| 2564 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2565 | jintArray _countArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2566 | jint _countBufferOffset = (jint) 0; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2567 | jintArray _shadersArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2568 | jint _shadersBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2569 | jint _countRemaining; |
| 2570 | GLsizei *count = (GLsizei *) 0; |
| 2571 | jint _shadersRemaining; |
| 2572 | GLuint *shaders = (GLuint *) 0; |
| 2573 | |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2574 | if (count_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2575 | count = (GLsizei *)getPointer(_env, count_buf, (jarray*)&_countArray, &_countRemaining, &_countBufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2576 | if (_countRemaining < 1) { |
| 2577 | _exception = 1; |
| 2578 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2579 | _exceptionMessage = "remaining() < 1 < needed"; |
| 2580 | goto exit; |
| 2581 | } |
| 2582 | } |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2583 | if (!shaders_buf) { |
| 2584 | _exception = 1; |
| 2585 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2586 | _exceptionMessage = "shaders == null"; |
| 2587 | goto exit; |
| 2588 | } |
Pablo Ceballos | 6aff906 | 2015-10-01 18:35:39 -0700 | [diff] [blame] | 2589 | shaders = (GLuint *)getPointer(_env, shaders_buf, (jarray*)&_shadersArray, &_shadersRemaining, &_shadersBufferOffset); |
| 2590 | if (_shadersRemaining < maxcount) { |
| 2591 | _exception = 1; |
| 2592 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2593 | _exceptionMessage = "remaining() < maxcount < needed"; |
| 2594 | goto exit; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2595 | } |
| 2596 | if (count_buf && count == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2597 | char * _countBase = (char *)_env->GetIntArrayElements(_countArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2598 | count = (GLsizei *) (_countBase + _countBufferOffset); |
| 2599 | } |
Pablo Ceballos | 6aff906 | 2015-10-01 18:35:39 -0700 | [diff] [blame] | 2600 | if (shaders == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2601 | char * _shadersBase = (char *)_env->GetIntArrayElements(_shadersArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2602 | shaders = (GLuint *) (_shadersBase + _shadersBufferOffset); |
| 2603 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2604 | glGetAttachedShaders( |
| 2605 | (GLuint)program, |
| 2606 | (GLsizei)maxcount, |
| 2607 | (GLsizei *)count, |
| 2608 | (GLuint *)shaders |
| 2609 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2610 | |
| 2611 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2612 | if (_shadersArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2613 | _env->ReleaseIntArrayElements(_shadersArray, (jint*)shaders, _exception ? JNI_ABORT : 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2614 | } |
| 2615 | if (_countArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2616 | _env->ReleaseIntArrayElements(_countArray, (jint*)count, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2617 | } |
| 2618 | if (_exception) { |
| 2619 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2620 | } |
| 2621 | } |
| 2622 | |
Mathias Agopian | 89be00b | 2013-02-22 20:08:06 -0800 | [diff] [blame] | 2623 | /* GLint glGetAttribLocation ( GLuint program, const char *name ) */ |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2624 | static jint |
| 2625 | android_glGetAttribLocation__ILjava_lang_String_2 |
| 2626 | (JNIEnv *_env, jobject _this, jint program, jstring name) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2627 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2628 | const char * _exceptionType = NULL; |
| 2629 | const char * _exceptionMessage = NULL; |
Mathias Agopian | 89be00b | 2013-02-22 20:08:06 -0800 | [diff] [blame] | 2630 | GLint _returnValue = 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2631 | const char* _nativename = 0; |
| 2632 | |
| 2633 | if (!name) { |
Elliott Hughes | 428d3fc | 2013-09-24 17:15:41 -0700 | [diff] [blame] | 2634 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2635 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2636 | _exceptionMessage = "name == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2637 | goto exit; |
| 2638 | } |
| 2639 | _nativename = _env->GetStringUTFChars(name, 0); |
| 2640 | |
| 2641 | _returnValue = glGetAttribLocation( |
| 2642 | (GLuint)program, |
| 2643 | (char *)_nativename |
| 2644 | ); |
| 2645 | |
| 2646 | exit: |
| 2647 | if (_nativename) { |
| 2648 | _env->ReleaseStringUTFChars(name, _nativename); |
| 2649 | } |
| 2650 | |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2651 | if (_exception) { |
| 2652 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Orion Hodson | c240f22 | 2019-02-26 18:05:03 +0000 | [diff] [blame] | 2653 | return (jint)0; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2654 | } |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 2655 | return (jint)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2656 | } |
| 2657 | |
| 2658 | /* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ |
| 2659 | static void |
| 2660 | android_glGetBooleanv__I_3ZI |
| 2661 | (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2662 | get<jbooleanArray, BooleanArrayGetter, jboolean*, BooleanArrayReleaser, GLboolean, glGetBooleanv>( |
| 2663 | _env, _this, pname, params_ref, offset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2664 | } |
| 2665 | |
| 2666 | /* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ |
| 2667 | static void |
| 2668 | android_glGetBooleanv__ILjava_nio_IntBuffer_2 |
| 2669 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2670 | getarray<GLboolean, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetBooleanv>( |
| 2671 | _env, _this, pname, params_buf); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2672 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2673 | /* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 2674 | static void |
| 2675 | android_glGetBufferParameteriv__II_3II |
| 2676 | (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] | 2677 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2678 | const char * _exceptionType = NULL; |
| 2679 | const char * _exceptionMessage = NULL; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2680 | GLint *params_base = (GLint *) 0; |
| 2681 | jint _remaining; |
| 2682 | GLint *params = (GLint *) 0; |
| 2683 | |
| 2684 | if (!params_ref) { |
| 2685 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2686 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2687 | _exceptionMessage = "params == null"; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2688 | goto exit; |
| 2689 | } |
| 2690 | if (offset < 0) { |
| 2691 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2692 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2693 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2694 | goto exit; |
| 2695 | } |
| 2696 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2697 | if (_remaining < 1) { |
| 2698 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2699 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2700 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2701 | goto exit; |
| 2702 | } |
| 2703 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2704 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2705 | params = params_base + offset; |
| 2706 | |
| 2707 | glGetBufferParameteriv( |
| 2708 | (GLenum)target, |
| 2709 | (GLenum)pname, |
| 2710 | (GLint *)params |
| 2711 | ); |
| 2712 | |
| 2713 | exit: |
| 2714 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2715 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2716 | _exception ? JNI_ABORT: 0); |
| 2717 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2718 | if (_exception) { |
| 2719 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2720 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2721 | } |
| 2722 | |
| 2723 | /* void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 2724 | static void |
| 2725 | android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 |
| 2726 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2727 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2728 | const char * _exceptionType = NULL; |
| 2729 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2730 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2731 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2732 | jint _remaining; |
| 2733 | GLint *params = (GLint *) 0; |
| 2734 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2735 | if (!params_buf) { |
| 2736 | _exception = 1; |
| 2737 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2738 | _exceptionMessage = "params == null"; |
| 2739 | goto exit; |
| 2740 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2741 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2742 | if (_remaining < 1) { |
| 2743 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2744 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2745 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2746 | goto exit; |
| 2747 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2748 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2749 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2750 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 2751 | } |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2752 | glGetBufferParameteriv( |
| 2753 | (GLenum)target, |
| 2754 | (GLenum)pname, |
| 2755 | (GLint *)params |
| 2756 | ); |
| 2757 | |
| 2758 | exit: |
| 2759 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2760 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Jack Palevich | 7310867 | 2011-03-28 14:49:12 -0700 | [diff] [blame] | 2761 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2762 | if (_exception) { |
| 2763 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2764 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2765 | } |
| 2766 | |
| 2767 | /* GLenum glGetError ( void ) */ |
| 2768 | static jint |
| 2769 | android_glGetError__ |
| 2770 | (JNIEnv *_env, jobject _this) { |
| 2771 | GLenum _returnValue; |
| 2772 | _returnValue = glGetError(); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 2773 | return (jint)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2774 | } |
| 2775 | |
| 2776 | /* void glGetFloatv ( GLenum pname, GLfloat *params ) */ |
| 2777 | static void |
| 2778 | android_glGetFloatv__I_3FI |
| 2779 | (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2780 | get<jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, GLfloat, glGetFloatv>( |
| 2781 | _env, _this, pname, params_ref, offset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2782 | } |
| 2783 | |
| 2784 | /* void glGetFloatv ( GLenum pname, GLfloat *params ) */ |
| 2785 | static void |
| 2786 | android_glGetFloatv__ILjava_nio_FloatBuffer_2 |
| 2787 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2788 | getarray<GLfloat, jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, glGetFloatv>( |
| 2789 | _env, _this, pname, params_buf); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2790 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2791 | /* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */ |
| 2792 | static void |
| 2793 | android_glGetFramebufferAttachmentParameteriv__III_3II |
| 2794 | (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jintArray params_ref, jint offset) { |
| 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 | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2798 | GLint *params_base = (GLint *) 0; |
| 2799 | jint _remaining; |
| 2800 | GLint *params = (GLint *) 0; |
| 2801 | |
| 2802 | if (!params_ref) { |
| 2803 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2804 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2805 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2806 | goto exit; |
| 2807 | } |
| 2808 | if (offset < 0) { |
| 2809 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2810 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2811 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2812 | goto exit; |
| 2813 | } |
| 2814 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 2815 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2816 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2817 | params = params_base + offset; |
| 2818 | |
| 2819 | glGetFramebufferAttachmentParameteriv( |
| 2820 | (GLenum)target, |
| 2821 | (GLenum)attachment, |
| 2822 | (GLenum)pname, |
| 2823 | (GLint *)params |
| 2824 | ); |
| 2825 | |
| 2826 | exit: |
| 2827 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2828 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2829 | _exception ? JNI_ABORT: 0); |
| 2830 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2831 | if (_exception) { |
| 2832 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2833 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2834 | } |
| 2835 | |
| 2836 | /* void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) */ |
| 2837 | static void |
| 2838 | android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 |
| 2839 | (JNIEnv *_env, jobject _this, jint target, jint attachment, jint pname, jobject params_buf) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2840 | jint _exception = 0; |
| 2841 | const char * _exceptionType = NULL; |
| 2842 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2843 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2844 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2845 | jint _remaining; |
| 2846 | GLint *params = (GLint *) 0; |
| 2847 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2848 | if (!params_buf) { |
| 2849 | _exception = 1; |
| 2850 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2851 | _exceptionMessage = "params == null"; |
| 2852 | goto exit; |
| 2853 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2854 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2855 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2856 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2857 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 2858 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2859 | glGetFramebufferAttachmentParameteriv( |
| 2860 | (GLenum)target, |
| 2861 | (GLenum)attachment, |
| 2862 | (GLenum)pname, |
| 2863 | (GLint *)params |
| 2864 | ); |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2865 | |
| 2866 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2867 | if (_array) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2868 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
| 2869 | } |
| 2870 | if (_exception) { |
| 2871 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2872 | } |
| 2873 | } |
| 2874 | |
| 2875 | /* void glGetIntegerv ( GLenum pname, GLint *params ) */ |
| 2876 | static void |
| 2877 | android_glGetIntegerv__I_3II |
| 2878 | (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2879 | get<jintArray, IntArrayGetter, jint*, IntArrayReleaser, GLint, glGetIntegerv>( |
| 2880 | _env, _this, pname, params_ref, offset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2881 | } |
| 2882 | |
| 2883 | /* void glGetIntegerv ( GLenum pname, GLint *params ) */ |
| 2884 | static void |
| 2885 | android_glGetIntegerv__ILjava_nio_IntBuffer_2 |
| 2886 | (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2887 | getarray<GLint, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetIntegerv>( |
| 2888 | _env, _this, pname, params_buf); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2889 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2890 | /* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */ |
| 2891 | static void |
| 2892 | android_glGetProgramiv__II_3II |
| 2893 | (JNIEnv *_env, jobject _this, jint program, jint pname, jintArray params_ref, jint offset) { |
| 2894 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2895 | const char * _exceptionType = NULL; |
| 2896 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2897 | GLint *params_base = (GLint *) 0; |
| 2898 | jint _remaining; |
| 2899 | GLint *params = (GLint *) 0; |
| 2900 | |
| 2901 | if (!params_ref) { |
| 2902 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2903 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2904 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2905 | goto exit; |
| 2906 | } |
| 2907 | if (offset < 0) { |
| 2908 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2909 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2910 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2911 | goto exit; |
| 2912 | } |
| 2913 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2914 | if (_remaining < 1) { |
| 2915 | _exception = 1; |
| 2916 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2917 | _exceptionMessage = "length - offset < 1 < needed"; |
| 2918 | goto exit; |
| 2919 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2920 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2921 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2922 | params = params_base + offset; |
| 2923 | |
| 2924 | glGetProgramiv( |
| 2925 | (GLuint)program, |
| 2926 | (GLenum)pname, |
| 2927 | (GLint *)params |
| 2928 | ); |
| 2929 | |
| 2930 | exit: |
| 2931 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2932 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2933 | _exception ? JNI_ABORT: 0); |
| 2934 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 2935 | if (_exception) { |
| 2936 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 2937 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2938 | } |
| 2939 | |
| 2940 | /* void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) */ |
| 2941 | static void |
| 2942 | android_glGetProgramiv__IILjava_nio_IntBuffer_2 |
| 2943 | (JNIEnv *_env, jobject _this, jint program, jint pname, jobject params_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2944 | jint _exception = 0; |
| 2945 | const char * _exceptionType = NULL; |
| 2946 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2947 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2948 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2949 | jint _remaining; |
| 2950 | GLint *params = (GLint *) 0; |
| 2951 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 2952 | if (!params_buf) { |
| 2953 | _exception = 1; |
| 2954 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2955 | _exceptionMessage = "params == null"; |
| 2956 | goto exit; |
| 2957 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2958 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2959 | if (_remaining < 1) { |
| 2960 | _exception = 1; |
| 2961 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 2962 | _exceptionMessage = "remaining() < 1 < needed"; |
| 2963 | goto exit; |
| 2964 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2965 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2966 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 2967 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 2968 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2969 | glGetProgramiv( |
| 2970 | (GLuint)program, |
| 2971 | (GLenum)pname, |
| 2972 | (GLint *)params |
| 2973 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2974 | |
| 2975 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2976 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 2977 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 2978 | } |
| 2979 | if (_exception) { |
| 2980 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2981 | } |
| 2982 | } |
| 2983 | |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 2984 | #include <stdlib.h> |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2985 | |
| 2986 | /* void glGetProgramInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */ |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 2987 | static jstring android_glGetProgramInfoLog(JNIEnv *_env, jobject, jint shader) { |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2988 | GLint infoLen = 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2989 | glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &infoLen); |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 2990 | if (!infoLen) { |
| 2991 | return _env->NewStringUTF(""); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2992 | } |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 2993 | char* buf = (char*) malloc(infoLen); |
| 2994 | if (buf == NULL) { |
| 2995 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 2996 | return NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 2997 | } |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 2998 | glGetProgramInfoLog(shader, infoLen, NULL, buf); |
| 2999 | jstring result = _env->NewStringUTF(buf); |
| 3000 | free(buf); |
| 3001 | return result; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3002 | } |
| 3003 | /* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 3004 | static void |
| 3005 | android_glGetRenderbufferParameteriv__II_3II |
| 3006 | (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { |
| 3007 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3008 | const char * _exceptionType = NULL; |
| 3009 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3010 | GLint *params_base = (GLint *) 0; |
| 3011 | jint _remaining; |
| 3012 | GLint *params = (GLint *) 0; |
| 3013 | |
| 3014 | if (!params_ref) { |
| 3015 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3016 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3017 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3018 | goto exit; |
| 3019 | } |
| 3020 | if (offset < 0) { |
| 3021 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3022 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3023 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3024 | goto exit; |
| 3025 | } |
| 3026 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3027 | if (_remaining < 1) { |
| 3028 | _exception = 1; |
| 3029 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3030 | _exceptionMessage = "length - offset < 1 < needed"; |
| 3031 | goto exit; |
| 3032 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3033 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3034 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3035 | params = params_base + offset; |
| 3036 | |
| 3037 | glGetRenderbufferParameteriv( |
| 3038 | (GLenum)target, |
| 3039 | (GLenum)pname, |
| 3040 | (GLint *)params |
| 3041 | ); |
| 3042 | |
| 3043 | exit: |
| 3044 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3045 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3046 | _exception ? JNI_ABORT: 0); |
| 3047 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3048 | if (_exception) { |
| 3049 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3050 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3051 | } |
| 3052 | |
| 3053 | /* void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 3054 | static void |
| 3055 | android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2 |
| 3056 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3057 | jint _exception = 0; |
| 3058 | const char * _exceptionType = NULL; |
| 3059 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3060 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3061 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3062 | jint _remaining; |
| 3063 | GLint *params = (GLint *) 0; |
| 3064 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3065 | if (!params_buf) { |
| 3066 | _exception = 1; |
| 3067 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3068 | _exceptionMessage = "params == null"; |
| 3069 | goto exit; |
| 3070 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3071 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3072 | if (_remaining < 1) { |
| 3073 | _exception = 1; |
| 3074 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3075 | _exceptionMessage = "remaining() < 1 < needed"; |
| 3076 | goto exit; |
| 3077 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3078 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3079 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3080 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 3081 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3082 | glGetRenderbufferParameteriv( |
| 3083 | (GLenum)target, |
| 3084 | (GLenum)pname, |
| 3085 | (GLint *)params |
| 3086 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3087 | |
| 3088 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3089 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3090 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3091 | } |
| 3092 | if (_exception) { |
| 3093 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3094 | } |
| 3095 | } |
| 3096 | |
| 3097 | /* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */ |
| 3098 | static void |
| 3099 | android_glGetShaderiv__II_3II |
| 3100 | (JNIEnv *_env, jobject _this, jint shader, jint pname, jintArray params_ref, jint offset) { |
| 3101 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3102 | const char * _exceptionType = NULL; |
| 3103 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3104 | GLint *params_base = (GLint *) 0; |
| 3105 | jint _remaining; |
| 3106 | GLint *params = (GLint *) 0; |
| 3107 | |
| 3108 | if (!params_ref) { |
| 3109 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3110 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3111 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3112 | goto exit; |
| 3113 | } |
| 3114 | if (offset < 0) { |
| 3115 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3116 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3117 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3118 | goto exit; |
| 3119 | } |
| 3120 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3121 | if (_remaining < 1) { |
| 3122 | _exception = 1; |
| 3123 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3124 | _exceptionMessage = "length - offset < 1 < needed"; |
| 3125 | goto exit; |
| 3126 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3127 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3128 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3129 | params = params_base + offset; |
| 3130 | |
| 3131 | glGetShaderiv( |
| 3132 | (GLuint)shader, |
| 3133 | (GLenum)pname, |
| 3134 | (GLint *)params |
| 3135 | ); |
| 3136 | |
| 3137 | exit: |
| 3138 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3139 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3140 | _exception ? JNI_ABORT: 0); |
| 3141 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3142 | if (_exception) { |
| 3143 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3144 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3145 | } |
| 3146 | |
| 3147 | /* void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) */ |
| 3148 | static void |
| 3149 | android_glGetShaderiv__IILjava_nio_IntBuffer_2 |
| 3150 | (JNIEnv *_env, jobject _this, jint shader, jint pname, jobject params_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3151 | jint _exception = 0; |
| 3152 | const char * _exceptionType = NULL; |
| 3153 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3154 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3155 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3156 | jint _remaining; |
| 3157 | GLint *params = (GLint *) 0; |
| 3158 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3159 | if (!params_buf) { |
| 3160 | _exception = 1; |
| 3161 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3162 | _exceptionMessage = "params == null"; |
| 3163 | goto exit; |
| 3164 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3165 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3166 | if (_remaining < 1) { |
| 3167 | _exception = 1; |
| 3168 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3169 | _exceptionMessage = "remaining() < 1 < needed"; |
| 3170 | goto exit; |
| 3171 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3172 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3173 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3174 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 3175 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3176 | glGetShaderiv( |
| 3177 | (GLuint)shader, |
| 3178 | (GLenum)pname, |
| 3179 | (GLint *)params |
| 3180 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3181 | |
| 3182 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3183 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3184 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3185 | } |
| 3186 | if (_exception) { |
| 3187 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3188 | } |
| 3189 | } |
| 3190 | |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 3191 | #include <stdlib.h> |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3192 | |
| 3193 | /* void glGetShaderInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */ |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 3194 | static jstring android_glGetShaderInfoLog(JNIEnv *_env, jobject, jint shader) { |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3195 | GLint infoLen = 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3196 | glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen); |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 3197 | if (!infoLen) { |
Romain Guy | e842e50 | 2016-11-29 19:26:29 -0800 | [diff] [blame] | 3198 | infoLen = 512; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3199 | } |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 3200 | char* buf = (char*) malloc(infoLen); |
| 3201 | if (buf == NULL) { |
| 3202 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 3203 | return NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3204 | } |
Romain Guy | e842e50 | 2016-11-29 19:26:29 -0800 | [diff] [blame] | 3205 | GLsizei outLen = 0; |
| 3206 | glGetShaderInfoLog(shader, infoLen, &outLen, buf); |
| 3207 | jstring result = _env->NewStringUTF(outLen == 0 ? "" : buf); |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 3208 | free(buf); |
| 3209 | return result; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3210 | } |
| 3211 | /* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */ |
| 3212 | static void |
| 3213 | android_glGetShaderPrecisionFormat__II_3II_3II |
| 3214 | (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jintArray range_ref, jint rangeOffset, jintArray precision_ref, jint precisionOffset) { |
| 3215 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3216 | const char * _exceptionType = NULL; |
| 3217 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3218 | GLint *range_base = (GLint *) 0; |
| 3219 | jint _rangeRemaining; |
| 3220 | GLint *range = (GLint *) 0; |
| 3221 | GLint *precision_base = (GLint *) 0; |
| 3222 | jint _precisionRemaining; |
| 3223 | GLint *precision = (GLint *) 0; |
| 3224 | |
| 3225 | if (!range_ref) { |
| 3226 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3227 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3228 | _exceptionMessage = "range == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3229 | goto exit; |
| 3230 | } |
| 3231 | if (rangeOffset < 0) { |
| 3232 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3233 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3234 | _exceptionMessage = "rangeOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3235 | goto exit; |
| 3236 | } |
| 3237 | _rangeRemaining = _env->GetArrayLength(range_ref) - rangeOffset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3238 | if (_rangeRemaining < 1) { |
| 3239 | _exception = 1; |
| 3240 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3241 | _exceptionMessage = "length - rangeOffset < 1 < needed"; |
| 3242 | goto exit; |
| 3243 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3244 | range_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3245 | _env->GetIntArrayElements(range_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3246 | range = range_base + rangeOffset; |
| 3247 | |
| 3248 | if (!precision_ref) { |
| 3249 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3250 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3251 | _exceptionMessage = "precision == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3252 | goto exit; |
| 3253 | } |
| 3254 | if (precisionOffset < 0) { |
| 3255 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3256 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3257 | _exceptionMessage = "precisionOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3258 | goto exit; |
| 3259 | } |
| 3260 | _precisionRemaining = _env->GetArrayLength(precision_ref) - precisionOffset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3261 | if (_precisionRemaining < 1) { |
| 3262 | _exception = 1; |
| 3263 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3264 | _exceptionMessage = "length - precisionOffset < 1 < needed"; |
| 3265 | goto exit; |
| 3266 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3267 | precision_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3268 | _env->GetIntArrayElements(precision_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3269 | precision = precision_base + precisionOffset; |
| 3270 | |
| 3271 | glGetShaderPrecisionFormat( |
| 3272 | (GLenum)shadertype, |
| 3273 | (GLenum)precisiontype, |
| 3274 | (GLint *)range, |
| 3275 | (GLint *)precision |
| 3276 | ); |
| 3277 | |
| 3278 | exit: |
| 3279 | if (precision_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3280 | _env->ReleaseIntArrayElements(precision_ref, (jint*)precision_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3281 | _exception ? JNI_ABORT: 0); |
| 3282 | } |
| 3283 | if (range_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3284 | _env->ReleaseIntArrayElements(range_ref, (jint*)range_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3285 | _exception ? JNI_ABORT: 0); |
| 3286 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3287 | if (_exception) { |
| 3288 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3289 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3290 | } |
| 3291 | |
| 3292 | /* void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) */ |
| 3293 | static void |
| 3294 | android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 |
| 3295 | (JNIEnv *_env, jobject _this, jint shadertype, jint precisiontype, jobject range_buf, jobject precision_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3296 | jint _exception = 0; |
| 3297 | const char * _exceptionType = NULL; |
| 3298 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3299 | jintArray _rangeArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3300 | jint _rangeBufferOffset = (jint) 0; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3301 | jintArray _precisionArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3302 | jint _precisionBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3303 | jint _rangeRemaining; |
| 3304 | GLint *range = (GLint *) 0; |
| 3305 | jint _precisionRemaining; |
| 3306 | GLint *precision = (GLint *) 0; |
| 3307 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3308 | if (!range_buf) { |
| 3309 | _exception = 1; |
| 3310 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3311 | _exceptionMessage = "range == null"; |
| 3312 | goto exit; |
| 3313 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3314 | range = (GLint *)getPointer(_env, range_buf, (jarray*)&_rangeArray, &_rangeRemaining, &_rangeBufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3315 | if (_rangeRemaining < 1) { |
| 3316 | _exception = 1; |
| 3317 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3318 | _exceptionMessage = "remaining() < 1 < needed"; |
| 3319 | goto exit; |
| 3320 | } |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3321 | if (!precision_buf) { |
| 3322 | _exception = 1; |
| 3323 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3324 | _exceptionMessage = "precision == null"; |
| 3325 | goto exit; |
| 3326 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3327 | precision = (GLint *)getPointer(_env, precision_buf, (jarray*)&_precisionArray, &_precisionRemaining, &_precisionBufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3328 | if (_precisionRemaining < 1) { |
| 3329 | _exception = 1; |
| 3330 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3331 | _exceptionMessage = "remaining() < 1 < needed"; |
| 3332 | goto exit; |
| 3333 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3334 | if (range == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3335 | char * _rangeBase = (char *)_env->GetIntArrayElements(_rangeArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3336 | range = (GLint *) (_rangeBase + _rangeBufferOffset); |
| 3337 | } |
| 3338 | if (precision == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3339 | char * _precisionBase = (char *)_env->GetIntArrayElements(_precisionArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3340 | precision = (GLint *) (_precisionBase + _precisionBufferOffset); |
| 3341 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3342 | glGetShaderPrecisionFormat( |
| 3343 | (GLenum)shadertype, |
| 3344 | (GLenum)precisiontype, |
| 3345 | (GLint *)range, |
| 3346 | (GLint *)precision |
| 3347 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3348 | |
| 3349 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3350 | if (_precisionArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3351 | _env->ReleaseIntArrayElements(_precisionArray, (jint*)precision, _exception ? JNI_ABORT : 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3352 | } |
| 3353 | if (_rangeArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3354 | _env->ReleaseIntArrayElements(_rangeArray, (jint*)range, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3355 | } |
| 3356 | if (_exception) { |
| 3357 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3358 | } |
| 3359 | } |
| 3360 | |
| 3361 | /* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */ |
| 3362 | static void |
| 3363 | android_glGetShaderSource__II_3II_3BI |
| 3364 | (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jintArray length_ref, jint lengthOffset, jbyteArray source_ref, jint sourceOffset) { |
| 3365 | jint _exception = 0; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3366 | const char * _exceptionType; |
| 3367 | const char * _exceptionMessage; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3368 | GLsizei *length_base = (GLsizei *) 0; |
| 3369 | jint _lengthRemaining; |
| 3370 | GLsizei *length = (GLsizei *) 0; |
| 3371 | char *source_base = (char *) 0; |
| 3372 | jint _sourceRemaining; |
| 3373 | char *source = (char *) 0; |
| 3374 | |
Pablo Ceballos | 6aff906 | 2015-10-01 18:35:39 -0700 | [diff] [blame] | 3375 | if (length_ref) { |
| 3376 | if (lengthOffset < 0) { |
| 3377 | _exception = 1; |
| 3378 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3379 | _exceptionMessage = "lengthOffset < 0"; |
| 3380 | goto exit; |
| 3381 | } |
| 3382 | _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; |
| 3383 | length_base = (GLsizei *) |
| 3384 | _env->GetIntArrayElements(length_ref, (jboolean *)0); |
| 3385 | length = length_base + lengthOffset; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3386 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3387 | |
| 3388 | if (!source_ref) { |
| 3389 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3390 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3391 | _exceptionMessage = "source == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3392 | goto exit; |
| 3393 | } |
| 3394 | if (sourceOffset < 0) { |
| 3395 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3396 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3397 | _exceptionMessage = "sourceOffset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3398 | goto exit; |
| 3399 | } |
| 3400 | _sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset; |
| 3401 | source_base = (char *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3402 | _env->GetByteArrayElements(source_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3403 | source = source_base + sourceOffset; |
| 3404 | |
| 3405 | glGetShaderSource( |
| 3406 | (GLuint)shader, |
| 3407 | (GLsizei)bufsize, |
| 3408 | (GLsizei *)length, |
| 3409 | (char *)source |
| 3410 | ); |
| 3411 | |
| 3412 | exit: |
| 3413 | if (source_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3414 | _env->ReleaseByteArrayElements(source_ref, (jbyte*)source_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3415 | _exception ? JNI_ABORT: 0); |
| 3416 | } |
| 3417 | if (length_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3418 | _env->ReleaseIntArrayElements(length_ref, (jint*)length_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3419 | _exception ? JNI_ABORT: 0); |
| 3420 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3421 | if (_exception) { |
| 3422 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3423 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3424 | } |
| 3425 | |
| 3426 | /* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */ |
| 3427 | static void |
| 3428 | android_glGetShaderSource__IILjava_nio_IntBuffer_2B |
| 3429 | (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jobject length_buf, jbyte source) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3430 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3431 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3432 | jint _remaining; |
| 3433 | GLsizei *length = (GLsizei *) 0; |
| 3434 | |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3435 | length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3436 | if (length == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3437 | char * _lengthBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3438 | length = (GLsizei *) (_lengthBase + _bufferOffset); |
| 3439 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3440 | glGetShaderSource( |
| 3441 | (GLuint)shader, |
| 3442 | (GLsizei)bufsize, |
| 3443 | (GLsizei *)length, |
Ashok Bhat | 01c26ea | 2014-02-24 09:49:07 +0000 | [diff] [blame] | 3444 | reinterpret_cast<char *>(source) |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3445 | ); |
| 3446 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3447 | releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _array, (jint*)length, JNI_TRUE); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3448 | } |
| 3449 | } |
| 3450 | |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 3451 | /* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */ |
| 3452 | static jstring android_glGetShaderSource(JNIEnv *_env, jobject, jint shader) { |
| 3453 | GLint shaderLen = 0; |
| 3454 | glGetShaderiv((GLuint)shader, GL_SHADER_SOURCE_LENGTH, &shaderLen); |
| 3455 | if (!shaderLen) { |
| 3456 | return _env->NewStringUTF(""); |
| 3457 | } |
| 3458 | char* buf = (char*) malloc(shaderLen); |
| 3459 | if (buf == NULL) { |
| 3460 | jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); |
| 3461 | return NULL; |
| 3462 | } |
| 3463 | glGetShaderSource(shader, shaderLen, NULL, buf); |
| 3464 | jstring result = _env->NewStringUTF(buf); |
| 3465 | free(buf); |
| 3466 | return result; |
| 3467 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3468 | /* const GLubyte * glGetString ( GLenum name ) */ |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 3469 | static jstring android_glGetString(JNIEnv* _env, jobject, jint name) { |
| 3470 | const char* chars = (const char*) glGetString((GLenum) name); |
| 3471 | return _env->NewStringUTF(chars); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3472 | } |
| 3473 | /* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */ |
| 3474 | static void |
| 3475 | android_glGetTexParameterfv__II_3FI |
| 3476 | (JNIEnv *_env, jobject _this, jint target, jint pname, jfloatArray params_ref, jint offset) { |
| 3477 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3478 | const char * _exceptionType = NULL; |
| 3479 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3480 | GLfloat *params_base = (GLfloat *) 0; |
| 3481 | jint _remaining; |
| 3482 | GLfloat *params = (GLfloat *) 0; |
| 3483 | |
| 3484 | if (!params_ref) { |
| 3485 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3486 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3487 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3488 | goto exit; |
| 3489 | } |
| 3490 | if (offset < 0) { |
| 3491 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3492 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3493 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3494 | goto exit; |
| 3495 | } |
| 3496 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 3497 | if (_remaining < 1) { |
| 3498 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3499 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3500 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3501 | goto exit; |
| 3502 | } |
| 3503 | params_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3504 | _env->GetFloatArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3505 | params = params_base + offset; |
| 3506 | |
| 3507 | glGetTexParameterfv( |
| 3508 | (GLenum)target, |
| 3509 | (GLenum)pname, |
| 3510 | (GLfloat *)params |
| 3511 | ); |
| 3512 | |
| 3513 | exit: |
| 3514 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3515 | _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3516 | _exception ? JNI_ABORT: 0); |
| 3517 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3518 | if (_exception) { |
| 3519 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3520 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3521 | } |
| 3522 | |
| 3523 | /* void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) */ |
| 3524 | static void |
| 3525 | android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 |
| 3526 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
| 3527 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3528 | const char * _exceptionType = NULL; |
| 3529 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3530 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3531 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3532 | jint _remaining; |
| 3533 | GLfloat *params = (GLfloat *) 0; |
| 3534 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3535 | if (!params_buf) { |
| 3536 | _exception = 1; |
| 3537 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3538 | _exceptionMessage = "params == null"; |
| 3539 | goto exit; |
| 3540 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3541 | params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3542 | if (_remaining < 1) { |
| 3543 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3544 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3545 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3546 | goto exit; |
| 3547 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3548 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3549 | char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3550 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 3551 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3552 | glGetTexParameterfv( |
| 3553 | (GLenum)target, |
| 3554 | (GLenum)pname, |
| 3555 | (GLfloat *)params |
| 3556 | ); |
| 3557 | |
| 3558 | exit: |
| 3559 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3560 | _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3561 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3562 | if (_exception) { |
| 3563 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3564 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3565 | } |
| 3566 | |
| 3567 | /* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 3568 | static void |
| 3569 | android_glGetTexParameteriv__II_3II |
| 3570 | (JNIEnv *_env, jobject _this, jint target, jint pname, jintArray params_ref, jint offset) { |
| 3571 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3572 | const char * _exceptionType = NULL; |
| 3573 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3574 | GLint *params_base = (GLint *) 0; |
| 3575 | jint _remaining; |
| 3576 | GLint *params = (GLint *) 0; |
| 3577 | |
| 3578 | if (!params_ref) { |
| 3579 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3580 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3581 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3582 | goto exit; |
| 3583 | } |
| 3584 | if (offset < 0) { |
| 3585 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3586 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3587 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3588 | goto exit; |
| 3589 | } |
| 3590 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 3591 | if (_remaining < 1) { |
| 3592 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3593 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3594 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3595 | goto exit; |
| 3596 | } |
| 3597 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3598 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3599 | params = params_base + offset; |
| 3600 | |
| 3601 | glGetTexParameteriv( |
| 3602 | (GLenum)target, |
| 3603 | (GLenum)pname, |
| 3604 | (GLint *)params |
| 3605 | ); |
| 3606 | |
| 3607 | exit: |
| 3608 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3609 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3610 | _exception ? JNI_ABORT: 0); |
| 3611 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3612 | if (_exception) { |
| 3613 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3614 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3615 | } |
| 3616 | |
| 3617 | /* void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) */ |
| 3618 | static void |
| 3619 | android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 |
| 3620 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
| 3621 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3622 | const char * _exceptionType = NULL; |
| 3623 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3624 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3625 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3626 | jint _remaining; |
| 3627 | GLint *params = (GLint *) 0; |
| 3628 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3629 | if (!params_buf) { |
| 3630 | _exception = 1; |
| 3631 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3632 | _exceptionMessage = "params == null"; |
| 3633 | goto exit; |
| 3634 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3635 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3636 | if (_remaining < 1) { |
| 3637 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3638 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3639 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3640 | goto exit; |
| 3641 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3642 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3643 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3644 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 3645 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3646 | glGetTexParameteriv( |
| 3647 | (GLenum)target, |
| 3648 | (GLenum)pname, |
| 3649 | (GLint *)params |
| 3650 | ); |
| 3651 | |
| 3652 | exit: |
| 3653 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3654 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3655 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3656 | if (_exception) { |
| 3657 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3658 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3659 | } |
| 3660 | |
| 3661 | /* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */ |
| 3662 | static void |
| 3663 | android_glGetUniformfv__II_3FI |
| 3664 | (JNIEnv *_env, jobject _this, jint program, jint location, jfloatArray params_ref, jint offset) { |
| 3665 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3666 | const char * _exceptionType = NULL; |
| 3667 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3668 | GLfloat *params_base = (GLfloat *) 0; |
| 3669 | jint _remaining; |
| 3670 | GLfloat *params = (GLfloat *) 0; |
| 3671 | |
| 3672 | if (!params_ref) { |
| 3673 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3674 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3675 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3676 | goto exit; |
| 3677 | } |
| 3678 | if (offset < 0) { |
| 3679 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3680 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3681 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3682 | goto exit; |
| 3683 | } |
| 3684 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3685 | if (_remaining < 1) { |
| 3686 | _exception = 1; |
| 3687 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3688 | _exceptionMessage = "length - offset < 1 < needed"; |
| 3689 | goto exit; |
| 3690 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3691 | params_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3692 | _env->GetFloatArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3693 | params = params_base + offset; |
| 3694 | |
| 3695 | glGetUniformfv( |
| 3696 | (GLuint)program, |
| 3697 | (GLint)location, |
| 3698 | (GLfloat *)params |
| 3699 | ); |
| 3700 | |
| 3701 | exit: |
| 3702 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3703 | _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3704 | _exception ? JNI_ABORT: 0); |
| 3705 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3706 | if (_exception) { |
| 3707 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3708 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3709 | } |
| 3710 | |
| 3711 | /* void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) */ |
| 3712 | static void |
| 3713 | android_glGetUniformfv__IILjava_nio_FloatBuffer_2 |
| 3714 | (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3715 | jint _exception = 0; |
| 3716 | const char * _exceptionType = NULL; |
| 3717 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3718 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3719 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3720 | jint _remaining; |
| 3721 | GLfloat *params = (GLfloat *) 0; |
| 3722 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3723 | if (!params_buf) { |
| 3724 | _exception = 1; |
| 3725 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3726 | _exceptionMessage = "params == null"; |
| 3727 | goto exit; |
| 3728 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3729 | params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3730 | if (_remaining < 1) { |
| 3731 | _exception = 1; |
| 3732 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3733 | _exceptionMessage = "remaining() < 1 < needed"; |
| 3734 | goto exit; |
| 3735 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3736 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3737 | char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3738 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 3739 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3740 | glGetUniformfv( |
| 3741 | (GLuint)program, |
| 3742 | (GLint)location, |
| 3743 | (GLfloat *)params |
| 3744 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3745 | |
| 3746 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3747 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3748 | _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3749 | } |
| 3750 | if (_exception) { |
| 3751 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3752 | } |
| 3753 | } |
| 3754 | |
| 3755 | /* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */ |
| 3756 | static void |
| 3757 | android_glGetUniformiv__II_3II |
| 3758 | (JNIEnv *_env, jobject _this, jint program, jint location, jintArray params_ref, jint offset) { |
| 3759 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3760 | const char * _exceptionType = NULL; |
| 3761 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3762 | GLint *params_base = (GLint *) 0; |
| 3763 | jint _remaining; |
| 3764 | GLint *params = (GLint *) 0; |
| 3765 | |
| 3766 | if (!params_ref) { |
| 3767 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3768 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3769 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3770 | goto exit; |
| 3771 | } |
| 3772 | if (offset < 0) { |
| 3773 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3774 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3775 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3776 | goto exit; |
| 3777 | } |
| 3778 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3779 | if (_remaining < 1) { |
| 3780 | _exception = 1; |
| 3781 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3782 | _exceptionMessage = "length - offset < 1 < needed"; |
| 3783 | goto exit; |
| 3784 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3785 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3786 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3787 | params = params_base + offset; |
| 3788 | |
| 3789 | glGetUniformiv( |
| 3790 | (GLuint)program, |
| 3791 | (GLint)location, |
| 3792 | (GLint *)params |
| 3793 | ); |
| 3794 | |
| 3795 | exit: |
| 3796 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3797 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3798 | _exception ? JNI_ABORT: 0); |
| 3799 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3800 | if (_exception) { |
| 3801 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3802 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3803 | } |
| 3804 | |
| 3805 | /* void glGetUniformiv ( GLuint program, GLint location, GLint *params ) */ |
| 3806 | static void |
| 3807 | android_glGetUniformiv__IILjava_nio_IntBuffer_2 |
| 3808 | (JNIEnv *_env, jobject _this, jint program, jint location, jobject params_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3809 | jint _exception = 0; |
| 3810 | const char * _exceptionType = NULL; |
| 3811 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3812 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3813 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3814 | jint _remaining; |
| 3815 | GLint *params = (GLint *) 0; |
| 3816 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3817 | if (!params_buf) { |
| 3818 | _exception = 1; |
| 3819 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3820 | _exceptionMessage = "params == null"; |
| 3821 | goto exit; |
| 3822 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3823 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3824 | if (_remaining < 1) { |
| 3825 | _exception = 1; |
| 3826 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3827 | _exceptionMessage = "remaining() < 1 < needed"; |
| 3828 | goto exit; |
| 3829 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3830 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3831 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3832 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 3833 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3834 | glGetUniformiv( |
| 3835 | (GLuint)program, |
| 3836 | (GLint)location, |
| 3837 | (GLint *)params |
| 3838 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3839 | |
| 3840 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3841 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3842 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3843 | } |
| 3844 | if (_exception) { |
| 3845 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3846 | } |
| 3847 | } |
| 3848 | |
Mathias Agopian | 89be00b | 2013-02-22 20:08:06 -0800 | [diff] [blame] | 3849 | /* GLint glGetUniformLocation ( GLuint program, const char *name ) */ |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3850 | static jint |
| 3851 | android_glGetUniformLocation__ILjava_lang_String_2 |
| 3852 | (JNIEnv *_env, jobject _this, jint program, jstring name) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3853 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3854 | const char * _exceptionType = NULL; |
| 3855 | const char * _exceptionMessage = NULL; |
Mathias Agopian | 89be00b | 2013-02-22 20:08:06 -0800 | [diff] [blame] | 3856 | GLint _returnValue = 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3857 | const char* _nativename = 0; |
| 3858 | |
| 3859 | if (!name) { |
Elliott Hughes | 428d3fc | 2013-09-24 17:15:41 -0700 | [diff] [blame] | 3860 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3861 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3862 | _exceptionMessage = "name == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3863 | goto exit; |
| 3864 | } |
| 3865 | _nativename = _env->GetStringUTFChars(name, 0); |
| 3866 | |
| 3867 | _returnValue = glGetUniformLocation( |
| 3868 | (GLuint)program, |
| 3869 | (char *)_nativename |
| 3870 | ); |
| 3871 | |
| 3872 | exit: |
| 3873 | if (_nativename) { |
| 3874 | _env->ReleaseStringUTFChars(name, _nativename); |
| 3875 | } |
| 3876 | |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3877 | if (_exception) { |
| 3878 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Orion Hodson | c240f22 | 2019-02-26 18:05:03 +0000 | [diff] [blame] | 3879 | return (jint)0; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3880 | } |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 3881 | return (jint)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3882 | } |
| 3883 | |
| 3884 | /* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */ |
| 3885 | static void |
| 3886 | android_glGetVertexAttribfv__II_3FI |
| 3887 | (JNIEnv *_env, jobject _this, jint index, jint pname, jfloatArray params_ref, jint offset) { |
| 3888 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3889 | const char * _exceptionType = NULL; |
| 3890 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3891 | GLfloat *params_base = (GLfloat *) 0; |
| 3892 | jint _remaining; |
| 3893 | GLfloat *params = (GLfloat *) 0; |
| 3894 | |
| 3895 | if (!params_ref) { |
| 3896 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3897 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3898 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3899 | goto exit; |
| 3900 | } |
| 3901 | if (offset < 0) { |
| 3902 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3903 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3904 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3905 | goto exit; |
| 3906 | } |
| 3907 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3908 | int _needed; |
| 3909 | switch (pname) { |
| 3910 | #if defined(GL_CURRENT_VERTEX_ATTRIB) |
| 3911 | case GL_CURRENT_VERTEX_ATTRIB: |
| 3912 | #endif // defined(GL_CURRENT_VERTEX_ATTRIB) |
| 3913 | _needed = 4; |
| 3914 | break; |
| 3915 | default: |
| 3916 | _needed = 1; |
| 3917 | break; |
| 3918 | } |
| 3919 | if (_remaining < _needed) { |
| 3920 | _exception = 1; |
| 3921 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3922 | _exceptionMessage = "length - offset < needed"; |
| 3923 | goto exit; |
| 3924 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3925 | params_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3926 | _env->GetFloatArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3927 | params = params_base + offset; |
| 3928 | |
| 3929 | glGetVertexAttribfv( |
| 3930 | (GLuint)index, |
| 3931 | (GLenum)pname, |
| 3932 | (GLfloat *)params |
| 3933 | ); |
| 3934 | |
| 3935 | exit: |
| 3936 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3937 | _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3938 | _exception ? JNI_ABORT: 0); |
| 3939 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 3940 | if (_exception) { |
| 3941 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 3942 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3943 | } |
| 3944 | |
| 3945 | /* void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) */ |
| 3946 | static void |
| 3947 | android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2 |
| 3948 | (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3949 | jint _exception = 0; |
| 3950 | const char * _exceptionType = NULL; |
| 3951 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3952 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3953 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3954 | jint _remaining; |
| 3955 | GLfloat *params = (GLfloat *) 0; |
| 3956 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 3957 | if (!params_buf) { |
| 3958 | _exception = 1; |
| 3959 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3960 | _exceptionMessage = "params == null"; |
| 3961 | goto exit; |
| 3962 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3963 | params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3964 | int _needed; |
| 3965 | switch (pname) { |
| 3966 | #if defined(GL_CURRENT_VERTEX_ATTRIB) |
| 3967 | case GL_CURRENT_VERTEX_ATTRIB: |
| 3968 | #endif // defined(GL_CURRENT_VERTEX_ATTRIB) |
| 3969 | _needed = 4; |
| 3970 | break; |
| 3971 | default: |
| 3972 | _needed = 1; |
| 3973 | break; |
| 3974 | } |
| 3975 | if (_remaining < _needed) { |
| 3976 | _exception = 1; |
| 3977 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 3978 | _exceptionMessage = "remaining() < needed"; |
| 3979 | goto exit; |
| 3980 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3981 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3982 | char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 3983 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 3984 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3985 | glGetVertexAttribfv( |
| 3986 | (GLuint)index, |
| 3987 | (GLenum)pname, |
| 3988 | (GLfloat *)params |
| 3989 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3990 | |
| 3991 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3992 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 3993 | _env->ReleaseFloatArrayElements(_array, (jfloat*)params, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 3994 | } |
| 3995 | if (_exception) { |
| 3996 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 3997 | } |
| 3998 | } |
| 3999 | |
| 4000 | /* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */ |
| 4001 | static void |
| 4002 | android_glGetVertexAttribiv__II_3II |
| 4003 | (JNIEnv *_env, jobject _this, jint index, jint pname, jintArray params_ref, jint offset) { |
| 4004 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4005 | const char * _exceptionType = NULL; |
| 4006 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4007 | GLint *params_base = (GLint *) 0; |
| 4008 | jint _remaining; |
| 4009 | GLint *params = (GLint *) 0; |
| 4010 | |
| 4011 | if (!params_ref) { |
| 4012 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4013 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4014 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4015 | goto exit; |
| 4016 | } |
| 4017 | if (offset < 0) { |
| 4018 | _exception = 1; |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4019 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4020 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4021 | goto exit; |
| 4022 | } |
| 4023 | _remaining = _env->GetArrayLength(params_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4024 | int _needed; |
| 4025 | switch (pname) { |
| 4026 | #if defined(GL_CURRENT_VERTEX_ATTRIB) |
| 4027 | case GL_CURRENT_VERTEX_ATTRIB: |
| 4028 | #endif // defined(GL_CURRENT_VERTEX_ATTRIB) |
| 4029 | _needed = 4; |
| 4030 | break; |
| 4031 | default: |
| 4032 | _needed = 1; |
| 4033 | break; |
| 4034 | } |
| 4035 | if (_remaining < _needed) { |
| 4036 | _exception = 1; |
| 4037 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4038 | _exceptionMessage = "length - offset < needed"; |
| 4039 | goto exit; |
| 4040 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4041 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4042 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4043 | params = params_base + offset; |
| 4044 | |
| 4045 | glGetVertexAttribiv( |
| 4046 | (GLuint)index, |
| 4047 | (GLenum)pname, |
| 4048 | (GLint *)params |
| 4049 | ); |
| 4050 | |
| 4051 | exit: |
| 4052 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4053 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4054 | _exception ? JNI_ABORT: 0); |
| 4055 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4056 | if (_exception) { |
| 4057 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4058 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4059 | } |
| 4060 | |
| 4061 | /* void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) */ |
| 4062 | static void |
| 4063 | android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2 |
| 4064 | (JNIEnv *_env, jobject _this, jint index, jint pname, jobject params_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4065 | jint _exception = 0; |
| 4066 | const char * _exceptionType = NULL; |
| 4067 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4068 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4069 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4070 | jint _remaining; |
| 4071 | GLint *params = (GLint *) 0; |
| 4072 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4073 | if (!params_buf) { |
| 4074 | _exception = 1; |
| 4075 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4076 | _exceptionMessage = "params == null"; |
| 4077 | goto exit; |
| 4078 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4079 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4080 | int _needed; |
| 4081 | switch (pname) { |
| 4082 | #if defined(GL_CURRENT_VERTEX_ATTRIB) |
| 4083 | case GL_CURRENT_VERTEX_ATTRIB: |
| 4084 | #endif // defined(GL_CURRENT_VERTEX_ATTRIB) |
| 4085 | _needed = 4; |
| 4086 | break; |
| 4087 | default: |
| 4088 | _needed = 1; |
| 4089 | break; |
| 4090 | } |
| 4091 | if (_remaining < _needed) { |
| 4092 | _exception = 1; |
| 4093 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4094 | _exceptionMessage = "remaining() < needed"; |
| 4095 | goto exit; |
| 4096 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4097 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4098 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4099 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 4100 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4101 | glGetVertexAttribiv( |
| 4102 | (GLuint)index, |
| 4103 | (GLenum)pname, |
| 4104 | (GLint *)params |
| 4105 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4106 | |
| 4107 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4108 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4109 | _env->ReleaseIntArrayElements(_array, (jint*)params, _exception ? JNI_ABORT : 0); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4110 | } |
| 4111 | if (_exception) { |
| 4112 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4113 | } |
| 4114 | } |
| 4115 | |
| 4116 | /* void glHint ( GLenum target, GLenum mode ) */ |
| 4117 | static void |
| 4118 | android_glHint__II |
| 4119 | (JNIEnv *_env, jobject _this, jint target, jint mode) { |
| 4120 | glHint( |
| 4121 | (GLenum)target, |
| 4122 | (GLenum)mode |
| 4123 | ); |
| 4124 | } |
| 4125 | |
| 4126 | /* GLboolean glIsBuffer ( GLuint buffer ) */ |
| 4127 | static jboolean |
| 4128 | android_glIsBuffer__I |
| 4129 | (JNIEnv *_env, jobject _this, jint buffer) { |
| 4130 | GLboolean _returnValue; |
| 4131 | _returnValue = glIsBuffer( |
| 4132 | (GLuint)buffer |
| 4133 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 4134 | return (jboolean)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4135 | } |
| 4136 | |
| 4137 | /* GLboolean glIsEnabled ( GLenum cap ) */ |
| 4138 | static jboolean |
| 4139 | android_glIsEnabled__I |
| 4140 | (JNIEnv *_env, jobject _this, jint cap) { |
| 4141 | GLboolean _returnValue; |
| 4142 | _returnValue = glIsEnabled( |
| 4143 | (GLenum)cap |
| 4144 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 4145 | return (jboolean)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4146 | } |
| 4147 | |
| 4148 | /* GLboolean glIsFramebuffer ( GLuint framebuffer ) */ |
| 4149 | static jboolean |
| 4150 | android_glIsFramebuffer__I |
| 4151 | (JNIEnv *_env, jobject _this, jint framebuffer) { |
| 4152 | GLboolean _returnValue; |
| 4153 | _returnValue = glIsFramebuffer( |
| 4154 | (GLuint)framebuffer |
| 4155 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 4156 | return (jboolean)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4157 | } |
| 4158 | |
| 4159 | /* GLboolean glIsProgram ( GLuint program ) */ |
| 4160 | static jboolean |
| 4161 | android_glIsProgram__I |
| 4162 | (JNIEnv *_env, jobject _this, jint program) { |
| 4163 | GLboolean _returnValue; |
| 4164 | _returnValue = glIsProgram( |
| 4165 | (GLuint)program |
| 4166 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 4167 | return (jboolean)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4168 | } |
| 4169 | |
| 4170 | /* GLboolean glIsRenderbuffer ( GLuint renderbuffer ) */ |
| 4171 | static jboolean |
| 4172 | android_glIsRenderbuffer__I |
| 4173 | (JNIEnv *_env, jobject _this, jint renderbuffer) { |
| 4174 | GLboolean _returnValue; |
| 4175 | _returnValue = glIsRenderbuffer( |
| 4176 | (GLuint)renderbuffer |
| 4177 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 4178 | return (jboolean)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4179 | } |
| 4180 | |
| 4181 | /* GLboolean glIsShader ( GLuint shader ) */ |
| 4182 | static jboolean |
| 4183 | android_glIsShader__I |
| 4184 | (JNIEnv *_env, jobject _this, jint shader) { |
| 4185 | GLboolean _returnValue; |
| 4186 | _returnValue = glIsShader( |
| 4187 | (GLuint)shader |
| 4188 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 4189 | return (jboolean)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4190 | } |
| 4191 | |
| 4192 | /* GLboolean glIsTexture ( GLuint texture ) */ |
| 4193 | static jboolean |
| 4194 | android_glIsTexture__I |
| 4195 | (JNIEnv *_env, jobject _this, jint texture) { |
| 4196 | GLboolean _returnValue; |
| 4197 | _returnValue = glIsTexture( |
| 4198 | (GLuint)texture |
| 4199 | ); |
Andy McFadden | cee5198 | 2013-04-25 16:08:31 -0700 | [diff] [blame] | 4200 | return (jboolean)_returnValue; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4201 | } |
| 4202 | |
| 4203 | /* void glLineWidth ( GLfloat width ) */ |
| 4204 | static void |
| 4205 | android_glLineWidth__F |
| 4206 | (JNIEnv *_env, jobject _this, jfloat width) { |
| 4207 | glLineWidth( |
| 4208 | (GLfloat)width |
| 4209 | ); |
| 4210 | } |
| 4211 | |
| 4212 | /* void glLinkProgram ( GLuint program ) */ |
| 4213 | static void |
| 4214 | android_glLinkProgram__I |
| 4215 | (JNIEnv *_env, jobject _this, jint program) { |
| 4216 | glLinkProgram( |
| 4217 | (GLuint)program |
| 4218 | ); |
| 4219 | } |
| 4220 | |
| 4221 | /* void glPixelStorei ( GLenum pname, GLint param ) */ |
| 4222 | static void |
| 4223 | android_glPixelStorei__II |
| 4224 | (JNIEnv *_env, jobject _this, jint pname, jint param) { |
| 4225 | glPixelStorei( |
| 4226 | (GLenum)pname, |
| 4227 | (GLint)param |
| 4228 | ); |
| 4229 | } |
| 4230 | |
| 4231 | /* void glPolygonOffset ( GLfloat factor, GLfloat units ) */ |
| 4232 | static void |
| 4233 | android_glPolygonOffset__FF |
| 4234 | (JNIEnv *_env, jobject _this, jfloat factor, jfloat units) { |
| 4235 | glPolygonOffset( |
| 4236 | (GLfloat)factor, |
| 4237 | (GLfloat)units |
| 4238 | ); |
| 4239 | } |
| 4240 | |
| 4241 | /* void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) */ |
| 4242 | static void |
| 4243 | android_glReadPixels__IIIIIILjava_nio_Buffer_2 |
| 4244 | (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height, jint format, jint type, jobject pixels_buf) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4245 | jint _exception = 0; |
| 4246 | const char * _exceptionType = NULL; |
| 4247 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4248 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4249 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4250 | jint _remaining; |
| 4251 | GLvoid *pixels = (GLvoid *) 0; |
| 4252 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4253 | if (!pixels_buf) { |
| 4254 | _exception = 1; |
| 4255 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4256 | _exceptionMessage = "pixels == null"; |
| 4257 | goto exit; |
| 4258 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4259 | pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4260 | if (pixels == NULL) { |
| 4261 | char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 4262 | pixels = (GLvoid *) (_pixelsBase + _bufferOffset); |
| 4263 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4264 | glReadPixels( |
| 4265 | (GLint)x, |
| 4266 | (GLint)y, |
| 4267 | (GLsizei)width, |
| 4268 | (GLsizei)height, |
| 4269 | (GLenum)format, |
| 4270 | (GLenum)type, |
| 4271 | (GLvoid *)pixels |
| 4272 | ); |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4273 | |
| 4274 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4275 | if (_array) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4276 | releasePointer(_env, _array, pixels, _exception ? JNI_FALSE : JNI_TRUE); |
| 4277 | } |
| 4278 | if (_exception) { |
| 4279 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4280 | } |
| 4281 | } |
| 4282 | |
| 4283 | /* void glReleaseShaderCompiler ( void ) */ |
| 4284 | static void |
| 4285 | android_glReleaseShaderCompiler__ |
| 4286 | (JNIEnv *_env, jobject _this) { |
| 4287 | glReleaseShaderCompiler(); |
| 4288 | } |
| 4289 | |
| 4290 | /* void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) */ |
| 4291 | static void |
| 4292 | android_glRenderbufferStorage__IIII |
| 4293 | (JNIEnv *_env, jobject _this, jint target, jint internalformat, jint width, jint height) { |
| 4294 | glRenderbufferStorage( |
| 4295 | (GLenum)target, |
| 4296 | (GLenum)internalformat, |
| 4297 | (GLsizei)width, |
| 4298 | (GLsizei)height |
| 4299 | ); |
| 4300 | } |
| 4301 | |
| 4302 | /* void glSampleCoverage ( GLclampf value, GLboolean invert ) */ |
| 4303 | static void |
| 4304 | android_glSampleCoverage__FZ |
| 4305 | (JNIEnv *_env, jobject _this, jfloat value, jboolean invert) { |
| 4306 | glSampleCoverage( |
| 4307 | (GLclampf)value, |
| 4308 | (GLboolean)invert |
| 4309 | ); |
| 4310 | } |
| 4311 | |
| 4312 | /* void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) */ |
| 4313 | static void |
| 4314 | android_glScissor__IIII |
| 4315 | (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) { |
| 4316 | glScissor( |
| 4317 | (GLint)x, |
| 4318 | (GLint)y, |
| 4319 | (GLsizei)width, |
| 4320 | (GLsizei)height |
| 4321 | ); |
| 4322 | } |
| 4323 | |
| 4324 | /* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */ |
| 4325 | static void |
| 4326 | android_glShaderBinary__I_3IIILjava_nio_Buffer_2I |
| 4327 | (JNIEnv *_env, jobject _this, jint n, jintArray shaders_ref, jint offset, jint binaryformat, jobject binary_buf, jint length) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4328 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4329 | const char * _exceptionType = NULL; |
| 4330 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4331 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4332 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4333 | GLuint *shaders_base = (GLuint *) 0; |
| 4334 | jint _shadersRemaining; |
| 4335 | GLuint *shaders = (GLuint *) 0; |
| 4336 | jint _binaryRemaining; |
| 4337 | GLvoid *binary = (GLvoid *) 0; |
| 4338 | |
| 4339 | if (!shaders_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4340 | _exception = 1; |
| 4341 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4342 | _exceptionMessage = "shaders == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4343 | goto exit; |
| 4344 | } |
| 4345 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4346 | _exception = 1; |
| 4347 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4348 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4349 | goto exit; |
| 4350 | } |
| 4351 | _shadersRemaining = _env->GetArrayLength(shaders_ref) - offset; |
| 4352 | shaders_base = (GLuint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4353 | _env->GetIntArrayElements(shaders_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4354 | shaders = shaders_base + offset; |
| 4355 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4356 | if (!binary_buf) { |
| 4357 | _exception = 1; |
| 4358 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4359 | _exceptionMessage = "binary == null"; |
| 4360 | goto exit; |
| 4361 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4362 | binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_array, &_binaryRemaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4363 | if (_binaryRemaining < length) { |
| 4364 | _exception = 1; |
| 4365 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4366 | _exceptionMessage = "remaining() < length < needed"; |
| 4367 | goto exit; |
| 4368 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4369 | if (binary == NULL) { |
| 4370 | char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 4371 | binary = (GLvoid *) (_binaryBase + _bufferOffset); |
| 4372 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4373 | glShaderBinary( |
| 4374 | (GLsizei)n, |
| 4375 | (GLuint *)shaders, |
| 4376 | (GLenum)binaryformat, |
| 4377 | (GLvoid *)binary, |
| 4378 | (GLsizei)length |
| 4379 | ); |
| 4380 | |
| 4381 | exit: |
| 4382 | if (_array) { |
| 4383 | releasePointer(_env, _array, binary, JNI_FALSE); |
| 4384 | } |
| 4385 | if (shaders_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4386 | _env->ReleaseIntArrayElements(shaders_ref, (jint*)shaders_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4387 | JNI_ABORT); |
| 4388 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4389 | if (_exception) { |
| 4390 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4391 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4392 | } |
| 4393 | |
| 4394 | /* void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) */ |
| 4395 | static void |
| 4396 | android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I |
| 4397 | (JNIEnv *_env, jobject _this, jint n, jobject shaders_buf, jint binaryformat, jobject binary_buf, jint length) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4398 | jint _exception = 0; |
| 4399 | const char * _exceptionType = NULL; |
| 4400 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4401 | jintArray _shadersArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4402 | jint _shadersBufferOffset = (jint) 0; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4403 | jintArray _binaryArray = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4404 | jint _binaryBufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4405 | jint _shadersRemaining; |
| 4406 | GLuint *shaders = (GLuint *) 0; |
| 4407 | jint _binaryRemaining; |
| 4408 | GLvoid *binary = (GLvoid *) 0; |
| 4409 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4410 | if (!shaders_buf) { |
| 4411 | _exception = 1; |
| 4412 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4413 | _exceptionMessage = "shaders == null"; |
| 4414 | goto exit; |
| 4415 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4416 | shaders = (GLuint *)getPointer(_env, shaders_buf, (jarray*)&_shadersArray, &_shadersRemaining, &_shadersBufferOffset); |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4417 | if (!binary_buf) { |
| 4418 | _exception = 1; |
| 4419 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4420 | _exceptionMessage = "binary == null"; |
| 4421 | goto exit; |
| 4422 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4423 | binary = (GLvoid *)getPointer(_env, binary_buf, (jarray*)&_binaryArray, &_binaryRemaining, &_binaryBufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4424 | if (_binaryRemaining < length) { |
| 4425 | _exception = 1; |
| 4426 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4427 | _exceptionMessage = "remaining() < length < needed"; |
| 4428 | goto exit; |
| 4429 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4430 | if (shaders == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4431 | char * _shadersBase = (char *)_env->GetIntArrayElements(_shadersArray, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4432 | shaders = (GLuint *) (_shadersBase + _shadersBufferOffset); |
| 4433 | } |
| 4434 | if (binary == NULL) { |
| 4435 | char * _binaryBase = (char *)_env->GetPrimitiveArrayCritical(_binaryArray, (jboolean *) 0); |
| 4436 | binary = (GLvoid *) (_binaryBase + _binaryBufferOffset); |
| 4437 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4438 | glShaderBinary( |
| 4439 | (GLsizei)n, |
| 4440 | (GLuint *)shaders, |
| 4441 | (GLenum)binaryformat, |
| 4442 | (GLvoid *)binary, |
| 4443 | (GLsizei)length |
| 4444 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4445 | |
| 4446 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4447 | if (_binaryArray) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4448 | releasePointer(_env, _binaryArray, binary, JNI_FALSE); |
| 4449 | } |
| 4450 | if (_shadersArray) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4451 | _env->ReleaseIntArrayElements(_shadersArray, (jint*)shaders, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4452 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4453 | if (_exception) { |
| 4454 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4455 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4456 | } |
| 4457 | |
| 4458 | |
| 4459 | /* void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint * length ) */ |
| 4460 | static |
| 4461 | void |
| 4462 | android_glShaderSource |
| 4463 | (JNIEnv *_env, jobject _this, jint shader, jstring string) { |
| 4464 | |
| 4465 | if (!string) { |
Elliott Hughes | 24ce5fb | 2011-04-08 20:01:01 -0700 | [diff] [blame] | 4466 | jniThrowException(_env, "java/lang/IllegalArgumentException", "string == null"); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4467 | return; |
| 4468 | } |
| 4469 | |
| 4470 | const char* nativeString = _env->GetStringUTFChars(string, 0); |
| 4471 | const char* strings[] = {nativeString}; |
| 4472 | glShaderSource(shader, 1, strings, 0); |
| 4473 | _env->ReleaseStringUTFChars(string, nativeString); |
| 4474 | } |
| 4475 | /* void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) */ |
| 4476 | static void |
| 4477 | android_glStencilFunc__III |
| 4478 | (JNIEnv *_env, jobject _this, jint func, jint ref, jint mask) { |
| 4479 | glStencilFunc( |
| 4480 | (GLenum)func, |
| 4481 | (GLint)ref, |
| 4482 | (GLuint)mask |
| 4483 | ); |
| 4484 | } |
| 4485 | |
| 4486 | /* void glStencilFuncSeparate ( GLenum face, GLenum func, GLint ref, GLuint mask ) */ |
| 4487 | static void |
| 4488 | android_glStencilFuncSeparate__IIII |
| 4489 | (JNIEnv *_env, jobject _this, jint face, jint func, jint ref, jint mask) { |
| 4490 | glStencilFuncSeparate( |
| 4491 | (GLenum)face, |
| 4492 | (GLenum)func, |
| 4493 | (GLint)ref, |
| 4494 | (GLuint)mask |
| 4495 | ); |
| 4496 | } |
| 4497 | |
| 4498 | /* void glStencilMask ( GLuint mask ) */ |
| 4499 | static void |
| 4500 | android_glStencilMask__I |
| 4501 | (JNIEnv *_env, jobject _this, jint mask) { |
| 4502 | glStencilMask( |
| 4503 | (GLuint)mask |
| 4504 | ); |
| 4505 | } |
| 4506 | |
| 4507 | /* void glStencilMaskSeparate ( GLenum face, GLuint mask ) */ |
| 4508 | static void |
| 4509 | android_glStencilMaskSeparate__II |
| 4510 | (JNIEnv *_env, jobject _this, jint face, jint mask) { |
| 4511 | glStencilMaskSeparate( |
| 4512 | (GLenum)face, |
| 4513 | (GLuint)mask |
| 4514 | ); |
| 4515 | } |
| 4516 | |
| 4517 | /* void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) */ |
| 4518 | static void |
| 4519 | android_glStencilOp__III |
| 4520 | (JNIEnv *_env, jobject _this, jint fail, jint zfail, jint zpass) { |
| 4521 | glStencilOp( |
| 4522 | (GLenum)fail, |
| 4523 | (GLenum)zfail, |
| 4524 | (GLenum)zpass |
| 4525 | ); |
| 4526 | } |
| 4527 | |
| 4528 | /* void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) */ |
| 4529 | static void |
| 4530 | android_glStencilOpSeparate__IIII |
| 4531 | (JNIEnv *_env, jobject _this, jint face, jint fail, jint zfail, jint zpass) { |
| 4532 | glStencilOpSeparate( |
| 4533 | (GLenum)face, |
| 4534 | (GLenum)fail, |
| 4535 | (GLenum)zfail, |
| 4536 | (GLenum)zpass |
| 4537 | ); |
| 4538 | } |
| 4539 | |
| 4540 | /* void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) */ |
| 4541 | static void |
| 4542 | android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 |
| 4543 | (JNIEnv *_env, jobject _this, jint target, jint level, jint internalformat, jint width, jint height, jint border, jint format, jint type, jobject pixels_buf) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4544 | jint _exception = 0; |
| 4545 | const char * _exceptionType = NULL; |
| 4546 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4547 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4548 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4549 | jint _remaining; |
| 4550 | GLvoid *pixels = (GLvoid *) 0; |
| 4551 | |
| 4552 | if (pixels_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4553 | pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4554 | } |
Thomas Tafertshofer | 37c9b49 | 2012-07-23 16:56:04 -0700 | [diff] [blame] | 4555 | if (pixels_buf && pixels == NULL) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4556 | char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 4557 | pixels = (GLvoid *) (_pixelsBase + _bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4558 | } |
| 4559 | glTexImage2D( |
| 4560 | (GLenum)target, |
| 4561 | (GLint)level, |
| 4562 | (GLint)internalformat, |
| 4563 | (GLsizei)width, |
| 4564 | (GLsizei)height, |
| 4565 | (GLint)border, |
| 4566 | (GLenum)format, |
| 4567 | (GLenum)type, |
| 4568 | (GLvoid *)pixels |
| 4569 | ); |
| 4570 | if (_array) { |
| 4571 | releasePointer(_env, _array, pixels, JNI_FALSE); |
| 4572 | } |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4573 | if (_exception) { |
| 4574 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4575 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4576 | } |
| 4577 | |
| 4578 | /* void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) */ |
| 4579 | static void |
| 4580 | android_glTexParameterf__IIF |
| 4581 | (JNIEnv *_env, jobject _this, jint target, jint pname, jfloat param) { |
| 4582 | glTexParameterf( |
| 4583 | (GLenum)target, |
| 4584 | (GLenum)pname, |
| 4585 | (GLfloat)param |
| 4586 | ); |
| 4587 | } |
| 4588 | |
| 4589 | /* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */ |
| 4590 | static void |
| 4591 | android_glTexParameterfv__II_3FI |
| 4592 | (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] | 4593 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4594 | const char * _exceptionType = NULL; |
| 4595 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4596 | GLfloat *params_base = (GLfloat *) 0; |
| 4597 | jint _remaining; |
| 4598 | GLfloat *params = (GLfloat *) 0; |
| 4599 | |
| 4600 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4601 | _exception = 1; |
| 4602 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4603 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4604 | goto exit; |
| 4605 | } |
| 4606 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4607 | _exception = 1; |
| 4608 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4609 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4610 | goto exit; |
| 4611 | } |
| 4612 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 4613 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4614 | _exception = 1; |
| 4615 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4616 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4617 | goto exit; |
| 4618 | } |
| 4619 | params_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4620 | _env->GetFloatArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4621 | params = params_base + offset; |
| 4622 | |
| 4623 | glTexParameterfv( |
| 4624 | (GLenum)target, |
| 4625 | (GLenum)pname, |
| 4626 | (GLfloat *)params |
| 4627 | ); |
| 4628 | |
| 4629 | exit: |
| 4630 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4631 | _env->ReleaseFloatArrayElements(params_ref, (jfloat*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4632 | JNI_ABORT); |
| 4633 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4634 | if (_exception) { |
| 4635 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4636 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4637 | } |
| 4638 | |
| 4639 | /* void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) */ |
| 4640 | static void |
| 4641 | android_glTexParameterfv__IILjava_nio_FloatBuffer_2 |
| 4642 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4643 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4644 | const char * _exceptionType = NULL; |
| 4645 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4646 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4647 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4648 | jint _remaining; |
| 4649 | GLfloat *params = (GLfloat *) 0; |
| 4650 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4651 | if (!params_buf) { |
| 4652 | _exception = 1; |
| 4653 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4654 | _exceptionMessage = "params == null"; |
| 4655 | goto exit; |
| 4656 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4657 | params = (GLfloat *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4658 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4659 | _exception = 1; |
| 4660 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4661 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4662 | goto exit; |
| 4663 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4664 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4665 | char * _paramsBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4666 | params = (GLfloat *) (_paramsBase + _bufferOffset); |
| 4667 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4668 | glTexParameterfv( |
| 4669 | (GLenum)target, |
| 4670 | (GLenum)pname, |
| 4671 | (GLfloat *)params |
| 4672 | ); |
| 4673 | |
| 4674 | exit: |
| 4675 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4676 | _env->ReleaseFloatArrayElements(_array, (jfloat*)params, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4677 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4678 | if (_exception) { |
| 4679 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4680 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4681 | } |
| 4682 | |
| 4683 | /* void glTexParameteri ( GLenum target, GLenum pname, GLint param ) */ |
| 4684 | static void |
| 4685 | android_glTexParameteri__III |
| 4686 | (JNIEnv *_env, jobject _this, jint target, jint pname, jint param) { |
| 4687 | glTexParameteri( |
| 4688 | (GLenum)target, |
| 4689 | (GLenum)pname, |
| 4690 | (GLint)param |
| 4691 | ); |
| 4692 | } |
| 4693 | |
| 4694 | /* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */ |
| 4695 | static void |
| 4696 | android_glTexParameteriv__II_3II |
| 4697 | (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] | 4698 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4699 | const char * _exceptionType = NULL; |
| 4700 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4701 | GLint *params_base = (GLint *) 0; |
| 4702 | jint _remaining; |
| 4703 | GLint *params = (GLint *) 0; |
| 4704 | |
| 4705 | if (!params_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4706 | _exception = 1; |
| 4707 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4708 | _exceptionMessage = "params == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4709 | goto exit; |
| 4710 | } |
| 4711 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4712 | _exception = 1; |
| 4713 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4714 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4715 | goto exit; |
| 4716 | } |
| 4717 | _remaining = _env->GetArrayLength(params_ref) - offset; |
| 4718 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4719 | _exception = 1; |
| 4720 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4721 | _exceptionMessage = "length - offset < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4722 | goto exit; |
| 4723 | } |
| 4724 | params_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4725 | _env->GetIntArrayElements(params_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4726 | params = params_base + offset; |
| 4727 | |
| 4728 | glTexParameteriv( |
| 4729 | (GLenum)target, |
| 4730 | (GLenum)pname, |
| 4731 | (GLint *)params |
| 4732 | ); |
| 4733 | |
| 4734 | exit: |
| 4735 | if (params_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4736 | _env->ReleaseIntArrayElements(params_ref, (jint*)params_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4737 | JNI_ABORT); |
| 4738 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4739 | if (_exception) { |
| 4740 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4741 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4742 | } |
| 4743 | |
| 4744 | /* void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) */ |
| 4745 | static void |
| 4746 | android_glTexParameteriv__IILjava_nio_IntBuffer_2 |
| 4747 | (JNIEnv *_env, jobject _this, jint target, jint pname, jobject params_buf) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4748 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4749 | const char * _exceptionType = NULL; |
| 4750 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4751 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4752 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4753 | jint _remaining; |
| 4754 | GLint *params = (GLint *) 0; |
| 4755 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4756 | if (!params_buf) { |
| 4757 | _exception = 1; |
| 4758 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4759 | _exceptionMessage = "params == null"; |
| 4760 | goto exit; |
| 4761 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4762 | params = (GLint *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4763 | if (_remaining < 1) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4764 | _exception = 1; |
| 4765 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4766 | _exceptionMessage = "remaining() < 1 < needed"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4767 | goto exit; |
| 4768 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4769 | if (params == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4770 | char * _paramsBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4771 | params = (GLint *) (_paramsBase + _bufferOffset); |
| 4772 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4773 | glTexParameteriv( |
| 4774 | (GLenum)target, |
| 4775 | (GLenum)pname, |
| 4776 | (GLint *)params |
| 4777 | ); |
| 4778 | |
| 4779 | exit: |
| 4780 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4781 | _env->ReleaseIntArrayElements(_array, (jint*)params, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4782 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4783 | if (_exception) { |
| 4784 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4785 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4786 | } |
| 4787 | |
| 4788 | /* void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) */ |
| 4789 | static void |
| 4790 | android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 |
| 4791 | (JNIEnv *_env, jobject _this, jint target, jint level, jint xoffset, jint yoffset, jint width, jint height, jint format, jint type, jobject pixels_buf) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4792 | jint _exception = 0; |
| 4793 | const char * _exceptionType = NULL; |
| 4794 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4795 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4796 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4797 | jint _remaining; |
| 4798 | GLvoid *pixels = (GLvoid *) 0; |
| 4799 | |
| 4800 | if (pixels_buf) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4801 | pixels = (GLvoid *)getPointer(_env, pixels_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4802 | } |
Thomas Tafertshofer | 37c9b49 | 2012-07-23 16:56:04 -0700 | [diff] [blame] | 4803 | if (pixels_buf && pixels == NULL) { |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4804 | char * _pixelsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); |
| 4805 | pixels = (GLvoid *) (_pixelsBase + _bufferOffset); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4806 | } |
| 4807 | glTexSubImage2D( |
| 4808 | (GLenum)target, |
| 4809 | (GLint)level, |
| 4810 | (GLint)xoffset, |
| 4811 | (GLint)yoffset, |
| 4812 | (GLsizei)width, |
| 4813 | (GLsizei)height, |
| 4814 | (GLenum)format, |
| 4815 | (GLenum)type, |
| 4816 | (GLvoid *)pixels |
| 4817 | ); |
| 4818 | if (_array) { |
| 4819 | releasePointer(_env, _array, pixels, JNI_FALSE); |
| 4820 | } |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4821 | if (_exception) { |
| 4822 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4823 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4824 | } |
| 4825 | |
| 4826 | /* void glUniform1f ( GLint location, GLfloat x ) */ |
| 4827 | static void |
| 4828 | android_glUniform1f__IF |
| 4829 | (JNIEnv *_env, jobject _this, jint location, jfloat x) { |
| 4830 | glUniform1f( |
| 4831 | (GLint)location, |
| 4832 | (GLfloat)x |
| 4833 | ); |
| 4834 | } |
| 4835 | |
| 4836 | /* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 4837 | static void |
| 4838 | android_glUniform1fv__II_3FI |
| 4839 | (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4840 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4841 | const char * _exceptionType = NULL; |
| 4842 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4843 | GLfloat *v_base = (GLfloat *) 0; |
| 4844 | jint _remaining; |
| 4845 | GLfloat *v = (GLfloat *) 0; |
| 4846 | |
| 4847 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4848 | _exception = 1; |
| 4849 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4850 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4851 | goto exit; |
| 4852 | } |
| 4853 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4854 | _exception = 1; |
| 4855 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4856 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4857 | goto exit; |
| 4858 | } |
| 4859 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4860 | if (_remaining < count) { |
| 4861 | _exception = 1; |
| 4862 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4863 | _exceptionMessage = "length - offset < count < needed"; |
| 4864 | goto exit; |
| 4865 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4866 | v_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4867 | _env->GetFloatArrayElements(v_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4868 | v = v_base + offset; |
| 4869 | |
| 4870 | glUniform1fv( |
| 4871 | (GLint)location, |
| 4872 | (GLsizei)count, |
| 4873 | (GLfloat *)v |
| 4874 | ); |
| 4875 | |
| 4876 | exit: |
| 4877 | if (v_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4878 | _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4879 | JNI_ABORT); |
| 4880 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4881 | if (_exception) { |
| 4882 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4883 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4884 | } |
| 4885 | |
| 4886 | /* void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 4887 | static void |
| 4888 | android_glUniform1fv__IILjava_nio_FloatBuffer_2 |
| 4889 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4890 | jint _exception = 0; |
| 4891 | const char * _exceptionType = NULL; |
| 4892 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4893 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4894 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4895 | jint _remaining; |
| 4896 | GLfloat *v = (GLfloat *) 0; |
| 4897 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 4898 | if (!v_buf) { |
| 4899 | _exception = 1; |
| 4900 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4901 | _exceptionMessage = "v == null"; |
| 4902 | goto exit; |
| 4903 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4904 | v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4905 | if (_remaining < count) { |
| 4906 | _exception = 1; |
| 4907 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4908 | _exceptionMessage = "remaining() < count < needed"; |
| 4909 | goto exit; |
| 4910 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4911 | if (v == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4912 | char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4913 | v = (GLfloat *) (_vBase + _bufferOffset); |
| 4914 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4915 | glUniform1fv( |
| 4916 | (GLint)location, |
| 4917 | (GLsizei)count, |
| 4918 | (GLfloat *)v |
| 4919 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4920 | |
| 4921 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4922 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4923 | _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4924 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4925 | if (_exception) { |
| 4926 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4927 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4928 | } |
| 4929 | |
| 4930 | /* void glUniform1i ( GLint location, GLint x ) */ |
| 4931 | static void |
| 4932 | android_glUniform1i__II |
| 4933 | (JNIEnv *_env, jobject _this, jint location, jint x) { |
| 4934 | glUniform1i( |
| 4935 | (GLint)location, |
| 4936 | (GLint)x |
| 4937 | ); |
| 4938 | } |
| 4939 | |
| 4940 | /* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 4941 | static void |
| 4942 | android_glUniform1iv__II_3II |
| 4943 | (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4944 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4945 | const char * _exceptionType = NULL; |
| 4946 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4947 | GLint *v_base = (GLint *) 0; |
| 4948 | jint _remaining; |
| 4949 | GLint *v = (GLint *) 0; |
| 4950 | |
| 4951 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4952 | _exception = 1; |
| 4953 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4954 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4955 | goto exit; |
| 4956 | } |
| 4957 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4958 | _exception = 1; |
| 4959 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4960 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4961 | goto exit; |
| 4962 | } |
| 4963 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4964 | if (_remaining < count) { |
| 4965 | _exception = 1; |
| 4966 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 4967 | _exceptionMessage = "length - offset < count < needed"; |
| 4968 | goto exit; |
| 4969 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4970 | v_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4971 | _env->GetIntArrayElements(v_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4972 | v = v_base + offset; |
| 4973 | |
| 4974 | glUniform1iv( |
| 4975 | (GLint)location, |
| 4976 | (GLsizei)count, |
| 4977 | (GLint *)v |
| 4978 | ); |
| 4979 | |
| 4980 | exit: |
| 4981 | if (v_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4982 | _env->ReleaseIntArrayElements(v_ref, (jint*)v_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4983 | JNI_ABORT); |
| 4984 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 4985 | if (_exception) { |
| 4986 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 4987 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4988 | } |
| 4989 | |
| 4990 | /* void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 4991 | static void |
| 4992 | android_glUniform1iv__IILjava_nio_IntBuffer_2 |
| 4993 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 4994 | jint _exception = 0; |
| 4995 | const char * _exceptionType = NULL; |
| 4996 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 4997 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 4998 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 4999 | jint _remaining; |
| 5000 | GLint *v = (GLint *) 0; |
| 5001 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 5002 | if (!v_buf) { |
| 5003 | _exception = 1; |
| 5004 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5005 | _exceptionMessage = "v == null"; |
| 5006 | goto exit; |
| 5007 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5008 | v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5009 | if (_remaining < count) { |
| 5010 | _exception = 1; |
| 5011 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5012 | _exceptionMessage = "remaining() < count < needed"; |
| 5013 | goto exit; |
| 5014 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5015 | if (v == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5016 | char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5017 | v = (GLint *) (_vBase + _bufferOffset); |
| 5018 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5019 | glUniform1iv( |
| 5020 | (GLint)location, |
| 5021 | (GLsizei)count, |
| 5022 | (GLint *)v |
| 5023 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5024 | |
| 5025 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5026 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5027 | _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5028 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5029 | if (_exception) { |
| 5030 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5031 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5032 | } |
| 5033 | |
| 5034 | /* void glUniform2f ( GLint location, GLfloat x, GLfloat y ) */ |
| 5035 | static void |
| 5036 | android_glUniform2f__IFF |
| 5037 | (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y) { |
| 5038 | glUniform2f( |
| 5039 | (GLint)location, |
| 5040 | (GLfloat)x, |
| 5041 | (GLfloat)y |
| 5042 | ); |
| 5043 | } |
| 5044 | |
| 5045 | /* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 5046 | static void |
| 5047 | android_glUniform2fv__II_3FI |
| 5048 | (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5049 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5050 | const char * _exceptionType = NULL; |
| 5051 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5052 | GLfloat *v_base = (GLfloat *) 0; |
| 5053 | jint _remaining; |
| 5054 | GLfloat *v = (GLfloat *) 0; |
| 5055 | |
| 5056 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5057 | _exception = 1; |
| 5058 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5059 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5060 | goto exit; |
| 5061 | } |
| 5062 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5063 | _exception = 1; |
| 5064 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5065 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5066 | goto exit; |
| 5067 | } |
| 5068 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5069 | if (_remaining < count*2) { |
| 5070 | _exception = 1; |
| 5071 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5072 | _exceptionMessage = "length - offset < count*2 < needed"; |
| 5073 | goto exit; |
| 5074 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5075 | v_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5076 | _env->GetFloatArrayElements(v_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5077 | v = v_base + offset; |
| 5078 | |
| 5079 | glUniform2fv( |
| 5080 | (GLint)location, |
| 5081 | (GLsizei)count, |
| 5082 | (GLfloat *)v |
| 5083 | ); |
| 5084 | |
| 5085 | exit: |
| 5086 | if (v_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5087 | _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5088 | JNI_ABORT); |
| 5089 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5090 | if (_exception) { |
| 5091 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5092 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5093 | } |
| 5094 | |
| 5095 | /* void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 5096 | static void |
| 5097 | android_glUniform2fv__IILjava_nio_FloatBuffer_2 |
| 5098 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5099 | jint _exception = 0; |
| 5100 | const char * _exceptionType = NULL; |
| 5101 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5102 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5103 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5104 | jint _remaining; |
| 5105 | GLfloat *v = (GLfloat *) 0; |
| 5106 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 5107 | if (!v_buf) { |
| 5108 | _exception = 1; |
| 5109 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5110 | _exceptionMessage = "v == null"; |
| 5111 | goto exit; |
| 5112 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5113 | v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5114 | if (_remaining < count*2) { |
| 5115 | _exception = 1; |
| 5116 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5117 | _exceptionMessage = "remaining() < count*2 < needed"; |
| 5118 | goto exit; |
| 5119 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5120 | if (v == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5121 | char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5122 | v = (GLfloat *) (_vBase + _bufferOffset); |
| 5123 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5124 | glUniform2fv( |
| 5125 | (GLint)location, |
| 5126 | (GLsizei)count, |
| 5127 | (GLfloat *)v |
| 5128 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5129 | |
| 5130 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5131 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5132 | _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5133 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5134 | if (_exception) { |
| 5135 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5136 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5137 | } |
| 5138 | |
| 5139 | /* void glUniform2i ( GLint location, GLint x, GLint y ) */ |
| 5140 | static void |
| 5141 | android_glUniform2i__III |
| 5142 | (JNIEnv *_env, jobject _this, jint location, jint x, jint y) { |
| 5143 | glUniform2i( |
| 5144 | (GLint)location, |
| 5145 | (GLint)x, |
| 5146 | (GLint)y |
| 5147 | ); |
| 5148 | } |
| 5149 | |
| 5150 | /* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 5151 | static void |
| 5152 | android_glUniform2iv__II_3II |
| 5153 | (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5154 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5155 | const char * _exceptionType = NULL; |
| 5156 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5157 | GLint *v_base = (GLint *) 0; |
| 5158 | jint _remaining; |
| 5159 | GLint *v = (GLint *) 0; |
| 5160 | |
| 5161 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5162 | _exception = 1; |
| 5163 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5164 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5165 | goto exit; |
| 5166 | } |
| 5167 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5168 | _exception = 1; |
| 5169 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5170 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5171 | goto exit; |
| 5172 | } |
| 5173 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5174 | if (_remaining < count*2) { |
| 5175 | _exception = 1; |
| 5176 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5177 | _exceptionMessage = "length - offset < count*2 < needed"; |
| 5178 | goto exit; |
| 5179 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5180 | v_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5181 | _env->GetIntArrayElements(v_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5182 | v = v_base + offset; |
| 5183 | |
| 5184 | glUniform2iv( |
| 5185 | (GLint)location, |
| 5186 | (GLsizei)count, |
| 5187 | (GLint *)v |
| 5188 | ); |
| 5189 | |
| 5190 | exit: |
| 5191 | if (v_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5192 | _env->ReleaseIntArrayElements(v_ref, (jint*)v_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5193 | JNI_ABORT); |
| 5194 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5195 | if (_exception) { |
| 5196 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5197 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5198 | } |
| 5199 | |
| 5200 | /* void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 5201 | static void |
| 5202 | android_glUniform2iv__IILjava_nio_IntBuffer_2 |
| 5203 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5204 | jint _exception = 0; |
| 5205 | const char * _exceptionType = NULL; |
| 5206 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5207 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5208 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5209 | jint _remaining; |
| 5210 | GLint *v = (GLint *) 0; |
| 5211 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 5212 | if (!v_buf) { |
| 5213 | _exception = 1; |
| 5214 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5215 | _exceptionMessage = "v == null"; |
| 5216 | goto exit; |
| 5217 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5218 | v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5219 | if (_remaining < count*2) { |
| 5220 | _exception = 1; |
| 5221 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5222 | _exceptionMessage = "remaining() < count*2 < needed"; |
| 5223 | goto exit; |
| 5224 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5225 | if (v == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5226 | char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5227 | v = (GLint *) (_vBase + _bufferOffset); |
| 5228 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5229 | glUniform2iv( |
| 5230 | (GLint)location, |
| 5231 | (GLsizei)count, |
| 5232 | (GLint *)v |
| 5233 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5234 | |
| 5235 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5236 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5237 | _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5238 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5239 | if (_exception) { |
| 5240 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5241 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5242 | } |
| 5243 | |
| 5244 | /* void glUniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z ) */ |
| 5245 | static void |
| 5246 | android_glUniform3f__IFFF |
| 5247 | (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z) { |
| 5248 | glUniform3f( |
| 5249 | (GLint)location, |
| 5250 | (GLfloat)x, |
| 5251 | (GLfloat)y, |
| 5252 | (GLfloat)z |
| 5253 | ); |
| 5254 | } |
| 5255 | |
| 5256 | /* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 5257 | static void |
| 5258 | android_glUniform3fv__II_3FI |
| 5259 | (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5260 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5261 | const char * _exceptionType = NULL; |
| 5262 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5263 | GLfloat *v_base = (GLfloat *) 0; |
| 5264 | jint _remaining; |
| 5265 | GLfloat *v = (GLfloat *) 0; |
| 5266 | |
| 5267 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5268 | _exception = 1; |
| 5269 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5270 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5271 | goto exit; |
| 5272 | } |
| 5273 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5274 | _exception = 1; |
| 5275 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5276 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5277 | goto exit; |
| 5278 | } |
| 5279 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5280 | if (_remaining < count*3) { |
| 5281 | _exception = 1; |
| 5282 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5283 | _exceptionMessage = "length - offset < count*3 < needed"; |
| 5284 | goto exit; |
| 5285 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5286 | v_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5287 | _env->GetFloatArrayElements(v_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5288 | v = v_base + offset; |
| 5289 | |
| 5290 | glUniform3fv( |
| 5291 | (GLint)location, |
| 5292 | (GLsizei)count, |
| 5293 | (GLfloat *)v |
| 5294 | ); |
| 5295 | |
| 5296 | exit: |
| 5297 | if (v_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5298 | _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5299 | JNI_ABORT); |
| 5300 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5301 | if (_exception) { |
| 5302 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5303 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5304 | } |
| 5305 | |
| 5306 | /* void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 5307 | static void |
| 5308 | android_glUniform3fv__IILjava_nio_FloatBuffer_2 |
| 5309 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5310 | jint _exception = 0; |
| 5311 | const char * _exceptionType = NULL; |
| 5312 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5313 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5314 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5315 | jint _remaining; |
| 5316 | GLfloat *v = (GLfloat *) 0; |
| 5317 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 5318 | if (!v_buf) { |
| 5319 | _exception = 1; |
| 5320 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5321 | _exceptionMessage = "v == null"; |
| 5322 | goto exit; |
| 5323 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5324 | v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5325 | if (_remaining < count*3) { |
| 5326 | _exception = 1; |
| 5327 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5328 | _exceptionMessage = "remaining() < count*3 < needed"; |
| 5329 | goto exit; |
| 5330 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5331 | if (v == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5332 | char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5333 | v = (GLfloat *) (_vBase + _bufferOffset); |
| 5334 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5335 | glUniform3fv( |
| 5336 | (GLint)location, |
| 5337 | (GLsizei)count, |
| 5338 | (GLfloat *)v |
| 5339 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5340 | |
| 5341 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5342 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5343 | _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5344 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5345 | if (_exception) { |
| 5346 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5347 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5348 | } |
| 5349 | |
| 5350 | /* void glUniform3i ( GLint location, GLint x, GLint y, GLint z ) */ |
| 5351 | static void |
| 5352 | android_glUniform3i__IIII |
| 5353 | (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z) { |
| 5354 | glUniform3i( |
| 5355 | (GLint)location, |
| 5356 | (GLint)x, |
| 5357 | (GLint)y, |
| 5358 | (GLint)z |
| 5359 | ); |
| 5360 | } |
| 5361 | |
| 5362 | /* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 5363 | static void |
| 5364 | android_glUniform3iv__II_3II |
| 5365 | (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5366 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5367 | const char * _exceptionType = NULL; |
| 5368 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5369 | GLint *v_base = (GLint *) 0; |
| 5370 | jint _remaining; |
| 5371 | GLint *v = (GLint *) 0; |
| 5372 | |
| 5373 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5374 | _exception = 1; |
| 5375 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5376 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5377 | goto exit; |
| 5378 | } |
| 5379 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5380 | _exception = 1; |
| 5381 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5382 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5383 | goto exit; |
| 5384 | } |
| 5385 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5386 | if (_remaining < count*3) { |
| 5387 | _exception = 1; |
| 5388 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5389 | _exceptionMessage = "length - offset < count*3 < needed"; |
| 5390 | goto exit; |
| 5391 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5392 | v_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5393 | _env->GetIntArrayElements(v_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5394 | v = v_base + offset; |
| 5395 | |
| 5396 | glUniform3iv( |
| 5397 | (GLint)location, |
| 5398 | (GLsizei)count, |
| 5399 | (GLint *)v |
| 5400 | ); |
| 5401 | |
| 5402 | exit: |
| 5403 | if (v_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5404 | _env->ReleaseIntArrayElements(v_ref, (jint*)v_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5405 | JNI_ABORT); |
| 5406 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5407 | if (_exception) { |
| 5408 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5409 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5410 | } |
| 5411 | |
| 5412 | /* void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 5413 | static void |
| 5414 | android_glUniform3iv__IILjava_nio_IntBuffer_2 |
| 5415 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5416 | jint _exception = 0; |
| 5417 | const char * _exceptionType = NULL; |
| 5418 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5419 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5420 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5421 | jint _remaining; |
| 5422 | GLint *v = (GLint *) 0; |
| 5423 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 5424 | if (!v_buf) { |
| 5425 | _exception = 1; |
| 5426 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5427 | _exceptionMessage = "v == null"; |
| 5428 | goto exit; |
| 5429 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5430 | v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5431 | if (_remaining < count*3) { |
| 5432 | _exception = 1; |
| 5433 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5434 | _exceptionMessage = "remaining() < count*3 < needed"; |
| 5435 | goto exit; |
| 5436 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5437 | if (v == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5438 | char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5439 | v = (GLint *) (_vBase + _bufferOffset); |
| 5440 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5441 | glUniform3iv( |
| 5442 | (GLint)location, |
| 5443 | (GLsizei)count, |
| 5444 | (GLint *)v |
| 5445 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5446 | |
| 5447 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5448 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5449 | _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5450 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5451 | if (_exception) { |
| 5452 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5453 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5454 | } |
| 5455 | |
| 5456 | /* void glUniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */ |
| 5457 | static void |
| 5458 | android_glUniform4f__IFFFF |
| 5459 | (JNIEnv *_env, jobject _this, jint location, jfloat x, jfloat y, jfloat z, jfloat w) { |
| 5460 | glUniform4f( |
| 5461 | (GLint)location, |
| 5462 | (GLfloat)x, |
| 5463 | (GLfloat)y, |
| 5464 | (GLfloat)z, |
| 5465 | (GLfloat)w |
| 5466 | ); |
| 5467 | } |
| 5468 | |
| 5469 | /* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 5470 | static void |
| 5471 | android_glUniform4fv__II_3FI |
| 5472 | (JNIEnv *_env, jobject _this, jint location, jint count, jfloatArray v_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5473 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5474 | const char * _exceptionType = NULL; |
| 5475 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5476 | GLfloat *v_base = (GLfloat *) 0; |
| 5477 | jint _remaining; |
| 5478 | GLfloat *v = (GLfloat *) 0; |
| 5479 | |
| 5480 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5481 | _exception = 1; |
| 5482 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5483 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5484 | goto exit; |
| 5485 | } |
| 5486 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5487 | _exception = 1; |
| 5488 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5489 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5490 | goto exit; |
| 5491 | } |
| 5492 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5493 | if (_remaining < count*4) { |
| 5494 | _exception = 1; |
| 5495 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5496 | _exceptionMessage = "length - offset < count*4 < needed"; |
| 5497 | goto exit; |
| 5498 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5499 | v_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5500 | _env->GetFloatArrayElements(v_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5501 | v = v_base + offset; |
| 5502 | |
| 5503 | glUniform4fv( |
| 5504 | (GLint)location, |
| 5505 | (GLsizei)count, |
| 5506 | (GLfloat *)v |
| 5507 | ); |
| 5508 | |
| 5509 | exit: |
| 5510 | if (v_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5511 | _env->ReleaseFloatArrayElements(v_ref, (jfloat*)v_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5512 | JNI_ABORT); |
| 5513 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5514 | if (_exception) { |
| 5515 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5516 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5517 | } |
| 5518 | |
| 5519 | /* void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) */ |
| 5520 | static void |
| 5521 | android_glUniform4fv__IILjava_nio_FloatBuffer_2 |
| 5522 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5523 | jint _exception = 0; |
| 5524 | const char * _exceptionType = NULL; |
| 5525 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5526 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5527 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5528 | jint _remaining; |
| 5529 | GLfloat *v = (GLfloat *) 0; |
| 5530 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 5531 | if (!v_buf) { |
| 5532 | _exception = 1; |
| 5533 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5534 | _exceptionMessage = "v == null"; |
| 5535 | goto exit; |
| 5536 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5537 | v = (GLfloat *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5538 | if (_remaining < count*4) { |
| 5539 | _exception = 1; |
| 5540 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5541 | _exceptionMessage = "remaining() < count*4 < needed"; |
| 5542 | goto exit; |
| 5543 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5544 | if (v == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5545 | char * _vBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5546 | v = (GLfloat *) (_vBase + _bufferOffset); |
| 5547 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5548 | glUniform4fv( |
| 5549 | (GLint)location, |
| 5550 | (GLsizei)count, |
| 5551 | (GLfloat *)v |
| 5552 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5553 | |
| 5554 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5555 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5556 | _env->ReleaseFloatArrayElements(_array, (jfloat*)v, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5557 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5558 | if (_exception) { |
| 5559 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5560 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5561 | } |
| 5562 | |
| 5563 | /* void glUniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w ) */ |
| 5564 | static void |
| 5565 | android_glUniform4i__IIIII |
| 5566 | (JNIEnv *_env, jobject _this, jint location, jint x, jint y, jint z, jint w) { |
| 5567 | glUniform4i( |
| 5568 | (GLint)location, |
| 5569 | (GLint)x, |
| 5570 | (GLint)y, |
| 5571 | (GLint)z, |
| 5572 | (GLint)w |
| 5573 | ); |
| 5574 | } |
| 5575 | |
| 5576 | /* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 5577 | static void |
| 5578 | android_glUniform4iv__II_3II |
| 5579 | (JNIEnv *_env, jobject _this, jint location, jint count, jintArray v_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5580 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5581 | const char * _exceptionType = NULL; |
| 5582 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5583 | GLint *v_base = (GLint *) 0; |
| 5584 | jint _remaining; |
| 5585 | GLint *v = (GLint *) 0; |
| 5586 | |
| 5587 | if (!v_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5588 | _exception = 1; |
| 5589 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5590 | _exceptionMessage = "v == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5591 | goto exit; |
| 5592 | } |
| 5593 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5594 | _exception = 1; |
| 5595 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5596 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5597 | goto exit; |
| 5598 | } |
| 5599 | _remaining = _env->GetArrayLength(v_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5600 | if (_remaining < count*4) { |
| 5601 | _exception = 1; |
| 5602 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5603 | _exceptionMessage = "length - offset < count*4 < needed"; |
| 5604 | goto exit; |
| 5605 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5606 | v_base = (GLint *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5607 | _env->GetIntArrayElements(v_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5608 | v = v_base + offset; |
| 5609 | |
| 5610 | glUniform4iv( |
| 5611 | (GLint)location, |
| 5612 | (GLsizei)count, |
| 5613 | (GLint *)v |
| 5614 | ); |
| 5615 | |
| 5616 | exit: |
| 5617 | if (v_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5618 | _env->ReleaseIntArrayElements(v_ref, (jint*)v_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5619 | JNI_ABORT); |
| 5620 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5621 | if (_exception) { |
| 5622 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5623 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5624 | } |
| 5625 | |
| 5626 | /* void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) */ |
| 5627 | static void |
| 5628 | android_glUniform4iv__IILjava_nio_IntBuffer_2 |
| 5629 | (JNIEnv *_env, jobject _this, jint location, jint count, jobject v_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5630 | jint _exception = 0; |
| 5631 | const char * _exceptionType = NULL; |
| 5632 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5633 | jintArray _array = (jintArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5634 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5635 | jint _remaining; |
| 5636 | GLint *v = (GLint *) 0; |
| 5637 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 5638 | if (!v_buf) { |
| 5639 | _exception = 1; |
| 5640 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5641 | _exceptionMessage = "v == null"; |
| 5642 | goto exit; |
| 5643 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5644 | v = (GLint *)getPointer(_env, v_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5645 | if (_remaining < count*4) { |
| 5646 | _exception = 1; |
| 5647 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5648 | _exceptionMessage = "remaining() < count*4 < needed"; |
| 5649 | goto exit; |
| 5650 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5651 | if (v == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5652 | char * _vBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5653 | v = (GLint *) (_vBase + _bufferOffset); |
| 5654 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5655 | glUniform4iv( |
| 5656 | (GLint)location, |
| 5657 | (GLsizei)count, |
| 5658 | (GLint *)v |
| 5659 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5660 | |
| 5661 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5662 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5663 | _env->ReleaseIntArrayElements(_array, (jint*)v, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5664 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5665 | if (_exception) { |
| 5666 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5667 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5668 | } |
| 5669 | |
| 5670 | /* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ |
| 5671 | static void |
| 5672 | android_glUniformMatrix2fv__IIZ_3FI |
| 5673 | (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5674 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5675 | const char * _exceptionType = NULL; |
| 5676 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5677 | GLfloat *value_base = (GLfloat *) 0; |
| 5678 | jint _remaining; |
| 5679 | GLfloat *value = (GLfloat *) 0; |
| 5680 | |
| 5681 | if (!value_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5682 | _exception = 1; |
| 5683 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5684 | _exceptionMessage = "value == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5685 | goto exit; |
| 5686 | } |
| 5687 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5688 | _exception = 1; |
| 5689 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5690 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5691 | goto exit; |
| 5692 | } |
| 5693 | _remaining = _env->GetArrayLength(value_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5694 | if (_remaining < count*4) { |
| 5695 | _exception = 1; |
| 5696 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5697 | _exceptionMessage = "length - offset < count*4 < needed"; |
| 5698 | goto exit; |
| 5699 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5700 | value_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5701 | _env->GetFloatArrayElements(value_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5702 | value = value_base + offset; |
| 5703 | |
| 5704 | glUniformMatrix2fv( |
| 5705 | (GLint)location, |
| 5706 | (GLsizei)count, |
| 5707 | (GLboolean)transpose, |
| 5708 | (GLfloat *)value |
| 5709 | ); |
| 5710 | |
| 5711 | exit: |
| 5712 | if (value_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5713 | _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5714 | JNI_ABORT); |
| 5715 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5716 | if (_exception) { |
| 5717 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5718 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5719 | } |
| 5720 | |
| 5721 | /* void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ |
| 5722 | static void |
| 5723 | android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 |
| 5724 | (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5725 | jint _exception = 0; |
| 5726 | const char * _exceptionType = NULL; |
| 5727 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5728 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5729 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5730 | jint _remaining; |
| 5731 | GLfloat *value = (GLfloat *) 0; |
| 5732 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 5733 | if (!value_buf) { |
| 5734 | _exception = 1; |
| 5735 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5736 | _exceptionMessage = "value == null"; |
| 5737 | goto exit; |
| 5738 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5739 | value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5740 | if (_remaining < count*4) { |
| 5741 | _exception = 1; |
| 5742 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5743 | _exceptionMessage = "remaining() < count*4 < needed"; |
| 5744 | goto exit; |
| 5745 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5746 | if (value == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5747 | char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5748 | value = (GLfloat *) (_valueBase + _bufferOffset); |
| 5749 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5750 | glUniformMatrix2fv( |
| 5751 | (GLint)location, |
| 5752 | (GLsizei)count, |
| 5753 | (GLboolean)transpose, |
| 5754 | (GLfloat *)value |
| 5755 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5756 | |
| 5757 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5758 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5759 | _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5760 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5761 | if (_exception) { |
| 5762 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5763 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5764 | } |
| 5765 | |
| 5766 | /* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ |
| 5767 | static void |
| 5768 | android_glUniformMatrix3fv__IIZ_3FI |
| 5769 | (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5770 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5771 | const char * _exceptionType = NULL; |
| 5772 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5773 | GLfloat *value_base = (GLfloat *) 0; |
| 5774 | jint _remaining; |
| 5775 | GLfloat *value = (GLfloat *) 0; |
| 5776 | |
| 5777 | if (!value_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5778 | _exception = 1; |
| 5779 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5780 | _exceptionMessage = "value == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5781 | goto exit; |
| 5782 | } |
| 5783 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5784 | _exception = 1; |
| 5785 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5786 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5787 | goto exit; |
| 5788 | } |
| 5789 | _remaining = _env->GetArrayLength(value_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5790 | if (_remaining < count*9) { |
| 5791 | _exception = 1; |
| 5792 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5793 | _exceptionMessage = "length - offset < count*9 < needed"; |
| 5794 | goto exit; |
| 5795 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5796 | value_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5797 | _env->GetFloatArrayElements(value_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5798 | value = value_base + offset; |
| 5799 | |
| 5800 | glUniformMatrix3fv( |
| 5801 | (GLint)location, |
| 5802 | (GLsizei)count, |
| 5803 | (GLboolean)transpose, |
| 5804 | (GLfloat *)value |
| 5805 | ); |
| 5806 | |
| 5807 | exit: |
| 5808 | if (value_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5809 | _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5810 | JNI_ABORT); |
| 5811 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5812 | if (_exception) { |
| 5813 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5814 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5815 | } |
| 5816 | |
| 5817 | /* void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ |
| 5818 | static void |
| 5819 | android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 |
| 5820 | (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5821 | jint _exception = 0; |
| 5822 | const char * _exceptionType = NULL; |
| 5823 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5824 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5825 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5826 | jint _remaining; |
| 5827 | GLfloat *value = (GLfloat *) 0; |
| 5828 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 5829 | if (!value_buf) { |
| 5830 | _exception = 1; |
| 5831 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5832 | _exceptionMessage = "value == null"; |
| 5833 | goto exit; |
| 5834 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5835 | value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5836 | if (_remaining < count*9) { |
| 5837 | _exception = 1; |
| 5838 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5839 | _exceptionMessage = "remaining() < count*9 < needed"; |
| 5840 | goto exit; |
| 5841 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5842 | if (value == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5843 | char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5844 | value = (GLfloat *) (_valueBase + _bufferOffset); |
| 5845 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5846 | glUniformMatrix3fv( |
| 5847 | (GLint)location, |
| 5848 | (GLsizei)count, |
| 5849 | (GLboolean)transpose, |
| 5850 | (GLfloat *)value |
| 5851 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5852 | |
| 5853 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5854 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5855 | _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5856 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5857 | if (_exception) { |
| 5858 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5859 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5860 | } |
| 5861 | |
| 5862 | /* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ |
| 5863 | static void |
| 5864 | android_glUniformMatrix4fv__IIZ_3FI |
| 5865 | (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jfloatArray value_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5866 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5867 | const char * _exceptionType = NULL; |
| 5868 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5869 | GLfloat *value_base = (GLfloat *) 0; |
| 5870 | jint _remaining; |
| 5871 | GLfloat *value = (GLfloat *) 0; |
| 5872 | |
| 5873 | if (!value_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5874 | _exception = 1; |
| 5875 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5876 | _exceptionMessage = "value == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5877 | goto exit; |
| 5878 | } |
| 5879 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5880 | _exception = 1; |
| 5881 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5882 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5883 | goto exit; |
| 5884 | } |
| 5885 | _remaining = _env->GetArrayLength(value_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5886 | if (_remaining < count*16) { |
| 5887 | _exception = 1; |
| 5888 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5889 | _exceptionMessage = "length - offset < count*16 < needed"; |
| 5890 | goto exit; |
| 5891 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5892 | value_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5893 | _env->GetFloatArrayElements(value_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5894 | value = value_base + offset; |
| 5895 | |
| 5896 | glUniformMatrix4fv( |
| 5897 | (GLint)location, |
| 5898 | (GLsizei)count, |
| 5899 | (GLboolean)transpose, |
| 5900 | (GLfloat *)value |
| 5901 | ); |
| 5902 | |
| 5903 | exit: |
| 5904 | if (value_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5905 | _env->ReleaseFloatArrayElements(value_ref, (jfloat*)value_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5906 | JNI_ABORT); |
| 5907 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5908 | if (_exception) { |
| 5909 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5910 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5911 | } |
| 5912 | |
| 5913 | /* void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) */ |
| 5914 | static void |
| 5915 | android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2 |
| 5916 | (JNIEnv *_env, jobject _this, jint location, jint count, jboolean transpose, jobject value_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5917 | jint _exception = 0; |
| 5918 | const char * _exceptionType = NULL; |
| 5919 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5920 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5921 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5922 | jint _remaining; |
| 5923 | GLfloat *value = (GLfloat *) 0; |
| 5924 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 5925 | if (!value_buf) { |
| 5926 | _exception = 1; |
| 5927 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5928 | _exceptionMessage = "value == null"; |
| 5929 | goto exit; |
| 5930 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5931 | value = (GLfloat *)getPointer(_env, value_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5932 | if (_remaining < count*16) { |
| 5933 | _exception = 1; |
| 5934 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 5935 | _exceptionMessage = "remaining() < count*16 < needed"; |
| 5936 | goto exit; |
| 5937 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5938 | if (value == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5939 | char * _valueBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 5940 | value = (GLfloat *) (_valueBase + _bufferOffset); |
| 5941 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5942 | glUniformMatrix4fv( |
| 5943 | (GLint)location, |
| 5944 | (GLsizei)count, |
| 5945 | (GLboolean)transpose, |
| 5946 | (GLfloat *)value |
| 5947 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5948 | |
| 5949 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5950 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 5951 | _env->ReleaseFloatArrayElements(_array, (jfloat*)value, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5952 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5953 | if (_exception) { |
| 5954 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 5955 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5956 | } |
| 5957 | |
| 5958 | /* void glUseProgram ( GLuint program ) */ |
| 5959 | static void |
| 5960 | android_glUseProgram__I |
| 5961 | (JNIEnv *_env, jobject _this, jint program) { |
| 5962 | glUseProgram( |
| 5963 | (GLuint)program |
| 5964 | ); |
| 5965 | } |
| 5966 | |
| 5967 | /* void glValidateProgram ( GLuint program ) */ |
| 5968 | static void |
| 5969 | android_glValidateProgram__I |
| 5970 | (JNIEnv *_env, jobject _this, jint program) { |
| 5971 | glValidateProgram( |
| 5972 | (GLuint)program |
| 5973 | ); |
| 5974 | } |
| 5975 | |
| 5976 | /* void glVertexAttrib1f ( GLuint indx, GLfloat x ) */ |
| 5977 | static void |
| 5978 | android_glVertexAttrib1f__IF |
| 5979 | (JNIEnv *_env, jobject _this, jint indx, jfloat x) { |
| 5980 | glVertexAttrib1f( |
| 5981 | (GLuint)indx, |
| 5982 | (GLfloat)x |
| 5983 | ); |
| 5984 | } |
| 5985 | |
| 5986 | /* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */ |
| 5987 | static void |
| 5988 | android_glVertexAttrib1fv__I_3FI |
| 5989 | (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5990 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 5991 | const char * _exceptionType = NULL; |
| 5992 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 5993 | GLfloat *values_base = (GLfloat *) 0; |
| 5994 | jint _remaining; |
| 5995 | GLfloat *values = (GLfloat *) 0; |
| 5996 | |
| 5997 | if (!values_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 5998 | _exception = 1; |
| 5999 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6000 | _exceptionMessage = "values == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6001 | goto exit; |
| 6002 | } |
| 6003 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6004 | _exception = 1; |
| 6005 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6006 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6007 | goto exit; |
| 6008 | } |
| 6009 | _remaining = _env->GetArrayLength(values_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6010 | if (_remaining < 1) { |
| 6011 | _exception = 1; |
| 6012 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6013 | _exceptionMessage = "length - offset < 1 < needed"; |
| 6014 | goto exit; |
| 6015 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6016 | values_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6017 | _env->GetFloatArrayElements(values_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6018 | values = values_base + offset; |
| 6019 | |
| 6020 | glVertexAttrib1fv( |
| 6021 | (GLuint)indx, |
| 6022 | (GLfloat *)values |
| 6023 | ); |
| 6024 | |
| 6025 | exit: |
| 6026 | if (values_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6027 | _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6028 | JNI_ABORT); |
| 6029 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6030 | if (_exception) { |
| 6031 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 6032 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6033 | } |
| 6034 | |
| 6035 | /* void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) */ |
| 6036 | static void |
| 6037 | android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2 |
| 6038 | (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6039 | jint _exception = 0; |
| 6040 | const char * _exceptionType = NULL; |
| 6041 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6042 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6043 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6044 | jint _remaining; |
| 6045 | GLfloat *values = (GLfloat *) 0; |
| 6046 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 6047 | if (!values_buf) { |
| 6048 | _exception = 1; |
| 6049 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6050 | _exceptionMessage = "values == null"; |
| 6051 | goto exit; |
| 6052 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6053 | values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6054 | if (_remaining < 1) { |
| 6055 | _exception = 1; |
| 6056 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6057 | _exceptionMessage = "remaining() < 1 < needed"; |
| 6058 | goto exit; |
| 6059 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6060 | if (values == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6061 | char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6062 | values = (GLfloat *) (_valuesBase + _bufferOffset); |
| 6063 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6064 | glVertexAttrib1fv( |
| 6065 | (GLuint)indx, |
| 6066 | (GLfloat *)values |
| 6067 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6068 | |
| 6069 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6070 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6071 | _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6072 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6073 | if (_exception) { |
| 6074 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 6075 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6076 | } |
| 6077 | |
| 6078 | /* void glVertexAttrib2f ( GLuint indx, GLfloat x, GLfloat y ) */ |
| 6079 | static void |
| 6080 | android_glVertexAttrib2f__IFF |
| 6081 | (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y) { |
| 6082 | glVertexAttrib2f( |
| 6083 | (GLuint)indx, |
| 6084 | (GLfloat)x, |
| 6085 | (GLfloat)y |
| 6086 | ); |
| 6087 | } |
| 6088 | |
| 6089 | /* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */ |
| 6090 | static void |
| 6091 | android_glVertexAttrib2fv__I_3FI |
| 6092 | (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6093 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6094 | const char * _exceptionType = NULL; |
| 6095 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6096 | GLfloat *values_base = (GLfloat *) 0; |
| 6097 | jint _remaining; |
| 6098 | GLfloat *values = (GLfloat *) 0; |
| 6099 | |
| 6100 | if (!values_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6101 | _exception = 1; |
| 6102 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6103 | _exceptionMessage = "values == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6104 | goto exit; |
| 6105 | } |
| 6106 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6107 | _exception = 1; |
| 6108 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6109 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6110 | goto exit; |
| 6111 | } |
| 6112 | _remaining = _env->GetArrayLength(values_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6113 | if (_remaining < 2) { |
| 6114 | _exception = 1; |
| 6115 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6116 | _exceptionMessage = "length - offset < 2 < needed"; |
| 6117 | goto exit; |
| 6118 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6119 | values_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6120 | _env->GetFloatArrayElements(values_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6121 | values = values_base + offset; |
| 6122 | |
| 6123 | glVertexAttrib2fv( |
| 6124 | (GLuint)indx, |
| 6125 | (GLfloat *)values |
| 6126 | ); |
| 6127 | |
| 6128 | exit: |
| 6129 | if (values_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6130 | _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6131 | JNI_ABORT); |
| 6132 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6133 | if (_exception) { |
| 6134 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 6135 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6136 | } |
| 6137 | |
| 6138 | /* void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) */ |
| 6139 | static void |
| 6140 | android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2 |
| 6141 | (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6142 | jint _exception = 0; |
| 6143 | const char * _exceptionType = NULL; |
| 6144 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6145 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6146 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6147 | jint _remaining; |
| 6148 | GLfloat *values = (GLfloat *) 0; |
| 6149 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 6150 | if (!values_buf) { |
| 6151 | _exception = 1; |
| 6152 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6153 | _exceptionMessage = "values == null"; |
| 6154 | goto exit; |
| 6155 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6156 | values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6157 | if (_remaining < 2) { |
| 6158 | _exception = 1; |
| 6159 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6160 | _exceptionMessage = "remaining() < 2 < needed"; |
| 6161 | goto exit; |
| 6162 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6163 | if (values == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6164 | char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6165 | values = (GLfloat *) (_valuesBase + _bufferOffset); |
| 6166 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6167 | glVertexAttrib2fv( |
| 6168 | (GLuint)indx, |
| 6169 | (GLfloat *)values |
| 6170 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6171 | |
| 6172 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6173 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6174 | _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6175 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6176 | if (_exception) { |
| 6177 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 6178 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6179 | } |
| 6180 | |
| 6181 | /* void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z ) */ |
| 6182 | static void |
| 6183 | android_glVertexAttrib3f__IFFF |
| 6184 | (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z) { |
| 6185 | glVertexAttrib3f( |
| 6186 | (GLuint)indx, |
| 6187 | (GLfloat)x, |
| 6188 | (GLfloat)y, |
| 6189 | (GLfloat)z |
| 6190 | ); |
| 6191 | } |
| 6192 | |
| 6193 | /* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */ |
| 6194 | static void |
| 6195 | android_glVertexAttrib3fv__I_3FI |
| 6196 | (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6197 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6198 | const char * _exceptionType = NULL; |
| 6199 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6200 | GLfloat *values_base = (GLfloat *) 0; |
| 6201 | jint _remaining; |
| 6202 | GLfloat *values = (GLfloat *) 0; |
| 6203 | |
| 6204 | if (!values_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6205 | _exception = 1; |
| 6206 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6207 | _exceptionMessage = "values == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6208 | goto exit; |
| 6209 | } |
| 6210 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6211 | _exception = 1; |
| 6212 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6213 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6214 | goto exit; |
| 6215 | } |
| 6216 | _remaining = _env->GetArrayLength(values_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6217 | if (_remaining < 3) { |
| 6218 | _exception = 1; |
| 6219 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6220 | _exceptionMessage = "length - offset < 3 < needed"; |
| 6221 | goto exit; |
| 6222 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6223 | values_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6224 | _env->GetFloatArrayElements(values_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6225 | values = values_base + offset; |
| 6226 | |
| 6227 | glVertexAttrib3fv( |
| 6228 | (GLuint)indx, |
| 6229 | (GLfloat *)values |
| 6230 | ); |
| 6231 | |
| 6232 | exit: |
| 6233 | if (values_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6234 | _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6235 | JNI_ABORT); |
| 6236 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6237 | if (_exception) { |
| 6238 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 6239 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6240 | } |
| 6241 | |
| 6242 | /* void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) */ |
| 6243 | static void |
| 6244 | android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2 |
| 6245 | (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6246 | jint _exception = 0; |
| 6247 | const char * _exceptionType = NULL; |
| 6248 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6249 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6250 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6251 | jint _remaining; |
| 6252 | GLfloat *values = (GLfloat *) 0; |
| 6253 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 6254 | if (!values_buf) { |
| 6255 | _exception = 1; |
| 6256 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6257 | _exceptionMessage = "values == null"; |
| 6258 | goto exit; |
| 6259 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6260 | values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6261 | if (_remaining < 3) { |
| 6262 | _exception = 1; |
| 6263 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6264 | _exceptionMessage = "remaining() < 3 < needed"; |
| 6265 | goto exit; |
| 6266 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6267 | if (values == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6268 | char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6269 | values = (GLfloat *) (_valuesBase + _bufferOffset); |
| 6270 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6271 | glVertexAttrib3fv( |
| 6272 | (GLuint)indx, |
| 6273 | (GLfloat *)values |
| 6274 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6275 | |
| 6276 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6277 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6278 | _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6279 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6280 | if (_exception) { |
| 6281 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 6282 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6283 | } |
| 6284 | |
| 6285 | /* void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) */ |
| 6286 | static void |
| 6287 | android_glVertexAttrib4f__IFFFF |
| 6288 | (JNIEnv *_env, jobject _this, jint indx, jfloat x, jfloat y, jfloat z, jfloat w) { |
| 6289 | glVertexAttrib4f( |
| 6290 | (GLuint)indx, |
| 6291 | (GLfloat)x, |
| 6292 | (GLfloat)y, |
| 6293 | (GLfloat)z, |
| 6294 | (GLfloat)w |
| 6295 | ); |
| 6296 | } |
| 6297 | |
| 6298 | /* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */ |
| 6299 | static void |
| 6300 | android_glVertexAttrib4fv__I_3FI |
| 6301 | (JNIEnv *_env, jobject _this, jint indx, jfloatArray values_ref, jint offset) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6302 | jint _exception = 0; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6303 | const char * _exceptionType = NULL; |
| 6304 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6305 | GLfloat *values_base = (GLfloat *) 0; |
| 6306 | jint _remaining; |
| 6307 | GLfloat *values = (GLfloat *) 0; |
| 6308 | |
| 6309 | if (!values_ref) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6310 | _exception = 1; |
| 6311 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6312 | _exceptionMessage = "values == null"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6313 | goto exit; |
| 6314 | } |
| 6315 | if (offset < 0) { |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6316 | _exception = 1; |
| 6317 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6318 | _exceptionMessage = "offset < 0"; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6319 | goto exit; |
| 6320 | } |
| 6321 | _remaining = _env->GetArrayLength(values_ref) - offset; |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6322 | if (_remaining < 4) { |
| 6323 | _exception = 1; |
| 6324 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6325 | _exceptionMessage = "length - offset < 4 < needed"; |
| 6326 | goto exit; |
| 6327 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6328 | values_base = (GLfloat *) |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6329 | _env->GetFloatArrayElements(values_ref, (jboolean *)0); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6330 | values = values_base + offset; |
| 6331 | |
| 6332 | glVertexAttrib4fv( |
| 6333 | (GLuint)indx, |
| 6334 | (GLfloat *)values |
| 6335 | ); |
| 6336 | |
| 6337 | exit: |
| 6338 | if (values_base) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6339 | _env->ReleaseFloatArrayElements(values_ref, (jfloat*)values_base, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6340 | JNI_ABORT); |
| 6341 | } |
Thomas Tafertshofer | 2545b32 | 2012-06-27 16:33:26 -0700 | [diff] [blame] | 6342 | if (_exception) { |
| 6343 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 6344 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6345 | } |
| 6346 | |
| 6347 | /* void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) */ |
| 6348 | static void |
| 6349 | android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 |
| 6350 | (JNIEnv *_env, jobject _this, jint indx, jobject values_buf) { |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6351 | jint _exception = 0; |
| 6352 | const char * _exceptionType = NULL; |
| 6353 | const char * _exceptionMessage = NULL; |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6354 | jfloatArray _array = (jfloatArray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6355 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6356 | jint _remaining; |
| 6357 | GLfloat *values = (GLfloat *) 0; |
| 6358 | |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 6359 | if (!values_buf) { |
| 6360 | _exception = 1; |
| 6361 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6362 | _exceptionMessage = "values == null"; |
| 6363 | goto exit; |
| 6364 | } |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6365 | values = (GLfloat *)getPointer(_env, values_buf, (jarray*)&_array, &_remaining, &_bufferOffset); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6366 | if (_remaining < 4) { |
| 6367 | _exception = 1; |
| 6368 | _exceptionType = "java/lang/IllegalArgumentException"; |
| 6369 | _exceptionMessage = "remaining() < 4 < needed"; |
| 6370 | goto exit; |
| 6371 | } |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6372 | if (values == NULL) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6373 | char * _valuesBase = (char *)_env->GetFloatArrayElements(_array, (jboolean *) 0); |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6374 | values = (GLfloat *) (_valuesBase + _bufferOffset); |
| 6375 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6376 | glVertexAttrib4fv( |
| 6377 | (GLuint)indx, |
| 6378 | (GLfloat *)values |
| 6379 | ); |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6380 | |
| 6381 | exit: |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6382 | if (_array) { |
Hiroshi Yamauchi | 3b1d46e | 2015-05-13 13:10:33 -0700 | [diff] [blame] | 6383 | _env->ReleaseFloatArrayElements(_array, (jfloat*)values, JNI_ABORT); |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6384 | } |
Mathias Agopian | 2ad0477 | 2013-02-23 03:12:30 -0800 | [diff] [blame] | 6385 | if (_exception) { |
| 6386 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 6387 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6388 | } |
| 6389 | |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 6390 | /* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint offset ) */ |
| 6391 | static void |
| 6392 | android_glVertexAttribPointer__IIIZII |
| 6393 | (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jint offset) { |
| 6394 | glVertexAttribPointer( |
| 6395 | (GLuint)indx, |
| 6396 | (GLint)size, |
| 6397 | (GLenum)type, |
| 6398 | (GLboolean)normalized, |
| 6399 | (GLsizei)stride, |
Ashok Bhat | 01c26ea | 2014-02-24 09:49:07 +0000 | [diff] [blame] | 6400 | reinterpret_cast<GLvoid *>(offset) |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 6401 | ); |
| 6402 | } |
| 6403 | |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6404 | /* void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr ) */ |
| 6405 | static void |
| 6406 | android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I |
| 6407 | (JNIEnv *_env, jobject _this, jint indx, jint size, jint type, jboolean normalized, jint stride, jobject ptr_buf, jint remaining) { |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 6408 | jint _exception = 0; |
| 6409 | const char * _exceptionType = NULL; |
| 6410 | const char * _exceptionMessage = NULL; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6411 | jarray _array = (jarray) 0; |
Thomas Tafertshofer | 17045a1 | 2012-07-12 13:55:55 -0700 | [diff] [blame] | 6412 | jint _bufferOffset = (jint) 0; |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6413 | jint _remaining; |
| 6414 | GLvoid *ptr = (GLvoid *) 0; |
| 6415 | |
| 6416 | if (ptr_buf) { |
| 6417 | ptr = (GLvoid *) getDirectBufferPointer(_env, ptr_buf); |
| 6418 | if ( ! ptr ) { |
| 6419 | return; |
| 6420 | } |
| 6421 | } |
| 6422 | glVertexAttribPointerBounds( |
| 6423 | (GLuint)indx, |
| 6424 | (GLint)size, |
| 6425 | (GLenum)type, |
| 6426 | (GLboolean)normalized, |
| 6427 | (GLsizei)stride, |
| 6428 | (GLvoid *)ptr, |
| 6429 | (GLsizei)remaining |
| 6430 | ); |
Romain Guy | 84cac20 | 2016-12-05 12:26:02 -0800 | [diff] [blame] | 6431 | if (_exception) { |
| 6432 | jniThrowException(_env, _exceptionType, _exceptionMessage); |
| 6433 | } |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6434 | } |
| 6435 | |
| 6436 | /* void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) */ |
| 6437 | static void |
| 6438 | android_glViewport__IIII |
| 6439 | (JNIEnv *_env, jobject _this, jint x, jint y, jint width, jint height) { |
| 6440 | glViewport( |
| 6441 | (GLint)x, |
| 6442 | (GLint)y, |
| 6443 | (GLsizei)width, |
| 6444 | (GLsizei)height |
| 6445 | ); |
| 6446 | } |
| 6447 | |
| 6448 | static const char *classPathName = "android/opengl/GLES20"; |
| 6449 | |
Daniel Micay | 76f6a86 | 2015-09-19 17:31:01 -0400 | [diff] [blame] | 6450 | static const JNINativeMethod methods[] = { |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6451 | {"_nativeClassInit", "()V", (void*)nativeClassInit }, |
| 6452 | {"glActiveTexture", "(I)V", (void *) android_glActiveTexture__I }, |
| 6453 | {"glAttachShader", "(II)V", (void *) android_glAttachShader__II }, |
| 6454 | {"glBindAttribLocation", "(IILjava/lang/String;)V", (void *) android_glBindAttribLocation__IILjava_lang_String_2 }, |
| 6455 | {"glBindBuffer", "(II)V", (void *) android_glBindBuffer__II }, |
| 6456 | {"glBindFramebuffer", "(II)V", (void *) android_glBindFramebuffer__II }, |
| 6457 | {"glBindRenderbuffer", "(II)V", (void *) android_glBindRenderbuffer__II }, |
| 6458 | {"glBindTexture", "(II)V", (void *) android_glBindTexture__II }, |
| 6459 | {"glBlendColor", "(FFFF)V", (void *) android_glBlendColor__FFFF }, |
| 6460 | {"glBlendEquation", "(I)V", (void *) android_glBlendEquation__I }, |
| 6461 | {"glBlendEquationSeparate", "(II)V", (void *) android_glBlendEquationSeparate__II }, |
| 6462 | {"glBlendFunc", "(II)V", (void *) android_glBlendFunc__II }, |
| 6463 | {"glBlendFuncSeparate", "(IIII)V", (void *) android_glBlendFuncSeparate__IIII }, |
| 6464 | {"glBufferData", "(IILjava/nio/Buffer;I)V", (void *) android_glBufferData__IILjava_nio_Buffer_2I }, |
| 6465 | {"glBufferSubData", "(IIILjava/nio/Buffer;)V", (void *) android_glBufferSubData__IIILjava_nio_Buffer_2 }, |
| 6466 | {"glCheckFramebufferStatus", "(I)I", (void *) android_glCheckFramebufferStatus__I }, |
| 6467 | {"glClear", "(I)V", (void *) android_glClear__I }, |
| 6468 | {"glClearColor", "(FFFF)V", (void *) android_glClearColor__FFFF }, |
| 6469 | {"glClearDepthf", "(F)V", (void *) android_glClearDepthf__F }, |
| 6470 | {"glClearStencil", "(I)V", (void *) android_glClearStencil__I }, |
| 6471 | {"glColorMask", "(ZZZZ)V", (void *) android_glColorMask__ZZZZ }, |
| 6472 | {"glCompileShader", "(I)V", (void *) android_glCompileShader__I }, |
| 6473 | {"glCompressedTexImage2D", "(IIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexImage2D__IIIIIIILjava_nio_Buffer_2 }, |
| 6474 | {"glCompressedTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glCompressedTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 }, |
| 6475 | {"glCopyTexImage2D", "(IIIIIIII)V", (void *) android_glCopyTexImage2D__IIIIIIII }, |
| 6476 | {"glCopyTexSubImage2D", "(IIIIIIII)V", (void *) android_glCopyTexSubImage2D__IIIIIIII }, |
| 6477 | {"glCreateProgram", "()I", (void *) android_glCreateProgram__ }, |
| 6478 | {"glCreateShader", "(I)I", (void *) android_glCreateShader__I }, |
| 6479 | {"glCullFace", "(I)V", (void *) android_glCullFace__I }, |
| 6480 | {"glDeleteBuffers", "(I[II)V", (void *) android_glDeleteBuffers__I_3II }, |
| 6481 | {"glDeleteBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteBuffers__ILjava_nio_IntBuffer_2 }, |
| 6482 | {"glDeleteFramebuffers", "(I[II)V", (void *) android_glDeleteFramebuffers__I_3II }, |
| 6483 | {"glDeleteFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteFramebuffers__ILjava_nio_IntBuffer_2 }, |
| 6484 | {"glDeleteProgram", "(I)V", (void *) android_glDeleteProgram__I }, |
| 6485 | {"glDeleteRenderbuffers", "(I[II)V", (void *) android_glDeleteRenderbuffers__I_3II }, |
| 6486 | {"glDeleteRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteRenderbuffers__ILjava_nio_IntBuffer_2 }, |
| 6487 | {"glDeleteShader", "(I)V", (void *) android_glDeleteShader__I }, |
| 6488 | {"glDeleteTextures", "(I[II)V", (void *) android_glDeleteTextures__I_3II }, |
| 6489 | {"glDeleteTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glDeleteTextures__ILjava_nio_IntBuffer_2 }, |
| 6490 | {"glDepthFunc", "(I)V", (void *) android_glDepthFunc__I }, |
| 6491 | {"glDepthMask", "(Z)V", (void *) android_glDepthMask__Z }, |
| 6492 | {"glDepthRangef", "(FF)V", (void *) android_glDepthRangef__FF }, |
| 6493 | {"glDetachShader", "(II)V", (void *) android_glDetachShader__II }, |
| 6494 | {"glDisable", "(I)V", (void *) android_glDisable__I }, |
| 6495 | {"glDisableVertexAttribArray", "(I)V", (void *) android_glDisableVertexAttribArray__I }, |
| 6496 | {"glDrawArrays", "(III)V", (void *) android_glDrawArrays__III }, |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 6497 | {"glDrawElements", "(IIII)V", (void *) android_glDrawElements__IIII }, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6498 | {"glDrawElements", "(IIILjava/nio/Buffer;)V", (void *) android_glDrawElements__IIILjava_nio_Buffer_2 }, |
| 6499 | {"glEnable", "(I)V", (void *) android_glEnable__I }, |
| 6500 | {"glEnableVertexAttribArray", "(I)V", (void *) android_glEnableVertexAttribArray__I }, |
| 6501 | {"glFinish", "()V", (void *) android_glFinish__ }, |
| 6502 | {"glFlush", "()V", (void *) android_glFlush__ }, |
| 6503 | {"glFramebufferRenderbuffer", "(IIII)V", (void *) android_glFramebufferRenderbuffer__IIII }, |
| 6504 | {"glFramebufferTexture2D", "(IIIII)V", (void *) android_glFramebufferTexture2D__IIIII }, |
| 6505 | {"glFrontFace", "(I)V", (void *) android_glFrontFace__I }, |
| 6506 | {"glGenBuffers", "(I[II)V", (void *) android_glGenBuffers__I_3II }, |
| 6507 | {"glGenBuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenBuffers__ILjava_nio_IntBuffer_2 }, |
| 6508 | {"glGenerateMipmap", "(I)V", (void *) android_glGenerateMipmap__I }, |
| 6509 | {"glGenFramebuffers", "(I[II)V", (void *) android_glGenFramebuffers__I_3II }, |
| 6510 | {"glGenFramebuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenFramebuffers__ILjava_nio_IntBuffer_2 }, |
| 6511 | {"glGenRenderbuffers", "(I[II)V", (void *) android_glGenRenderbuffers__I_3II }, |
| 6512 | {"glGenRenderbuffers", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenRenderbuffers__ILjava_nio_IntBuffer_2 }, |
| 6513 | {"glGenTextures", "(I[II)V", (void *) android_glGenTextures__I_3II }, |
| 6514 | {"glGenTextures", "(ILjava/nio/IntBuffer;)V", (void *) android_glGenTextures__ILjava_nio_IntBuffer_2 }, |
| 6515 | {"glGetActiveAttrib", "(III[II[II[II[BI)V", (void *) android_glGetActiveAttrib__III_3II_3II_3II_3BI }, |
| 6516 | {"glGetActiveAttrib", "(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V", (void *) android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B }, |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 6517 | {"glGetActiveAttrib", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveAttrib1 }, |
| 6518 | {"glGetActiveAttrib", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveAttrib2 }, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6519 | {"glGetActiveUniform", "(III[II[II[II[BI)V", (void *) android_glGetActiveUniform__III_3II_3II_3II_3BI }, |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 6520 | {"glGetActiveUniform", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveUniform1 }, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6521 | {"glGetActiveUniform", "(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V", (void *) android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B }, |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 6522 | {"glGetActiveUniform", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveUniform2 }, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6523 | {"glGetAttachedShaders", "(II[II[II)V", (void *) android_glGetAttachedShaders__II_3II_3II }, |
| 6524 | {"glGetAttachedShaders", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetAttachedShaders__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 }, |
| 6525 | {"glGetAttribLocation", "(ILjava/lang/String;)I", (void *) android_glGetAttribLocation__ILjava_lang_String_2 }, |
| 6526 | {"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI }, |
| 6527 | {"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 }, |
| 6528 | {"glGetBufferParameteriv", "(II[II)V", (void *) android_glGetBufferParameteriv__II_3II }, |
| 6529 | {"glGetBufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetBufferParameteriv__IILjava_nio_IntBuffer_2 }, |
| 6530 | {"glGetError", "()I", (void *) android_glGetError__ }, |
| 6531 | {"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI }, |
| 6532 | {"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 }, |
| 6533 | {"glGetFramebufferAttachmentParameteriv", "(III[II)V", (void *) android_glGetFramebufferAttachmentParameteriv__III_3II }, |
| 6534 | {"glGetFramebufferAttachmentParameteriv", "(IIILjava/nio/IntBuffer;)V", (void *) android_glGetFramebufferAttachmentParameteriv__IIILjava_nio_IntBuffer_2 }, |
| 6535 | {"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II }, |
| 6536 | {"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 }, |
| 6537 | {"glGetProgramiv", "(II[II)V", (void *) android_glGetProgramiv__II_3II }, |
| 6538 | {"glGetProgramiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetProgramiv__IILjava_nio_IntBuffer_2 }, |
| 6539 | {"glGetProgramInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetProgramInfoLog }, |
| 6540 | {"glGetRenderbufferParameteriv", "(II[II)V", (void *) android_glGetRenderbufferParameteriv__II_3II }, |
| 6541 | {"glGetRenderbufferParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetRenderbufferParameteriv__IILjava_nio_IntBuffer_2 }, |
| 6542 | {"glGetShaderiv", "(II[II)V", (void *) android_glGetShaderiv__II_3II }, |
| 6543 | {"glGetShaderiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetShaderiv__IILjava_nio_IntBuffer_2 }, |
| 6544 | {"glGetShaderInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetShaderInfoLog }, |
| 6545 | {"glGetShaderPrecisionFormat", "(II[II[II)V", (void *) android_glGetShaderPrecisionFormat__II_3II_3II }, |
| 6546 | {"glGetShaderPrecisionFormat", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)V", (void *) android_glGetShaderPrecisionFormat__IILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 }, |
| 6547 | {"glGetShaderSource", "(II[II[BI)V", (void *) android_glGetShaderSource__II_3II_3BI }, |
| 6548 | {"glGetShaderSource", "(IILjava/nio/IntBuffer;B)V", (void *) android_glGetShaderSource__IILjava_nio_IntBuffer_2B }, |
Thomas Tafertshofer | dd06946 | 2012-07-19 16:55:37 -0700 | [diff] [blame] | 6549 | {"glGetShaderSource", "(I)Ljava/lang/String;", (void *) android_glGetShaderSource }, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6550 | {"glGetString", "(I)Ljava/lang/String;", (void *) android_glGetString }, |
| 6551 | {"glGetTexParameterfv", "(II[FI)V", (void *) android_glGetTexParameterfv__II_3FI }, |
| 6552 | {"glGetTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetTexParameterfv__IILjava_nio_FloatBuffer_2 }, |
| 6553 | {"glGetTexParameteriv", "(II[II)V", (void *) android_glGetTexParameteriv__II_3II }, |
| 6554 | {"glGetTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetTexParameteriv__IILjava_nio_IntBuffer_2 }, |
| 6555 | {"glGetUniformfv", "(II[FI)V", (void *) android_glGetUniformfv__II_3FI }, |
| 6556 | {"glGetUniformfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetUniformfv__IILjava_nio_FloatBuffer_2 }, |
| 6557 | {"glGetUniformiv", "(II[II)V", (void *) android_glGetUniformiv__II_3II }, |
| 6558 | {"glGetUniformiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetUniformiv__IILjava_nio_IntBuffer_2 }, |
| 6559 | {"glGetUniformLocation", "(ILjava/lang/String;)I", (void *) android_glGetUniformLocation__ILjava_lang_String_2 }, |
| 6560 | {"glGetVertexAttribfv", "(II[FI)V", (void *) android_glGetVertexAttribfv__II_3FI }, |
| 6561 | {"glGetVertexAttribfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glGetVertexAttribfv__IILjava_nio_FloatBuffer_2 }, |
| 6562 | {"glGetVertexAttribiv", "(II[II)V", (void *) android_glGetVertexAttribiv__II_3II }, |
| 6563 | {"glGetVertexAttribiv", "(IILjava/nio/IntBuffer;)V", (void *) android_glGetVertexAttribiv__IILjava_nio_IntBuffer_2 }, |
| 6564 | {"glHint", "(II)V", (void *) android_glHint__II }, |
| 6565 | {"glIsBuffer", "(I)Z", (void *) android_glIsBuffer__I }, |
| 6566 | {"glIsEnabled", "(I)Z", (void *) android_glIsEnabled__I }, |
| 6567 | {"glIsFramebuffer", "(I)Z", (void *) android_glIsFramebuffer__I }, |
| 6568 | {"glIsProgram", "(I)Z", (void *) android_glIsProgram__I }, |
| 6569 | {"glIsRenderbuffer", "(I)Z", (void *) android_glIsRenderbuffer__I }, |
| 6570 | {"glIsShader", "(I)Z", (void *) android_glIsShader__I }, |
| 6571 | {"glIsTexture", "(I)Z", (void *) android_glIsTexture__I }, |
| 6572 | {"glLineWidth", "(F)V", (void *) android_glLineWidth__F }, |
| 6573 | {"glLinkProgram", "(I)V", (void *) android_glLinkProgram__I }, |
| 6574 | {"glPixelStorei", "(II)V", (void *) android_glPixelStorei__II }, |
| 6575 | {"glPolygonOffset", "(FF)V", (void *) android_glPolygonOffset__FF }, |
| 6576 | {"glReadPixels", "(IIIIIILjava/nio/Buffer;)V", (void *) android_glReadPixels__IIIIIILjava_nio_Buffer_2 }, |
| 6577 | {"glReleaseShaderCompiler", "()V", (void *) android_glReleaseShaderCompiler__ }, |
| 6578 | {"glRenderbufferStorage", "(IIII)V", (void *) android_glRenderbufferStorage__IIII }, |
| 6579 | {"glSampleCoverage", "(FZ)V", (void *) android_glSampleCoverage__FZ }, |
| 6580 | {"glScissor", "(IIII)V", (void *) android_glScissor__IIII }, |
| 6581 | {"glShaderBinary", "(I[IIILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__I_3IIILjava_nio_Buffer_2I }, |
| 6582 | {"glShaderBinary", "(ILjava/nio/IntBuffer;ILjava/nio/Buffer;I)V", (void *) android_glShaderBinary__ILjava_nio_IntBuffer_2ILjava_nio_Buffer_2I }, |
| 6583 | {"glShaderSource", "(ILjava/lang/String;)V", (void *) android_glShaderSource }, |
| 6584 | {"glStencilFunc", "(III)V", (void *) android_glStencilFunc__III }, |
| 6585 | {"glStencilFuncSeparate", "(IIII)V", (void *) android_glStencilFuncSeparate__IIII }, |
| 6586 | {"glStencilMask", "(I)V", (void *) android_glStencilMask__I }, |
| 6587 | {"glStencilMaskSeparate", "(II)V", (void *) android_glStencilMaskSeparate__II }, |
| 6588 | {"glStencilOp", "(III)V", (void *) android_glStencilOp__III }, |
| 6589 | {"glStencilOpSeparate", "(IIII)V", (void *) android_glStencilOpSeparate__IIII }, |
| 6590 | {"glTexImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexImage2D__IIIIIIIILjava_nio_Buffer_2 }, |
| 6591 | {"glTexParameterf", "(IIF)V", (void *) android_glTexParameterf__IIF }, |
| 6592 | {"glTexParameterfv", "(II[FI)V", (void *) android_glTexParameterfv__II_3FI }, |
| 6593 | {"glTexParameterfv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glTexParameterfv__IILjava_nio_FloatBuffer_2 }, |
| 6594 | {"glTexParameteri", "(III)V", (void *) android_glTexParameteri__III }, |
| 6595 | {"glTexParameteriv", "(II[II)V", (void *) android_glTexParameteriv__II_3II }, |
| 6596 | {"glTexParameteriv", "(IILjava/nio/IntBuffer;)V", (void *) android_glTexParameteriv__IILjava_nio_IntBuffer_2 }, |
| 6597 | {"glTexSubImage2D", "(IIIIIIIILjava/nio/Buffer;)V", (void *) android_glTexSubImage2D__IIIIIIIILjava_nio_Buffer_2 }, |
| 6598 | {"glUniform1f", "(IF)V", (void *) android_glUniform1f__IF }, |
| 6599 | {"glUniform1fv", "(II[FI)V", (void *) android_glUniform1fv__II_3FI }, |
| 6600 | {"glUniform1fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform1fv__IILjava_nio_FloatBuffer_2 }, |
| 6601 | {"glUniform1i", "(II)V", (void *) android_glUniform1i__II }, |
| 6602 | {"glUniform1iv", "(II[II)V", (void *) android_glUniform1iv__II_3II }, |
| 6603 | {"glUniform1iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform1iv__IILjava_nio_IntBuffer_2 }, |
| 6604 | {"glUniform2f", "(IFF)V", (void *) android_glUniform2f__IFF }, |
| 6605 | {"glUniform2fv", "(II[FI)V", (void *) android_glUniform2fv__II_3FI }, |
| 6606 | {"glUniform2fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform2fv__IILjava_nio_FloatBuffer_2 }, |
| 6607 | {"glUniform2i", "(III)V", (void *) android_glUniform2i__III }, |
| 6608 | {"glUniform2iv", "(II[II)V", (void *) android_glUniform2iv__II_3II }, |
| 6609 | {"glUniform2iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform2iv__IILjava_nio_IntBuffer_2 }, |
| 6610 | {"glUniform3f", "(IFFF)V", (void *) android_glUniform3f__IFFF }, |
| 6611 | {"glUniform3fv", "(II[FI)V", (void *) android_glUniform3fv__II_3FI }, |
| 6612 | {"glUniform3fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform3fv__IILjava_nio_FloatBuffer_2 }, |
| 6613 | {"glUniform3i", "(IIII)V", (void *) android_glUniform3i__IIII }, |
| 6614 | {"glUniform3iv", "(II[II)V", (void *) android_glUniform3iv__II_3II }, |
| 6615 | {"glUniform3iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform3iv__IILjava_nio_IntBuffer_2 }, |
| 6616 | {"glUniform4f", "(IFFFF)V", (void *) android_glUniform4f__IFFFF }, |
| 6617 | {"glUniform4fv", "(II[FI)V", (void *) android_glUniform4fv__II_3FI }, |
| 6618 | {"glUniform4fv", "(IILjava/nio/FloatBuffer;)V", (void *) android_glUniform4fv__IILjava_nio_FloatBuffer_2 }, |
| 6619 | {"glUniform4i", "(IIIII)V", (void *) android_glUniform4i__IIIII }, |
| 6620 | {"glUniform4iv", "(II[II)V", (void *) android_glUniform4iv__II_3II }, |
| 6621 | {"glUniform4iv", "(IILjava/nio/IntBuffer;)V", (void *) android_glUniform4iv__IILjava_nio_IntBuffer_2 }, |
| 6622 | {"glUniformMatrix2fv", "(IIZ[FI)V", (void *) android_glUniformMatrix2fv__IIZ_3FI }, |
| 6623 | {"glUniformMatrix2fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix2fv__IIZLjava_nio_FloatBuffer_2 }, |
| 6624 | {"glUniformMatrix3fv", "(IIZ[FI)V", (void *) android_glUniformMatrix3fv__IIZ_3FI }, |
| 6625 | {"glUniformMatrix3fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix3fv__IIZLjava_nio_FloatBuffer_2 }, |
| 6626 | {"glUniformMatrix4fv", "(IIZ[FI)V", (void *) android_glUniformMatrix4fv__IIZ_3FI }, |
| 6627 | {"glUniformMatrix4fv", "(IIZLjava/nio/FloatBuffer;)V", (void *) android_glUniformMatrix4fv__IIZLjava_nio_FloatBuffer_2 }, |
| 6628 | {"glUseProgram", "(I)V", (void *) android_glUseProgram__I }, |
| 6629 | {"glValidateProgram", "(I)V", (void *) android_glValidateProgram__I }, |
| 6630 | {"glVertexAttrib1f", "(IF)V", (void *) android_glVertexAttrib1f__IF }, |
| 6631 | {"glVertexAttrib1fv", "(I[FI)V", (void *) android_glVertexAttrib1fv__I_3FI }, |
| 6632 | {"glVertexAttrib1fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib1fv__ILjava_nio_FloatBuffer_2 }, |
| 6633 | {"glVertexAttrib2f", "(IFF)V", (void *) android_glVertexAttrib2f__IFF }, |
| 6634 | {"glVertexAttrib2fv", "(I[FI)V", (void *) android_glVertexAttrib2fv__I_3FI }, |
| 6635 | {"glVertexAttrib2fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib2fv__ILjava_nio_FloatBuffer_2 }, |
| 6636 | {"glVertexAttrib3f", "(IFFF)V", (void *) android_glVertexAttrib3f__IFFF }, |
| 6637 | {"glVertexAttrib3fv", "(I[FI)V", (void *) android_glVertexAttrib3fv__I_3FI }, |
| 6638 | {"glVertexAttrib3fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib3fv__ILjava_nio_FloatBuffer_2 }, |
| 6639 | {"glVertexAttrib4f", "(IFFFF)V", (void *) android_glVertexAttrib4f__IFFFF }, |
| 6640 | {"glVertexAttrib4fv", "(I[FI)V", (void *) android_glVertexAttrib4fv__I_3FI }, |
| 6641 | {"glVertexAttrib4fv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glVertexAttrib4fv__ILjava_nio_FloatBuffer_2 }, |
Jack Palevich | 224107a | 2010-06-22 20:08:40 +0800 | [diff] [blame] | 6642 | {"glVertexAttribPointer", "(IIIZII)V", (void *) android_glVertexAttribPointer__IIIZII }, |
Jack Palevich | 560814f | 2009-11-19 16:34:55 +0800 | [diff] [blame] | 6643 | {"glVertexAttribPointerBounds", "(IIIZILjava/nio/Buffer;I)V", (void *) android_glVertexAttribPointerBounds__IIIZILjava_nio_Buffer_2I }, |
| 6644 | {"glViewport", "(IIII)V", (void *) android_glViewport__IIII }, |
| 6645 | }; |
| 6646 | |
| 6647 | int register_android_opengl_jni_GLES20(JNIEnv *_env) |
| 6648 | { |
| 6649 | int err; |
| 6650 | err = android::AndroidRuntime::registerNativeMethods(_env, classPathName, methods, NELEM(methods)); |
| 6651 | return err; |
| 6652 | } |