Loading opengl/tools/glgen/src/JniCodeEmitter.java +48 −19 Original line number Diff line number Diff line Loading @@ -454,6 +454,15 @@ public class JniCodeEmitter { String iii = indent + indent; // emitBoundsChecks(jfunc, out, iii); emitFunctionCall(jfunc, out, iii, false); // Set the pointer after we call the native code, so that if // the native code throws an exception we don't modify the // pointer. We assume that the native code is written so that // if an exception is thrown, then the underlying glXXXPointer // function will not have been called. String fname = jfunc.getName(); if (isPointerFunc) { // TODO - deal with VBO variants Loading Loading @@ -498,9 +507,6 @@ public class JniCodeEmitter { } } // emitBoundsChecks(jfunc, out, iii); emitFunctionCall(jfunc, out, iii, false); boolean isVoid = jfunc.getType().isVoid(); if (!isVoid) { Loading Loading @@ -873,19 +879,39 @@ public class JniCodeEmitter { String array = numBufferArgs <= 1 ? "_array" : "_" + bufferArgNames.get(bufArgIdx++) + "Array"; boolean nullAllowed = isNullAllowed(cfunc); boolean nullAllowed = isNullAllowed(cfunc) || isPointerFunc; if (nullAllowed) { out.println(indent + "if (" + cname + "_buf) {"); out.print(indent); } if (isPointerFunc) { out.println(indent + cname + " = (" + cfunc.getArgType(cIndex).getDeclaration() + ") _env->GetDirectBufferAddress(" + (mUseCPlusPlus ? "" : "_env, ") + cname + "_buf);"); String iii = " "; out.println(iii + indent + "if ( ! " + cname + " ) {"); out.println(iii + iii + indent + (mUseCPlusPlus ? "_env" : "(*_env)") + "->ThrowNew(" + (mUseCPlusPlus ? "" : "_env, ") + "IAEClass, \"Must use a native order direct Buffer\");"); out.println(iii + iii + indent + "return;"); out.println(iii + indent + "}"); } else { out.println(indent + cname + " = (" + cfunc.getArgType(cIndex).getDeclaration() + ")getPointer(_env, " + cname + "_buf, &" + array + ", &" + remaining + ");"); "_buf, &" + array + ", &" + remaining + ");"); } if (nullAllowed) { out.println(indent + "}"); Loading Loading @@ -987,6 +1013,7 @@ public class JniCodeEmitter { ");"); out.println(indent + "}"); } else if (jfunc.getArgType(idx).isBuffer()) { if (! isPointerFunc) { String array = numBufferArgs <= 1 ? "_array" : "_" + bufferArgNames.get(bufArgIdx++) + "Array"; out.println(indent + "if (" + array + ") {"); Loading @@ -995,12 +1022,14 @@ public class JniCodeEmitter { cfunc.getArgName(cIndex) + ", " + (cfunc.getArgType(cIndex).isConst() ? "JNI_FALSE" : "_exception ? JNI_FALSE : JNI_TRUE") + "JNI_FALSE" : "_exception ? JNI_FALSE :" + " JNI_TRUE") + ");"); out.println(indent + "}"); } } } } if (!isVoid) { out.println(indent + "return _returnValue;"); Loading Loading
opengl/tools/glgen/src/JniCodeEmitter.java +48 −19 Original line number Diff line number Diff line Loading @@ -454,6 +454,15 @@ public class JniCodeEmitter { String iii = indent + indent; // emitBoundsChecks(jfunc, out, iii); emitFunctionCall(jfunc, out, iii, false); // Set the pointer after we call the native code, so that if // the native code throws an exception we don't modify the // pointer. We assume that the native code is written so that // if an exception is thrown, then the underlying glXXXPointer // function will not have been called. String fname = jfunc.getName(); if (isPointerFunc) { // TODO - deal with VBO variants Loading Loading @@ -498,9 +507,6 @@ public class JniCodeEmitter { } } // emitBoundsChecks(jfunc, out, iii); emitFunctionCall(jfunc, out, iii, false); boolean isVoid = jfunc.getType().isVoid(); if (!isVoid) { Loading Loading @@ -873,19 +879,39 @@ public class JniCodeEmitter { String array = numBufferArgs <= 1 ? "_array" : "_" + bufferArgNames.get(bufArgIdx++) + "Array"; boolean nullAllowed = isNullAllowed(cfunc); boolean nullAllowed = isNullAllowed(cfunc) || isPointerFunc; if (nullAllowed) { out.println(indent + "if (" + cname + "_buf) {"); out.print(indent); } if (isPointerFunc) { out.println(indent + cname + " = (" + cfunc.getArgType(cIndex).getDeclaration() + ") _env->GetDirectBufferAddress(" + (mUseCPlusPlus ? "" : "_env, ") + cname + "_buf);"); String iii = " "; out.println(iii + indent + "if ( ! " + cname + " ) {"); out.println(iii + iii + indent + (mUseCPlusPlus ? "_env" : "(*_env)") + "->ThrowNew(" + (mUseCPlusPlus ? "" : "_env, ") + "IAEClass, \"Must use a native order direct Buffer\");"); out.println(iii + iii + indent + "return;"); out.println(iii + indent + "}"); } else { out.println(indent + cname + " = (" + cfunc.getArgType(cIndex).getDeclaration() + ")getPointer(_env, " + cname + "_buf, &" + array + ", &" + remaining + ");"); "_buf, &" + array + ", &" + remaining + ");"); } if (nullAllowed) { out.println(indent + "}"); Loading Loading @@ -987,6 +1013,7 @@ public class JniCodeEmitter { ");"); out.println(indent + "}"); } else if (jfunc.getArgType(idx).isBuffer()) { if (! isPointerFunc) { String array = numBufferArgs <= 1 ? "_array" : "_" + bufferArgNames.get(bufArgIdx++) + "Array"; out.println(indent + "if (" + array + ") {"); Loading @@ -995,12 +1022,14 @@ public class JniCodeEmitter { cfunc.getArgName(cIndex) + ", " + (cfunc.getArgType(cIndex).isConst() ? "JNI_FALSE" : "_exception ? JNI_FALSE : JNI_TRUE") + "JNI_FALSE" : "_exception ? JNI_FALSE :" + " JNI_TRUE") + ");"); out.println(indent + "}"); } } } } if (!isVoid) { out.println(indent + "return _returnValue;"); Loading