1552a6204828b5f25db0c3e644cead321664706faJesse Hall/* void glTransformFeedbackVaryings ( GLuint program, GLsizei count, const GLchar *varyings, GLenum bufferMode ) */ 2552a6204828b5f25db0c3e644cead321664706faJesse Hallstatic 3552a6204828b5f25db0c3e644cead321664706faJesse Hallvoid 4552a6204828b5f25db0c3e644cead321664706faJesse Hallandroid_glTransformFeedbackVaryings 5552a6204828b5f25db0c3e644cead321664706faJesse Hall (JNIEnv *_env, jobject _this, jint program, jobjectArray varyings_ref, jint bufferMode) { 6552a6204828b5f25db0c3e644cead321664706faJesse Hall jint _exception = 0; 7552a6204828b5f25db0c3e644cead321664706faJesse Hall const char* _exceptionType = NULL; 8552a6204828b5f25db0c3e644cead321664706faJesse Hall const char* _exceptionMessage = NULL; 9552a6204828b5f25db0c3e644cead321664706faJesse Hall jint _count = 0, _i; 10552a6204828b5f25db0c3e644cead321664706faJesse Hall const char** _varyings = NULL; 11552a6204828b5f25db0c3e644cead321664706faJesse Hall const char* _varying = NULL; 12552a6204828b5f25db0c3e644cead321664706faJesse Hall 13552a6204828b5f25db0c3e644cead321664706faJesse Hall if (!varyings_ref) { 14552a6204828b5f25db0c3e644cead321664706faJesse Hall _exception = 1; 15552a6204828b5f25db0c3e644cead321664706faJesse Hall _exceptionType = "java/lang/IllegalArgumentException"; 16552a6204828b5f25db0c3e644cead321664706faJesse Hall _exceptionMessage = "varyings == null"; 17552a6204828b5f25db0c3e644cead321664706faJesse Hall goto exit; 18552a6204828b5f25db0c3e644cead321664706faJesse Hall } 19552a6204828b5f25db0c3e644cead321664706faJesse Hall 20552a6204828b5f25db0c3e644cead321664706faJesse Hall _count = _env->GetArrayLength(varyings_ref); 21552a6204828b5f25db0c3e644cead321664706faJesse Hall _varyings = (const char**)calloc(_count, sizeof(const char*)); 22552a6204828b5f25db0c3e644cead321664706faJesse Hall for (_i = 0; _i < _count; _i++) { 23552a6204828b5f25db0c3e644cead321664706faJesse Hall jstring _varying = (jstring)_env->GetObjectArrayElement(varyings_ref, _i); 24552a6204828b5f25db0c3e644cead321664706faJesse Hall if (!_varying) { 25552a6204828b5f25db0c3e644cead321664706faJesse Hall _exception = 1; 26552a6204828b5f25db0c3e644cead321664706faJesse Hall _exceptionType = "java/lang/IllegalArgumentException"; 27552a6204828b5f25db0c3e644cead321664706faJesse Hall _exceptionMessage = "null varyings element"; 28552a6204828b5f25db0c3e644cead321664706faJesse Hall goto exit; 29552a6204828b5f25db0c3e644cead321664706faJesse Hall } 30552a6204828b5f25db0c3e644cead321664706faJesse Hall _varyings[_i] = _env->GetStringUTFChars(_varying, 0); 31552a6204828b5f25db0c3e644cead321664706faJesse Hall } 32552a6204828b5f25db0c3e644cead321664706faJesse Hall 33552a6204828b5f25db0c3e644cead321664706faJesse Hall glTransformFeedbackVaryings(program, _count, _varyings, bufferMode); 34552a6204828b5f25db0c3e644cead321664706faJesse Hall 35552a6204828b5f25db0c3e644cead321664706faJesse Hallexit: 36552a6204828b5f25db0c3e644cead321664706faJesse Hall for (_i = _count - 1; _i >= 0; _i--) { 37552a6204828b5f25db0c3e644cead321664706faJesse Hall if (_varyings[_i]) { 38552a6204828b5f25db0c3e644cead321664706faJesse Hall jstring _varying = (jstring)_env->GetObjectArrayElement(varyings_ref, _i); 39552a6204828b5f25db0c3e644cead321664706faJesse Hall if (_varying) { 40552a6204828b5f25db0c3e644cead321664706faJesse Hall _env->ReleaseStringUTFChars(_varying, _varyings[_i]); 41552a6204828b5f25db0c3e644cead321664706faJesse Hall } 42552a6204828b5f25db0c3e644cead321664706faJesse Hall } 43552a6204828b5f25db0c3e644cead321664706faJesse Hall } 44552a6204828b5f25db0c3e644cead321664706faJesse Hall free(_varyings); 45552a6204828b5f25db0c3e644cead321664706faJesse Hall if (_exception) { 46552a6204828b5f25db0c3e644cead321664706faJesse Hall jniThrowException(_env, _exceptionType, _exceptionMessage); 47552a6204828b5f25db0c3e644cead321664706faJesse Hall } 48552a6204828b5f25db0c3e644cead321664706faJesse Hall} 49552a6204828b5f25db0c3e644cead321664706faJesse Hall 50