diff options
11 files changed, 294 insertions, 204 deletions
diff --git a/opengl/tools/glgen/specs/egl/checks.spec b/opengl/tools/glgen/specs/egl/checks.spec index 34fb1ee011..ae531eef78 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 9eb00702d7..e1f76fd102 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 @@ glGenRenderbuffers check renderbuffers n 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 @@ glGetFramebufferAttachmentParameterivOES check params 1 // 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 @@ glGetShaderiv check params 1 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 @@ glLightModel ifcheck params 4 pname GL_LIGHT_MODEL_AMBIENT 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 9f8a793cc3..750481c0a8 100644 --- a/opengl/tools/glgen/specs/jsr239/glspec-checks +++ b/opengl/tools/glgen/specs/jsr239/glspec-checks @@ -19,9 +19,9 @@ glMaterial ifcheck params 1 pname GL_SHININESS ifcheck params 4 pname GL_AMBIENT 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 5a412bf85f..6caf07655f 100644 --- a/opengl/tools/glgen/src/JniCodeEmitter.java +++ b/opengl/tools/glgen/src/JniCodeEmitter.java @@ -222,12 +222,13 @@ public class JniCodeEmitter { 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 @@ public class JniCodeEmitter { 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 @@ public class JniCodeEmitter { } 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 @@ public class JniCodeEmitter { } } + 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 @@ public class JniCodeEmitter { // 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 @@ public class JniCodeEmitter { 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 + + + 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 + + out.println(indent + indent + "_exceptionMessage = \"" + cname + " == null\";"); - out.println(indent + indent + "goto exit;"); - out.println(indent + "}"); + out.println(indent + indent + "goto exit;"); + out.println(indent + "}"); + } + + out.println(nullAllowedIndent + indent + "_native" + cname + + " = _env->GetStringUTFChars(" + cname + ", 0);"); - out.println(indent + "_native" + cname + " = _env->GetStringUTFChars(" + cname + ", 0);"); + emitStringCheck(cfunc, cname, out, nullAllowedIndent + indent); + + if (nullAllowed) { + out.println(indent + "}"); + } } out.println(); @@ -1115,85 +1186,126 @@ public class JniCodeEmitter { 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 @@ public class JniCodeEmitter { 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 @@ public class JniCodeEmitter { 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 6199637d60..497d284727 100755 --- a/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp +++ b/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp @@ -13,34 +13,30 @@ android_eglCreatePbufferFromClientBuffer 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; + } + _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; } - } - 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 cc7b85d1de..355c4b0456 100644 --- a/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp +++ b/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp @@ -14,18 +14,32 @@ android_eglCreateWindowSurface 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 (offset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "offset < 0"; - 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 (win == NULL) { not_valid_surface: _exception = 1; @@ -39,24 +53,6 @@ not_valid_surface: 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 a8d63d9d3a..6cdbf71be7 100644 --- a/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp +++ b/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp @@ -18,22 +18,18 @@ android_glGetActiveAttrib__III_3II_3II_3II_3BI jint _nameRemaining; char *name = (char *) 0; - if (!length_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "length == null"; - goto exit; - } - if (lengthOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "lengthOffset < 0"; - goto exit; + 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; } - _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 68e83890e1..07094bd0d8 100644 --- a/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp +++ b/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp @@ -18,22 +18,18 @@ android_glGetActiveUniform__III_3II_3II_3II_3BI jint _nameRemaining; char *name = (char *) 0; - if (!length_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "length == null"; - goto exit; - } - if (lengthOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "lengthOffset < 0"; - goto exit; + 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; } - _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 6104c84e7d..24086e4ee8 100644 --- a/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp +++ b/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp @@ -12,22 +12,18 @@ android_glGetActiveUniformBlockName_III_3II_3BI jint _nameRemaining; GLchar* _name = (GLchar*)0; - if (!length_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "length == null"; - goto exit; - } - if (lengthOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "lengthOffset < 0"; - goto exit; + 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; } - _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 d9808ef07a..55469dbaa0 100644 --- a/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp +++ b/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp @@ -12,22 +12,18 @@ android_glGetShaderSource__II_3II_3BI jint _sourceRemaining; char *source = (char *) 0; - if (!length_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "length == null"; - goto exit; - } - if (lengthOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "lengthOffset < 0"; - goto exit; + 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; } - _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 cb656c8068..47f232d5b3 100644 --- a/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp +++ b/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp @@ -18,22 +18,18 @@ android_glGetTransformFeedbackVarying__III_3II_3II_3II_3BI jint _nameRemaining; char *name = (char *) 0; - if (!length_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "length == null"; - goto exit; - } - if (lengthOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "lengthOffset < 0"; - goto exit; + 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; } - _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; - length_base = (GLsizei *) - _env->GetIntArrayElements(length_ref, (jboolean *)0); - length = length_base + lengthOffset; if (!size_ref) { _exception = 1; |