diff options
author | Jack Palevich <jackpal@google.com> | 2010-01-28 20:28:32 +0800 |
---|---|---|
committer | Jack Palevich <jackpal@google.com> | 2010-01-28 20:28:32 +0800 |
commit | e44e45c454a1f6ab89bce338d4ef12471549a7a2 (patch) | |
tree | cdd13b3e4fc0c662a0e2210dbc85a0aac3030f0b /opengl/tools/glgen/src | |
parent | 422cfc9c16d26db970787bd08c13501c038e5fed (diff) | |
download | frameworks_native-e44e45c454a1f6ab89bce338d4ef12471549a7a2.zip frameworks_native-e44e45c454a1f6ab89bce338d4ef12471549a7a2.tar.gz frameworks_native-e44e45c454a1f6ab89bce338d4ef12471549a7a2.tar.bz2 |
Implement the GL11ExtensionPack APIs.
Diffstat (limited to 'opengl/tools/glgen/src')
-rw-r--r-- | opengl/tools/glgen/src/JniCodeEmitter.java | 56 |
1 files changed, 54 insertions, 2 deletions
diff --git a/opengl/tools/glgen/src/JniCodeEmitter.java b/opengl/tools/glgen/src/JniCodeEmitter.java index e79170a..2db4e8d 100644 --- a/opengl/tools/glgen/src/JniCodeEmitter.java +++ b/opengl/tools/glgen/src/JniCodeEmitter.java @@ -211,6 +211,8 @@ public class JniCodeEmitter { index += 5; } else if (checks[index].equals("unsupported")) { index += 1; + } else if (checks[index].equals("requires")) { + index += 2; } else if (checks[index].equals("nullAllowed")) { return true; } else { @@ -243,6 +245,8 @@ public class JniCodeEmitter { index += 5; } else if (checks[index].equals("unsupported")) { index += 1; + } else if (checks[index].equals("requires")) { + index += 2; } else if (checks[index].equals("nullAllowed")) { index += 1; } else { @@ -263,6 +267,8 @@ public class JniCodeEmitter { while (index < checks.length) { if (checks[index].equals("unsupported")) { return true; + } else if (checks[index].equals("requires")) { + index += 2; } else if (checks[index].equals("return")) { index += 2; } else if (checks[index].startsWith("check")) { @@ -280,7 +286,34 @@ public class JniCodeEmitter { } return false; } - + + String isRequiresFunc(CFunc cfunc) { + String[] checks = mChecker.getChecks(cfunc.getName()); + int index = 1; + if (checks != null) { + while (index < checks.length) { + if (checks[index].equals("unsupported")) { + index += 1; + } else if (checks[index].equals("requires")) { + return checks[index+1]; + } else if (checks[index].equals("return")) { + index += 2; + } else if (checks[index].startsWith("check")) { + index += 3; + } else if (checks[index].equals("ifcheck")) { + index += 5; + } else if (checks[index].equals("nullAllowed")) { + index += 1; + } else { + System.out.println("Error: unknown keyword \"" + + checks[index] + "\""); + System.exit(0); + } + } + } + return null; + } + void emitNativeBoundsChecks(CFunc cfunc, String cname, PrintStream out, boolean isBuffer, boolean emitExceptionCheck, String offset, String remaining, String iii) { @@ -365,6 +398,9 @@ public class JniCodeEmitter { } else if (checks[index].equals("unsupported")) { // ignore index += 1; + } else if (checks[index].equals("requires")) { + // ignore + index += 2; } else if (checks[index].equals("nullAllowed")) { // ignore index += 1; @@ -776,7 +812,23 @@ public class JniCodeEmitter { out.println(); return; } - + + String requiresExtension = isRequiresFunc(cfunc); + if (requiresExtension != null) { + out.println(indent + + "if (! supportsExtension(_env, _this, have_" + requiresExtension + "ID)) {"); + out.println(indent + indent + + "_env->ThrowNew(UOEClass,"); + out.println(indent + indent + + " \"" + cfunc.getName() + "\");"); + if (isVoid) { + out.println(indent + indent + " return;"); + } else { + String retval = getErrorReturnValue(cfunc); + out.println(indent + indent + " return " + retval + ";"); + } + out.println(indent + "}"); + } if (mUseContextPointer) { out.println(indent + "android::gl::ogles_context_t *ctx = getContext(_env, _this);"); |