Added some alternate AL functions.
This commit is contained in:
parent
94a4c50a83
commit
3715e4b39d
|
@ -153,6 +153,8 @@ final class ShaderUNI extends Shader {
|
||||||
}
|
}
|
||||||
|
|
||||||
void cleanup() {
|
void cleanup() {
|
||||||
|
GL15.glDeleteBuffers(bufferID);
|
||||||
|
|
||||||
GL20.glDetachShader(programID, shaderID);
|
GL20.glDetachShader(programID, shaderID);
|
||||||
|
|
||||||
GL20.glDeleteShader(shaderID);
|
GL20.glDeleteShader(shaderID);
|
||||||
|
|
|
@ -173,9 +173,7 @@ public class GeneratorVisitor extends SimpleDeclarationVisitor {
|
||||||
writer.println("static " + Utils.getTypedefName(method) + " " + method.getSimpleName() + ";");
|
writer.println("static " + Utils.getTypedefName(method) + " " + method.getSimpleName() + ";");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateJavaSource(InterfaceDeclaration d) throws IOException {
|
private void generateJavaSource(InterfaceDeclaration d, PrintWriter java_writer) throws IOException {
|
||||||
validateMethods(d);
|
|
||||||
PrintWriter java_writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, d.getPackage().getQualifiedName(), new File(Utils.getSimpleClassName(d) + ".java"), null);
|
|
||||||
java_writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */");
|
java_writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */");
|
||||||
java_writer.println();
|
java_writer.println();
|
||||||
java_writer.println("package " + d.getPackage().getQualifiedName() + ";");
|
java_writer.println("package " + d.getPackage().getQualifiedName() + ";");
|
||||||
|
@ -252,23 +250,25 @@ public class GeneratorVisitor extends SimpleDeclarationVisitor {
|
||||||
File input = d.getPosition().file();
|
File input = d.getPosition().file();
|
||||||
File output = new File(env.getOptions().get("-s") + '/' + d.getPackage().getQualifiedName().replace('.', '/'), Utils.getSimpleClassName(d) + ".java");
|
File output = new File(env.getOptions().get("-s") + '/' + d.getPackage().getQualifiedName().replace('.', '/'), Utils.getSimpleClassName(d) + ".java");
|
||||||
|
|
||||||
|
PrintWriter java_writer = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Skip this class if the output exists and the input has not been modified.
|
// Skip this class if the output exists and the input has not been modified.
|
||||||
if ( output.exists() && input.lastModified() < output.lastModified() )
|
if ( output.exists() && input.lastModified() < output.lastModified() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (d.getMethods().size() > 0 || d.getFields().size() > 0)
|
if (d.getMethods().size() > 0 || d.getFields().size() > 0) {
|
||||||
generateJavaSource(d);
|
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)
|
if (d.getMethods().size() > 0)
|
||||||
generateNativeSource(d);
|
generateNativeSource(d);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
try {
|
|
||||||
// If anything goes wrong mid-gen, delete output to allow regen next time we run.
|
// If anything goes wrong mid-gen, delete output to allow regen next time we run.
|
||||||
if ( output.exists() )
|
if ( java_writer != null ) java_writer.close();
|
||||||
output.delete();
|
if ( output.exists() ) output.delete();
|
||||||
} catch (Exception e2) {
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,6 +73,8 @@ public class JavaMethodsGenerator {
|
||||||
}
|
}
|
||||||
Alternate alt_annotation = method.getAnnotation(Alternate.class);
|
Alternate alt_annotation = method.getAnnotation(Alternate.class);
|
||||||
if ( alt_annotation == null || alt_annotation.nativeAlt() ) {
|
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);
|
printJavaNativeStub(writer, method, Mode.NORMAL, generate_error_checks, context_specific);
|
||||||
if (Utils.hasMethodBufferObjectParameter(method)) {
|
if (Utils.hasMethodBufferObjectParameter(method)) {
|
||||||
printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.BUFFEROBJECT, generate_error_checks, context_specific);
|
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();
|
Iterator<? extends MethodDeclaration> it = d.getMethods().iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
MethodDeclaration method = it.next();
|
MethodDeclaration method = it.next();
|
||||||
|
if ( method.getAnnotation(Alternate.class) != null )
|
||||||
|
continue;
|
||||||
EnumSet<Platform> platforms;
|
EnumSet<Platform> platforms;
|
||||||
PlatformDependent platform_annotation = method.getAnnotation(PlatformDependent.class);
|
PlatformDependent platform_annotation = method.getAnnotation(PlatformDependent.class);
|
||||||
if (platform_annotation != null)
|
if (platform_annotation != null)
|
||||||
|
|
|
@ -721,6 +721,10 @@ public interface AL10 {
|
||||||
@ALvoid
|
@ALvoid
|
||||||
void alGenSources(@AutoSize("sources") @ALsizei int n, @OutParameter @ALuint IntBuffer sources);
|
void alGenSources(@AutoSize("sources") @ALsizei int n, @OutParameter @ALuint IntBuffer sources);
|
||||||
|
|
||||||
|
@Alternate(value = "alGenSources", nativeAlt = true)
|
||||||
|
@ALvoid
|
||||||
|
void alGenSources2(@Constant("1") @ALsizei int n, @Result @ALuint int source);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The application requests deletion of a number of Sources by DeleteSources.
|
* The application requests deletion of a number of Sources by DeleteSources.
|
||||||
*
|
*
|
||||||
|
@ -729,6 +733,10 @@ public interface AL10 {
|
||||||
@ALvoid
|
@ALvoid
|
||||||
void alDeleteSources(@AutoSize("sources") @ALsizei int n, @ALuint IntBuffer sources);
|
void alDeleteSources(@AutoSize("sources") @ALsizei int n, @ALuint IntBuffer sources);
|
||||||
|
|
||||||
|
@Alternate(value = "alDeleteSources", nativeAlt = true)
|
||||||
|
@ALvoid
|
||||||
|
void alDeleteSources2(@Constant("1") @ALsizei int n, @Indirect @ALuint int source);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The application can verify whether a source name is valid using the IsSource query.
|
* The application can verify whether a source name is valid using the IsSource query.
|
||||||
*
|
*
|
||||||
|
@ -945,6 +953,10 @@ public interface AL10 {
|
||||||
@ALvoid
|
@ALvoid
|
||||||
void alGenBuffers(@AutoSize("buffers") @ALsizei int n, @OutParameter @ALuint IntBuffer buffers);
|
void alGenBuffers(@AutoSize("buffers") @ALsizei int n, @OutParameter @ALuint IntBuffer buffers);
|
||||||
|
|
||||||
|
@Alternate(value = "alGenBuffers", nativeAlt = true)
|
||||||
|
@ALvoid
|
||||||
|
void alGenBuffers2(@Constant("1") @ALsizei int n, @Result @ALuint int buffer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* The application requests deletion of a number of Buffers by calling DeleteBuffers.
|
* The application requests deletion of a number of Buffers by calling DeleteBuffers.
|
||||||
|
@ -964,6 +976,10 @@ public interface AL10 {
|
||||||
@ALvoid
|
@ALvoid
|
||||||
void alDeleteBuffers(@AutoSize("buffers") @ALsizei int n, @ALuint IntBuffer buffers);
|
void alDeleteBuffers(@AutoSize("buffers") @ALsizei int n, @ALuint IntBuffer buffers);
|
||||||
|
|
||||||
|
@Alternate(value = "alDeleteBuffers", nativeAlt = true)
|
||||||
|
@ALvoid
|
||||||
|
void alDeleteBuffers2(@Constant("1") @ALsizei int n, @Indirect @ALuint int buffer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The application can verify whether a buffer Name is valid using the IsBuffer query.
|
* The application can verify whether a buffer Name is valid using the IsBuffer query.
|
||||||
*
|
*
|
||||||
|
@ -1052,6 +1068,10 @@ public interface AL10 {
|
||||||
@ALvoid
|
@ALvoid
|
||||||
void alSourceQueueBuffers(@ALuint int source, @AutoSize("buffers") @ALsizei int n, @ALuint IntBuffer buffers);
|
void alSourceQueueBuffers(@ALuint int source, @AutoSize("buffers") @ALsizei int n, @ALuint IntBuffer buffers);
|
||||||
|
|
||||||
|
@Alternate(value = "alSourceQueueBuffers", nativeAlt = true)
|
||||||
|
@ALvoid
|
||||||
|
void alSourceQueueBuffers2(@ALuint int source, @Constant("1") @ALsizei int n, @Indirect @ALuint int buffer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Once a queue entry for a buffer has been appended to a queue and is pending
|
* Once a queue entry for a buffer has been appended to a queue and is pending
|
||||||
|
@ -1074,6 +1094,10 @@ public interface AL10 {
|
||||||
@ALvoid
|
@ALvoid
|
||||||
void alSourceUnqueueBuffers(@ALuint int source, @AutoSize("buffers") @ALsizei int n, @OutParameter @ALuint IntBuffer buffers);
|
void alSourceUnqueueBuffers(@ALuint int source, @AutoSize("buffers") @ALsizei int n, @OutParameter @ALuint IntBuffer buffers);
|
||||||
|
|
||||||
|
@Alternate(value = "alSourceUnqueueBuffers", nativeAlt = true)
|
||||||
|
@ALvoid
|
||||||
|
void alSourceUnqueueBuffers2(@ALuint int source, @Constant("1") @ALsizei int n, @Result @ALuint int buffer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* Samples usually use the entire dynamic range of the chosen format/encoding,
|
* Samples usually use the entire dynamic range of the chosen format/encoding,
|
||||||
|
|
Loading…
Reference in New Issue