2012-07-19 23:50:08 +00:00
|
|
|
/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
|
|
|
|
static void
|
|
|
|
android_glGetActiveAttrib__III_3II_3II_3II_3BI
|
|
|
|
(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) {
|
|
|
|
jint _exception = 0;
|
|
|
|
const char * _exceptionType;
|
|
|
|
const char * _exceptionMessage;
|
|
|
|
GLsizei *length_base = (GLsizei *) 0;
|
|
|
|
jint _lengthRemaining;
|
|
|
|
GLsizei *length = (GLsizei *) 0;
|
|
|
|
GLint *size_base = (GLint *) 0;
|
|
|
|
jint _sizeRemaining;
|
|
|
|
GLint *size = (GLint *) 0;
|
|
|
|
GLenum *type_base = (GLenum *) 0;
|
|
|
|
jint _typeRemaining;
|
|
|
|
GLenum *type = (GLenum *) 0;
|
|
|
|
char *name_base = (char *) 0;
|
|
|
|
jint _nameRemaining;
|
|
|
|
char *name = (char *) 0;
|
|
|
|
|
|
|
|
if (!length_ref) {
|
|
|
|
_exception = 1;
|
|
|
|
_exceptionType = "java/lang/IllegalArgumentException";
|
|
|
|
_exceptionMessage = "length == null";
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
if (lengthOffset < 0) {
|
|
|
|
_exception = 1;
|
|
|
|
_exceptionType = "java/lang/IllegalArgumentException";
|
|
|
|
_exceptionMessage = "lengthOffset < 0";
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
_lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
|
|
|
|
length_base = (GLsizei *)
|
2015-05-09 00:54:55 +00:00
|
|
|
_env->GetIntArrayElements(length_ref, (jboolean *)0);
|
2012-07-19 23:50:08 +00:00
|
|
|
length = length_base + lengthOffset;
|
|
|
|
|
|
|
|
if (!size_ref) {
|
|
|
|
_exception = 1;
|
|
|
|
_exceptionType = "java/lang/IllegalArgumentException";
|
|
|
|
_exceptionMessage = "size == null";
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
if (sizeOffset < 0) {
|
|
|
|
_exception = 1;
|
|
|
|
_exceptionType = "java/lang/IllegalArgumentException";
|
|
|
|
_exceptionMessage = "sizeOffset < 0";
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
_sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
|
|
|
|
size_base = (GLint *)
|
2015-05-09 00:54:55 +00:00
|
|
|
_env->GetIntArrayElements(size_ref, (jboolean *)0);
|
2012-07-19 23:50:08 +00:00
|
|
|
size = size_base + sizeOffset;
|
|
|
|
|
|
|
|
if (!type_ref) {
|
|
|
|
_exception = 1;
|
|
|
|
_exceptionType = "java/lang/IllegalArgumentException";
|
|
|
|
_exceptionMessage = "type == null";
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
if (typeOffset < 0) {
|
|
|
|
_exception = 1;
|
|
|
|
_exceptionType = "java/lang/IllegalArgumentException";
|
|
|
|
_exceptionMessage = "typeOffset < 0";
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
_typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
|
|
|
|
type_base = (GLenum *)
|
2015-05-09 00:54:55 +00:00
|
|
|
_env->GetIntArrayElements(type_ref, (jboolean *)0);
|
2012-07-19 23:50:08 +00:00
|
|
|
type = type_base + typeOffset;
|
|
|
|
|
|
|
|
if (!name_ref) {
|
|
|
|
_exception = 1;
|
|
|
|
_exceptionType = "java/lang/IllegalArgumentException";
|
|
|
|
_exceptionMessage = "name == null";
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
if (nameOffset < 0) {
|
|
|
|
_exception = 1;
|
|
|
|
_exceptionType = "java/lang/IllegalArgumentException";
|
|
|
|
_exceptionMessage = "nameOffset < 0";
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
_nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
|
|
|
|
name_base = (char *)
|
2015-05-09 00:54:55 +00:00
|
|
|
_env->GetByteArrayElements(name_ref, (jboolean *)0);
|
2012-07-19 23:50:08 +00:00
|
|
|
name = name_base + nameOffset;
|
|
|
|
|
|
|
|
glGetActiveAttrib(
|
|
|
|
(GLuint)program,
|
|
|
|
(GLuint)index,
|
|
|
|
(GLsizei)bufsize,
|
|
|
|
(GLsizei *)length,
|
|
|
|
(GLint *)size,
|
|
|
|
(GLenum *)type,
|
|
|
|
(char *)name
|
|
|
|
);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
if (name_base) {
|
2015-05-09 00:54:55 +00:00
|
|
|
_env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
|
2012-07-19 23:50:08 +00:00
|
|
|
_exception ? JNI_ABORT: 0);
|
|
|
|
}
|
|
|
|
if (type_base) {
|
2015-05-09 00:54:55 +00:00
|
|
|
_env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
|
2012-07-19 23:50:08 +00:00
|
|
|
_exception ? JNI_ABORT: 0);
|
|
|
|
}
|
|
|
|
if (size_base) {
|
2015-05-09 00:54:55 +00:00
|
|
|
_env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
|
2012-07-19 23:50:08 +00:00
|
|
|
_exception ? JNI_ABORT: 0);
|
|
|
|
}
|
|
|
|
if (length_base) {
|
2015-05-09 00:54:55 +00:00
|
|
|
_env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
|
2012-07-19 23:50:08 +00:00
|
|
|
_exception ? JNI_ABORT: 0);
|
|
|
|
}
|
|
|
|
if (_exception) {
|
|
|
|
jniThrowException(_env, _exceptionType, _exceptionMessage);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
|
|
|
|
static void
|
|
|
|
android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B
|
|
|
|
(JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) {
|
2015-05-09 00:54:55 +00:00
|
|
|
jintArray _lengthArray = (jintArray) 0;
|
2012-07-19 23:50:08 +00:00
|
|
|
jint _lengthBufferOffset = (jint) 0;
|
2015-05-09 00:54:55 +00:00
|
|
|
jintArray _sizeArray = (jintArray) 0;
|
2012-07-19 23:50:08 +00:00
|
|
|
jint _sizeBufferOffset = (jint) 0;
|
2015-05-09 00:54:55 +00:00
|
|
|
jintArray _typeArray = (jintArray) 0;
|
2012-07-19 23:50:08 +00:00
|
|
|
jint _typeBufferOffset = (jint) 0;
|
|
|
|
jint _lengthRemaining;
|
|
|
|
GLsizei *length = (GLsizei *) 0;
|
|
|
|
jint _sizeRemaining;
|
|
|
|
GLint *size = (GLint *) 0;
|
|
|
|
jint _typeRemaining;
|
|
|
|
GLenum *type = (GLenum *) 0;
|
|
|
|
|
2015-05-09 00:54:55 +00:00
|
|
|
length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
|
|
|
|
size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
|
|
|
|
type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
|
2012-07-19 23:50:08 +00:00
|
|
|
if (length == NULL) {
|
2015-05-09 00:54:55 +00:00
|
|
|
char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
|
2012-07-19 23:50:08 +00:00
|
|
|
length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
|
|
|
|
}
|
|
|
|
if (size == NULL) {
|
2015-05-09 00:54:55 +00:00
|
|
|
char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
|
2012-07-19 23:50:08 +00:00
|
|
|
size = (GLint *) (_sizeBase + _sizeBufferOffset);
|
|
|
|
}
|
|
|
|
if (type == NULL) {
|
2015-05-09 00:54:55 +00:00
|
|
|
char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
|
2012-07-19 23:50:08 +00:00
|
|
|
type = (GLenum *) (_typeBase + _typeBufferOffset);
|
|
|
|
}
|
|
|
|
glGetActiveAttrib(
|
|
|
|
(GLuint)program,
|
|
|
|
(GLuint)index,
|
|
|
|
(GLsizei)bufsize,
|
|
|
|
(GLsizei *)length,
|
|
|
|
(GLint *)size,
|
|
|
|
(GLenum *)type,
|
2014-02-15 12:51:43 +00:00
|
|
|
reinterpret_cast<char *>(name)
|
2012-07-19 23:50:08 +00:00
|
|
|
);
|
|
|
|
if (_typeArray) {
|
2015-05-09 00:54:55 +00:00
|
|
|
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
|
2012-07-19 23:50:08 +00:00
|
|
|
}
|
|
|
|
if (_sizeArray) {
|
2015-05-09 00:54:55 +00:00
|
|
|
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
|
2012-07-19 23:50:08 +00:00
|
|
|
}
|
|
|
|
if (_lengthArray) {
|
2015-05-09 00:54:55 +00:00
|
|
|
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
|
2012-07-19 23:50:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
|
|
|
|
static jstring
|
|
|
|
android_glGetActiveAttrib1
|
|
|
|
(JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) {
|
|
|
|
jint _exception = 0;
|
|
|
|
const char * _exceptionType;
|
|
|
|
const char * _exceptionMessage;
|
|
|
|
GLint *size_base = (GLint *) 0;
|
|
|
|
jint _sizeRemaining;
|
|
|
|
GLint *size = (GLint *) 0;
|
|
|
|
GLenum *type_base = (GLenum *) 0;
|
|
|
|
jint _typeRemaining;
|
|
|
|
GLenum *type = (GLenum *) 0;
|
|
|
|
|
|
|
|
jstring result = 0;
|
|
|
|
|
|
|
|
GLint len = 0;
|
|
|
|
glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
|
|
|
|
if (!len) {
|
|
|
|
return _env->NewStringUTF("");
|
|
|
|
}
|
|
|
|
char* buf = (char*) malloc(len);
|
|
|
|
|
|
|
|
if (buf == NULL) {
|
|
|
|
jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (!size_ref) {
|
|
|
|
_exception = 1;
|
|
|
|
_exceptionType = "java/lang/IllegalArgumentException";
|
|
|
|
_exceptionMessage = "size == null";
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
if (sizeOffset < 0) {
|
|
|
|
_exception = 1;
|
|
|
|
_exceptionType = "java/lang/IllegalArgumentException";
|
|
|
|
_exceptionMessage = "sizeOffset < 0";
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
_sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
|
|
|
|
size_base = (GLint *)
|
2015-05-09 00:54:55 +00:00
|
|
|
_env->GetIntArrayElements(size_ref, (jboolean *)0);
|
2012-07-19 23:50:08 +00:00
|
|
|
size = size_base + sizeOffset;
|
|
|
|
|
|
|
|
if (!type_ref) {
|
|
|
|
_exception = 1;
|
|
|
|
_exceptionType = "java/lang/IllegalArgumentException";
|
|
|
|
_exceptionMessage = "type == null";
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
if (typeOffset < 0) {
|
|
|
|
_exception = 1;
|
|
|
|
_exceptionType = "java/lang/IllegalArgumentException";
|
|
|
|
_exceptionMessage = "typeOffset < 0";
|
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
_typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
|
|
|
|
type_base = (GLenum *)
|
2015-05-09 00:54:55 +00:00
|
|
|
_env->GetIntArrayElements(type_ref, (jboolean *)0);
|
2012-07-19 23:50:08 +00:00
|
|
|
type = type_base + typeOffset;
|
|
|
|
|
|
|
|
glGetActiveAttrib(
|
|
|
|
(GLuint)program,
|
|
|
|
(GLuint)index,
|
|
|
|
(GLsizei)len,
|
|
|
|
NULL,
|
|
|
|
(GLint *)size,
|
|
|
|
(GLenum *)type,
|
|
|
|
(char *)buf
|
|
|
|
);
|
|
|
|
exit:
|
|
|
|
if (type_base) {
|
2015-05-09 00:54:55 +00:00
|
|
|
_env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
|
2012-07-19 23:50:08 +00:00
|
|
|
_exception ? JNI_ABORT: 0);
|
|
|
|
}
|
|
|
|
if (size_base) {
|
2015-05-09 00:54:55 +00:00
|
|
|
_env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
|
2012-07-19 23:50:08 +00:00
|
|
|
_exception ? JNI_ABORT: 0);
|
|
|
|
}
|
|
|
|
if (_exception != 1) {
|
|
|
|
result = _env->NewStringUTF(buf);
|
|
|
|
}
|
|
|
|
if (buf) {
|
|
|
|
free(buf);
|
|
|
|
}
|
|
|
|
if (_exception) {
|
|
|
|
jniThrowException(_env, _exceptionType, _exceptionMessage);
|
|
|
|
}
|
|
|
|
if (result == 0) {
|
|
|
|
result = _env->NewStringUTF("");
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */
|
|
|
|
static jstring
|
|
|
|
android_glGetActiveAttrib2
|
|
|
|
(JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
|
2015-05-09 00:54:55 +00:00
|
|
|
jintArray _sizeArray = (jintArray) 0;
|
2012-07-19 23:50:08 +00:00
|
|
|
jint _sizeBufferOffset = (jint) 0;
|
2015-05-09 00:54:55 +00:00
|
|
|
jintArray _typeArray = (jintArray) 0;
|
2012-07-19 23:50:08 +00:00
|
|
|
jint _typeBufferOffset = (jint) 0;
|
|
|
|
jint _lengthRemaining;
|
|
|
|
GLsizei *length = (GLsizei *) 0;
|
|
|
|
jint _sizeRemaining;
|
|
|
|
GLint *size = (GLint *) 0;
|
|
|
|
jint _typeRemaining;
|
|
|
|
GLenum *type = (GLenum *) 0;
|
|
|
|
|
|
|
|
jstring result = 0;
|
|
|
|
|
|
|
|
GLint len = 0;
|
|
|
|
glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len);
|
|
|
|
if (!len) {
|
|
|
|
return _env->NewStringUTF("");
|
|
|
|
}
|
|
|
|
char* buf = (char*) malloc(len);
|
|
|
|
|
|
|
|
if (buf == NULL) {
|
|
|
|
jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-05-09 00:54:55 +00:00
|
|
|
size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
|
|
|
|
type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
|
2012-07-19 23:50:08 +00:00
|
|
|
if (size == NULL) {
|
2015-05-09 00:54:55 +00:00
|
|
|
char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
|
2012-07-19 23:50:08 +00:00
|
|
|
size = (GLint *) (_sizeBase + _sizeBufferOffset);
|
|
|
|
}
|
|
|
|
if (type == NULL) {
|
2015-05-09 00:54:55 +00:00
|
|
|
char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
|
2012-07-19 23:50:08 +00:00
|
|
|
type = (GLenum *) (_typeBase + _typeBufferOffset);
|
|
|
|
}
|
|
|
|
glGetActiveAttrib(
|
|
|
|
(GLuint)program,
|
|
|
|
(GLuint)index,
|
|
|
|
(GLsizei)len,
|
|
|
|
NULL,
|
|
|
|
(GLint *)size,
|
|
|
|
(GLenum *)type,
|
|
|
|
(char *)buf
|
|
|
|
);
|
|
|
|
|
|
|
|
if (_typeArray) {
|
2015-05-09 00:54:55 +00:00
|
|
|
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
|
2012-07-19 23:50:08 +00:00
|
|
|
}
|
|
|
|
if (_sizeArray) {
|
2015-05-09 00:54:55 +00:00
|
|
|
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
|
2012-07-19 23:50:08 +00:00
|
|
|
}
|
|
|
|
result = _env->NewStringUTF(buf);
|
|
|
|
if (buf) {
|
|
|
|
free(buf);
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|