131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall/* void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */ 231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hallstatic void 331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hallandroid_glGetTransformFeedbackVarying__III_3II_3II_3II_3BI 431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (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) { 531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jint _exception = 0; 631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall const char * _exceptionType; 731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall const char * _exceptionMessage; 831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall GLsizei *length_base = (GLsizei *) 0; 931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jint _lengthRemaining; 1031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall GLsizei *length = (GLsizei *) 0; 1131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall GLint *size_base = (GLint *) 0; 1231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jint _sizeRemaining; 1331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall GLint *size = (GLint *) 0; 1431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall GLenum *type_base = (GLenum *) 0; 1531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jint _typeRemaining; 1631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall GLenum *type = (GLenum *) 0; 1731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall char *name_base = (char *) 0; 1831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jint _nameRemaining; 1931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall char *name = (char *) 0; 2031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 21b62e242c4c2bdfe84ce28231d2fcc85e79517f8cPablo Ceballos if (length_ref) { 22b62e242c4c2bdfe84ce28231d2fcc85e79517f8cPablo Ceballos if (lengthOffset < 0) { 23b62e242c4c2bdfe84ce28231d2fcc85e79517f8cPablo Ceballos _exception = 1; 24b62e242c4c2bdfe84ce28231d2fcc85e79517f8cPablo Ceballos _exceptionType = "java/lang/IllegalArgumentException"; 25b62e242c4c2bdfe84ce28231d2fcc85e79517f8cPablo Ceballos _exceptionMessage = "lengthOffset < 0"; 26b62e242c4c2bdfe84ce28231d2fcc85e79517f8cPablo Ceballos goto exit; 27b62e242c4c2bdfe84ce28231d2fcc85e79517f8cPablo Ceballos } 28b62e242c4c2bdfe84ce28231d2fcc85e79517f8cPablo Ceballos _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; 29b62e242c4c2bdfe84ce28231d2fcc85e79517f8cPablo Ceballos length_base = (GLsizei *) 30b62e242c4c2bdfe84ce28231d2fcc85e79517f8cPablo Ceballos _env->GetIntArrayElements(length_ref, (jboolean *)0); 31b62e242c4c2bdfe84ce28231d2fcc85e79517f8cPablo Ceballos length = length_base + lengthOffset; 3231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 3331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 3431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (!size_ref) { 3531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exception = 1; 3631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exceptionType = "java/lang/IllegalArgumentException"; 3731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exceptionMessage = "size == null"; 3831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall goto exit; 3931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 4031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (sizeOffset < 0) { 4131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exception = 1; 4231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exceptionType = "java/lang/IllegalArgumentException"; 4331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exceptionMessage = "sizeOffset < 0"; 4431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall goto exit; 4531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 4631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; 4731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall size_base = (GLint *) 484e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi _env->GetIntArrayElements(size_ref, (jboolean *)0); 4931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall size = size_base + sizeOffset; 5031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 5131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (!type_ref) { 5231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exception = 1; 5331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exceptionType = "java/lang/IllegalArgumentException"; 5431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exceptionMessage = "type == null"; 5531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall goto exit; 5631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 5731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (typeOffset < 0) { 5831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exception = 1; 5931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exceptionType = "java/lang/IllegalArgumentException"; 6031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exceptionMessage = "typeOffset < 0"; 6131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall goto exit; 6231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 6331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; 6431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall type_base = (GLenum *) 654e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi _env->GetIntArrayElements(type_ref, (jboolean *)0); 6631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall type = type_base + typeOffset; 6731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 6831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (!name_ref) { 6931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exception = 1; 7031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exceptionType = "java/lang/IllegalArgumentException"; 7131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exceptionMessage = "name == null"; 7231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall goto exit; 7331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 7431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (nameOffset < 0) { 7531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exception = 1; 7631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exceptionType = "java/lang/IllegalArgumentException"; 7731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exceptionMessage = "nameOffset < 0"; 7831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall goto exit; 7931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 8031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset; 8131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall name_base = (char *) 824e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi _env->GetByteArrayElements(name_ref, (jboolean *)0); 8331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall name = name_base + nameOffset; 8431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 8531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall glGetTransformFeedbackVarying( 8631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLuint)program, 8731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLuint)index, 8831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLsizei)bufsize, 8931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLsizei *)length, 9031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLint *)size, 9131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLenum *)type, 9231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (char *)name 9331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall ); 9431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 9531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hallexit: 9631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (name_base) { 974e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base, 9831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exception ? JNI_ABORT: 0); 9931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 10031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (type_base) { 1014e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi _env->ReleaseIntArrayElements(type_ref, (jint*)type_base, 10231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exception ? JNI_ABORT: 0); 10331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 10431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (size_base) { 1054e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi _env->ReleaseIntArrayElements(size_ref, (jint*)size_base, 10631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exception ? JNI_ABORT: 0); 10731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 10831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (length_base) { 1094e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi _env->ReleaseIntArrayElements(length_ref, (jint*)length_base, 11031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exception ? JNI_ABORT: 0); 11131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 11231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (_exception) { 11331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jniThrowException(_env, _exceptionType, _exceptionMessage); 11431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 11531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall} 11631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 11731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall/* void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */ 11831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hallstatic void 11931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hallandroid_glGetTransformFeedbackVarying__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B 12031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) { 121dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballos jniThrowException(_env, "java/lang/UnsupportedOperationException", "deprecated"); 122dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballos} 123dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballos 124dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballos/* void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */ 125dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballosstatic void 126dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballosandroid_glGetTransformFeedbackVarying__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_ByteBuffer_2 127dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballos (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jobject name_buf) { 1284e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi jintArray _lengthArray = (jintArray) 0; 12931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jint _lengthBufferOffset = (jint) 0; 1304e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi jintArray _sizeArray = (jintArray) 0; 13131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jint _sizeBufferOffset = (jint) 0; 1324e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi jintArray _typeArray = (jintArray) 0; 13331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jint _typeBufferOffset = (jint) 0; 134dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballos jbyteArray _nameArray = (jbyteArray)0; 135dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballos jint _nameBufferOffset = (jint)0; 13631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jint _lengthRemaining; 13731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall GLsizei *length = (GLsizei *) 0; 13831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jint _sizeRemaining; 13931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall GLint *size = (GLint *) 0; 14031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jint _typeRemaining; 14131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall GLenum *type = (GLenum *) 0; 142dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballos jint _nameRemaining; 143dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballos GLchar* name = (GLchar*)0; 144dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballos 14531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 1464e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset); 1474e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset); 1484e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset); 149dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballos name = (GLchar*)getPointer(_env, name_buf, (jarray*)&_nameArray, &_nameRemaining, &_nameBufferOffset); 15031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (length == NULL) { 1514e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0); 15231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall length = (GLsizei *) (_lengthBase + _lengthBufferOffset); 15331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 15431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (size == NULL) { 1554e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0); 15631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall size = (GLint *) (_sizeBase + _sizeBufferOffset); 15731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 15831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (type == NULL) { 1594e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0); 16031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall type = (GLenum *) (_typeBase + _typeBufferOffset); 16131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 162dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballos if (name == NULL) { 163dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballos char* _nameBase = (char *)_env->GetByteArrayElements(_nameArray, (jboolean*)0); 164dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballos name = (GLchar *) (_nameBase + _nameBufferOffset); 165dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballos } 16631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall glGetTransformFeedbackVarying( 16731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLuint)program, 16831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLuint)index, 16931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLsizei)bufsize, 17031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLsizei *)length, 17131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLint *)size, 17231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLenum *)type, 173dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballos (GLchar*)name 17431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall ); 17531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (_typeArray) { 1764e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE); 17731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 17831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (_sizeArray) { 1794e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE); 18031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 18131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (_lengthArray) { 1824e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE); 18331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 184dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballos if (_nameArray) { 185dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballos releaseArrayPointer<jbyteArray, jbyte*, ByteArrayReleaser>(_env, _nameArray, (jbyte*)name, JNI_TRUE); 186dde548d4ac08c1e9cd7b3bad2b664eb866c96fb5Pablo Ceballos } 18731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall} 18831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 18931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall/* void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */ 19031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hallstatic jstring 19131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hallandroid_glGetTransformFeedbackVarying1 19231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) { 19331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jint _exception = 0; 19431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall const char * _exceptionType; 19531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall const char * _exceptionMessage; 19631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall GLint *size_base = (GLint *) 0; 19731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jint _sizeRemaining; 19831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall GLint *size = (GLint *) 0; 19931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall GLenum *type_base = (GLenum *) 0; 20031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jint _typeRemaining; 20131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall GLenum *type = (GLenum *) 0; 20231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 20331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jstring result = 0; 20431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 20531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall GLint len = 0; 20631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len); 20731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (!len) { 20831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall return _env->NewStringUTF(""); 20931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 21031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall char* buf = (char*) malloc(len); 21131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 21231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (buf == NULL) { 21331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); 21431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall return NULL; 21531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 21631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (!size_ref) { 21731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exception = 1; 21831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exceptionType = "java/lang/IllegalArgumentException"; 21931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exceptionMessage = "size == null"; 22031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall goto exit; 22131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 22231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (sizeOffset < 0) { 22331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exception = 1; 22431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exceptionType = "java/lang/IllegalArgumentException"; 22531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exceptionMessage = "sizeOffset < 0"; 22631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall goto exit; 22731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 22831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; 22931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall size_base = (GLint *) 2304e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi _env->GetIntArrayElements(size_ref, (jboolean *)0); 23131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall size = size_base + sizeOffset; 23231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 23331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (!type_ref) { 23431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exception = 1; 23531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exceptionType = "java/lang/IllegalArgumentException"; 23631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exceptionMessage = "type == null"; 23731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall goto exit; 23831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 23931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (typeOffset < 0) { 24031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exception = 1; 24131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exceptionType = "java/lang/IllegalArgumentException"; 24231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exceptionMessage = "typeOffset < 0"; 24331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall goto exit; 24431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 24531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; 24631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall type_base = (GLenum *) 2474e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi _env->GetIntArrayElements(type_ref, (jboolean *)0); 24831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall type = type_base + typeOffset; 24931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 25031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall glGetTransformFeedbackVarying( 25131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLuint)program, 25231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLuint)index, 25331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLsizei)len, 25431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall NULL, 25531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLint *)size, 25631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLenum *)type, 25731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (char *)buf 25831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall ); 25931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hallexit: 26031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (type_base) { 2614e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi _env->ReleaseIntArrayElements(type_ref, (jint*)type_base, 26231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exception ? JNI_ABORT: 0); 26331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 26431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (size_base) { 2654e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi _env->ReleaseIntArrayElements(size_ref, (jint*)size_base, 26631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall _exception ? JNI_ABORT: 0); 26731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 26831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (_exception != 1) { 26931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall result = _env->NewStringUTF(buf); 27031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 27131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (buf) { 27231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall free(buf); 27331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 27431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (_exception) { 27531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jniThrowException(_env, _exceptionType, _exceptionMessage); 27631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 27731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (result == 0) { 27831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall result = _env->NewStringUTF(""); 27931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 28031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 28131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall return result; 28231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall} 28331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 28431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall/* void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */ 28531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hallstatic jstring 28631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hallandroid_glGetTransformFeedbackVarying2 28731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) { 2884e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi jintArray _sizeArray = (jintArray) 0; 28931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jint _sizeBufferOffset = (jint) 0; 2904e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi jintArray _typeArray = (jintArray) 0; 29131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jint _typeBufferOffset = (jint) 0; 29231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jint _lengthRemaining; 29331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall GLsizei *length = (GLsizei *) 0; 29431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jint _sizeRemaining; 29531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall GLint *size = (GLint *) 0; 29631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jint _typeRemaining; 29731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall GLenum *type = (GLenum *) 0; 29831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 29931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jstring result = 0; 30031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 30131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall GLint len = 0; 30231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len); 30331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (!len) { 30431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall return _env->NewStringUTF(""); 30531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 30631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall char* buf = (char*) malloc(len); 30731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 30831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (buf == NULL) { 30931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); 31031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall return NULL; 31131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 31231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 3134e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset); 3144e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset); 31531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (size == NULL) { 3164e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0); 31731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall size = (GLint *) (_sizeBase + _sizeBufferOffset); 31831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 31931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (type == NULL) { 3204e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0); 32131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall type = (GLenum *) (_typeBase + _typeBufferOffset); 32231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 32331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall glGetTransformFeedbackVarying( 32431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLuint)program, 32531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLuint)index, 32631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLsizei)len, 32731f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall NULL, 32831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLint *)size, 32931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (GLenum *)type, 33031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall (char *)buf 33131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall ); 33231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall 33331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (_typeArray) { 3344e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE); 33531f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 33631f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (_sizeArray) { 3374e7de461c18278a31be83e7c9074a02fbb6e9475Hiroshi Yamauchi releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE); 33831f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 33931f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall result = _env->NewStringUTF(buf); 34031f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall if (buf) { 34131f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall free(buf); 34231f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall } 34331f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall return result; 34431f6edc21bbc2802f4c755b4982945d5237e92ceJesse Hall} 345