From: <sp...@us...> - 2010-07-27 15:33:29
|
Revision: 3392 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3392&view=rev Author: spasi Date: 2010-07-27 15:33:22 +0000 (Tue, 27 Jul 2010) Log Message: ----------- Added support for OpenGL 4.1 and new extensions. Modified Paths: -------------- trunk/LWJGL/platform_build/build-generator.xml trunk/LWJGL/src/java/org/lwjgl/opengl/AMDDebugOutputCallback.java trunk/LWJGL/src/java/org/lwjgl/opengl/AMDDebugOutputUtil.java trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java trunk/LWJGL/src/native/common/extgl.h trunk/LWJGL/src/native/common/org_lwjgl_opengl_AMDDebugOutputCallback.c trunk/LWJGL/src/templates/org/lwjgl/opengl/EXT_direct_state_access.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL40.java Added Paths: ----------- trunk/LWJGL/src/java/org/lwjgl/opengl/ARBDebugOutputCallback.java trunk/LWJGL/src/java/org/lwjgl/opengl/ARBDebugOutputUtil.java trunk/LWJGL/src/native/common/org_lwjgl_opengl_ARBDebugOutputCallback.c trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_ES2_compatibility.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_debug_output.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_get_program_binary.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_robustness.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_precision.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_shader_stencil_export.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_vertex_attrib_64bit.java trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_viewport_array.java trunk/LWJGL/src/templates/org/lwjgl/opengl/GL41.java Modified: trunk/LWJGL/platform_build/build-generator.xml =================================================================== --- trunk/LWJGL/platform_build/build-generator.xml 2010-07-25 14:22:09 UTC (rev 3391) +++ trunk/LWJGL/platform_build/build-generator.xml 2010-07-27 15:33:22 UTC (rev 3392) @@ -7,7 +7,7 @@ <fileset dir="${lwjgl.src.native}/generated" includes="**"/> </delete> </target> - + <!-- Compiles the Java generator source code --> <target name="generators" description="Compiles the native method generators"> <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/util/generator/**.java" source="1.5" target="1.5" taskname="generator"> @@ -17,6 +17,7 @@ <javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" source="1.4" target="1.4" taskname="generator"> <include name="org/lwjgl/opengl/GLSync.java"/> <include name="org/lwjgl/opengl/AMDDebugOutputCallback.java"/> + <include name="org/lwjgl/opengl/ARBDebugOutputCallback.java"/> <include name="org/lwjgl/opengl/PointerWrapper.java"/> </javac> </target> @@ -42,7 +43,7 @@ <fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java, org/lwjgl/openal/EFX10.java"/> </apply> </target> - + <!-- Generate OpenAL [DEBUG] --> <target name="generate-openal-debug" depends="generators" description="Generates java and native source for AL"> <apply executable="apt" parallel="true"> @@ -111,7 +112,7 @@ <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> </apply> </target> - + <!-- Generate context capabilities --> <target name="generate-opengl-capabilities" depends="generators" description="Generates java and native source for GL"> <apply executable="apt" parallel="true"> @@ -125,8 +126,8 @@ <arg value="-Acontextspecific"/> <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> </apply> - </target> - + </target> + <!-- Generate context capabilities [DEBUG] --> <target name="generate-opengl-capabilities-debug" depends="generators" description="Generates java and native source for GL"> <apply executable="apt" parallel="true"> @@ -141,5 +142,5 @@ <arg value="-Acontextspecific"/> <fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/> </apply> - </target> + </target> </project> Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/AMDDebugOutputCallback.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/AMDDebugOutputCallback.java 2010-07-25 14:22:09 UTC (rev 3391) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/AMDDebugOutputCallback.java 2010-07-27 15:33:22 UTC (rev 3392) @@ -59,7 +59,7 @@ private final long pointer; /** - * Creates a AMDDebugOutputCallback with a default callback handler. + * Creates an AMDDebugOutputCallback with a default callback handler. * The default handler will simply print the message on System.err. */ public AMDDebugOutputCallback() { @@ -120,7 +120,7 @@ } /** - * Creates a AMDDebugOutputCallback with the specified callback handlers. + * Creates an AMDDebugOutputCallback with the specified callback handlers. * The handler's {@code handleMessage} method will be called whenever * debug output is generated by the GL. * Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/AMDDebugOutputUtil.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/AMDDebugOutputUtil.java 2010-07-25 14:22:09 UTC (rev 3391) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/AMDDebugOutputUtil.java 2010-07-27 15:33:22 UTC (rev 3392) @@ -28,7 +28,7 @@ if ( !ctx.getContextAttribs().isDebug() ) throw new IllegalStateException("The current context is not a debug context."); - if ( !GLContext.getCapabilities().GL_AMD_debug_output ) + if ( !GLContext.getCapabilities().GL_AMD_debug_output ) throw new IllegalStateException("AMD_debug_output is not supported."); handlers.put(ctx, handler); Added: trunk/LWJGL/src/java/org/lwjgl/opengl/ARBDebugOutputCallback.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/ARBDebugOutputCallback.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/ARBDebugOutputCallback.java 2010-07-27 15:33:22 UTC (rev 3392) @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +/** + * Instances of this class are needed to use the callback functionality of the ARB_debug_output extension. + * A debug context must be current before creating instances of this class. Users of this class may provide + * implementations of the {@code Handler} interface to receive notifications. The same {@code Handler} + * instance may be used by different contexts but it is not recommended. Handler notifications are synchronized. + * + * @author Spasi + */ +public final class ARBDebugOutputCallback implements PointerWrapper { + + /** Severity levels. */ + private static final int + GL_DEBUG_SEVERITY_HIGH_ARB = 0x9146, + GL_DEBUG_SEVERITY_MEDIUM_ARB = 0x9147, + GL_DEBUG_SEVERITY_LOW_ARB = 0x9148; + + /** Sources. */ + private static final int + GL_DEBUG_SOURCE_API_ARB = 0x8246, + GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB = 0x8247, + GL_DEBUG_SOURCE_SHADER_COMPILER_ARB = 0x8248, + GL_DEBUG_SOURCE_THIRD_PARTY_ARB = 0x8249, + GL_DEBUG_SOURCE_APPLICATION_ARB = 0x824A, + GL_DEBUG_SOURCE_OTHER_ARB = 0x824B; + + /** Types. */ + private static final int + GL_DEBUG_TYPE_ERROR_ARB = 0x824C, + GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB = 0x824D, + GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB = 0x824E, + GL_DEBUG_TYPE_PORTABILITY_ARB = 0x824F, + GL_DEBUG_TYPE_PERFORMANCE_ARB = 0x8250, + GL_DEBUG_TYPE_OTHER_ARB = 0x8251; + + private final long pointer; + + /** + * Creates an ARBDebugOutputCallback with a default callback handler. + * The default handler will simply print the message on System.err. + */ + public ARBDebugOutputCallback() { + this(new Handler() { + public void handleMessage(final int source, final int type, final int id, final int severity, final String message) { + System.err.println("[LWJGL] ARB_debug_output message"); + System.err.println("\tID: " + id); + + String description; + switch ( source ) { + case GL_DEBUG_SOURCE_API_ARB: + description = "API"; + break; + case GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB: + description = "WINDOW SYSTEM"; + break; + case GL_DEBUG_SOURCE_SHADER_COMPILER_ARB: + description = "SHADER COMPILER"; + break; + case GL_DEBUG_SOURCE_THIRD_PARTY_ARB: + description = "THIRD PARTY"; + break; + case GL_DEBUG_SOURCE_APPLICATION_ARB: + description = "APPLICATION"; + break; + case GL_DEBUG_SOURCE_OTHER_ARB: + description = "OTHER"; + break; + default: + description = "Unknown (" + Integer.toHexString(source) + ")"; + } + System.err.println("\tSource: " + description); + + switch ( type ) { + case GL_DEBUG_TYPE_ERROR_ARB: + description = "ERROR"; + break; + case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB: + description = "DEPRECATED BEHAVIOR"; + break; + case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB: + description = "UNDEFINED BEHAVIOR"; + break; + case GL_DEBUG_TYPE_PORTABILITY_ARB: + description = "PORTABILITY"; + break; + case GL_DEBUG_TYPE_PERFORMANCE_ARB: + description = "PERFORMANCE"; + break; + case GL_DEBUG_TYPE_OTHER_ARB: + description = "OTHER"; + break; + default: + description = "Unknown (" + Integer.toHexString(source) + ")"; + } + System.err.println("\tType: " + description); + + switch ( severity ) { + case GL_DEBUG_SEVERITY_HIGH_ARB: + description = "HIGH"; + break; + case GL_DEBUG_SEVERITY_MEDIUM_ARB: + description = "MEDIUM"; + break; + case GL_DEBUG_SEVERITY_LOW_ARB: + description = "LOW"; + break; + default: + description = "Unknown (" + Integer.toHexString(source) + ")"; + } + System.err.println("\tSeverity: " + description); + + System.err.println("\tMessage: " + message); + } + }); + } + + /** + * Creates an ARBDebugOutputCallback with the specified callback handlers. + * The handler's {@code handleMessage} method will be called whenever + * debug output is generated by the GL. + * + * @param handler the callback handler + */ + public ARBDebugOutputCallback(final Handler handler) { + try { + // We have to call registerHandler reflectively because we need this class to compile before we run the Generator. + // The registerHandler method depends on org.lwjgl.opengl.Context, if we touched that we would need to compile + // the whole library (which is not possible). + Class.forName("org.lwjgl.opengl.ARBDebugOutputUtil").getMethod("registerHandler", new Class[] { Handler.class }).invoke(null, new Object[] { handler }); + } catch (Exception e) { + throw new RuntimeException(e.getCause() != null ? e.getCause() : e); + } + this.pointer = getFunctionPointer(); + } + + public long getPointer() { + return pointer; + } + + private static native long getFunctionPointer(); + + /** Implementations of this interface can be used to receive ARB_debug_output notifications. */ + public interface Handler { + + /** + * This method will be called when an AMD_debug_output message is generated. + * + * @param id the message ID + * @param source the message source + * @param type the message type + * @param severity the message severity + * @param message the string representation of the message. + */ + void handleMessage(int source, int type, int id, int severity, String message); + + } + +} \ No newline at end of file Added: trunk/LWJGL/src/java/org/lwjgl/opengl/ARBDebugOutputUtil.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/ARBDebugOutputUtil.java (rev 0) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/ARBDebugOutputUtil.java 2010-07-27 15:33:22 UTC (rev 3392) @@ -0,0 +1,60 @@ +package org.lwjgl.opengl; + +import org.lwjgl.opengl.ARBDebugOutputCallback.Handler; + +import java.nio.ByteBuffer; +import java.util.Map; +import java.util.WeakHashMap; + +/** + * This class handles ARBDebugOutputCallback.Handler registration and notification. + * We could have put this in ARBDebugOutputCallback, but we need to compile it for + * the generator. Registration is done reflectively in the ARBDebugOutputCallback + * constructor. + * + * @author Spasi + */ +final class ARBDebugOutputUtil { + + private static final Map handlers = new WeakHashMap(); + + private ARBDebugOutputUtil() {} + + public static void registerHandler(final Handler handler) { + final Context ctx = Context.getCurrentContext(); + if ( ctx == null ) + throw new IllegalStateException("No context is current."); + + if ( !ctx.getContextAttribs().isDebug() ) + throw new IllegalStateException("The current context is not a debug context."); + + if ( !GLContext.getCapabilities().GL_ARB_debug_output ) + throw new IllegalStateException("ARB_debug_output is not supported."); + + handlers.put(ctx, handler); + } + + /** + * This method is called by native code. If finds the callback handler associated + * with the current Thread and calls its {@code handleMessage} method. + * + * @param source the message source + * @param type the message type + * @param id the message ID + * @param severity the message severity + * @param message the string representation of the message. + * @param userParam the user-specified data specified in glDebugMessageCallbackAMD. For the current implementation this is always null and we ignore it. + */ + private static void messageCallback(final int source, final int type, final int id, final int severity, final String message, final ByteBuffer userParam) { + synchronized ( GlobalLock.lock ) { + final Context ctx = Context.getCurrentContext(); + if ( ctx == null ) + return; + + final Handler handler = (Handler)handlers.get(ctx); + if ( handler != null ) + handler.handleMessage(source, type, id, severity, message); + } + } + +} \ No newline at end of file Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java 2010-07-25 14:22:09 UTC (rev 3391) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/ContextAttribs.java 2010-07-27 15:33:22 UTC (rev 3392) @@ -56,6 +56,13 @@ */ public final class ContextAttribs { + // Same values for GLX & WGL + private static final int CONTEXT_ROBUST_ACCESS_BIT_ARB = 0x00000004; + private static final int CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB = 0x8256; + private static final int + NO_RESET_NOTIFICATION_ARB = 0x8261, + LOSE_CONTEXT_ON_RESET_ARB = 0x8252; + private int majorVersion; private int minorVersion; @@ -63,10 +70,13 @@ private boolean debug; private boolean forwardCompatible; + private boolean robustAccess; private boolean profileCore; private boolean profileCompatibility; + private boolean loseContextOnReset; + public ContextAttribs() { this(1, 0); } @@ -82,14 +92,6 @@ this.majorVersion = majorVersion; this.minorVersion = minorVersion; - - this.layerPlane = 0; - - this.debug = false; - this.forwardCompatible = false; - - this.profileCore = false; - this.profileCompatibility = false; } private ContextAttribs(final ContextAttribs attribs) { @@ -100,9 +102,12 @@ this.debug = attribs.debug; this.forwardCompatible = attribs.forwardCompatible; + this.robustAccess = attribs.robustAccess; this.profileCore = attribs.profileCore; this.profileCompatibility = attribs.profileCompatibility; + + this.loseContextOnReset = attribs.loseContextOnReset; } public int getMajorVersion() { @@ -193,6 +198,24 @@ return attribs; } + /** + * Returns a ContextAttribs instance with CONTEXT_RESET_NOTIFICATION_STRATEGY set + * to LOSE_CONTEXT_ON_RESET if the parameter is true or to NO_RESET_NOTIFICATION + * if the parameter is false. + * + * @param loseContextOnReset + * + * @return the new ContextAttribs + */ + public ContextAttribs withLoseContextOnReset(final boolean loseContextOnReset) { + if ( loseContextOnReset == this.loseContextOnReset ) + return this; + + final ContextAttribs attribs = new ContextAttribs(this); + attribs.loseContextOnReset = loseContextOnReset; + return attribs; + } + private static ContextAttribsImplementation getImplementation() { switch ( LWJGLUtil.getPlatform() ) { case LWJGLUtil.PLATFORM_LINUX: @@ -221,6 +244,8 @@ flags |= implementation.getDebugBit(); if ( forwardCompatible ) flags |= implementation.getForwardCompatibleBit(); + if ( robustAccess ) + flags |= CONTEXT_ROBUST_ACCESS_BIT_ARB; if ( 0 < flags ) attribCount++; @@ -247,6 +272,8 @@ attribs.put(implementation.getFlagsAttrib()).put(flags); if ( 0 < profileMask ) attribs.put(implementation.getProfileMaskAttrib()).put(profileMask); + if ( loseContextOnReset ) + attribs.put(CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB).put(LOSE_CONTEXT_ON_RESET_ARB); attribs.put(0); attribs.rewind(); @@ -261,6 +288,9 @@ sb.append(" - Layer=").append(layerPlane); sb.append(" - Debug=").append(debug); sb.append(" - ForwardCompatible=").append(forwardCompatible); + sb.append(" - RobustAccess=").append(robustAccess); + if ( robustAccess ) + sb.append(" (").append(loseContextOnReset ? "LOSE_CONTEXT_ON_RESET" : "NO_RESET_NOTIFICATION"); sb.append(" - Profile="); if ( profileCore ) sb.append("Core"); Modified: trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java 2010-07-25 14:22:09 UTC (rev 3391) +++ trunk/LWJGL/src/java/org/lwjgl/opengl/GLContext.java 2010-07-27 15:33:22 UTC (rev 3392) @@ -215,38 +215,22 @@ LWJGLUtil.log("The major and/or minor OpenGL version is malformed: " + e.getMessage()); } - // ----------------------[ 4.X ]---------------------- - if ( 4 <= majorVersion ) - supported_extensions.add("OpenGL40"); + final int[][] GL_VERSIONS = { + { 1, 2, 3, 4, 5 }, // OpenGL 1 + { 0, 1 }, // OpenGL 2 + { 0, 1, 2, 3 }, // OpenGL 3 + { 0, 1 }, // OpenGL 4 + }; - // ----------------------[ 3.X ]---------------------- - if ( 3 < majorVersion || (3 == majorVersion && 3 <= minorVersion) ) - supported_extensions.add("OpenGL33"); - if ( 3 < majorVersion || (3 == majorVersion && 2 <= minorVersion) ) - supported_extensions.add("OpenGL32"); - if ( 3 < majorVersion || (3 == majorVersion && 1 <= minorVersion) ) - supported_extensions.add("OpenGL31"); - if ( 3 <= majorVersion ) - supported_extensions.add("OpenGL30"); + for ( int major = 1; major <= GL_VERSIONS.length; major++ ) { + int[] minors = GL_VERSIONS[major - 1]; + for ( int i = 0; i < minors.length; i++ ) { + int minor = minors[i]; + if ( major < majorVersion || (major == majorVersion && minor <= minorVersion) ) + supported_extensions.add("OpenGL" + Integer.toString(major) + Integer.toString(minor)); + } + } - // ----------------------[ 2.X ]---------------------- - if ( 2 < majorVersion || (2 == majorVersion && 1 <= minorVersion) ) - supported_extensions.add("OpenGL21"); - if ( 2 <= majorVersion ) - supported_extensions.add("OpenGL20"); - - // ----------------------[ 1.X ]---------------------- - if ( 1 < majorVersion || 5 <= minorVersion ) - supported_extensions.add("OpenGL15"); - if ( 1 < majorVersion || 4 <= minorVersion ) - supported_extensions.add("OpenGL14"); - if ( 1 < majorVersion || 3 <= minorVersion ) - supported_extensions.add("OpenGL13"); - if ( 1 < majorVersion || 2 <= minorVersion ) - supported_extensions.add("OpenGL12"); - if ( 1 < majorVersion || 1 <= minorVersion ) - supported_extensions.add("OpenGL11"); - int profileMask = 0; if ( majorVersion < 3 ) { Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java 2010-07-25 14:22:09 UTC (rev 3391) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GLTypeMap.java 2010-07-27 15:33:22 UTC (rev 3392) @@ -133,9 +133,9 @@ return "s"; else if ( annotation_type.equals(GLubyte.class) || annotation_type.equals(GLbyte.class) ) return "b"; - else if ( annotation_type.equals(GLfloat.class) ) + else if ( annotation_type.equals(GLfloat.class) || annotation_type.equals(GLclampf.class) ) return "f"; - else if ( annotation_type.equals(GLdouble.class) ) + else if ( annotation_type.equals(GLdouble.class) || annotation_type.equals(GLclampd.class) ) return "d"; else if ( annotation_type.equals(GLhalf.class) ) return "h"; Modified: trunk/LWJGL/src/native/common/extgl.h =================================================================== --- trunk/LWJGL/src/native/common/extgl.h 2010-07-25 14:22:09 UTC (rev 3391) +++ trunk/LWJGL/src/native/common/extgl.h 2010-07-27 15:33:22 UTC (rev 3392) @@ -136,6 +136,9 @@ /* AMD_debug_output callback function pointer. */ typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam); +/* ARB_debug_output callback function pointer. */ +typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam); + /* helper stuff */ /* initializes everything, call this right after the rc is created. the function returns true if successful */ Modified: trunk/LWJGL/src/native/common/org_lwjgl_opengl_AMDDebugOutputCallback.c =================================================================== --- trunk/LWJGL/src/native/common/org_lwjgl_opengl_AMDDebugOutputCallback.c 2010-07-25 14:22:09 UTC (rev 3391) +++ trunk/LWJGL/src/native/common/org_lwjgl_opengl_AMDDebugOutputCallback.c 2010-07-27 15:33:22 UTC (rev 3392) @@ -41,7 +41,11 @@ #include "extgl.h" #include "org_lwjgl_opengl_AMDDebugOutputCallback.h" -static void APIENTRY debugOutputCallback(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam) { +static jclass debugOutputCallbackClassAMD; +static jmethodID debugOutputCallbackMethodAMD; + +static void APIENTRY debugOutputCallbackAMD(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam) { + /* jclass callback_class; jmethodID callback_method; JNIEnv *env = getThreadEnv(); @@ -60,8 +64,25 @@ } } } + */ + + JNIEnv *env = getThreadEnv(); + if ( env != NULL && !(*env)->ExceptionOccurred(env) && debugOutputCallbackMethodAMD != NULL ) { + (*env)->CallStaticVoidMethod(env, debugOutputCallbackClassAMD, debugOutputCallbackMethodAMD, + (jint)id, + (jint)category, + (jint)severity, + NewStringNativeWithLength(env, message, length), + NULL // Ignoring user param, pointless for our implementation + ); + } } JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_AMDDebugOutputCallback_getFunctionPointer(JNIEnv *env, jclass clazz) { - return (jlong)(intptr_t)&debugOutputCallback; + // Cache the callback class and methodID + debugOutputCallbackClassAMD = (*env)->FindClass(env, "org/lwjgl/opengl/AMDDebugOutputUtil"); + if ( debugOutputCallbackClassAMD != NULL ) + debugOutputCallbackMethodAMD = (*env)->GetStaticMethodID(env, debugOutputCallbackClassAMD, "messageCallback", "(IIILjava/lang/String;Ljava/nio/ByteBuffer;)V"); + + return (jlong)(intptr_t)&debugOutputCallbackAMD; } Added: trunk/LWJGL/src/native/common/org_lwjgl_opengl_ARBDebugOutputCallback.c =================================================================== --- trunk/LWJGL/src/native/common/org_lwjgl_opengl_ARBDebugOutputCallback.c (rev 0) +++ trunk/LWJGL/src/native/common/org_lwjgl_opengl_ARBDebugOutputCallback.c 2010-07-27 15:33:22 UTC (rev 3392) @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/** + * JNI implementation of the AMD_debug_output function callback. + * + * @author Spasi + */ + +#include <jni.h> +#include "common_tools.h" +#include "extgl.h" +#include "org_lwjgl_opengl_ARBDebugOutputCallback.h" + +static jclass debugOutputCallbackClassARB; +static jmethodID debugOutputCallbackMethodARB; + +static void APIENTRY debugOutputCallbackARB(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam) { + JNIEnv *env = getThreadEnv(); + if ( env != NULL && !(*env)->ExceptionOccurred(env) && debugOutputCallbackMethodARB != NULL ) { + (*env)->CallStaticVoidMethod(env, debugOutputCallbackClassARB, debugOutputCallbackMethodARB, + (jint)source, + (jint)type, + (jint)id, + (jint)severity, + NewStringNativeWithLength(env, message, length), + NULL // Ignoring user param, pointless for our implementation + ); + } +} + +JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_ARBDebugOutputCallback_getFunctionPointer(JNIEnv *env, jclass clazz) { + // Cache the callback class and methodID + debugOutputCallbackClassARB = (*env)->FindClass(env, "org/lwjgl/opengl/ARBDebugOutputUtil"); + if ( debugOutputCallbackClassARB != NULL ) + debugOutputCallbackMethodARB = (*env)->GetStaticMethodID(env, debugOutputCallbackClassARB, "messageCallback", "(IIIILjava/lang/String;Ljava/nio/ByteBuffer;)V"); + + return (jlong)(intptr_t)&debugOutputCallbackARB; +} Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_ES2_compatibility.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_ES2_compatibility.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_ES2_compatibility.java 2010-07-27 15:33:22 UTC (rev 3392) @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +public interface ARB_ES2_compatibility { + + /** + * Accepted by the <value> parameter of GetBooleanv, GetIntegerv, + * GetInteger64v, GetFloatv, and GetDoublev: + */ + int GL_SHADER_COMPILER = 0x8DFA, + GL_NUM_SHADER_BINARY_FORMATS = 0x8DF9, + GL_MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB, + GL_MAX_VARYING_VECTORS = 0x8DFC, + GL_MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD, + GL_IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A, + GL_IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B; + + /** Accepted by the <type> parameter of VertexAttribPointer: */ + int GL_FIXED = 0x140C; + + /** + * Accepted by the <precisiontype> parameter of + * GetShaderPrecisionFormat: + */ + int GL_LOW_FLOAT = 0x8DF0, + GL_MEDIUM_FLOAT = 0x8DF1, + GL_HIGH_FLOAT = 0x8DF2, + GL_LOW_INT = 0x8DF3, + GL_MEDIUM_INT = 0x8DF4, + GL_HIGH_INT = 0x8DF5; + + void glReleaseShaderCompiler(); + + void glShaderBinary(@AutoSize("shaders") @GLsizei int count, @Const @GLuint IntBuffer shaders, + @GLenum int binaryformat, @Const @GLvoid ByteBuffer binary, @AutoSize("binary") @GLsizei int length); + + void glGetShaderPrecisionFormat(@GLenum int shadertype, @GLenum int precisiontype, + @OutParameter @Check("2") IntBuffer range, + @OutParameter @Check("1") IntBuffer precision); + + void glDepthRangef(@GLclampf float n, @GLclampf float f); + + void glClearDepthf(@GLclampf float d); + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_debug_output.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_debug_output.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_debug_output.java 2010-07-27 15:33:22 UTC (rev 3392) @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +public interface ARB_debug_output { + + /** + * Tokens accepted by the <target> parameters of Enable, Disable, + * and IsEnabled: + */ + int GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB = 0x8242; + + /** + * Tokens accepted by the <value> parameters of GetBooleanv, + * GetIntegerv, GetFloatv, and GetDoublev: + */ + int GL_MAX_DEBUG_MESSAGE_LENGTH_ARB = 0x9143, + GL_MAX_DEBUG_LOGGED_MESSAGES_ARB = 0x9144, + GL_DEBUG_LOGGED_MESSAGES_ARB = 0x9145, + GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB = 0x8243; + + /** Tokens accepted by the <pname> parameter of GetPointerv: */ + int GL_DEBUG_CALLBACK_FUNCTION_ARB = 0x8244, + GL_DEBUG_CALLBACK_USER_PARAM_ARB = 0x8245; + + /** + * Tokens accepted or provided by the <source> parameters of + * DebugMessageControlARB, DebugMessageInsertARB and DEBUGPROCARB, + * and the <sources> parameter of GetDebugMessageLogARB: + */ + int GL_DEBUG_SOURCE_API_ARB = 0x8246, + GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB = 0x8247, + GL_DEBUG_SOURCE_SHADER_COMPILER_ARB = 0x8248, + GL_DEBUG_SOURCE_THIRD_PARTY_ARB = 0x8249, + GL_DEBUG_SOURCE_APPLICATION_ARB = 0x824A, + GL_DEBUG_SOURCE_OTHER_ARB = 0x824B; + + /** + * Tokens accepted or provided by the <type> parameters of + * DebugMessageControlARB, DebugMessageInsertARB and DEBUGPROCARB, + * and the <types> parameter of GetDebugMessageLogARB: + */ + int GL_DEBUG_TYPE_ERROR_ARB = 0x824C, + GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB = 0x824D, + GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB = 0x824E, + GL_DEBUG_TYPE_PORTABILITY_ARB = 0x824F, + GL_DEBUG_TYPE_PERFORMANCE_ARB = 0x8250, + GL_DEBUG_TYPE_OTHER_ARB = 0x8251; + + /** + * Tokens accepted or provided by the <severity> parameters of + * DebugMessageControlARB, DebugMessageInsertARB and DEBUGPROCARB + * callback functions, and the <severities> parameter of + * GetDebugMessageLogARB: + */ + int GL_DEBUG_SEVERITY_HIGH_ARB = 0x9146, + GL_DEBUG_SEVERITY_MEDIUM_ARB = 0x9147, + GL_DEBUG_SEVERITY_LOW_ARB = 0x9148; + + void glDebugMessageControlARB(@GLenum int source, + @GLenum int type, + @GLenum int severity, + @AutoSize(value = "ids", canBeNull = true) @GLsizei int count, + @Check(canBeNull = true) @Const @GLuint IntBuffer ids, + boolean enabled); + + void glDebugMessageInsertARB(@GLenum int source, @GLenum int type, @GLuint int id, @GLenum int severity, @AutoSize("buf") @GLsizei int length, @Const @GLchar ByteBuffer buf); + + @Alternate("glDebugMessageInsertARB") + void glDebugMessageInsertARB(@GLenum int source, @GLenum int type, @GLuint int id, @GLenum int severity, @Constant("buf.length()") @GLsizei int length, CharSequence buf); + + void glDebugMessageCallbackARB(@GLpointer(value = "GLDEBUGPROCARB", canBeNull = true) ARBDebugOutputCallback callback, @Check(canBeNull = true) @GLvoid ByteBuffer userParam); + + @GLuint + int glGetDebugMessageLogARB(@GLuint int count, + @AutoSize(value = "messageLog", canBeNull = true) @GLsizei int logSize, + @Check(value = "count", canBeNull = true) @GLenum IntBuffer sources, + @Check(value = "count", canBeNull = true) @GLenum IntBuffer types, + @Check(value = "count", canBeNull = true) @GLuint IntBuffer ids, + @Check(value = "count", canBeNull = true) @GLenum IntBuffer severities, + @Check(value = "count", canBeNull = true) @GLsizei IntBuffer lengths, + @Check(canBeNull = true) @OutParameter @GLchar ByteBuffer messageLog); + + // Not really useful and a pain to implement in Java + //void glGetPointerv(@GLenum int pname, void**params); + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_get_program_binary.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_get_program_binary.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_get_program_binary.java 2010-07-27 15:33:22 UTC (rev 3392) @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; + +import java.nio.ByteBuffer; +import java.nio.IntBuffer; + +public interface ARB_get_program_binary { + + /** + * Accepted by the <pname> parameter of ProgramParameteri and + * GetProgramiv: + */ + int GL_PROGRAM_BINARY_RETRIEVABLE_HINT = 0x8257; + + /** Accepted by the <pname> parameter of GetProgramiv: */ + int GL_PROGRAM_BINARY_LENGTH = 0x8741; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, + * GetInteger64v, GetFloatv and GetDoublev: + */ + int GL_NUM_PROGRAM_BINARY_FORMATS = 0x87FE, + GL_PROGRAM_BINARY_FORMATS = 0x87FF; + + void glGetProgramBinary(@GLuint int program, @AutoSize("binary") @GLsizei int bufSize, + @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length, + @Check("1") @GLenum IntBuffer binaryFormat, + @OutParameter @GLvoid ByteBuffer binary); + + void glProgramBinary(@GLuint int program, @GLenum int binaryFormat, @Const @GLvoid ByteBuffer binary, @AutoSize("binary") @GLsizei int length); + + void glProgramParameteri(@GLuint int program, @GLenum int pname, int value); + +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_robustness.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_robustness.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_robustness.java 2010-07-27 15:33:22 UTC (rev 3392) @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; + +import java.nio.*; + +@Dependent +@DeprecatedGL +public interface ARB_robustness { + + /** Returned by GetGraphicsResetStatusARB: */ + int GL_NO_ERROR = 0x0000, + GL_GUILTY_CONTEXT_RESET_ARB = 0x8253, + GL_INNOCENT_CONTEXT_RESET_ARB = 0x8254, + GL_UNKNOWN_CONTEXT_RESET_ARB = 0x8255; + + /** + * Accepted by the <value> parameter of GetBooleanv, GetIntegerv, + * GetInteger64v, GetFloatv, and GetDoublev: + */ + int GL_RESET_NOTIFICATION_STRATEGY_ARB = 0x8256; + + /** + * Returned by GetIntegerv and related simple queries when + * <value> is RESET_NOTIFICATION_STRATEGY_ARB: + */ + int GL_LOSE_CONTEXT_ON_RESET_ARB = 0x8252, + GL_NO_RESET_NOTIFICATION_ARB = 0x8261; + + /** Returned by GetIntegerv when <pname> is CONTEXT_FLAGS: */ + int GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB = 0x00000004; + + @GLenum + int glGetGraphicsResetStatusARB(); + + @DeprecatedGL + void glGetnMapdvARB(@GLenum int target, @GLenum int query, @Constant("v.remaining() << 3") @GLsizei int bufSize, @OutParameter @Check DoubleBuffer v); + + @DeprecatedGL + void glGetnMapfvARB(@GLenum int target, @GLenum int query, @Constant("v.remaining() << 2") @GLsizei int bufSize, @OutParameter @Check FloatBuffer v); + + @DeprecatedGL + void glGetnMapivARB(@GLenum int target, @GLenum int query, @Constant("v.remaining() << 2") @GLsizei int bufSize, @OutParameter @Check IntBuffer v); + + @DeprecatedGL + void glGetnPixelMapfvARB(@GLenum int map, @Constant("values.remaining() << 2") @GLsizei int bufSize, @OutParameter @Check FloatBuffer values); + + @DeprecatedGL + void glGetnPixelMapuivARB(@GLenum int map, @Constant("values.remaining() << 2") @GLsizei int bufSize, @OutParameter @Check @GLuint IntBuffer values); + + @DeprecatedGL + void glGetnPixelMapusvARB(@GLenum int map, @Constant("values.remaining() << 1") @GLsizei int bufSize, @OutParameter @Check @GLushort ShortBuffer values); + + @DeprecatedGL + void glGetnPolygonStippleARB(@AutoSize("pattern") @GLsizei int bufSize, @OutParameter @GLubyte ByteBuffer pattern); + + void glGetnTexImageARB(@GLenum int target, int level, @GLenum int format, @GLenum int type, @AutoSize("img") @GLsizei int bufSize, + @OutParameter + @BufferObject(BufferKind.PackPBO) + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer img); + + void glReadnPixelsARB(int x, int y, @GLsizei int width, @GLsizei int height, + @GLenum int format, @GLenum int type, @AutoSize("data") @GLsizei int bufSize, + @OutParameter + @BufferObject(BufferKind.PackPBO) + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer data); + + @Dependent("GL_ARB_imaging") + void glGetnColorTableARB(@GLenum int target, @GLenum int format, @GLenum int type, @AutoSize("table") @GLsizei int bufSize, + @OutParameter + @GLbyte + @GLfloat + @GLdouble Buffer table); + + @Dependent("GL_ARB_imaging") + void glGetnConvolutionFilterARB(@GLenum int target, @GLenum int format, @GLenum int type, @AutoSize("image") @GLsizei int bufSize, + @OutParameter + @BufferObject(BufferKind.PackPBO) + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer image); + + @Dependent("GL_ARB_imaging") + void glGetnSeparableFilterARB(@GLenum int target, @GLenum int format, @GLenum int type, + @AutoSize("row") @GLsizei int rowBufSize, + @OutParameter + @BufferObject(BufferKind.PackPBO) + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer row, + @AutoSize("column") @GLsizei int columnBufSize, + @OutParameter + @BufferObject(BufferKind.PackPBO) + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer column, + @OutParameter + @BufferObject(BufferKind.PackPBO) + @Check + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer span); + + @Dependent("GL_ARB_imaging") + void glGetnHistogramARB(@GLenum int target, boolean reset, @GLenum int format, @GLenum int type, @AutoSize("values") @GLsizei int bufSize, + @OutParameter + @BufferObject(BufferKind.PackPBO) + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer values); + + @Dependent("GL_ARB_imaging") + void glGetnMinmaxARB(@GLenum int target, boolean reset, @GLenum int format, @GLenum int type, @AutoSize("values") @GLsizei int bufSize, + @OutParameter + @BufferObject(BufferKind.PackPBO) + @GLbyte + @GLshort + @GLint + @GLfloat + @GLdouble Buffer values); + + @Dependent("OpenGL13") + void glGetnCompressedTexImageARB(@GLenum int target, int lod, @AutoSize("img") @GLsizei int bufSize, + @OutParameter + @BufferObject(BufferKind.PackPBO) + @GLbyte + @GLshort + @GLint Buffer img); + + @Dependent("OpenGL20") + void glGetnUniformfvARB(@GLuint int program, int location, @Constant("params.remaining() << 2") @GLsizei int bufSize, @OutParameter @Check FloatBuffer params); + + @Dependent("OpenGL20") + void glGetnUniformivARB(@GLuint int program, int location, @Constant("params.remaining() << 2") @GLsizei int bufSize, @OutParameter @Check IntBuffer params); + + @Dependent("OpenGL20") + void glGetnUniformuivARB(@GLuint int program, int location, @Constant("params.remaining() << 2") @GLsizei int bufSize, @OutParameter @Check @GLuint IntBuffer params); + + @Dependent("OpenGL20") + void glGetnUniformdvARB(@GLuint int program, int location, @Constant("params.remaining() << 3") @GLsizei int bufSize, @OutParameter @Check DoubleBuffer params); +} \ No newline at end of file Added: trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java =================================================================== --- trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java (rev 0) +++ trunk/LWJGL/src/templates/org/lwjgl/opengl/ARB_separate_shader_objects.java 2010-07-27 15:33:22 UTC (rev 3392) @@ -0,0 +1,269 @@ +/* + * Copyright (c) 2002-2008 LWJGL Project + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * * Neither the name of 'LWJGL' nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.lwjgl.opengl; + +import org.lwjgl.util.generator.*; + +import java.nio.ByteBuffer; +import java.nio.DoubleBuffer; +import java.nio.FloatBuffer; +import java.nio.IntBuffer; + +@Extension(postfix = "") +public interface ARB_separate_shader_objects { + + /** Accepted by <stages> parameter to UseProgramStages: */ + int GL_VERTEX_SHADER_BIT = 0x00000001, + GL_FRAGMENT_SHADER_BIT = 0x00000002, + GL_GEOMETRY_SHADER_BIT = 0x00000004, + GL_TESS_CONTROL_SHADER_BIT = 0x00000008, + GL_TESS_EVALUATION_SHADER_BIT = 0x00000010, + GL_ALL_SHADER_BITS = 0xFFFFFFFF; + + /** + * Accepted by the <pname> parameter of ProgramParameteri and + * GetProgramiv: + */ + int GL_PROGRAM_SEPARABLE = 0x8258; + + /** Accepted by <type> parameter to GetProgramPipelineiv: */ + int GL_ACTIVE_PROGRAM = 0x8259; + + /** + * Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, + * GetInteger64v, GetFloatv, and GetDoublev: + */ + int GL_PROGRAM_PIPELINE_BINDING = 0x825A; + + void glUseProgramStages(@GLuint int pipeline, @GLbitfield int stages, @GLuint int program); + + void glActiveShaderProgram(@GLuint int pipeline, @GLuint int program); + + @StripPostfix(value = "strings", postfix = "v") + @GLuint + int glCreateShaderProgramv(@GLenum int type, @GLsizei int count, @Check @Const @Indirect @GLchar ByteBuffer strings); + + @Alternate("glCreateShaderProgramv") + @StripPostfix(value = "string", postfix = "v") + @GLuint + int glCreateShaderProgramv(@GLenum int type, @Constant("1") @GLsizei int count, @NullTerminated CharSequence string); + + @Alternate("glCreateShaderProgramv") + @StripPostfix(value = "strings", postfix = "v") + @GLuint + int glCreateShaderProgramv(@GLenum int type, @Constant("strings.length") @GLsizei int count, + @Const @NullTerminated @StringList(value = "count") CharSequence[] strings); + + void glBindProgramPipeline(@GLuint int pipeline); + + void glDeleteProgramPipelines(@AutoSize("pipelines") @GLsizei int n, @Const @GLuint IntBuffer pipelines); + + @Alternate("glDeleteProgramPipelines") + void glDeleteProgramPipelines(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, pipeline), 0", keepParam = true) int pipeline); + + void glGenProgramPipelines(@AutoSize("pipelines") @GLsizei int n, @OutParameter @GLuint IntBuffer pipelines); + + @Alternate("glGenProgramPipelines") + @GLreturn("pipelines") + void glGenProgramPipelines2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer pipelines); + + boolean glIsProgramPipeline(@GLuint int pipeline); + + void glProgramParameteri(@GLuint int program, @GLenum int pname, int value); + + @StripPostfix("params") + void glGetProgramPipelineiv(@GLuint int pipeline, @GLenum int pname, @OutParameter @Check("1") IntBuffer params); + + @Alternate("glGetProgramPipelineiv") + @GLreturn("params") + @StripPostfix("params") + void glGetProgramPipelineiv2(@GLuint int pipeline, @GLenum int pname, @OutParameter IntBuffer params); + + void glProgramUniform1i(@GLuint int program, int location, int v0); + + void glProgramUniform2i(@GLuint int program, int location, int v0, int v1); + + void glProgramUniform3i(@GLuint int program, int location, int v0, int v1, int v2); + + void glProgramUniform4i(@GLuint int program, int location, int v0, int v1, int v2, int v3); + + void glProgramUniform1f(@GLuint int program, int location, float v0); + + void glProgramUniform2f(@GLuint int program, int location, float v0, float v1); + + void glProgramUniform3f(@GLuint int program, int location, float v0, float v1, float v2); + + void glProgramUniform4f(@GLuint int program, int location, float v0, float v1, float v2, float v3); + + void glProgramUniform1d(@GLuint int program, int location, double v0); + + void glProgramUniform2d(@GLuint int program, int location, double v0, double v1); + + void glProgramUniform3d(@GLuint int program, int location, double v0, double v1, double v2); + + void glProgramUniform4d(@GLuint int program, int location, double v0, double v1, double v2, double v3); + + @StripPostfix("value") + void glProgramUniform1iv(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const IntBuffer value); + + @StripPostfix("value") + void glProgramUniform2iv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const IntBuffer value); + + @StripPostfix("value") + void glProgramUniform3iv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const IntBuffer value); + + @StripPostfix("value") + void glProgramUniform4iv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const IntBuffer value); + + @StripPostfix("value") + void glProgramUniform1fv(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const FloatBuffer value); + + @StripPostfix("value") + void glProgramUniform2fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const FloatBuffer value); + + @StripPostfix("value") + void glProgramUniform3fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const FloatBuffer value); + + @StripPostfix("value") + void glProgramUniform4fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const FloatBuffer value); + + @StripPostfix("value") + void glProgramUniform1dv(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const DoubleBuffer value); + + @StripPostfix("value") + void glProgramUniform2dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const DoubleBuffer value); + + @StripPostfix("value") + void glProgramUniform3dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const DoubleBuffer value); + + @StripPostfix("value") + void glProgramUniform4dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const DoubleBuffer value); + + void glProgramUniform1ui(@GLuint int program, int location, int v0); + + void glProgramUniform2ui(@GLuint int program, int location, int v0, int v1); + + void glProgramUniform3ui(@GLuint int program, int location, int v0, int v1, int v2); + + void glProgramUniform4ui(@GLuint int program, int location, int v0, int v1, int v2, int v3); + + @StripPostfix("value") + void glProgramUniform1uiv(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const IntBuffer value); + + @StripPostfix("value") + void glProgramUniform2uiv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const IntBuffer value); + + @StripPostfix("value") + void glProgramUniform3uiv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const IntBuffer value); + + @StripPostfix("value") + void glProgramUniform4uiv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const IntBuffer value); + + @StripPostfix("value") + void glProgramUniformMatrix2fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, boolean transpose, @Const FloatBuffer value); + + @StripPostfix("value") + void glProgramUniformMatrix3fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 3)") @GLsizei int count, boolean transpose, @Const FloatBuffer value); + + @StripPostfix("value") + void glProgramUniformMatrix4fv(@GLuint int program, int location,... [truncated message content] |