glgen: Better support for null arguments in JNI
- Modify the checks.spec file format to specify which argument is
allowed to be null.
- Update the JniCodeEmitter to support passing null arguments for all
pointer types as well as strings.
- Update the EGL/GLES checks.spec files and stub files to allow null
arguments through the JNI layer where the spec allows it.
Bug 9321681
Change-Id: I7d8e7319b43da95993516aa3ac5318b971a1ff92
diff --git a/opengl/tools/glgen/specs/egl/checks.spec b/opengl/tools/glgen/specs/egl/checks.spec
index 34fb1ee..ae531ee 100644
--- a/opengl/tools/glgen/specs/egl/checks.spec
+++ b/opengl/tools/glgen/specs/egl/checks.spec
@@ -1,13 +1,13 @@
-eglInitialize check major 1 check minor 1
-eglGetConfigs check configs config_size
-eglChooseConfig check configs config_size check num_config 1 sentinel attrib_list EGL_NONE
+eglInitialize nullAllowed major nullAllowed minor check major 1 check minor 1
+eglGetConfigs nullAllowed configs check configs config_size
+eglChooseConfig nullAllowed configs check configs config_size check num_config 1 sentinel attrib_list EGL_NONE
eglGetConfigAttrib check value 1
-//STUB function: //eglCreateWindowSurface sentinel attrib_list EGL_NONE
-eglCreatePbufferSurface sentinel attrib_list EGL_NONE
-//unsupported: eglCreatePixmapSurface sentinel attrib_list EGL_NONE
+//STUB function: //eglCreateWindowSurface nullAllowed attrib_list sentinel attrib_list EGL_NONE
+eglCreatePbufferSurface nullAllowed attrib_list sentinel attrib_list EGL_NONE
+//unsupported: eglCreatePixmapSurface nullAllowed attrib_list sentinel attrib_list EGL_NONE
eglCreatePixmapSurface unsupported
eglCopyBuffers unsupported
eglQuerySurface check value 1
-eglCreatePbufferFromClientBuffer sentinel attrib_list EGL_NONE
+//STUB function: eglCreatePbufferFromClientBuffer nullAllowed attrib_list sentinel attrib_list EGL_NONE
eglCreateContext sentinel attrib_list EGL_NONE
eglQueryContext check value 1
diff --git a/opengl/tools/glgen/specs/gles11/checks.spec b/opengl/tools/glgen/specs/gles11/checks.spec
index 9eb0070..e1f76fd 100644
--- a/opengl/tools/glgen/specs/gles11/checks.spec
+++ b/opengl/tools/glgen/specs/gles11/checks.spec
@@ -19,7 +19,7 @@
# is not perfect but better than nothing.
#
-glBufferData nullAllowed check data size
+glBufferData nullAllowed data check data size
glBufferSubData check data size
# glCompressedTexImage2D
# glCompressedTexSubImage2D
@@ -45,7 +45,7 @@
glGenTextures check textures n
// glGetActiveAttrib
// glGetActiveUniform
-glGetAttachedShaders nullAllowed check count 1 check shaders maxcount
+glGetAttachedShaders nullAllowed count check count 1 check shaders maxcount
// glGetBooleanv
glGetBufferParameter check params 1
glGetClipPlanef check eqn 4
@@ -57,8 +57,10 @@
// glGetIntegerv
glGetLight ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION
glGetMaterial ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE
+glGetProgramBinary nullAllowed length
// glGetProgramInfoLog
glGetProgramiv check params 1
+glGetProgramResourceiv nullAllowed length
glGetRenderbufferParameteriv check params 1
glGetRenderbufferParameterivOES check params 1
// glGetShaderInfoLog
@@ -66,6 +68,7 @@
glGetShaderPrecisionFormat check range 1 check precision 1
// glGetShaderSource
// glGetString
+glGetSynciv nullAllowed length
glGetTexEnv ifcheck params 4 pname GL_TEXTURE_ENV_COLOR
glGetTexGen ifcheck params 4 pname GL_OBJECT_PLANE,GL_EYE_PLANE
glGetTexParameter check params 1
@@ -76,15 +79,17 @@
glLoadMatrix check m 16
glMaterial ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE
glMultMatrix check m 16
+glObjectLabelKHR nullAllowed label
glPointParameter check params 1
glQueryMatrixxOES check mantissa 16 check exponent 16 return -1
# glReadPixels
glShaderBinary check binary length
// glShaderSource
glTexEnv ifcheck params 4 pname GL_TEXTURE_ENV_COLOR
-glTexImage2D nullAllowed
+glTexImage2D nullAllowed pixels
+glTexImage3D nullAllowed pixels
glTexParameter check params 1
-glTexSubImage2D nullAllowed
+glTexSubImage2D nullAllowed pixels
glUniform1 check v count
glUniform2 check v count*2
glUniform3 check v count*3
diff --git a/opengl/tools/glgen/specs/jsr239/glspec-checks b/opengl/tools/glgen/specs/jsr239/glspec-checks
index 9f8a793..750481c 100644
--- a/opengl/tools/glgen/specs/jsr239/glspec-checks
+++ b/opengl/tools/glgen/specs/jsr239/glspec-checks
@@ -19,9 +19,9 @@
glMultMatrix check m 16
glPointParameter check params 1
glTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR
-glTexImage2D nullAllowed
-glTexSubImage2D nullAllowed
-glBufferData nullAllowed check data size
+glTexImage2D nullAllowed pixels
+glTexSubImage2D nullAllowed pixels
+glBufferData nullAllowed data check data size
glBufferSubData check data size
glTexParameter check params 1
glQueryMatrixxOES check mantissa 16 check exponent 16 return -1
diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java
index 5a412bf..6caf076 100644
--- a/opengl/tools/glgen/src/JniCodeEmitter.java
+++ b/opengl/tools/glgen/src/JniCodeEmitter.java
@@ -222,12 +222,13 @@
needsExit = true;
}
- boolean isNullAllowed(CFunc cfunc) {
+ boolean isNullAllowed(CFunc cfunc, String cname) {
String[] checks = mChecker.getChecks(cfunc.getName());
int index = 1;
if (checks != null) {
while (index < checks.length) {
- if (checks[index].equals("nullAllowed")) {
+ if (checks[index].equals("nullAllowed") &&
+ checks[index + 1].equals(cname)) {
return true;
} else {
index = skipOneCheck(checks, index);
@@ -252,6 +253,22 @@
return false;
}
+ boolean hasCheckTest(CFunc cfunc, String cname) {
+ String[] checks = mChecker.getChecks(cfunc.getName());
+ int index = 1;
+ if (checks != null) {
+ while (index < checks.length) {
+ if (checks[index].startsWith("check") &&
+ cname != null && cname.equals(checks[index + 1])) {
+ return true;
+ } else {
+ index = skipOneCheck(checks, index);
+ }
+ }
+ }
+ return false;
+ }
+
boolean hasIfTest(CFunc cfunc) {
String[] checks = mChecker.getChecks(cfunc.getName());
int index = 1;
@@ -281,7 +298,7 @@
} else if (checks[index].equals("requires")) {
index += 2;
} else if (checks[index].equals("nullAllowed")) {
- index += 1;
+ index += 2;
} else {
System.out.println("Error: unknown keyword \"" +
checks[index] + "\"");
@@ -469,6 +486,37 @@
}
}
+ void emitStringCheck(CFunc cfunc, String cname, PrintStream out, String iii) {
+
+ String[] checks = mChecker.getChecks(cfunc.getName());
+
+ int index = 1;
+ if (checks != null) {
+ while (index < checks.length) {
+ if (checks[index].startsWith("check")) {
+ if (cname != null && !cname.equals(checks[index + 1])) {
+ index += 3;
+ continue;
+ }
+ out.println(iii + "_stringlen = _env->GetStringUTFLength(" + cname + ");");
+ out.println(iii + "if (" + checks[index + 2] + " > _stringlen) {");
+ out.println(iii + indent + "_exception = 1;");
+ out.println(iii + indent +
+ "_exceptionType = \"java/lang/ArrayIndexOutOfBoundsException\";");
+ out.println(iii + indent +
+ "_exceptionMessage = \"length of " + cname + " is shorter than " +
+ checks[index + 2] + " argument\";");
+ out.println(iii + indent + "goto exit;");
+ out.println(iii + "}");
+ index += 3;
+ needsExit = true;
+ } else {
+ index = skipOneCheck(checks, index);
+ }
+ }
+ }
+ }
+
void emitLocalVariablesForSentinel(CFunc cfunc, PrintStream out) {
String[] checks = mChecker.getChecks(cfunc.getName());
@@ -1066,12 +1114,20 @@
// Emit local variable declaration for strings
if (stringArgs.size() > 0) {
+ boolean requiresStringLengthCheck = false;
for (int i = 0; i < stringArgs.size(); i++) {
int idx = stringArgs.get(i).intValue();
int cIndex = jfunc.getArgCIndex(idx);
String cname = cfunc.getArgName(cIndex);
out.println(indent + "const char* _native" + cname + " = 0;");
+ if (hasCheckTest(cfunc, cname)) {
+ requiresStringLengthCheck = true;
+ }
+ }
+
+ if (requiresStringLengthCheck) {
+ out.println(indent + "jsize _stringlen = 0;");
}
out.println();
@@ -1084,19 +1140,34 @@
int cIndex = jfunc.getArgCIndex(idx);
String cname = cfunc.getArgName(cIndex);
+ boolean nullAllowed = isNullAllowed(cfunc, cname);
+ String nullAllowedIndent = nullAllowed ? indent : "";
+
CType type = cfunc.getArgType(jfunc.getArgCIndex(idx));
String decl = type.getDeclaration();
- needsExit = true;
- out.println(indent + "if (!" + cname + ") {");
- out.println(indent + indent + "_exception = 1;");
- out.println(indent + indent +
- "_exceptionType = \"java/lang/IllegalArgumentException\";");
- out.println(indent + indent +
- "_exceptionMessage = \"" + cname + " == null\";");
- out.println(indent + indent + "goto exit;");
- out.println(indent + "}");
- out.println(indent + "_native" + cname + " = _env->GetStringUTFChars(" + cname + ", 0);");
+ if (nullAllowed) {
+ out.println(indent + "if (" + cname + ") {");
+ } else {
+ needsExit = true;
+ out.println(indent + "if (!" + cname + ") {");
+ out.println(indent + indent + "_exception = 1;");
+ out.println(indent + indent +
+ "_exceptionType = \"java/lang/IllegalArgumentException\";");
+ out.println(indent + indent +
+ "_exceptionMessage = \"" + cname + " == null\";");
+ out.println(indent + indent + "goto exit;");
+ out.println(indent + "}");
+ }
+
+ out.println(nullAllowedIndent + indent + "_native" + cname +
+ " = _env->GetStringUTFChars(" + cname + ", 0);");
+
+ emitStringCheck(cfunc, cname, out, nullAllowedIndent + indent);
+
+ if (nullAllowed) {
+ out.println(indent + "}");
+ }
}
out.println();
@@ -1115,85 +1186,126 @@
remaining = ((numArrays + numBuffers) <= 1) ? "_remaining" :
"_" + cname + "Remaining";
+ boolean nullAllowed = isNullAllowed(cfunc, cname);
+ String nullAllowedIndent = nullAllowed ? indent : "";
+
if (jfunc.getArgType(idx).isArray()
&& !jfunc.getArgType(idx).isEGLHandle()) {
needsExit = true;
- out.println(indent + "if (!" + cname + "_ref) {");
- out.println(indent + indent + "_exception = 1;");
- out.println(indent + indent +
- "_exceptionType = \"java/lang/IllegalArgumentException\";");
- out.println(indent + indent +
- "_exceptionMessage = \"" + cname +" == null\";");
- out.println(indent + indent + "goto exit;");
- out.println(indent + "}");
- out.println(indent + "if (" + offset + " < 0) {");
- out.println(indent + indent + "_exception = 1;");
- out.println(indent + indent +
- "_exceptionType = \"java/lang/IllegalArgumentException\";");
- out.println(indent + indent +
- "_exceptionMessage = \"" + offset +" < 0\";");
- out.println(indent + indent + "goto exit;");
- out.println(indent + "}");
- out.println(indent + remaining + " = " +
- (mUseCPlusPlus ? "_env" : "(*_env)") +
- "->GetArrayLength(" +
- (mUseCPlusPlus ? "" : "_env, ") +
- cname + "_ref) - " + offset + ";");
+ if (nullAllowed) {
+ out.println(indent + "if (" + cname + "_ref) {");
+ }
+ else
+ {
+ out.println(indent + "if (!" + cname + "_ref) {");
+ out.println(indent + indent + "_exception = 1;");
+ out.println(indent + indent +
+ "_exceptionType = " +
+ "\"java/lang/IllegalArgumentException\";");
+ out.println(indent + indent +
+ "_exceptionMessage = \"" + cname +
+ " == null\";");
+ out.println(indent + indent + "goto exit;");
+ out.println(indent + "}");
+ }
+
+ out.println(nullAllowedIndent + indent + "if (" + offset +
+ " < 0) {");
+ out.println(nullAllowedIndent + indent + indent +
+ "_exception = 1;");
+ out.println(nullAllowedIndent + indent + indent +
+ "_exceptionType = " +
+ "\"java/lang/IllegalArgumentException\";");
+ out.println(nullAllowedIndent + indent + indent +
+ "_exceptionMessage = \"" + offset +" < 0\";");
+ out.println(nullAllowedIndent + indent + indent +
+ "goto exit;");
+ out.println(nullAllowedIndent + indent + "}");
+
+ out.println(nullAllowedIndent + indent + remaining + " = " +
+ (mUseCPlusPlus ? "_env" : "(*_env)") +
+ "->GetArrayLength(" +
+ (mUseCPlusPlus ? "" : "_env, ") +
+ cname + "_ref) - " + offset + ";");
emitNativeBoundsChecks(cfunc, cname, out, false,
- emitExceptionCheck,
- offset, remaining, " ");
+ emitExceptionCheck, offset, remaining,
+ nullAllowedIndent + indent);
- out.println(indent +
+ out.println(nullAllowedIndent + indent +
cname +
"_base = (" +
cfunc.getArgType(cIndex).getDeclaration() +
")");
String arrayGetter = jfunc.getArgType(idx).getArrayGetterForPrimitiveArray();
- out.println(indent + " " +
+ out.println(nullAllowedIndent + indent + " " +
(mUseCPlusPlus ? "_env" : "(*_env)") +
"->" + arrayGetter + "(" +
(mUseCPlusPlus ? "" : "_env, ") +
jfunc.getArgName(idx) +
"_ref, (jboolean *)0);");
- out.println(indent +
+ out.println(nullAllowedIndent + indent +
cname + " = " + cname + "_base + " + offset + ";");
emitSentinelCheck(cfunc, cname, out, false,
- emitExceptionCheck, offset,
- remaining, indent);
+ emitExceptionCheck, offset, remaining,
+ nullAllowedIndent + indent);
+
+ if (nullAllowed) {
+ out.println(indent + "}");
+ }
+
out.println();
} else if (jfunc.getArgType(idx).isArray()
&& jfunc.getArgType(idx).isEGLHandle()) {
needsExit = true;
- out.println(indent + "if (!" + cname + "_ref) {");
- out.println(indent + indent + "_exception = 1;");
- out.println(indent + indent +
- "_exceptionType = \"java/lang/IllegalArgumentException\";");
- out.println(indent + indent + "_exceptionMessage = \"" + cname +" == null\";");
- out.println(indent + indent + "goto exit;");
- out.println(indent + "}");
- out.println(indent + "if (" + offset + " < 0) {");
- out.println(indent + indent + "_exception = 1;");
- out.println(indent + indent +
- "_exceptionType = \"java/lang/IllegalArgumentException\";");
- out.println(indent + indent + "_exceptionMessage = \"" + offset +" < 0\";");
- out.println(indent + indent + "goto exit;");
- out.println(indent + "}");
- out.println(indent + remaining + " = " +
+ if (nullAllowed) {
+ out.println(indent + "if (" + cname + "_ref) {");
+ }
+ else
+ {
+ out.println(indent + "if (!" + cname + "_ref) {");
+ out.println(indent + indent + "_exception = 1;");
+ out.println(indent + indent + "_exceptionType = " +
+ "\"java/lang/IllegalArgumentException\";");
+ out.println(indent + indent + "_exceptionMessage = \"" +
+ cname +" == null\";");
+ out.println(indent + indent + "goto exit;");
+ out.println(indent + "}");
+ }
+
+ out.println(nullAllowedIndent + indent + "if (" + offset +
+ " < 0) {");
+ out.println(nullAllowedIndent + indent + indent +
+ "_exception = 1;");
+ out.println(nullAllowedIndent + indent + indent +
+ "_exceptionType = " +
+ "\"java/lang/IllegalArgumentException\";");
+ out.println(nullAllowedIndent + indent + indent +
+ "_exceptionMessage = \"" + offset +" < 0\";");
+ out.println(nullAllowedIndent + indent + indent +
+ "goto exit;");
+ out.println(nullAllowedIndent + indent + "}");
+
+ out.println(nullAllowedIndent + indent + remaining + " = " +
(mUseCPlusPlus ? "_env" : "(*_env)") +
"->GetArrayLength(" +
(mUseCPlusPlus ? "" : "_env, ") +
cname + "_ref) - " + offset + ";");
emitNativeBoundsChecks(cfunc, cname, out, false,
- emitExceptionCheck,
- offset, remaining, " ");
- out.println(indent +
+ emitExceptionCheck, offset, remaining,
+ nullAllowedIndent + indent);
+ out.println(nullAllowedIndent + indent +
jfunc.getArgName(idx) + " = new " +
cfunc.getArgType(cIndex).getBaseType() +
"["+ remaining + "];");
+
+ if (nullAllowed) {
+ out.println(indent + "}");
+ }
+
out.println();
} else if (jfunc.getArgType(idx).isBuffer()) {
String array = numBufferArgs <= 1 ? "_array" :
@@ -1201,7 +1313,7 @@
String bufferOffset = numBufferArgs <= 1 ? "_bufferOffset" :
"_" + cfunc.getArgName(cIndex) + "BufferOffset";
- boolean nullAllowed = isNullAllowed(cfunc) || isPointerFunc;
+ nullAllowed = nullAllowed || isPointerFunc;
if (nullAllowed) {
out.println(indent + "if (" + cname + "_buf) {");
out.print(indent);
@@ -1254,7 +1366,8 @@
String array = numBufferArgs <= 1 ? "_array" :
"_" + cfunc.getArgName(cIndex) + "Array";
- boolean nullAllowed = isNullAllowed(cfunc) || isPointerFunc;
+ boolean nullAllowed = isNullAllowed(cfunc, cname) ||
+ isPointerFunc;
if (nullAllowed) {
out.println(indent + "if (" + cname + "_buf && " + cname +" == NULL) {");
} else {
diff --git a/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp b/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp
index 6199637..497d284 100755
--- a/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp
+++ b/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp
@@ -13,34 +13,30 @@
jint _remaining;
EGLint *attrib_list = (EGLint *) 0;
- if (!attrib_list_ref) {
- _exception = 1;
- _exceptionType = "java/lang/IllegalArgumentException";
- _exceptionMessage = "attrib_list == null";
- goto exit;
- }
- if (offset < 0) {
- _exception = 1;
- _exceptionType = "java/lang/IllegalArgumentException";
- _exceptionMessage = "offset < 0";
- goto exit;
- }
- _remaining = _env->GetArrayLength(attrib_list_ref) - offset;
- attrib_list_base = (EGLint *)
- _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--) {
- if (attrib_list[i] == EGL_NONE){
- attrib_list_sentinel = true;
- break;
+ if (attrib_list_ref) {
+ if (offset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "offset < 0";
+ goto exit;
}
- }
- if (attrib_list_sentinel == false) {
- _exception = 1;
- _exceptionType = "java/lang/IllegalArgumentException";
- _exceptionMessage = "attrib_list must contain EGL_NONE!";
- goto exit;
+ _remaining = _env->GetArrayLength(attrib_list_ref) - offset;
+ attrib_list_base = (EGLint *)
+ _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--) {
+ if (attrib_list[i] == EGL_NONE){
+ attrib_list_sentinel = true;
+ break;
+ }
+ }
+ if (attrib_list_sentinel == false) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "attrib_list must contain EGL_NONE!";
+ goto exit;
+ }
}
_returnValue = eglCreatePbufferFromClientBuffer(
diff --git a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp
index cc7b85d..355c4b0 100644
--- a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp
+++ b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp
@@ -14,18 +14,32 @@
EGLint *attrib_list = (EGLint *) 0;
android::sp<ANativeWindow> window;
- if (!attrib_list_ref) {
- _exception = 1;
- _exceptionType = "java/lang/IllegalArgumentException";
- _exceptionMessage = "attrib_list == null";
- goto exit;
+ if (attrib_list_ref) {
+ if (offset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "offset < 0";
+ goto exit;
+ }
+ _remaining = _env->GetArrayLength(attrib_list_ref) - offset;
+ attrib_list_base = (EGLint *)
+ _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--) {
+ if (*((EGLint*)(attrib_list + i)) == EGL_NONE){
+ attrib_list_sentinel = 1;
+ break;
+ }
+ }
+ if (attrib_list_sentinel == 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "attrib_list must contain EGL_NONE!";
+ goto exit;
+ }
}
- if (offset < 0) {
- _exception = 1;
- _exceptionType = "java/lang/IllegalArgumentException";
- _exceptionMessage = "offset < 0";
- goto exit;
- }
+
if (win == NULL) {
not_valid_surface:
_exception = 1;
@@ -39,24 +53,6 @@
if (window == NULL)
goto not_valid_surface;
- _remaining = _env->GetArrayLength(attrib_list_ref) - offset;
- attrib_list_base = (EGLint *)
- _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--) {
- if (*((EGLint*)(attrib_list + i)) == EGL_NONE){
- attrib_list_sentinel = 1;
- break;
- }
- }
- if (attrib_list_sentinel == 0) {
- _exception = 1;
- _exceptionType = "java/lang/IllegalArgumentException";
- _exceptionMessage = "attrib_list must contain EGL_NONE!";
- goto exit;
- }
-
_returnValue = eglCreateWindowSurface(
(EGLDisplay)dpy_native,
(EGLConfig)config_native,
diff --git a/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp b/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp
index a8d63d9..6cdbf71 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp
@@ -18,22 +18,18 @@
jint _nameRemaining;
char *name = (char *) 0;
- if (!length_ref) {
- _exception = 1;
- _exceptionType = "java/lang/IllegalArgumentException";
- _exceptionMessage = "length == null";
- goto exit;
+ if (length_ref) {
+ if (lengthOffset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "lengthOffset < 0";
+ goto exit;
+ }
+ _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
+ length_base = (GLsizei *)
+ _env->GetIntArrayElements(length_ref, (jboolean *)0);
+ length = length_base + lengthOffset;
}
- if (lengthOffset < 0) {
- _exception = 1;
- _exceptionType = "java/lang/IllegalArgumentException";
- _exceptionMessage = "lengthOffset < 0";
- goto exit;
- }
- _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
- length_base = (GLsizei *)
- _env->GetIntArrayElements(length_ref, (jboolean *)0);
- length = length_base + lengthOffset;
if (!size_ref) {
_exception = 1;
diff --git a/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp b/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp
index 68e8389..07094bd 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp
@@ -18,22 +18,18 @@
jint _nameRemaining;
char *name = (char *) 0;
- if (!length_ref) {
- _exception = 1;
- _exceptionType = "java/lang/IllegalArgumentException";
- _exceptionMessage = "length == null";
- goto exit;
+ if (length_ref) {
+ if (lengthOffset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "lengthOffset < 0";
+ goto exit;
+ }
+ _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
+ length_base = (GLsizei *)
+ _env->GetIntArrayElements(length_ref, (jboolean *)0);
+ length = length_base + lengthOffset;
}
- if (lengthOffset < 0) {
- _exception = 1;
- _exceptionType = "java/lang/IllegalArgumentException";
- _exceptionMessage = "lengthOffset < 0";
- goto exit;
- }
- _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
- length_base = (GLsizei *)
- _env->GetIntArrayElements(length_ref, (jboolean *)0);
- length = length_base + lengthOffset;
if (!size_ref) {
_exception = 1;
diff --git a/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp b/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp
index 6104c84..24086e4 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp
@@ -12,22 +12,18 @@
jint _nameRemaining;
GLchar* _name = (GLchar*)0;
- if (!length_ref) {
- _exception = 1;
- _exceptionType = "java/lang/IllegalArgumentException";
- _exceptionMessage = "length == null";
- goto exit;
+ if (length_ref) {
+ if (lengthOffset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "lengthOffset < 0";
+ goto exit;
+ }
+ _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
+ _length_base = (GLsizei*)_env->GetIntArrayElements(
+ length_ref, (jboolean*)0);
+ _length = _length_base + lengthOffset;
}
- if (lengthOffset < 0) {
- _exception = 1;
- _exceptionType = "java/lang/IllegalArgumentException";
- _exceptionMessage = "lengthOffset < 0";
- goto exit;
- }
- _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
- _length_base = (GLsizei*)_env->GetIntArrayElements(
- length_ref, (jboolean*)0);
- _length = _length_base + lengthOffset;
if (!name_ref) {
_exception = 1;
diff --git a/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp b/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp
index d9808ef..55469db 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp
@@ -12,22 +12,18 @@
jint _sourceRemaining;
char *source = (char *) 0;
- if (!length_ref) {
- _exception = 1;
- _exceptionType = "java/lang/IllegalArgumentException";
- _exceptionMessage = "length == null";
- goto exit;
+ if (length_ref) {
+ if (lengthOffset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "lengthOffset < 0";
+ goto exit;
+ }
+ _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
+ length_base = (GLsizei *)
+ _env->GetIntArrayElements(length_ref, (jboolean *)0);
+ length = length_base + lengthOffset;
}
- if (lengthOffset < 0) {
- _exception = 1;
- _exceptionType = "java/lang/IllegalArgumentException";
- _exceptionMessage = "lengthOffset < 0";
- goto exit;
- }
- _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
- length_base = (GLsizei *)
- _env->GetIntArrayElements(length_ref, (jboolean *)0);
- length = length_base + lengthOffset;
if (!source_ref) {
_exception = 1;
diff --git a/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp b/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp
index cb656c8..47f232d 100644
--- a/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp
+++ b/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp
@@ -18,22 +18,18 @@
jint _nameRemaining;
char *name = (char *) 0;
- if (!length_ref) {
- _exception = 1;
- _exceptionType = "java/lang/IllegalArgumentException";
- _exceptionMessage = "length == null";
- goto exit;
+ if (length_ref) {
+ if (lengthOffset < 0) {
+ _exception = 1;
+ _exceptionType = "java/lang/IllegalArgumentException";
+ _exceptionMessage = "lengthOffset < 0";
+ goto exit;
+ }
+ _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
+ length_base = (GLsizei *)
+ _env->GetIntArrayElements(length_ref, (jboolean *)0);
+ length = length_base + lengthOffset;
}
- if (lengthOffset < 0) {
- _exception = 1;
- _exceptionType = "java/lang/IllegalArgumentException";
- _exceptionMessage = "lengthOffset < 0";
- goto exit;
- }
- _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset;
- length_base = (GLsizei *)
- _env->GetIntArrayElements(length_ref, (jboolean *)0);
- length = length_base + lengthOffset;
if (!size_ref) {
_exception = 1;