summaryrefslogtreecommitdiffstats
path: root/opengl/tools
diff options
context:
space:
mode:
Diffstat (limited to 'opengl/tools')
-rw-r--r--opengl/tools/glgen/src/JType.java78
-rw-r--r--opengl/tools/glgen/src/JniCodeEmitter.java76
-rwxr-xr-xopengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp5
-rw-r--r--opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp8
-rw-r--r--opengl/tools/glgen/stubs/gles11/common.cpp134
-rw-r--r--opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp1
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp64
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp64
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp9
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetBooleanv.cpp6
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetFloatv.cpp6
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetIntegerv.cpp7
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp16
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp64
-rw-r--r--opengl/tools/glgen/stubs/gles11/glGetUniformIndices.cpp18
-rwxr-xr-xopengl/tools/glgen2/glgen.py28
16 files changed, 416 insertions, 168 deletions
diff --git a/opengl/tools/glgen/src/JType.java b/opengl/tools/glgen/src/JType.java
index c6e227e..5803a44 100644
--- a/opengl/tools/glgen/src/JType.java
+++ b/opengl/tools/glgen/src/JType.java
@@ -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"));
diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java
index e51b7a2..1bed05b 100644
--- a/opengl/tools/glgen/src/JniCodeEmitter.java
+++ b/opengl/tools/glgen/src/JniCodeEmitter.java
@@ -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;");
+ }
+ out.println(indent + "jint _bufferOffset = (jint) 0;");
} else {
for (int i = 0; i < numBufferArgs; i++) {
- out.println(indent + "jarray _" + bufferArgNames.get(i) +
- "Array = (jarray) 0;");
+ 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,9 +1260,17 @@ public class JniCodeEmitter {
} else {
out.println(indent + "if (" + cname +" == NULL) {");
}
- 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 + "}");
+ 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 + "}");
+ }
}
}
@@ -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,17 +1375,32 @@ 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 + ") {");
- out.println(indent + indent +
- "releasePointer(_env, " + array + ", " +
- cfunc.getArgName(cIndex) +
- ", " +
- (cfunc.getArgType(cIndex).isConst() ?
- "JNI_FALSE" : (emitExceptionCheck ?
- "_exception ? JNI_FALSE : JNI_TRUE" : "JNI_TRUE")) +
- ");");
+ 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) +
+ ", " +
+ (cfunc.getArgType(cIndex).isConst() ?
+ "JNI_FALSE" : (emitExceptionCheck ?
+ "_exception ? JNI_FALSE : JNI_TRUE" : "JNI_TRUE")) +
+ ");");
+ }
out.println(indent + "}");
}
}
diff --git a/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp b/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp
index f09c171..6199637 100755
--- a/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp
+++ b/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp
@@ -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);
}
-
diff --git a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp
index 0b6bf58..cc7b85d 100644
--- a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp
+++ b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp
@@ -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) {
diff --git a/opengl/tools/glgen/stubs/gles11/common.cpp b/opengl/tools/glgen/stubs/gles11/common.cpp
index f7bcb9d..18ec5e3 100644
--- a/opengl/tools/glgen/stubs/gles11/common.cpp
+++ b/opengl/tools/glgen/stubs/gles11/common.cpp
@@ -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);
diff --git a/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp b/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp
index d844152..86decfb 100644
--- a/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp
@@ -36,4 +36,3 @@ android_glDrawElementsInstanced__IIIII
(GLsizei)instanceCount
);
}
-
diff --git a/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp b/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp
index 7d414d8..a8d63d9 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp
@@ -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) {
diff --git a/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp b/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp
index a7376ba..68e8389 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp
@@ -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) {
diff --git a/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp b/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp
index bb6ae7c..6104c84 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp
@@ -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;
}
-
diff --git a/opengl/tools/glgen/stubs/gles11/glGetBooleanv.cpp b/opengl/tools/glgen/stubs/gles11/glGetBooleanv.cpp
index 00c52af..7874bd8 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetBooleanv.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetBooleanv.cpp
@@ -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);
}
diff --git a/opengl/tools/glgen/stubs/gles11/glGetFloatv.cpp b/opengl/tools/glgen/stubs/gles11/glGetFloatv.cpp
index 71c399d..2f41fd1 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetFloatv.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetFloatv.cpp
@@ -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);
}
diff --git a/opengl/tools/glgen/stubs/gles11/glGetIntegerv.cpp b/opengl/tools/glgen/stubs/gles11/glGetIntegerv.cpp
index 9000ece..c960f31 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetIntegerv.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetIntegerv.cpp
@@ -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);
}
-
diff --git a/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp b/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp
index c995d9c..d9808ef 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp
@@ -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);
}
}
diff --git a/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp b/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp
index a977693..cb656c8 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp
@@ -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) {
diff --git a/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.cpp b/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.cpp
index fb137ab..13ef01e 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.cpp
@@ -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,8 +57,8 @@ android_glGetUniformIndices_array
exit:
if (_indices_base) {
- _env->ReleasePrimitiveArrayCritical(uniformIndices_ref, _indices_base,
- _exception ? JNI_ABORT : 0);
+ _env->ReleaseIntArrayElements(uniformIndices_ref, (jint*)_indices_base,
+ _exception ? JNI_ABORT : 0);
}
for (_i = _count - 1; _i >= 0; _i--) {
if (_names[_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,11 +118,11 @@ android_glGetUniformIndices_buffer
}
_indices = (GLuint*)getPointer(_env, uniformIndices_buf,
- &_uniformIndicesArray, &_uniformIndicesRemaining,
+ (jarray*)&_uniformIndicesArray, &_uniformIndicesRemaining,
&_uniformIndicesOffset);
if (!_indices) {
- _indicesBase = (char*)_env->GetPrimitiveArrayCritical(
- _uniformIndicesArray, 0);
+ _indicesBase = (char*)_env->GetIntArrayElements(
+ _uniformIndicesArray, 0);
_indices = (GLuint*)(_indicesBase + _uniformIndicesOffset);
}
if (_uniformIndicesRemaining < _count) {
@@ -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);
}
}
-
diff --git a/opengl/tools/glgen2/glgen.py b/opengl/tools/glgen2/glgen.py
index ed6b451..9b30fd1 100755
--- a/opengl/tools/glgen2/glgen.py
+++ b/opengl/tools/glgen2/glgen.py
@@ -86,11 +86,25 @@ def fmtTypeNameList(params):
return ', '.join(['"%s", %s' % (p[0], p[1]) for p in params])
-def overrideSymbolName(sym):
- # The wrapper intercepts glGetString and (sometimes) calls the generated
- # __glGetString thunk which dispatches to the driver's glGetString
- if sym == 'glGetString':
- return '__glGetString'
+def overrideSymbolName(sym, apiname):
+ # The wrapper intercepts various glGet and glGetString functions and
+ # (sometimes) calls the generated thunk which dispatches to the
+ # driver's implementation
+ wrapped_get_syms = {
+ 'gles1' : [
+ 'glGetString'
+ ],
+ 'gles2' : [
+ 'glGetString',
+ 'glGetStringi',
+ 'glGetBooleanv',
+ 'glGetFloatv',
+ 'glGetIntegerv',
+ 'glGetInteger64v',
+ ],
+ }
+ if sym in wrapped_get_syms.get(apiname):
+ return '__' + sym
else:
return sym
@@ -115,8 +129,8 @@ class TrampolineGen(reg.OutputGenerator):
print('%s API_ENTRY(%s)(%s) {\n'
' %s(%s%s%s);\n'
'}'
- % (rtype, overrideSymbolName(fname), fmtParams(params),
- call, fname,
+ % (rtype, overrideSymbolName(fname, self.genOpts.apiname),
+ fmtParams(params), call, fname,
', ' if len(params) > 0 else '',
fmtArgs(params)),
file=self.outFile)