|
From: <sp...@us...> - 2010-02-07 15:16:13
|
Revision: 3269
http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3269&view=rev
Author: spasi
Date: 2010-02-07 15:15:33 +0000 (Sun, 07 Feb 2010)
Log Message:
-----------
Removed glPrimitiveRestart from GL31 (immediate mode call that never made it to the core)
Added Optional annotation for functions that miss from incomplete implementations.
Modified Paths:
--------------
trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java
trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java
Added Paths:
-----------
trunk/LWJGL/src/java/org/lwjgl/util/generator/Optional.java
Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java 2010-02-03 21:03:32 UTC (rev 3268)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/ContextCapabilitiesGenerator.java 2010-02-07 15:15:33 UTC (rev 3269)
@@ -197,12 +197,13 @@
writer.print("\tprivate boolean " + getAddressesInitializerName(d.getSimpleName()) + "(");
- DeprecatedGL deprecated = d.getAnnotation(DeprecatedGL.class);
+ boolean optional;
+ boolean deprecated = d.getAnnotation(DeprecatedGL.class) != null;
Dependent dependent = d.getAnnotation(Dependent.class);
- if ( deprecated != null )
+ if ( deprecated )
writer.print("boolean forwardCompatible");
if ( dependent != null ) {
- if ( deprecated != null )
+ if ( deprecated )
writer.print(",");
writer.print("Set supported_extensions");
}
@@ -211,11 +212,14 @@
writer.println("\t\treturn ");
while ( methods.hasNext() ) {
MethodDeclaration method = methods.next();
- deprecated = method.getAnnotation(DeprecatedGL.class);
+ optional = method.getAnnotation(Optional.class) != null;
+ deprecated = method.getAnnotation(DeprecatedGL.class) != null;
dependent = method.getAnnotation(Dependent.class);
writer.print("\t\t\t(");
- if ( deprecated != null )
+ if ( optional )
+ writer.print('(');
+ if ( deprecated )
writer.print("forwardCompatible || ");
if ( dependent != null ) {
if ( dependent.value().indexOf(',') == -1 )
@@ -227,7 +231,7 @@
writer.print(") || ");
}
}
- if ( deprecated != null || dependent != null )
+ if ( deprecated || dependent != null )
writer.print('(');
writer.print(Utils.getFunctionAddressName(d, method) + " = ");
PlatformDependent platform_dependent = method.getAnnotation(PlatformDependent.class);
@@ -253,8 +257,10 @@
} else
writer.print("GLContext.getFunctionAddress(");
writer.print("\"" + method.getSimpleName() + "\")) != 0");
- if ( deprecated != null || dependent != null )
+ if ( deprecated || dependent != null )
writer.print(')');
+ if ( optional )
+ writer.print(" || true)");
if ( methods.hasNext() )
writer.println(" &&");
}
Added: trunk/LWJGL/src/java/org/lwjgl/util/generator/Optional.java
===================================================================
--- trunk/LWJGL/src/java/org/lwjgl/util/generator/Optional.java (rev 0)
+++ trunk/LWJGL/src/java/org/lwjgl/util/generator/Optional.java 2010-02-07 15:15:33 UTC (rev 3269)
@@ -0,0 +1,47 @@
+/*
+ * 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.util.generator;
+
+/**
+ * A function annotated with @Optional will allow the extension to be available even if the driver does not expose that function.
+ * This is useful when certain buggy drivers miss some functionality.
+ *
+ * @author spasi <sp...@us...>
+ */
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@Target(ElementType.METHOD)
+public @interface Optional {
+ String reason(); // No default value to force documentation
+}
\ No newline at end of file
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java 2010-02-03 21:03:32 UTC (rev 3268)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL31.java 2010-02-07 15:15:33 UTC (rev 3269)
@@ -96,8 +96,6 @@
*/
int GL_PRIMITIVE_RESTART_INDEX = 0x8F9E;
- void glPrimitiveRestart();
-
void glPrimitiveRestartIndex(@GLuint int index);
// -------------------------------------------------------------------------
Modified: trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java
===================================================================
--- trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java 2010-02-03 21:03:32 UTC (rev 3268)
+++ trunk/LWJGL/src/templates/org/lwjgl/opengl/GL32.java 2010-02-07 15:15:33 UTC (rev 3269)
@@ -63,6 +63,7 @@
// ----------------------[ ARB_draw_elements_base_vertex ]----------------------
// -----------------------------------------------------------------------------
+ @Optional(reason = "AMD's 3.2 implementation does not expose this (last driver checked: 10.1)")
void glDrawElementsBaseVertex(@GLenum int mode, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type,
@BufferObject(BufferKind.ElementVBO)
@Const
@@ -70,6 +71,7 @@
@GLushort
@GLuint Buffer indices, int basevertex);
+ @Optional(reason = "AMD's 3.2 implementation does not expose this (last driver checked: 10.1)")
void glDrawRangeElementsBaseVertex(@GLenum int mode, @GLuint int start, @GLuint int end, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type,
@BufferObject(BufferKind.ElementVBO)
@Const
@@ -77,6 +79,7 @@
@GLushort
@GLuint Buffer indices, int basevertex);
+ @Optional(reason = "AMD's 3.2 implementation does not expose this (last driver checked: 10.1)")
void glDrawElementsInstancedBaseVertex(@GLenum int mode, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type,
@BufferObject(BufferKind.ElementVBO)
@Const
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|