diff --git a/src/java/org/lwjgl/opengl/APIUtil.java b/src/java/org/lwjgl/opengl/APIUtil.java index 3a0acee7..62ac61bf 100644 --- a/src/java/org/lwjgl/opengl/APIUtil.java +++ b/src/java/org/lwjgl/opengl/APIUtil.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002-2008 LWJGL Project + * Copyright (c) 2002-2011 LWJGL Project * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -37,35 +37,33 @@ import org.lwjgl.MemoryUtil; import java.nio.*; -/** @author spasi */ +/** + * Utility class for OpenGL API calls. Instances of APIUtil are created in ContextCapabilities, + * so we have an instance per OpenGL context. + * + * @author spasi + */ final class APIUtil { - private static final int INITIAL_BUFFER_SIZE = 256; + private static final int INITIAL_BUFFER_SIZE = 256; private static final int INITIAL_LENGTHS_SIZE = 4; private static final int BUFFERS_SIZE = 32; - private static final ThreadLocal arrayTL = new ThreadLocal() { - protected char[] initialValue() { return new char[INITIAL_BUFFER_SIZE]; } - }; + private char[] arrayTL; + private ByteBuffer bufferTL; + private IntBuffer lengthsTL; + private final Buffers buffersTL; - private static final ThreadLocal bufferTL = new ThreadLocal() { - protected ByteBuffer initialValue() { return BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE); } - }; - - private static final ThreadLocal lengthsTL = new ThreadLocal() { - protected IntBuffer initialValue() { return BufferUtils.createIntBuffer(INITIAL_LENGTHS_SIZE); } - }; - - private static final ThreadLocal buffersTL = new ThreadLocal() { - protected Buffers initialValue() { return new Buffers(); } - }; - - private APIUtil() { + APIUtil() { + arrayTL = new char[INITIAL_BUFFER_SIZE]; + bufferTL = BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE); + lengthsTL = BufferUtils.createIntBuffer(INITIAL_LENGTHS_SIZE); + buffersTL = new Buffers(); } - private static char[] getArray(final int size) { - char[] array = arrayTL.get(); + private static char[] getArray(final ContextCapabilities caps, final int size) { + char[] array = caps.util.arrayTL; if ( array.length < size ) { int sizeNew = array.length << 1; @@ -73,14 +71,14 @@ final class APIUtil { sizeNew <<= 1; array = new char[size]; - arrayTL.set(array); + caps.util.arrayTL = array; } return array; } - static ByteBuffer getBufferByte(final int size) { - ByteBuffer buffer = bufferTL.get(); + static ByteBuffer getBufferByte(final ContextCapabilities caps, final int size) { + ByteBuffer buffer = caps.util.bufferTL; if ( buffer.capacity() < size ) { int sizeNew = buffer.capacity() << 1; @@ -88,15 +86,15 @@ final class APIUtil { sizeNew <<= 1; buffer = BufferUtils.createByteBuffer(size); - bufferTL.set(buffer); + caps.util.bufferTL = buffer; } else buffer.clear(); return buffer; } - private static ByteBuffer getBufferByteOffset(final int size) { - ByteBuffer buffer = bufferTL.get(); + private static ByteBuffer getBufferByteOffset(final ContextCapabilities caps, final int size) { + ByteBuffer buffer = caps.util.bufferTL; if ( buffer.capacity() < size ) { int sizeNew = buffer.capacity() << 1; @@ -105,7 +103,7 @@ final class APIUtil { final ByteBuffer bufferNew = BufferUtils.createByteBuffer(size); bufferNew.put(buffer); - bufferTL.set(buffer = bufferNew); + caps.util.bufferTL = (buffer = bufferNew); } else { buffer.position(buffer.limit()); buffer.limit(buffer.capacity()); @@ -114,22 +112,22 @@ final class APIUtil { return buffer; } - static ShortBuffer getBufferShort() { return buffersTL.get().shorts; } + static ShortBuffer getBufferShort(final ContextCapabilities caps) { return caps.util.buffersTL.shorts; } - static IntBuffer getBufferInt() { return buffersTL.get().ints; } + static IntBuffer getBufferInt(final ContextCapabilities caps) { return caps.util.buffersTL.ints; } - static LongBuffer getBufferLong() { return buffersTL.get().longs; } + static LongBuffer getBufferLong(final ContextCapabilities caps) { return caps.util.buffersTL.longs; } - static FloatBuffer getBufferFloat() { return buffersTL.get().floats; } + static FloatBuffer getBufferFloat(final ContextCapabilities caps) { return caps.util.buffersTL.floats; } - static DoubleBuffer getBufferDouble() { return buffersTL.get().doubles; } + static DoubleBuffer getBufferDouble(final ContextCapabilities caps) { return caps.util.buffersTL.doubles; } - static IntBuffer getLengths() { - return getLengths(1); + static IntBuffer getLengths(final ContextCapabilities caps) { + return getLengths(caps, 1); } - static IntBuffer getLengths(final int size) { - IntBuffer lengths = lengthsTL.get(); + static IntBuffer getLengths(final ContextCapabilities caps, final int size) { + IntBuffer lengths = caps.util.lengthsTL; if ( lengths.capacity() < size ) { int sizeNew = lengths.capacity(); @@ -137,7 +135,7 @@ final class APIUtil { sizeNew <<= 1; lengths = BufferUtils.createIntBuffer(size); - lengthsTL.set(lengths); + caps.util.lengthsTL = lengths; } else lengths.clear(); @@ -169,9 +167,9 @@ final class APIUtil { * * @return the buffer as a String. */ - static String getString(final ByteBuffer buffer) { + static String getString(final ContextCapabilities caps, final ByteBuffer buffer) { final int length = buffer.remaining(); - final char[] charArray = getArray(length); + final char[] charArray = getArray(caps, length); for ( int i = buffer.position(); i < buffer.limit(); i++ ) charArray[i - buffer.position()] = (char)buffer.get(i); @@ -186,8 +184,8 @@ final class APIUtil { * * @return the String as a ByteBuffer */ - static long getBuffer(final CharSequence string) { - final ByteBuffer buffer = encode(getBufferByte(string.length()), string); + static long getBuffer(final ContextCapabilities caps, final CharSequence string) { + final ByteBuffer buffer = encode(getBufferByte(caps, string.length()), string); buffer.flip(); return MemoryUtil.getAddress0(buffer); } @@ -199,8 +197,8 @@ final class APIUtil { * * @return the String as a ByteBuffer */ - static long getBuffer(final CharSequence string, final int offset) { - final ByteBuffer buffer = encode(getBufferByteOffset(offset + string.length()), string); + static long getBuffer(final ContextCapabilities caps, final CharSequence string, final int offset) { + final ByteBuffer buffer = encode(getBufferByteOffset(caps, offset + string.length()), string); buffer.flip(); return MemoryUtil.getAddress(buffer); } @@ -212,8 +210,8 @@ final class APIUtil { * * @return the String as a ByteBuffer */ - static long getBufferNT(final CharSequence string) { - final ByteBuffer buffer = encode(getBufferByte(string.length() + 1), string); + static long getBufferNT(final ContextCapabilities caps, final CharSequence string) { + final ByteBuffer buffer = encode(getBufferByte(caps, string.length() + 1), string); buffer.put((byte)0); buffer.flip(); return MemoryUtil.getAddress0(buffer); @@ -234,8 +232,8 @@ final class APIUtil { * * @return the Strings as a ByteBuffer */ - static long getBuffer(final CharSequence[] strings) { - final ByteBuffer buffer = getBufferByte(getTotalLength(strings)); + static long getBuffer(final ContextCapabilities caps, final CharSequence[] strings) { + final ByteBuffer buffer = getBufferByte(caps, getTotalLength(strings)); for ( CharSequence string : strings ) encode(buffer, string); @@ -251,8 +249,8 @@ final class APIUtil { * * @return the Strings as a ByteBuffer */ - static long getBufferNT(final CharSequence[] strings) { - final ByteBuffer buffer = getBufferByte(getTotalLength(strings) + strings.length); + static long getBufferNT(final ContextCapabilities caps, final CharSequence[] strings) { + final ByteBuffer buffer = getBufferByte(caps, getTotalLength(strings) + strings.length); for ( CharSequence string : strings ) { encode(buffer, string); @@ -270,8 +268,8 @@ final class APIUtil { * * @return the String lengths in an IntBuffer */ - static long getLengths(final CharSequence[] strings) { - IntBuffer buffer = getLengths(strings.length); + static long getLengths(final ContextCapabilities caps, final CharSequence[] strings) { + IntBuffer buffer = getLengths(caps, strings.length); for ( CharSequence string : strings ) buffer.put(string.length()); @@ -280,21 +278,21 @@ final class APIUtil { return MemoryUtil.getAddress0(buffer); } - static long getInt(final int value) { - return MemoryUtil.getAddress0(getBufferInt().put(0, value)); + static long getInt(final ContextCapabilities caps, final int value) { + return MemoryUtil.getAddress0(getBufferInt(caps).put(0, value)); } - static long getBufferByte0() { - return MemoryUtil.getAddress0(getBufferByte(0)); + static long getBufferByte0(final ContextCapabilities caps) { + return MemoryUtil.getAddress0(getBufferByte(caps, 0)); } private static class Buffers { final ShortBuffer shorts; - final IntBuffer ints; - final LongBuffer longs; + final IntBuffer ints; + final LongBuffer longs; - final FloatBuffer floats; + final FloatBuffer floats; final DoubleBuffer doubles; Buffers() { diff --git a/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java b/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java index 8cfb638d..f6b2526d 100644 --- a/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java +++ b/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java @@ -301,13 +301,13 @@ public class JavaMethodsGenerator { } } else if ( method.getAnnotation(GLreturn.class) != null ) { has_result = true; - Utils.printGLReturnPre(writer, method, method.getAnnotation(GLreturn.class)); + Utils.printGLReturnPre(writer, method, method.getAnnotation(GLreturn.class), type_map); } writer.print(Utils.getSimpleNativeMethodName(method, generate_error_checks, context_specific)); if (mode == Mode.BUFFEROBJECT) writer.print(Utils.BUFFER_OBJECT_METHOD_POSTFIX); writer.print("("); - boolean first_parameter = printMethodCallArguments(writer, method, typeinfos_instance, mode); + boolean first_parameter = printMethodCallArguments(writer, method, typeinfos_instance, mode, type_map); if (context_specific) { if (!first_parameter) writer.print(", "); @@ -335,7 +335,7 @@ public class JavaMethodsGenerator { else writer.println(tabs + "return " + Utils.RESULT_VAR_NAME + ";"); } else - Utils.printGLReturnPost(writer, method, method.getAnnotation(GLreturn.class)); + Utils.printGLReturnPost(writer, method, method.getAnnotation(GLreturn.class), type_map); } if ( code_annotation != null && code_annotation.tryBlock() ) { @@ -439,7 +439,7 @@ public class JavaMethodsGenerator { throw new RuntimeException(c + " is not allowed"); } - private static boolean printMethodCallArgument(PrintWriter writer, MethodDeclaration method, ParameterDeclaration param, Map typeinfos_instance, Mode mode, boolean first_parameter) { + private static boolean printMethodCallArgument(PrintWriter writer, MethodDeclaration method, ParameterDeclaration param, Map typeinfos_instance, Mode mode, boolean first_parameter, TypeMap type_map) { if (!first_parameter) writer.print(", "); @@ -496,7 +496,9 @@ public class JavaMethodsGenerator { writer.print("APIUtil.getBuffer"); if ( param.getAnnotation(NullTerminated.class) != null ) writer.print("NT"); - writer.print("(" + param.getSimpleName()); + writer.print('('); + writer.print(type_map.getAPIUtilParam(true)); + writer.print(param.getSimpleName()); if ( offset != null ) writer.print(", " + offset); writer.print(")"); @@ -531,7 +533,7 @@ public class JavaMethodsGenerator { return false; } - private static boolean printMethodCallArguments(PrintWriter writer, MethodDeclaration method, Map typeinfos_instance, Mode mode) { + private static boolean printMethodCallArguments(PrintWriter writer, MethodDeclaration method, Map typeinfos_instance, Mode mode, TypeMap type_map) { boolean first_parameter = true; for ( ParameterDeclaration param : method.getParameters() ) { if ( param.getAnnotation(Result.class) != null || (param.getAnnotation(Helper.class) != null && !param.getAnnotation(Helper.class).passToNative()) ) @@ -539,7 +541,7 @@ public class JavaMethodsGenerator { final Constant constant_annotation = param.getAnnotation(Constant.class); if ( constant_annotation== null || !constant_annotation.isNative() ) - first_parameter = printMethodCallArgument(writer, method, param, typeinfos_instance, mode, first_parameter); + first_parameter = printMethodCallArgument(writer, method, param, typeinfos_instance, mode, first_parameter, type_map); } if (Utils.getNIOBufferType(Utils.getMethodReturnType(method)) != null) { if (method.getAnnotation(CachedResult.class) != null && method.getAnnotation(CachedResult.class).isRange()) { diff --git a/src/java/org/lwjgl/util/generator/TypeMap.java b/src/java/org/lwjgl/util/generator/TypeMap.java index d70bc3ee..aa863767 100644 --- a/src/java/org/lwjgl/util/generator/TypeMap.java +++ b/src/java/org/lwjgl/util/generator/TypeMap.java @@ -50,6 +50,7 @@ import java.lang.annotation.Annotation; public interface TypeMap { void printCapabilitiesInit(PrintWriter writer); String getCapabilities(); + String getAPIUtilParam(boolean comma); void printErrorCheckMethod(PrintWriter writer, MethodDeclaration method, String tabs); String getRegisterNativesFunctionName(); PrimitiveType.Kind getPrimitiveTypeFromNativeType(Class native_type); diff --git a/src/java/org/lwjgl/util/generator/Utils.java b/src/java/org/lwjgl/util/generator/Utils.java index ec29e3b1..c3934333 100644 --- a/src/java/org/lwjgl/util/generator/Utils.java +++ b/src/java/org/lwjgl/util/generator/Utils.java @@ -57,19 +57,19 @@ import com.sun.mirror.type.TypeMirror; public class Utils { - public static final String TYPEDEF_POSTFIX = "PROC"; - public static final String FUNCTION_POINTER_VAR_NAME = "function_pointer"; - public static final String FUNCTION_POINTER_POSTFIX = "_pointer"; - public static final String CHECKS_CLASS_NAME = "GLChecks"; - public static final String CONTEXT_CAPS_CLASS_NAME = "ContextCapabilities"; - public static final String STUB_INITIALIZER_NAME = "initNativeStubs"; - public static final String BUFFER_OBJECT_METHOD_POSTFIX = "BO"; - public static final String BUFFER_OBJECT_PARAMETER_POSTFIX = "_buffer_offset"; - public static final String RESULT_SIZE_NAME = "result_size"; - public static final String RESULT_VAR_NAME = "__result"; - public static final String CACHED_BUFFER_LENGTH_NAME = "length"; - public static final String CACHED_BUFFER_NAME = "old_buffer"; - private static final String OVERLOADED_METHOD_PREFIX = "n"; + public static final String TYPEDEF_POSTFIX = "PROC"; + public static final String FUNCTION_POINTER_VAR_NAME = "function_pointer"; + public static final String FUNCTION_POINTER_POSTFIX = "_pointer"; + public static final String CHECKS_CLASS_NAME = "GLChecks"; + public static final String CONTEXT_CAPS_CLASS_NAME = "ContextCapabilities"; + public static final String STUB_INITIALIZER_NAME = "initNativeStubs"; + public static final String BUFFER_OBJECT_METHOD_POSTFIX = "BO"; + public static final String BUFFER_OBJECT_PARAMETER_POSTFIX = "_buffer_offset"; + public static final String RESULT_SIZE_NAME = "result_size"; + public static final String RESULT_VAR_NAME = "__result"; + public static final String CACHED_BUFFER_LENGTH_NAME = "length"; + public static final String CACHED_BUFFER_NAME = "old_buffer"; + private static final String OVERLOADED_METHOD_PREFIX = "n"; public static String getTypedefName(MethodDeclaration method) { Alternate alt_annotation = method.getAnnotation(Alternate.class); @@ -102,6 +102,7 @@ public class Utils { } private static class AnnotationMirrorComparator implements Comparator { + public int compare(AnnotationMirror a1, AnnotationMirror a2) { String n1 = a1.getAnnotationType().getDeclaration().getQualifiedName(); String n2 = a2.getAnnotationType().getDeclaration().getQualifiedName(); @@ -148,22 +149,22 @@ public class Utils { private static boolean hasParameterMultipleTypes(ParameterDeclaration param) { int num_native_annotations = 0; - for (AnnotationMirror annotation : param.getAnnotationMirrors()) - if (NativeTypeTranslator.getAnnotation(annotation, NativeType.class) != null) + for ( AnnotationMirror annotation : param.getAnnotationMirrors() ) + if ( NativeTypeTranslator.getAnnotation(annotation, NativeType.class) != null ) num_native_annotations++; return num_native_annotations > 1; } public static boolean isParameterMultiTyped(ParameterDeclaration param) { boolean result = Buffer.class.equals(Utils.getJavaType(param.getType())); - if (!result && hasParameterMultipleTypes(param)) + if ( !result && hasParameterMultipleTypes(param) ) throw new RuntimeException(param + " not defined as java.nio.Buffer but has multiple types"); return result; } public static ParameterDeclaration findParameter(MethodDeclaration method, String name) { - for (ParameterDeclaration param : method.getParameters()) - if (param.getSimpleName().equals(name)) + for ( ParameterDeclaration param : method.getParameters() ) + if ( param.getSimpleName().equals(name) ) return param; throw new RuntimeException("Parameter " + name + " not found"); } @@ -176,7 +177,7 @@ public class Utils { overloadsComment = null; String doc_comment = decl.getDocComment(); - if (doc_comment != null) { + if ( doc_comment != null ) { final String tab = decl instanceof InterfaceDeclaration ? "" : "\t"; writer.println(tab + "/**"); @@ -187,7 +188,7 @@ public class Utils { final StringTokenizer doc_lines = new StringTokenizer(doc_comment, "\n", true); boolean lastWasNL = false; - while (doc_lines.hasMoreTokens()) { + while ( doc_lines.hasMoreTokens() ) { final String t = doc_lines.nextToken(); if ( "\n".equals(t) ) { if ( lastWasNL ) @@ -205,8 +206,8 @@ public class Utils { } public static AnnotationMirror getParameterAutoAnnotation(ParameterDeclaration param) { - for (AnnotationMirror annotation : param.getAnnotationMirrors()) - if (NativeTypeTranslator.getAnnotation(annotation, Auto.class) != null) + for ( AnnotationMirror annotation : param.getAnnotationMirrors() ) + if ( NativeTypeTranslator.getAnnotation(annotation, Auto.class) != null ) return annotation; return null; } @@ -242,9 +243,9 @@ public class Utils { public static ParameterDeclaration getResultParameter(MethodDeclaration method) { ParameterDeclaration result_param = null; - for (ParameterDeclaration param : method.getParameters()) { - if (param.getAnnotation(Result.class) != null) { - if (result_param != null) + for ( ParameterDeclaration param : method.getParameters() ) { + if ( param.getAnnotation(Result.class) != null ) { + if ( result_param != null ) throw new RuntimeException("Multiple parameters annotated with Result in method " + method); result_param = param; } @@ -255,7 +256,7 @@ public class Utils { public static TypeMirror getMethodReturnType(MethodDeclaration method) { TypeMirror result_type; ParameterDeclaration result_param = getResultParameter(method); - if (result_param != null) { + if ( result_param != null ) { result_type = result_param.getType(); } else result_type = method.getReturnType(); @@ -291,20 +292,20 @@ public class Utils { public static void printExtraCallArguments(PrintWriter writer, MethodDeclaration method, String size_parameter_name) { writer.print(size_parameter_name); - if (method.getAnnotation(CachedResult.class) != null) { + if ( method.getAnnotation(CachedResult.class) != null ) { writer.print(", " + CACHED_BUFFER_NAME); } } private static String getClassName(InterfaceDeclaration interface_decl, String opengl_name) { Extension extension_annotation = interface_decl.getAnnotation(Extension.class); - if (extension_annotation != null && !"".equals(extension_annotation.className())) { + if ( extension_annotation != null && !"".equals(extension_annotation.className()) ) { return extension_annotation.className(); } StringBuilder result = new StringBuilder(); - for (int i = 0; i < opengl_name.length(); i++) { + for ( int i = 0; i < opengl_name.length(); i++ ) { int ch = opengl_name.codePointAt(i); - if (ch == '_') { + if ( ch == '_' ) { i++; result.appendCodePoint(Character.toUpperCase(opengl_name.codePointAt(i))); } else @@ -314,8 +315,8 @@ public class Utils { } public static boolean hasMethodBufferObjectParameter(MethodDeclaration method) { - for (ParameterDeclaration param : method.getParameters()) { - if (param.getAnnotation(BufferObject.class) != null) { + for ( ParameterDeclaration param : method.getParameters() ) { + if ( param.getAnnotation(BufferObject.class) != null ) { return true; } } @@ -332,7 +333,7 @@ public class Utils { public static Class getNIOBufferType(TypeMirror t) { Class param_type = getJavaType(t); - if (Buffer.class.isAssignableFrom(param_type)) + if ( Buffer.class.isAssignableFrom(param_type) ) return param_type; else if ( param_type == CharSequence.class || param_type == CharSequence[].class || param_type == PointerBuffer.class ) return ByteBuffer.class; @@ -344,7 +345,7 @@ public class Utils { String method_name; Alternate alt_annotation = method.getAnnotation(Alternate.class); method_name = alt_annotation == null || alt_annotation.nativeAlt() ? method.getSimpleName() : alt_annotation.value(); - if (isMethodIndirect(generate_error_checks, context_specific, method)) + if ( isMethodIndirect(generate_error_checks, context_specific, method) ) method_name = OVERLOADED_METHOD_PREFIX + method_name; return method_name; } @@ -392,15 +393,15 @@ public class Utils { return offset; } - static void printGLReturnPre(PrintWriter writer, MethodDeclaration method, GLreturn return_annotation) { + static void printGLReturnPre(PrintWriter writer, MethodDeclaration method, GLreturn return_annotation, TypeMap type_map) { final String return_type = getMethodReturnType(method, return_annotation, true); if ( "String".equals(return_type) ) { if ( !return_annotation.forceMaxLength() ) { - writer.println("IntBuffer " + return_annotation.value() + "_length = APIUtil.getLengths();"); + writer.println("IntBuffer " + return_annotation.value() + "_length = APIUtil.getLengths(" + type_map.getAPIUtilParam(false) + ");"); writer.print("\t\t"); } - writer.print("ByteBuffer " + return_annotation.value() + " = APIUtil.getBufferByte(" + return_annotation.maxLength()); + writer.print("ByteBuffer " + return_annotation.value() + " = APIUtil.getBufferByte(" + type_map.getAPIUtilParam(true) + return_annotation.maxLength()); /* Params that use the return buffer will advance its position while filling it. When we return, the position will be at the right spot for grabbing the returned string bytes. We only have to make sure that the original buffer was @@ -412,9 +413,9 @@ public class Utils { writer.println(");"); } else { final String buffer_type = "Boolean".equals(return_type) ? "Byte" : return_type; - writer.print(buffer_type + "Buffer " + return_annotation.value() + " = APIUtil.getBuffer" + buffer_type + "("); + writer.print(buffer_type + "Buffer " + return_annotation.value() + " = APIUtil.getBuffer" + buffer_type + "(" + type_map.getAPIUtilParam(false)); if ( "Byte".equals(buffer_type) ) - writer.print('1'); + writer.print((type_map.getAPIUtilParam(false).length() > 0 ? ", " : "") + "1"); writer.println(");"); } @@ -426,20 +427,20 @@ public class Utils { writer.print("\t\t"); } - static void printGLReturnPost(PrintWriter writer, MethodDeclaration method, GLreturn return_annotation) { + static void printGLReturnPost(PrintWriter writer, MethodDeclaration method, GLreturn return_annotation, TypeMap type_map) { final String return_type = getMethodReturnType(method, return_annotation, true); if ( "String".equals(return_type) ) { writer.print("\t\t" + return_annotation.value() + ".limit("); final String offset = getStringOffset(method, null); - if ( offset != null) + if ( offset != null ) writer.print(offset + " + "); if ( return_annotation.forceMaxLength() ) writer.print(return_annotation.maxLength()); else writer.print(return_annotation.value() + "_length.get(0)"); writer.println(");"); - writer.println("\t\treturn APIUtil.getString(" + return_annotation.value() + ");"); + writer.println("\t\treturn APIUtil.getString(" + type_map.getAPIUtilParam(true) + return_annotation.value() + ");"); } else { writer.print("\t\treturn " + return_annotation.value() + ".get(0)"); if ( "Boolean".equals(return_type) ) diff --git a/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java b/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java index d5c32da9..e1aed20e 100644 --- a/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java +++ b/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java @@ -178,6 +178,10 @@ public class ALTypeMap implements TypeMap { throw new UnsupportedOperationException(); } + public String getAPIUtilParam(boolean comma) { + return ""; + } + public void printErrorCheckMethod(final PrintWriter writer, final MethodDeclaration method, final String tabs) { writer.println(tabs + "Util.checkALError();"); } diff --git a/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java b/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java index 6a2c13bb..9b6433ac 100644 --- a/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java +++ b/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java @@ -89,6 +89,10 @@ public class CLTypeMap implements TypeMap { return "CLCapabilities"; } + public String getAPIUtilParam(boolean comma) { + return ""; + } + public void printErrorCheckMethod(final PrintWriter writer, final MethodDeclaration method, final String tabs) { final Check check = method.getAnnotation(Check.class); if ( check != null ) // Get the error code from an IntBuffer output parameter diff --git a/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java b/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java index 18543af3..b15a4ddf 100644 --- a/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java +++ b/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java @@ -64,6 +64,7 @@ public class GLCapabilitiesGenerator { public static void generateClassPrologue(PrintWriter writer, boolean context_specific, boolean generate_error_checks) { writer.println("public class " + Utils.CONTEXT_CAPS_CLASS_NAME + " {"); writer.println("\tstatic final boolean DEBUG = " + Boolean.toString(generate_error_checks) + ";"); + writer.println("\tfinal APIUtil util = new APIUtil();"); writer.println("\tfinal StateTracker tracker = new StateTracker();"); writer.println(); if ( !context_specific ) { diff --git a/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java b/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java index b9c91d7b..a606c375 100644 --- a/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java +++ b/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java @@ -97,6 +97,10 @@ public class GLESTypeMap implements TypeMap { return "caps"; } + public String getAPIUtilParam(boolean comma) { + return ""; + } + public void printErrorCheckMethod(final PrintWriter writer, final MethodDeclaration method, final String tabs) { writer.println(tabs + "Util.checkGLError();"); } diff --git a/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java b/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java index 92f6df1f..d85a42d2 100644 --- a/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java +++ b/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java @@ -106,6 +106,10 @@ public class GLTypeMap implements TypeMap { return "caps"; } + public String getAPIUtilParam(boolean comma) { + return comma ? "caps, " : "caps"; + } + public void printErrorCheckMethod(final PrintWriter writer, final MethodDeclaration method, final String tabs) { writer.println(tabs + "Util.checkGLError();"); } diff --git a/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java b/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java index 39f26c59..52bdc281 100644 --- a/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java +++ b/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java @@ -58,7 +58,7 @@ public interface AMD_name_gen_delete { void glDeleteNamesAMD(@GLenum int identifier, @AutoSize("names") @GLsizei int num, @Const @GLuint IntBuffer names); @Alternate("glDeleteNamesAMD") - void glDeleteNamesAMD(@GLenum int identifier, @Constant("1") @GLsizei int num, @Constant(value = "APIUtil.getInt(name)", keepParam = true) int name); + void glDeleteNamesAMD(@GLenum int identifier, @Constant("1") @GLsizei int num, @Constant(value = "APIUtil.getInt(caps, name)", keepParam = true) int name); boolean glIsNameAMD(@GLenum int identifier, @GLuint int name); diff --git a/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java b/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java index 2d0c5da9..73e3232b 100644 --- a/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java +++ b/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java @@ -100,12 +100,12 @@ public interface AMD_performance_monitor { void glDeletePerfMonitorsAMD(@AutoSize("monitors") @GLsizei int n, @GLuint IntBuffer monitors); @Alternate("glDeletePerfMonitorsAMD") - void glDeletePerfMonitorsAMD(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(monitor)", keepParam = true) int monitor); + void glDeletePerfMonitorsAMD(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, monitor)", keepParam = true) int monitor); void glSelectPerfMonitorCountersAMD(@GLuint int monitor, boolean enable, @GLuint int group, @AutoSize("counterList") int numCounters, @GLuint IntBuffer counterList); @Alternate("glSelectPerfMonitorCountersAMD") - void glSelectPerfMonitorCountersAMD(@GLuint int monitor, boolean enable, @GLuint int group, @Constant("1") int numCounters, @Constant(value = "APIUtil.getInt(counter)", keepParam = true) int counter); + void glSelectPerfMonitorCountersAMD(@GLuint int monitor, boolean enable, @GLuint int group, @Constant("1") int numCounters, @Constant(value = "APIUtil.getInt(caps, counter)", keepParam = true) int counter); void glBeginPerfMonitorAMD(@GLuint int monitor); diff --git a/src/templates/org/lwjgl/opengl/APPLE_fence.java b/src/templates/org/lwjgl/opengl/APPLE_fence.java index c0106f88..f4914b86 100644 --- a/src/templates/org/lwjgl/opengl/APPLE_fence.java +++ b/src/templates/org/lwjgl/opengl/APPLE_fence.java @@ -55,7 +55,7 @@ public interface APPLE_fence { void glDeleteFencesAPPLE(@AutoSize("fences") @GLsizei int n, @Const @GLuint IntBuffer fences); @Alternate("glDeleteFencesAPPLE") - void glDeleteFencesAPPLE(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtil.getInt(fence)", keepParam = true) int fence); + void glDeleteFencesAPPLE(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtil.getInt(caps, fence)", keepParam = true) int fence); void glSetFenceAPPLE(@GLuint int fence); diff --git a/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java b/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java index e4a0935a..d1cd1c72 100644 --- a/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java +++ b/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java @@ -52,7 +52,7 @@ public interface APPLE_vertex_array_object { void glDeleteVertexArraysAPPLE(@AutoSize("arrays") @GLsizei int n, @Const @GLuint IntBuffer arrays); @Alternate("glDeleteVertexArraysAPPLE") - void glDeleteVertexArraysAPPLE(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtil.getInt(array)", keepParam = true) int array); + void glDeleteVertexArraysAPPLE(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtil.getInt(caps, array)", keepParam = true) int array); void glGenVertexArraysAPPLE(@AutoSize("arrays") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); diff --git a/src/templates/org/lwjgl/opengl/ARB_buffer_object.java b/src/templates/org/lwjgl/opengl/ARB_buffer_object.java index 70dbda15..c7a326ab 100644 --- a/src/templates/org/lwjgl/opengl/ARB_buffer_object.java +++ b/src/templates/org/lwjgl/opengl/ARB_buffer_object.java @@ -71,7 +71,7 @@ public interface ARB_buffer_object { void glDeleteBuffersARB(@AutoSize("buffers") @GLsizei int n, @Const @GLuint IntBuffer buffers); @Alternate("glDeleteBuffersARB") - void glDeleteBuffersARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(buffer)", keepParam = true) int buffer); + void glDeleteBuffersARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, buffer)", keepParam = true) int buffer); void glGenBuffersARB(@AutoSize("buffers") @GLsizei int n, @OutParameter @GLuint IntBuffer buffers); diff --git a/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java b/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java index 78de4fda..40d799da 100644 --- a/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java +++ b/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java @@ -65,5 +65,5 @@ public interface ARB_draw_buffers { void glDrawBuffersARB(@AutoSize("buffers") @GLsizei int size, @Const @GLenum IntBuffer buffers); @Alternate("glDrawBuffersARB") - void glDrawBuffersARB(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getInt(buffer)", keepParam = true) int buffer); + void glDrawBuffersARB(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getInt(caps, buffer)", keepParam = true) int buffer); } diff --git a/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java b/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java index d757df6d..6f996047 100644 --- a/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java +++ b/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java @@ -197,7 +197,7 @@ public interface ARB_framebuffer_object { @Reuse("GL30") @Alternate("glDeleteRenderbuffers") - void glDeleteRenderbuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(renderbuffer)", keepParam = true) int renderbuffer); + void glDeleteRenderbuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, renderbuffer)", keepParam = true) int renderbuffer); @Reuse("GL30") void glGenRenderbuffers(@AutoSize("renderbuffers") @GLsizei int n, @OutParameter @GLuint IntBuffer renderbuffers); @@ -237,7 +237,7 @@ public interface ARB_framebuffer_object { @Reuse("GL30") @Alternate("glDeleteFramebuffers") - void glDeleteFramebuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(framebuffer)", keepParam = true) int framebuffer); + void glDeleteFramebuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, framebuffer)", keepParam = true) int framebuffer); @Reuse("GL30") void glGenFramebuffers(@AutoSize("framebuffers") @GLsizei int n, @OutParameter @GLuint IntBuffer framebuffers); diff --git a/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java b/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java index 7d620083..ebb4bc00 100644 --- a/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java +++ b/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java @@ -68,7 +68,7 @@ public interface ARB_occlusion_query { void glDeleteQueriesARB(@AutoSize("ids") @GLsizei int n, @GLuint IntBuffer ids); @Alternate("glDeleteQueriesARB") - void glDeleteQueriesARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(id)", keepParam = true) int id); + void glDeleteQueriesARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, id)", keepParam = true) int id); boolean glIsQueryARB(@GLuint int id); diff --git a/src/templates/org/lwjgl/opengl/ARB_program.java b/src/templates/org/lwjgl/opengl/ARB_program.java index 1f4cd571..eb538d22 100644 --- a/src/templates/org/lwjgl/opengl/ARB_program.java +++ b/src/templates/org/lwjgl/opengl/ARB_program.java @@ -128,7 +128,7 @@ public interface ARB_program { void glDeleteProgramsARB(@AutoSize("programs") @GLsizei int n, @Const @GLuint IntBuffer programs); @Alternate("glDeleteProgramsARB") - void glDeleteProgramsARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(program)", keepParam = true) int program); + void glDeleteProgramsARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, program)", keepParam = true) int program); void glGenProgramsARB(@AutoSize("programs") @GLsizei int n, @OutParameter @GLuint IntBuffer programs); diff --git a/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java b/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java index 40f31c59..24057c1c 100644 --- a/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java +++ b/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java @@ -63,7 +63,7 @@ public interface ARB_sampler_objects { @Reuse("GL33") @Alternate("glDeleteSamplers") - void glDeleteSamplers(@Constant("1") @GLsizei int count, @Constant(value = "APIUtil.getInt(sampler)", keepParam = true) int sampler); + void glDeleteSamplers(@Constant("1") @GLsizei int count, @Constant(value = "APIUtil.getInt(caps, sampler)", keepParam = true) int sampler); @Reuse("GL33") boolean glIsSampler(@GLuint int sampler); diff --git a/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java b/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java index 54112e51..cecb4d9f 100644 --- a/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java +++ b/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java @@ -98,7 +98,7 @@ public interface ARB_separate_shader_objects { @Reuse("GL41") @Alternate("glDeleteProgramPipelines") - void glDeleteProgramPipelines(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(pipeline)", keepParam = true) int pipeline); + void glDeleteProgramPipelines(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, pipeline)", keepParam = true) int pipeline); @Reuse("GL41") void glGenProgramPipelines(@AutoSize("pipelines") @GLsizei int n, @OutParameter @GLuint IntBuffer pipelines); diff --git a/src/templates/org/lwjgl/opengl/ARB_shader_objects.java b/src/templates/org/lwjgl/opengl/ARB_shader_objects.java index 3558afbd..2c79890d 100644 --- a/src/templates/org/lwjgl/opengl/ARB_shader_objects.java +++ b/src/templates/org/lwjgl/opengl/ARB_shader_objects.java @@ -110,7 +110,7 @@ public interface ARB_shader_objects { @Alternate(value = "glShaderSourceARB", nativeAlt = true) void glShaderSourceARB3(@GLhandleARB int shader, @Constant("strings.length") @GLsizei int count, @Const @PointerArray(value = "count", lengths = "length") CharSequence[] strings, - @Constant("APIUtil.getLengths(strings)") @Const IntBuffer length); + @Constant("APIUtil.getLengths(caps, strings)") @Const IntBuffer length); void glCompileShaderARB(@GLhandleARB int shaderObj); @@ -234,7 +234,7 @@ public interface ARB_shader_objects { @Alternate(value = "glGetActiveUniformARB", javaAlt = true) @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveUniformARB(@GLhandleARB int programObj, @GLuint int index, @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length), MemoryUtil.getAddress0(APIUtil.getBufferInt()), MemoryUtil.getAddress(APIUtil.getBufferInt(), 1)") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length), MemoryUtil.getAddress0(APIUtil.getBufferInt(caps)), MemoryUtil.getAddress(APIUtil.getBufferInt(caps), 1)") IntBuffer length, @OutParameter @GLcharARB ByteBuffer name); /** Overloads glGetActiveUniformARB. This version returns only the uniform size. */ @@ -244,7 +244,7 @@ public interface ARB_shader_objects { @OutParameter @GLsizei @Constant("0L") IntBuffer length, @OutParameter IntBuffer size, @OutParameter @GLenum @Constant("MemoryUtil.getAddress(size, 1)") IntBuffer type, // Reuse size buffer and ignore - @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte0()") ByteBuffer name); + @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name); /** Overloads glGetActiveUniformARB. This version returns only the uniform type. */ @Alternate(value = "glGetActiveUniformARB", javaAlt = true) @@ -253,7 +253,7 @@ public interface ARB_shader_objects { @OutParameter @GLsizei @Constant("0L") IntBuffer length, @OutParameter @Constant("MemoryUtil.getAddress(type, 1)") IntBuffer size, // Reuse type buffer and ignore @OutParameter @GLenum IntBuffer type, - @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte0()") ByteBuffer name); + @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name); @StripPostfix("params") void glGetUniformfvARB(@GLhandleARB int programObj, int location, @OutParameter @Check FloatBuffer params); diff --git a/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java b/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java index 4cde62d4..7f705d6e 100644 --- a/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java +++ b/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java @@ -68,7 +68,7 @@ public interface ARB_shading_language_include { @Alternate(value = "glCompileShaderIncludeARB", nativeAlt = true) void glCompileShaderIncludeARB2(@GLuint int shader, @Constant("path.length") @GLsizei int count, @Const @PointerArray(value = "count", lengths = "length") CharSequence[] path, - @Constant("APIUtil.getLengths(path)") @Const IntBuffer length); + @Constant("APIUtil.getLengths(caps, path)") @Const IntBuffer length); boolean glIsNamedStringARB(@AutoSize("name") int namelen, @Const @GLchar ByteBuffer name); diff --git a/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java b/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java index afdaa833..45e80a29 100644 --- a/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java +++ b/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java @@ -61,7 +61,7 @@ public interface ARB_transform_feedback2 { @Reuse("GL40") @Alternate("glDeleteTransformFeedbacks") - void glDeleteTransformFeedbacks(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(id)", keepParam = true) int id); + void glDeleteTransformFeedbacks(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, id)", keepParam = true) int id); @Reuse("GL40") void glGenTransformFeedbacks(@AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); diff --git a/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java b/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java index 7461d47e..d7493402 100644 --- a/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java +++ b/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java @@ -55,7 +55,7 @@ public interface ARB_vertex_array_object { @Reuse("GL30") @Alternate("glDeleteVertexArrays") - void glDeleteVertexArrays(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(array)", keepParam = true) int array); + void glDeleteVertexArrays(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, array)", keepParam = true) int array); @Reuse("GL30") void glGenVertexArrays(@AutoSize("arrays") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); diff --git a/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java b/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java index 91e82a52..9b54647a 100644 --- a/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java +++ b/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java @@ -170,7 +170,7 @@ public interface ARB_vertex_shader { @Alternate(value = "glGetActiveAttribARB", javaAlt = true) @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveAttribARB(@GLhandleARB int programObj, @GLuint int index, @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length), MemoryUtil.getAddress0(APIUtil.getBufferInt()), MemoryUtil.getAddress(APIUtil.getBufferInt(), 1)") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length), MemoryUtil.getAddress0(APIUtil.getBufferInt(caps)), MemoryUtil.getAddress(APIUtil.getBufferInt(caps), 1)") IntBuffer length, @OutParameter @GLcharARB ByteBuffer name); /** Overloads glGetActiveAttribARB. This version returns only the attrib size. */ @@ -180,7 +180,7 @@ public interface ARB_vertex_shader { @OutParameter @GLsizei @Constant("0L") IntBuffer length, @OutParameter IntBuffer size, @OutParameter @GLenum @Constant("MemoryUtil.getAddress(size, 1)") IntBuffer type, // Reuse size buffer and ignore - @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte0()") ByteBuffer name); + @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name); /** Overloads glGetActiveAttribARB. This version returns only the attrib type. */ @Alternate(value = "glGetActiveAttribARB", javaAlt = true) @@ -189,7 +189,7 @@ public interface ARB_vertex_shader { @OutParameter @GLsizei @Constant("0L") IntBuffer length, @OutParameter @Constant("MemoryUtil.getAddress(type, 1)") IntBuffer size, // Reuse type buffer and ignore @OutParameter @GLenum IntBuffer type, - @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte0()") ByteBuffer name); + @OutParameter @GLcharARB @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name); int glGetAttribLocationARB(@GLhandleARB int programObj, @NullTerminated @Const @GLcharARB ByteBuffer name); diff --git a/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java b/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java index a1632318..7f3395b5 100644 --- a/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java +++ b/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java @@ -65,5 +65,5 @@ public interface ATI_draw_buffers { void glDrawBuffersATI(@AutoSize("buffers") @GLsizei int size, @Const @GLenum IntBuffer buffers); @Alternate("glDrawBuffersATI") - void glDrawBuffersATI(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getInt(buffer)", keepParam = true) int buffer); + void glDrawBuffersATI(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getInt(caps, buffer)", keepParam = true) int buffer); } diff --git a/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java b/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java index 7eccedfd..ca83721b 100644 --- a/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java +++ b/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java @@ -1075,7 +1075,7 @@ public interface EXT_direct_state_access { @Alternate("glTextureParameterIivEXT") @Dependent("GL_EXT_texture_integer") @StripPostfix("param") - void glTextureParameterIivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(param)", keepParam = true) int param); + void glTextureParameterIivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(caps, param)", keepParam = true) int param); @Dependent("GL_EXT_texture_integer") @StripPostfix("params") @@ -1084,7 +1084,7 @@ public interface EXT_direct_state_access { @Alternate("glTextureParameterIuivEXT") @Dependent("GL_EXT_texture_integer") @StripPostfix("param") - void glTextureParameterIuivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(param)", keepParam = true) @GLuint int param); + void glTextureParameterIuivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(caps, param)", keepParam = true) @GLuint int param); @Dependent("GL_EXT_texture_integer") @StripPostfix("params") @@ -1119,7 +1119,7 @@ public interface EXT_direct_state_access { @Alternate("glMultiTexParameterIivEXT") @Dependent("GL_EXT_texture_integer") @StripPostfix("param") - void glMultiTexParameterIivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(param)", keepParam = true) int param); + void glMultiTexParameterIivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(caps, param)", keepParam = true) int param); @Dependent("GL_EXT_texture_integer") @StripPostfix("params") @@ -1128,7 +1128,7 @@ public interface EXT_direct_state_access { @Alternate("glMultiTexParameterIuivEXT") @Dependent("GL_EXT_texture_integer") @StripPostfix("param") - void glMultiTexParameterIuivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(param)", keepParam = true) int param); + void glMultiTexParameterIuivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(caps, param)", keepParam = true) int param); @Dependent("GL_EXT_texture_integer") @StripPostfix("params") diff --git a/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java b/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java index 5257266a..b831eb81 100644 --- a/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java +++ b/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java @@ -136,7 +136,7 @@ public interface EXT_framebuffer_object { void glDeleteRenderbuffersEXT(@AutoSize("renderbuffers") int n, @Const @GLuint IntBuffer renderbuffers); @Alternate("glDeleteRenderbuffersEXT") - void glDeleteRenderbuffersEXT(@Constant("1") int n, @Constant(value = "APIUtil.getInt(renderbuffer)", keepParam = true) int renderbuffer); + void glDeleteRenderbuffersEXT(@Constant("1") int n, @Constant(value = "APIUtil.getInt(caps, renderbuffer)", keepParam = true) int renderbuffer); void glGenRenderbuffersEXT(@AutoSize("renderbuffers") int n, @OutParameter @GLuint IntBuffer renderbuffers); @@ -161,7 +161,7 @@ public interface EXT_framebuffer_object { void glDeleteFramebuffersEXT(@AutoSize("framebuffers") int n, @Const @GLuint IntBuffer framebuffers); @Alternate("glDeleteFramebuffersEXT") - void glDeleteFramebuffersEXT(@Constant("1") int n, @Constant(value = "APIUtil.getInt(framebuffer)", keepParam = true) int framebuffer); + void glDeleteFramebuffersEXT(@Constant("1") int n, @Constant(value = "APIUtil.getInt(caps, framebuffer)", keepParam = true) int framebuffer); void glGenFramebuffersEXT(@AutoSize("framebuffers") int n, @OutParameter @GLuint IntBuffer framebuffers); diff --git a/src/templates/org/lwjgl/opengl/EXT_texture_integer.java b/src/templates/org/lwjgl/opengl/EXT_texture_integer.java index 8875b1df..0482327f 100644 --- a/src/templates/org/lwjgl/opengl/EXT_texture_integer.java +++ b/src/templates/org/lwjgl/opengl/EXT_texture_integer.java @@ -118,14 +118,14 @@ public interface EXT_texture_integer { @Alternate("glTexParameterIivEXT") @StripPostfix(value = "param", postfix = "v") - void glTexParameterIivEXT(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(param)", keepParam = true) int param); + void glTexParameterIivEXT(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(caps, param)", keepParam = true) int param); @StripPostfix("params") void glTexParameterIuivEXT(@GLenum int target, @GLenum int pname, @Check("4") @GLuint IntBuffer params); @Alternate("glTexParameterIuivEXT") @StripPostfix(value = "param", postfix = "v") - void glTexParameterIuivEXT(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(param)", keepParam = true) int param); + void glTexParameterIuivEXT(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(caps, param)", keepParam = true) int param); @StripPostfix("params") void glGetTexParameterIivEXT(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); diff --git a/src/templates/org/lwjgl/opengl/GL11.java b/src/templates/org/lwjgl/opengl/GL11.java index a5ebec0f..b538bfe4 100644 --- a/src/templates/org/lwjgl/opengl/GL11.java +++ b/src/templates/org/lwjgl/opengl/GL11.java @@ -784,7 +784,7 @@ public interface GL11 { void glDeleteTextures(@AutoSize("textures") @GLsizei int n, @Const @GLuint IntBuffer textures); @Alternate("glDeleteTextures") - void glDeleteTextures(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(texture)", keepParam = true) int texture); + void glDeleteTextures(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, texture)", keepParam = true) int texture); void glCullFace(@GLenum int mode); diff --git a/src/templates/org/lwjgl/opengl/GL15.java b/src/templates/org/lwjgl/opengl/GL15.java index e2e857db..86518a86 100644 --- a/src/templates/org/lwjgl/opengl/GL15.java +++ b/src/templates/org/lwjgl/opengl/GL15.java @@ -97,7 +97,7 @@ public interface GL15 { void glDeleteBuffers(@AutoSize("buffers") @GLsizei int n, @Const @GLuint IntBuffer buffers); @Alternate("glDeleteBuffers") - void glDeleteBuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(buffer)", keepParam = true) int buffer); + void glDeleteBuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, buffer)", keepParam = true) int buffer); void glGenBuffers(@AutoSize("buffers") @GLsizei int n, @OutParameter @GLuint IntBuffer buffers); @@ -205,7 +205,7 @@ public interface GL15 { void glDeleteQueries(@AutoSize("ids") @GLsizei int n, @GLuint IntBuffer ids); @Alternate("glDeleteQueries") - void glDeleteQueries(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(id)", keepParam = true) int id); + void glDeleteQueries(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, id)", keepParam = true) int id); boolean glIsQuery(@GLuint int id); diff --git a/src/templates/org/lwjgl/opengl/GL20.java b/src/templates/org/lwjgl/opengl/GL20.java index 6bbe3b9b..909e8e7f 100644 --- a/src/templates/org/lwjgl/opengl/GL20.java +++ b/src/templates/org/lwjgl/opengl/GL20.java @@ -108,7 +108,7 @@ public interface GL20 { @Alternate(value = "glShaderSource", nativeAlt = true) void glShaderSource3(@GLuint int shader, @Constant("strings.length") @GLsizei int count, @Const @PointerArray(value = "count", lengths = "length") CharSequence[] strings, - @Constant("APIUtil.getLengths(strings)") @Const IntBuffer length); + @Constant("APIUtil.getLengths(caps, strings)") @Const IntBuffer length); int glCreateShader(@GLuint int type); @@ -257,7 +257,7 @@ public interface GL20 { @Alternate(value = "glGetActiveUniform", javaAlt = true) @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveUniform(@GLuint int program, @GLuint int index, @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length), MemoryUtil.getAddress0(APIUtil.getBufferInt()), MemoryUtil.getAddress(APIUtil.getBufferInt(), 1)") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length), MemoryUtil.getAddress0(APIUtil.getBufferInt(caps)), MemoryUtil.getAddress(APIUtil.getBufferInt(caps), 1)") IntBuffer length, @OutParameter @GLchar ByteBuffer name); /** Overloads glGetActiveUniform. This version returns only the uniform size. */ @@ -267,7 +267,7 @@ public interface GL20 { @OutParameter @GLsizei @Constant("0L") IntBuffer length, @OutParameter IntBuffer size, @OutParameter @GLenum @Constant("MemoryUtil.getAddress(size, 1)") IntBuffer type, // Reuse size buffer and ignore - @OutParameter @GLchar @Constant("APIUtil.getBufferByte0()") ByteBuffer name); + @OutParameter @GLchar @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name); /** Overloads glGetActiveUniform. This version returns only the uniform type. */ @Alternate(value = "glGetActiveUniform", javaAlt = true) @@ -276,7 +276,7 @@ public interface GL20 { @OutParameter @GLsizei @Constant("0L") IntBuffer length, @OutParameter @Constant("MemoryUtil.getAddress(type, 1)") IntBuffer size, // Reuse type buffer and ignore @OutParameter @GLenum IntBuffer type, - @OutParameter @GLchar @Constant("APIUtil.getBufferByte0()") ByteBuffer name); + @OutParameter @GLchar @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name); @StripPostfix("params") void glGetUniformfv(@GLuint int program, int location, @OutParameter @Check FloatBuffer params); @@ -432,7 +432,7 @@ public interface GL20 { @Alternate(value = "glGetActiveAttrib", javaAlt = true) @GLreturn(value = "name", maxLength = "maxLength") void glGetActiveAttrib(@GLuint int program, @GLuint int index, @GLsizei int maxLength, - @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length), MemoryUtil.getAddress0(APIUtil.getBufferInt()), MemoryUtil.getAddress(APIUtil.getBufferInt(), 1)") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length), MemoryUtil.getAddress0(APIUtil.getBufferInt(caps)), MemoryUtil.getAddress(APIUtil.getBufferInt(caps), 1)") IntBuffer length, @OutParameter @GLchar ByteBuffer name); /** Overloads glGetActiveAttribARB. This version returns only the attrib size. */ @@ -442,7 +442,7 @@ public interface GL20 { @OutParameter @GLsizei @Constant("0L") IntBuffer length, @OutParameter IntBuffer size, @OutParameter @GLenum @Constant("MemoryUtil.getAddress(size, 1)") IntBuffer type, // Reuse size buffer and ignore - @OutParameter @GLchar @Constant("APIUtil.getBufferByte0()") ByteBuffer name); + @OutParameter @GLchar @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name); /** Overloads glGetActiveAttrib. This version returns only the attrib type. */ @Alternate(value = "glGetActiveAttrib", javaAlt = true) @@ -451,7 +451,7 @@ public interface GL20 { @OutParameter @GLsizei @Constant("0L") IntBuffer length, @OutParameter @Constant("MemoryUtil.getAddress(type, 1)") IntBuffer size, // Reuse type buffer and ignore @OutParameter @GLenum IntBuffer type, - @OutParameter @GLchar @Constant("APIUtil.getBufferByte0()") ByteBuffer name); + @OutParameter @GLchar @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name); int glGetAttribLocation(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name); @@ -509,7 +509,7 @@ public interface GL20 { void glDrawBuffers(@AutoSize("buffers") @GLsizei int size, @Const @GLenum IntBuffer buffers); @Alternate("glDrawBuffers") - void glDrawBuffers(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getInt(buffer)", keepParam = true) int buffer); + void glDrawBuffers(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getInt(caps, buffer)", keepParam = true) int buffer); // ---------------------------------------------------------------- // ----------------------[ ARB_point_sprite ]---------------------- diff --git a/src/templates/org/lwjgl/opengl/GL30.java b/src/templates/org/lwjgl/opengl/GL30.java index 8cd77df5..22f27f8c 100644 --- a/src/templates/org/lwjgl/opengl/GL30.java +++ b/src/templates/org/lwjgl/opengl/GL30.java @@ -528,7 +528,7 @@ public interface GL30 { void glDeleteRenderbuffers(@AutoSize("renderbuffers") int n, @Const @GLuint IntBuffer renderbuffers); @Alternate("glDeleteRenderbuffers") - void glDeleteRenderbuffers(@Constant("1") int n, @Constant(value = "APIUtil.getInt(renderbuffer)", keepParam = true) int renderbuffer); + void glDeleteRenderbuffers(@Constant("1") int n, @Constant(value = "APIUtil.getInt(caps, renderbuffer)", keepParam = true) int renderbuffer); void glGenRenderbuffers(@AutoSize("renderbuffers") int n, @OutParameter @GLuint IntBuffer renderbuffers); @@ -553,7 +553,7 @@ public interface GL30 { void glDeleteFramebuffers(@AutoSize("framebuffers") int n, @Const @GLuint IntBuffer framebuffers); @Alternate("glDeleteFramebuffers") - void glDeleteFramebuffers(@Constant("1") int n, @Constant(value = "APIUtil.getInt(framebuffer)", keepParam = true) int framebuffer); + void glDeleteFramebuffers(@Constant("1") int n, @Constant(value = "APIUtil.getInt(caps, framebuffer)", keepParam = true) int framebuffer); void glGenFramebuffers(@AutoSize("framebuffers") int n, @OutParameter @GLuint IntBuffer framebuffers); @@ -712,14 +712,14 @@ public interface GL30 { @Alternate("glTexParameterIiv") @StripPostfix(value = "param", postfix = "v") - void glTexParameterIiv(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(param)", keepParam = true) int param); + void glTexParameterIiv(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(caps, param)", keepParam = true) int param); @StripPostfix("params") void glTexParameterIuiv(@GLenum int target, @GLenum int pname, @Check("4") @GLuint IntBuffer params); @Alternate("glTexParameterIuiv") @StripPostfix(value = "param", postfix = "v") - void glTexParameterIuiv(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(param)", keepParam = true) int param); + void glTexParameterIuiv(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getInt(caps, param)", keepParam = true) int param); @StripPostfix("params") void glGetTexParameterIiv(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params); @@ -1019,7 +1019,7 @@ public interface GL30 { @Alternate("glDeleteVertexArrays") @Code(" StateTracker.deleteVAO(caps, array);") - void glDeleteVertexArrays(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(array)", keepParam = true) int array); + void glDeleteVertexArrays(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, array)", keepParam = true) int array); void glGenVertexArrays(@AutoSize("arrays") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays); diff --git a/src/templates/org/lwjgl/opengl/GL33.java b/src/templates/org/lwjgl/opengl/GL33.java index 8b2662ff..d97685a0 100644 --- a/src/templates/org/lwjgl/opengl/GL33.java +++ b/src/templates/org/lwjgl/opengl/GL33.java @@ -102,7 +102,7 @@ public interface GL33 { void glDeleteSamplers(@AutoSize("samplers") @GLsizei int count, @Const @GLuint IntBuffer samplers); @Alternate("glDeleteSamplers") - void glDeleteSamplers(@Constant("1") @GLsizei int count, @Constant(value = "APIUtil.getInt(sampler)", keepParam = true) int sampler); + void glDeleteSamplers(@Constant("1") @GLsizei int count, @Constant(value = "APIUtil.getInt(caps, sampler)", keepParam = true) int sampler); boolean glIsSampler(@GLuint int sampler); diff --git a/src/templates/org/lwjgl/opengl/GL40.java b/src/templates/org/lwjgl/opengl/GL40.java index dcf7aadf..1aa68bb0 100644 --- a/src/templates/org/lwjgl/opengl/GL40.java +++ b/src/templates/org/lwjgl/opengl/GL40.java @@ -404,7 +404,7 @@ public interface GL40 { void glDeleteTransformFeedbacks(@AutoSize("ids") @GLsizei int n, @Const @GLuint IntBuffer ids); @Alternate("glDeleteTransformFeedbacks") - void glDeleteTransformFeedbacks(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(id)", keepParam = true) int id); + void glDeleteTransformFeedbacks(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, id)", keepParam = true) int id); void glGenTransformFeedbacks(@AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids); diff --git a/src/templates/org/lwjgl/opengl/GL41.java b/src/templates/org/lwjgl/opengl/GL41.java index 691e3abe..8baf5563 100644 --- a/src/templates/org/lwjgl/opengl/GL41.java +++ b/src/templates/org/lwjgl/opengl/GL41.java @@ -166,7 +166,7 @@ public interface GL41 { void glDeleteProgramPipelines(@AutoSize("pipelines") @GLsizei int n, @Const @GLuint IntBuffer pipelines); @Alternate("glDeleteProgramPipelines") - void glDeleteProgramPipelines(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(pipeline)", keepParam = true) int pipeline); + void glDeleteProgramPipelines(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, pipeline)", keepParam = true) int pipeline); void glGenProgramPipelines(@AutoSize("pipelines") @GLsizei int n, @OutParameter @GLuint IntBuffer pipelines); diff --git a/src/templates/org/lwjgl/opengl/NV_fence.java b/src/templates/org/lwjgl/opengl/NV_fence.java index 46a28deb..ac0fd2f4 100644 --- a/src/templates/org/lwjgl/opengl/NV_fence.java +++ b/src/templates/org/lwjgl/opengl/NV_fence.java @@ -54,7 +54,7 @@ public interface NV_fence { void glDeleteFencesNV(@AutoSize("piFences") @GLsizei int n, @Const @GLuint IntBuffer piFences); @Alternate("glDeleteFencesNV") - void glDeleteFencesNV(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtil.getInt(fence)", keepParam = true) int fence); + void glDeleteFencesNV(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtil.getInt(caps, fence)", keepParam = true) int fence); void glSetFenceNV(@GLuint int fence, @GLenum int condition); diff --git a/src/templates/org/lwjgl/opengl/NV_occlusion_query.java b/src/templates/org/lwjgl/opengl/NV_occlusion_query.java index 52746a5d..6b0ae981 100644 --- a/src/templates/org/lwjgl/opengl/NV_occlusion_query.java +++ b/src/templates/org/lwjgl/opengl/NV_occlusion_query.java @@ -59,7 +59,7 @@ public interface NV_occlusion_query { void glDeleteOcclusionQueriesNV(@AutoSize("piIDs") @GLsizei int n, @Const @GLuint IntBuffer piIDs); @Alternate("glDeleteOcclusionQueriesNV") - void glDeleteOcclusionQueriesNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(piID)", keepParam = true) int piID); + void glDeleteOcclusionQueriesNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, piID)", keepParam = true) int piID); boolean glIsOcclusionQueryNV(@GLuint int id); diff --git a/src/templates/org/lwjgl/opengl/NV_program.java b/src/templates/org/lwjgl/opengl/NV_program.java index 4e843235..5448edf5 100644 --- a/src/templates/org/lwjgl/opengl/NV_program.java +++ b/src/templates/org/lwjgl/opengl/NV_program.java @@ -69,7 +69,7 @@ public interface NV_program { void glDeleteProgramsNV(@AutoSize("programs") @GLsizei int n, @Const @GLuint IntBuffer programs); @Alternate("glDeleteProgramsNV") - void glDeleteProgramsNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(program)", keepParam = true) int program); + void glDeleteProgramsNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, program)", keepParam = true) int program); void glGenProgramsNV(@AutoSize("programs") @GLsizei int n, @OutParameter @GLuint IntBuffer programs); @@ -101,6 +101,6 @@ public interface NV_program { void glRequestResidentProgramsNV(@AutoSize("programIDs") @GLsizei int n, @GLuint IntBuffer programIDs); @Alternate("glRequestResidentProgramsNV") - void glRequestResidentProgramsNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(programID)", keepParam = true) int programID); + void glRequestResidentProgramsNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, programID)", keepParam = true) int programID); } diff --git a/src/templates/org/lwjgl/opengl/NV_transform_feedback.java b/src/templates/org/lwjgl/opengl/NV_transform_feedback.java index 261110f6..3e82b1f1 100644 --- a/src/templates/org/lwjgl/opengl/NV_transform_feedback.java +++ b/src/templates/org/lwjgl/opengl/NV_transform_feedback.java @@ -152,7 +152,7 @@ public interface NV_transform_feedback { @Alternate(value = "glGetActiveVaryingNV", javaAlt = true) @GLreturn(value = "name", maxLength = "bufSize") void glGetActiveVaryingNV(@GLuint int program, @GLuint int index, @GLsizei int bufSize, - @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length), MemoryUtil.getAddress0(APIUtil.getBufferInt()), MemoryUtil.getAddress(APIUtil.getBufferInt(), 1)") IntBuffer length, + @OutParameter @GLsizei @Constant("MemoryUtil.getAddress0(name_length), MemoryUtil.getAddress0(APIUtil.getBufferInt(caps)), MemoryUtil.getAddress(APIUtil.getBufferInt(caps), 1)") IntBuffer length, @OutParameter @GLchar ByteBuffer name); /** Overloads glGetActiveVaryingNV. This version returns only the varying size. */ @@ -162,7 +162,7 @@ public interface NV_transform_feedback { @OutParameter @GLsizei @Constant("0L") IntBuffer length, @OutParameter IntBuffer size, @OutParameter @GLenum @Constant("MemoryUtil.getAddress(size, 1)") IntBuffer type, // Reuse size buffer and ignore - @OutParameter @GLchar @Constant("APIUtil.getBufferByte0()") ByteBuffer name); + @OutParameter @GLchar @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name); /** Overloads glGetActiveVaryingNV. This version returns only the varying type. */ @Alternate(value = "glGetActiveVaryingNV", javaAlt = true) @@ -171,7 +171,7 @@ public interface NV_transform_feedback { @OutParameter @GLsizei @Constant("0L") IntBuffer length, @OutParameter @Constant("MemoryUtil.getAddress(type, 1)") IntBuffer size, // Reuse type buffer and ignore @OutParameter @GLenum IntBuffer type, - @OutParameter @GLchar @Constant("APIUtil.getBufferByte0()") ByteBuffer name); + @OutParameter @GLchar @Constant("APIUtil.getBufferByte0(caps)") ByteBuffer name); void glActiveVaryingNV(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name); diff --git a/src/templates/org/lwjgl/opengl/NV_transform_feedback2.java b/src/templates/org/lwjgl/opengl/NV_transform_feedback2.java index 5c7b4fa2..e63dfa7d 100644 --- a/src/templates/org/lwjgl/opengl/NV_transform_feedback2.java +++ b/src/templates/org/lwjgl/opengl/NV_transform_feedback2.java @@ -59,7 +59,7 @@ public interface NV_transform_feedback2 { void glDeleteTransformFeedbacksNV(@AutoSize("ids") @GLsizei int n, @Const @GLuint IntBuffer ids); @Alternate("glDeleteTransformFeedbacksNV") - void glDeleteTransformFeedbacksNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(id)", keepParam = true) int id); + void glDeleteTransformFeedbacksNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getInt(caps, id)", keepParam = true) int id); void glGenTransformFeedbacksNV(@AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids);