Added support for NVX_gpu_memory_info (experimental extension).

Added support for initializing extensions that are not exposed in GL_EXTENSIONS (enables EXT_direct_state_access and NV_primitive_restart on AMD GPUs, use at your own risk).
Updated @Optional functions for AMD GPUs (driver version: 10.3)
This commit is contained in:
Ioannis Tsakpinis 2010-03-31 15:46:16 +00:00
parent bd6ac573d5
commit 6e738cc2b6
12 changed files with 168 additions and 9 deletions

View file

@ -14,7 +14,7 @@
<property name="lwjgl.res" location="res" />
<property name="lwjgl.version" value="2.4" />
<property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/AMD*.java,org/lwjgl/opengl/APPLE*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java,org/lwjgl/opengl/SGIS*.java,org/lwjgl/opengl/GREMEDY*.java"/>
<property name="opengl-template-pattern" value="org/lwjgl/opengl/GL*.java,org/lwjgl/opengl/ARB*.java,org/lwjgl/opengl/AMD*.java,org/lwjgl/opengl/APPLE*.java,org/lwjgl/opengl/ATI*.java,org/lwjgl/opengl/EXT*.java,org/lwjgl/opengl/NV*.java,org/lwjgl/opengl/NVX*.java,org/lwjgl/opengl/HP*.java,org/lwjgl/opengl/IBM*.java,org/lwjgl/opengl/SUN*.java,org/lwjgl/opengl/SGIS*.java,org/lwjgl/opengl/GREMEDY*.java"/>
<!-- ================================================================== -->
<!-- Filesets used for targets -->
<!-- ================================================================== -->

View file

@ -164,6 +164,8 @@ public class ContextCapabilitiesGenerator {
public static void generateInitStubs(PrintWriter writer, InterfaceDeclaration d, boolean context_specific) {
if ( d.getMethods().size() > 0 ) {
if ( context_specific ) {
if ( d.getAnnotation(ForceInit.class) != null )
writer.println("\t\t" + CACHED_EXTS_VAR_NAME + ".add(\"" + translateFieldName(d.getSimpleName()) + "\");");
writer.print("\t\tif (" + CACHED_EXTS_VAR_NAME + ".contains(\"");
writer.print(translateFieldName(d.getSimpleName()) + "\")");
writer.print(" && !" + getAddressesInitializerName(d.getSimpleName()) + "(");
@ -218,7 +220,7 @@ public class ContextCapabilitiesGenerator {
continue;
if ( !first )
writer.println(" &&");
writer.println(" &");
else
first = false;

View file

@ -0,0 +1,45 @@
/*
* 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;
/**
* Extensions marked with ForceInit will be initialized by LWJGL even if not exposed in the GL_EXTENSIONS string.
*
* @author spasi
*/
import java.lang.annotation.ElementType;
import java.lang.annotation.Target;
@Target({ ElementType.TYPE })
public @interface ForceInit {
}

View file

@ -186,6 +186,7 @@ public class GeneratorVisitor extends SimpleDeclarationVisitor {
//java_writer.println("import org.lwjgl.NondirectBufferWrapper;");
java_writer.println("import java.nio.*;");
java_writer.println();
Utils.printDocComment(java_writer, d);
java_writer.print("public ");
boolean is_final = Utils.isFinal(d);
if (is_final)

View file

@ -149,11 +149,12 @@ public class Utils {
public static void printDocComment(PrintWriter writer, Declaration decl) {
String doc_comment = decl.getDocComment();
if (doc_comment != null) {
writer.println("\t/**");
String tab = decl instanceof InterfaceDeclaration ? "" : "\t";
writer.println(tab + "/**");
StringTokenizer doc_lines = new StringTokenizer(doc_comment, "\n");
while (doc_lines.hasMoreTokens())
writer.println("\t *" + doc_lines.nextToken());
writer.println("\t */");
writer.println(tab + " * " + doc_lines.nextToken());
writer.println(tab + " */");
} else if ( (decl instanceof MethodDeclaration) && decl.getAnnotation(Alternate.class) != null )
writer.println("\t/** Overloads " + decl.getAnnotation(Alternate.class).value() + " */");
}

View file

@ -0,0 +1,45 @@
/*
* 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;
public interface ATI_texture_env_combine3 {
/**
* Accepted by the &lt;params&gt; parameter of TexEnvf, TexEnvi, TexEnvfv,
* and TexEnviv when the &lt;pname&gt; parameter value is COMBINE_RGB_ARB
* or COMBINE_ALPHA_ARB
*/
int GL_MODULATE_ADD_ATI = 0x8744;
int GL_MODULATE_SIGNED_ADD_ATI = 0x8745;
int GL_MODULATE_SUBTRACT_ATI = 0x8746;
}

View file

@ -35,6 +35,7 @@ import org.lwjgl.util.generator.*;
import java.nio.*;
@ForceInit
@Dependent
@DeprecatedGL
public interface EXT_direct_state_access {
@ -518,9 +519,11 @@ public interface EXT_direct_state_access {
value parameters
*/
@Optional(reason = "AMD does not expose this (last driver checked: 10.3)")
@Dependent("OpenGL30")
void glEnableClientStateiEXT(@GLenum int array, @GLuint int index);
@Optional(reason = "AMD does not expose this (last driver checked: 10.3)")
@Dependent("OpenGL30")
void glDisableClientStateiEXT(@GLenum int array, @GLuint int index);
@ -562,6 +565,7 @@ public interface EXT_direct_state_access {
and before state value parameters
*/
@Optional(reason = "AMD does not expose this (last driver checked: 10.3)")
@Dependent("OpenGL30")
@StripPostfix("params")
void glGetFloati_vEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") FloatBuffer params);
@ -572,6 +576,7 @@ public interface EXT_direct_state_access {
@StripPostfix("params")
void glGetFloati_vEXT2(@GLenum int pname, @GLuint int index, @OutParameter FloatBuffer params);
@Optional(reason = "AMD does not expose this (last driver checked: 10.3)")
@Dependent("OpenGL30")
@StripPostfix("params")
void glGetDoublei_vEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") DoubleBuffer params);
@ -582,6 +587,7 @@ public interface EXT_direct_state_access {
@StripPostfix("params")
void glGetDoublei_vEXT2(@GLenum int pname, @GLuint int index, @OutParameter DoubleBuffer params);
@Optional(reason = "AMD does not expose this (last driver checked: 10.3)")
@Dependent("OpenGL30")
@StripPostfix(value = "params", hasPostfix = false)
void glGetPointeri_vEXT(@GLenum int pname, @GLuint int index, @Result @GLvoid ByteBuffer params);
@ -812,6 +818,7 @@ public interface EXT_direct_state_access {
@GLshort
@GLint Buffer img);
@Dependent("OpenGL13")
void glGetCompressedTexImage(@GLenum int target, int lod,
@OutParameter
@BufferObject(BufferKind.PackPBO)
@ -946,6 +953,7 @@ public interface EXT_direct_state_access {
@Dependent("OpenGL20")
void glProgramUniform4fEXT(@GLuint int program, int location, float v0, float v1, float v2, float v3);
@Dependent("OpenGL20")
void glProgramUniform1iEXT(@GLuint int program, int location, int v0);
@Dependent("OpenGL20")

View file

@ -63,7 +63,6 @@ public interface GL32 {
// ----------------------[ 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
@ -71,7 +70,6 @@ public interface GL32 {
@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
@ -79,7 +77,6 @@ public interface GL32 {
@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
@ -326,7 +323,6 @@ public interface GL32 {
@Alternate("glGetInteger64i_v")
@GLreturn("data")
@StripPostfix(value = "data", postfix = "64")
@Optional(reason = "NV's 3.2 implementation does not expose this (last driver checked: 19?.??)")
void glGetInteger64i_v2(@GLenum int value, @GLuint int index, @OutParameter @GLint64 LongBuffer data);
@StripPostfix("values")

View file

@ -46,12 +46,16 @@ public interface GL40 {
// ----------------------[ ARB_draw_buffers_blend ]----------------------
// ----------------------------------------------------------------------
@Optional(reason = "AMD's 4.0 implementation does not expose this (last driver checked: 10.3)")
void glBlendEquationi(@GLuint int buf, @GLenum int mode);
@Optional(reason = "AMD's 4.0 implementation does not expose this (last driver checked: 10.3)")
void glBlendEquationSeparatei(@GLuint int buf, @GLenum int modeRGB, @GLenum int modeAlpha);
@Optional(reason = "AMD's 4.0 implementation does not expose this (last driver checked: 10.3)")
void glBlendFunci(@GLuint int buf, @GLenum int src, @GLenum int dst);
@Optional(reason = "AMD's 4.0 implementation does not expose this (last driver checked: 10.3)")
void glBlendFuncSeparatei(@GLuint int buf, @GLenum int srcRGB, @GLenum int dstRGB, @GLenum int srcAlpha, @GLenum int dstAlpha);
// -----------------------------------------------------------------
@ -182,6 +186,7 @@ public interface GL40 {
*/
int GL_MIN_SAMPLE_SHADING_VALUE = 0x8C37;
@Optional(reason = "AMD's 4.0 implementation does not expose this (last driver checked: 10.3)")
void glMinSampleShading(@GLclampf float value);
// ---------------------------------------------------------------------

View file

@ -0,0 +1,44 @@
/*
* 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;
/** Experimental extension, may be removed/changed in the future. */
public interface NVX_gpu_memory_info {
/** Accepted by the &lt;pname&gt; parameter of GetIntegerv: */
int GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX = 0x9047;
int GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX = 0x9048;
int GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX = 0x9049;
int GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX = 0x904A;
int GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX = 0x904B;
}

View file

@ -78,23 +78,34 @@ public interface NV_half_float {
void glSecondaryColor3hNV(@GLhalf short red, @GLhalf short green, @GLhalf short blue);
@Optional(reason = "AMD does not expose this (last driver checked: 10.3)")
void glVertexWeighthNV(@GLhalf short weight);
@Optional(reason = "AMD does not expose this (last driver checked: 10.3)")
void glVertexAttrib1hNV(@GLuint int index, @GLhalf short x);
@Optional(reason = "AMD does not expose this (last driver checked: 10.3)")
void glVertexAttrib2hNV(@GLuint int index, @GLhalf short x, @GLhalf short y);
@Optional(reason = "AMD does not expose this (last driver checked: 10.3)")
void glVertexAttrib3hNV(@GLuint int index, @GLhalf short x, @GLhalf short y, @GLhalf short z);
@Optional(reason = "AMD does not expose this (last driver checked: 10.3)")
void glVertexAttrib4hNV(@GLuint int index, @GLhalf short x, @GLhalf short y, @GLhalf short z, @GLhalf short w);
@Optional(reason = "AMD does not expose this (last driver checked: 10.3)")
@StripPostfix("attribs")
void glVertexAttribs1hvNV(@GLuint int index, @AutoSize("attribs") @GLsizei int n, @Const @GLhalf ShortBuffer attribs);
@Optional(reason = "AMD does not expose this (last driver checked: 10.3)")
@StripPostfix("attribs")
void glVertexAttribs2hvNV(@GLuint int index, @AutoSize(value = "attribs", expression = " >> 1") @GLsizei int n, @Const @GLhalf ShortBuffer attribs);
@Optional(reason = "AMD does not expose this (last driver checked: 10.3)")
@StripPostfix("attribs")
void glVertexAttribs3hvNV(@GLuint int index, @AutoSize(value = "attribs", expression = " / 3") @GLsizei int n, @Const @GLhalf ShortBuffer attribs);
@Optional(reason = "AMD does not expose this (last driver checked: 10.3)")
@StripPostfix("attribs")
void glVertexAttribs4hvNV(@GLuint int index, @AutoSize(value = "attribs", expression = " >> 2") @GLsizei int n, @Const @GLhalf ShortBuffer attribs);
}

View file

@ -33,6 +33,7 @@ package org.lwjgl.opengl;
import org.lwjgl.util.generator.*;
@ForceInit
public interface NV_primitive_restart {
/**