1 /* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ 2 static void 3 android_glGetActiveAttrib__III_3II_3II_3II_3BI 4 (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) { 5 jint _exception = 0; 6 const char * _exceptionType; 7 const char * _exceptionMessage; 8 GLsizei *length_base = (GLsizei *) 0; 9 jint _lengthRemaining; 10 GLsizei *length = (GLsizei *) 0; 11 GLint *size_base = (GLint *) 0; 12 jint _sizeRemaining; 13 GLint *size = (GLint *) 0; 14 GLenum *type_base = (GLenum *) 0; 15 jint _typeRemaining; 16 GLenum *type = (GLenum *) 0; 17 char *name_base = (char *) 0; 18 jint _nameRemaining; 19 char *name = (char *) 0; 20 21 if (!length_ref) { 22 _exception = 1; 23 _exceptionType = "java/lang/IllegalArgumentException"; 24 _exceptionMessage = "length == null"; 25 goto exit; 26 } 27 if (lengthOffset < 0) { 28 _exception = 1; 29 _exceptionType = "java/lang/IllegalArgumentException"; 30 _exceptionMessage = "lengthOffset < 0"; 31 goto exit; 32 } 33 _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; 34 length_base = (GLsizei *) 35 _env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0); 36 length = length_base + lengthOffset; 37 38 if (!size_ref) { 39 _exception = 1; 40 _exceptionType = "java/lang/IllegalArgumentException"; 41 _exceptionMessage = "size == null"; 42 goto exit; 43 } 44 if (sizeOffset < 0) { 45 _exception = 1; 46 _exceptionType = "java/lang/IllegalArgumentException"; 47 _exceptionMessage = "sizeOffset < 0"; 48 goto exit; 49 } 50 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; 51 size_base = (GLint *) 52 _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0); 53 size = size_base + sizeOffset; 54 55 if (!type_ref) { 56 _exception = 1; 57 _exceptionType = "java/lang/IllegalArgumentException"; 58 _exceptionMessage = "type == null"; 59 goto exit; 60 } 61 if (typeOffset < 0) { 62 _exception = 1; 63 _exceptionType = "java/lang/IllegalArgumentException"; 64 _exceptionMessage = "typeOffset < 0"; 65 goto exit; 66 } 67 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; 68 type_base = (GLenum *) 69 _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0); 70 type = type_base + typeOffset; 71 72 if (!name_ref) { 73 _exception = 1; 74 _exceptionType = "java/lang/IllegalArgumentException"; 75 _exceptionMessage = "name == null"; 76 goto exit; 77 } 78 if (nameOffset < 0) { 79 _exception = 1; 80 _exceptionType = "java/lang/IllegalArgumentException"; 81 _exceptionMessage = "nameOffset < 0"; 82 goto exit; 83 } 84 _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset; 85 name_base = (char *) 86 _env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0); 87 name = name_base + nameOffset; 88 89 glGetActiveAttrib( 90 (GLuint)program, 91 (GLuint)index, 92 (GLsizei)bufsize, 93 (GLsizei *)length, 94 (GLint *)size, 95 (GLenum *)type, 96 (char *)name 97 ); 98 99 exit: 100 if (name_base) { 101 _env->ReleasePrimitiveArrayCritical(name_ref, name_base, 102 _exception ? JNI_ABORT: 0); 103 } 104 if (type_base) { 105 _env->ReleasePrimitiveArrayCritical(type_ref, type_base, 106 _exception ? JNI_ABORT: 0); 107 } 108 if (size_base) { 109 _env->ReleasePrimitiveArrayCritical(size_ref, size_base, 110 _exception ? JNI_ABORT: 0); 111 } 112 if (length_base) { 113 _env->ReleasePrimitiveArrayCritical(length_ref, length_base, 114 _exception ? JNI_ABORT: 0); 115 } 116 if (_exception) { 117 jniThrowException(_env, _exceptionType, _exceptionMessage); 118 } 119 } 120 121 /* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ 122 static void 123 android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B 124 (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) { 125 jarray _lengthArray = (jarray) 0; 126 jint _lengthBufferOffset = (jint) 0; 127 jarray _sizeArray = (jarray) 0; 128 jint _sizeBufferOffset = (jint) 0; 129 jarray _typeArray = (jarray) 0; 130 jint _typeBufferOffset = (jint) 0; 131 jint _lengthRemaining; 132 GLsizei *length = (GLsizei *) 0; 133 jint _sizeRemaining; 134 GLint *size = (GLint *) 0; 135 jint _typeRemaining; 136 GLenum *type = (GLenum *) 0; 137 138 length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset); 139 size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset); 140 type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset); 141 if (length == NULL) { 142 char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0); 143 length = (GLsizei *) (_lengthBase + _lengthBufferOffset); 144 } 145 if (size == NULL) { 146 char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0); 147 size = (GLint *) (_sizeBase + _sizeBufferOffset); 148 } 149 if (type == NULL) { 150 char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0); 151 type = (GLenum *) (_typeBase + _typeBufferOffset); 152 } 153 glGetActiveAttrib( 154 (GLuint)program, 155 (GLuint)index, 156 (GLsizei)bufsize, 157 (GLsizei *)length, 158 (GLint *)size, 159 (GLenum *)type, 160 (char *)name 161 ); 162 if (_typeArray) { 163 releasePointer(_env, _typeArray, type, JNI_TRUE); 164 } 165 if (_sizeArray) { 166 releasePointer(_env, _sizeArray, size, JNI_TRUE); 167 } 168 if (_lengthArray) { 169 releasePointer(_env, _lengthArray, length, JNI_TRUE); 170 } 171 } 172 173 /* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ 174 static jstring 175 android_glGetActiveAttrib1 176 (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) { 177 jint _exception = 0; 178 const char * _exceptionType; 179 const char * _exceptionMessage; 180 GLint *size_base = (GLint *) 0; 181 jint _sizeRemaining; 182 GLint *size = (GLint *) 0; 183 GLenum *type_base = (GLenum *) 0; 184 jint _typeRemaining; 185 GLenum *type = (GLenum *) 0; 186 187 jstring result = 0; 188 189 GLint len = 0; 190 glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len); 191 if (!len) { 192 return _env->NewStringUTF(""); 193 } 194 char* buf = (char*) malloc(len); 195 196 if (buf == NULL) { 197 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); 198 return NULL; 199 } 200 if (!size_ref) { 201 _exception = 1; 202 _exceptionType = "java/lang/IllegalArgumentException"; 203 _exceptionMessage = "size == null"; 204 goto exit; 205 } 206 if (sizeOffset < 0) { 207 _exception = 1; 208 _exceptionType = "java/lang/IllegalArgumentException"; 209 _exceptionMessage = "sizeOffset < 0"; 210 goto exit; 211 } 212 _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; 213 size_base = (GLint *) 214 _env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0); 215 size = size_base + sizeOffset; 216 217 if (!type_ref) { 218 _exception = 1; 219 _exceptionType = "java/lang/IllegalArgumentException"; 220 _exceptionMessage = "type == null"; 221 goto exit; 222 } 223 if (typeOffset < 0) { 224 _exception = 1; 225 _exceptionType = "java/lang/IllegalArgumentException"; 226 _exceptionMessage = "typeOffset < 0"; 227 goto exit; 228 } 229 _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; 230 type_base = (GLenum *) 231 _env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0); 232 type = type_base + typeOffset; 233 234 glGetActiveAttrib( 235 (GLuint)program, 236 (GLuint)index, 237 (GLsizei)len, 238 NULL, 239 (GLint *)size, 240 (GLenum *)type, 241 (char *)buf 242 ); 243 exit: 244 if (type_base) { 245 _env->ReleasePrimitiveArrayCritical(type_ref, type_base, 246 _exception ? JNI_ABORT: 0); 247 } 248 if (size_base) { 249 _env->ReleasePrimitiveArrayCritical(size_ref, size_base, 250 _exception ? JNI_ABORT: 0); 251 } 252 if (_exception != 1) { 253 result = _env->NewStringUTF(buf); 254 } 255 if (buf) { 256 free(buf); 257 } 258 if (_exception) { 259 jniThrowException(_env, _exceptionType, _exceptionMessage); 260 } 261 if (result == 0) { 262 result = _env->NewStringUTF(""); 263 } 264 265 return result; 266 } 267 268 /* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ 269 static jstring 270 android_glGetActiveAttrib2 271 (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) { 272 jarray _sizeArray = (jarray) 0; 273 jint _sizeBufferOffset = (jint) 0; 274 jarray _typeArray = (jarray) 0; 275 jint _typeBufferOffset = (jint) 0; 276 jint _lengthRemaining; 277 GLsizei *length = (GLsizei *) 0; 278 jint _sizeRemaining; 279 GLint *size = (GLint *) 0; 280 jint _typeRemaining; 281 GLenum *type = (GLenum *) 0; 282 283 jstring result = 0; 284 285 GLint len = 0; 286 glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len); 287 if (!len) { 288 return _env->NewStringUTF(""); 289 } 290 char* buf = (char*) malloc(len); 291 292 if (buf == NULL) { 293 jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); 294 return NULL; 295 } 296 297 size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset); 298 type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset); 299 if (size == NULL) { 300 char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0); 301 size = (GLint *) (_sizeBase + _sizeBufferOffset); 302 } 303 if (type == NULL) { 304 char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0); 305 type = (GLenum *) (_typeBase + _typeBufferOffset); 306 } 307 glGetActiveAttrib( 308 (GLuint)program, 309 (GLuint)index, 310 (GLsizei)len, 311 NULL, 312 (GLint *)size, 313 (GLenum *)type, 314 (char *)buf 315 ); 316 317 if (_typeArray) { 318 releasePointer(_env, _typeArray, type, JNI_TRUE); 319 } 320 if (_sizeArray) { 321 releasePointer(_env, _sizeArray, size, JNI_TRUE); 322 } 323 result = _env->NewStringUTF(buf); 324 if (buf) { 325 free(buf); 326 } 327 return result; 328 } 329