Merge "Replace JNI primitive array critical calls with non-critical ones." into mnc-dev
This commit is contained in:
commit
6f48c7f3dc
@ -191,6 +191,84 @@ public class JType {
|
||||
(baseType.indexOf("Buffer") != -1);
|
||||
}
|
||||
|
||||
public JType getArrayTypeForTypedBuffer() {
|
||||
if (!isTypedBuffer()) {
|
||||
throw new RuntimeException("Not typed buffer type " + this);
|
||||
}
|
||||
switch (baseType) {
|
||||
case "java.nio.ByteBuffer":
|
||||
return new JType("byte", false, true);
|
||||
case "java.nio.BooleanBuffer":
|
||||
return new JType("boolean", false, true);
|
||||
case "java.nio.ShortBuffer":
|
||||
return new JType("short", false, true);
|
||||
case "java.nio.CharBuffer":
|
||||
return new JType("char", false, true);
|
||||
case "java.nio.IntBuffer":
|
||||
return new JType("int", false, true);
|
||||
case "java.nio.LongBuffer":
|
||||
return new JType("long", false, true);
|
||||
case "java.nio.FloatBuffer":
|
||||
return new JType("float", false, true);
|
||||
case "java.nio.DoubleBuffer":
|
||||
return new JType("double", false, true);
|
||||
default:
|
||||
throw new RuntimeException("Unknown typed buffer type " + this);
|
||||
}
|
||||
}
|
||||
|
||||
public String getArrayGetterForPrimitiveArray() {
|
||||
if (!isArray() || isClass()) {
|
||||
throw new RuntimeException("Not array type " + this);
|
||||
}
|
||||
switch (baseType) {
|
||||
case "byte":
|
||||
return "GetByteArrayElements";
|
||||
case "boolean":
|
||||
return "GetBooleanArrayElements";
|
||||
case "short":
|
||||
return "GetShortArrayElements";
|
||||
case "char":
|
||||
return "GetCharArrayElements";
|
||||
case "int":
|
||||
return "GetIntArrayElements";
|
||||
case "long":
|
||||
return "GetLongArrayElements";
|
||||
case "float":
|
||||
return "GetFloatArrayElements";
|
||||
case "double":
|
||||
return "GetDoubleArrayElements";
|
||||
default:
|
||||
throw new RuntimeException("Unknown array type " + this);
|
||||
}
|
||||
}
|
||||
|
||||
public String getArrayReleaserForPrimitiveArray() {
|
||||
if (!isArray() || isClass()) {
|
||||
throw new RuntimeException("Not array type " + this);
|
||||
}
|
||||
switch (baseType) {
|
||||
case "byte":
|
||||
return "ReleaseByteArrayElements";
|
||||
case "boolean":
|
||||
return "ReleaseBooleanArrayElements";
|
||||
case "short":
|
||||
return "ReleaseShortArrayElements";
|
||||
case "char":
|
||||
return "ReleaseCharArrayElements";
|
||||
case "int":
|
||||
return "ReleaseIntArrayElements";
|
||||
case "long":
|
||||
return "ReleaseLongArrayElements";
|
||||
case "float":
|
||||
return "ReleaseFloatArrayElements";
|
||||
case "double":
|
||||
return "ReleaseDoubleArrayElements";
|
||||
default:
|
||||
throw new RuntimeException("Unknown array type " + this);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isEGLHandle() {
|
||||
return !isPrimitive() &&
|
||||
(baseType.startsWith("EGL"));
|
||||
|
@ -812,6 +812,7 @@ public class JniCodeEmitter {
|
||||
List<Integer> stringArgs = new ArrayList<Integer>();
|
||||
int numBufferArgs = 0;
|
||||
List<String> bufferArgNames = new ArrayList<String>();
|
||||
List<JType> bufferArgTypes = new ArrayList<JType>();
|
||||
|
||||
// Emit JNI signature (arguments)
|
||||
//
|
||||
@ -835,6 +836,7 @@ public class JniCodeEmitter {
|
||||
int cIndex = jfunc.getArgCIndex(i);
|
||||
String cname = cfunc.getArgName(cIndex);
|
||||
bufferArgNames.add(cname);
|
||||
bufferArgTypes.add(jfunc.getArgType(i));
|
||||
numBufferArgs++;
|
||||
}
|
||||
}
|
||||
@ -948,12 +950,25 @@ public class JniCodeEmitter {
|
||||
|
||||
// Emit a single _array or multiple _XXXArray variables
|
||||
if (numBufferArgs == 1) {
|
||||
JType bufferType = bufferArgTypes.get(0);
|
||||
if (bufferType.isTypedBuffer()) {
|
||||
String typedArrayType = getJniType(bufferType.getArrayTypeForTypedBuffer());
|
||||
out.println(indent + typedArrayType + " _array = (" + typedArrayType + ") 0;");
|
||||
} else {
|
||||
out.println(indent + "jarray _array = (jarray) 0;");
|
||||
}
|
||||
out.println(indent + "jint _bufferOffset = (jint) 0;");
|
||||
} else {
|
||||
for (int i = 0; i < numBufferArgs; i++) {
|
||||
JType bufferType = bufferArgTypes.get(0);
|
||||
if (bufferType.isTypedBuffer()) {
|
||||
String typedArrayType = getJniType(bufferType.getArrayTypeForTypedBuffer());
|
||||
out.println(indent + typedArrayType + " _" + bufferArgNames.get(i) +
|
||||
"Array = (" + typedArrayType + ") 0;");
|
||||
} else {
|
||||
out.println(indent + "jarray _" + bufferArgNames.get(i) +
|
||||
"Array = (jarray) 0;");
|
||||
}
|
||||
out.println(indent + "jint _" + bufferArgNames.get(i) +
|
||||
"BufferOffset = (jint) 0;");
|
||||
}
|
||||
@ -1135,9 +1150,10 @@ public class JniCodeEmitter {
|
||||
"_base = (" +
|
||||
cfunc.getArgType(cIndex).getDeclaration() +
|
||||
")");
|
||||
String arrayGetter = jfunc.getArgType(idx).getArrayGetterForPrimitiveArray();
|
||||
out.println(indent + " " +
|
||||
(mUseCPlusPlus ? "_env" : "(*_env)") +
|
||||
"->GetPrimitiveArrayCritical(" +
|
||||
"->" + arrayGetter + "(" +
|
||||
(mUseCPlusPlus ? "" : "_env, ") +
|
||||
jfunc.getArgName(idx) +
|
||||
"_ref, (jboolean *)0);");
|
||||
@ -1209,7 +1225,7 @@ public class JniCodeEmitter {
|
||||
cfunc.getArgType(cIndex).getDeclaration() +
|
||||
")getPointer(_env, " +
|
||||
cname +
|
||||
"_buf, &" + array + ", &" + remaining + ", &" + bufferOffset +
|
||||
"_buf, (jarray*)&" + array + ", &" + remaining + ", &" + bufferOffset +
|
||||
");");
|
||||
}
|
||||
|
||||
@ -1244,11 +1260,19 @@ public class JniCodeEmitter {
|
||||
} else {
|
||||
out.println(indent + "if (" + cname +" == NULL) {");
|
||||
}
|
||||
JType argType = jfunc.getArgType(idx);
|
||||
if (argType.isTypedBuffer()) {
|
||||
String arrayGetter = argType.getArrayTypeForTypedBuffer().getArrayGetterForPrimitiveArray();
|
||||
out.println(indent + indent + "char * _" + cname + "Base = (char *)_env->" + arrayGetter + "(" + array + ", (jboolean *) 0);");
|
||||
out.println(indent + indent + cname + " = (" +cfunc.getArgType(cIndex).getDeclaration() +") (_" + cname + "Base + " + bufferOffset + ");");
|
||||
out.println(indent + "}");
|
||||
} else {
|
||||
out.println(indent + indent + "char * _" + cname + "Base = (char *)_env->GetPrimitiveArrayCritical(" + array + ", (jboolean *) 0);");
|
||||
out.println(indent + indent + cname + " = (" +cfunc.getArgType(cIndex).getDeclaration() +") (_" + cname + "Base + " + bufferOffset + ");");
|
||||
out.println(indent + "}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!isVoid) {
|
||||
@ -1336,12 +1360,13 @@ public class JniCodeEmitter {
|
||||
// the need to write back to the Java array
|
||||
out.println(indent +
|
||||
"if (" + jfunc.getArgName(idx) + "_base) {");
|
||||
String arrayReleaser = jfunc.getArgType(idx).getArrayReleaserForPrimitiveArray();
|
||||
out.println(indent + indent +
|
||||
(mUseCPlusPlus ? "_env" : "(*_env)") +
|
||||
"->ReleasePrimitiveArrayCritical(" +
|
||||
"->" + arrayReleaser + "(" +
|
||||
(mUseCPlusPlus ? "" : "_env, ") +
|
||||
jfunc.getArgName(idx) + "_ref, " +
|
||||
cfunc.getArgName(cIndex) +
|
||||
"(j" + jfunc.getArgType(idx).getBaseType() + "*)" + cfunc.getArgName(cIndex) +
|
||||
"_base,");
|
||||
out.println(indent + indent + indent +
|
||||
(cfunc.getArgType(cIndex).isConst() ?
|
||||
@ -1350,9 +1375,23 @@ public class JniCodeEmitter {
|
||||
out.println(indent + "}");
|
||||
} else if (jfunc.getArgType(idx).isBuffer()) {
|
||||
if (! isPointerFunc) {
|
||||
JType argType = jfunc.getArgType(idx);
|
||||
String array = numBufferArgs <= 1 ? "_array" :
|
||||
"_" + cfunc.getArgName(cIndex) + "Array";
|
||||
out.println(indent + "if (" + array + ") {");
|
||||
if (argType.isTypedBuffer()) {
|
||||
String arrayReleaser =
|
||||
argType.getArrayTypeForTypedBuffer().getArrayReleaserForPrimitiveArray();
|
||||
out.println(indent + indent +
|
||||
"_env->" + arrayReleaser + "(" + array + ", " +
|
||||
"(j" + argType.getArrayTypeForTypedBuffer().getBaseType() + "*)" +
|
||||
cfunc.getArgName(cIndex) +
|
||||
", " +
|
||||
(cfunc.getArgType(cIndex).isConst() ?
|
||||
"JNI_ABORT" : (emitExceptionCheck ?
|
||||
"_exception ? JNI_ABORT : 0" : "0")) +
|
||||
");");
|
||||
} else {
|
||||
out.println(indent + indent +
|
||||
"releasePointer(_env, " + array + ", " +
|
||||
cfunc.getArgName(cIndex) +
|
||||
@ -1361,6 +1400,7 @@ public class JniCodeEmitter {
|
||||
"JNI_FALSE" : (emitExceptionCheck ?
|
||||
"_exception ? JNI_FALSE : JNI_TRUE" : "JNI_TRUE")) +
|
||||
");");
|
||||
}
|
||||
out.println(indent + "}");
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ android_eglCreatePbufferFromClientBuffer
|
||||
}
|
||||
_remaining = _env->GetArrayLength(attrib_list_ref) - offset;
|
||||
attrib_list_base = (EGLint *)
|
||||
_env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0);
|
||||
_env->GetIntArrayElements(attrib_list_ref, (jboolean *)0);
|
||||
attrib_list = attrib_list_base + offset;
|
||||
attrib_list_sentinel = false;
|
||||
for (int i = _remaining - 1; i >= 0; i--) {
|
||||
@ -53,7 +53,7 @@ android_eglCreatePbufferFromClientBuffer
|
||||
|
||||
exit:
|
||||
if (attrib_list_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base,
|
||||
_env->ReleaseIntArrayElements(attrib_list_ref, attrib_list_base,
|
||||
JNI_ABORT);
|
||||
}
|
||||
if (_exception) {
|
||||
@ -71,4 +71,3 @@ android_eglCreatePbufferFromClientBufferInt
|
||||
}
|
||||
return android_eglCreatePbufferFromClientBuffer(_env, _this, dpy, buftype, buffer, config, attrib_list_ref, offset);
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@ not_valid_surface:
|
||||
|
||||
_remaining = _env->GetArrayLength(attrib_list_ref) - offset;
|
||||
attrib_list_base = (EGLint *)
|
||||
_env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0);
|
||||
_env->GetIntArrayElements(attrib_list_ref, (jboolean *)0);
|
||||
attrib_list = attrib_list_base + offset;
|
||||
attrib_list_sentinel = 0;
|
||||
for (int i = _remaining - 1; i >= 0; i--) {
|
||||
@ -66,7 +66,7 @@ not_valid_surface:
|
||||
|
||||
exit:
|
||||
if (attrib_list_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base,
|
||||
_env->ReleaseIntArrayElements(attrib_list_ref, attrib_list_base,
|
||||
JNI_ABORT);
|
||||
}
|
||||
if (_exception) {
|
||||
@ -123,7 +123,7 @@ not_valid_surface:
|
||||
|
||||
_remaining = _env->GetArrayLength(attrib_list_ref) - offset;
|
||||
attrib_list_base = (EGLint *)
|
||||
_env->GetPrimitiveArrayCritical(attrib_list_ref, (jboolean *)0);
|
||||
_env->GetIntArrayElements(attrib_list_ref, (jboolean *)0);
|
||||
attrib_list = attrib_list_base + offset;
|
||||
attrib_list_sentinel = 0;
|
||||
for (int i = _remaining - 1; i >= 0; i--) {
|
||||
@ -148,7 +148,7 @@ not_valid_surface:
|
||||
|
||||
exit:
|
||||
if (attrib_list_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(attrib_list_ref, attrib_list_base,
|
||||
_env->ReleaseIntArrayElements(attrib_list_ref, attrib_list_base,
|
||||
JNI_ABORT);
|
||||
}
|
||||
if (_exception) {
|
||||
|
@ -100,6 +100,116 @@ getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *o
|
||||
return NULL;
|
||||
}
|
||||
|
||||
class ByteArrayGetter {
|
||||
public:
|
||||
static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) {
|
||||
return _env->GetByteArrayElements(array, is_copy);
|
||||
}
|
||||
};
|
||||
class BooleanArrayGetter {
|
||||
public:
|
||||
static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) {
|
||||
return _env->GetBooleanArrayElements(array, is_copy);
|
||||
}
|
||||
};
|
||||
class CharArrayGetter {
|
||||
public:
|
||||
static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) {
|
||||
return _env->GetCharArrayElements(array, is_copy);
|
||||
}
|
||||
};
|
||||
class ShortArrayGetter {
|
||||
public:
|
||||
static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) {
|
||||
return _env->GetShortArrayElements(array, is_copy);
|
||||
}
|
||||
};
|
||||
class IntArrayGetter {
|
||||
public:
|
||||
static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) {
|
||||
return _env->GetIntArrayElements(array, is_copy);
|
||||
}
|
||||
};
|
||||
class LongArrayGetter {
|
||||
public:
|
||||
static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) {
|
||||
return _env->GetLongArrayElements(array, is_copy);
|
||||
}
|
||||
};
|
||||
class FloatArrayGetter {
|
||||
public:
|
||||
static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) {
|
||||
return _env->GetFloatArrayElements(array, is_copy);
|
||||
}
|
||||
};
|
||||
class DoubleArrayGetter {
|
||||
public:
|
||||
static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) {
|
||||
return _env->GetDoubleArrayElements(array, is_copy);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename JTYPEARRAY, typename ARRAYGETTER>
|
||||
static void*
|
||||
getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) {
|
||||
return ARRAYGETTER::Get(_env, array, is_copy);
|
||||
}
|
||||
|
||||
class ByteArrayReleaser {
|
||||
public:
|
||||
static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) {
|
||||
_env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT);
|
||||
}
|
||||
};
|
||||
class BooleanArrayReleaser {
|
||||
public:
|
||||
static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) {
|
||||
_env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT);
|
||||
}
|
||||
};
|
||||
class CharArrayReleaser {
|
||||
public:
|
||||
static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) {
|
||||
_env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT);
|
||||
}
|
||||
};
|
||||
class ShortArrayReleaser {
|
||||
public:
|
||||
static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) {
|
||||
_env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT);
|
||||
}
|
||||
};
|
||||
class IntArrayReleaser {
|
||||
public:
|
||||
static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) {
|
||||
_env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT);
|
||||
}
|
||||
};
|
||||
class LongArrayReleaser {
|
||||
public:
|
||||
static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) {
|
||||
_env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT);
|
||||
}
|
||||
};
|
||||
class FloatArrayReleaser {
|
||||
public:
|
||||
static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) {
|
||||
_env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT);
|
||||
}
|
||||
};
|
||||
class DoubleArrayReleaser {
|
||||
public:
|
||||
static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) {
|
||||
_env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename JTYPEARRAY, typename NTYPEARRAY, typename ARRAYRELEASER>
|
||||
static void
|
||||
releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) {
|
||||
ARRAYRELEASER::Release(_env, array, data, commit);
|
||||
}
|
||||
|
||||
static void
|
||||
releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit)
|
||||
{
|
||||
@ -203,7 +313,8 @@ static int getNeededCount(GLint pname) {
|
||||
return needed;
|
||||
}
|
||||
|
||||
template <typename JTYPEARRAY, typename CTYPE, void GET(GLenum, CTYPE*)>
|
||||
template <typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
|
||||
typename ARRAYRELEASER, typename CTYPE, void GET(GLenum, CTYPE*)>
|
||||
static void
|
||||
get
|
||||
(JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) {
|
||||
@ -238,8 +349,8 @@ get
|
||||
_exceptionMessage = "length - offset < needed";
|
||||
goto exit;
|
||||
}
|
||||
params_base = (CTYPE *)
|
||||
_env->GetPrimitiveArrayCritical(params_ref, (jboolean *)0);
|
||||
params_base = (CTYPE *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
|
||||
_env, params_ref, (jboolean *)0);
|
||||
params = params_base + offset;
|
||||
|
||||
GET(
|
||||
@ -249,8 +360,8 @@ get
|
||||
|
||||
exit:
|
||||
if (params_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(params_ref, params_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
|
||||
_env, params_ref, params_base, !_exception);
|
||||
}
|
||||
if (_exception) {
|
||||
jniThrowException(_env, _exceptionType, _exceptionMessage);
|
||||
@ -258,20 +369,21 @@ exit:
|
||||
}
|
||||
|
||||
|
||||
template <typename CTYPE, void GET(GLenum, CTYPE*)>
|
||||
template <typename CTYPE, typename JTYPEARRAY, typename ARRAYGETTER, typename NTYPEARRAY,
|
||||
typename ARRAYRELEASER, void GET(GLenum, CTYPE*)>
|
||||
static void
|
||||
getarray
|
||||
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
|
||||
jint _exception = 0;
|
||||
const char * _exceptionType;
|
||||
const char * _exceptionMessage;
|
||||
jarray _array = (jarray) 0;
|
||||
JTYPEARRAY _array = (JTYPEARRAY) 0;
|
||||
jint _bufferOffset = (jint) 0;
|
||||
jint _remaining;
|
||||
CTYPE *params = (CTYPE *) 0;
|
||||
int _needed = 0;
|
||||
|
||||
params = (CTYPE *)getPointer(_env, params_buf, &_array, &_remaining, &_bufferOffset);
|
||||
params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
|
||||
_remaining /= sizeof(CTYPE); // convert from bytes to item count
|
||||
_needed = getNeededCount(pname);
|
||||
// if we didn't find this pname, we just assume the user passed
|
||||
@ -284,7 +396,8 @@ getarray
|
||||
goto exit;
|
||||
}
|
||||
if (params == NULL) {
|
||||
char * _paramsBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
|
||||
char * _paramsBase = (char *) getArrayPointer<JTYPEARRAY, ARRAYGETTER>(
|
||||
_env, _array, (jboolean *) 0);
|
||||
params = (CTYPE *) (_paramsBase + _bufferOffset);
|
||||
}
|
||||
GET(
|
||||
@ -294,7 +407,8 @@ getarray
|
||||
|
||||
exit:
|
||||
if (_array) {
|
||||
releasePointer(_env, _array, params, _exception ? JNI_FALSE : JNI_TRUE);
|
||||
releaseArrayPointer<JTYPEARRAY, NTYPEARRAY, ARRAYRELEASER>(
|
||||
_env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE);
|
||||
}
|
||||
if (_exception) {
|
||||
jniThrowException(_env, _exceptionType, _exceptionMessage);
|
||||
|
@ -36,4 +36,3 @@ android_glDrawElementsInstanced__IIIII
|
||||
(GLsizei)instanceCount
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ android_glGetActiveAttrib__III_3II_3II_3II_3BI
|
||||
}
|
||||
_lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
|
||||
length_base = (GLsizei *)
|
||||
_env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
|
||||
_env->GetIntArrayElements(length_ref, (jboolean *)0);
|
||||
length = length_base + lengthOffset;
|
||||
|
||||
if (!size_ref) {
|
||||
@ -49,7 +49,7 @@ android_glGetActiveAttrib__III_3II_3II_3II_3BI
|
||||
}
|
||||
_sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
|
||||
size_base = (GLint *)
|
||||
_env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
|
||||
_env->GetIntArrayElements(size_ref, (jboolean *)0);
|
||||
size = size_base + sizeOffset;
|
||||
|
||||
if (!type_ref) {
|
||||
@ -66,7 +66,7 @@ android_glGetActiveAttrib__III_3II_3II_3II_3BI
|
||||
}
|
||||
_typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
|
||||
type_base = (GLenum *)
|
||||
_env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
|
||||
_env->GetIntArrayElements(type_ref, (jboolean *)0);
|
||||
type = type_base + typeOffset;
|
||||
|
||||
if (!name_ref) {
|
||||
@ -83,7 +83,7 @@ android_glGetActiveAttrib__III_3II_3II_3II_3BI
|
||||
}
|
||||
_nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
|
||||
name_base = (char *)
|
||||
_env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0);
|
||||
_env->GetByteArrayElements(name_ref, (jboolean *)0);
|
||||
name = name_base + nameOffset;
|
||||
|
||||
glGetActiveAttrib(
|
||||
@ -98,19 +98,19 @@ android_glGetActiveAttrib__III_3II_3II_3II_3BI
|
||||
|
||||
exit:
|
||||
if (name_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(name_ref, name_base,
|
||||
_env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (type_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(type_ref, type_base,
|
||||
_env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (size_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(size_ref, size_base,
|
||||
_env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (length_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(length_ref, length_base,
|
||||
_env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (_exception) {
|
||||
@ -122,11 +122,11 @@ exit:
|
||||
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) {
|
||||
jarray _lengthArray = (jarray) 0;
|
||||
jintArray _lengthArray = (jintArray) 0;
|
||||
jint _lengthBufferOffset = (jint) 0;
|
||||
jarray _sizeArray = (jarray) 0;
|
||||
jintArray _sizeArray = (jintArray) 0;
|
||||
jint _sizeBufferOffset = (jint) 0;
|
||||
jarray _typeArray = (jarray) 0;
|
||||
jintArray _typeArray = (jintArray) 0;
|
||||
jint _typeBufferOffset = (jint) 0;
|
||||
jint _lengthRemaining;
|
||||
GLsizei *length = (GLsizei *) 0;
|
||||
@ -135,19 +135,19 @@ android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_ni
|
||||
jint _typeRemaining;
|
||||
GLenum *type = (GLenum *) 0;
|
||||
|
||||
length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
|
||||
size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
|
||||
type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
|
||||
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);
|
||||
if (length == NULL) {
|
||||
char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0);
|
||||
char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
|
||||
length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
|
||||
}
|
||||
if (size == NULL) {
|
||||
char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
|
||||
char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
|
||||
size = (GLint *) (_sizeBase + _sizeBufferOffset);
|
||||
}
|
||||
if (type == NULL) {
|
||||
char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
|
||||
char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
|
||||
type = (GLenum *) (_typeBase + _typeBufferOffset);
|
||||
}
|
||||
glGetActiveAttrib(
|
||||
@ -160,13 +160,13 @@ android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_ni
|
||||
reinterpret_cast<char *>(name)
|
||||
);
|
||||
if (_typeArray) {
|
||||
releasePointer(_env, _typeArray, type, JNI_TRUE);
|
||||
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
|
||||
}
|
||||
if (_sizeArray) {
|
||||
releasePointer(_env, _sizeArray, size, JNI_TRUE);
|
||||
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
|
||||
}
|
||||
if (_lengthArray) {
|
||||
releasePointer(_env, _lengthArray, length, JNI_TRUE);
|
||||
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ android_glGetActiveAttrib1
|
||||
}
|
||||
_sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
|
||||
size_base = (GLint *)
|
||||
_env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
|
||||
_env->GetIntArrayElements(size_ref, (jboolean *)0);
|
||||
size = size_base + sizeOffset;
|
||||
|
||||
if (!type_ref) {
|
||||
@ -228,7 +228,7 @@ android_glGetActiveAttrib1
|
||||
}
|
||||
_typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
|
||||
type_base = (GLenum *)
|
||||
_env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
|
||||
_env->GetIntArrayElements(type_ref, (jboolean *)0);
|
||||
type = type_base + typeOffset;
|
||||
|
||||
glGetActiveAttrib(
|
||||
@ -242,11 +242,11 @@ android_glGetActiveAttrib1
|
||||
);
|
||||
exit:
|
||||
if (type_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(type_ref, type_base,
|
||||
_env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (size_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(size_ref, size_base,
|
||||
_env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (_exception != 1) {
|
||||
@ -269,9 +269,9 @@ exit:
|
||||
static jstring
|
||||
android_glGetActiveAttrib2
|
||||
(JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
|
||||
jarray _sizeArray = (jarray) 0;
|
||||
jintArray _sizeArray = (jintArray) 0;
|
||||
jint _sizeBufferOffset = (jint) 0;
|
||||
jarray _typeArray = (jarray) 0;
|
||||
jintArray _typeArray = (jintArray) 0;
|
||||
jint _typeBufferOffset = (jint) 0;
|
||||
jint _lengthRemaining;
|
||||
GLsizei *length = (GLsizei *) 0;
|
||||
@ -294,14 +294,14 @@ android_glGetActiveAttrib2
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
|
||||
type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
|
||||
size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
|
||||
type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
|
||||
if (size == NULL) {
|
||||
char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
|
||||
char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
|
||||
size = (GLint *) (_sizeBase + _sizeBufferOffset);
|
||||
}
|
||||
if (type == NULL) {
|
||||
char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
|
||||
char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
|
||||
type = (GLenum *) (_typeBase + _typeBufferOffset);
|
||||
}
|
||||
glGetActiveAttrib(
|
||||
@ -315,10 +315,10 @@ android_glGetActiveAttrib2
|
||||
);
|
||||
|
||||
if (_typeArray) {
|
||||
releasePointer(_env, _typeArray, type, JNI_TRUE);
|
||||
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
|
||||
}
|
||||
if (_sizeArray) {
|
||||
releasePointer(_env, _sizeArray, size, JNI_TRUE);
|
||||
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
|
||||
}
|
||||
result = _env->NewStringUTF(buf);
|
||||
if (buf) {
|
||||
|
@ -32,7 +32,7 @@ android_glGetActiveUniform__III_3II_3II_3II_3BI
|
||||
}
|
||||
_lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
|
||||
length_base = (GLsizei *)
|
||||
_env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
|
||||
_env->GetIntArrayElements(length_ref, (jboolean *)0);
|
||||
length = length_base + lengthOffset;
|
||||
|
||||
if (!size_ref) {
|
||||
@ -49,7 +49,7 @@ android_glGetActiveUniform__III_3II_3II_3II_3BI
|
||||
}
|
||||
_sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
|
||||
size_base = (GLint *)
|
||||
_env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
|
||||
_env->GetIntArrayElements(size_ref, (jboolean *)0);
|
||||
size = size_base + sizeOffset;
|
||||
|
||||
if (!type_ref) {
|
||||
@ -66,7 +66,7 @@ android_glGetActiveUniform__III_3II_3II_3II_3BI
|
||||
}
|
||||
_typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
|
||||
type_base = (GLenum *)
|
||||
_env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
|
||||
_env->GetIntArrayElements(type_ref, (jboolean *)0);
|
||||
type = type_base + typeOffset;
|
||||
|
||||
if (!name_ref) {
|
||||
@ -83,7 +83,7 @@ android_glGetActiveUniform__III_3II_3II_3II_3BI
|
||||
}
|
||||
_nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
|
||||
name_base = (char *)
|
||||
_env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0);
|
||||
_env->GetByteArrayElements(name_ref, (jboolean *)0);
|
||||
name = name_base + nameOffset;
|
||||
|
||||
glGetActiveUniform(
|
||||
@ -98,19 +98,19 @@ android_glGetActiveUniform__III_3II_3II_3II_3BI
|
||||
|
||||
exit:
|
||||
if (name_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(name_ref, name_base,
|
||||
_env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (type_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(type_ref, type_base,
|
||||
_env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (size_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(size_ref, size_base,
|
||||
_env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (length_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(length_ref, length_base,
|
||||
_env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (_exception) {
|
||||
@ -122,11 +122,11 @@ exit:
|
||||
static void
|
||||
android_glGetActiveUniform__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) {
|
||||
jarray _lengthArray = (jarray) 0;
|
||||
jintArray _lengthArray = (jintArray) 0;
|
||||
jint _lengthBufferOffset = (jint) 0;
|
||||
jarray _sizeArray = (jarray) 0;
|
||||
jintArray _sizeArray = (jintArray) 0;
|
||||
jint _sizeBufferOffset = (jint) 0;
|
||||
jarray _typeArray = (jarray) 0;
|
||||
jintArray _typeArray = (jintArray) 0;
|
||||
jint _typeBufferOffset = (jint) 0;
|
||||
jint _lengthRemaining;
|
||||
GLsizei *length = (GLsizei *) 0;
|
||||
@ -135,19 +135,19 @@ android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_n
|
||||
jint _typeRemaining;
|
||||
GLenum *type = (GLenum *) 0;
|
||||
|
||||
length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
|
||||
size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
|
||||
type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
|
||||
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);
|
||||
if (length == NULL) {
|
||||
char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0);
|
||||
char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
|
||||
length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
|
||||
}
|
||||
if (size == NULL) {
|
||||
char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
|
||||
char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
|
||||
size = (GLint *) (_sizeBase + _sizeBufferOffset);
|
||||
}
|
||||
if (type == NULL) {
|
||||
char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
|
||||
char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
|
||||
type = (GLenum *) (_typeBase + _typeBufferOffset);
|
||||
}
|
||||
glGetActiveUniform(
|
||||
@ -160,13 +160,13 @@ android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_n
|
||||
reinterpret_cast<char *>(name)
|
||||
);
|
||||
if (_typeArray) {
|
||||
releasePointer(_env, _typeArray, type, JNI_TRUE);
|
||||
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
|
||||
}
|
||||
if (_sizeArray) {
|
||||
releasePointer(_env, _sizeArray, size, JNI_TRUE);
|
||||
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
|
||||
}
|
||||
if (_lengthArray) {
|
||||
releasePointer(_env, _lengthArray, length, JNI_TRUE);
|
||||
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,7 +214,7 @@ android_glGetActiveUniform1
|
||||
}
|
||||
_sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
|
||||
size_base = (GLint *)
|
||||
_env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
|
||||
_env->GetIntArrayElements(size_ref, (jboolean *)0);
|
||||
size = size_base + sizeOffset;
|
||||
|
||||
if (!type_ref) {
|
||||
@ -231,7 +231,7 @@ android_glGetActiveUniform1
|
||||
}
|
||||
_typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
|
||||
type_base = (GLenum *)
|
||||
_env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
|
||||
_env->GetIntArrayElements(type_ref, (jboolean *)0);
|
||||
type = type_base + typeOffset;
|
||||
|
||||
glGetActiveUniform(
|
||||
@ -246,11 +246,11 @@ android_glGetActiveUniform1
|
||||
|
||||
exit:
|
||||
if (type_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(type_ref, type_base,
|
||||
_env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (size_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(size_ref, size_base,
|
||||
_env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (_exception != 1) {
|
||||
@ -272,9 +272,9 @@ exit:
|
||||
static jstring
|
||||
android_glGetActiveUniform2
|
||||
(JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
|
||||
jarray _sizeArray = (jarray) 0;
|
||||
jintArray _sizeArray = (jintArray) 0;
|
||||
jint _sizeBufferOffset = (jint) 0;
|
||||
jarray _typeArray = (jarray) 0;
|
||||
jintArray _typeArray = (jintArray) 0;
|
||||
jint _typeBufferOffset = (jint) 0;
|
||||
jint _sizeRemaining;
|
||||
GLint *size = (GLint *) 0;
|
||||
@ -294,15 +294,15 @@ android_glGetActiveUniform2
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
|
||||
type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
|
||||
size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
|
||||
type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
|
||||
|
||||
if (size == NULL) {
|
||||
char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
|
||||
char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
|
||||
size = (GLint *) (_sizeBase + _sizeBufferOffset);
|
||||
}
|
||||
if (type == NULL) {
|
||||
char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
|
||||
char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
|
||||
type = (GLenum *) (_typeBase + _typeBufferOffset);
|
||||
}
|
||||
glGetActiveUniform(
|
||||
@ -316,10 +316,10 @@ android_glGetActiveUniform2
|
||||
);
|
||||
|
||||
if (_typeArray) {
|
||||
releasePointer(_env, _typeArray, type, JNI_TRUE);
|
||||
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
|
||||
}
|
||||
if (_sizeArray) {
|
||||
releasePointer(_env, _sizeArray, size, JNI_TRUE);
|
||||
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
|
||||
}
|
||||
result = _env->NewStringUTF(buf);
|
||||
if (buf) {
|
||||
|
@ -25,7 +25,7 @@ android_glGetActiveUniformBlockName_III_3II_3BI
|
||||
goto exit;
|
||||
}
|
||||
_lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
|
||||
_length_base = (GLsizei*)_env->GetPrimitiveArrayCritical(
|
||||
_length_base = (GLsizei*)_env->GetIntArrayElements(
|
||||
length_ref, (jboolean*)0);
|
||||
_length = _length_base + lengthOffset;
|
||||
|
||||
@ -42,7 +42,7 @@ android_glGetActiveUniformBlockName_III_3II_3BI
|
||||
goto exit;
|
||||
}
|
||||
_nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
|
||||
_name_base = (GLchar*)_env->GetPrimitiveArrayCritical(
|
||||
_name_base = (GLchar*)_env->GetByteArrayElements(
|
||||
name_ref, (jboolean*)0);
|
||||
_name = _name_base + nameOffset;
|
||||
|
||||
@ -56,11 +56,11 @@ android_glGetActiveUniformBlockName_III_3II_3BI
|
||||
|
||||
exit:
|
||||
if (_name_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(name_ref, _name_base,
|
||||
_env->ReleaseByteArrayElements(name_ref, (jbyte*)_name_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (_length_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(length_ref, _length_base,
|
||||
_env->ReleaseIntArrayElements(length_ref, (jint*)_length_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (_exception) {
|
||||
@ -124,4 +124,3 @@ android_glGetActiveUniformBlockName_II
|
||||
free(name);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -2,12 +2,14 @@
|
||||
static void
|
||||
android_glGetBooleanv__I_3ZI
|
||||
(JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) {
|
||||
get<jbooleanArray, GLboolean, glGetBooleanv>(_env, _this, pname, params_ref, offset);
|
||||
get<jbooleanArray, BooleanArrayGetter, jboolean*, BooleanArrayReleaser, GLboolean, glGetBooleanv>(
|
||||
_env, _this, pname, params_ref, offset);
|
||||
}
|
||||
|
||||
/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */
|
||||
static void
|
||||
android_glGetBooleanv__ILjava_nio_IntBuffer_2
|
||||
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
|
||||
getarray<GLboolean, glGetBooleanv>(_env, _this, pname, params_buf);
|
||||
getarray<GLboolean, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetBooleanv>(
|
||||
_env, _this, pname, params_buf);
|
||||
}
|
||||
|
@ -2,12 +2,14 @@
|
||||
static void
|
||||
android_glGetFloatv__I_3FI
|
||||
(JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) {
|
||||
get<jfloatArray, GLfloat, glGetFloatv>(_env, _this, pname, params_ref, offset);
|
||||
get<jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, GLfloat, glGetFloatv>(
|
||||
_env, _this, pname, params_ref, offset);
|
||||
}
|
||||
|
||||
/* void glGetFloatv ( GLenum pname, GLfloat *params ) */
|
||||
static void
|
||||
android_glGetFloatv__ILjava_nio_FloatBuffer_2
|
||||
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
|
||||
getarray<GLfloat, glGetFloatv>(_env, _this, pname, params_buf);
|
||||
getarray<GLfloat, jfloatArray, FloatArrayGetter, jfloat*, FloatArrayReleaser, glGetFloatv>(
|
||||
_env, _this, pname, params_buf);
|
||||
}
|
||||
|
@ -2,13 +2,14 @@
|
||||
static void
|
||||
android_glGetIntegerv__I_3II
|
||||
(JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) {
|
||||
get<jintArray, GLint, glGetIntegerv>(_env, _this, pname, params_ref, offset);
|
||||
get<jintArray, IntArrayGetter, jint*, IntArrayReleaser, GLint, glGetIntegerv>(
|
||||
_env, _this, pname, params_ref, offset);
|
||||
}
|
||||
|
||||
/* void glGetIntegerv ( GLenum pname, GLint *params ) */
|
||||
static void
|
||||
android_glGetIntegerv__ILjava_nio_IntBuffer_2
|
||||
(JNIEnv *_env, jobject _this, jint pname, jobject params_buf) {
|
||||
getarray<GLint, glGetIntegerv>(_env, _this, pname, params_buf);
|
||||
getarray<GLint, jintArray, IntArrayGetter, jint*, IntArrayReleaser, glGetIntegerv>(
|
||||
_env, _this, pname, params_buf);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ android_glGetShaderSource__II_3II_3BI
|
||||
}
|
||||
_lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
|
||||
length_base = (GLsizei *)
|
||||
_env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
|
||||
_env->GetIntArrayElements(length_ref, (jboolean *)0);
|
||||
length = length_base + lengthOffset;
|
||||
|
||||
if (!source_ref) {
|
||||
@ -43,7 +43,7 @@ android_glGetShaderSource__II_3II_3BI
|
||||
}
|
||||
_sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset;
|
||||
source_base = (char *)
|
||||
_env->GetPrimitiveArrayCritical(source_ref, (jboolean *)0);
|
||||
_env->GetByteArrayElements(source_ref, (jboolean *)0);
|
||||
source = source_base + sourceOffset;
|
||||
|
||||
glGetShaderSource(
|
||||
@ -55,11 +55,11 @@ android_glGetShaderSource__II_3II_3BI
|
||||
|
||||
exit:
|
||||
if (source_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(source_ref, source_base,
|
||||
_env->ReleaseByteArrayElements(source_ref, (jbyte*)source_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (length_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(length_ref, length_base,
|
||||
_env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (_exception) {
|
||||
@ -71,14 +71,14 @@ exit:
|
||||
static void
|
||||
android_glGetShaderSource__IILjava_nio_IntBuffer_2B
|
||||
(JNIEnv *_env, jobject _this, jint shader, jint bufsize, jobject length_buf, jbyte source) {
|
||||
jarray _array = (jarray) 0;
|
||||
jintArray _array = (jintArray) 0;
|
||||
jint _bufferOffset = (jint) 0;
|
||||
jint _remaining;
|
||||
GLsizei *length = (GLsizei *) 0;
|
||||
|
||||
length = (GLsizei *)getPointer(_env, length_buf, &_array, &_remaining, &_bufferOffset);
|
||||
length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_array, &_remaining, &_bufferOffset);
|
||||
if (length == NULL) {
|
||||
char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0);
|
||||
char * _lengthBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0);
|
||||
length = (GLsizei *) (_lengthBase + _bufferOffset);
|
||||
}
|
||||
glGetShaderSource(
|
||||
@ -88,7 +88,7 @@ android_glGetShaderSource__IILjava_nio_IntBuffer_2B
|
||||
reinterpret_cast<char *>(source)
|
||||
);
|
||||
if (_array) {
|
||||
releasePointer(_env, _array, length, JNI_TRUE);
|
||||
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _array, (jint*)length, JNI_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ android_glGetTransformFeedbackVarying__III_3II_3II_3II_3BI
|
||||
}
|
||||
_lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
|
||||
length_base = (GLsizei *)
|
||||
_env->GetPrimitiveArrayCritical(length_ref, (jboolean *)0);
|
||||
_env->GetIntArrayElements(length_ref, (jboolean *)0);
|
||||
length = length_base + lengthOffset;
|
||||
|
||||
if (!size_ref) {
|
||||
@ -49,7 +49,7 @@ android_glGetTransformFeedbackVarying__III_3II_3II_3II_3BI
|
||||
}
|
||||
_sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
|
||||
size_base = (GLint *)
|
||||
_env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
|
||||
_env->GetIntArrayElements(size_ref, (jboolean *)0);
|
||||
size = size_base + sizeOffset;
|
||||
|
||||
if (!type_ref) {
|
||||
@ -66,7 +66,7 @@ android_glGetTransformFeedbackVarying__III_3II_3II_3II_3BI
|
||||
}
|
||||
_typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
|
||||
type_base = (GLenum *)
|
||||
_env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
|
||||
_env->GetIntArrayElements(type_ref, (jboolean *)0);
|
||||
type = type_base + typeOffset;
|
||||
|
||||
if (!name_ref) {
|
||||
@ -83,7 +83,7 @@ android_glGetTransformFeedbackVarying__III_3II_3II_3II_3BI
|
||||
}
|
||||
_nameRemaining = _env->GetArrayLength(name_ref) - nameOffset;
|
||||
name_base = (char *)
|
||||
_env->GetPrimitiveArrayCritical(name_ref, (jboolean *)0);
|
||||
_env->GetByteArrayElements(name_ref, (jboolean *)0);
|
||||
name = name_base + nameOffset;
|
||||
|
||||
glGetTransformFeedbackVarying(
|
||||
@ -98,19 +98,19 @@ android_glGetTransformFeedbackVarying__III_3II_3II_3II_3BI
|
||||
|
||||
exit:
|
||||
if (name_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(name_ref, name_base,
|
||||
_env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (type_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(type_ref, type_base,
|
||||
_env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (size_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(size_ref, size_base,
|
||||
_env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (length_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(length_ref, length_base,
|
||||
_env->ReleaseIntArrayElements(length_ref, (jint*)length_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (_exception) {
|
||||
@ -122,11 +122,11 @@ exit:
|
||||
static void
|
||||
android_glGetTransformFeedbackVarying__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) {
|
||||
jarray _lengthArray = (jarray) 0;
|
||||
jintArray _lengthArray = (jintArray) 0;
|
||||
jint _lengthBufferOffset = (jint) 0;
|
||||
jarray _sizeArray = (jarray) 0;
|
||||
jintArray _sizeArray = (jintArray) 0;
|
||||
jint _sizeBufferOffset = (jint) 0;
|
||||
jarray _typeArray = (jarray) 0;
|
||||
jintArray _typeArray = (jintArray) 0;
|
||||
jint _typeBufferOffset = (jint) 0;
|
||||
jint _lengthRemaining;
|
||||
GLsizei *length = (GLsizei *) 0;
|
||||
@ -135,19 +135,19 @@ android_glGetTransformFeedbackVarying__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuff
|
||||
jint _typeRemaining;
|
||||
GLenum *type = (GLenum *) 0;
|
||||
|
||||
length = (GLsizei *)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset);
|
||||
size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
|
||||
type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
|
||||
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);
|
||||
if (length == NULL) {
|
||||
char * _lengthBase = (char *)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean *) 0);
|
||||
char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0);
|
||||
length = (GLsizei *) (_lengthBase + _lengthBufferOffset);
|
||||
}
|
||||
if (size == NULL) {
|
||||
char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
|
||||
char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
|
||||
size = (GLint *) (_sizeBase + _sizeBufferOffset);
|
||||
}
|
||||
if (type == NULL) {
|
||||
char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
|
||||
char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
|
||||
type = (GLenum *) (_typeBase + _typeBufferOffset);
|
||||
}
|
||||
glGetTransformFeedbackVarying(
|
||||
@ -164,13 +164,13 @@ android_glGetTransformFeedbackVarying__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuff
|
||||
(char *)static_cast<uintptr_t>(name)
|
||||
);
|
||||
if (_typeArray) {
|
||||
releasePointer(_env, _typeArray, type, JNI_TRUE);
|
||||
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
|
||||
}
|
||||
if (_sizeArray) {
|
||||
releasePointer(_env, _sizeArray, size, JNI_TRUE);
|
||||
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
|
||||
}
|
||||
if (_lengthArray) {
|
||||
releasePointer(_env, _lengthArray, length, JNI_TRUE);
|
||||
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _lengthArray, (jint*)length, JNI_TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,7 +215,7 @@ android_glGetTransformFeedbackVarying1
|
||||
}
|
||||
_sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset;
|
||||
size_base = (GLint *)
|
||||
_env->GetPrimitiveArrayCritical(size_ref, (jboolean *)0);
|
||||
_env->GetIntArrayElements(size_ref, (jboolean *)0);
|
||||
size = size_base + sizeOffset;
|
||||
|
||||
if (!type_ref) {
|
||||
@ -232,7 +232,7 @@ android_glGetTransformFeedbackVarying1
|
||||
}
|
||||
_typeRemaining = _env->GetArrayLength(type_ref) - typeOffset;
|
||||
type_base = (GLenum *)
|
||||
_env->GetPrimitiveArrayCritical(type_ref, (jboolean *)0);
|
||||
_env->GetIntArrayElements(type_ref, (jboolean *)0);
|
||||
type = type_base + typeOffset;
|
||||
|
||||
glGetTransformFeedbackVarying(
|
||||
@ -246,11 +246,11 @@ android_glGetTransformFeedbackVarying1
|
||||
);
|
||||
exit:
|
||||
if (type_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(type_ref, type_base,
|
||||
_env->ReleaseIntArrayElements(type_ref, (jint*)type_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (size_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(size_ref, size_base,
|
||||
_env->ReleaseIntArrayElements(size_ref, (jint*)size_base,
|
||||
_exception ? JNI_ABORT: 0);
|
||||
}
|
||||
if (_exception != 1) {
|
||||
@ -273,9 +273,9 @@ exit:
|
||||
static jstring
|
||||
android_glGetTransformFeedbackVarying2
|
||||
(JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) {
|
||||
jarray _sizeArray = (jarray) 0;
|
||||
jintArray _sizeArray = (jintArray) 0;
|
||||
jint _sizeBufferOffset = (jint) 0;
|
||||
jarray _typeArray = (jarray) 0;
|
||||
jintArray _typeArray = (jintArray) 0;
|
||||
jint _typeBufferOffset = (jint) 0;
|
||||
jint _lengthRemaining;
|
||||
GLsizei *length = (GLsizei *) 0;
|
||||
@ -298,14 +298,14 @@ android_glGetTransformFeedbackVarying2
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size = (GLint *)getPointer(_env, size_buf, &_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
|
||||
type = (GLenum *)getPointer(_env, type_buf, &_typeArray, &_typeRemaining, &_typeBufferOffset);
|
||||
size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset);
|
||||
type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset);
|
||||
if (size == NULL) {
|
||||
char * _sizeBase = (char *)_env->GetPrimitiveArrayCritical(_sizeArray, (jboolean *) 0);
|
||||
char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0);
|
||||
size = (GLint *) (_sizeBase + _sizeBufferOffset);
|
||||
}
|
||||
if (type == NULL) {
|
||||
char * _typeBase = (char *)_env->GetPrimitiveArrayCritical(_typeArray, (jboolean *) 0);
|
||||
char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0);
|
||||
type = (GLenum *) (_typeBase + _typeBufferOffset);
|
||||
}
|
||||
glGetTransformFeedbackVarying(
|
||||
@ -319,10 +319,10 @@ android_glGetTransformFeedbackVarying2
|
||||
);
|
||||
|
||||
if (_typeArray) {
|
||||
releasePointer(_env, _typeArray, type, JNI_TRUE);
|
||||
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _typeArray, (jint*)type, JNI_TRUE);
|
||||
}
|
||||
if (_sizeArray) {
|
||||
releasePointer(_env, _sizeArray, size, JNI_TRUE);
|
||||
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(_env, _sizeArray, (jint*)size, JNI_TRUE);
|
||||
}
|
||||
result = _env->NewStringUTF(buf);
|
||||
if (buf) {
|
||||
|
@ -49,7 +49,7 @@ android_glGetUniformIndices_array
|
||||
_exceptionMessage = "not enough space in uniformIndices";
|
||||
goto exit;
|
||||
}
|
||||
_indices_base = (GLuint*)_env->GetPrimitiveArrayCritical(
|
||||
_indices_base = (GLuint*)_env->GetIntArrayElements(
|
||||
uniformIndices_ref, 0);
|
||||
_indices = _indices_base + uniformIndicesOffset;
|
||||
|
||||
@ -57,7 +57,7 @@ android_glGetUniformIndices_array
|
||||
|
||||
exit:
|
||||
if (_indices_base) {
|
||||
_env->ReleasePrimitiveArrayCritical(uniformIndices_ref, _indices_base,
|
||||
_env->ReleaseIntArrayElements(uniformIndices_ref, (jint*)_indices_base,
|
||||
_exception ? JNI_ABORT : 0);
|
||||
}
|
||||
for (_i = _count - 1; _i >= 0; _i--) {
|
||||
@ -85,7 +85,7 @@ android_glGetUniformIndices_buffer
|
||||
jint _count = 0;
|
||||
jint _i;
|
||||
const char** _names = NULL;
|
||||
jarray _uniformIndicesArray = (jarray)0;
|
||||
jintArray _uniformIndicesArray = (jintArray)0;
|
||||
jint _uniformIndicesRemaining;
|
||||
jint _uniformIndicesOffset = 0;
|
||||
GLuint* _indices = NULL;
|
||||
@ -118,10 +118,10 @@ android_glGetUniformIndices_buffer
|
||||
}
|
||||
|
||||
_indices = (GLuint*)getPointer(_env, uniformIndices_buf,
|
||||
&_uniformIndicesArray, &_uniformIndicesRemaining,
|
||||
(jarray*)&_uniformIndicesArray, &_uniformIndicesRemaining,
|
||||
&_uniformIndicesOffset);
|
||||
if (!_indices) {
|
||||
_indicesBase = (char*)_env->GetPrimitiveArrayCritical(
|
||||
_indicesBase = (char*)_env->GetIntArrayElements(
|
||||
_uniformIndicesArray, 0);
|
||||
_indices = (GLuint*)(_indicesBase + _uniformIndicesOffset);
|
||||
}
|
||||
@ -136,7 +136,8 @@ android_glGetUniformIndices_buffer
|
||||
|
||||
exit:
|
||||
if (_uniformIndicesArray) {
|
||||
releasePointer(_env, _uniformIndicesArray, _indicesBase, JNI_TRUE);
|
||||
releaseArrayPointer<jintArray, jint*, IntArrayReleaser>(
|
||||
_env, _uniformIndicesArray, (jint*)_indicesBase, JNI_TRUE);
|
||||
}
|
||||
for (_i = _count - 1; _i >= 0; _i--) {
|
||||
if (_names[_i]) {
|
||||
@ -151,4 +152,3 @@ exit:
|
||||
jniThrowException(_env, _exceptionType, _exceptionMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user