From: <sp...@us...> - 2011-07-16 22:26:54
|
Revision: 3593 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3593&view=rev Author: spasi Date: 2011-07-16 22:26:46 +0000 (Sat, 16 Jul 2011) Log Message: ----------- Converted GL APIUtil to a per ContextCapabilities instance. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtil.java trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeMap.java trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_fence.java trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_program.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_integer.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL30.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL33.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL40.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL41.java trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_fence.java trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_occlusion_query.java trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_program.java trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_transform_feedback.java trunk/LWJGL/src/templates/org/lwjgl/opengl/NV_transform_feedback2.java Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtil.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtil.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/APIUtil.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -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 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<char[]> arrayTL = new ThreadLocal<char[]>() { - 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<ByteBuffer> bufferTL = new ThreadLocal<ByteBuffer>() { - protected ByteBuffer initialValue() { return BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE); } - }; - - private static final ThreadLocal<IntBuffer> lengthsTL = new ThreadLocal<IntBuffer>() { - protected IntBuffer initialValue() { return BufferUtils.createIntBuffer(INITIAL_LENGTHS_SIZE); } - }; - - private static final ThreadLocal<Buffers> buffersTL = new ThreadLocal<Buffers>() { - 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 @@ 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 @@ 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 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 @@ 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 @@ sizeNew <<= 1; lengths = BufferUtils.createIntBuffer(size); - lengthsTL.set(lengths); + caps.util.lengthsTL = lengths; } else lengths.clear(); @@ -169,9 +167,9 @@ * * @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 @@ * * @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 @@ * * @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 @@ * * @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 @@ * * @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 @@ * * @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 @@ * * @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 @@ 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() { Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/JavaMethodsGenerator.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -301,13 +301,13 @@ } } 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 @@ 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 @@ throw new RuntimeException(c + " is not allowed"); } - private static boolean printMethodCallArgument(PrintWriter writer, MethodDeclaration method, ParameterDeclaration param, Map<ParameterDeclaration, TypeInfo> typeinfos_instance, Mode mode, boolean first_parameter) { + private static boolean printMethodCallArgument(PrintWriter writer, MethodDeclaration method, ParameterDeclaration param, Map<ParameterDeclaration, TypeInfo> typeinfos_instance, Mode mode, boolean first_parameter, TypeMap type_map) { if (!first_parameter) writer.print(", "); @@ -496,7 +496,9 @@ 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 @@ return false; } - private static boolean printMethodCallArguments(PrintWriter writer, MethodDeclaration method, Map<ParameterDeclaration, TypeInfo> typeinfos_instance, Mode mode) { + private static boolean printMethodCallArguments(PrintWriter writer, MethodDeclaration method, Map<ParameterDeclaration, TypeInfo> 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 @@ 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()) { Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeMap.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeMap.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/TypeMap.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -50,6 +50,7 @@ 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<? extends Annotation> native_type); Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Utils.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -57,19 +57,19 @@ 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 @@ } private static class AnnotationMirrorComparator implements Comparator<AnnotationMirror> { + public int compare(AnnotationMirror a1, AnnotationMirror a2) { String n1 = a1.getAnnotationType().getDeclaration().getQualifiedName(); String n2 = a2.getAnnotationType().getDeclaration().getQualifiedName(); @@ -148,22 +149,22 @@ 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 @@ 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 @@ 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 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 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 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 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 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 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 @@ 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 @@ 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 @@ 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 @@ 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) ) Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/openal/ALTypeMap.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -178,6 +178,10 @@ 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();"); } Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/opencl/CLTypeMap.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -89,6 +89,10 @@ 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 Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLCapabilitiesGenerator.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -64,6 +64,7 @@ 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 ) { Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLESTypeMap.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -97,6 +97,10 @@ 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();"); } Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/opengl/GLTypeMap.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -106,6 +106,10 @@ 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();"); } Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_name_gen_delete.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -58,7 +58,7 @@ 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); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/AMD_performance_monitor.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -100,12 +100,12 @@ 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); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_fence.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_fence.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_fence.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -55,7 +55,7 @@ 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); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/APPLE_vertex_array_object.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -52,7 +52,7 @@ 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); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_buffer_object.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -71,7 +71,7 @@ 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); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_draw_buffers.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -65,5 +65,5 @@ 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); } Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_framebuffer_object.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -197,7 +197,7 @@ @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 @@ @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); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_occlusion_query.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -68,7 +68,7 @@ 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); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_program.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_program.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_program.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -128,7 +128,7 @@ 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); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_sampler_objects.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -63,7 +63,7 @@ @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); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -98,7 +98,7 @@ @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); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_objects.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -110,7 +110,7 @@ @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 @@ @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 @@ @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 @@ @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); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shading_language_include.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -68,7 +68,7 @@ @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); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_transform_feedback2.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -61,7 +61,7 @@ @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); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_array_object.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -55,7 +55,7 @@ @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); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_shader.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -170,7 +170,7 @@ @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 @@ @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 @@ @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); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ATI_draw_buffers.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -65,5 +65,5 @@ 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); } Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -1075,7 +1075,7 @@ @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 @@ @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 @@ @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 @@ @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") Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_framebuffer_object.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -136,7 +136,7 @@ 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 @@ 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); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_integer.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_integer.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_texture_integer.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -118,14 +118,14 @@ @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); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL11.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -784,7 +784,7 @@ 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); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL15.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -97,7 +97,7 @@ 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 @@ 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); Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java 2011-07-16 19:40:16 UTC (rev 3592) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL20.java 2011-07-16 22:26:46 UTC (rev 3593) @@ -108,7 +108,7 @@ @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 @@ @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 @@ @OutParameter @GLsizei @Constant("0L") IntBuffer length, ... [truncated message content] |