Added alternatives for glGetActiveUniform/Attrib.

Added a javadoc comment to all alternative methods.
This commit is contained in:
Ioannis Tsakpinis 2010-03-23 12:43:44 +00:00
parent 2f172a09bf
commit ef86a6c501
8 changed files with 86 additions and 26 deletions

View File

@ -48,4 +48,7 @@ public @interface Alternate {
/** If true, an alternate Java->native call will be created. Useful when the alternate implementation uses different types. */
boolean nativeAlt() default false;
/** If true, the alternate method's name will be used for the Java call. */
boolean javaAlt() default false;
}

View File

@ -210,7 +210,7 @@ public class JavaMethodsGenerator {
StripPostfix strip_annotation = method.getAnnotation(StripPostfix.class);
String method_name;
Alternate alt_annotation = method.getAnnotation(Alternate.class);
method_name = alt_annotation == null ? method.getSimpleName() : alt_annotation.value();
method_name = alt_annotation == null || alt_annotation.javaAlt() ? method.getSimpleName() : alt_annotation.value();
if (strip_annotation != null && mode == Mode.NORMAL)
method_name = getPostfixStrippedName(type_map, interface_decl, method);
writer.print(" " + method_name + "(");
@ -324,7 +324,7 @@ public class JavaMethodsGenerator {
}
String method_name;
Alternate alt_annotation = method.getAnnotation(Alternate.class);
method_name = alt_annotation == null ? method.getSimpleName() : alt_annotation.value();
method_name = alt_annotation == null || alt_annotation.javaAlt() ? method.getSimpleName() : alt_annotation.value();
String extension_postfix = "NULL".equals(strip_annotation.extension()) ? getExtensionPostfix(interface_decl) : strip_annotation.extension();
String result;

View File

@ -154,7 +154,8 @@ public class Utils {
while (doc_lines.hasMoreTokens())
writer.println("\t *" + doc_lines.nextToken());
writer.println("\t */");
}
} else if ( (decl instanceof MethodDeclaration) && decl.getAnnotation(Alternate.class) != null )
writer.println("\t/** Overloads " + decl.getAnnotation(Alternate.class).value() + " */");
}
public static AnnotationMirror getParameterAutoAnnotation(ParameterDeclaration param) {

View File

@ -227,6 +227,22 @@ public interface ARB_shader_objects {
@OutParameter @GLenum @Check("1") IntBuffer type,
@OutParameter @GLcharARB ByteBuffer name);
@Alternate(value = "glGetActiveUniformARB", javaAlt = true)
@GLreturn(value = "size")
void glGetActiveUniformSizeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength,
@OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
@OutParameter IntBuffer size,
@OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore
@GLcharARB @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
@Alternate(value = "glGetActiveUniformARB", javaAlt = true)
@GLreturn(value = "type")
void glGetActiveUniformTypeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength,
@OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
@OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore
@OutParameter @GLenum IntBuffer type,
@GLcharARB @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
@StripPostfix("params")
void glGetUniformfvARB(@GLhandleARB int programObj, int location, @OutParameter @Check FloatBuffer params);

View File

@ -117,7 +117,7 @@ public interface ARB_uniform_buffer_object {
@GLreturn("params")
@StripPostfix("params")
void glGetActiveUniformsiv(@GLuint int program, @Constant("1") @GLsizei int uniformCount,
@Constant(value = "APIUtils.getBufferInt().put(1, uniformIndex), 1", keepParam = true) int uniformIndex, // index 0 used by return value
@Constant(value = "params.put(1, uniformIndex), 1", keepParam = true) int uniformIndex, // Reuse params buffer
@GLenum int pname,
@OutParameter @GLint IntBuffer params);

View File

@ -63,15 +63,11 @@ public interface ARB_vertex_shader {
int GL_VERTEX_PROGRAM_POINT_SIZE_ARB = 0x8642;
int GL_VERTEX_PROGRAM_TWO_SIDE_ARB = 0x8643;
/**
* Accepted by the <pname> parameter GetObjectParameter{if}vARB:
*/
/** Accepted by the <pname> parameter GetObjectParameter{if}vARB: */
int GL_OBJECT_ACTIVE_ATTRIBUTES_ARB = 0x8B89;
int GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB = 0x8B8A;
/**
* Accepted by the <pname> parameter of GetVertexAttrib{dfi}vARB:
*/
/** Accepted by the <pname> parameter of GetVertexAttrib{dfi}vARB: */
int GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB = 0x8622;
int GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB = 0x8623;
int GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB = 0x8624;
@ -79,14 +75,10 @@ public interface ARB_vertex_shader {
int GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB = 0x886A;
int GL_CURRENT_VERTEX_ATTRIB_ARB = 0x8626;
/**
* Accepted by the <pname> parameter of GetVertexAttribPointervARB:
*/
/** Accepted by the <pname> parameter of GetVertexAttribPointervARB: */
int GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB = 0x8645;
/**
* Returned by the <type> parameter of GetActiveAttribARB:
*/
/** Returned by the <type> parameter of GetActiveAttribARB: */
int GL_FLOAT = 0x1406;
int GL_FLOAT_VEC2_ARB = 0x8B50;
int GL_FLOAT_VEC3_ARB = 0x8B51;
@ -122,7 +114,7 @@ public interface ARB_vertex_shader {
void glVertexAttrib4NubARB(@GLuint int index, @GLubyte byte x, @GLubyte byte y, @GLubyte byte z, @GLubyte byte w);
void glVertexAttribPointerARB(@GLuint int index, int size, @AutoType("buffer") @GLenum int type, boolean normalized, @GLsizei int stride,
@CachedReference(index="index",name="glVertexAttribPointer_buffer")
@CachedReference(index = "index", name = "glVertexAttribPointer_buffer")
@BufferObject(BufferKind.ArrayVBO)
@Check
@Const
@ -145,18 +137,34 @@ public interface ARB_vertex_shader {
void glBindAttribLocationARB(@GLhandleARB int programObj, @GLuint int index, @NullTerminated CharSequence name);
void glGetActiveAttribARB(@GLhandleARB int programObj, @GLuint int index, @AutoSize("name") @GLsizei int maxLength,
@OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length,
@OutParameter @Check("1") IntBuffer size,
@OutParameter @GLenum @Check("1") IntBuffer type,
@OutParameter @GLcharARB ByteBuffer name);
@OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length,
@OutParameter @Check("1") IntBuffer size,
@OutParameter @GLenum @Check("1") IntBuffer type,
@OutParameter @GLcharARB ByteBuffer name);
@Alternate("glGetActiveAttribARB")
@GLreturn(value = "name", maxLength = "maxLength")
void glGetActiveAttribARB2(@GLhandleARB int programObj, @GLuint int index, @GLsizei int maxLength,
@OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length,
@OutParameter @Check("1") IntBuffer size,
@OutParameter @GLenum @Check("1") IntBuffer type,
@OutParameter @GLcharARB ByteBuffer name);
@OutParameter @GLsizei @Constant("name_length, 0") IntBuffer length,
@OutParameter @Check("1") IntBuffer size,
@OutParameter @GLenum @Check("1") IntBuffer type,
@OutParameter @GLcharARB ByteBuffer name);
@Alternate(value = "glGetActiveAttribARB", javaAlt = true)
@GLreturn(value = "size")
void glGetActiveAttribSizeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength,
@OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
@OutParameter IntBuffer size,
@OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore
@GLcharARB @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
@Alternate(value = "glGetActiveAttribARB", javaAlt = true)
@GLreturn(value = "type")
void glGetActiveAttribTypeARB(@GLhandleARB int programObj, @GLuint int index, @Constant("0") @GLsizei int maxLength,
@OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
@OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore
@OutParameter @GLenum IntBuffer type,
@GLcharARB @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
int glGetAttribLocationARB(@GLhandleARB int programObj, @NullTerminated @Const @GLcharARB ByteBuffer name);

View File

@ -250,6 +250,22 @@ public interface GL20 {
@OutParameter @GLenum @Check("1") IntBuffer type,
@OutParameter @GLchar ByteBuffer name);
@Alternate(value = "glGetActiveUniform", javaAlt = true)
@GLreturn(value = "size")
void glGetActiveUniformSize(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength,
@OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
@OutParameter IntBuffer size,
@OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore
@GLchar @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
@Alternate(value = "glGetActiveUniform", javaAlt = true)
@GLreturn(value = "type")
void glGetActiveUniformType(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength,
@OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
@OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore
@OutParameter @GLenum IntBuffer type,
@GLchar @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
@StripPostfix("params")
void glGetUniformfv(@GLuint int program, int location, @OutParameter @Check FloatBuffer params);
@ -386,6 +402,22 @@ public interface GL20 {
@OutParameter @GLenum @Check("1") IntBuffer type,
@OutParameter @GLchar ByteBuffer name);
@Alternate(value = "glGetActiveAttrib", javaAlt = true)
@GLreturn(value = "size")
void glGetActiveAttribSize(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength,
@OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
@OutParameter IntBuffer size,
@OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore
@GLchar @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
@Alternate(value = "glGetActiveAttrib", javaAlt = true)
@GLreturn(value = "type")
void glGetActiveAttribType(@GLuint int program, @GLuint int index, @Constant("0") @GLsizei int maxLength,
@OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
@OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore
@OutParameter @GLenum IntBuffer type,
@GLchar @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
int glGetAttribLocation(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name);
@Alternate("glGetAttribLocation")

View File

@ -250,7 +250,7 @@ public interface GL31 {
@GLreturn("params")
@StripPostfix("params")
void glGetActiveUniformsiv(@GLuint int program, @Constant("1") @GLsizei int uniformCount,
@Constant(value = "APIUtils.getBufferInt().put(0, uniformIndex), 0", keepParam = true) int uniformIndex,
@Constant(value = "params.put(1, uniformIndex), 1", keepParam = true) int uniformIndex, // Reuse params buffer
@GLenum int pname,
@OutParameter @GLint IntBuffer params);