mirror of
https://github.com/shadowfacts/lwjgl2-arm64.git
synced 2026-04-08 07:54:05 +00:00
Added some alternate AL functions.
This commit is contained in:
parent
94a4c50a83
commit
3715e4b39d
5 changed files with 42 additions and 12 deletions
|
|
@ -153,6 +153,8 @@ final class ShaderUNI extends Shader {
|
|||
}
|
||||
|
||||
void cleanup() {
|
||||
GL15.glDeleteBuffers(bufferID);
|
||||
|
||||
GL20.glDetachShader(programID, shaderID);
|
||||
|
||||
GL20.glDeleteShader(shaderID);
|
||||
|
|
|
|||
|
|
@ -173,9 +173,7 @@ public class GeneratorVisitor extends SimpleDeclarationVisitor {
|
|||
writer.println("static " + Utils.getTypedefName(method) + " " + method.getSimpleName() + ";");
|
||||
}
|
||||
|
||||
private void generateJavaSource(InterfaceDeclaration d) throws IOException {
|
||||
validateMethods(d);
|
||||
PrintWriter java_writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, d.getPackage().getQualifiedName(), new File(Utils.getSimpleClassName(d) + ".java"), null);
|
||||
private void generateJavaSource(InterfaceDeclaration d, PrintWriter java_writer) throws IOException {
|
||||
java_writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */");
|
||||
java_writer.println();
|
||||
java_writer.println("package " + d.getPackage().getQualifiedName() + ";");
|
||||
|
|
@ -252,23 +250,25 @@ public class GeneratorVisitor extends SimpleDeclarationVisitor {
|
|||
File input = d.getPosition().file();
|
||||
File output = new File(env.getOptions().get("-s") + '/' + d.getPackage().getQualifiedName().replace('.', '/'), Utils.getSimpleClassName(d) + ".java");
|
||||
|
||||
PrintWriter java_writer = null;
|
||||
|
||||
try {
|
||||
// Skip this class if the output exists and the input has not been modified.
|
||||
if ( output.exists() && input.lastModified() < output.lastModified() )
|
||||
return;
|
||||
|
||||
if (d.getMethods().size() > 0 || d.getFields().size() > 0)
|
||||
generateJavaSource(d);
|
||||
if (d.getMethods().size() > 0 || d.getFields().size() > 0) {
|
||||
validateMethods(d);
|
||||
java_writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, d.getPackage().getQualifiedName(), new File(Utils.getSimpleClassName(d) + ".java"), null);
|
||||
generateJavaSource(d, java_writer);
|
||||
}
|
||||
if (d.getMethods().size() > 0)
|
||||
generateNativeSource(d);
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
// If anything goes wrong mid-gen, delete output to allow regen next time we run.
|
||||
if ( output.exists() )
|
||||
output.delete();
|
||||
} catch (Exception e2) {
|
||||
// ignore
|
||||
}
|
||||
// If anything goes wrong mid-gen, delete output to allow regen next time we run.
|
||||
if ( java_writer != null ) java_writer.close();
|
||||
if ( output.exists() ) output.delete();
|
||||
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@ public class JavaMethodsGenerator {
|
|||
}
|
||||
Alternate alt_annotation = method.getAnnotation(Alternate.class);
|
||||
if ( alt_annotation == null || alt_annotation.nativeAlt() ) {
|
||||
if ( alt_annotation != null && method.getSimpleName().equals(alt_annotation.value()) )
|
||||
throw new RuntimeException("An alternate function with native code should have a different name than the main function.");
|
||||
printJavaNativeStub(writer, method, Mode.NORMAL, generate_error_checks, context_specific);
|
||||
if (Utils.hasMethodBufferObjectParameter(method)) {
|
||||
printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.BUFFEROBJECT, generate_error_checks, context_specific);
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@ public class RegisterStubsGenerator {
|
|||
Iterator<? extends MethodDeclaration> it = d.getMethods().iterator();
|
||||
while (it.hasNext()) {
|
||||
MethodDeclaration method = it.next();
|
||||
if ( method.getAnnotation(Alternate.class) != null )
|
||||
continue;
|
||||
EnumSet<Platform> platforms;
|
||||
PlatformDependent platform_annotation = method.getAnnotation(PlatformDependent.class);
|
||||
if (platform_annotation != null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue