Merge "Implement glCreateShaderProgramv JNI" into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
659f3a11e9
@@ -888,9 +888,69 @@ android_glActiveShaderProgram__II
|
||||
static jint
|
||||
android_glCreateShaderProgramv
|
||||
(JNIEnv *_env, jobject _this, jint type, jobjectArray strings) {
|
||||
jint _exception = 0;
|
||||
const char * _exceptionType = NULL;
|
||||
const char * _exceptionMessage = NULL;
|
||||
GLsizei _count;
|
||||
const GLchar** _strings = NULL;
|
||||
jstring* _jstrings = NULL;
|
||||
GLuint _returnValue = 0;
|
||||
|
||||
jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented");
|
||||
return 0;
|
||||
if (!strings) {
|
||||
_exception = 1;
|
||||
_exceptionType = "java/lang/IllegalArgumentException";
|
||||
_exceptionMessage = "strings == null";
|
||||
goto exit;
|
||||
}
|
||||
|
||||
_count = _env->GetArrayLength(strings);
|
||||
|
||||
_strings = (const GLchar**) calloc(_count, sizeof(const GLchar*));
|
||||
if (!_strings) {
|
||||
_exception = 1;
|
||||
_exceptionType = "java/lang/OutOfMemoryError";
|
||||
_exceptionMessage = "out of memory";
|
||||
goto exit;
|
||||
}
|
||||
|
||||
_jstrings = (jstring*) calloc(_count, sizeof(jstring));
|
||||
if (!_jstrings) {
|
||||
_exception = 1;
|
||||
_exceptionType = "java/lang/OutOfMemoryError";
|
||||
_exceptionMessage = "out of memory";
|
||||
goto exit;
|
||||
}
|
||||
|
||||
for(int i = 0; i < _count; i++) {
|
||||
_jstrings[i] = (jstring) _env->GetObjectArrayElement(strings, i);
|
||||
if (!_jstrings[i]) {
|
||||
_exception = 1;
|
||||
_exceptionType = "java/lang/IllegalArgumentException";
|
||||
_exceptionMessage = "strings == null";
|
||||
goto exit;
|
||||
}
|
||||
_strings[i] = _env->GetStringUTFChars(_jstrings[i], 0);
|
||||
}
|
||||
|
||||
_returnValue = glCreateShaderProgramv((GLenum)type, _count, _strings);
|
||||
exit:
|
||||
if (_strings && _jstrings) {
|
||||
for(int i = 0; i < _count; i++) {
|
||||
if (_strings[i] && _jstrings[i]) {
|
||||
_env->ReleaseStringUTFChars(_jstrings[i], _strings[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_strings) {
|
||||
free(_strings);
|
||||
}
|
||||
if (_jstrings) {
|
||||
free(_jstrings);
|
||||
}
|
||||
if (_exception) {
|
||||
jniThrowException(_env, _exceptionType, _exceptionMessage);
|
||||
}
|
||||
return (jint)_returnValue;
|
||||
}
|
||||
/* void glBindProgramPipeline ( GLuint pipeline ) */
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user