1 /* void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName ) */ 2 static void 3 android_glGetActiveUniformBlockName_III_3II_3BI 4 (JNIEnv* _env, jobject _this, jint program, jint uniformBlockIndex, int bufSize, jintArray length_ref, jint lengthOffset, 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 GLchar* _name_base = (GLchar*)0; 12 jint _nameRemaining; 13 GLchar* _name = (GLchar*)0; 14 15 if (!length_ref) { 16 _exception = 1; 17 _exceptionType = "java/lang/IllegalArgumentException"; 18 _exceptionMessage = "length == null"; 19 goto exit; 20 } 21 if (lengthOffset < 0) { 22 _exception = 1; 23 _exceptionType = "java/lang/IllegalArgumentException"; 24 _exceptionMessage = "lengthOffset < 0"; 25 goto exit; 26 } 27 _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; 28 _length_base = (GLsizei*)_env->GetPrimitiveArrayCritical( 29 length_ref, (jboolean*)0); 30 _length = _length_base + lengthOffset; 31 32 if (!name_ref) { 33 _exception = 1; 34 _exceptionType = "java/lang/IllegalArgumentException"; 35 _exceptionMessage = "uniformBlockName == null"; 36 goto exit; 37 } 38 if (nameOffset < 0) { 39 _exception = 1; 40 _exceptionType = "java/lang/IllegalArgumentException"; 41 _exceptionMessage = "uniformBlockNameOffset < 0"; 42 goto exit; 43 } 44 _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset; 45 _name_base = (GLchar*)_env->GetPrimitiveArrayCritical( 46 name_ref, (jboolean*)0); 47 _name = _name_base + nameOffset; 48 49 glGetActiveUniformBlockName( 50 (GLuint)program, 51 (GLuint)uniformBlockIndex, 52 (GLsizei)bufSize, 53 (GLsizei*)_length, 54 (GLchar*)_name 55 ); 56 57 exit: 58 if (_name_base) { 59 _env->ReleasePrimitiveArrayCritical(name_ref, _name_base, 60 _exception ? JNI_ABORT: 0); 61 } 62 if (_length_base) { 63 _env->ReleasePrimitiveArrayCritical(length_ref, _length_base, 64 _exception ? JNI_ABORT: 0); 65 } 66 if (_exception) { 67 jniThrowException(_env, _exceptionType, _exceptionMessage); 68 } 69 } 70 71 /* void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName ) */ 72 static void 73 android_glGetActiveUniformBlockName_IILjava_nio_Buffer_2Ljava_nio_Buffer_2 74 (JNIEnv* _env, jobject _this, jint program, jint uniformBlockIndex, jobject length_buf, jobject uniformBlockName_buf) { 75 jint _exception = 0; 76 const char* _exceptionType; 77 const char* _exceptionMessage; 78 jarray _lengthArray = (jarray)0; 79 jint _lengthBufferOffset = (jint)0; 80 GLsizei* _length = (GLsizei*)0; 81 jint _lengthRemaining; 82 jarray _nameArray = (jarray)0; 83 jint _nameBufferOffset = (jint)0; 84 GLchar* _name = (GLchar*)0; 85 jint _nameRemaining; 86 87 _length = (GLsizei*)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset); 88 if (_length == NULL) { 89 GLsizei* _lengthBase = (GLsizei*)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean*)0); 90 _length = (GLsizei*)(_lengthBase + _lengthBufferOffset); 91 } 92 93 _name = (GLchar*)getPointer(_env, uniformBlockName_buf, &_nameArray, &_nameRemaining, &_nameBufferOffset); 94 if (_name == NULL) { 95 GLchar* _nameBase = (GLchar*)_env->GetPrimitiveArrayCritical(_nameArray, (jboolean*)0); 96 _name = (GLchar*)(_nameBase + _nameBufferOffset); 97 } 98 99 glGetActiveUniformBlockName( 100 (GLuint)program, 101 (GLuint)uniformBlockIndex, 102 (GLsizei)_nameRemaining, 103 _length, _name 104 ); 105 if (_nameArray) { 106 releasePointer(_env, _nameArray, _name, JNI_TRUE); 107 } 108 if (_lengthArray) { 109 releasePointer(_env, _lengthArray, _length, JNI_TRUE); 110 } 111 } 112 113 /* void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName ) */ 114 static jstring 115 android_glGetActiveUniformBlockName_II 116 (JNIEnv *_env, jobject _this, jint program, jint uniformBlockIndex) { 117 GLint len = 0; 118 glGetActiveUniformBlockiv((GLuint)program, (GLuint)uniformBlockIndex, 119 GL_UNIFORM_BLOCK_NAME_LENGTH, &len); 120 GLchar* name = (GLchar*)malloc(len); 121 glGetActiveUniformBlockName((GLuint)program, (GLuint)uniformBlockIndex, 122 len, NULL, name); 123 jstring result = _env->NewStringUTF(name); 124 free(name); 125 return result; 126 } 127 128