Added support for OpenCL & CL/GL interop + minor improvements. [WIP]
This commit is contained in:
parent
4318d4d9f8
commit
1aa9ab5104
14
build.xml
14
build.xml
|
@ -34,7 +34,7 @@
|
|||
</target>
|
||||
|
||||
<!-- Cleans up any files created during the execution of this script -->
|
||||
<target name="clean" description="Cleans the diectories controlled by this ant script" depends="clean-generated">
|
||||
<target name="clean" description="Cleans the directories controlled by this ant script" depends="clean-generated">
|
||||
<delete dir="${lwjgl.temp}" quiet="true" failonerror="false" taskname="cleaning temp folder" />
|
||||
<delete dir="${lwjgl.docs}/javadoc" quiet="true" failonerror="false" taskname="cleaning javadoc folder" />
|
||||
<delete dir="${lwjgl.bin}" quiet="true" failonerror="false" taskname="cleaning bin folder" />
|
||||
|
@ -251,8 +251,9 @@
|
|||
<class name="org.lwjgl.openal.AL" />
|
||||
<class name="org.lwjgl.opengl.GLContext" />
|
||||
<class name="org.lwjgl.opengl.Pbuffer" />
|
||||
<class name="org.lwjgl.opengl.AMDDebugOutputCallback" />
|
||||
<class name="org.lwjgl.opengl.ARBDebugOutputCallback" />
|
||||
<class name="org.lwjgl.opengl.CallbackUtil" />
|
||||
<class name="org.lwjgl.opencl.CL" />
|
||||
<class name="org.lwjgl.opencl.CallbackUtil" />
|
||||
</javah>
|
||||
</target>
|
||||
|
||||
|
@ -340,18 +341,19 @@
|
|||
|
||||
<!-- Compiles the Java source code -->
|
||||
<target name="compile" description="Compiles the java source code" depends="-initialize">
|
||||
<javac debug="yes" destdir="${lwjgl.bin}" source="1.4" target="1.4" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar" taskname="core">
|
||||
<javac debug="yes" destdir="${lwjgl.bin}" source="1.5" target="1.5" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar" taskname="core">
|
||||
<src path="${lwjgl.src}/java/"/>
|
||||
<src path="${lwjgl.src}/generated/"/>
|
||||
<include name="org/lwjgl/*.java"/>
|
||||
<include name="org/lwjgl/input/**"/>
|
||||
<include name="org/lwjgl/opengl/**"/>
|
||||
<include name="org/lwjgl/openal/**"/>
|
||||
<include name="org/lwjgl/opencl/**"/>
|
||||
<include name="org/lwjgl/util/**"/>
|
||||
<exclude name="org/lwjgl/util/generator/**"/>
|
||||
</javac>
|
||||
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/test/**" source="1.4" target="1.4" taskname="test" />
|
||||
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/examples/**" source="1.4" target="1.4" taskname="examples" />
|
||||
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/test/**" source="1.5" target="1.5" taskname="test" />
|
||||
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" includes="org/lwjgl/examples/**" source="1.5" target="1.5" taskname="examples" />
|
||||
</target>
|
||||
|
||||
<target name="compile_native" depends="headers, touch-version, version-mismatch" description="Compiles the native files">
|
||||
|
|
|
@ -15,6 +15,9 @@
|
|||
<property name="lwjgl.version" value="2.6" />
|
||||
|
||||
<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"/>
|
||||
<property name="opencl-template-pattern-extensions" value="org/lwjgl/opencl/KHR*.java,org/lwjgl/opencl/EXT*.java,org/lwjgl/opencl/APPLE*.java,org/lwjgl/opencl/AMD*.java,org/lwjgl/opencl/NV*.java"/>
|
||||
<property name="opencl-template-pattern" value="org/lwjgl/opencl/CL*.java,${opencl-template-pattern-extensions}"/>
|
||||
|
||||
<!-- ================================================================== -->
|
||||
<!-- Filesets used for targets -->
|
||||
<!-- ================================================================== -->
|
||||
|
@ -43,13 +46,11 @@
|
|||
<!-- More files to include in the lwjgl_test.jar file -->
|
||||
<fileset id="lwjgl_test_extra.fileset" dir="${lwjgl.src}/java">
|
||||
<exclude name="**.*" />
|
||||
<include name="org/lwjgl/test/opengl/shaders/shaderFP.fp" />
|
||||
<include name="org/lwjgl/test/opengl/shaders/shaderFP.vp" />
|
||||
<include name="org/lwjgl/test/opengl/shaders/shaderFSH.fsh" />
|
||||
<include name="org/lwjgl/test/opengl/shaders/shaderFSH.vsh" />
|
||||
<include name="org/lwjgl/test/opengl/shaders/shaderVP.vp" />
|
||||
<include name="org/lwjgl/test/opengl/shaders/shaderVSH.vsh" />
|
||||
<include name="org/lwjgl/test/opengl/shaders/shaderUNI.vsh" />
|
||||
<include name="org/lwjgl/test/opengl/shaders/*.fp" />
|
||||
<include name="org/lwjgl/test/opengl/shaders/*.vp" />
|
||||
<include name="org/lwjgl/test/opengl/shaders/*.vsh" />
|
||||
<include name="org/lwjgl/test/opengl/shaders/*.fsh" />
|
||||
<include name="org/lwjgl/test/opencl/gl/*.cl />
|
||||
</fileset>
|
||||
|
||||
<!-- Files to include in the lwjgl_util.jar file -->
|
||||
|
|
|
@ -11,21 +11,38 @@
|
|||
<!-- 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">
|
||||
<include name="org/lwjgl/util/generator/openal/**.java"/>
|
||||
<include name="org/lwjgl/util/generator/opengl/**.java"/>
|
||||
<include name="org/lwjgl/util/generator/opencl/**.java"/>
|
||||
<compilerarg value="-Xlint:all"/>
|
||||
</javac>
|
||||
<!-- Compile helper classes used by the templates -->
|
||||
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" source="1.4" target="1.4" taskname="generator">
|
||||
<javac debug="yes" srcdir="${lwjgl.src}/java/" destdir="${lwjgl.bin}" source="1.5" target="1.5" taskname="generator">
|
||||
<include name="org/lwjgl/PointerWrapper.java"/>
|
||||
<include name="org/lwjgl/PointerBuffer.java"/>
|
||||
<!-- OpenGL -->
|
||||
<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"/>
|
||||
<!-- OpenCL -->
|
||||
<include name="org/lwjgl/opencl/CLPlatform.java"/>
|
||||
<include name="org/lwjgl/opencl/CLDevice.java"/>
|
||||
<include name="org/lwjgl/opencl/CLContext.java"/>
|
||||
<include name="org/lwjgl/opencl/CLContextCallback.java"/>
|
||||
<include name="org/lwjgl/opencl/CLCommandQueue.java"/>
|
||||
<include name="org/lwjgl/opencl/CLMem.java"/>
|
||||
<include name="org/lwjgl/opencl/CLMemObjectDestructorCallback.java"/>
|
||||
<include name="org/lwjgl/opencl/CLBuildProgramCallback.java"/>
|
||||
<include name="org/lwjgl/opencl/CLNativeKernel.java"/>
|
||||
<include name="org/lwjgl/opencl/CLEventCallback.java"/>
|
||||
<include name="org/lwjgl/opencl/CLFunctionAddress.java"/>
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<!-- Proxy target to generate it all -->
|
||||
<target name="generate-all" depends="generate-openal, generate-opengl, generate-opengl-capabilities, generate-opengl-references" description="Generates java and native source"/>
|
||||
<target name="generate-all" depends="generate-openal, generate-opengl, generate-opengl-capabilities, generate-opengl-references, generate-opencl, generate-opencl-capabilities" description="Generates java and native source"/>
|
||||
|
||||
<target name="generate-debug" depends="generate-openal-debug, generate-opengl-debug, generate-opengl-capabilities-debug, generate-opengl-references" description="Generates java and native source"/>
|
||||
<target name="generate-debug" depends="generate-openal-debug, generate-opengl-debug, generate-opengl-capabilities-debug, generate-opengl-references, generate-opencl-debug, generate-opencl-capabilities-debug" description="Generates java and native source with debug functionality"/>
|
||||
|
||||
<!-- Generate OpenAL -->
|
||||
<target name="generate-openal" depends="generators" description="Generates java and native source for AL">
|
||||
|
@ -39,7 +56,7 @@
|
|||
<arg path="${lwjgl.src}/generated"/>
|
||||
<arg value="-d"/>
|
||||
<arg path="${lwjgl.src.native}/generated"/>
|
||||
<arg value="-Atypemap=org.lwjgl.util.generator.ALTypeMap"/>
|
||||
<arg value="-Atypemap=org.lwjgl.util.generator.openal.ALTypeMap"/>
|
||||
<fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java, org/lwjgl/openal/EFX10.java"/>
|
||||
</apply>
|
||||
</target>
|
||||
|
@ -56,7 +73,7 @@
|
|||
<arg path="${lwjgl.src}/generated"/>
|
||||
<arg value="-d"/>
|
||||
<arg path="${lwjgl.src.native}/generated"/>
|
||||
<arg value="-Atypemap=org.lwjgl.util.generator.ALTypeMap"/>
|
||||
<arg value="-Atypemap=org.lwjgl.util.generator.openal.ALTypeMap"/>
|
||||
<arg value="-Ageneratechecks"/>
|
||||
<fileset dir="${lwjgl.src.templates}" includes="org/lwjgl/openal/AL10.java, org/lwjgl/openal/AL11.java, org/lwjgl/openal/EFX10.java"/>
|
||||
</apply>
|
||||
|
@ -75,7 +92,7 @@
|
|||
<arg value="-d"/>
|
||||
<arg path="${lwjgl.src.native}/generated"/>
|
||||
<arg value="-Acontextspecific"/>
|
||||
<arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/>
|
||||
<arg value="-Atypemap=org.lwjgl.util.generator.opengl.GLTypeMap"/>
|
||||
<fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/>
|
||||
</apply>
|
||||
</target>
|
||||
|
@ -94,17 +111,17 @@
|
|||
<arg path="${lwjgl.src.native}/generated"/>
|
||||
<arg value="-Ageneratechecks"/>
|
||||
<arg value="-Acontextspecific"/>
|
||||
<arg value="-Atypemap=org.lwjgl.util.generator.GLTypeMap"/>
|
||||
<arg value="-Atypemap=org.lwjgl.util.generator.opengl.GLTypeMap"/>
|
||||
<fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/>
|
||||
</apply>
|
||||
</target>
|
||||
|
||||
<!-- Generate references -->
|
||||
<!-- Generate OpenGL references -->
|
||||
<target name="generate-opengl-references" depends="generators" description="Generates java and native source for GL">
|
||||
<apply executable="apt" parallel="true">
|
||||
<arg value="-nocompile"/>
|
||||
<arg value="-factory"/>
|
||||
<arg value="org.lwjgl.util.generator.ReferencesGeneratorProcessorFactory"/>
|
||||
<arg value="org.lwjgl.util.generator.opengl.GLReferencesGeneratorProcessorFactory"/>
|
||||
<arg value="-cp"/>
|
||||
<arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
|
||||
<arg value="-s"/>
|
||||
|
@ -113,12 +130,12 @@
|
|||
</apply>
|
||||
</target>
|
||||
|
||||
<!-- Generate context capabilities -->
|
||||
<!-- Generate OpenGL context capabilities -->
|
||||
<target name="generate-opengl-capabilities" depends="generators" description="Generates java and native source for GL">
|
||||
<apply executable="apt" parallel="true">
|
||||
<arg value="-nocompile"/>
|
||||
<arg value="-factory"/>
|
||||
<arg value="org.lwjgl.util.generator.ContextGeneratorProcessorFactory"/>
|
||||
<arg value="org.lwjgl.util.generator.opengl.GLGeneratorProcessorFactory"/>
|
||||
<arg value="-cp"/>
|
||||
<arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
|
||||
<arg value="-s"/>
|
||||
|
@ -128,12 +145,12 @@
|
|||
</apply>
|
||||
</target>
|
||||
|
||||
<!-- Generate context capabilities [DEBUG] -->
|
||||
<!-- Generate OpenGL context capabilities [DEBUG] -->
|
||||
<target name="generate-opengl-capabilities-debug" depends="generators" description="Generates java and native source for GL">
|
||||
<apply executable="apt" parallel="true">
|
||||
<arg value="-nocompile"/>
|
||||
<arg value="-factory"/>
|
||||
<arg value="org.lwjgl.util.generator.ContextGeneratorProcessorFactory"/>
|
||||
<arg value="org.lwjgl.util.generator.opengl.GLGeneratorProcessorFactory"/>
|
||||
<arg value="-cp"/>
|
||||
<arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
|
||||
<arg value="-s"/>
|
||||
|
@ -143,4 +160,72 @@
|
|||
<fileset dir="${lwjgl.src.templates}" includes="${opengl-template-pattern}"/>
|
||||
</apply>
|
||||
</target>
|
||||
|
||||
<!-- Generate OpenCL -->
|
||||
<target name="generate-opencl" depends="generators" description="Generates java and native source for CL">
|
||||
<apply executable="apt" parallel="true">
|
||||
<arg value="-nocompile"/>
|
||||
<arg value="-factory"/>
|
||||
<arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/>
|
||||
<arg value="-cp"/>
|
||||
<arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
|
||||
<arg value="-s"/>
|
||||
<arg path="${lwjgl.src}/generated"/>
|
||||
<arg value="-d"/>
|
||||
<arg path="${lwjgl.src.native}/generated"/>
|
||||
<arg value="-Acontextspecific"/>
|
||||
<arg value="-Atypemap=org.lwjgl.util.generator.opencl.CLTypeMap"/>
|
||||
<fileset dir="${lwjgl.src.templates}" includes="${opencl-template-pattern}"/>
|
||||
</apply>
|
||||
</target>
|
||||
|
||||
<!-- Generate OpenCL [DEBUG] -->
|
||||
<target name="generate-opencl-debug" depends="generators" description="Generates java and native source for CL">
|
||||
<apply executable="apt" parallel="true">
|
||||
<arg value="-nocompile"/>
|
||||
<arg value="-factory"/>
|
||||
<arg value="org.lwjgl.util.generator.GeneratorProcessorFactory"/>
|
||||
<arg value="-cp"/>
|
||||
<arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
|
||||
<arg value="-s"/>
|
||||
<arg path="${lwjgl.src}/generated"/>
|
||||
<arg value="-d"/>
|
||||
<arg path="${lwjgl.src.native}/generated"/>
|
||||
<arg value="-Ageneratechecks"/>
|
||||
<arg value="-Acontextspecific"/>
|
||||
<arg value="-Atypemap=org.lwjgl.util.generator.opencl.CLTypeMap"/>
|
||||
<fileset dir="${lwjgl.src.templates}" includes="${opencl-template-pattern}"/>
|
||||
</apply>
|
||||
</target>
|
||||
|
||||
<!-- Generate OpenCL capabilities -->
|
||||
<target name="generate-opencl-capabilities" depends="generators" description="Generates capabilities for CL">
|
||||
<apply executable="apt" parallel="true">
|
||||
<arg value="-nocompile"/>
|
||||
<arg value="-factory"/>
|
||||
<arg value="org.lwjgl.util.generator.opencl.CLGeneratorProcessorFactory"/>
|
||||
<arg value="-cp"/>
|
||||
<arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
|
||||
<arg value="-s"/>
|
||||
<arg path="${lwjgl.src}/generated"/>
|
||||
<arg value="-Acontextspecific"/>
|
||||
<fileset dir="${lwjgl.src.templates}" includes="${opencl-template-pattern}"/>
|
||||
</apply>
|
||||
</target>
|
||||
|
||||
<!-- Generate OpenCL capabilities [DEBUG] -->
|
||||
<target name="generate-opencl-capabilities-debug" depends="generators" description="Generates capabilities for CL">
|
||||
<apply executable="apt" parallel="true">
|
||||
<arg value="-nocompile"/>
|
||||
<arg value="-factory"/>
|
||||
<arg value="org.lwjgl.util.generator.opencl.CLGeneratorProcessorFactory"/>
|
||||
<arg value="-cp"/>
|
||||
<arg path="${lwjgl.src}/java:${lwjgl.src.templates}:${lwjgl.bin}:${java.class.path}"/>
|
||||
<arg value="-s"/>
|
||||
<arg path="${lwjgl.src}/generated"/>
|
||||
<arg value="-Ageneratechecks"/>
|
||||
<arg value="-Acontextspecific"/>
|
||||
<fileset dir="${lwjgl.src.templates}" includes="${opencl-template-pattern}"/>
|
||||
</apply>
|
||||
</target>
|
||||
</project>
|
||||
|
|
|
@ -27,10 +27,10 @@
|
|||
<condition property="cflags_pthread" value="-pthreads" else="-pthread">
|
||||
<os name="SunOS" />
|
||||
</condition>
|
||||
<condition property="version_script_flags32" value="" else="-Wl,--version-script=${native}/linux/lwjgl.map">
|
||||
<condition property="version_script_flags32" value="" else="-Wl,--version-script='${native}/linux/lwjgl.map'">
|
||||
<os name="SunOS" />
|
||||
</condition>
|
||||
<condition property="version_script_flags64" value="-m64" else="-Wl,--version-script=${native}/linux/lwjgl.map">
|
||||
<condition property="version_script_flags64" value="-m64" else="-Wl,--version-script='${native}/linux/lwjgl.map'">
|
||||
<and>
|
||||
<os name="SunOS" />
|
||||
</and>
|
||||
|
|
|
@ -87,13 +87,27 @@ public class BufferChecks {
|
|||
}
|
||||
}
|
||||
|
||||
/** Helper methods to ensure an IntBuffer is null-terminated */
|
||||
/** Helper method to ensure an IntBuffer is null-terminated */
|
||||
public static void checkNullTerminated(IntBuffer buf) {
|
||||
if ( buf.get(buf.limit() - 1) != 0 ) {
|
||||
throw new IllegalArgumentException("Missing null termination");
|
||||
}
|
||||
}
|
||||
|
||||
/** Helper method to ensure a LongBuffer is null-terminated */
|
||||
public static void checkNullTerminated(LongBuffer buf) {
|
||||
if ( buf.get(buf.limit() - 1) != 0 ) {
|
||||
throw new IllegalArgumentException("Missing null termination");
|
||||
}
|
||||
}
|
||||
|
||||
/** Helper method to ensure a PointerBuffer is null-terminated */
|
||||
public static void checkNullTerminated(PointerBuffer buf) {
|
||||
if ( buf.get(buf.limit() - 1) != 0 ) {
|
||||
throw new IllegalArgumentException("Missing null termination");
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkNotNull(Object o) {
|
||||
if ( LWJGLUtil.CHECKS && o == null)
|
||||
throw new IllegalArgumentException("Null argument");
|
||||
|
@ -138,6 +152,15 @@ public class BufferChecks {
|
|||
}
|
||||
}
|
||||
|
||||
public static void checkDirect(PointerBuffer buf) {
|
||||
// NO-OP, PointerBuffer is always direct.
|
||||
}
|
||||
|
||||
public static void checkArray(Object[] array) {
|
||||
if ( LWJGLUtil.CHECKS && array == null )
|
||||
throw new IllegalArgumentException("Invalid array");
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a separate call to help inline checkBufferSize.
|
||||
*/
|
||||
|
@ -145,6 +168,18 @@ public class BufferChecks {
|
|||
throw new IllegalArgumentException("Number of remaining buffer elements is " + buf.remaining() + ", must be at least " + size);
|
||||
}
|
||||
|
||||
private static void throwBufferSizeException(PointerBuffer buf, int size) {
|
||||
throw new IllegalArgumentException("Number of remaining pointer buffer elements is " + buf.remaining() + ", must be at least " + size);
|
||||
}
|
||||
|
||||
private static void throwArraySizeException(Object[] array, int size) {
|
||||
throw new IllegalArgumentException("Number of array elements is " + array.length + ", must be at least " + size);
|
||||
}
|
||||
|
||||
private static void throwArraySizeException(long[] array, int size) {
|
||||
throw new IllegalArgumentException("Number of array elements is " + array.length + ", must be at least " + size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to ensure a buffer is big enough to receive data from a
|
||||
* glGet* operation.
|
||||
|
@ -202,4 +237,21 @@ public class BufferChecks {
|
|||
checkDirect(buf);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkBuffer(PointerBuffer buf, int size) {
|
||||
if ( LWJGLUtil.CHECKS && buf.remaining() < size ) {
|
||||
throwBufferSizeException(buf, size);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkArray(Object[] array, int size) {
|
||||
if ( LWJGLUtil.CHECKS && array.length < size )
|
||||
throwArraySizeException(array, size);
|
||||
}
|
||||
|
||||
public static void checkArray(long[] array, int size) {
|
||||
if ( LWJGLUtil.CHECKS && array.length < size )
|
||||
throwArraySizeException(array, size);
|
||||
}
|
||||
|
||||
}
|
|
@ -120,6 +120,16 @@ public final class BufferUtils {
|
|||
return createByteBuffer(size << 3).asDoubleBuffer();
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a PointerBuffer with the specified number
|
||||
* of elements.
|
||||
* @param size The size, in memory addresses
|
||||
* @return a PointerBuffer
|
||||
*/
|
||||
public static PointerBuffer createPointerBuffer(int size) {
|
||||
return PointerBuffer.allocateDirect(size);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return n, where buffer_element_size=2^n.
|
||||
*/
|
||||
|
|
|
@ -269,9 +269,21 @@ public class LWJGLUtil {
|
|||
|
||||
public static final boolean CHECKS = !getPrivilegedBoolean("org.lwjgl.util.NoChecks");
|
||||
|
||||
private static final int PLATFORM;
|
||||
|
||||
static {
|
||||
LWJGLIcon16x16.flip();
|
||||
LWJGLIcon32x32.flip();
|
||||
|
||||
final String osName = getPrivilegedProperty("os.name");
|
||||
if ( osName.startsWith("Windows") )
|
||||
PLATFORM = PLATFORM_WINDOWS;
|
||||
else if ( osName.startsWith("Linux") || osName.startsWith("FreeBSD") || osName.startsWith("SunOS") )
|
||||
PLATFORM = PLATFORM_LINUX;
|
||||
else if ( osName.startsWith("Mac OS X") )
|
||||
PLATFORM = PLATFORM_MACOSX;
|
||||
else
|
||||
throw new LinkageError("Unknown platform: " + osName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -281,17 +293,7 @@ public class LWJGLUtil {
|
|||
* @return the current platform type
|
||||
*/
|
||||
public static int getPlatform() {
|
||||
String osName = getPrivilegedProperty("os.name");
|
||||
|
||||
if (osName.startsWith("Windows")) {
|
||||
return PLATFORM_WINDOWS;
|
||||
} else if (osName.startsWith("Linux") || osName.startsWith("FreeBSD") || osName.startsWith("SunOS")) {
|
||||
return PLATFORM_LINUX;
|
||||
} else if (osName.startsWith("Mac OS X")) {
|
||||
return PLATFORM_MACOSX;
|
||||
} else {
|
||||
throw new LinkageError("Unknown platform: " + osName);
|
||||
}
|
||||
return PLATFORM;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,924 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.nio.*;
|
||||
|
||||
/**
|
||||
* This class is a container for architecture independent pointer data.
|
||||
* The interface mirrors the NIO LongBuffer API for convenience.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public class PointerBuffer implements Comparable {
|
||||
|
||||
private static final boolean is64Bit;
|
||||
|
||||
static {
|
||||
// Use reflection so that we can compile this class for the Generator.
|
||||
boolean is64 = false;
|
||||
try {
|
||||
Method m = Class.forName("org.lwjgl.Sys").getDeclaredMethod("is64Bit", (Class[])null);
|
||||
is64 = ((Boolean)m.invoke(null, (Object[])null)).booleanValue();
|
||||
} catch (Throwable t) {
|
||||
// ignore
|
||||
} finally {
|
||||
is64Bit = is64;
|
||||
}
|
||||
}
|
||||
|
||||
protected final ByteBuffer pointers;
|
||||
|
||||
protected final Buffer view;
|
||||
protected final IntBuffer view32;
|
||||
protected final LongBuffer view64;
|
||||
|
||||
public PointerBuffer(final int capacity) {
|
||||
this(BufferUtils.createByteBuffer(capacity * getPointerSize()));
|
||||
}
|
||||
|
||||
public PointerBuffer(final ByteBuffer source) {
|
||||
if ( !source.isDirect() )
|
||||
throw new IllegalArgumentException("ByteBuffer is not direct");
|
||||
|
||||
pointers = source.slice().order(source.order());
|
||||
|
||||
if ( is64Bit ) {
|
||||
view32 = null;
|
||||
view = view64 = pointers.asLongBuffer();
|
||||
} else {
|
||||
view = view32 = pointers.asIntBuffer();
|
||||
view64 = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ByteBuffer that backs this PointerBuffer.
|
||||
*
|
||||
* @return the pointer ByteBuffer
|
||||
*/
|
||||
public ByteBuffer getBuffer() {
|
||||
return pointers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the pointer size in bytes, based on the underlying architecture.
|
||||
*
|
||||
* @return The pointer size in bytes
|
||||
*/
|
||||
public static int getPointerSize() {
|
||||
return is64Bit ? 8 : 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this buffer's capacity. </p>
|
||||
*
|
||||
* @return The capacity of this buffer
|
||||
*/
|
||||
public final int capacity() {
|
||||
return view.capacity();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this buffer's position. </p>
|
||||
*
|
||||
* @return The position of this buffer
|
||||
*/
|
||||
public final int position() {
|
||||
return view.position();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this buffer's position, in bytes. </p>
|
||||
*
|
||||
* @return The position of this buffer in bytes.
|
||||
*/
|
||||
public final int positionByte() {
|
||||
return position() * getPointerSize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this buffer's position. If the mark is defined and larger than the
|
||||
* new position then it is discarded. </p>
|
||||
*
|
||||
* @param newPosition The new position value; must be non-negative
|
||||
* and no larger than the current limit
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws IllegalArgumentException If the preconditions on <tt>newPosition</tt> do not hold
|
||||
*/
|
||||
public final PointerBuffer position(int newPosition) {
|
||||
view.position(newPosition);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns this buffer's limit. </p>
|
||||
*
|
||||
* @return The limit of this buffer
|
||||
*/
|
||||
public final int limit() {
|
||||
return view.limit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this buffer's limit. If the position is larger than the new limit
|
||||
* then it is set to the new limit. If the mark is defined and larger than
|
||||
* the new limit then it is discarded. </p>
|
||||
*
|
||||
* @param newLimit The new limit value; must be non-negative
|
||||
* and no larger than this buffer's capacity
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws IllegalArgumentException If the preconditions on <tt>newLimit</tt> do not hold
|
||||
*/
|
||||
public final PointerBuffer limit(int newLimit) {
|
||||
view.limit(newLimit);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets this buffer's mark at its position. </p>
|
||||
*
|
||||
* @return This buffer
|
||||
*/
|
||||
public final PointerBuffer mark() {
|
||||
view.mark();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets this buffer's position to the previously-marked position.
|
||||
* <p/>
|
||||
* <p> Invoking this method neither changes nor discards the mark's
|
||||
* value. </p>
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws java.nio.InvalidMarkException If the mark has not been set
|
||||
*/
|
||||
public final PointerBuffer reset() {
|
||||
view.reset();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears this buffer. The position is set to zero, the limit is set to
|
||||
* the capacity, and the mark is discarded.
|
||||
* <p/>
|
||||
* <p> Invoke this method before using a sequence of channel-read or
|
||||
* <i>put</i> operations to fill this buffer. For example:
|
||||
* <p/>
|
||||
* <blockquote><pre>
|
||||
* buf.clear(); // Prepare buffer for reading
|
||||
* in.read(buf); // Read data</pre></blockquote>
|
||||
* <p/>
|
||||
* <p> This method does not actually erase the data in the buffer, but it
|
||||
* is named as if it did because it will most often be used in situations
|
||||
* in which that might as well be the case. </p>
|
||||
*
|
||||
* @return This buffer
|
||||
*/
|
||||
public final PointerBuffer clear() {
|
||||
view.clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flips this buffer. The limit is set to the current position and then
|
||||
* the position is set to zero. If the mark is defined then it is
|
||||
* discarded.
|
||||
* <p/>
|
||||
* <p> After a sequence of channel-read or <i>put</i> operations, invoke
|
||||
* this method to prepare for a sequence of channel-write or relative
|
||||
* <i>get</i> operations. For example:
|
||||
* <p/>
|
||||
* <blockquote><pre>
|
||||
* buf.put(magic); // Prepend header
|
||||
* in.read(buf); // Read data into rest of buffer
|
||||
* buf.flip(); // Flip buffer
|
||||
* out.write(buf); // Write header + data to channel</pre></blockquote>
|
||||
* <p/>
|
||||
* <p> This method is often used in conjunction with the {@link
|
||||
* java.nio.ByteBuffer#compact compact} method when transferring data from
|
||||
* one place to another. </p>
|
||||
*
|
||||
* @return This buffer
|
||||
*/
|
||||
public final PointerBuffer flip() {
|
||||
view.flip();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rewinds this buffer. The position is set to zero and the mark is
|
||||
* discarded.
|
||||
* <p/>
|
||||
* <p> Invoke this method before a sequence of channel-write or <i>get</i>
|
||||
* operations, assuming that the limit has already been set
|
||||
* appropriately. For example:
|
||||
* <p/>
|
||||
* <blockquote><pre>
|
||||
* out.write(buf); // Write remaining data
|
||||
* buf.rewind(); // Rewind buffer
|
||||
* buf.get(array); // Copy data into array</pre></blockquote>
|
||||
*
|
||||
* @return This buffer
|
||||
*/
|
||||
public final PointerBuffer rewind() {
|
||||
view.rewind();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of elements between the current position and the
|
||||
* limit. </p>
|
||||
*
|
||||
* @return The number of elements remaining in this buffer
|
||||
*/
|
||||
public final int remaining() {
|
||||
return view.remaining();
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether there are any elements between the current position and
|
||||
* the limit. </p>
|
||||
*
|
||||
* @return <tt>true</tt> if, and only if, there is at least one element
|
||||
* remaining in this buffer
|
||||
*/
|
||||
public final boolean hasRemaining() {
|
||||
return view.hasRemaining();
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates a new pointer buffer.
|
||||
* <p/>
|
||||
* <p> The new buffer's position will be zero, its limit will be its
|
||||
* capacity, and its mark will be undefined. </p>
|
||||
*
|
||||
* @param capacity The new buffer's capacity, in pointers
|
||||
*
|
||||
* @return The new pointer buffer
|
||||
*
|
||||
* @throws IllegalArgumentException If the <tt>capacity</tt> is a negative integer
|
||||
*/
|
||||
public static PointerBuffer allocateDirect(int capacity) {
|
||||
return new PointerBuffer(capacity);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is used in slice and duplicate instead of normal object construction,
|
||||
* so that subclasses can return themselves.
|
||||
*
|
||||
* @param source
|
||||
*
|
||||
* @return A new PointerBuffer instance
|
||||
*/
|
||||
protected PointerBuffer newInstance(final ByteBuffer source) {
|
||||
return new PointerBuffer(source);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new pointer buffer whose content is a shared subsequence of
|
||||
* this buffer's content.
|
||||
* <p/>
|
||||
* <p> The content of the new buffer will start at this buffer's current
|
||||
* position. Changes to this buffer's content will be visible in the new
|
||||
* buffer, and vice versa; the two buffers' position, limit, and mark
|
||||
* values will be independent.
|
||||
* <p/>
|
||||
* <p> The new buffer's position will be zero, its capacity and its limit
|
||||
* will be the number of longs remaining in this buffer, and its mark
|
||||
* will be undefined. The new buffer will be direct if, and only if, this
|
||||
* buffer is direct, and it will be read-only if, and only if, this buffer
|
||||
* is read-only. </p>
|
||||
*
|
||||
* @return The new pointer buffer
|
||||
*/
|
||||
public PointerBuffer slice() {
|
||||
final int pointerSize = getPointerSize();
|
||||
|
||||
pointers.position(view.position() * pointerSize);
|
||||
pointers.limit(view.limit() * pointerSize);
|
||||
|
||||
try {
|
||||
// We're slicing in the constructor.
|
||||
return newInstance(pointers);
|
||||
} finally {
|
||||
pointers.clear();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new pointer buffer that shares this buffer's content.
|
||||
* <p/>
|
||||
* <p> The content of the new buffer will be that of this buffer. Changes
|
||||
* to this buffer's content will be visible in the new buffer, and vice
|
||||
* versa; the two buffers' position, limit, and mark values will be
|
||||
* independent.
|
||||
* <p/>
|
||||
* <p> The new buffer's capacity, limit and position will be
|
||||
* identical to those of this buffer. The new buffer will be direct if,
|
||||
* and only if, this buffer is direct, and it will be read-only if, and
|
||||
* only if, this buffer is read-only. </p>
|
||||
*
|
||||
* @return The new pointer buffer
|
||||
*/
|
||||
public PointerBuffer duplicate() {
|
||||
final PointerBuffer buffer = newInstance(pointers);
|
||||
|
||||
buffer.position(view.position());
|
||||
buffer.limit(view.limit());
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new, read-only pointer buffer that shares this buffer's
|
||||
* content.
|
||||
* <p/>
|
||||
* <p> The content of the new buffer will be that of this buffer. Changes
|
||||
* to this buffer's content will be visible in the new buffer; the new
|
||||
* buffer itself, however, will be read-only and will not allow the shared
|
||||
* content to be modified. The two buffers' position, limit, and mark
|
||||
* values will be independent.
|
||||
* <p/>
|
||||
* <p> The new buffer's capacity, limit and position will be
|
||||
* identical to those of this buffer.
|
||||
* <p/>
|
||||
* <p> If this buffer is itself read-only then this method behaves in
|
||||
* exactly the same way as the {@link #duplicate duplicate} method. </p>
|
||||
*
|
||||
* @return The new, read-only pointer buffer
|
||||
*/
|
||||
public PointerBuffer asReadOnlyBuffer() {
|
||||
final PointerBuffer buffer = new PointerBufferR(pointers);
|
||||
|
||||
buffer.position(view.position());
|
||||
buffer.limit(view.limit());
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
public boolean isReadOnly() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Relative <i>get</i> method. Reads the long at this buffer's
|
||||
* current position, and then increments the position. </p>
|
||||
*
|
||||
* @return The long at the buffer's current position
|
||||
*
|
||||
* @throws BufferUnderflowException If the buffer's current position is not smaller than its limit
|
||||
*/
|
||||
public long get() {
|
||||
if ( is64Bit )
|
||||
return view64.get();
|
||||
else
|
||||
return view32.get() & 0x00000000FFFFFFFFL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Relative <i>put</i> method <i>(optional operation)</i>.
|
||||
* <p/>
|
||||
* <p> Writes the given long into this buffer at the current
|
||||
* position, and then increments the position. </p>
|
||||
*
|
||||
* @param l The long to be written
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws BufferOverflowException If this buffer's current position is not smaller than its limit
|
||||
* @throws ReadOnlyBufferException If this buffer is read-only
|
||||
*/
|
||||
public PointerBuffer put(long l) {
|
||||
if ( is64Bit )
|
||||
view64.put(l);
|
||||
else
|
||||
view32.put((int)l);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience put that accepts PointerWrapper objects.
|
||||
*
|
||||
* @see #put(long)
|
||||
*/
|
||||
public PointerBuffer put(final PointerWrapper pointer) {
|
||||
return put(pointer.getPointer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience put on a target ByteBuffer.
|
||||
*
|
||||
* @param target the target ByteBuffer
|
||||
* @param l the long value to be written
|
||||
*/
|
||||
public static void put(final ByteBuffer target, long l) {
|
||||
if ( is64Bit )
|
||||
target.putLong(l);
|
||||
else
|
||||
target.putInt((int)l);
|
||||
}
|
||||
|
||||
/**
|
||||
* Absolute <i>get</i> method. Reads the long at the given
|
||||
* index. </p>
|
||||
*
|
||||
* @param index The index from which the long will be read
|
||||
*
|
||||
* @return The long at the given index
|
||||
*
|
||||
* @throws IndexOutOfBoundsException If <tt>index</tt> is negative
|
||||
* or not smaller than the buffer's limit
|
||||
*/
|
||||
public long get(int index) {
|
||||
if ( is64Bit )
|
||||
return view64.get(index);
|
||||
else
|
||||
return view32.get(index) & 0x00000000FFFFFFFFL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Absolute <i>put</i> method <i>(optional operation)</i>.
|
||||
* <p/>
|
||||
* <p> Writes the given long into this buffer at the given
|
||||
* index. </p>
|
||||
*
|
||||
* @param index The index at which the long will be written
|
||||
* @param l The long value to be written
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws IndexOutOfBoundsException If <tt>index</tt> is negative
|
||||
* or not smaller than the buffer's limit
|
||||
* @throws ReadOnlyBufferException If this buffer is read-only
|
||||
*/
|
||||
public PointerBuffer put(int index, long l) {
|
||||
if ( is64Bit )
|
||||
view64.put(index, l);
|
||||
else
|
||||
view32.put(index, (int)l);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience put that accepts PointerWrapper objects.
|
||||
*
|
||||
* @see #put(int, long)
|
||||
*/
|
||||
public PointerBuffer put(int index, PointerWrapper pointer) {
|
||||
return put(index, pointer.getPointer());
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience put on a target ByteBuffer.
|
||||
*
|
||||
* @param target the target ByteBuffer
|
||||
* @param index the index at which the long will be written
|
||||
* @param l the long value to be written
|
||||
*/
|
||||
public static void put(final ByteBuffer target, int index, long l) {
|
||||
if ( is64Bit )
|
||||
target.putLong(index * 8, l);
|
||||
else
|
||||
target.putInt(index * 4, (int)l);
|
||||
}
|
||||
|
||||
// -- Bulk get operations --
|
||||
|
||||
/**
|
||||
* Relative bulk <i>get</i> method.
|
||||
* <p/>
|
||||
* <p> This method transfers longs from this buffer into the given
|
||||
* destination array. If there are fewer longs remaining in the
|
||||
* buffer than are required to satisfy the request, that is, if
|
||||
* <tt>length</tt> <tt>></tt> <tt>remaining()</tt>, then no
|
||||
* longs are transferred and a {@link BufferUnderflowException} is
|
||||
* thrown.
|
||||
* <p/>
|
||||
* <p> Otherwise, this method copies <tt>length</tt> longs from this
|
||||
* buffer into the given array, starting at the current position of this
|
||||
* buffer and at the given offset in the array. The position of this
|
||||
* buffer is then incremented by <tt>length</tt>.
|
||||
* <p/>
|
||||
* <p> In other words, an invocation of this method of the form
|
||||
* <tt>src.get(dst, off, len)</tt> has exactly the same effect as
|
||||
* the loop
|
||||
* <p/>
|
||||
* <pre>
|
||||
* for (int i = off; i < off + len; i++)
|
||||
* dst[i] = src.get(); </pre>
|
||||
* <p/>
|
||||
* except that it first checks that there are sufficient longs in
|
||||
* this buffer and it is potentially much more efficient. </p>
|
||||
*
|
||||
* @param dst The array into which longs are to be written
|
||||
* @param offset The offset within the array of the first long to be
|
||||
* written; must be non-negative and no larger than
|
||||
* <tt>dst.length</tt>
|
||||
* @param length The maximum number of longs to be written to the given
|
||||
* array; must be non-negative and no larger than
|
||||
* <tt>dst.length - offset</tt>
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws BufferUnderflowException If there are fewer than <tt>length</tt> longs
|
||||
* remaining in this buffer
|
||||
* @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and <tt>length</tt>
|
||||
* parameters do not hold
|
||||
*/
|
||||
public PointerBuffer get(long[] dst, int offset, int length) {
|
||||
if ( is64Bit )
|
||||
view64.get(dst, offset, length);
|
||||
else {
|
||||
checkBounds(offset, length, dst.length);
|
||||
if ( length > view32.remaining() )
|
||||
throw new BufferUnderflowException();
|
||||
int end = offset + length;
|
||||
for ( int i = offset; i < end; i++ )
|
||||
dst[i] = view32.get() & 0x00000000FFFFFFFFL;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Relative bulk <i>get</i> method.
|
||||
* <p/>
|
||||
* <p> This method transfers longs from this buffer into the given
|
||||
* destination array. An invocation of this method of the form
|
||||
* <tt>src.get(a)</tt> behaves in exactly the same way as the invocation
|
||||
* <p/>
|
||||
* <pre>
|
||||
* src.get(a, 0, a.length) </pre>
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws BufferUnderflowException If there are fewer than <tt>length</tt> longs
|
||||
* remaining in this buffer
|
||||
*/
|
||||
public PointerBuffer get(long[] dst) {
|
||||
return get(dst, 0, dst.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Relative bulk <i>put</i> method <i>(optional operation)</i>.
|
||||
* <p/>
|
||||
* <p> This method transfers the longs remaining in the given source
|
||||
* buffer into this buffer. If there are more longs remaining in the
|
||||
* source buffer than in this buffer, that is, if
|
||||
* <tt>src.remaining()</tt> <tt>></tt> <tt>remaining()</tt>,
|
||||
* then no longs are transferred and a {@link
|
||||
* BufferOverflowException} is thrown.
|
||||
* <p/>
|
||||
* <p> Otherwise, this method copies
|
||||
* <i>n</i> = <tt>src.remaining()</tt> longs from the given
|
||||
* buffer into this buffer, starting at each buffer's current position.
|
||||
* The positions of both buffers are then incremented by <i>n</i>.
|
||||
* <p/>
|
||||
* <p> In other words, an invocation of this method of the form
|
||||
* <tt>dst.put(src)</tt> has exactly the same effect as the loop
|
||||
* <p/>
|
||||
* <pre>
|
||||
* while (src.hasRemaining())
|
||||
* dst.put(src.get()); </pre>
|
||||
* <p/>
|
||||
* except that it first checks that there is sufficient space in this
|
||||
* buffer and it is potentially much more efficient. </p>
|
||||
*
|
||||
* @param src The source buffer from which longs are to be read;
|
||||
* must not be this buffer
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws BufferOverflowException If there is insufficient space in this buffer
|
||||
* for the remaining longs in the source buffer
|
||||
* @throws IllegalArgumentException If the source buffer is this buffer
|
||||
* @throws ReadOnlyBufferException If this buffer is read-only
|
||||
*/
|
||||
public PointerBuffer put(PointerBuffer src) {
|
||||
if ( is64Bit )
|
||||
view64.put(src.view64);
|
||||
else
|
||||
view32.put(src.view32);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Relative bulk <i>put</i> method <i>(optional operation)</i>.
|
||||
* <p/>
|
||||
* <p> This method transfers longs into this buffer from the given
|
||||
* source array. If there are more longs to be copied from the array
|
||||
* than remain in this buffer, that is, if
|
||||
* <tt>length</tt> <tt>></tt> <tt>remaining()</tt>, then no
|
||||
* longs are transferred and a {@link BufferOverflowException} is
|
||||
* thrown.
|
||||
* <p/>
|
||||
* <p> Otherwise, this method copies <tt>length</tt> longs from the
|
||||
* given array into this buffer, starting at the given offset in the array
|
||||
* and at the current position of this buffer. The position of this buffer
|
||||
* is then incremented by <tt>length</tt>.
|
||||
* <p/>
|
||||
* <p> In other words, an invocation of this method of the form
|
||||
* <tt>dst.put(src, off, len)</tt> has exactly the same effect as
|
||||
* the loop
|
||||
* <p/>
|
||||
* <pre>
|
||||
* for (int i = off; i < off + len; i++)
|
||||
* dst.put(a[i]); </pre>
|
||||
* <p/>
|
||||
* except that it first checks that there is sufficient space in this
|
||||
* buffer and it is potentially much more efficient. </p>
|
||||
*
|
||||
* @param src The array from which longs are to be read
|
||||
* @param offset The offset within the array of the first long to be read;
|
||||
* must be non-negative and no larger than <tt>array.length</tt>
|
||||
* @param length The number of longs to be read from the given array;
|
||||
* must be non-negative and no larger than
|
||||
* <tt>array.length - offset</tt>
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws BufferOverflowException If there is insufficient space in this buffer
|
||||
* @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and <tt>length</tt>
|
||||
* parameters do not hold
|
||||
* @throws ReadOnlyBufferException If this buffer is read-only
|
||||
*/
|
||||
public PointerBuffer put(long[] src, int offset, int length) {
|
||||
if ( is64Bit )
|
||||
view64.put(src, offset, length);
|
||||
else {
|
||||
checkBounds(offset, length, src.length);
|
||||
if ( length > view32.remaining() )
|
||||
throw new BufferOverflowException();
|
||||
int end = offset + length;
|
||||
for ( int i = offset; i < end; i++ )
|
||||
view32.put((int)src[i]);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Relative bulk <i>put</i> method <i>(optional operation)</i>.
|
||||
* <p/>
|
||||
* <p> This method transfers the entire content of the given source
|
||||
* long array into this buffer. An invocation of this method of the
|
||||
* form <tt>dst.put(a)</tt> behaves in exactly the same way as the
|
||||
* invocation
|
||||
* <p/>
|
||||
* <pre>
|
||||
* dst.put(a, 0, a.length) </pre>
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws BufferOverflowException If there is insufficient space in this buffer
|
||||
* @throws ReadOnlyBufferException If this buffer is read-only
|
||||
*/
|
||||
public final PointerBuffer put(long[] src) {
|
||||
return put(src, 0, src.length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compacts this buffer <i>(optional operation)</i>.
|
||||
* <p/>
|
||||
* <p> The longs between the buffer's current position and its limit,
|
||||
* if any, are copied to the beginning of the buffer. That is, the
|
||||
* long at index <i>p</i> = <tt>position()</tt> is copied
|
||||
* to index zero, the long at index <i>p</i> + 1 is copied
|
||||
* to index one, and so forth until the long at index
|
||||
* <tt>limit()</tt> - 1 is copied to index
|
||||
* <i>n</i> = <tt>limit()</tt> - <tt>1</tt> - <i>p</i>.
|
||||
* The buffer's position is then set to <i>n+1</i> and its limit is set to
|
||||
* its capacity. The mark, if defined, is discarded.
|
||||
* <p/>
|
||||
* <p> The buffer's position is set to the number of longs copied,
|
||||
* rather than to zero, so that an invocation of this method can be
|
||||
* followed immediately by an invocation of another relative <i>put</i>
|
||||
* method. </p>
|
||||
*
|
||||
* @return This buffer
|
||||
*
|
||||
* @throws ReadOnlyBufferException If this buffer is read-only
|
||||
*/
|
||||
public PointerBuffer compact() {
|
||||
if ( is64Bit )
|
||||
view64.compact();
|
||||
else
|
||||
view32.compact();
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves this buffer's byte order.
|
||||
* <p/>
|
||||
* <p> The byte order of a pointer buffer created by allocation or by
|
||||
* wrapping an existing <tt>long</tt> array is the {@link
|
||||
* ByteOrder#nativeOrder </code>native order<code>} of the underlying
|
||||
* hardware. The byte order of a pointer buffer created as a <a
|
||||
* href="ByteBuffer.html#views">view</a> of a byte buffer is that of the
|
||||
* byte buffer at the moment that the view is created. </p>
|
||||
*
|
||||
* @return This buffer's byte order
|
||||
*/
|
||||
public ByteOrder order() {
|
||||
if ( is64Bit )
|
||||
return view64.order();
|
||||
else
|
||||
return view32.order();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string summarizing the state of this buffer. </p>
|
||||
*
|
||||
* @return A summary string
|
||||
*/
|
||||
public String toString() {
|
||||
StringBuffer sb = new StringBuffer(48);
|
||||
sb.append(getClass().getName());
|
||||
sb.append("[pos=");
|
||||
sb.append(position());
|
||||
sb.append(" lim=");
|
||||
sb.append(limit());
|
||||
sb.append(" cap=");
|
||||
sb.append(capacity());
|
||||
sb.append("]");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current hash code of this buffer.
|
||||
* <p/>
|
||||
* <p> The hash code of a pointer buffer depends only upon its remaining
|
||||
* elements; that is, upon the elements from <tt>position()</tt> up to, and
|
||||
* including, the element at <tt>limit()</tt> - <tt>1</tt>.
|
||||
* <p/>
|
||||
* <p> Because buffer hash codes are content-dependent, it is inadvisable
|
||||
* to use buffers as keys in hash maps or similar data structures unless it
|
||||
* is known that their contents will not change. </p>
|
||||
*
|
||||
* @return The current hash code of this buffer
|
||||
*/
|
||||
public int hashCode() {
|
||||
int h = 1;
|
||||
int p = position();
|
||||
for ( int i = limit() - 1; i >= p; i-- )
|
||||
h = 31 * h + (int)get(i);
|
||||
return h;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether or not this buffer is equal to another object.
|
||||
* <p/>
|
||||
* <p> Two pointer buffers are equal if, and only if,
|
||||
* <p/>
|
||||
* <p><ol>
|
||||
* <p/>
|
||||
* <li><p> They have the same element type, </p></li>
|
||||
* <p/>
|
||||
* <li><p> They have the same number of remaining elements, and
|
||||
* </p></li>
|
||||
* <p/>
|
||||
* <li><p> The two sequences of remaining elements, considered
|
||||
* independently of their starting positions, are pointwise equal.
|
||||
* </p></li>
|
||||
* <p/>
|
||||
* </ol>
|
||||
* <p/>
|
||||
* <p> A pointer buffer is not equal to any other type of object. </p>
|
||||
*
|
||||
* @param ob The object to which this buffer is to be compared
|
||||
*
|
||||
* @return <tt>true</tt> if, and only if, this buffer is equal to the
|
||||
* given object
|
||||
*/
|
||||
public boolean equals(Object ob) {
|
||||
if ( !(ob instanceof PointerBuffer) )
|
||||
return false;
|
||||
PointerBuffer that = (PointerBuffer)ob;
|
||||
if ( this.remaining() != that.remaining() )
|
||||
return false;
|
||||
int p = this.position();
|
||||
for ( int i = this.limit() - 1, j = that.limit() - 1; i >= p; i--, j-- ) {
|
||||
long v1 = this.get(i);
|
||||
long v2 = that.get(j);
|
||||
if ( v1 != v2 ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares this buffer to another.
|
||||
* <p/>
|
||||
* <p> Two pointer buffers are compared by comparing their sequences of
|
||||
* remaining elements lexicographically, without regard to the starting
|
||||
* position of each sequence within its corresponding buffer.
|
||||
* <p/>
|
||||
* <p> A pointer buffer is not comparable to any other type of object.
|
||||
*
|
||||
* @return A negative integer, zero, or a positive integer as this buffer
|
||||
* is less than, equal to, or greater than the given buffer
|
||||
*/
|
||||
public int compareTo(Object o) {
|
||||
final PointerBuffer that = (PointerBuffer)o;
|
||||
int n = this.position() + Math.min(this.remaining(), that.remaining());
|
||||
for ( int i = this.position(), j = that.position(); i < n; i++, j++ ) {
|
||||
long v1 = this.get(i);
|
||||
long v2 = that.get(j);
|
||||
if ( v1 == v2 )
|
||||
continue;
|
||||
if ( v1 < v2 )
|
||||
return -1;
|
||||
return +1;
|
||||
}
|
||||
return this.remaining() - that.remaining();
|
||||
}
|
||||
|
||||
private static void checkBounds(int off, int len, int size) {
|
||||
if ( (off | len | (off + len) | (size - (off + len))) < 0 )
|
||||
throw new IndexOutOfBoundsException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Read-only version of PointerBuffer.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
private static final class PointerBufferR extends PointerBuffer {
|
||||
|
||||
PointerBufferR(final ByteBuffer source) {
|
||||
super(source);
|
||||
}
|
||||
|
||||
public boolean isReadOnly() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected PointerBuffer newInstance(final ByteBuffer source) {
|
||||
return new PointerBufferR(source);
|
||||
}
|
||||
|
||||
public PointerBuffer asReadOnlyBuffer() {
|
||||
return duplicate();
|
||||
}
|
||||
|
||||
public PointerBuffer put(final long l) {
|
||||
throw new ReadOnlyBufferException();
|
||||
}
|
||||
|
||||
public PointerBuffer put(final int index, final long l) {
|
||||
throw new ReadOnlyBufferException();
|
||||
}
|
||||
|
||||
public PointerBuffer put(final PointerBuffer src) {
|
||||
throw new ReadOnlyBufferException();
|
||||
}
|
||||
|
||||
public PointerBuffer put(final long[] src, final int offset, final int length) {
|
||||
throw new ReadOnlyBufferException();
|
||||
}
|
||||
|
||||
public PointerBuffer compact() {
|
||||
throw new ReadOnlyBufferException();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -29,9 +29,13 @@
|
|||
* 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;
|
||||
package org.lwjgl;
|
||||
|
||||
/** @author spasi <spasi@users.sourceforge.net> */
|
||||
/**
|
||||
* A common interface for classes that wrap pointer addresses.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public interface PointerWrapper {
|
||||
|
||||
long getPointer();
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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;
|
||||
|
||||
/**
|
||||
* Base PointerWrapper implementation.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public abstract class PointerWrapperAbstract implements PointerWrapper {
|
||||
|
||||
protected final long pointer;
|
||||
|
||||
protected PointerWrapperAbstract(final long pointer) {
|
||||
this.pointer = pointer;
|
||||
}
|
||||
|
||||
public final boolean isNull() {
|
||||
return pointer == 0;
|
||||
}
|
||||
|
||||
public final void checkNull() {
|
||||
if ( LWJGLUtil.DEBUG && pointer == 0 )
|
||||
throw new IllegalStateException("This pointer is null.");
|
||||
}
|
||||
|
||||
public long getPointer() {
|
||||
return pointer;
|
||||
}
|
||||
|
||||
public boolean equals(final Object o) {
|
||||
if ( this == o ) return true;
|
||||
if ( !(o instanceof PointerWrapperAbstract) ) return false;
|
||||
|
||||
final PointerWrapperAbstract that = (PointerWrapperAbstract)o;
|
||||
|
||||
if ( pointer != that.pointer ) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return (int)(pointer ^ (pointer >>> 32));
|
||||
}
|
||||
|
||||
}
|
|
@ -56,10 +56,11 @@ public final class Sys {
|
|||
/** Current version of library */
|
||||
private static final String VERSION = "2.6";
|
||||
|
||||
/** The implementation instance to delegate platform specific behavior to */
|
||||
private final static SysImplementation implementation;
|
||||
private static final String POSTFIX64BIT = "64";
|
||||
|
||||
private final static String POSTFIX64BIT = "64";
|
||||
/** The implementation instance to delegate platform specific behavior to */
|
||||
private static final SysImplementation implementation;
|
||||
private static final boolean is64Bit;
|
||||
|
||||
private static void doLoadLibrary(final String lib_name) {
|
||||
AccessController.doPrivileged(new PrivilegedAction() {
|
||||
|
@ -76,14 +77,15 @@ public final class Sys {
|
|||
});
|
||||
}
|
||||
|
||||
private static void loadLibrary(final String lib_name) {
|
||||
private static boolean loadLibrary(final String lib_name) {
|
||||
try {
|
||||
doLoadLibrary(lib_name);
|
||||
return false;
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
if (implementation.has64Bit()) {
|
||||
try {
|
||||
doLoadLibrary(lib_name + POSTFIX64BIT);
|
||||
return;
|
||||
return true;
|
||||
} catch (UnsatisfiedLinkError e2) {
|
||||
LWJGLUtil.log("Failed to load 64 bit library: " + e2.getMessage());
|
||||
}
|
||||
|
@ -95,7 +97,7 @@ public final class Sys {
|
|||
|
||||
static {
|
||||
implementation = createImplementation();
|
||||
loadLibrary(JNI_LIBRARY_NAME);
|
||||
is64Bit = loadLibrary(JNI_LIBRARY_NAME);
|
||||
|
||||
int native_jni_version = implementation.getJNIVersion();
|
||||
int required_version = implementation.getRequiredJNIVersion();
|
||||
|
@ -137,6 +139,11 @@ public final class Sys {
|
|||
public static void initialize() {
|
||||
}
|
||||
|
||||
/** Returns true if a 64bit implementation was loaded. */
|
||||
public static boolean is64Bit() {
|
||||
return is64Bit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the number of ticks that the hires timer does in a second. This method is fast;
|
||||
* it should be called as frequently as possible, as it recalibrates the timer.
|
||||
|
|
|
@ -0,0 +1,580 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.LWJGLUtil;
|
||||
import org.lwjgl.PointerBuffer;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.nio.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetEncoder;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Utility class for OpenCL API calls.
|
||||
* TODO: Remove useless stuff
|
||||
*
|
||||
* @author spasi
|
||||
*/
|
||||
final class APIUtil {
|
||||
|
||||
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 static final ThreadLocal<ByteBuffer> bufferByteTL = new ThreadLocal<ByteBuffer>() {
|
||||
protected ByteBuffer initialValue() { return BufferUtils.createByteBuffer(INITIAL_BUFFER_SIZE); }
|
||||
};
|
||||
|
||||
private static final ThreadLocal<PointerBuffer> bufferPointerTL = new ThreadLocal<PointerBuffer>() {
|
||||
protected PointerBuffer initialValue() { return BufferUtils.createPointerBuffer(INITIAL_BUFFER_SIZE); }
|
||||
};
|
||||
|
||||
private static final ThreadLocal<PointerBuffer> lengthsTL = new ThreadLocal<PointerBuffer>() {
|
||||
protected PointerBuffer initialValue() { return BufferUtils.createPointerBuffer(INITIAL_LENGTHS_SIZE); }
|
||||
};
|
||||
|
||||
private static final ThreadLocal<InfiniteCharSequence> infiniteSeqTL = new ThreadLocal<InfiniteCharSequence>() {
|
||||
protected InfiniteCharSequence initialValue() { return new InfiniteCharSequence(); }
|
||||
};
|
||||
|
||||
private static final ThreadLocal<Buffers> buffersTL = new ThreadLocal<Buffers>() {
|
||||
protected Buffers initialValue() { return new Buffers(); }
|
||||
};
|
||||
|
||||
private static final CharsetEncoder encoder = Charset.forName("US-ASCII").newEncoder();
|
||||
|
||||
private static final ObjectDestructor<CLDevice> DESTRUCTOR_CLSubDevice = new ObjectDestructor<CLDevice>() {
|
||||
public void release(final CLDevice object) { EXTDeviceFission.clReleaseDeviceEXT(object); }
|
||||
};
|
||||
private static final ObjectDestructor<CLMem> DESTRUCTOR_CLMem = new ObjectDestructor<CLMem>() {
|
||||
public void release(final CLMem object) { CL10.clReleaseMemObject(object); }
|
||||
};
|
||||
private static final ObjectDestructor<CLCommandQueue> DESTRUCTOR_CLCommandQueue = new ObjectDestructor<CLCommandQueue>() {
|
||||
public void release(final CLCommandQueue object) { CL10.clReleaseCommandQueue(object); }
|
||||
};
|
||||
private static final ObjectDestructor<CLSampler> DESTRUCTOR_CLSampler = new ObjectDestructor<CLSampler>() {
|
||||
public void release(final CLSampler object) { CL10.clReleaseSampler(object); }
|
||||
};
|
||||
private static final ObjectDestructor<CLProgram> DESTRUCTOR_CLProgram = new ObjectDestructor<CLProgram>() {
|
||||
public void release(final CLProgram object) { CL10.clReleaseProgram(object); }
|
||||
};
|
||||
private static final ObjectDestructor<CLKernel> DESTRUCTOR_CLKernel = new ObjectDestructor<CLKernel>() {
|
||||
public void release(final CLKernel object) { CL10.clReleaseKernel(object); }
|
||||
};
|
||||
private static final ObjectDestructor<CLEvent> DESTRUCTOR_CLEvent = new ObjectDestructor<CLEvent>() {
|
||||
public void release(final CLEvent object) { CL10.clReleaseEvent(object); }
|
||||
};
|
||||
|
||||
private APIUtil() {
|
||||
}
|
||||
|
||||
private static char[] getArray(final int size) {
|
||||
char[] array = arrayTL.get();
|
||||
|
||||
if ( array.length < size ) {
|
||||
int sizeNew = array.length << 1;
|
||||
while ( sizeNew < size )
|
||||
sizeNew <<= 1;
|
||||
|
||||
array = new char[size];
|
||||
arrayTL.set(array);
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
static ByteBuffer getBufferByte(final int size) {
|
||||
ByteBuffer buffer = bufferByteTL.get();
|
||||
|
||||
if ( buffer.capacity() < size ) {
|
||||
int sizeNew = buffer.capacity() << 1;
|
||||
while ( sizeNew < size )
|
||||
sizeNew <<= 1;
|
||||
|
||||
buffer = BufferUtils.createByteBuffer(size);
|
||||
bufferByteTL.set(buffer);
|
||||
} else
|
||||
buffer.clear();
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
private static ByteBuffer getBufferByteOffset(final int size) {
|
||||
ByteBuffer buffer = bufferByteTL.get();
|
||||
|
||||
if ( buffer.capacity() < size ) {
|
||||
int sizeNew = buffer.capacity() << 1;
|
||||
while ( sizeNew < size )
|
||||
sizeNew <<= 1;
|
||||
|
||||
final ByteBuffer bufferNew = BufferUtils.createByteBuffer(size);
|
||||
bufferNew.put(buffer);
|
||||
bufferByteTL.set(buffer = bufferNew);
|
||||
} else {
|
||||
buffer.position(buffer.limit());
|
||||
buffer.limit(buffer.capacity());
|
||||
}
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static PointerBuffer getBufferPointer(final int size) {
|
||||
PointerBuffer buffer = bufferPointerTL.get();
|
||||
|
||||
if ( buffer.capacity() < size ) {
|
||||
int sizeNew = buffer.capacity() << 1;
|
||||
while ( sizeNew < size )
|
||||
sizeNew <<= 1;
|
||||
|
||||
buffer = BufferUtils.createPointerBuffer(size);
|
||||
bufferPointerTL.set(buffer);
|
||||
} else
|
||||
buffer.clear();
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static ShortBuffer getBufferShort() { return buffersTL.get().shorts; }
|
||||
|
||||
static IntBuffer getBufferInt() { return buffersTL.get().ints; }
|
||||
|
||||
static IntBuffer getBufferIntDebug() { return buffersTL.get().intsDebug; }
|
||||
|
||||
static LongBuffer getBufferLong() { return buffersTL.get().longs; }
|
||||
|
||||
static FloatBuffer getBufferFloat() { return buffersTL.get().floats; }
|
||||
|
||||
static DoubleBuffer getBufferDouble() { return buffersTL.get().doubles; }
|
||||
|
||||
static PointerBuffer getBufferPointer() { return buffersTL.get().pointers; }
|
||||
|
||||
static PointerBuffer getLengths() {
|
||||
return getLengths(1);
|
||||
}
|
||||
|
||||
static PointerBuffer getLengths(final int size) {
|
||||
PointerBuffer lengths = lengthsTL.get();
|
||||
|
||||
if ( lengths.capacity() < size ) {
|
||||
int sizeNew = lengths.capacity();
|
||||
while ( sizeNew < size )
|
||||
sizeNew <<= 1;
|
||||
|
||||
lengths = BufferUtils.createPointerBuffer(size);
|
||||
lengthsTL.set(lengths);
|
||||
} else
|
||||
lengths.clear();
|
||||
|
||||
return lengths;
|
||||
}
|
||||
|
||||
private static InfiniteCharSequence getInfiniteSeq() {
|
||||
return infiniteSeqTL.get();
|
||||
}
|
||||
|
||||
private static void encode(final ByteBuffer buffer, final CharSequence string) {
|
||||
final InfiniteCharSequence infiniteSeq = getInfiniteSeq();
|
||||
infiniteSeq.setString(string);
|
||||
encoder.encode(infiniteSeq.buffer, buffer, true);
|
||||
infiniteSeq.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads a byte string from the specified buffer.
|
||||
*
|
||||
* @param buffer
|
||||
*
|
||||
* @return the buffer as a String.
|
||||
*/
|
||||
static String getString(final ByteBuffer buffer) {
|
||||
final int length = buffer.remaining();
|
||||
final char[] charArray = getArray(length);
|
||||
|
||||
for ( int i = buffer.position(); i < buffer.limit(); i++ )
|
||||
charArray[i - buffer.position()] = (char)buffer.get(i);
|
||||
|
||||
return new String(charArray, 0, length);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a buffer containing the specified string as bytes.
|
||||
*
|
||||
* @param string
|
||||
*
|
||||
* @return the String as a ByteBuffer
|
||||
*/
|
||||
static ByteBuffer getBuffer(final CharSequence string) {
|
||||
final ByteBuffer buffer = getBufferByte(string.length());
|
||||
|
||||
encode(buffer, string);
|
||||
|
||||
buffer.flip();
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a buffer containing the specified string as bytes, starting at the specified offset.
|
||||
*
|
||||
* @param string
|
||||
*
|
||||
* @return the String as a ByteBuffer
|
||||
*/
|
||||
static ByteBuffer getBuffer(final CharSequence string, final int offset) {
|
||||
final ByteBuffer buffer = getBufferByteOffset(offset + string.length());
|
||||
|
||||
encode(buffer, string);
|
||||
|
||||
buffer.flip();
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a buffer containing the specified string as bytes, including null-termination.
|
||||
*
|
||||
* @param string
|
||||
*
|
||||
* @return the String as a ByteBuffer
|
||||
*/
|
||||
static ByteBuffer getBufferNT(final CharSequence string) {
|
||||
final ByteBuffer buffer = getBufferByte(string.length() + 1);
|
||||
|
||||
encode(buffer, string);
|
||||
|
||||
buffer.put((byte)0);
|
||||
buffer.flip();
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static int getTotalLength(final CharSequence[] strings) {
|
||||
int length = 0;
|
||||
for ( int i = 0; i < strings.length; i++ )
|
||||
length += strings[i].length();
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a buffer containing the specified strings as bytes.
|
||||
*
|
||||
* @param strings
|
||||
*
|
||||
* @return the Strings as a ByteBuffer
|
||||
*/
|
||||
static ByteBuffer getBuffer(final CharSequence[] strings) {
|
||||
final ByteBuffer buffer = getBufferByte(getTotalLength(strings));
|
||||
|
||||
final InfiniteCharSequence infiniteSeq = getInfiniteSeq();
|
||||
for ( int i = 0; i < strings.length; i++ ) {
|
||||
infiniteSeq.setString(strings[i]);
|
||||
encoder.encode(infiniteSeq.buffer, buffer, true);
|
||||
}
|
||||
infiniteSeq.clear();
|
||||
|
||||
buffer.flip();
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a buffer containing the specified strings as bytes, including null-termination.
|
||||
*
|
||||
* @param strings
|
||||
*
|
||||
* @return the Strings as a ByteBuffer
|
||||
*/
|
||||
static ByteBuffer getBufferNT(final CharSequence[] strings) {
|
||||
final ByteBuffer buffer = getBufferByte(getTotalLength(strings) + strings.length);
|
||||
|
||||
final InfiniteCharSequence infiniteSeq = getInfiniteSeq();
|
||||
for ( int i = 0; i < strings.length; i++ ) {
|
||||
infiniteSeq.setString(strings[i]);
|
||||
encoder.encode(infiniteSeq.buffer, buffer, true);
|
||||
buffer.put((byte)0);
|
||||
}
|
||||
infiniteSeq.clear();
|
||||
|
||||
buffer.flip();
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a buffer containing the lengths of the specified strings.
|
||||
*
|
||||
* @param strings
|
||||
*
|
||||
* @return the String lengths in a PointerBuffer
|
||||
*/
|
||||
static PointerBuffer getLengths(final CharSequence[] strings) {
|
||||
PointerBuffer buffer = getLengths(strings.length);
|
||||
|
||||
for ( int i = 0; i < strings.length; i++ )
|
||||
buffer.put(strings[i].length());
|
||||
|
||||
buffer.flip();
|
||||
return buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a buffer containing the lengths of the specified buffers.
|
||||
*
|
||||
* @param buffers the buffer array
|
||||
*
|
||||
* @return the buffer lengths in a PointerBuffer
|
||||
*/
|
||||
static PointerBuffer getLengths(final ByteBuffer[] buffers) {
|
||||
PointerBuffer buffer = getLengths(buffers.length);
|
||||
|
||||
for ( int i = 0; i < buffers.length; i++ )
|
||||
buffer.put(buffers[i].remaining());
|
||||
|
||||
buffer.flip();
|
||||
return buffer;
|
||||
}
|
||||
|
||||
static int getSize(final PointerBuffer lengths) {
|
||||
long size = 0;
|
||||
for ( int i = lengths.position(); i < lengths.limit(); i++ )
|
||||
size += lengths.get(i);
|
||||
|
||||
return (int)size;
|
||||
}
|
||||
|
||||
static void getClassTokens(final Class[] tokenClasses, final Map<Integer, String> target, final TokenFilter filter) {
|
||||
getClassTokens(Arrays.asList(tokenClasses), target, filter);
|
||||
}
|
||||
|
||||
static void getClassTokens(final Iterable<Class> tokenClasses, final Map<Integer, String> target, final TokenFilter filter) {
|
||||
final int TOKEN_MODIFIERS = Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL;
|
||||
|
||||
for ( final Class tokenClass : tokenClasses ) {
|
||||
for ( final Field field : tokenClass.getDeclaredFields() ) {
|
||||
// Get only <public static final int> fields.
|
||||
if ( (field.getModifiers() & TOKEN_MODIFIERS) == TOKEN_MODIFIERS && field.getType() == int.class ) {
|
||||
try {
|
||||
final int value = field.getInt(null);
|
||||
if ( filter != null && !filter.accept(field, value) )
|
||||
continue;
|
||||
|
||||
if ( target.containsKey(value) ) // Print colliding tokens in their hex representation.
|
||||
target.put(value, "0x" + Integer.toHexString(value).toUpperCase());
|
||||
else
|
||||
target.put(value, field.getName());
|
||||
} catch (IllegalAccessException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static ByteBuffer getNativeKernelArgs(final long user_func_ref, final CLMem[] clMems, final long[] sizes) {
|
||||
final ByteBuffer args = getBufferByte(8 + 4 + (clMems == null ? 0 : clMems.length * (4 + PointerBuffer.getPointerSize())));
|
||||
|
||||
args.putLong(0, user_func_ref);
|
||||
if ( clMems == null )
|
||||
args.putInt(8, 0);
|
||||
else {
|
||||
args.putInt(8, clMems.length);
|
||||
int byteIndex = 12;
|
||||
for ( int i = 0; i < clMems.length; i++ ) {
|
||||
if ( LWJGLUtil.DEBUG && !clMems[i].isValid() )
|
||||
throw new IllegalArgumentException("An invalid CLMem object was specified.");
|
||||
args.putInt(byteIndex, (int)sizes[i]); // CLMem size
|
||||
byteIndex += (4 + PointerBuffer.getPointerSize()); // Skip size and make room for the pointer
|
||||
}
|
||||
}
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
/**
|
||||
* Releases all sub-devices created from the specified CLDevice.
|
||||
*
|
||||
* @param device the CLDevice to clear
|
||||
*/
|
||||
static void releaseObjects(final CLDevice device) {
|
||||
// Release objects only if we're about to hit 0.
|
||||
if ( device.getReferenceCount() > 1 )
|
||||
return;
|
||||
|
||||
releaseObjects(device.getSubCLDeviceRegistry(), DESTRUCTOR_CLSubDevice);
|
||||
}
|
||||
|
||||
/**
|
||||
* Releases all objects contained in the specified CLContext.
|
||||
*
|
||||
* @param context the CLContext to clear
|
||||
*/
|
||||
static void releaseObjects(final CLContext context) {
|
||||
// Release objects only if we're about to hit 0.
|
||||
if ( context.getReferenceCount() > 1 )
|
||||
return;
|
||||
|
||||
releaseObjects(context.getCLEventRegistry(), DESTRUCTOR_CLEvent);
|
||||
releaseObjects(context.getCLProgramRegistry(), DESTRUCTOR_CLProgram);
|
||||
releaseObjects(context.getCLSamplerRegistry(), DESTRUCTOR_CLSampler);
|
||||
releaseObjects(context.getCLMemRegistry(), DESTRUCTOR_CLMem);
|
||||
releaseObjects(context.getCLCommandQueueRegistry(), DESTRUCTOR_CLCommandQueue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Releases all objects contained in the specified CLProgram.
|
||||
*
|
||||
* @param program the CLProgram to clear
|
||||
*/
|
||||
static void releaseObjects(final CLProgram program) {
|
||||
// Release objects only if we're about to hit 0.
|
||||
if ( program.getReferenceCount() > 1 )
|
||||
return;
|
||||
|
||||
releaseObjects(program.getCLKernelRegistry(), DESTRUCTOR_CLKernel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Releases all objects contained in the specified CLCommandQueue.
|
||||
*
|
||||
* @param queue the CLCommandQueue to clear
|
||||
*/
|
||||
static void releaseObjects(final CLCommandQueue queue) {
|
||||
// Release objects only if we're about to hit 0.
|
||||
if ( queue.getReferenceCount() > 1 )
|
||||
return;
|
||||
|
||||
releaseObjects(queue.getCLEventRegistry(), DESTRUCTOR_CLEvent);
|
||||
}
|
||||
|
||||
static Set<String> getExtensions(final String extensionList) {
|
||||
final Set<String> extensions = new HashSet<String>();
|
||||
|
||||
final StringTokenizer tokenizer = new StringTokenizer(extensionList);
|
||||
while ( tokenizer.hasMoreTokens() )
|
||||
extensions.add(tokenizer.nextToken());
|
||||
|
||||
return extensions;
|
||||
}
|
||||
|
||||
private static <T extends CLObjectChild> void releaseObjects(final CLObjectRegistry<T> registry, final ObjectDestructor<T> destructor) {
|
||||
if ( registry.isEmpty() )
|
||||
return;
|
||||
|
||||
for ( final T object : registry.getAll() ) {
|
||||
while ( object.isValid() )
|
||||
destructor.release(object);
|
||||
}
|
||||
}
|
||||
|
||||
private interface ObjectDestructor<T extends CLObjectChild> {
|
||||
|
||||
void release(T object);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* A mutable CharSequence with very large initial length. We can wrap this in a re-usable CharBuffer for decoding.
|
||||
* We cannot subclass CharBuffer because of {@link java.nio.CharBuffer#toString(int,int)}.
|
||||
*/
|
||||
private static class InfiniteCharSequence implements CharSequence {
|
||||
|
||||
final CharBuffer buffer;
|
||||
|
||||
CharSequence string;
|
||||
|
||||
InfiniteCharSequence() {
|
||||
buffer = CharBuffer.wrap(this);
|
||||
}
|
||||
|
||||
void setString(final CharSequence string) {
|
||||
this.string = string;
|
||||
this.buffer.position(0);
|
||||
this.buffer.limit(string.length());
|
||||
}
|
||||
|
||||
void clear() {
|
||||
this.string = null;
|
||||
}
|
||||
|
||||
public int length() {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
public char charAt(final int index) {
|
||||
return string.charAt(index);
|
||||
}
|
||||
|
||||
public CharSequence subSequence(final int start, final int end) {
|
||||
return string.subSequence(start, end);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Buffers {
|
||||
|
||||
final ShortBuffer shorts;
|
||||
final IntBuffer ints;
|
||||
final IntBuffer intsDebug;
|
||||
final LongBuffer longs;
|
||||
|
||||
final FloatBuffer floats;
|
||||
final DoubleBuffer doubles;
|
||||
|
||||
final PointerBuffer pointers;
|
||||
|
||||
Buffers() {
|
||||
shorts = BufferUtils.createShortBuffer(BUFFERS_SIZE);
|
||||
ints = BufferUtils.createIntBuffer(BUFFERS_SIZE);
|
||||
intsDebug = BufferUtils.createIntBuffer(1);
|
||||
longs = BufferUtils.createLongBuffer(BUFFERS_SIZE);
|
||||
|
||||
floats = BufferUtils.createFloatBuffer(BUFFERS_SIZE);
|
||||
doubles = BufferUtils.createDoubleBuffer(BUFFERS_SIZE);
|
||||
|
||||
pointers = BufferUtils.createPointerBuffer(BUFFERS_SIZE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** Simple interface for Field filtering */
|
||||
interface TokenFilter {
|
||||
|
||||
/** Should return true if the specified Field passes the filter. */
|
||||
boolean accept(Field field, int value);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
* Utility class that provides CLContextCallback implementations that use
|
||||
* the APPLE_ContextLoggingFunctions callback functions.
|
||||
* <p/>
|
||||
* TODO: Test this class
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public final class APPLEContextLoggingUtil {
|
||||
|
||||
/** Sends all log messages to the Apple System Logger. */
|
||||
public static final CLContextCallback SYSTEM_LOG_CALLBACK;
|
||||
|
||||
/** Sends all log messages to the file descriptor stdout. */
|
||||
public static final CLContextCallback STD_OUT_CALLBACK;
|
||||
|
||||
/** Sends all log messages to the file descriptor stderr. */
|
||||
public static final CLContextCallback STD_ERR_CALLBACK;
|
||||
|
||||
static {
|
||||
if ( CLCapabilities.isExtensionSupported("CL_APPLE_ContextLoggingFunctions") ) {
|
||||
SYSTEM_LOG_CALLBACK = new CLContextCallback(CallbackUtil.getLogMessageToSystemLogAPPLE()) {
|
||||
protected void handleMessage(final String errinfo, final ByteBuffer private_info) { throw new UnsupportedOperationException(); }
|
||||
};
|
||||
|
||||
STD_OUT_CALLBACK = new CLContextCallback(CallbackUtil.getLogMessageToStdoutAPPLE()) {
|
||||
protected void handleMessage(final String errinfo, final ByteBuffer private_info) { throw new UnsupportedOperationException(); }
|
||||
};
|
||||
|
||||
STD_ERR_CALLBACK = new CLContextCallback(CallbackUtil.getLogMessageToStderrAPPLE()) {
|
||||
protected void handleMessage(final String errinfo, final ByteBuffer private_info) { throw new UnsupportedOperationException(); }
|
||||
};
|
||||
} else {
|
||||
SYSTEM_LOG_CALLBACK = null;
|
||||
STD_OUT_CALLBACK = null;
|
||||
STD_ERR_CALLBACK = null;
|
||||
}
|
||||
}
|
||||
|
||||
private APPLEContextLoggingUtil() {}
|
||||
|
||||
}
|
|
@ -0,0 +1,148 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.LWJGLUtil;
|
||||
import org.lwjgl.Sys;
|
||||
|
||||
/**
|
||||
* LWJGL users must use this class to initialize OpenCL
|
||||
* before using any other class in the org.lwjgl.opencl package.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public final class CL {
|
||||
|
||||
private static boolean created;
|
||||
|
||||
static {
|
||||
Sys.initialize();
|
||||
}
|
||||
|
||||
private CL() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Native method to create CL instance
|
||||
*
|
||||
* @param oclPaths Array of strings containing paths to search for OpenCL library
|
||||
*/
|
||||
private static native void nCreate(String oclPaths) throws LWJGLException;
|
||||
|
||||
/**
|
||||
* Native method to create CL instance from the Mac OS X 10.4 OpenCL framework.
|
||||
* It is only defined in the Mac OS X native library.
|
||||
*/
|
||||
private static native void nCreateDefault() throws LWJGLException;
|
||||
|
||||
/** Native method the destroy the CL */
|
||||
private static native void nDestroy();
|
||||
|
||||
/** @return true if CL has been created */
|
||||
public static boolean isCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public static void create() throws LWJGLException {
|
||||
if ( created )
|
||||
return;
|
||||
//throw new IllegalStateException("OpenCL has already been created.");
|
||||
|
||||
final String libname;
|
||||
final String[] library_names;
|
||||
switch ( LWJGLUtil.getPlatform() ) {
|
||||
case LWJGLUtil.PLATFORM_WINDOWS:
|
||||
libname = "OpenCL";
|
||||
library_names = new String[] { "OpenCL.dll" };
|
||||
break;
|
||||
case LWJGLUtil.PLATFORM_LINUX:
|
||||
libname = "OpenCL";
|
||||
library_names = new String[] { "libOpenCL64.so", "libOpenCL.so" }; // TODO: Fix this
|
||||
break;
|
||||
case LWJGLUtil.PLATFORM_MACOSX:
|
||||
libname = "OpenCL";
|
||||
library_names = new String[] { "OpenCL.dylib" }; // TODO: Fix this
|
||||
break;
|
||||
default:
|
||||
throw new LWJGLException("Unknown platform: " + LWJGLUtil.getPlatform());
|
||||
}
|
||||
|
||||
final String[] oclPaths = LWJGLUtil.getLibraryPaths(libname, library_names, CL.class.getClassLoader());
|
||||
LWJGLUtil.log("Found " + oclPaths.length + " OpenCL paths");
|
||||
for ( int i = 0; i < oclPaths.length; i++ ) {
|
||||
try {
|
||||
nCreate(oclPaths[i]);
|
||||
created = true;
|
||||
break;
|
||||
} catch (LWJGLException e) {
|
||||
LWJGLUtil.log("Failed to load " + oclPaths[i] + ": " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if ( !created && LWJGLUtil.getPlatform() == LWJGLUtil.PLATFORM_MACOSX ) {
|
||||
// Try to load OpenCL from the framework instead
|
||||
nCreateDefault();
|
||||
created = true;
|
||||
}
|
||||
|
||||
if ( !created )
|
||||
throw new LWJGLException("Could not locate OpenCL library.");
|
||||
|
||||
if ( !CLCapabilities.isExtensionSupported("OpenCL10") )
|
||||
throw new RuntimeException("OpenCL 1.0 not supported.");
|
||||
}
|
||||
|
||||
public static void destroy() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to get a pointer to a named function with aliases in the OpenCL library.
|
||||
*
|
||||
* @param aliases the function name aliases.
|
||||
*
|
||||
* @return the function pointer address
|
||||
*/
|
||||
static long getFunctionAddress(String[] aliases) {
|
||||
for ( int i = 0; i < aliases.length; i++ ) {
|
||||
long address = getFunctionAddress(aliases[i]);
|
||||
if ( address != 0 )
|
||||
return address;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static native long getFunctionAddress(String name);
|
||||
|
||||
private static native void resetNativeStubs(Class clazz);
|
||||
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerWrapperAbstract;
|
||||
|
||||
/**
|
||||
* Instances of this class can be used to receive OpenCL program build notifications.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public abstract class CLBuildProgramCallback extends CLCallback {
|
||||
|
||||
protected CLBuildProgramCallback() {
|
||||
super(CallbackUtil.getBuildProgramCallback());
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from native code.
|
||||
*
|
||||
* @param program_address the CLProgram object pointer
|
||||
*/
|
||||
private void handleMessage(long program_address) {
|
||||
handleMessage(CLContext.getCLProgramGlobal(program_address));
|
||||
}
|
||||
|
||||
/**
|
||||
* The callback method.
|
||||
*
|
||||
* @param program the CLProgram object that was built
|
||||
*/
|
||||
protected abstract void handleMessage(CLProgram program);
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerWrapperAbstract;
|
||||
|
||||
/**
|
||||
* Base class for OpenCL callback objects.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
abstract class CLCallback extends PointerWrapperAbstract {
|
||||
|
||||
private final boolean custom;
|
||||
|
||||
protected CLCallback(final long pointer) {
|
||||
this(pointer, false);
|
||||
}
|
||||
|
||||
protected CLCallback(final long pointer, final boolean custom) {
|
||||
super(pointer);
|
||||
|
||||
this.custom = custom;
|
||||
}
|
||||
|
||||
final boolean isCustom() {
|
||||
return custom;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,259 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.LWJGLUtil;
|
||||
import org.lwjgl.PointerBuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
* Utility class that provides runtime checks for OpenCL method calls.
|
||||
* TODO: Revisit this when Java 7.0 is released, there will be new Buffer API with 64bit indices/sizes.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
final class CLChecks {
|
||||
|
||||
private CLChecks() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the number of bytes in the specified cl_mem buffer rectangle region.
|
||||
*
|
||||
* @param origin the host origin
|
||||
* @param region the rectangle region
|
||||
* @param row_pitch the host row pitch
|
||||
* @param slice_pitch the host slice pitch
|
||||
*
|
||||
* @return the region size in bytes
|
||||
*/
|
||||
static int calculateBufferRectSize(final PointerBuffer origin, final PointerBuffer region, long row_pitch, long slice_pitch) {
|
||||
if ( !LWJGLUtil.CHECKS )
|
||||
return 0;
|
||||
|
||||
final long x = origin.get(0);
|
||||
final long y = origin.get(1);
|
||||
final long z = origin.get(2);
|
||||
|
||||
if ( x < 0 || y < 0 || z < 0 )
|
||||
throw new IllegalArgumentException("Invalid cl_mem host origin: " + x + ", " + y + ", " + z);
|
||||
|
||||
final long w = region.get(0);
|
||||
final long h = region.get(1);
|
||||
final long d = region.get(2);
|
||||
|
||||
if ( w < 1 || h < 1 || d < 1 )
|
||||
throw new IllegalArgumentException("Invalid cl_mem rectangle region dimensions: " + w + " x " + h + " x " + d);
|
||||
|
||||
if ( row_pitch == 0 )
|
||||
row_pitch = w;
|
||||
else if ( row_pitch < w )
|
||||
throw new IllegalArgumentException("Invalid host row pitch specified: " + row_pitch);
|
||||
|
||||
if ( slice_pitch == 0 )
|
||||
slice_pitch = row_pitch * h;
|
||||
else if ( slice_pitch < (row_pitch * h) )
|
||||
throw new IllegalArgumentException("Invalid host slice pitch specified: " + slice_pitch);
|
||||
|
||||
return (int)((z * slice_pitch + y * row_pitch + x) + (w * h * d));
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the number of bytes in the specified cl_mem image region.
|
||||
* This implementation assumes 1 byte per element, because we cannot the
|
||||
* image type.
|
||||
*
|
||||
* @param region the image region
|
||||
* @param row_pitch the row pitch
|
||||
* @param slice_pitch the slice pitch
|
||||
*
|
||||
* @return the region size in bytes
|
||||
*/
|
||||
static int calculateImageSize(final PointerBuffer region, long row_pitch, long slice_pitch) {
|
||||
if ( !LWJGLUtil.CHECKS )
|
||||
return 0;
|
||||
|
||||
final long w = region.get(0);
|
||||
final long h = region.get(1);
|
||||
final long d = region.get(2);
|
||||
|
||||
if ( w < 1 || h < 1 || d < 1 )
|
||||
throw new IllegalArgumentException("Invalid cl_mem image region dimensions: " + w + " x " + h + " x " + d);
|
||||
|
||||
if ( row_pitch == 0 )
|
||||
row_pitch = w;
|
||||
else if ( row_pitch < w )
|
||||
throw new IllegalArgumentException("Invalid row pitch specified: " + row_pitch);
|
||||
|
||||
if ( slice_pitch == 0 )
|
||||
slice_pitch = row_pitch * h;
|
||||
else if ( slice_pitch < (row_pitch * h) )
|
||||
throw new IllegalArgumentException("Invalid slice pitch specified: " + slice_pitch);
|
||||
|
||||
return (int)(slice_pitch * d);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the number of bytes in the specified 2D image.
|
||||
*
|
||||
* @param format the cl_image_format struct
|
||||
* @param w the image width
|
||||
* @param h the image height
|
||||
* @param row_pitch the image row pitch
|
||||
*
|
||||
* @return the 2D image size in bytes
|
||||
*/
|
||||
static int calculateImage2DSize(final ByteBuffer format, final long w, final long h, long row_pitch) {
|
||||
if ( LWJGLUtil.CHECKS && (w < 1 || h < 1) )
|
||||
throw new IllegalArgumentException("Invalid 2D image dimensions: " + w + " x " + h);
|
||||
|
||||
final int elementSize = getElementSize(format);
|
||||
|
||||
if ( row_pitch == 0 )
|
||||
row_pitch = w * elementSize;
|
||||
else if ( LWJGLUtil.CHECKS && ((row_pitch < w * elementSize) || (row_pitch % elementSize != 0)) )
|
||||
throw new IllegalArgumentException("Invalid image_row_pitch specified: " + row_pitch);
|
||||
|
||||
return (int)(row_pitch * h);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates the number of bytes in the specified 3D image.
|
||||
*
|
||||
* @param format the cl_image_format struct
|
||||
* @param w the image width
|
||||
* @param h the image height
|
||||
* @param d the image depth
|
||||
* @param row_pitch the image row pitch
|
||||
* @param slice_pitch the image slice pitch
|
||||
*
|
||||
* @return the 3D image size in bytes
|
||||
*/
|
||||
static int calculateImage3DSize(final ByteBuffer format, final long w, final long h, final long d, long row_pitch, long slice_pitch) {
|
||||
if ( LWJGLUtil.CHECKS && (w < 1 || h < 1 || d < 2) )
|
||||
throw new IllegalArgumentException("Invalid 3D image dimensions: " + w + " x " + h + " x " + d);
|
||||
|
||||
final int elementSize = getElementSize(format);
|
||||
|
||||
if ( row_pitch == 0 )
|
||||
row_pitch = w * elementSize;
|
||||
else if ( LWJGLUtil.CHECKS && ((row_pitch < w * elementSize) || (row_pitch % elementSize != 0)) )
|
||||
throw new IllegalArgumentException("Invalid image_row_pitch specified: " + row_pitch);
|
||||
|
||||
if ( slice_pitch == 0 )
|
||||
slice_pitch = row_pitch * h;
|
||||
else if ( LWJGLUtil.CHECKS && ((row_pitch < row_pitch * h) || (slice_pitch % row_pitch != 0)) )
|
||||
throw new IllegalArgumentException("Invalid image_slice_pitch specified: " + row_pitch);
|
||||
|
||||
return (int)(slice_pitch * d);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of bytes per element for the specified image format.
|
||||
*
|
||||
* @param format a cl_image_format struct.
|
||||
*
|
||||
* @return the number of bytes per image element
|
||||
*/
|
||||
private static int getElementSize(final ByteBuffer format) {
|
||||
final int channelOrder = format.getInt(format.position() + 0);
|
||||
final int channelType = format.getInt(format.position() + 4);
|
||||
|
||||
return getChannelCount(channelOrder) * getChannelSize(channelType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of channels in the specified cl_channel_order.
|
||||
*
|
||||
* @param channelOrder the cl_channel_order
|
||||
*
|
||||
* @return the number of channels
|
||||
*/
|
||||
private static int getChannelCount(final int channelOrder) {
|
||||
switch ( channelOrder ) {
|
||||
case CL10.CL_R:
|
||||
case CL10.CL_A:
|
||||
case CL10.CL_INTENSITY:
|
||||
case CL10.CL_LUMINANCE:
|
||||
case CL11.CL_Rx:
|
||||
return 1;
|
||||
case CL10.CL_RG:
|
||||
case CL10.CL_RA:
|
||||
case CL11.CL_RGx:
|
||||
return 2;
|
||||
case CL10.CL_RGB:
|
||||
case CL11.CL_RGBx:
|
||||
return 3;
|
||||
case CL10.CL_RGBA:
|
||||
case CL10.CL_BGRA:
|
||||
case CL10.CL_ARGB:
|
||||
return 4;
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid cl_channel_order specified: 0x" + Integer.toHexString(channelOrder).toUpperCase());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of bytes in the specified cl_channel_type.
|
||||
*
|
||||
* @param channelType the cl_channel_type
|
||||
*
|
||||
* @return the number of bytes
|
||||
*/
|
||||
private static int getChannelSize(final int channelType) {
|
||||
switch ( channelType ) {
|
||||
case CL10.CL_SNORM_INT8:
|
||||
case CL10.CL_UNORM_INT8:
|
||||
case CL10.CL_SIGNED_INT8:
|
||||
case CL10.CL_UNSIGNED_INT8:
|
||||
return 1;
|
||||
case CL10.CL_SNORM_INT16:
|
||||
case CL10.CL_UNORM_INT16:
|
||||
case CL10.CL_UNORM_SHORT_565:
|
||||
case CL10.CL_UNORM_SHORT_555:
|
||||
case CL10.CL_SIGNED_INT16:
|
||||
case CL10.CL_UNSIGNED_INT16:
|
||||
case CL10.CL_HALF_FLOAT:
|
||||
return 2;
|
||||
case CL10.CL_UNORM_INT_101010:
|
||||
case CL10.CL_SIGNED_INT32:
|
||||
case CL10.CL_UNSIGNED_INT32:
|
||||
case CL10.CL_FLOAT:
|
||||
return 4;
|
||||
default:
|
||||
throw new IllegalArgumentException("Invalid cl_channel_type specified: 0x" + Integer.toHexString(channelType).toUpperCase());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerBuffer;
|
||||
|
||||
/**
|
||||
* This class is a wrapper around a cl_command_queue pointer.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public final class CLCommandQueue extends CLObjectChild<CLContext> {
|
||||
|
||||
private final CLDevice device;
|
||||
|
||||
private final CLObjectRegistry<CLEvent> clEvents;
|
||||
|
||||
CLCommandQueue(final long pointer, final CLContext context, final CLDevice device) {
|
||||
super(pointer, context);
|
||||
if ( isValid() ) {
|
||||
this.device = device;
|
||||
this.clEvents = new CLObjectRegistryGlobal<CLEvent>(CLContext.clEventsGlobal);
|
||||
context.getCLCommandQueueRegistry().registerObject(this);
|
||||
} else {
|
||||
this.device = null;
|
||||
this.clEvents = null;
|
||||
}
|
||||
}
|
||||
|
||||
public CLDevice getCLDevice() {
|
||||
return device;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a CLEvent associated with this command-queue.
|
||||
*
|
||||
* @param id the event object id
|
||||
*
|
||||
* @return the CLEvent object
|
||||
*/
|
||||
public CLEvent getCLEvent(final long id) {
|
||||
return clEvents.getObject(id);
|
||||
}
|
||||
|
||||
// -------[ IMPLEMENTATION STUFF BELOW ]-------
|
||||
|
||||
CLObjectRegistry<CLEvent> getCLEventRegistry() { return clEvents; }
|
||||
|
||||
/**
|
||||
* Called from OpenCL methods that generate CLEvents.
|
||||
*
|
||||
* @param event a buffer containing a CLEvent pointer.
|
||||
*/
|
||||
void registerCLEvent(final PointerBuffer event) {
|
||||
if ( event != null )
|
||||
new CLEvent(event.get(event.position()), this);
|
||||
}
|
||||
|
||||
int release() {
|
||||
try {
|
||||
return super.release();
|
||||
} finally {
|
||||
if ( !isValid() )
|
||||
getParent().getCLCommandQueueRegistry().unregisterObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,135 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* This class is a wrapper around a cl_context pointer.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public final class CLContext extends CLObject {
|
||||
|
||||
private final CLObjectRegistry<CLCommandQueue> clCommandQueues;
|
||||
private final CLObjectRegistry<CLMem> clMems;
|
||||
private final CLObjectRegistry<CLSampler> clSamplers;
|
||||
private final CLObjectRegistry<CLProgram> clPrograms;
|
||||
private final CLObjectRegistry<CLEvent> clEvents;
|
||||
|
||||
/** Global registry for build callbacks. */
|
||||
static Map<Long, CLProgram> clProgramsGlobal = new HashMap<Long, CLProgram>();
|
||||
|
||||
/** Global registry for event callbacks. */
|
||||
static Map<Long, CLEvent> clEventsGlobal = new HashMap<Long, CLEvent>();
|
||||
|
||||
CLContext(final long pointer) {
|
||||
super(pointer);
|
||||
|
||||
if ( isValid() ) {
|
||||
clCommandQueues = new CLObjectRegistry<CLCommandQueue>();
|
||||
clMems = new CLObjectRegistry<CLMem>();
|
||||
clSamplers = new CLObjectRegistry<CLSampler>();
|
||||
clPrograms = new CLObjectRegistryGlobal<CLProgram>(clProgramsGlobal);
|
||||
clEvents = new CLObjectRegistryGlobal<CLEvent>(clEventsGlobal);
|
||||
} else {
|
||||
clCommandQueues = null;
|
||||
clMems = null;
|
||||
clSamplers = null;
|
||||
clPrograms = null;
|
||||
clEvents = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a CLCommandQueue associated with this context.
|
||||
*
|
||||
* @param id the command queue object id
|
||||
*
|
||||
* @return the CLCommandQueue object
|
||||
*/
|
||||
public CLCommandQueue getCLCommandQueue(final long id) { return clCommandQueues.getObject(id); }
|
||||
|
||||
/**
|
||||
* Returns a CLMem associated with this context.
|
||||
*
|
||||
* @param id the memory object id
|
||||
*
|
||||
* @return the CLMem object
|
||||
*/
|
||||
public CLMem getCLMem(final long id) { return clMems.getObject(id); }
|
||||
|
||||
/**
|
||||
* Returns a CLSampler associated with this context.
|
||||
*
|
||||
* @param id the sampler object id
|
||||
*
|
||||
* @return the CLSampler object
|
||||
*/
|
||||
public CLSampler getCLSampler(final long id) { return clSamplers.getObject(id); }
|
||||
|
||||
/**
|
||||
* Returns a CLProgram associated with this context.
|
||||
*
|
||||
* @param id the program object id
|
||||
*
|
||||
* @return the CLProgram object
|
||||
*/
|
||||
public CLProgram getCLProgram(final long id) { return clPrograms.getObject(id); }
|
||||
|
||||
/**
|
||||
* Returns a user CLEvent associated with this context.
|
||||
*
|
||||
* @param id the event object id
|
||||
*
|
||||
* @return the CLEvent object
|
||||
*/
|
||||
public CLEvent getCLEvent(final long id) { return clEvents.getObject(id); }
|
||||
|
||||
// -------[ IMPLEMENTATION STUFF BELOW ]-------
|
||||
|
||||
CLObjectRegistry<CLCommandQueue> getCLCommandQueueRegistry() { return clCommandQueues; }
|
||||
|
||||
CLObjectRegistry<CLMem> getCLMemRegistry() { return clMems; }
|
||||
|
||||
CLObjectRegistry<CLSampler> getCLSamplerRegistry() { return clSamplers; }
|
||||
|
||||
CLObjectRegistry<CLProgram> getCLProgramRegistry() { return clPrograms; }
|
||||
|
||||
CLObjectRegistry<CLEvent> getCLEventRegistry() { return clEvents; }
|
||||
|
||||
static CLProgram getCLProgramGlobal(final long id) { return clProgramsGlobal.get(id); }
|
||||
|
||||
static CLEvent getCLEventGlobal(final long id) { return clEventsGlobal.get(id); }
|
||||
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerWrapperAbstract;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
* Instances of this class can be used to receive OpenCL context error notifications.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public abstract class CLContextCallback extends PointerWrapperAbstract {
|
||||
|
||||
private final boolean custom;
|
||||
|
||||
protected CLContextCallback() {
|
||||
super(CallbackUtil.getContextCallback());
|
||||
custom = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor allows non-LWJGL implementations.
|
||||
*
|
||||
* @param pointer
|
||||
*/
|
||||
protected CLContextCallback(final long pointer) {
|
||||
super(pointer);
|
||||
|
||||
if ( pointer == 0 )
|
||||
throw new RuntimeException("Invalid callback function pointer specified.");
|
||||
|
||||
custom = true;
|
||||
}
|
||||
|
||||
final boolean isCustom() {
|
||||
return custom;
|
||||
}
|
||||
|
||||
/**
|
||||
* The callback method.
|
||||
*
|
||||
* @param errinfo the error description
|
||||
* @param private_info optional error data (may be null)
|
||||
*/
|
||||
protected abstract void handleMessage(String errinfo, ByteBuffer private_info);
|
||||
|
||||
}
|
|
@ -0,0 +1,191 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerBuffer;
|
||||
|
||||
/**
|
||||
* This class is a wrapper around a cl_device_id pointer.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public final class CLDevice extends CLObjectChild<CLDevice> {
|
||||
|
||||
private static final CLDeviceImpl impl = (CLDeviceImpl)CLPlatform.getClassInstance("org.lwjgl.opencl.CLDeviceImpl");
|
||||
|
||||
private final CLObjectRegistry<CLDevice> subCLDevices;
|
||||
|
||||
private Object caps;
|
||||
|
||||
public CLDevice(final long pointer) {
|
||||
this(pointer, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* EXT_device_fission constructor.
|
||||
*
|
||||
* @param pointer the sub-device pointer
|
||||
* @param parent the parent CLDevice
|
||||
*/
|
||||
CLDevice(final long pointer, final CLDevice parent) {
|
||||
super(pointer, parent);
|
||||
|
||||
if ( isValid() ) {
|
||||
subCLDevices = new CLObjectRegistry<CLDevice>();
|
||||
if ( parent != null )
|
||||
parent.subCLDevices.registerObject(this);
|
||||
} else
|
||||
subCLDevices = null;
|
||||
}
|
||||
|
||||
void setCapabilities(final Object caps) {
|
||||
this.caps = caps;
|
||||
}
|
||||
|
||||
Object getCapabilities() {
|
||||
return caps;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a sub-device of this device.
|
||||
*
|
||||
* @param id the sub-device object id
|
||||
*
|
||||
* @return the CLDevice object
|
||||
*/
|
||||
public CLDevice getSubCLDevice(final long id) { return subCLDevices.getObject(id); }
|
||||
|
||||
int retain() {
|
||||
if ( getParent() == null )
|
||||
return getReferenceCount(); // NO-OP, root devices cannot be retained
|
||||
|
||||
return super.retain();
|
||||
}
|
||||
|
||||
int release() {
|
||||
if ( getParent() == null )
|
||||
return getReferenceCount(); // NO-OP, root devices cannot be released
|
||||
|
||||
try {
|
||||
return super.release();
|
||||
} finally {
|
||||
if ( !isValid() )
|
||||
getParent().subCLDevices.unregisterObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
CLObjectRegistry<CLDevice> getSubCLDeviceRegistry() { return subCLDevices; }
|
||||
|
||||
/**
|
||||
* Called from clCreateSubDevicesEXT to register new sub-devices.
|
||||
*
|
||||
* @param devices a buffer containing CLDevice pointers.
|
||||
*/
|
||||
void registerSubCLDevices(final PointerBuffer devices) {
|
||||
for ( int i = devices.position(); i < devices.limit(); i++ ) {
|
||||
final long pointer = devices.get(i);
|
||||
if ( pointer != 0 )
|
||||
new CLDevice(pointer, this);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------[ HELPER METHODS ]---------------
|
||||
|
||||
/**
|
||||
* Returns the value of the specified String parameter.
|
||||
*
|
||||
* @param param_name the parameter
|
||||
*
|
||||
* @return the parameter value
|
||||
*/
|
||||
public String getInfoString(int param_name) {
|
||||
return impl.getInfoString(this, param_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the integer value of the specified parameter.
|
||||
*
|
||||
* @param param_name the parameter
|
||||
*
|
||||
* @return the parameter value
|
||||
*/
|
||||
public int getInfoInt(int param_name) {
|
||||
return impl.getInfoInt(this, param_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the boolean value of the specified parameter.
|
||||
*
|
||||
* @param param_name the parameter
|
||||
*
|
||||
* @return the parameter value
|
||||
*/
|
||||
public boolean getInfoBoolean(int param_name) {
|
||||
return impl.getInfoInt(this, param_name) != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the size_t value of the specified parameter.
|
||||
*
|
||||
* @param param_name the parameter
|
||||
*
|
||||
* @return the parameter value
|
||||
*/
|
||||
public long getInfoSize(int param_name) {
|
||||
return impl.getInfoSize(this, param_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the long value of the specified parameter. Can be used
|
||||
* for both cl_ulong and cl_bitfield parameters.
|
||||
*
|
||||
* @param param_name the parameter
|
||||
*
|
||||
* @return the parameter value
|
||||
*/
|
||||
public long getInfoLong(int param_name) {
|
||||
return impl.getInfoLong(this, param_name);
|
||||
}
|
||||
|
||||
/** CLDevice helper methods implementation interface. */
|
||||
interface CLDeviceImpl {
|
||||
|
||||
String getInfoString(CLDevice device, int param_name);
|
||||
|
||||
int getInfoInt(CLDevice device, int param_name);
|
||||
|
||||
long getInfoSize(CLDevice device, int param_name);
|
||||
|
||||
long getInfoLong(CLDevice device, int param_name);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerBuffer;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import static org.lwjgl.opencl.CL10.*;
|
||||
|
||||
/**
|
||||
* Implementation of CLDevice helper methods.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
final class CLDeviceImpl implements CLDevice.CLDeviceImpl {
|
||||
|
||||
CLDeviceImpl() {
|
||||
}
|
||||
|
||||
static CLDeviceCapabilities getCapabilities(final CLDevice device) {
|
||||
device.checkValid();
|
||||
|
||||
CLDeviceCapabilities caps = (CLDeviceCapabilities)device.getCapabilities();
|
||||
if ( caps == null )
|
||||
device.setCapabilities(caps = new CLDeviceCapabilities(device));
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
private static int getInfoBytes(final CLDevice device, final int param_name) {
|
||||
final PointerBuffer bytes = APIUtil.getBufferPointer();
|
||||
clGetDeviceInfo(device, param_name, null, bytes);
|
||||
return (int)bytes.get(0);
|
||||
}
|
||||
|
||||
public String getInfoString(final CLDevice device, final int param_name) {
|
||||
device.checkValid();
|
||||
|
||||
final int bytes = getInfoBytes(device, param_name);
|
||||
|
||||
final ByteBuffer versionBuffer = APIUtil.getBufferByte(bytes);
|
||||
clGetDeviceInfo(device, param_name, versionBuffer, null);
|
||||
|
||||
versionBuffer.limit(bytes - 1); // Exclude null-termination
|
||||
return APIUtil.getString(versionBuffer);
|
||||
}
|
||||
|
||||
public int getInfoInt(final CLDevice device, final int param_name) {
|
||||
device.checkValid();
|
||||
|
||||
final ByteBuffer versionBuffer = APIUtil.getBufferByte(4);
|
||||
clGetDeviceInfo(device, param_name, versionBuffer, null);
|
||||
|
||||
return versionBuffer.getInt(0);
|
||||
}
|
||||
|
||||
public long getInfoSize(final CLDevice device, final int param_name) {
|
||||
device.checkValid();
|
||||
|
||||
final PointerBuffer pointerBuffer = APIUtil.getBufferPointer();
|
||||
clGetDeviceInfo(device, param_name, pointerBuffer.getBuffer(), null);
|
||||
|
||||
return pointerBuffer.get(0);
|
||||
}
|
||||
|
||||
public long getInfoLong(final CLDevice device, final int param_name) {
|
||||
device.checkValid();
|
||||
|
||||
final ByteBuffer versionBuffer = APIUtil.getBufferByte(8);
|
||||
clGetDeviceInfo(device, param_name, versionBuffer, null);
|
||||
|
||||
return versionBuffer.getLong(0);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
/**
|
||||
* This class is a wrapper around a cl_mem pointer.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public final class CLEvent extends CLObjectChild<CLContext> {
|
||||
|
||||
private final CLCommandQueue queue;
|
||||
|
||||
CLEvent(final long pointer, final CLContext context) {
|
||||
this(pointer, context, null);
|
||||
}
|
||||
|
||||
CLEvent(final long pointer, final CLCommandQueue queue) {
|
||||
this(pointer, queue.getParent(), queue);
|
||||
}
|
||||
|
||||
CLEvent(final long pointer, final CLContext context, final CLCommandQueue queue) {
|
||||
super(pointer, context);
|
||||
if ( isValid() ) {
|
||||
this.queue = queue;
|
||||
if ( queue == null )
|
||||
context.getCLEventRegistry().registerObject(this);
|
||||
else
|
||||
queue.getCLEventRegistry().registerObject(this);
|
||||
} else
|
||||
this.queue = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the command-queue associated with this event. For
|
||||
* user events this method returns null.
|
||||
*
|
||||
* @return the command-queue or null if this is a user event
|
||||
*/
|
||||
public CLCommandQueue getCLCommandQueue() {
|
||||
return queue;
|
||||
}
|
||||
|
||||
int release() {
|
||||
try {
|
||||
return super.release();
|
||||
} finally {
|
||||
if ( !isValid() ) {
|
||||
if ( queue == null )
|
||||
getParent().getCLEventRegistry().unregisterObject(this);
|
||||
else
|
||||
queue.getCLEventRegistry().unregisterObject(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
/**
|
||||
* Instances of this class can be used to receive OpenCL memory object destruction notifications.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public abstract class CLEventCallback extends CLCallback {
|
||||
|
||||
protected CLEventCallback() {
|
||||
super(CallbackUtil.getEventCallback());
|
||||
}
|
||||
|
||||
/**
|
||||
* Called from native code.
|
||||
*
|
||||
* @param event_address the CLEvent object pointer
|
||||
*/
|
||||
private void handleMessage(long event_address, int event_command_exec_status) {
|
||||
handleMessage(CLContext.getCLEventGlobal(event_address), event_command_exec_status);
|
||||
}
|
||||
|
||||
/**
|
||||
* The callback method.
|
||||
*
|
||||
* @param event the CLEvent object
|
||||
*/
|
||||
protected abstract void handleMessage(CLEvent event, int event_command_exec_status);
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerWrapperAbstract;
|
||||
|
||||
/**
|
||||
* This class is a wrapper around an OpenCL extension function pointer.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
final class CLFunctionAddress extends PointerWrapperAbstract {
|
||||
|
||||
CLFunctionAddress(final long pointer) {
|
||||
super(pointer);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,113 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerWrapper;
|
||||
|
||||
/**
|
||||
* This class is a wrapper around a cl_kernel pointer.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public final class CLKernel extends CLObjectChild<CLProgram> {
|
||||
|
||||
private static final CLKernelImpl impl = (CLKernelImpl)CLPlatform.getClassInstance("org.lwjgl.opencl.CLKernelImpl");
|
||||
|
||||
CLKernel(final long pointer, final CLProgram program) {
|
||||
super(pointer, program);
|
||||
if ( isValid() )
|
||||
program.getCLKernelRegistry().registerObject(this);
|
||||
}
|
||||
|
||||
int release() {
|
||||
try {
|
||||
return super.release();
|
||||
} finally {
|
||||
if ( !isValid() )
|
||||
getParent().getCLKernelRegistry().unregisterObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
public CLKernel setArg(final int index, final byte value) {
|
||||
impl.setArg(this, index, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CLKernel setArg(final int index, final short value) {
|
||||
impl.setArg(this, index, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CLKernel setArg(final int index, final int value) {
|
||||
impl.setArg(this, index, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CLKernel setArg(final int index, final long value) {
|
||||
impl.setArg(this, index, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CLKernel setArg(final int index, final float value) {
|
||||
impl.setArg(this, index, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CLKernel setArg(final int index, final double value) {
|
||||
impl.setArg(this, index, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public CLKernel setArg(final int index, final PointerWrapper value) {
|
||||
impl.setArg(this, index, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
interface CLKernelImpl {
|
||||
|
||||
void setArg(CLKernel clKernel, int index, byte value);
|
||||
|
||||
void setArg(CLKernel clKernel, int index, short value);
|
||||
|
||||
void setArg(CLKernel clKernel, int index, int value);
|
||||
|
||||
void setArg(CLKernel clKernel, int index, long value);
|
||||
|
||||
void setArg(CLKernel clKernel, int index, float value);
|
||||
|
||||
void setArg(CLKernel clKernel, int index, double value);
|
||||
|
||||
void setArg(CLKernel clKernel, int index, PointerWrapper pointer);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.PointerWrapper;
|
||||
|
||||
import static org.lwjgl.opencl.CL10.*;
|
||||
|
||||
/**
|
||||
* Implementation of CLKernel helper methods.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
final class CLKernelImpl implements CLKernel.CLKernelImpl {
|
||||
|
||||
CLKernelImpl() {
|
||||
}
|
||||
|
||||
public void setArg(final CLKernel clKernel, final int index, final byte value) {
|
||||
clSetKernelArg(clKernel, index, 1, APIUtil.getBufferByte(1).put(0, value));
|
||||
}
|
||||
|
||||
public void setArg(final CLKernel clKernel, final int index, final short value) {
|
||||
clSetKernelArg(clKernel, index, 2, APIUtil.getBufferShort().put(0, value));
|
||||
}
|
||||
|
||||
public void setArg(final CLKernel clKernel, final int index, final int value) {
|
||||
clSetKernelArg(clKernel, index, 4, APIUtil.getBufferInt().put(0, value));
|
||||
}
|
||||
|
||||
public void setArg(final CLKernel clKernel, final int index, final long value) {
|
||||
clSetKernelArg(clKernel, index, 8, APIUtil.getBufferLong().put(0, value));
|
||||
}
|
||||
|
||||
public void setArg(final CLKernel clKernel, final int index, final float value) {
|
||||
clSetKernelArg(clKernel, index, 4, APIUtil.getBufferFloat().put(0, value));
|
||||
}
|
||||
|
||||
public void setArg(final CLKernel clKernel, final int index, final double value) {
|
||||
clSetKernelArg(clKernel, index, 8, APIUtil.getBufferDouble().put(0, value));
|
||||
}
|
||||
|
||||
public void setArg(final CLKernel clKernel, final int index, final PointerWrapper pointer) {
|
||||
clSetKernelArg(clKernel, index, PointerBuffer.getPointerSize(), APIUtil.getBufferPointer().put(0, pointer).getBuffer());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
/**
|
||||
* This class is a wrapper around a cl_mem pointer.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public final class CLMem extends CLObjectChild<CLContext> {
|
||||
|
||||
CLMem(final long pointer, final CLContext context) {
|
||||
super(pointer, context);
|
||||
if ( isValid() )
|
||||
context.getCLMemRegistry().registerObject(this);
|
||||
}
|
||||
|
||||
static CLMem create(final long pointer, final CLContext context) {
|
||||
CLMem clMem = context.getCLMemRegistry().getObject(pointer);
|
||||
if ( clMem == null )
|
||||
clMem = new CLMem(pointer, context);
|
||||
else
|
||||
clMem.retain();
|
||||
|
||||
return clMem;
|
||||
}
|
||||
|
||||
int release() {
|
||||
try {
|
||||
return super.release();
|
||||
} finally {
|
||||
if ( !isValid() )
|
||||
getParent().getCLMemRegistry().unregisterObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
/**
|
||||
* Instances of this class can be used to receive OpenCL memory object destruction notifications.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public abstract class CLMemObjectDestructorCallback extends CLCallback {
|
||||
|
||||
protected CLMemObjectDestructorCallback() {
|
||||
super(CallbackUtil.getMemObjectDestructorCallback());
|
||||
}
|
||||
|
||||
/**
|
||||
* The callback method.
|
||||
*
|
||||
* @param memobj id of the CLMem object that was destroyed
|
||||
*/
|
||||
protected abstract void handleMessage(long memobj);
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
* Instances of this class can be used to execute native kernels. clEnqueueNativeKernel will build
|
||||
* the its arguments automatically, in a way that allows <code>execute</code> to receive an array
|
||||
* of ByteBuffers, pointing to cl_mem objects in global memory. The ByteBuffer objects should not
|
||||
* be used outside the handleMessage method.
|
||||
*
|
||||
* @author Spasi
|
||||
* @see CL10#clEnqueueNativeKernel
|
||||
* @see #execute(java.nio.ByteBuffer[])
|
||||
*/
|
||||
public abstract class CLNativeKernel extends CLCallback {
|
||||
|
||||
protected CLNativeKernel() {
|
||||
super(CallbackUtil.getNativeKernelCallback());
|
||||
}
|
||||
|
||||
/**
|
||||
* Implement this method to execute an action on cl_mem objects in global memory.
|
||||
*
|
||||
* @param memobjs an array of ByteBuffers pointing to cl_mem global memory.
|
||||
*/
|
||||
protected abstract void execute(ByteBuffer[] memobjs);
|
||||
|
||||
}
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.LWJGLUtil;
|
||||
import org.lwjgl.PointerWrapperAbstract;
|
||||
|
||||
/**
|
||||
* Base class for all retainable OpenCL objects.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
abstract class CLObject extends PointerWrapperAbstract {
|
||||
|
||||
private int refCount;
|
||||
|
||||
CLObject(final long pointer) {
|
||||
super(pointer);
|
||||
|
||||
if ( pointer != 0 )
|
||||
this.refCount = 1;
|
||||
}
|
||||
|
||||
public final int getReferenceCount() {
|
||||
return refCount;
|
||||
}
|
||||
|
||||
public final boolean isValid() {
|
||||
return refCount > 0;
|
||||
}
|
||||
|
||||
public final long getPointer() {
|
||||
checkValid();
|
||||
return super.getPointer();
|
||||
}
|
||||
|
||||
final long getPointerUnsafe() {
|
||||
return super.getPointer();
|
||||
}
|
||||
|
||||
int retain() {
|
||||
checkValid();
|
||||
//System.out.println(getClass().getSimpleName() + " REF COUNT: " + pointer + " - " + (refCount + 1));
|
||||
return ++refCount;
|
||||
}
|
||||
|
||||
int release() {
|
||||
checkValid();
|
||||
//System.out.println(getClass().getSimpleName() + " REF COUNT: " + pointer + " - " + (refCount - 1));
|
||||
return --refCount;
|
||||
}
|
||||
|
||||
final void checkValid() {
|
||||
checkNull();
|
||||
if ( LWJGLUtil.DEBUG && refCount == 0 )
|
||||
throw new IllegalStateException("This CL object is invalid.");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.LWJGLUtil;
|
||||
|
||||
/**
|
||||
* Base class for all CLObjects that are associated with a parent CLObject.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
abstract class CLObjectChild<P extends CLObject> extends CLObject {
|
||||
|
||||
private final P parent;
|
||||
|
||||
CLObjectChild(final long pointer, final P parent) {
|
||||
super(pointer);
|
||||
|
||||
if ( LWJGLUtil.DEBUG && parent != null && !parent.isValid() )
|
||||
throw new IllegalStateException("The parent specified is not a valid CL object.");
|
||||
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public P getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package org.lwjgl.opencl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* A CLContextObject container.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
class CLObjectRegistry<T extends CLObjectChild> {
|
||||
|
||||
private Map<Long, T> registry;
|
||||
|
||||
CLObjectRegistry() {
|
||||
}
|
||||
|
||||
final boolean isEmpty() {
|
||||
return registry == null || registry.isEmpty();
|
||||
}
|
||||
|
||||
final T getObject(final long id) {
|
||||
return registry == null ? null : registry.get(id);
|
||||
}
|
||||
|
||||
final boolean hasObject(final long id) {
|
||||
return registry != null && registry.containsKey(id);
|
||||
}
|
||||
|
||||
final List<T> getAll() {
|
||||
return registry == null ? null : new ArrayList<T>(registry.values());
|
||||
}
|
||||
|
||||
void registerObject(final T object) {
|
||||
final Map<Long, T> map = getMap();
|
||||
final Long key = object.getPointer();
|
||||
|
||||
if ( !map.containsKey(key) )
|
||||
getMap().put(object.getPointer(), object);
|
||||
}
|
||||
|
||||
void unregisterObject(final T object) {
|
||||
getMap().remove(object.getPointerUnsafe());
|
||||
}
|
||||
|
||||
private Map<Long, T> getMap() {
|
||||
if ( registry == null )
|
||||
registry = new HashMap<Long, T>();
|
||||
|
||||
return registry;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* A CLObject registry that also registers/unregisters objects to/from a global registry.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
final class CLObjectRegistryGlobal<T extends CLObjectChild> extends CLObjectRegistry<T> {
|
||||
|
||||
private final Map<Long, T> globalRegistry;
|
||||
|
||||
CLObjectRegistryGlobal(final Map<Long, T> globalRegistry) {
|
||||
this.globalRegistry = globalRegistry;
|
||||
}
|
||||
|
||||
void registerObject(final T object) {
|
||||
super.registerObject(object);
|
||||
globalRegistry.put(object.getPointer(), object);
|
||||
}
|
||||
|
||||
void unregisterObject(final T object) {
|
||||
super.unregisterObject(object);
|
||||
globalRegistry.remove(object.getPointerUnsafe());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerWrapperAbstract;
|
||||
import org.lwjgl.opencl.api.Filter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This class is a wrapper around a cl_platform_id pointer.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public final class CLPlatform extends PointerWrapperAbstract {
|
||||
|
||||
private static final CLPlatformImpl impl = (CLPlatformImpl)getClassInstance("org.lwjgl.opencl.CLPlatformImpl");
|
||||
|
||||
private Object caps;
|
||||
|
||||
public CLPlatform(final long pointer) {
|
||||
super(pointer);
|
||||
}
|
||||
|
||||
void setCapabilities(final Object caps) {
|
||||
this.caps = caps;
|
||||
}
|
||||
|
||||
Object getCapabilities() {
|
||||
return caps;
|
||||
}
|
||||
|
||||
// ---------------[ HELPER METHODS ]---------------
|
||||
|
||||
static Object getClassInstance(final String className) {
|
||||
Object instance = null;
|
||||
try {
|
||||
instance = Class.forName(className).newInstance();
|
||||
} finally {
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<CLPlatform> getPlatforms() {
|
||||
return getPlatforms(null);
|
||||
}
|
||||
|
||||
public static List<CLPlatform> getPlatforms(final Filter<CLPlatform> filter) {
|
||||
return impl.getPlatforms(filter);
|
||||
}
|
||||
|
||||
public String getInfoString(int param_name) {
|
||||
return impl.getInfoString(this, param_name);
|
||||
}
|
||||
|
||||
public List<CLDevice> getDevices(final int device_type) {
|
||||
return getDevices(device_type, null);
|
||||
}
|
||||
|
||||
public List<CLDevice> getDevices(final int device_type, final Filter<CLDevice> filter) {
|
||||
return impl.getDevices(this, device_type, filter);
|
||||
}
|
||||
|
||||
/** CLPlatform helper methods implementation interface. */
|
||||
interface CLPlatformImpl {
|
||||
|
||||
List<CLPlatform> getPlatforms(Filter<CLPlatform> filter);
|
||||
|
||||
String getInfoString(CLPlatform platform, int param_name);
|
||||
|
||||
List<CLDevice> getDevices(CLPlatform platform, int device_type, final Filter<CLDevice> filter);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.opencl.api.Filter;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.lwjgl.opencl.CL10.*;
|
||||
|
||||
/**
|
||||
* Implementation of CLPlatform helper methods.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
final class CLPlatformImpl implements CLPlatform.CLPlatformImpl {
|
||||
|
||||
CLPlatformImpl() {
|
||||
}
|
||||
|
||||
static CLPlatformCapabilities getCapabilities(final CLPlatform platform) {
|
||||
platform.checkNull();
|
||||
|
||||
CLPlatformCapabilities caps = (CLPlatformCapabilities)platform.getCapabilities();
|
||||
if ( caps == null )
|
||||
platform.setCapabilities(caps = new CLPlatformCapabilities(platform));
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
public List<CLPlatform> getPlatforms(final Filter<CLPlatform> filter) {
|
||||
final IntBuffer numBuffer = APIUtil.getBufferInt();
|
||||
clGetPlatformIDs(null, numBuffer);
|
||||
|
||||
final int num_platforms = numBuffer.get(0);
|
||||
if ( num_platforms == 0 )
|
||||
return null;
|
||||
|
||||
final PointerBuffer platformIDs = APIUtil.getBufferPointer(num_platforms);
|
||||
clGetPlatformIDs(platformIDs, null);
|
||||
|
||||
final List<CLPlatform> platforms = new ArrayList<CLPlatform>(num_platforms);
|
||||
for ( int i = 0; i < num_platforms; i++ ) {
|
||||
final CLPlatform platform = new CLPlatform(platformIDs.get(i));
|
||||
if ( filter == null || filter.accept(platform) )
|
||||
platforms.add(platform);
|
||||
}
|
||||
|
||||
return platforms.size() == 0 ? null : platforms;
|
||||
}
|
||||
|
||||
public String getInfoString(final CLPlatform platform, final int param_name) {
|
||||
platform.checkNull();
|
||||
|
||||
final PointerBuffer bytes = APIUtil.getBufferPointer();
|
||||
clGetPlatformInfo(platform, param_name, null, bytes);
|
||||
|
||||
final ByteBuffer versionBuffer = APIUtil.getBufferByte((int)bytes.get(0));
|
||||
clGetPlatformInfo(platform, param_name, versionBuffer, null);
|
||||
|
||||
versionBuffer.limit((int)bytes.get(0) - 1); // Exclude null-termination
|
||||
return APIUtil.getString(versionBuffer);
|
||||
}
|
||||
|
||||
public List<CLDevice> getDevices(final CLPlatform platform, final int device_type, final Filter<CLDevice> filter) {
|
||||
platform.checkNull();
|
||||
|
||||
final IntBuffer numBuffer = APIUtil.getBufferInt();
|
||||
clGetDeviceIDs(platform, device_type, null, numBuffer);
|
||||
|
||||
final int num_devices = numBuffer.get(0);
|
||||
if ( num_devices == 0 )
|
||||
return null;
|
||||
|
||||
final PointerBuffer deviceIDs = APIUtil.getBufferPointer(num_devices);
|
||||
clGetDeviceIDs(platform, device_type, deviceIDs, null);
|
||||
|
||||
final List<CLDevice> devices = new ArrayList<CLDevice>(num_devices);
|
||||
for ( int i = 0; i < num_devices; i++ ) {
|
||||
final CLDevice device = new CLDevice(deviceIDs.get(i));
|
||||
if ( filter == null || filter.accept(device) )
|
||||
devices.add(device);
|
||||
}
|
||||
|
||||
return devices.size() == 0 ? null : devices;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerBuffer;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* This class is a wrapper around a cl_program pointer.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public final class CLProgram extends CLObjectChild<CLContext> {
|
||||
|
||||
private final CLObjectRegistry<CLKernel> clKernels;
|
||||
|
||||
CLProgram(final long pointer, final CLContext context) {
|
||||
super(pointer, context);
|
||||
|
||||
if ( isValid() ) {
|
||||
context.getCLProgramRegistry().registerObject(this);
|
||||
clKernels = new CLObjectRegistry<CLKernel>();
|
||||
} else
|
||||
clKernels = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a CLKernel associated with this program.
|
||||
*
|
||||
* @param id the kernel id
|
||||
*
|
||||
* @return the CLKernel object
|
||||
*/
|
||||
public CLKernel getCLKernel(final long id) {
|
||||
return clKernels.getObject(id);
|
||||
}
|
||||
|
||||
// -------[ IMPLEMENTATION STUFF BELOW ]-------
|
||||
|
||||
CLObjectRegistry<CLKernel> getCLKernelRegistry() { return clKernels; }
|
||||
|
||||
/**
|
||||
* Called from clCreateKernelsInProgram to register new CLKernels.
|
||||
*
|
||||
* @param kernels a buffer containing CLKernel pointers.
|
||||
*/
|
||||
void registerCLKernels(final PointerBuffer kernels) {
|
||||
for ( int i = kernels.position(); i < kernels.limit(); i++ ) {
|
||||
final long pointer = kernels.get(i);
|
||||
if ( pointer != 0 )
|
||||
new CLKernel(pointer, this);
|
||||
}
|
||||
}
|
||||
|
||||
int release() {
|
||||
try {
|
||||
return super.release();
|
||||
} finally {
|
||||
if ( !isValid() )
|
||||
getParent().getCLProgramRegistry().unregisterObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
/**
|
||||
* This class is a wrapper around a cl_sampler pointer.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public final class CLSampler extends CLObjectChild<CLContext> {
|
||||
|
||||
CLSampler(final long pointer, final CLContext context) {
|
||||
super(pointer, context);
|
||||
if ( isValid() )
|
||||
context.getCLSamplerRegistry().registerObject(this);
|
||||
}
|
||||
|
||||
int release() {
|
||||
try {
|
||||
return super.release();
|
||||
} finally {
|
||||
if ( !isValid() )
|
||||
getParent().getCLSamplerRegistry().unregisterObject(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,200 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Utility class that handles OpenCL API callbacks.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
final class CallbackUtil {
|
||||
|
||||
private static final Map<CLContext, Long> contextUserData = new HashMap<CLContext, Long>();
|
||||
|
||||
private CallbackUtil() {}
|
||||
|
||||
/**
|
||||
* Creates a new global reference to the specified Object.
|
||||
*
|
||||
* @param obj the Object
|
||||
*
|
||||
* @return the GlobalRef memory address or 0 if the Object is null.
|
||||
*/
|
||||
static long createGlobalRef(final Object obj) {
|
||||
return obj == null ? 0 : ncreateGlobalRef(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new global reference to the specified Object.
|
||||
*
|
||||
* @param obj the Object
|
||||
*
|
||||
* @return the GlobalRef memory address.
|
||||
*/
|
||||
private static native long ncreateGlobalRef(Object obj);
|
||||
|
||||
/**
|
||||
* Deletes a global reference.
|
||||
*
|
||||
* @param ref the GlobalRef memory address.
|
||||
*/
|
||||
private static native void deleteGlobalRef(long ref);
|
||||
|
||||
/**
|
||||
* Deletes the global reference represented by user_data if an OpenCL error occured.
|
||||
*
|
||||
* @param errcode the error code
|
||||
* @param user_data the GlobalRef memory address
|
||||
*/
|
||||
static void checkCallback(final int errcode, final long user_data) {
|
||||
if ( errcode != 0x0 && user_data != 0 )
|
||||
deleteGlobalRef(user_data);
|
||||
}
|
||||
|
||||
/* [ Context callback functionality ]
|
||||
This is a little weird, so here's an explanation of what's happening for future reference:
|
||||
Before making the clCreateContext call we create a global reference to the CLContextCallback object (using JNI's NewGlobalRef function).
|
||||
We pass that global reference to the user_data parameter of clCreateContext. If clCreateContext returns anything but CL_SUCCESS, we
|
||||
immediately destroy the global reference to avoid the memory leak. If the new context was created successfully, we associate the context
|
||||
with the global reference in the contextUserData HashMap. On a future call to clReleaseContext, we clear that association and destroy the
|
||||
global reference (if the reference count is 0).
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns the memory address of the native function we pass to clCreateContext(FromType).
|
||||
*
|
||||
* @return the callback function address
|
||||
*/
|
||||
static native long getContextCallback();
|
||||
|
||||
/**
|
||||
* Associates the specified CLContext with the specified global reference. If the context
|
||||
* is invalid, the global reference is deleted. NO-OP if user_data is 0.
|
||||
*
|
||||
* @param context the CLContext to register
|
||||
* @param user_data the global reference pointer
|
||||
*/
|
||||
static void registerCallback(final CLContext context, final long user_data) {
|
||||
if ( context.getPointer() == 0 ) {
|
||||
if ( user_data != 0 )
|
||||
deleteGlobalRef(user_data);
|
||||
return;
|
||||
}
|
||||
|
||||
if ( user_data != 0 )
|
||||
contextUserData.put(context, user_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrements the specified context's reference count, clears its association
|
||||
* with a CLContextCallback object if it exists and deletes the corresponding
|
||||
* global reference.
|
||||
*
|
||||
* @param context the CLContext to unregister
|
||||
*/
|
||||
static void unregisterCallback(final CLContext context) {
|
||||
if ( context.release() > 0 )
|
||||
return;
|
||||
|
||||
final Long user_data = contextUserData.remove(context);
|
||||
|
||||
if ( user_data != null )
|
||||
deleteGlobalRef(user_data);
|
||||
}
|
||||
|
||||
/* [ Other callback functionality ]
|
||||
The other callbacks are simpler. We create the GlobalRef before passing the callback,
|
||||
we delete it when we receive the callback call.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns the memory address of the native function we pass to clSetMemObjectDestructorCallback.
|
||||
*
|
||||
* @return the callback function address
|
||||
*/
|
||||
static native long getMemObjectDestructorCallback();
|
||||
|
||||
/**
|
||||
* Returns the memory address of the native function we pass to clBuildProgram.
|
||||
*
|
||||
* @return the callback function address
|
||||
*/
|
||||
static native long getBuildProgramCallback();
|
||||
|
||||
/**
|
||||
* Returns the memory address of the native function we pass to clEnqueueNativeKernel.
|
||||
*
|
||||
* @return the callback function address
|
||||
*/
|
||||
static native long getNativeKernelCallback();
|
||||
|
||||
/**
|
||||
* Returns the memory address of the native function we pass to clSetEventCallback.
|
||||
*
|
||||
* @return the callback function address
|
||||
*/
|
||||
static native long getEventCallback();
|
||||
|
||||
/**
|
||||
* Returns the memory address of the native function we pass to clCreateContext(FromType),
|
||||
* when <code>APPLEContextLoggingUtil.SYSTEM_LOG_CALLBACK</code> is used.
|
||||
*
|
||||
* @return the callback function address
|
||||
*
|
||||
* @see APPLEContextLoggingUtil#SYSTEM_LOG_CALLBACK
|
||||
*/
|
||||
static native long getLogMessageToSystemLogAPPLE();
|
||||
|
||||
/**
|
||||
* Returns the memory address of the native function we pass to clCreateContext(FromType),
|
||||
* when <code>APPLEContextLoggingUtil.STD_OUT_CALLBACK</code> is used.
|
||||
*
|
||||
* @return the callback function address
|
||||
*
|
||||
* @see APPLEContextLoggingUtil#STD_OUT_CALLBACK
|
||||
*/
|
||||
static native long getLogMessageToStdoutAPPLE();
|
||||
|
||||
/**
|
||||
* Returns the memory address of the native function we pass to clCreateContext(FromType),
|
||||
* when <code>APPLEContextLoggingUtil.STD_ERR_CALLBACK</code> is used.
|
||||
*
|
||||
* @return the callback function address
|
||||
*
|
||||
* @see APPLEContextLoggingUtil#STD_ERR_CALLBACK
|
||||
*/
|
||||
static native long getLogMessageToStderrAPPLE();
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
public class OpenCLException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public OpenCLException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public OpenCLException(final String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public OpenCLException(final String message, final Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public OpenCLException(final Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* 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.opencl;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Utility methods for OpenCL
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public final class Util {
|
||||
|
||||
/** Maps OpenCL error token values to their String representations. */
|
||||
private static final Map<Integer, String> CL_ERROR_TOKENS = new HashMap<Integer, String>(64);
|
||||
|
||||
static {
|
||||
APIUtil.getClassTokens(new Class[] {
|
||||
CL10.class, CL11.class,
|
||||
KHRGLSharing.class, KHRICD.class,
|
||||
APPLEGLSharing.class,
|
||||
EXTDeviceFission.class,
|
||||
}, CL_ERROR_TOKENS, new APIUtil.TokenFilter() {
|
||||
public boolean accept(final Field field, final int value) {
|
||||
return value < 0; // Currently, all OpenCL errors have negative values.
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private Util() {
|
||||
}
|
||||
|
||||
public static void checkCLError(final int errcode) {
|
||||
if ( errcode != CL10.CL_SUCCESS )
|
||||
throwCLError(errcode);
|
||||
}
|
||||
|
||||
private static void throwCLError(final int errcode) {
|
||||
String errname = CL_ERROR_TOKENS.get(errcode);
|
||||
if ( errname == null )
|
||||
errname = "UNKNOWN";
|
||||
throw new OpenCLException("Error Code: " + errname + " (0x" + Integer.toHexString(errcode).toUpperCase() + ")");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl.api;
|
||||
|
||||
/**
|
||||
* Simple filter interface.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public interface Filter<T> {
|
||||
|
||||
/**
|
||||
* Returns true if the specified object passes the filter.
|
||||
*
|
||||
* @param object the object to test
|
||||
*
|
||||
* @return true if the object is accepted
|
||||
*/
|
||||
boolean accept(T object);
|
||||
|
||||
}
|
|
@ -31,6 +31,8 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.PointerWrapperAbstract;
|
||||
|
||||
/**
|
||||
* Instances of this class are needed to use the callback functionality of the AMD_debug_output extension.
|
||||
* A debug context must be current before creating instances of this class. Users of this class may provide
|
||||
|
@ -39,7 +41,7 @@ package org.lwjgl.opengl;
|
|||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public final class AMDDebugOutputCallback implements PointerWrapper {
|
||||
public final class AMDDebugOutputCallback extends PointerWrapperAbstract {
|
||||
|
||||
/** Severity levels. */
|
||||
private static final int GL_DEBUG_SEVERITY_HIGH_AMD = 0x9146,
|
||||
|
@ -56,7 +58,7 @@ public final class AMDDebugOutputCallback implements PointerWrapper {
|
|||
GL_DEBUG_CATEGORY_APPLICATION_AMD = 0x914F,
|
||||
GL_DEBUG_CATEGORY_OTHER_AMD = 0x9150;
|
||||
|
||||
private final long pointer;
|
||||
private final Handler handler;
|
||||
|
||||
/**
|
||||
* Creates an AMDDebugOutputCallback with a default callback handler.
|
||||
|
@ -120,30 +122,31 @@ public final class AMDDebugOutputCallback implements PointerWrapper {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates an AMDDebugOutputCallback with the specified callback handlers.
|
||||
* Creates an AMDDebugOutputCallback with the specified callback handler.
|
||||
* The handler's {@code handleMessage} method will be called whenever
|
||||
* debug output is generated by the GL.
|
||||
*
|
||||
* @param handler the callback handler
|
||||
*/
|
||||
public AMDDebugOutputCallback(final Handler handler) {
|
||||
super(getFunctionPointer());
|
||||
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
Handler getHandler() {
|
||||
return handler;
|
||||
}
|
||||
|
||||
private static long getFunctionPointer() {
|
||||
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.AMDDebugOutputUtil").getMethod("registerHandler", new Class[] { Handler.class }).invoke(null, new Object[] { handler });
|
||||
// Call reflectively so that we can compile this class for the Generator.
|
||||
return ((Long)Class.forName("org.lwjgl.opengl.CallbackUtil").getDeclaredMethod("getDebugOutputCallbackAMD", null).invoke(null, null)).longValue();
|
||||
} 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 AMD_debug_output notifications. */
|
||||
public interface Handler {
|
||||
|
||||
|
|
|
@ -1,59 +0,0 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.opengl.AMDDebugOutputCallback.Handler;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
/**
|
||||
* This class handles AMDDebugOutputCallback.Handler registration and notification.
|
||||
* We could have put this in AMDDebugOutputCallback, but we need to compile it for
|
||||
* the generator. Registration is done reflectively in the AMDDebugOutputCallback
|
||||
* constructor.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
final class AMDDebugOutputUtil {
|
||||
|
||||
private static final Map handlers = new WeakHashMap();
|
||||
|
||||
private AMDDebugOutputUtil() {}
|
||||
|
||||
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_AMD_debug_output )
|
||||
throw new IllegalStateException("AMD_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 id the message ID
|
||||
* @param category the message category
|
||||
* @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 id, final int category, 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(id, category, severity, message);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -38,7 +38,7 @@ import java.nio.charset.Charset;
|
|||
import java.nio.charset.CharsetEncoder;
|
||||
|
||||
/** @author spasi */
|
||||
final class APIUtils {
|
||||
final class APIUtil {
|
||||
|
||||
private static final int INITIAL_BUFFER_SIZE = 256;
|
||||
private static final int INITIAL_LENGTHS_SIZE = 4;
|
||||
|
@ -67,7 +67,7 @@ final class APIUtils {
|
|||
|
||||
private static CharsetEncoder encoder = Charset.forName("US-ASCII").newEncoder();
|
||||
|
||||
private APIUtils() {
|
||||
private APIUtil() {
|
||||
}
|
||||
|
||||
private static char[] getArray(final int size) {
|
|
@ -31,6 +31,8 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.PointerWrapperAbstract;
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
@ -39,7 +41,7 @@ package org.lwjgl.opengl;
|
|||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public final class ARBDebugOutputCallback implements PointerWrapper {
|
||||
public final class ARBDebugOutputCallback extends PointerWrapperAbstract {
|
||||
|
||||
/** Severity levels. */
|
||||
private static final int
|
||||
|
@ -65,7 +67,7 @@ public final class ARBDebugOutputCallback implements PointerWrapper {
|
|||
GL_DEBUG_TYPE_PERFORMANCE_ARB = 0x8250,
|
||||
GL_DEBUG_TYPE_OTHER_ARB = 0x8251;
|
||||
|
||||
private final long pointer;
|
||||
private final Handler handler;
|
||||
|
||||
/**
|
||||
* Creates an ARBDebugOutputCallback with a default callback handler.
|
||||
|
@ -147,35 +149,36 @@ public final class ARBDebugOutputCallback implements PointerWrapper {
|
|||
}
|
||||
|
||||
/**
|
||||
* Creates an ARBDebugOutputCallback with the specified callback handlers.
|
||||
* Creates an ARBDebugOutputCallback with the specified callback handler.
|
||||
* 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) {
|
||||
super(getFunctionPointer());
|
||||
|
||||
this.handler = handler;
|
||||
}
|
||||
|
||||
Handler getHandler() {
|
||||
return handler;
|
||||
}
|
||||
|
||||
private static long getFunctionPointer() {
|
||||
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 });
|
||||
// Call reflectively so that we can compile this class for the Generator.
|
||||
return ((Long)Class.forName("org.lwjgl.opengl.CallbackUtil").getDeclaredMethod("getDebugOutputCallbackARB", null).invoke(null, null)).longValue();
|
||||
} 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.
|
||||
* This method will be called when an ARB_debug_output message is generated.
|
||||
*
|
||||
* @param id the message ID
|
||||
* @param source the message source
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -33,6 +33,7 @@ package org.lwjgl.opengl;
|
|||
|
||||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.LWJGLUtil;
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.Sys;
|
||||
|
||||
import java.awt.*;
|
||||
|
@ -258,6 +259,14 @@ public class AWTGLCanvas extends Canvas implements DrawableLWJGL, ComponentListe
|
|||
}
|
||||
}
|
||||
|
||||
public final void setCLSharingProperties(final PointerBuffer properties) throws LWJGLException {
|
||||
synchronized ( SYNC_LOCK ) {
|
||||
if ( context == null )
|
||||
throw new IllegalStateException("Canvas not yet displayable");
|
||||
context.setCLSharingProperties(properties);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this to do initialising of the context.
|
||||
* It will be called once from paint(), immediately after
|
||||
|
|
|
@ -2,6 +2,7 @@ package org.lwjgl.opengl;
|
|||
|
||||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.LWJGLUtil;
|
||||
import org.lwjgl.PointerBuffer;
|
||||
|
||||
/**
|
||||
* @author Spasi
|
||||
|
@ -73,6 +74,13 @@ abstract class AbstractDrawable implements DrawableLWJGL {
|
|||
}
|
||||
}
|
||||
|
||||
public void setCLSharingProperties(final PointerBuffer properties) throws LWJGLException {
|
||||
synchronized ( GlobalLock.lock ) {
|
||||
checkDestroyed();
|
||||
context.setCLSharingProperties(properties);
|
||||
}
|
||||
}
|
||||
|
||||
protected final void checkDestroyed() {
|
||||
if ( context == null )
|
||||
throw new IllegalStateException("The Drawable has no context available.");
|
||||
|
|
|
@ -0,0 +1,157 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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 java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Utility class that handles OpenGL API callbacks.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
final class CallbackUtil {
|
||||
|
||||
/** Context -> Long */
|
||||
private static final Map contextUserParamsARB = new HashMap();
|
||||
/** Context -> Long */
|
||||
private static final Map contextUserParamsAMD = new HashMap();
|
||||
|
||||
private CallbackUtil() {}
|
||||
|
||||
/**
|
||||
* Creates a new global reference to the specified Object.
|
||||
*
|
||||
* @param obj the Object
|
||||
*
|
||||
* @return the GlobalRef memory address or 0 if the Object is null.
|
||||
*/
|
||||
static long createGlobalRef(final Object obj) {
|
||||
return obj == null ? 0 : ncreateGlobalRef(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new global reference to the specified Object.
|
||||
*
|
||||
* @param obj the Object
|
||||
*
|
||||
* @return the GlobalRef memory address.
|
||||
*/
|
||||
private static native long ncreateGlobalRef(Object obj);
|
||||
|
||||
/**
|
||||
* Deletes a global reference.
|
||||
*
|
||||
* @param ref the GlobalRef memory address.
|
||||
*/
|
||||
private static native void deleteGlobalRef(long ref);
|
||||
|
||||
// --------- [ XXX_debug_output ] ---------
|
||||
|
||||
/**
|
||||
* Associates the current OpenGL context with the specified global reference. If there
|
||||
* is no context current, the global reference is deleted and an exception is thrown.
|
||||
* Any previous callback registrations will be cleared.
|
||||
*
|
||||
* @param userParam the global reference pointer
|
||||
*/
|
||||
private static void registerContextCallback(final long userParam, final Map contextUserData) {
|
||||
Context context = Context.getCurrentContext();
|
||||
if ( context == null ) {
|
||||
deleteGlobalRef(userParam);
|
||||
throw new IllegalStateException("No context is current.");
|
||||
}
|
||||
|
||||
final Long userParam_old = (Long)contextUserData.remove(context);
|
||||
if ( userParam_old != null )
|
||||
deleteGlobalRef(userParam_old.longValue());
|
||||
|
||||
if ( userParam != 0 )
|
||||
contextUserData.put(context, new Long(userParam));
|
||||
}
|
||||
|
||||
/**
|
||||
* Releases references to any callbacks associated with the specified GL context.
|
||||
*
|
||||
* @param context the Context to unregister
|
||||
*/
|
||||
static void unregisterCallbacks(final Context context) {
|
||||
Long userParam = (Long)contextUserParamsARB.remove(context);
|
||||
if ( userParam != null )
|
||||
deleteGlobalRef(userParam.longValue());
|
||||
|
||||
userParam = (Long)contextUserParamsAMD.remove(context);
|
||||
if ( userParam != null )
|
||||
deleteGlobalRef(userParam.longValue());
|
||||
}
|
||||
|
||||
// --------- [ ARB_debug_output ] ---------
|
||||
|
||||
/**
|
||||
* Returns the memory address of the native function we pass to glDebugMessageCallbackARB.
|
||||
*
|
||||
* @return the callback function address
|
||||
*/
|
||||
static native long getDebugOutputCallbackARB();
|
||||
|
||||
/**
|
||||
* Associates the current OpenGL context with the specified global reference. If there
|
||||
* is no context current, the global reference is deleted and an exception is thrown.
|
||||
* Any previous callback registrations will be cleared.
|
||||
*
|
||||
* @param userParam the global reference pointer
|
||||
*/
|
||||
static void registerContextCallbackARB(final long userParam) {
|
||||
registerContextCallback(userParam, contextUserParamsARB);
|
||||
}
|
||||
|
||||
// --------- [ AMD_debug_output ] ---------
|
||||
|
||||
/**
|
||||
* Returns the memory address of the native function we pass to glDebugMessageCallbackAMD.
|
||||
*
|
||||
* @return the callback function address
|
||||
*/
|
||||
static native long getDebugOutputCallbackAMD();
|
||||
|
||||
/**
|
||||
* Associates the current OpenGL context with the specified global reference. If there
|
||||
* is no context current, the global reference is deleted and an exception is thrown.
|
||||
* Any previous callback registrations will be cleared.
|
||||
*
|
||||
* @param userParam the global reference pointer
|
||||
*/
|
||||
static void registerContextCallbackAMD(final long userParam) {
|
||||
registerContextCallback(userParam, contextUserParamsAMD);
|
||||
}
|
||||
|
||||
}
|
|
@ -33,7 +33,9 @@ package org.lwjgl.opengl;
|
|||
|
||||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.LWJGLUtil;
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.Sys;
|
||||
import org.lwjgl.opencl.KHRGLSharing;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
@ -52,10 +54,10 @@ import java.nio.IntBuffer;
|
|||
final class Context {
|
||||
|
||||
/** The platform specific implementation of context methods */
|
||||
private final static ContextImplementation implementation;
|
||||
private static final ContextImplementation implementation;
|
||||
|
||||
/** The current Context */
|
||||
private final static ThreadLocal current_context_local = new ThreadLocal();
|
||||
private static final ThreadLocal current_context_local = new ThreadLocal();
|
||||
|
||||
/** Handle to the native GL rendering context */
|
||||
private final ByteBuffer handle;
|
||||
|
@ -206,6 +208,7 @@ final class Context {
|
|||
try {
|
||||
releaseDrawable();
|
||||
implementation.destroy(peer_info, handle);
|
||||
CallbackUtil.unregisterCallbacks(this);
|
||||
destroyed = true;
|
||||
thread = null;
|
||||
GLContext.unloadOpenGLLibrary();
|
||||
|
@ -256,4 +259,26 @@ final class Context {
|
|||
throw new OpenGLException(error);
|
||||
}
|
||||
|
||||
public synchronized void setCLSharingProperties(final PointerBuffer properties) throws LWJGLException {
|
||||
final ByteBuffer peer_handle = peer_info.lockAndGetHandle();
|
||||
try {
|
||||
switch ( LWJGLUtil.getPlatform() ) {
|
||||
case LWJGLUtil.PLATFORM_WINDOWS:
|
||||
final WindowsContextImplementation implWindows = (WindowsContextImplementation)implementation;
|
||||
properties.put(KHRGLSharing.CL_GL_CONTEXT_KHR).put(implWindows.getHGLRC(handle));
|
||||
properties.put(KHRGLSharing.CL_WGL_HDC_KHR).put(implWindows.getHDC(peer_handle));
|
||||
break;
|
||||
case LWJGLUtil.PLATFORM_LINUX:
|
||||
final LinuxContextImplementation implLinux = (LinuxContextImplementation)implementation;
|
||||
properties.put(KHRGLSharing.CL_GL_CONTEXT_KHR).put(implLinux.getGLXContext(handle));
|
||||
properties.put(KHRGLSharing.CL_GLX_DISPLAY_KHR).put(implLinux.getDisplay(peer_handle));
|
||||
break;
|
||||
default:
|
||||
throw new UnsupportedOperationException("CL/GL context sharing is not supposed on this platform.");
|
||||
}
|
||||
} finally {
|
||||
peer_info.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -57,6 +57,8 @@ import java.nio.IntBuffer;
|
|||
public final class ContextAttribs {
|
||||
|
||||
// Same values for GLX & WGL
|
||||
private static final int CONTEXT_ES2_PROFILE_BIT_EXT = 0x00000004;
|
||||
|
||||
private static final int CONTEXT_ROBUST_ACCESS_BIT_ARB = 0x00000004;
|
||||
private static final int CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB = 0x8256;
|
||||
private static final int
|
||||
|
@ -74,6 +76,7 @@ public final class ContextAttribs {
|
|||
|
||||
private boolean profileCore;
|
||||
private boolean profileCompatibility;
|
||||
private boolean profileES;
|
||||
|
||||
private boolean loseContextOnReset;
|
||||
|
||||
|
@ -106,6 +109,7 @@ public final class ContextAttribs {
|
|||
|
||||
this.profileCore = attribs.profileCore;
|
||||
this.profileCompatibility = attribs.profileCompatibility;
|
||||
this.profileES = attribs.profileES;
|
||||
|
||||
this.loseContextOnReset = attribs.loseContextOnReset;
|
||||
}
|
||||
|
@ -138,6 +142,10 @@ public final class ContextAttribs {
|
|||
return profileCompatibility;
|
||||
}
|
||||
|
||||
public boolean isProfileES() {
|
||||
return profileES;
|
||||
}
|
||||
|
||||
public ContextAttribs withLayer(final int layerPlane) {
|
||||
if ( layerPlane < 0 )
|
||||
throw new IllegalArgumentException("Invalid layer plane specified: " + layerPlane);
|
||||
|
@ -198,6 +206,19 @@ public final class ContextAttribs {
|
|||
return attribs;
|
||||
}
|
||||
|
||||
public ContextAttribs withProfileES(final boolean profileES) {
|
||||
if ( !(majorVersion == 2 && minorVersion == 0) )
|
||||
throw new IllegalArgumentException("The OpenGL ES profiles is only supported for OpenGL version 2.0.");
|
||||
|
||||
if ( profileES == this.profileES )
|
||||
return this;
|
||||
|
||||
final ContextAttribs attribs = new ContextAttribs(this);
|
||||
attribs.profileES = profileES;
|
||||
|
||||
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
|
||||
|
@ -254,6 +275,8 @@ public final class ContextAttribs {
|
|||
profileMask |= implementation.getProfileCoreBit();
|
||||
else if ( profileCompatibility )
|
||||
profileMask |= implementation.getProfileCompatibilityBit();
|
||||
else if ( profileES )
|
||||
profileMask |= CONTEXT_ES2_PROFILE_BIT_EXT;
|
||||
if ( 0 < profileMask )
|
||||
attribCount++;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.PointerBuffer;
|
||||
|
||||
/**
|
||||
* The Drawable interface describes an OpenGL drawable with an associated
|
||||
|
@ -62,4 +63,15 @@ public interface Drawable {
|
|||
/** Destroys the Drawable. */
|
||||
void destroy();
|
||||
|
||||
/**
|
||||
* Sets the appropriate khr_gl_sharing properties in the target <code>PointerBuffer</code>,
|
||||
* so that if it is used in a <code>clCreateContext(FromType)</code> call, the created CL
|
||||
* context will be sharing objects with this <code>Drawable</code>'s GL context. After a
|
||||
* call to this method, the target buffer position will have advanced by 2 to 4 positions,
|
||||
* depending on the implementation.
|
||||
*
|
||||
* @param properties The target properties buffer. It must have at least 4 positions remaining.
|
||||
*/
|
||||
void setCLSharingProperties(PointerBuffer properties) throws LWJGLException;
|
||||
|
||||
}
|
||||
|
|
|
@ -31,19 +31,17 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.PointerWrapperAbstract;
|
||||
|
||||
/**
|
||||
* This class is a wrapper around a GLsync pointer.
|
||||
*
|
||||
* @author spasi <spasi@users.sourceforge.net>
|
||||
*/
|
||||
public final class GLSync implements PointerWrapper {
|
||||
|
||||
private final long sync;
|
||||
public final class GLSync extends PointerWrapperAbstract {
|
||||
|
||||
GLSync(final long sync) {
|
||||
this.sync = sync;
|
||||
}
|
||||
|
||||
public long getPointer() {
|
||||
return sync;
|
||||
super(sync);
|
||||
}
|
||||
|
||||
}
|
|
@ -59,6 +59,10 @@ final class LinuxContextImplementation implements ContextImplementation {
|
|||
|
||||
private static native ByteBuffer nCreate(ByteBuffer peer_handle, IntBuffer attribs, ByteBuffer shared_context_handle) throws LWJGLException;
|
||||
|
||||
native long getGLXContext(ByteBuffer context_handle);
|
||||
|
||||
native long getDisplay(ByteBuffer peer_info_handle);
|
||||
|
||||
public void releaseDrawable(ByteBuffer context_handle) throws LWJGLException {
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,10 @@ final class WindowsContextImplementation implements ContextImplementation {
|
|||
|
||||
private static native ByteBuffer nCreate(ByteBuffer peer_handle, IntBuffer attribs_handle, ByteBuffer shared_context_handle) throws LWJGLException;
|
||||
|
||||
native long getHGLRC(ByteBuffer context_handle);
|
||||
|
||||
native long getHDC(ByteBuffer peer_info_handle);
|
||||
|
||||
public void swapBuffers() throws LWJGLException {
|
||||
Context current_context = Context.getCurrentContext();
|
||||
if ( current_context == null )
|
||||
|
|
|
@ -0,0 +1,185 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.test.opencl;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.opencl.*;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.List;
|
||||
|
||||
import static org.lwjgl.opencl.CL10.*;
|
||||
import static org.lwjgl.opencl.CL11.*;
|
||||
|
||||
/** Basic OpenCL test. */
|
||||
public class HelloOpenCL {
|
||||
|
||||
public HelloOpenCL() {
|
||||
}
|
||||
|
||||
protected void execute() {
|
||||
try {
|
||||
CL.create();
|
||||
|
||||
final List<CLPlatform> platforms = CLPlatform.getPlatforms();
|
||||
for ( CLPlatform platform : platforms ) {
|
||||
System.out.println("\n-------------------------");
|
||||
System.out.println("NEW PLATFORM: " + platform.getPointer());
|
||||
System.out.println(CLCapabilities.getPlatformCapabilities(platform));
|
||||
System.out.println("-------------------------");
|
||||
printPlatformInfo(platform, "CL_PLATFORM_PROFILE", CL_PLATFORM_PROFILE);
|
||||
printPlatformInfo(platform, "CL_PLATFORM_VERSION", CL_PLATFORM_VERSION);
|
||||
printPlatformInfo(platform, "CL_PLATFORM_NAME", CL_PLATFORM_NAME);
|
||||
printPlatformInfo(platform, "CL_PLATFORM_VENDOR", CL_PLATFORM_VENDOR);
|
||||
System.out.println("");
|
||||
|
||||
final PointerBuffer ctxProps = BufferUtils.createPointerBuffer(3);
|
||||
ctxProps.put(CL_CONTEXT_PLATFORM).put(platform.getPointer()).put(0).flip();
|
||||
|
||||
final List<CLDevice> devices = platform.getDevices(CL_DEVICE_TYPE_ALL);
|
||||
for ( CLDevice device : devices ) {
|
||||
System.out.println("\n\tNEW DEVICE: " + device.getPointer());
|
||||
System.out.println(CLCapabilities.getDeviceCapabilities(device));
|
||||
System.out.println("\t-------------------------");
|
||||
|
||||
System.out.println("\tCL_DEVICE_TYPE = " + device.getInfoInt(CL_DEVICE_TYPE));
|
||||
System.out.println("\tCL_DEVICE_VENDOR_ID = " + device.getInfoInt(CL_DEVICE_VENDOR_ID));
|
||||
System.out.println("\tCL_DEVICE_MAX_COMPUTE_UNITS = " + device.getInfoInt(CL_DEVICE_MAX_COMPUTE_UNITS));
|
||||
System.out.println("\tCL_DEVICE_MAX_WORK_ITEM_DIMENSIONS = " + device.getInfoInt(CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS));
|
||||
//CL10.clGetDeviceInfo(device, CL10.CL_DEVICE_MAX_WORK_ITEM_SIZES, info, size_ret);
|
||||
//System.out.println("\tCL_DEVICE_MAX_WORK_ITEM_SIZES = " + info.getInt(0));
|
||||
System.out.println("\tCL_DEVICE_MAX_WORK_GROUP_SIZE = " + device.getInfoSize(CL_DEVICE_MAX_WORK_GROUP_SIZE));
|
||||
System.out.println("\tCL_DEVICE_MAX_CLOCK_FREQUENCY = " + device.getInfoInt(CL_DEVICE_MAX_CLOCK_FREQUENCY));
|
||||
System.out.println("\tCL_DEVICE_ADDRESS_BITS = " + device.getInfoInt(CL_DEVICE_ADDRESS_BITS));
|
||||
System.out.println("\tCL_DEVICE_AVAILABLE = " + device.getInfoBoolean(CL_DEVICE_AVAILABLE));
|
||||
System.out.println("\tCL_DEVICE_COMPILER_AVAILABLE = " + device.getInfoBoolean(CL_DEVICE_COMPILER_AVAILABLE));
|
||||
|
||||
printDeviceInfo(device, "CL_DEVICE_NAME", CL_DEVICE_NAME);
|
||||
printDeviceInfo(device, "CL_DEVICE_VENDOR", CL_DEVICE_VENDOR);
|
||||
printDeviceInfo(device, "CL_DRIVER_VERSION", CL_DRIVER_VERSION);
|
||||
printDeviceInfo(device, "CL_DEVICE_PROFILE", CL_DEVICE_PROFILE);
|
||||
printDeviceInfo(device, "CL_DEVICE_VERSION", CL_DEVICE_VERSION);
|
||||
printDeviceInfo(device, "CL_DEVICE_OPENCL_C_VERSION", CL_DEVICE_OPENCL_C_VERSION);
|
||||
|
||||
CLContext context = clCreateContext(ctxProps, device, new CLContextCallback() {
|
||||
protected void handleMessage(final String errinfo, final ByteBuffer private_info) {
|
||||
System.out.println("IN CLContextCallback :: " + errinfo);
|
||||
}
|
||||
}, null);
|
||||
|
||||
CLMem buffer = clCreateBuffer(context, CL_MEM_READ_ONLY, 128, null);
|
||||
|
||||
clSetMemObjectDestructorCallback(buffer, new CLMemObjectDestructorCallback() {
|
||||
protected void handleMessage(final long memobj) {
|
||||
System.out.println("FIRST Buffer destructed: " + memobj);
|
||||
}
|
||||
});
|
||||
|
||||
clSetMemObjectDestructorCallback(buffer, new CLMemObjectDestructorCallback() {
|
||||
protected void handleMessage(final long memobj) {
|
||||
System.out.println("SECOND Buffer destructed: " + memobj);
|
||||
}
|
||||
});
|
||||
|
||||
ByteBuffer bufferCreateInfo = BufferUtils.createByteBuffer(2 * PointerBuffer.getPointerSize());
|
||||
PointerBuffer.put(bufferCreateInfo, 0);
|
||||
PointerBuffer.put(bufferCreateInfo, 64);
|
||||
bufferCreateInfo.flip();
|
||||
CLMem subbuffer = clCreateSubBuffer(buffer, CL10.CL_MEM_READ_ONLY, CL11.CL_BUFFER_CREATE_TYPE_REGION, bufferCreateInfo, null);
|
||||
|
||||
clSetMemObjectDestructorCallback(subbuffer, new CLMemObjectDestructorCallback() {
|
||||
protected void handleMessage(final long memobj) {
|
||||
System.out.println("Sub Buffer destructed: " + memobj);
|
||||
}
|
||||
});
|
||||
|
||||
clRetainMemObject(buffer);
|
||||
|
||||
final long exec_caps = device.getInfoLong(CL_DEVICE_EXECUTION_CAPABILITIES);
|
||||
if ( (exec_caps & CL_EXEC_NATIVE_KERNEL) == CL_EXEC_NATIVE_KERNEL ) {
|
||||
System.out.println("-TRYING TO EXEC NATIVE KERNEL-");
|
||||
final CLCommandQueue queue = clCreateCommandQueue(context, device, 0, null);
|
||||
|
||||
clEnqueueNativeKernel(queue, new CLNativeKernel() {
|
||||
protected void execute(final ByteBuffer[] memobjs) {
|
||||
if ( memobjs == null )
|
||||
System.out.println("OK, it's null");
|
||||
else {
|
||||
System.out.println("memobjs = " + memobjs.length);
|
||||
for ( int k = 0; k < memobjs.length; k++ ) {
|
||||
System.out.println("memobjs[" + k + "].remaining() = " + memobjs[k].remaining());
|
||||
for ( int l = memobjs[k].position(); l < memobjs[k].limit(); l++ ) {
|
||||
memobjs[k].put(l, (byte)l);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}, new CLMem[] { buffer }, new long[] { 128 }, null, null);
|
||||
|
||||
clFinish(queue);
|
||||
}
|
||||
|
||||
clReleaseMemObject(buffer);
|
||||
clReleaseContext(context);
|
||||
}
|
||||
}
|
||||
} catch (LWJGLException le) {
|
||||
die("Init", le.getMessage());
|
||||
}
|
||||
|
||||
CL.destroy();
|
||||
}
|
||||
|
||||
private static void printPlatformInfo(final CLPlatform platform, final String param_name, final int param) {
|
||||
System.out.println("\t" + param_name + " = " + platform.getInfoString(param));
|
||||
}
|
||||
|
||||
private static void printDeviceInfo(final CLDevice device, final String param_name, final int param) {
|
||||
System.out.println("\t" + param_name + " = " + device.getInfoString(param));
|
||||
}
|
||||
|
||||
private static void die(String kind, String description) {
|
||||
System.out.println(kind + " error " + description + " occured");
|
||||
}
|
||||
|
||||
/**
|
||||
* main entry point
|
||||
*
|
||||
* @param args String array containing arguments
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
new HelloOpenCL().execute();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,675 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.test.opencl.gl;
|
||||
|
||||
import org.lwjgl.BufferUtils;
|
||||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
import org.lwjgl.opencl.*;
|
||||
import org.lwjgl.opencl.api.Filter;
|
||||
import org.lwjgl.opengl.Display;
|
||||
import org.lwjgl.opengl.DisplayMode;
|
||||
import org.lwjgl.opengl.Drawable;
|
||||
import org.lwjgl.util.Color;
|
||||
import org.lwjgl.util.ReadableColor;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.IntBuffer;
|
||||
import java.util.List;
|
||||
|
||||
import static java.lang.Math.*;
|
||||
import static org.lwjgl.opencl.CL10.*;
|
||||
import static org.lwjgl.opencl.CL10GL.*;
|
||||
import static org.lwjgl.opengl.GL11.*;
|
||||
import static org.lwjgl.opengl.GL12.*;
|
||||
import static org.lwjgl.opengl.GL15.*;
|
||||
import static org.lwjgl.opengl.GL21.*;
|
||||
|
||||
/*
|
||||
THIS DEMO USES CODE PORTED FROM JogAmp.org
|
||||
Original code: http://github.com/mbien/jocl-demos
|
||||
Original author: Michael Bien
|
||||
|
||||
___ ___ ___
|
||||
/ /\ / /\ ___ / /\ http://jocl.jogamp.org/
|
||||
/ /:/ / /::\ /__/\ / /::\ a http://jogamp.org/ project.
|
||||
/__/::\ / /:/\:\ \ \:\ / /:/\:\
|
||||
\__\/\:\ / /:/~/::\ \ \:\ / /:/~/::\
|
||||
\ \:\ /__/:/ /:/\:\ ___ \__\:\/__/:/ /:/\:\
|
||||
\__\:\\ \:\/:/__\//__/\ | |:|\ \:\/:/__\/
|
||||
/ /:/ \ \::/ \ \:\| |:| \ \::/
|
||||
/__/:/ \ \:\ \ \:\__|:| \ \:\
|
||||
\__\/ \ \:\ \__\::::/ \ \:\
|
||||
\__\/ ~~~~ \__\/
|
||||
___ ___ ___ ___ ___
|
||||
/ /\ / /\ / /\ /__/\ / /\
|
||||
/ /::\ / /::\ / /:/_ \ \:\ / /:/
|
||||
/ /:/\:\ / /:/\:\ / /:/ /\ \ \:\ / /:/ ___ ___
|
||||
/ /:/ \:\ / /:/~/:// /:/ /:/_ _____\__\:\ / /:/ ___ /__/\ / /\
|
||||
/__/:/ \__\:\/__/:/ /://__/:/ /:/ /\/__/::::::::\/__/:/ / /\\ \:\ / /:/
|
||||
\ \:\ / /:/\ \:\/:/ \ \:\/:/ /:/\ \:\~~\~~\/\ \:\ / /:/ \ \:\ /:/
|
||||
\ \:\ /:/ \ \::/ \ \::/ /:/ \ \:\ ~~~ \ \:\ /:/ \ \:\/:/
|
||||
\ \:\/:/ \ \:\ \ \:\/:/ \ \:\ \ \:\/:/ \ \::/
|
||||
\ \::/ \ \:\ \ \::/ \ \:\ \ \::/ \__\/
|
||||
\__\/ \__\/ \__\/ \__\/ \__\/
|
||||
|
||||
_____ ___ ___ ___ ___
|
||||
/ /::\ / /\ /__/\ / /\ / /\
|
||||
/ /:/\:\ / /:/_ | |::\ / /::\ / /:/_
|
||||
/ /:/ \:\ / /:/ /\ | |:|:\ / /:/\:\ / /:/ /\
|
||||
/__/:/ \__\:| / /:/ /:/_ __|__|:|\:\ / /:/ \:\ / /:/ /::\
|
||||
\ \:\ / /:/ /__/:/ /:/ /\ /__/::::| \:\ /__/:/ \__\:\ /__/:/ /:/\:\
|
||||
\ \:\ /:/ \ \:\/:/ /:/ \ \:\~~\__\/ \ \:\ / /:/ \ \:\/:/~/:/
|
||||
\ \:\/:/ \ \::/ /:/ \ \:\ \ \:\ /:/ \ \::/ /:/
|
||||
\ \::/ \ \:\/:/ \ \:\ \ \:\/:/ \__\/ /:/
|
||||
\__\/ \ \::/ \ \:\ \ \::/ /__/:/
|
||||
\__\/ \__\/ \__\/ \__\/
|
||||
*/
|
||||
|
||||
/**
|
||||
* Computes the Mandelbrot set with OpenCL using multiple GPUs and renders the result with OpenGL.
|
||||
* A shared PBO is used as storage for the fractal image.<br/>
|
||||
* http://en.wikipedia.org/wiki/Mandelbrot_set
|
||||
* <p>
|
||||
* controls:<br/>
|
||||
* keys 1-9 control parallelism level<br/>
|
||||
* space enables/disables slice seperator<br/>
|
||||
* 'd' toggles between 32/64bit floatingpoint precision<br/>
|
||||
* mouse/mousewheel to drag and zoom<br/>
|
||||
* 'Home' to reset the viewport<br/>
|
||||
* </p>
|
||||
*
|
||||
* @author Michael Bien, Spasi
|
||||
*/
|
||||
public class DemoFractal {
|
||||
|
||||
// max number of used GPUs
|
||||
private static final int MAX_PARALLELISM_LEVEL = 8;
|
||||
|
||||
// max per pixel iterations to compute the fractal
|
||||
private static final int MAX_ITERATIONS = 500;
|
||||
|
||||
private CLContext clContext;
|
||||
private CLCommandQueue[] queues;
|
||||
private CLKernel[] kernels;
|
||||
private CLProgram[] programs;
|
||||
|
||||
private CLMem[] pboBuffers;
|
||||
private IntBuffer pboIDs;
|
||||
|
||||
private CLMem[] colorMap;
|
||||
private IntBuffer[] colorMapBuffer;
|
||||
|
||||
private final PointerBuffer kernel2DGlobalWorkSize;
|
||||
|
||||
private int width = 0;
|
||||
private int height = 0;
|
||||
|
||||
private double minX = -2f;
|
||||
private double minY = -1.2f;
|
||||
private double maxX = 0.6f;
|
||||
private double maxY = 1.3f;
|
||||
|
||||
private boolean dragging;
|
||||
private double dragX;
|
||||
private double dragY;
|
||||
private double dragMinX;
|
||||
private double dragMinY;
|
||||
private double dragMaxX;
|
||||
private double dragMaxY;
|
||||
|
||||
private int mouseX;
|
||||
private int mouseY;
|
||||
|
||||
private int slices;
|
||||
|
||||
private boolean drawSeparator;
|
||||
private boolean doublePrecision = true;
|
||||
private boolean buffersInitialized;
|
||||
private boolean rebuild;
|
||||
|
||||
private boolean run = true;
|
||||
|
||||
public DemoFractal(int width, int height) {
|
||||
kernel2DGlobalWorkSize = BufferUtils.createPointerBuffer(2);
|
||||
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
private void run() {
|
||||
long startTime = System.currentTimeMillis() + 5000;
|
||||
long fps = 0;
|
||||
|
||||
while ( run ) {
|
||||
if ( !Display.isVisible() )
|
||||
Thread.yield();
|
||||
|
||||
handleIO();
|
||||
display();
|
||||
|
||||
Display.update();
|
||||
if ( Display.isCloseRequested() )
|
||||
break;
|
||||
|
||||
if ( startTime > System.currentTimeMillis() ) {
|
||||
fps++;
|
||||
} else {
|
||||
long timeUsed = 5000 + (startTime - System.currentTimeMillis());
|
||||
startTime = System.currentTimeMillis() + 5000;
|
||||
System.out.println(fps + " frames in 5 seconds = " + (fps / (timeUsed / 1000f)));
|
||||
fps = 0;
|
||||
}
|
||||
}
|
||||
|
||||
CL.destroy();
|
||||
Display.destroy();
|
||||
}
|
||||
|
||||
private void handleIO() {
|
||||
if ( Keyboard.getNumKeyboardEvents() != 0 ) {
|
||||
while ( Keyboard.next() ) {
|
||||
if ( Keyboard.getEventKeyState() )
|
||||
continue;
|
||||
|
||||
final int key = Keyboard.getEventKey();
|
||||
|
||||
if ( Keyboard.KEY_1 <= key && key <= Keyboard.KEY_8 ) {
|
||||
int number = key - Keyboard.KEY_1 + 1;
|
||||
slices = min(number, min(queues.length, MAX_PARALLELISM_LEVEL));
|
||||
System.out.println("NEW PARALLELISM LEVEL: " + slices);
|
||||
buffersInitialized = false;
|
||||
} else {
|
||||
switch ( Keyboard.getEventKey() ) {
|
||||
case Keyboard.KEY_SPACE:
|
||||
drawSeparator = !drawSeparator;
|
||||
System.out.println("SEPARATOR DRAWING IS NOW: " + (drawSeparator ? "ON" : "OFF"));
|
||||
break;
|
||||
case Keyboard.KEY_D:
|
||||
doublePrecision = !doublePrecision;
|
||||
System.out.println("DOUBLE PRECISION IS NOW: " + (doublePrecision ? "ON" : "OFF"));
|
||||
rebuild = true;
|
||||
break;
|
||||
case Keyboard.KEY_HOME:
|
||||
minX = -2f;
|
||||
minY = -1.2f;
|
||||
maxX = 0.6f;
|
||||
maxY = 1.3f;
|
||||
break;
|
||||
case Keyboard.KEY_ESCAPE:
|
||||
run = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while ( Mouse.next() ) {
|
||||
final int eventBtn = Mouse.getEventButton();
|
||||
|
||||
final int x = Mouse.getX();
|
||||
final int y = Mouse.getY();
|
||||
|
||||
if ( Mouse.isButtonDown(0) && (x != mouseX || y != mouseY) ) {
|
||||
if ( !dragging ) {
|
||||
dragging = true;
|
||||
|
||||
dragX = mouseX;
|
||||
dragY = mouseY;
|
||||
|
||||
dragMinX = minX;
|
||||
dragMinY = minY;
|
||||
dragMaxX = maxX;
|
||||
dragMaxY = maxY;
|
||||
}
|
||||
|
||||
double offsetX = (x - dragX) * (maxX - minX) / width;
|
||||
double offsetY = (y - dragY) * (maxY - minY) / height;
|
||||
|
||||
minX = dragMinX - offsetX;
|
||||
minY = dragMinY - offsetY;
|
||||
|
||||
maxX = dragMaxX - offsetX;
|
||||
maxY = dragMaxY - offsetY;
|
||||
} else {
|
||||
if ( dragging )
|
||||
dragging = false;
|
||||
|
||||
if ( eventBtn == -1 ) {
|
||||
final int dwheel = Mouse.getEventDWheel();
|
||||
if ( dwheel != 0 ) {
|
||||
double scale = dwheel > 0 ? 0.05 : -0.05;
|
||||
|
||||
double deltaX = scale * (maxX - minX);
|
||||
double deltaY = scale * (maxY - minY);
|
||||
|
||||
// offset for "zoom to cursor"
|
||||
double offsetX = (x / (double)width - 0.5) * deltaX * 2.0;
|
||||
double offsetY = (y / (double)height - 0.5) * deltaY * 2.0;
|
||||
|
||||
minX += deltaX + offsetX;
|
||||
minY += deltaY - offsetY;
|
||||
|
||||
maxX += -deltaX + offsetX;
|
||||
maxY += -deltaY - offsetY;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mouseX = x;
|
||||
mouseY = y;
|
||||
}
|
||||
}
|
||||
|
||||
public void init() {
|
||||
try {
|
||||
Display.setDisplayMode(new DisplayMode(width, height));
|
||||
Display.setTitle("OpenCL Fractal Demo");
|
||||
Display.create();
|
||||
CL.create();
|
||||
} catch (LWJGLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
try {
|
||||
initCL(Display.getDrawable());
|
||||
} catch (Exception e) {
|
||||
if ( clContext != null )
|
||||
clReleaseContext(clContext);
|
||||
Display.destroy();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
Display.setSwapInterval(0);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
initView(Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());
|
||||
|
||||
initPBO();
|
||||
glFinish();
|
||||
|
||||
setKernelConstants();
|
||||
}
|
||||
|
||||
private void initCL(Drawable drawable) throws Exception {
|
||||
// Find a platform
|
||||
List<CLPlatform> platforms = CLPlatform.getPlatforms();
|
||||
if ( platforms == null )
|
||||
throw new RuntimeException("No OpenCL platforms found.");
|
||||
|
||||
final CLPlatform platform = platforms.get(0); // just grab the first one
|
||||
|
||||
// Find devices with GL sharing support
|
||||
final Filter<CLDevice> glSharingFilter = new Filter<CLDevice>() {
|
||||
public boolean accept(final CLDevice device) {
|
||||
final CLDeviceCapabilities caps = CLCapabilities.getDeviceCapabilities(device);
|
||||
return caps.CL_KHR_gl_sharing;
|
||||
}
|
||||
};
|
||||
List<CLDevice> devices = platform.getDevices(CL_DEVICE_TYPE_GPU, glSharingFilter);
|
||||
if ( devices == null ) {
|
||||
devices = platform.getDevices(CL_DEVICE_TYPE_CPU, glSharingFilter);
|
||||
if ( devices == null )
|
||||
throw new RuntimeException("No OpenCL devices found.");
|
||||
}
|
||||
|
||||
// Create the context
|
||||
final PointerBuffer deviceIDs = BufferUtils.createPointerBuffer(devices.size());
|
||||
for ( CLDevice device : devices )
|
||||
deviceIDs.put(device);
|
||||
deviceIDs.flip();
|
||||
|
||||
final PointerBuffer contextProps = BufferUtils.createPointerBuffer(2 + 4 + 1);
|
||||
contextProps.put(CL_CONTEXT_PLATFORM).put(platform);
|
||||
|
||||
drawable.setCLSharingProperties(contextProps); // Enable GL sharing
|
||||
|
||||
contextProps.put(0);
|
||||
contextProps.flip();
|
||||
clContext = clCreateContext(contextProps, deviceIDs, null, null);
|
||||
|
||||
slices = min(devices.size(), MAX_PARALLELISM_LEVEL);
|
||||
|
||||
// create command queues for every GPU, setup colormap and init kernels
|
||||
queues = new CLCommandQueue[slices];
|
||||
kernels = new CLKernel[slices];
|
||||
colorMap = new CLMem[slices];
|
||||
colorMapBuffer = new IntBuffer[slices];
|
||||
|
||||
for ( int i = 0; i < slices; i++ ) {
|
||||
colorMapBuffer[i] = BufferUtils.createIntBuffer(32 * 2);
|
||||
colorMap[i] = clCreateBuffer(clContext, CL_MEM_READ_ONLY, colorMapBuffer[i].capacity() * 4, null);
|
||||
colorMap[i].checkNull();
|
||||
|
||||
initColorMap(colorMapBuffer[i], 32, Color.BLUE, Color.GREEN, Color.RED);
|
||||
|
||||
// create command queue and upload color map buffer on each used device
|
||||
queues[i] = clCreateCommandQueue(clContext, devices.get(i), CL_QUEUE_PROFILING_ENABLE, null);
|
||||
queues[i].checkNull();
|
||||
clEnqueueWriteBuffer(queues[i], colorMap[i], CL_TRUE, 0, colorMapBuffer[i], null, null); // blocking upload
|
||||
|
||||
}
|
||||
|
||||
// check if we have 64bit FP support on all devices
|
||||
// if yes we can use only one program for all devices + one kernel per device.
|
||||
// if not we will have to create (at least) one program for 32 and one for 64bit devices.
|
||||
// since there are different vendor extensions for double FP we use one program per device.
|
||||
// (OpenCL spec is not very clear about this usecases)
|
||||
boolean all64bit = true;
|
||||
for ( CLDevice device : devices ) {
|
||||
if ( !isDoubleFPAvailable(device) ) {
|
||||
all64bit = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// load program(s)
|
||||
programs = new CLProgram[all64bit ? 1 : slices];
|
||||
|
||||
buildPrograms();
|
||||
}
|
||||
|
||||
private void createPrograms() throws IOException {
|
||||
final String source = getProgramSource("Mandelbrot.cl");
|
||||
for ( int i = 0; i < programs.length; i++ )
|
||||
programs[i] = clCreateProgramWithSource(clContext, source, null);
|
||||
}
|
||||
|
||||
private String getProgramSource(final String file) throws IOException {
|
||||
InputStream source = getClass().getResourceAsStream(file);
|
||||
if ( source == null ) // dev-mode
|
||||
source = new FileInputStream("src/java/org/lwjgl/test/opencl/gl/" + file);
|
||||
final BufferedReader reader = new BufferedReader(new InputStreamReader(source));
|
||||
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
String line;
|
||||
try {
|
||||
while ( (line = reader.readLine()) != null )
|
||||
sb.append(line).append("\n");
|
||||
} finally {
|
||||
source.close();
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static void initColorMap(IntBuffer colorMap, int stepSize, ReadableColor... colors) {
|
||||
for ( int n = 0; n < colors.length - 1; n++ ) {
|
||||
ReadableColor color = colors[n];
|
||||
int r0 = color.getRed();
|
||||
int g0 = color.getGreen();
|
||||
int b0 = color.getBlue();
|
||||
|
||||
color = colors[n + 1];
|
||||
int r1 = color.getRed();
|
||||
int g1 = color.getGreen();
|
||||
int b1 = color.getBlue();
|
||||
|
||||
int deltaR = r1 - r0;
|
||||
int deltaG = g1 - g0;
|
||||
int deltaB = b1 - b0;
|
||||
|
||||
for ( int step = 0; step < stepSize; step++ ) {
|
||||
float alpha = (float)step / (stepSize - 1);
|
||||
int r = (int)(r0 + alpha * deltaR);
|
||||
int g = (int)(g0 + alpha * deltaG);
|
||||
int b = (int)(b0 + alpha * deltaB);
|
||||
colorMap.put((r << 16) | (g << 8) | (b << 0));
|
||||
}
|
||||
}
|
||||
colorMap.rewind();
|
||||
}
|
||||
|
||||
private static void initView(int width, int height) {
|
||||
glViewport(0, 0, width, height);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
glOrtho(0.0, width, 0.0, height, 0.0, 1.0);
|
||||
}
|
||||
|
||||
private void initPBO() {
|
||||
if ( pboBuffers == null ) {
|
||||
pboBuffers = new CLMem[slices];
|
||||
pboIDs = BufferUtils.createIntBuffer(slices);
|
||||
} else {
|
||||
for ( CLMem pboBuffer : pboBuffers )
|
||||
clReleaseMemObject(pboBuffer);
|
||||
glDeleteBuffers(pboIDs);
|
||||
}
|
||||
|
||||
glGenBuffers(pboIDs);
|
||||
|
||||
// setup one empty PBO per slice
|
||||
for ( int i = 0; i < slices; i++ ) {
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pboIDs.get(i));
|
||||
glBufferData(GL_PIXEL_UNPACK_BUFFER, width * height * 4 / slices, GL_STREAM_DRAW);
|
||||
|
||||
pboBuffers[i] = clCreateFromGLBuffer(clContext, CL_MEM_WRITE_ONLY, pboIDs.get(i), null);
|
||||
}
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
|
||||
buffersInitialized = true;
|
||||
}
|
||||
|
||||
private void buildPrograms() {
|
||||
/*
|
||||
* workaround: The driver keeps using the old binaries for some reason.
|
||||
* to solve this we simple create a new program and release the old.
|
||||
* however rebuilding programs should be possible -> remove when drivers are fixed.
|
||||
* (again: the spec is not very clear about this kind of usages)
|
||||
*/
|
||||
if ( programs[0] != null ) {
|
||||
for ( CLProgram program : programs )
|
||||
clReleaseProgram(program);
|
||||
}
|
||||
|
||||
try {
|
||||
createPrograms();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
// disable 64bit floating point math if not available
|
||||
for ( int i = 0; i < programs.length; i++ ) {
|
||||
final CLDevice device = queues[i].getCLDevice();
|
||||
|
||||
final StringBuilder options = new StringBuilder("-cl-fast-relaxed-math");
|
||||
final CLDeviceCapabilities caps = CLCapabilities.getDeviceCapabilities(device);
|
||||
if ( doublePrecision && isDoubleFPAvailable(device) ) {
|
||||
//cl_khr_fp64
|
||||
options.append(" -D DOUBLE_FP");
|
||||
|
||||
//amd's verson of double precision floating point math
|
||||
if ( !caps.CL_KHR_fp64 && caps.CL_AMD_fp64 )
|
||||
options.append(" -D AMD_FP");
|
||||
}
|
||||
|
||||
System.out.println("COMPILER OPTIONS: " + options);
|
||||
|
||||
clBuildProgram(programs[i], device, options, null);
|
||||
}
|
||||
|
||||
rebuild = false;
|
||||
|
||||
for ( int i = 0; i < kernels.length; i++ ) {
|
||||
// init kernel with constants
|
||||
kernels[i] = clCreateKernel(programs[min(i, programs.length)], "mandelbrot", null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// init kernels with constants
|
||||
|
||||
private void setKernelConstants() {
|
||||
for ( int i = 0; i < slices; i++ ) {
|
||||
kernels[i]
|
||||
.setArg(6, pboBuffers[i])
|
||||
.setArg(7, colorMap[i])
|
||||
.setArg(8, colorMapBuffer[i].capacity())
|
||||
.setArg(9, MAX_ITERATIONS);
|
||||
}
|
||||
}
|
||||
|
||||
// rendering cycle
|
||||
|
||||
public void display() {
|
||||
// make sure GL does not use our objects before we start computeing
|
||||
glFinish();
|
||||
|
||||
if ( !buffersInitialized ) {
|
||||
initPBO();
|
||||
setKernelConstants();
|
||||
}
|
||||
|
||||
if ( rebuild ) {
|
||||
buildPrograms();
|
||||
setKernelConstants();
|
||||
}
|
||||
compute(doublePrecision);
|
||||
|
||||
render();
|
||||
}
|
||||
|
||||
// OpenCL
|
||||
|
||||
private void compute(final boolean is64bit) {
|
||||
int sliceWidth = (int)(width / (float)slices);
|
||||
double rangeX = (maxX - minX) / slices;
|
||||
double rangeY = (maxY - minY);
|
||||
|
||||
kernel2DGlobalWorkSize.put(0, sliceWidth).put(1, height);
|
||||
|
||||
// start computation
|
||||
for ( int i = 0; i < slices; i++ ) {
|
||||
kernels[i].setArg(0, sliceWidth).setArg(1, height);
|
||||
if ( !is64bit || !isDoubleFPAvailable(queues[i].getCLDevice()) ) {
|
||||
kernels[i]
|
||||
.setArg(2, (float)(minX + rangeX * i)).setArg(3, (float)minY)
|
||||
.setArg(4, (float)rangeX).setArg(5, (float)rangeY);
|
||||
} else {
|
||||
kernels[i]
|
||||
.setArg(2, minX + rangeX * i).setArg(3, minY)
|
||||
.setArg(4, rangeX).setArg(5, rangeY);
|
||||
}
|
||||
|
||||
// aquire GL objects, and enqueue a kernel with a probe from the list
|
||||
clEnqueueAcquireGLObjects(queues[i], pboBuffers[i], null, null);
|
||||
|
||||
clEnqueueNDRangeKernel(queues[i], kernels[i], 2,
|
||||
null,
|
||||
kernel2DGlobalWorkSize,
|
||||
null,
|
||||
null, null);
|
||||
|
||||
clEnqueueReleaseGLObjects(queues[i], pboBuffers[i], null, null);
|
||||
}
|
||||
|
||||
// block until done (important: finish before doing further gl work)
|
||||
for ( int i = 0; i < slices; i++ ) {
|
||||
clFinish(queues[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// OpenGL
|
||||
|
||||
private void render() {
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
//draw slices
|
||||
int sliceWidth = width / slices;
|
||||
|
||||
for ( int i = 0; i < slices; i++ ) {
|
||||
int seperatorOffset = drawSeparator ? i : 0;
|
||||
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, pboIDs.get(i));
|
||||
glRasterPos2i(sliceWidth * i + seperatorOffset, 0);
|
||||
|
||||
glDrawPixels(sliceWidth, height, GL_BGRA, GL_UNSIGNED_BYTE, 0);
|
||||
|
||||
}
|
||||
glBindBuffer(GL_PIXEL_UNPACK_BUFFER, 0);
|
||||
|
||||
//draw info text
|
||||
/*
|
||||
textRenderer.beginRendering(width, height, false);
|
||||
|
||||
textRenderer.draw("device/time/precision", 10, height - 15);
|
||||
|
||||
for ( int i = 0; i < slices; i++ ) {
|
||||
CLDevice device = queues[i].getDevice();
|
||||
boolean doubleFP = doublePrecision && isDoubleFPAvailable(device);
|
||||
CLEvent event = probes.getEvent(i);
|
||||
long start = event.getProfilingInfo(START);
|
||||
long end = event.getProfilingInfo(END);
|
||||
textRenderer.draw(device.getType().toString() + i + " "
|
||||
+ (int)((end - start) / 1000000.0f) + "ms @"
|
||||
+ (doubleFP ? "64bit" : "32bit"), 10, height - (20 + 16 * (slices - i)));
|
||||
}
|
||||
|
||||
textRenderer.endRendering();
|
||||
*/
|
||||
}
|
||||
|
||||
public void reshape(int x, int y, int width, int height) {
|
||||
if ( this.width == width && this.height == height )
|
||||
return;
|
||||
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
|
||||
initPBO();
|
||||
setKernelConstants();
|
||||
|
||||
initView(width, height);
|
||||
|
||||
}
|
||||
|
||||
private static boolean isDoubleFPAvailable(CLDevice device) {
|
||||
final CLDeviceCapabilities caps = CLCapabilities.getDeviceCapabilities(device);
|
||||
return caps.CL_KHR_fp64 || caps.CL_AMD_fp64;
|
||||
}
|
||||
|
||||
public static void main(String args[]) {
|
||||
DemoFractal demo = new DemoFractal(512, 512);
|
||||
demo.init();
|
||||
demo.run();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
#ifdef DOUBLE_FP
|
||||
#ifdef AMD_FP
|
||||
#pragma OPENCL EXTENSION cl_amd_fp64 : enable
|
||||
#else
|
||||
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
|
||||
#endif
|
||||
typedef double varfloat;
|
||||
#else
|
||||
typedef float varfloat;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* For a description of this algorithm please refer to
|
||||
* http://en.wikipedia.org/wiki/Mandelbrot_set
|
||||
* @author Michael Bien
|
||||
*/
|
||||
kernel void mandelbrot(
|
||||
const int width, const int height,
|
||||
const varfloat x0, const varfloat y0,
|
||||
const varfloat rangeX, const varfloat rangeY,
|
||||
global uint *output, global uint *colorMap,
|
||||
const int colorMapSize, const int maxIterations) {
|
||||
|
||||
unsigned int ix = get_global_id(0);
|
||||
unsigned int iy = get_global_id(1);
|
||||
|
||||
varfloat r = x0 + ix * rangeX / width;
|
||||
varfloat i = y0 + iy * rangeY / height;
|
||||
|
||||
varfloat x = 0;
|
||||
varfloat y = 0;
|
||||
|
||||
varfloat magnitudeSquared = 0;
|
||||
int iteration = 0;
|
||||
|
||||
while (magnitudeSquared < 4 && iteration < maxIterations) {
|
||||
varfloat x2 = x*x;
|
||||
varfloat y2 = y*y;
|
||||
y = 2 * x * y + i;
|
||||
x = x2 - y2 + r;
|
||||
magnitudeSquared = x2+y2;
|
||||
iteration++;
|
||||
}
|
||||
|
||||
if (iteration == maxIterations) {
|
||||
output[iy * width + ix] = 0;
|
||||
}else {
|
||||
varfloat alpha = (varfloat)iteration / maxIterations;
|
||||
int colorIndex = (int)(alpha * colorMapSize);
|
||||
output[iy * width + ix] = colorMap[colorIndex];
|
||||
// monochrom
|
||||
// output[iy * width + ix] = 255*iteration/maxIterations;
|
||||
}
|
||||
|
||||
}
|
|
@ -81,6 +81,8 @@ public final class VersionTest {
|
|||
ca = ca.withProfileCore(true);
|
||||
else if ( "compatibility".equalsIgnoreCase(args[i]) )
|
||||
ca = ca.withProfileCompatibility(true);
|
||||
else if ( "es".equalsIgnoreCase(args[i]) )
|
||||
ca = ca.withProfileES(true);
|
||||
else
|
||||
argsError("Unknown argument: \'" + args[i] + "\'");
|
||||
}
|
||||
|
@ -236,6 +238,7 @@ public final class VersionTest {
|
|||
System.out.println("majorVersion\t- Minor OpenGL version.");
|
||||
System.out.println("core\t- Sets the Core Profile bit (optional, requires 3.2+).");
|
||||
System.out.println("compatibility\t- Sets the Compatibility Profile bit (optional, requires 3.2+).");
|
||||
System.out.println("ws\t- Sets the OpenGL ES Profile bit (optional, requires 2.0).");
|
||||
System.out.println("layer\t- Layer plane (optional).");
|
||||
System.out.println("debug\t- Enables debug mode (optional).");
|
||||
System.out.println("fc\t- Enables forward compatibility mode (optional, requires 3.0+).");
|
||||
|
|
|
@ -49,6 +49,9 @@ public @interface Alternate {
|
|||
/** If true, an alternate Java->native call will be created. Useful when the alternate implementation uses different types. */
|
||||
boolean nativeAlt() default false;
|
||||
|
||||
/** Applicable when nativeAlt is true. If true, no extra native call will be generated. Useful when there's another nativeAlt already defined. */
|
||||
boolean skipNative() default false;
|
||||
|
||||
/** If true, the alternate method's name will be used for the Java call. */
|
||||
boolean javaAlt() default false;
|
||||
}
|
|
@ -45,9 +45,10 @@ import java.lang.annotation.Target;
|
|||
import java.lang.annotation.ElementType;
|
||||
|
||||
@Auto
|
||||
@Target(ElementType.PARAMETER)
|
||||
@Target({ElementType.METHOD,ElementType.PARAMETER})
|
||||
public @interface AutoSize {
|
||||
String value(); // The name of the Buffer parameter
|
||||
String expression() default ""; // This value is added after the argument
|
||||
boolean canBeNull() default false; // When this is true and the Buffer parameter is null, 0 will be used.
|
||||
boolean isNative() default false; // When this is true, auto-sizing will be performed in native code.
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ package org.lwjgl.util.generator;
|
|||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
||||
@Target(ElementType.PARAMETER)
|
||||
@Target({ElementType.PARAMETER, ElementType.METHOD})
|
||||
public @interface Check {
|
||||
String value() default "";
|
||||
boolean canBeNull() default false;
|
||||
|
|
|
@ -38,10 +38,22 @@ package org.lwjgl.util.generator;
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface Code {
|
||||
String value();
|
||||
|
||||
String value() default ""; // Java, before everything
|
||||
|
||||
boolean tryBlock() default false; // Add a try/finally block around the native call and return statement
|
||||
|
||||
String javaBeforeNative() default ""; // Before the native call
|
||||
String javaAfterNative() default ""; // After the native call
|
||||
String javaFinally() default ""; // In the finally block
|
||||
|
||||
String nativeAfterVars() default ""; // After variable declaration
|
||||
String nativeBeforeCall() default ""; // Before the API call
|
||||
String nativeAfterCall() default ""; // After the API call
|
||||
|
||||
}
|
||||
|
|
|
@ -46,4 +46,6 @@ public @interface Constant {
|
|||
String value();
|
||||
/** If true, the original parameter will not be removed from the method. */
|
||||
boolean keepParam() default false;
|
||||
/** If true, this is a native code constant. */
|
||||
boolean isNative() default false;
|
||||
}
|
||||
|
|
|
@ -31,20 +31,16 @@
|
|||
*/
|
||||
package org.lwjgl.util.generator;
|
||||
|
||||
/**
|
||||
*
|
||||
* AutoResultSize specifies the size of a returned Buffer
|
||||
* as an expression.
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Functions marked with <code>@Extern</code> will not be declared as <code>static</code> in the C implementation.
|
||||
* This allows other source files to call them.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface AutoResultSize {
|
||||
String value(); // The size as a java expression
|
||||
public @interface Extern {
|
||||
|
||||
}
|
|
@ -43,4 +43,6 @@ import java.lang.annotation.ElementType;
|
|||
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface GenerateAutos {
|
||||
/** If true, a size variable will be generated. */
|
||||
String[] sizeVariables() default {};
|
||||
}
|
||||
|
|
|
@ -32,21 +32,23 @@
|
|||
|
||||
package org.lwjgl.util.generator;
|
||||
|
||||
import com.sun.mirror.apt.*;
|
||||
import com.sun.mirror.declaration.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
import java.util.Map;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import com.sun.mirror.apt.*;
|
||||
import com.sun.mirror.declaration.AnnotationTypeDeclaration;
|
||||
import com.sun.mirror.declaration.TypeDeclaration;
|
||||
|
||||
import static java.util.Collections.*;
|
||||
import static com.sun.mirror.util.DeclarationVisitors.*;
|
||||
import static java.util.Collections.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* Generator tool for creating the java classes and native code
|
||||
* from an annotated template java interface.
|
||||
*
|
||||
|
@ -55,6 +57,7 @@ import static com.sun.mirror.util.DeclarationVisitors.*;
|
|||
* $Id$
|
||||
*/
|
||||
public class GeneratorProcessorFactory implements AnnotationProcessorFactory, RoundCompleteListener {
|
||||
|
||||
private static boolean first_round = true;
|
||||
|
||||
// Process any set of annotations
|
||||
|
@ -78,7 +81,7 @@ public class GeneratorProcessorFactory implements AnnotationProcessorFactory, Ro
|
|||
|
||||
public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds, AnnotationProcessorEnvironment env) {
|
||||
// Only process the initial types, not the generated ones
|
||||
if (first_round) {
|
||||
if ( first_round ) {
|
||||
env.addListener(this);
|
||||
return new GeneratorProcessor(env);
|
||||
} else
|
||||
|
@ -86,6 +89,7 @@ public class GeneratorProcessorFactory implements AnnotationProcessorFactory, Ro
|
|||
}
|
||||
|
||||
private static class GeneratorProcessor implements AnnotationProcessor {
|
||||
|
||||
private final AnnotationProcessorEnvironment env;
|
||||
|
||||
GeneratorProcessor(AnnotationProcessorEnvironment env) {
|
||||
|
@ -97,22 +101,22 @@ public class GeneratorProcessorFactory implements AnnotationProcessorFactory, Ro
|
|||
String typemap_classname = null;
|
||||
boolean generate_error_checks = options.containsKey("-Ageneratechecks");
|
||||
boolean context_specific = options.containsKey("-Acontextspecific");
|
||||
for (String k : options.keySet()) {
|
||||
for ( String k : options.keySet() ) {
|
||||
int delimiter = k.indexOf('=');
|
||||
if (delimiter != -1) {
|
||||
if (k.startsWith("-Atypemap")) {
|
||||
if ( delimiter != -1 ) {
|
||||
if ( k.startsWith("-Atypemap") ) {
|
||||
typemap_classname = k.substring(delimiter + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (typemap_classname == null)
|
||||
if ( typemap_classname == null )
|
||||
throw new RuntimeException("No TypeMap class name specified with -Atypemap=<class-name>");
|
||||
|
||||
TypeDeclaration lastFile = null;
|
||||
try {
|
||||
long generatorLM = getGeneratorLastModified();
|
||||
TypeMap type_map = (TypeMap)(Class.forName(typemap_classname).newInstance());
|
||||
for (TypeDeclaration typedecl : env.getSpecifiedTypeDeclarations()) {
|
||||
for ( TypeDeclaration typedecl : env.getSpecifiedTypeDeclarations() ) {
|
||||
lastFile = typedecl;
|
||||
typedecl.accept(getDeclarationScanner(new GeneratorVisitor(env, type_map, generate_error_checks, context_specific, generatorLM), NO_OP));
|
||||
}
|
||||
|
@ -130,7 +134,16 @@ public class GeneratorProcessorFactory implements AnnotationProcessorFactory, Ro
|
|||
* @return time of the latest change
|
||||
*/
|
||||
private static long getGeneratorLastModified() {
|
||||
final File pck = new File(System.getProperty("user.dir") + "/bin/org/lwjgl/util/generator");
|
||||
long lastModified = getDirectoryLastModified("/bin/org/lwjgl/util/generator");
|
||||
lastModified = Math.max(lastModified, getDirectoryLastModified("/bin/org/lwjgl/util/generator/openal"));
|
||||
lastModified = Math.max(lastModified, getDirectoryLastModified("/bin/org/lwjgl/util/generator/opengl"));
|
||||
lastModified = Math.max(lastModified, getDirectoryLastModified("/bin/org/lwjgl/util/generator/opencl"));
|
||||
|
||||
return lastModified;
|
||||
}
|
||||
|
||||
private static long getDirectoryLastModified(final String path) {
|
||||
final File pck = new File(System.getProperty("user.dir") + path);
|
||||
if ( !pck.exists() || !pck.isDirectory() )
|
||||
return Long.MAX_VALUE;
|
||||
|
||||
|
|
|
@ -37,12 +37,11 @@ import com.sun.mirror.declaration.*;
|
|||
import com.sun.mirror.type.*;
|
||||
import com.sun.mirror.util.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.nio.channels.FileChannel;
|
||||
import java.util.*;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.File;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
/**
|
||||
|
@ -68,11 +67,6 @@ public class GeneratorVisitor extends SimpleDeclarationVisitor {
|
|||
this.generatorLM = generatorLM;
|
||||
}
|
||||
|
||||
private void validateMethods(InterfaceDeclaration d) {
|
||||
for (MethodDeclaration method : d.getMethods())
|
||||
validateMethod(method);
|
||||
}
|
||||
|
||||
private void validateMethod(MethodDeclaration method) {
|
||||
if (method.isVarArgs())
|
||||
throw new RuntimeException("Method " + method.getSimpleName() + " is variadic");
|
||||
|
@ -96,13 +90,13 @@ public class GeneratorVisitor extends SimpleDeclarationVisitor {
|
|||
if (method.getAnnotation(CachedResult.class) != null) {
|
||||
if (Utils.getNIOBufferType(Utils.getMethodReturnType(method)) == null)
|
||||
throw new RuntimeException(method + " return type is not a Buffer, but is annotated with CachedResult");
|
||||
if (method.getAnnotation(AutoResultSize.class) == null)
|
||||
throw new RuntimeException(method + " is annotated with CachedResult but misses an AutoResultSize annotation");
|
||||
if (method.getAnnotation(AutoSize.class) == null)
|
||||
throw new RuntimeException(method + " is annotated with CachedResult but misses an AutoSize annotation");
|
||||
}
|
||||
validateTypes(method, method.getAnnotationMirrors(), method.getReturnType());
|
||||
}
|
||||
|
||||
private void validateType(MethodDeclaration method, Class annotation_type, Class type) {
|
||||
private void validateType(MethodDeclaration method, Class<?extends Annotation> annotation_type, Class type) {
|
||||
Class[] valid_types = type_map.getValidAnnotationTypes(type);
|
||||
for (int i = 0; i < valid_types.length; i++)
|
||||
if (valid_types[i].equals(annotation_type))
|
||||
|
@ -115,7 +109,11 @@ public class GeneratorVisitor extends SimpleDeclarationVisitor {
|
|||
for (AnnotationMirror annotation : annotations) {
|
||||
NativeType native_type_annotation = NativeTypeTranslator.getAnnotation(annotation, NativeType.class);
|
||||
if (native_type_annotation != null) {
|
||||
Class annotation_type = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType());
|
||||
Class<? extends Annotation> annotation_type = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType());
|
||||
/*System.out.println("\nYO:");
|
||||
System.out.println("annotation = " + annotation);
|
||||
System.out.println("native_type_annotation = " + native_type_annotation);
|
||||
System.out.println("annotation_type = " + annotation_type);*/
|
||||
Class type = Utils.getJavaType(type_mirror);
|
||||
if (Buffer.class.equals(type))
|
||||
continue;
|
||||
|
@ -172,7 +170,9 @@ public class GeneratorVisitor extends SimpleDeclarationVisitor {
|
|||
}
|
||||
|
||||
private static void generateMethodNativePointers(PrintWriter writer, MethodDeclaration method) {
|
||||
writer.println("static " + Utils.getTypedefName(method) + " " + method.getSimpleName() + ";");
|
||||
if ( method.getAnnotation(Extern.class) == null )
|
||||
writer.print("static ");
|
||||
writer.println(Utils.getTypedefName(method) + " " + method.getSimpleName() + ";");
|
||||
}
|
||||
|
||||
private void generateJavaSource(InterfaceDeclaration d, PrintWriter java_writer) throws IOException {
|
||||
|
@ -182,8 +182,14 @@ public class GeneratorVisitor extends SimpleDeclarationVisitor {
|
|||
java_writer.println();
|
||||
java_writer.println("import org.lwjgl.*;");
|
||||
java_writer.println("import java.nio.*;");
|
||||
Imports imports = d.getAnnotation(Imports.class);
|
||||
if ( imports != null ) {
|
||||
for ( String i : imports.value() )
|
||||
java_writer.println("import " + i + ";");
|
||||
}
|
||||
java_writer.println();
|
||||
Utils.printDocComment(java_writer, d);
|
||||
if ( d.getAnnotation(Private.class) == null )
|
||||
java_writer.print("public ");
|
||||
boolean is_final = Utils.isFinal(d);
|
||||
if (is_final)
|
||||
|
@ -223,8 +229,10 @@ public class GeneratorVisitor extends SimpleDeclarationVisitor {
|
|||
native_writer.println("#include <jni.h>");
|
||||
type_map.printNativeIncludes(native_writer);
|
||||
native_writer.println();
|
||||
//if ( d.getAnnotation(NoTypeDefs.class) == null ) {
|
||||
TypedefsGenerator.generateNativeTypedefs(type_map, native_writer, d.getMethods());
|
||||
native_writer.println();
|
||||
//}
|
||||
if (!context_specific) {
|
||||
generateMethodsNativePointers(native_writer, d.getMethods());
|
||||
native_writer.println();
|
||||
|
@ -247,29 +255,98 @@ public class GeneratorVisitor extends SimpleDeclarationVisitor {
|
|||
}
|
||||
|
||||
public void visitInterfaceDeclaration(InterfaceDeclaration d) {
|
||||
File input = d.getPosition().file();
|
||||
File output = new File(env.getOptions().get("-s") + '/' + d.getPackage().getQualifiedName().replace('.', '/'), Utils.getSimpleClassName(d) + ".java");
|
||||
final File input = d.getPosition().file();
|
||||
final File outputJava = new File(env.getOptions().get("-s") + '/' + d.getPackage().getQualifiedName().replace('.', '/'), Utils.getSimpleClassName(d) + ".java");
|
||||
|
||||
PrintWriter java_writer = null;
|
||||
|
||||
try {
|
||||
// Skip this class if the output exists and the input has not been modified.
|
||||
if ( output.exists() && Math.max(input.lastModified(), generatorLM) < output.lastModified() )
|
||||
final Collection<? extends MethodDeclaration> methods = d.getMethods();
|
||||
if ( methods.size() == 0 && d.getFields().size() == 0 )
|
||||
return;
|
||||
|
||||
if (d.getMethods().size() > 0 || d.getFields().size() > 0) {
|
||||
validateMethods(d);
|
||||
// Skip this class if the output exists and the input has not been modified.
|
||||
if ( outputJava.exists() && Math.max(input.lastModified(), generatorLM) < outputJava.lastModified() )
|
||||
return;
|
||||
|
||||
for ( final MethodDeclaration method : methods )
|
||||
validateMethod(method);
|
||||
java_writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, d.getPackage().getQualifiedName(), new File(Utils.getSimpleClassName(d) + ".java"), null);
|
||||
generateJavaSource(d, java_writer);
|
||||
|
||||
if ( methods.size() > 0 ) {
|
||||
boolean hasNative = false;
|
||||
for ( final MethodDeclaration method : methods ) {
|
||||
Alternate alt_annotation = method.getAnnotation(Alternate.class);
|
||||
if ( (alt_annotation == null || alt_annotation.nativeAlt()) && method.getAnnotation(Reuse.class) == null ) {
|
||||
hasNative = true;
|
||||
break;
|
||||
}
|
||||
if (d.getMethods().size() > 0)
|
||||
}
|
||||
if ( !hasNative )
|
||||
return;
|
||||
|
||||
final String outputPath = env.getOptions().get("-d") + '/' + Utils.getNativeQualifiedName(Utils.getQualifiedClassName(d));
|
||||
final File outputNative = new File(outputPath + ".c");
|
||||
final File outputBackup = new File(outputPath + "_backup.c");
|
||||
|
||||
// If the native file exists, rename.
|
||||
final ByteBuffer nativeBefore;
|
||||
if ( outputNative.exists() ) {
|
||||
nativeBefore = readFile(outputNative);
|
||||
outputNative.renameTo(outputBackup);
|
||||
} else
|
||||
nativeBefore = null;
|
||||
|
||||
try {
|
||||
generateNativeSource(d);
|
||||
|
||||
// If the native file did exist, compare with the new file. If they're the same,
|
||||
// reset the last modified time to avoid ridiculous C compilation times.
|
||||
if ( nativeBefore != null && outputNative.length() == nativeBefore.capacity() ) {
|
||||
final ByteBuffer nativeAfter = readFile(outputNative);
|
||||
boolean same = true;
|
||||
for ( int i = nativeBefore.position(); i < nativeBefore.limit(); i++ ) {
|
||||
if ( nativeBefore.get(i) != nativeAfter.get(i) ) {
|
||||
same = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( same ) {
|
||||
outputNative.delete();
|
||||
outputBackup.renameTo(outputNative);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
if ( outputBackup.exists() )
|
||||
outputBackup.delete();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// If anything goes wrong mid-gen, delete output to allow regen next time we run.
|
||||
if ( java_writer != null ) java_writer.close();
|
||||
if ( output.exists() ) output.delete();
|
||||
if ( outputJava.exists() ) outputJava.delete();
|
||||
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static ByteBuffer readFile(final File file) throws IOException {
|
||||
final FileChannel channel = new FileInputStream(file).getChannel();
|
||||
|
||||
final long bytesTotal = channel.size();
|
||||
final ByteBuffer buffer = ByteBuffer.allocateDirect((int)bytesTotal);
|
||||
|
||||
long bytesRead = 0;
|
||||
do {
|
||||
bytesRead += channel.read(buffer);
|
||||
} while ( bytesRead < bytesTotal );
|
||||
buffer.flip();
|
||||
|
||||
channel.close();
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
/**
|
||||
* Method parameters marked with <code>@Helper</code> will be considered Java-API
|
||||
* parameters and will be ignored when generating native stubs/code.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target(ElementType.PARAMETER)
|
||||
public @interface Helper {
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* This annotation can be used when an extension template needs
|
||||
* extra imports in its generated class.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface Imports {
|
||||
String[] value();
|
||||
}
|
|
@ -56,8 +56,13 @@ public class JNITypeTranslator implements TypeVisitor {
|
|||
}
|
||||
|
||||
public void visitArrayType(ArrayType t) {
|
||||
if ( "java.lang.CharSequence".equals(t.getComponentType().toString()) )
|
||||
final String className = t.getComponentType().toString();
|
||||
if ( "java.lang.CharSequence".equals(className) )
|
||||
signature.append("jobject");
|
||||
else if ( "java.nio.ByteBuffer".equals(className) )
|
||||
signature.append("jobjectArray");
|
||||
else if ( "org.lwjgl.opencl.CLMem".equals(className) )
|
||||
signature.append("jobjectArray");
|
||||
else
|
||||
throw new RuntimeException(t + " is not allowed");
|
||||
}
|
||||
|
|
|
@ -41,6 +41,9 @@ package org.lwjgl.util.generator;
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.util.generator.opengl.GLreturn;
|
||||
|
||||
import com.sun.mirror.apt.*;
|
||||
import com.sun.mirror.declaration.*;
|
||||
import com.sun.mirror.type.*;
|
||||
|
@ -50,7 +53,7 @@ import java.util.*;
|
|||
import java.nio.*;
|
||||
|
||||
public class JavaMethodsGenerator {
|
||||
private final static String SAVED_PARAMETER_POSTFIX = "_saved";
|
||||
private static final String SAVED_PARAMETER_POSTFIX = "_saved";
|
||||
|
||||
public static void generateMethodsJava(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, InterfaceDeclaration interface_decl, boolean generate_error_checks, boolean context_specific) {
|
||||
for (MethodDeclaration method : interface_decl.getMethods())
|
||||
|
@ -71,8 +74,14 @@ public class JavaMethodsGenerator {
|
|||
if ( method.getAnnotation(CachedResult.class) != null && !method.getAnnotation(CachedResult.class).isRange() ) {
|
||||
printMethodWithMultiType(env, type_map, writer, interface_decl, method, TypeInfo.getDefaultTypeInfoMap(method), Mode.CACHEDRESULT, generate_error_checks, context_specific);
|
||||
}
|
||||
|
||||
// Skip the native function if we're re-using.
|
||||
Reuse reuse_annotation = method.getAnnotation(Reuse.class);
|
||||
if ( reuse_annotation != null )
|
||||
return;
|
||||
|
||||
Alternate alt_annotation = method.getAnnotation(Alternate.class);
|
||||
if ( alt_annotation == null || alt_annotation.nativeAlt() ) {
|
||||
if ( alt_annotation == null || (alt_annotation.nativeAlt() && !alt_annotation.skipNative()) ) {
|
||||
if ( alt_annotation != null && method.getSimpleName().equals(alt_annotation.value()) )
|
||||
throw new RuntimeException("An alternate function with native code should have a different name than the main function.");
|
||||
printJavaNativeStub(writer, method, Mode.NORMAL, generate_error_checks, context_specific);
|
||||
|
@ -90,12 +99,12 @@ public class JavaMethodsGenerator {
|
|||
Utils.printDocComment(writer, method);
|
||||
writer.print("\tpublic static native ");
|
||||
}
|
||||
printResultType(writer, method, true);
|
||||
writer.print(getResultType(method, true));
|
||||
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 = generateParametersJava(writer, method, TypeInfo.getDefaultTypeInfoMap(method), true, mode);
|
||||
boolean first_parameter = generateParametersJava(writer, method, TypeInfo.getDefaultTypeInfoMap(method), true, true, mode);
|
||||
if (context_specific) {
|
||||
if (!first_parameter)
|
||||
writer.print(", ");
|
||||
|
@ -104,10 +113,14 @@ public class JavaMethodsGenerator {
|
|||
writer.println(");");
|
||||
}
|
||||
|
||||
private static boolean generateParametersJava(PrintWriter writer, MethodDeclaration method, Map<ParameterDeclaration, TypeInfo> typeinfos_instance,
|
||||
boolean native_stub, Mode mode) {
|
||||
private static boolean generateParametersJava(PrintWriter writer, MethodDeclaration method, Map<ParameterDeclaration, TypeInfo> typeinfos_instance, boolean native_stub, final boolean printTypes, Mode mode) {
|
||||
boolean first_parameter = true;
|
||||
for (ParameterDeclaration param : method.getParameters()) {
|
||||
if ( native_stub && param.getAnnotation(Helper.class) != null )
|
||||
continue;
|
||||
final Constant constant_annotation = param.getAnnotation(Constant.class);
|
||||
if ( constant_annotation != null && constant_annotation.isNative() )
|
||||
continue;
|
||||
AnnotationMirror auto_annotation_mirror = Utils.getParameterAutoAnnotation(param);
|
||||
boolean hide_auto_parameter = mode == Mode.NORMAL && !native_stub && auto_annotation_mirror != null;
|
||||
if (hide_auto_parameter) {
|
||||
|
@ -119,44 +132,53 @@ public class JavaMethodsGenerator {
|
|||
if (!first_parameter)
|
||||
writer.print(", ");
|
||||
first_parameter = false;
|
||||
writer.print("boolean " + TypeInfo.UNSIGNED_PARAMETER_NAME);
|
||||
if ( printTypes )
|
||||
writer.print("boolean ");
|
||||
writer.print( TypeInfo.UNSIGNED_PARAMETER_NAME);
|
||||
}
|
||||
}
|
||||
} else if (
|
||||
param.getAnnotation(Result.class) == null
|
||||
&& (native_stub || ((param.getAnnotation(Constant.class) == null || param.getAnnotation(Constant.class).keepParam()) && !Utils.isReturnParameter(method, param)))
|
||||
&& (getAutoTypeParameter(method, param) == null || mode != Mode.AUTOS)
|
||||
)
|
||||
{
|
||||
TypeInfo type_info = typeinfos_instance.get(param);
|
||||
first_parameter = generateParameterJava(writer, param, type_info, native_stub, first_parameter, mode);
|
||||
&& (mode != Mode.AUTOS || getAutoTypeParameter(method, param) == null)
|
||||
) {
|
||||
first_parameter = generateParameterJava(writer, param, typeinfos_instance.get(param), native_stub, printTypes, first_parameter, mode);
|
||||
}
|
||||
}
|
||||
CachedResult cached_result_annotation = method.getAnnotation(CachedResult.class);
|
||||
TypeMirror result_type = Utils.getMethodReturnType(method);
|
||||
if ((native_stub && Utils.getNIOBufferType(result_type) != null) || Utils.needResultSize(method)) {
|
||||
AutoSize auto_size_annotation = method.getAnnotation(AutoSize.class);
|
||||
if ( auto_size_annotation == null || !auto_size_annotation.isNative() ) {
|
||||
if (cached_result_annotation == null || !cached_result_annotation.isRange()) {
|
||||
if (!first_parameter)
|
||||
writer.print(", ");
|
||||
first_parameter = false;
|
||||
writer.print("long " + Utils.RESULT_SIZE_NAME);
|
||||
if ( printTypes )
|
||||
writer.print("long ");
|
||||
writer.print(Utils.RESULT_SIZE_NAME);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (cached_result_annotation != null) {
|
||||
if (!first_parameter)
|
||||
writer.print(", ");
|
||||
|
||||
if ( mode == Mode.CACHEDRESULT )
|
||||
writer.print("long " + Utils.CACHED_BUFFER_LENGTH_NAME + ", ");
|
||||
if ( mode == Mode.CACHEDRESULT ) {
|
||||
if ( printTypes )
|
||||
writer.print("long ");
|
||||
writer.print(Utils.CACHED_BUFFER_LENGTH_NAME + ", ");
|
||||
}
|
||||
|
||||
first_parameter = false;
|
||||
printResultType(writer, method, native_stub);
|
||||
if ( printTypes )
|
||||
writer.print(getResultType(method, native_stub));
|
||||
writer.print(" " + Utils.CACHED_BUFFER_NAME);
|
||||
}
|
||||
return first_parameter;
|
||||
}
|
||||
|
||||
private static boolean generateParameterJava(PrintWriter writer, ParameterDeclaration param, TypeInfo type_info, boolean native_stub, boolean first_parameter, Mode mode) {
|
||||
private static boolean generateParameterJava(PrintWriter writer, ParameterDeclaration param, TypeInfo type_info, boolean native_stub, final boolean printTypes, boolean first_parameter, Mode mode) {
|
||||
Class buffer_type = Utils.getNIOBufferType(param.getType());
|
||||
if (!first_parameter)
|
||||
writer.print(", ");
|
||||
|
@ -164,18 +186,23 @@ public class JavaMethodsGenerator {
|
|||
if (bo_annotation != null && mode == Mode.BUFFEROBJECT) {
|
||||
if (buffer_type == null)
|
||||
throw new RuntimeException("type of " + param + " is not a nio Buffer parameter but is annotated as buffer object");
|
||||
writer.print("long " + param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX);
|
||||
if ( printTypes )
|
||||
writer.print("long ");
|
||||
writer.print(param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX);
|
||||
} else {
|
||||
if ( native_stub && param.getAnnotation(GLpointer.class) != null )
|
||||
writer.print("long");
|
||||
if ( native_stub && param.getAnnotation(PointerWrapper.class) != null )
|
||||
writer.print("long ");
|
||||
else {
|
||||
Class type = type_info.getType();
|
||||
if ( native_stub && (type == CharSequence.class || type == CharSequence[].class) )
|
||||
writer.print("ByteBuffer");
|
||||
else
|
||||
writer.print(type_info.getType().getSimpleName());
|
||||
if ( native_stub && (type == CharSequence.class || type == CharSequence[].class || type == PointerBuffer.class) )
|
||||
writer.print("ByteBuffer ");
|
||||
else if ( printTypes )
|
||||
writer.print(type_info.getType().getSimpleName() + " ");
|
||||
}
|
||||
writer.print(" " + param.getSimpleName());
|
||||
AutoSize auto_size_annotation = param.getAnnotation(AutoSize.class);
|
||||
if ( auto_size_annotation != null )
|
||||
writer.print(auto_size_annotation.value() + "_");
|
||||
writer.print(param.getSimpleName());
|
||||
if ( native_stub && buffer_type != null )
|
||||
writer.print(", int " + param.getSimpleName() + NativeMethodStubsGenerator.BUFFER_POSITION_POSTFIX);
|
||||
}
|
||||
|
@ -205,8 +232,11 @@ public class JavaMethodsGenerator {
|
|||
|
||||
private static void printMethodWithMultiType(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, InterfaceDeclaration interface_decl, MethodDeclaration method, Map<ParameterDeclaration, TypeInfo> typeinfos_instance, Mode mode, boolean generate_error_checks, boolean context_specific) {
|
||||
Utils.printDocComment(writer, method);
|
||||
if ( interface_decl.getAnnotation(Private.class) == null && method.getAnnotation(Private.class) == null )
|
||||
writer.print("\tpublic static ");
|
||||
printResultType(writer, method, false);
|
||||
else
|
||||
writer.print("\tstatic ");
|
||||
writer.print(getResultType(method, false));
|
||||
StripPostfix strip_annotation = method.getAnnotation(StripPostfix.class);
|
||||
String method_name;
|
||||
Alternate alt_annotation = method.getAnnotation(Alternate.class);
|
||||
|
@ -214,32 +244,60 @@ public class JavaMethodsGenerator {
|
|||
if (strip_annotation != null && mode == Mode.NORMAL)
|
||||
method_name = getPostfixStrippedName(type_map, interface_decl, method);
|
||||
writer.print(" " + method_name + "(");
|
||||
generateParametersJava(writer, method, typeinfos_instance, false, mode);
|
||||
TypeMirror result_type = Utils.getMethodReturnType(method);
|
||||
generateParametersJava(writer, method, typeinfos_instance, false, true, mode);
|
||||
writer.println(") {");
|
||||
|
||||
final TypeMirror result_type = Utils.getMethodReturnType(method);
|
||||
boolean has_result = !result_type.equals(env.getTypeUtils().getVoidType());
|
||||
|
||||
final Reuse reuse_annotation = method.getAnnotation(Reuse.class);
|
||||
if ( reuse_annotation != null ) {
|
||||
writer.print("\t\t");
|
||||
if ( has_result || method.getAnnotation(GLreturn.class) != null )
|
||||
writer.print("return ");
|
||||
|
||||
writer.print(reuse_annotation.value() + "." + method_name + "(");
|
||||
generateParametersJava(writer, method, typeinfos_instance, false, false, mode);
|
||||
writer.println(");\n\t}");
|
||||
return;
|
||||
}
|
||||
|
||||
if (context_specific) {
|
||||
writer.println("\t\tContextCapabilities caps = GLContext.getCapabilities();");
|
||||
writer.print("\t\tlong " + Utils.FUNCTION_POINTER_VAR_NAME + " = caps.");
|
||||
type_map.printCapabilitiesInit(writer);
|
||||
writer.print("\t\tlong " + Utils.FUNCTION_POINTER_VAR_NAME + " = " + type_map.getCapabilities() + ".");
|
||||
writer.println(Utils.getFunctionAddressName(interface_decl, method, true) + ";");
|
||||
writer.print("\t\tBufferChecks.checkFunctionAddress(");
|
||||
writer.println(Utils.FUNCTION_POINTER_VAR_NAME + ");");
|
||||
}
|
||||
Code code_annotation = method.getAnnotation(Code.class);
|
||||
if (code_annotation != null)
|
||||
final Code code_annotation = method.getAnnotation(Code.class);
|
||||
if (code_annotation != null && code_annotation.value().length() > 0)
|
||||
writer.println(code_annotation.value());
|
||||
printBufferObjectChecks(writer, method, mode);
|
||||
printParameterChecks(writer, method, typeinfos_instance, mode);
|
||||
printParameterChecks(writer, method, typeinfos_instance, mode, generate_error_checks);
|
||||
printParameterCaching(writer, interface_decl, method, mode);
|
||||
writer.print("\t\t");
|
||||
boolean has_result = !result_type.equals(env.getTypeUtils().getVoidType());
|
||||
if (has_result) {
|
||||
printResultType(writer, method, false);
|
||||
writer.print(" " + Utils.RESULT_VAR_NAME + " = ");
|
||||
|
||||
if ( method.getAnnotation(GLpointer.class) != null )
|
||||
writer.print("new " + method.getReturnType() + "(");
|
||||
if ( code_annotation != null && code_annotation.javaBeforeNative().length() > 0 )
|
||||
writer.println(code_annotation.javaBeforeNative());
|
||||
writer.print("\t\t");
|
||||
|
||||
final PointerWrapper pointer_wrapper_annotation = method.getAnnotation(PointerWrapper.class);
|
||||
if (has_result) {
|
||||
writer.print(getResultType(method, false) + " " + Utils.RESULT_VAR_NAME);
|
||||
|
||||
if ( code_annotation != null && code_annotation.tryBlock() ) {
|
||||
writer.print(" = " + getDefaultResultValue(method));
|
||||
writer.println(";\n\t\ttry {");
|
||||
writer.print("\t\t\t" + Utils.RESULT_VAR_NAME);
|
||||
}
|
||||
if ( method.getAnnotation(GLreturn.class) != null ) {
|
||||
|
||||
writer.print(" = ");
|
||||
if ( pointer_wrapper_annotation != null ) {
|
||||
if ( pointer_wrapper_annotation.factory().length() > 0 )
|
||||
writer.print(pointer_wrapper_annotation.factory() + "(");
|
||||
else
|
||||
writer.print("new " + getResultType(method, false) + "(");
|
||||
}
|
||||
} else if ( method.getAnnotation(GLreturn.class) != null ) {
|
||||
has_result = true;
|
||||
Utils.printGLReturnPre(writer, method, method.getAnnotation(GLreturn.class));
|
||||
}
|
||||
|
@ -253,22 +311,36 @@ public class JavaMethodsGenerator {
|
|||
writer.print(", ");
|
||||
writer.print(Utils.FUNCTION_POINTER_VAR_NAME);
|
||||
}
|
||||
if ( has_result && method.getAnnotation(GLpointer.class) != null )
|
||||
if ( has_result && pointer_wrapper_annotation != null ) {
|
||||
writer.print(")");
|
||||
if ( pointer_wrapper_annotation.params().length() > 0 )
|
||||
writer.print(", " + pointer_wrapper_annotation.params());
|
||||
}
|
||||
writer.println(");");
|
||||
|
||||
if ( code_annotation != null && code_annotation.javaAfterNative().length() > 0 )
|
||||
writer.println(code_annotation.javaAfterNative());
|
||||
|
||||
final String tabs = code_annotation != null && code_annotation.tryBlock() ? "\t\t\t" : "\t\t";
|
||||
if (generate_error_checks && method.getAnnotation(NoErrorCheck.class) == null)
|
||||
writer.println("\t\t" + type_map.getErrorCheckMethodName() + ";");
|
||||
type_map.printErrorCheckMethod(writer, method, tabs);
|
||||
// DISABLED: indirect buffer support
|
||||
//printNondirectParameterCopies(writer, method, mode);
|
||||
if (has_result) {
|
||||
if ( method.getAnnotation(GLreturn.class) == null ) {
|
||||
if ( ByteBuffer.class.equals(Utils.getJavaType(result_type)) )
|
||||
writer.println("\t\treturn LWJGLUtil.CHECKS && " + Utils.RESULT_VAR_NAME + " == null ? null : " + Utils.RESULT_VAR_NAME + ".order(ByteOrder.nativeOrder());"); // safeNewBuffer returns a direct ByteBuffer with BIG_ENDIAN order.
|
||||
writer.println(tabs + "return LWJGLUtil.CHECKS && " + Utils.RESULT_VAR_NAME + " == null ? null : " + Utils.RESULT_VAR_NAME + ".order(ByteOrder.nativeOrder());"); // safeNewBuffer returns a direct ByteBuffer with BIG_ENDIAN order.
|
||||
else
|
||||
writer.println("\t\treturn " + Utils.RESULT_VAR_NAME + ";");
|
||||
writer.println(tabs + "return " + Utils.RESULT_VAR_NAME + ";");
|
||||
} else
|
||||
Utils.printGLReturnPost(writer, method, method.getAnnotation(GLreturn.class));
|
||||
}
|
||||
|
||||
if ( code_annotation != null && code_annotation.tryBlock() ) {
|
||||
writer.println("\t\t} finally {");
|
||||
writer.println(code_annotation.javaFinally());
|
||||
writer.println("\t\t}");
|
||||
}
|
||||
writer.println("\t}");
|
||||
}
|
||||
|
||||
|
@ -296,7 +368,7 @@ public class JavaMethodsGenerator {
|
|||
else if (annotation_type.equals(AutoSize.class))
|
||||
parameter_name = param.getAnnotation(AutoSize.class).value();
|
||||
else
|
||||
throw new RuntimeException("Unkown annotation type " + annotation_type);
|
||||
throw new RuntimeException("Unknown annotation type " + annotation_type);
|
||||
if (target_parameter.getSimpleName().equals(parameter_name))
|
||||
return param;
|
||||
}
|
||||
|
@ -368,6 +440,7 @@ public class JavaMethodsGenerator {
|
|||
private static boolean printMethodCallArgument(PrintWriter writer, MethodDeclaration method, ParameterDeclaration param, Map<ParameterDeclaration, TypeInfo> typeinfos_instance, Mode mode, boolean first_parameter) {
|
||||
if (!first_parameter)
|
||||
writer.print(", ");
|
||||
|
||||
AnnotationMirror auto_annotation = Utils.getParameterAutoAnnotation(param);
|
||||
Constant constant_annotation = param.getAnnotation(Constant.class);
|
||||
if (constant_annotation != null) {
|
||||
|
@ -375,31 +448,34 @@ public class JavaMethodsGenerator {
|
|||
} else if (auto_annotation != null && mode == Mode.NORMAL) {
|
||||
Class param_type = NativeTypeTranslator.getClassFromType(auto_annotation.getAnnotationType());
|
||||
if (AutoType.class.equals(param_type)) {
|
||||
AutoType auto_type_annotation = param.getAnnotation(AutoType.class);
|
||||
String auto_parameter_name = auto_type_annotation.value();
|
||||
ParameterDeclaration auto_parameter = Utils.findParameter(method, auto_parameter_name);
|
||||
String auto_type = typeinfos_instance.get(auto_parameter).getAutoType();
|
||||
if (auto_type == null)
|
||||
final AutoType auto_type_annotation = param.getAnnotation(AutoType.class);
|
||||
final ParameterDeclaration auto_parameter = Utils.findParameter(method, auto_type_annotation.value());
|
||||
final String auto_type = typeinfos_instance.get(auto_parameter).getAutoType();
|
||||
if ( auto_type == null )
|
||||
throw new RuntimeException("No auto type for parameter " + param.getSimpleName() + " in method " + method);
|
||||
writer.print(auto_type);
|
||||
} else if (AutoSize.class.equals(param_type)) {
|
||||
AutoSize auto_type_annotation = param.getAnnotation(AutoSize.class);
|
||||
String auto_parameter_name = auto_type_annotation.value();
|
||||
ParameterDeclaration auto_target_param = Utils.findParameter(method, auto_parameter_name);
|
||||
TypeInfo auto_target_type_info = typeinfos_instance.get(auto_target_param);
|
||||
if ( auto_type_annotation.canBeNull() )
|
||||
writer.print("((" + auto_parameter_name + " == null ? 0 : " + auto_parameter_name + ".remaining())");
|
||||
else
|
||||
writer.print("(" + auto_parameter_name + ".remaining()");
|
||||
// Shift the remaining if the target parameter is multityped and there's no AutoType to track type
|
||||
boolean shift_remaining = !hasAnyParameterAutoTypeAnnotation(method, auto_target_param) && Utils.isParameterMultiTyped(auto_target_param);
|
||||
if (shift_remaining) {
|
||||
int shifting = getBufferElementSizeExponent(auto_target_type_info.getType());
|
||||
if (shifting > 0)
|
||||
writer.print(" << " + shifting);
|
||||
final AutoSize auto_size_annotation = param.getAnnotation(AutoSize.class);
|
||||
final String auto_parameter_name = auto_size_annotation.value();
|
||||
final ParameterDeclaration auto_target_param = Utils.findParameter(method, auto_parameter_name);
|
||||
final TypeInfo auto_target_type_info = typeinfos_instance.get(auto_target_param);
|
||||
final boolean shift_remaining = !hasAnyParameterAutoTypeAnnotation(method, auto_target_param) && Utils.isParameterMultiTyped(auto_target_param);
|
||||
int shifting = 0;
|
||||
if ( shift_remaining ) {
|
||||
shifting = getBufferElementSizeExponent(auto_target_type_info.getType());
|
||||
if ( shifting > 0 )
|
||||
writer.print("(");
|
||||
}
|
||||
if ( auto_size_annotation.canBeNull() )
|
||||
writer.print("(" + auto_parameter_name + " == null ? 0 : " + auto_parameter_name + ".remaining())");
|
||||
else
|
||||
writer.print(auto_parameter_name + ".remaining()");
|
||||
// Shift the remaining if the target parameter is multityped and there's no AutoType to track type
|
||||
if (shift_remaining && shifting > 0) {
|
||||
writer.print(" << " + shifting);
|
||||
writer.print(")");
|
||||
writer.print(auto_type_annotation.expression());
|
||||
}
|
||||
writer.print(auto_size_annotation.expression());
|
||||
} else
|
||||
throw new RuntimeException("Unknown auto annotation " + param_type);
|
||||
} else {
|
||||
|
@ -407,14 +483,15 @@ public class JavaMethodsGenerator {
|
|||
writer.print(param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX);
|
||||
} else {
|
||||
Class type = typeinfos_instance.get(param).getType();
|
||||
Check check_annotation = param.getAnnotation(Check.class);
|
||||
boolean hide_buffer = mode == Mode.AUTOS && getAutoTypeParameter(method, param) != null;
|
||||
if (hide_buffer)
|
||||
if (hide_buffer) {
|
||||
writer.print("null");
|
||||
else {
|
||||
} else {
|
||||
if ( type == CharSequence.class || type == CharSequence[].class ) {
|
||||
final String offset = Utils.getStringOffset(method, param);
|
||||
|
||||
writer.print("APIUtils.getBuffer");
|
||||
writer.print("APIUtil.getBuffer");
|
||||
if ( param.getAnnotation(NullTerminated.class) != null )
|
||||
writer.print("NT");
|
||||
writer.print("(" + param.getSimpleName());
|
||||
|
@ -422,23 +499,36 @@ public class JavaMethodsGenerator {
|
|||
writer.print(", " + offset);
|
||||
writer.print(")");
|
||||
hide_buffer = true;
|
||||
} else
|
||||
} else {
|
||||
final AutoSize auto_size_annotation = param.getAnnotation(AutoSize.class);
|
||||
if ( auto_size_annotation != null )
|
||||
writer.print(auto_size_annotation.value() + "_");
|
||||
writer.print(param.getSimpleName());
|
||||
if ( PointerBuffer.class.isAssignableFrom(type) ) {
|
||||
if ( check_annotation != null && check_annotation.canBeNull() )
|
||||
writer.print(" != null ? " + param.getSimpleName());
|
||||
writer.print(".getBuffer()");
|
||||
if ( check_annotation != null && check_annotation.canBeNull() )
|
||||
writer.print(" : null");
|
||||
}
|
||||
}
|
||||
}
|
||||
Class buffer_type = Utils.getNIOBufferType(param.getType());
|
||||
if (buffer_type != null) {
|
||||
writer.print(", ");
|
||||
if (!hide_buffer) {
|
||||
TypeInfo type_info = typeinfos_instance.get(param);
|
||||
Check check_annotation = param.getAnnotation(Check.class);
|
||||
int shifting;
|
||||
if (Utils.getNIOBufferType(param.getType()).equals(Buffer.class))
|
||||
shifting = getBufferElementSizeExponent(type_info.getType());
|
||||
else
|
||||
if (Utils.getNIOBufferType(param.getType()).equals(Buffer.class)) {
|
||||
shifting = getBufferElementSizeExponent(type == Buffer.class ? ByteBuffer.class : type); // TODO: This will always throw an exception
|
||||
//shifting = 0;
|
||||
} else
|
||||
shifting = 0;
|
||||
writer.print(param.getSimpleName());
|
||||
if (check_annotation != null && check_annotation.canBeNull())
|
||||
writer.print(" != null ? " + param.getSimpleName());
|
||||
if ( type == PointerBuffer.class )
|
||||
writer.print(".positionByte()");
|
||||
else
|
||||
writer.print(".position()");
|
||||
if (shifting > 0)
|
||||
writer.print(" << " + shifting);
|
||||
|
@ -449,8 +539,8 @@ public class JavaMethodsGenerator {
|
|||
writer.print(offset == null ? "0" : offset);
|
||||
} else
|
||||
writer.print("0");
|
||||
} else {
|
||||
GLpointer pointer_annotation = param.getAnnotation(GLpointer.class);
|
||||
} else if ( type != long.class ) {
|
||||
PointerWrapper pointer_annotation = param.getAnnotation(PointerWrapper.class);
|
||||
if ( pointer_annotation != null ) {
|
||||
if ( pointer_annotation.canBeNull() )
|
||||
writer.print(" == null ? 0 : " + param.getSimpleName());
|
||||
|
@ -464,8 +554,12 @@ public class JavaMethodsGenerator {
|
|||
|
||||
private static boolean printMethodCallArguments(PrintWriter writer, MethodDeclaration method, Map<ParameterDeclaration, TypeInfo> typeinfos_instance, Mode mode) {
|
||||
boolean first_parameter = true;
|
||||
for (ParameterDeclaration param : method.getParameters())
|
||||
if (param.getAnnotation(Result.class) == null) {
|
||||
for ( ParameterDeclaration param : method.getParameters() ) {
|
||||
if ( param.getAnnotation(Result.class) != null || param.getAnnotation(Helper.class) != null )
|
||||
continue;
|
||||
|
||||
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);
|
||||
}
|
||||
if (Utils.getNIOBufferType(Utils.getMethodReturnType(method)) != null) {
|
||||
|
@ -473,6 +567,8 @@ public class JavaMethodsGenerator {
|
|||
first_parameter = false;
|
||||
Utils.printExtraCallArguments(writer, method, "");
|
||||
} else {
|
||||
AutoSize auto_size_annotation = method.getAnnotation(AutoSize.class);
|
||||
if ( auto_size_annotation == null || !auto_size_annotation.isNative() ) {
|
||||
if (!first_parameter)
|
||||
writer.print(", ");
|
||||
first_parameter = false;
|
||||
|
@ -480,16 +576,15 @@ public class JavaMethodsGenerator {
|
|||
String result_size_expression;
|
||||
if ( mode == Mode.CACHEDRESULT )
|
||||
result_size_expression = Utils.CACHED_BUFFER_LENGTH_NAME;
|
||||
else {
|
||||
AutoResultSize auto_result_size_annotation = method.getAnnotation(AutoResultSize.class);
|
||||
if (auto_result_size_annotation == null)
|
||||
else if ( auto_size_annotation == null )
|
||||
result_size_expression = Utils.RESULT_SIZE_NAME;
|
||||
else
|
||||
result_size_expression = auto_result_size_annotation.value();
|
||||
}
|
||||
result_size_expression = auto_size_annotation.value();
|
||||
|
||||
Utils.printExtraCallArguments(writer, method, result_size_expression);
|
||||
}
|
||||
}
|
||||
}
|
||||
return first_parameter;
|
||||
}
|
||||
|
||||
|
@ -531,14 +626,33 @@ public class JavaMethodsGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
private static void printParameterChecks(PrintWriter writer, MethodDeclaration method, Map<ParameterDeclaration, TypeInfo> typeinfos, Mode mode) {
|
||||
private static void printParameterChecks(PrintWriter writer, MethodDeclaration method, Map<ParameterDeclaration, TypeInfo> typeinfos, Mode mode, final boolean generate_error_checks) {
|
||||
if ( mode == Mode.NORMAL ) {
|
||||
final GenerateAutos gen_autos_annotation = method.getAnnotation(GenerateAutos.class);
|
||||
if ( gen_autos_annotation != null && gen_autos_annotation.sizeVariables().length > 0 ) {
|
||||
// For the auto-generated parameters, declare and init a size variable (that can be reused by @Code)
|
||||
for ( final ParameterDeclaration param : method.getParameters() ) {
|
||||
if ( Arrays.binarySearch(gen_autos_annotation.sizeVariables(), param.getSimpleName()) >= 0 ) {
|
||||
final int shifting = getBufferElementSizeExponent(typeinfos.get(param).getType());
|
||||
final Check check_annotation = param.getAnnotation(Check.class);
|
||||
|
||||
writer.print("\t\tlong " + param.getSimpleName() + "_size = ");
|
||||
if ( check_annotation == null || !check_annotation.canBeNull() )
|
||||
writer.println(param.getSimpleName() + ".remaining() << " + shifting + ";");
|
||||
else
|
||||
writer.println(param.getSimpleName() + " == null ? 0 : " + param.getSimpleName() + ".remaining() << " + shifting + ";");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (ParameterDeclaration param : method.getParameters()) {
|
||||
Class java_type = Utils.getJavaType(param.getType());
|
||||
if (Utils.isAddressableType(java_type) &&
|
||||
if ( java_type.isArray() || (Utils.isAddressableType(java_type) &&
|
||||
(mode != Mode.BUFFEROBJECT || param.getAnnotation(BufferObject.class) == null) &&
|
||||
(mode != Mode.AUTOS || getAutoTypeParameter(method, param) == null) &&
|
||||
param.getAnnotation(Result.class) == null &&
|
||||
!Utils.isReturnParameter(method, param) ) {
|
||||
!Utils.isReturnParameter(method, param)) ) {
|
||||
String check_value = null;
|
||||
boolean can_be_null = false;
|
||||
Check check_annotation = param.getAnnotation(Check.class);
|
||||
|
@ -546,59 +660,115 @@ public class JavaMethodsGenerator {
|
|||
check_value = check_annotation.value();
|
||||
can_be_null = check_annotation.canBeNull();
|
||||
}
|
||||
NullTerminated null_terminated = param.getAnnotation(NullTerminated.class);
|
||||
if (Buffer.class.isAssignableFrom(java_type) && param.getAnnotation(Constant.class) == null) {
|
||||
if ((Buffer.class.isAssignableFrom(java_type) || PointerBuffer.class.isAssignableFrom(java_type)) && param.getAnnotation(Constant.class) == null) {
|
||||
boolean indirect_buffer_allowed = false && param.getAnnotation(CachedReference.class) == null; // DISABLED: indirect buffer support
|
||||
boolean out_parameter = param.getAnnotation(OutParameter.class) != null;
|
||||
TypeInfo typeinfo = typeinfos.get(param);
|
||||
printParameterCheck(writer, param.getSimpleName(), typeinfo.getType().getSimpleName(), check_value, can_be_null, null_terminated, indirect_buffer_allowed, out_parameter);
|
||||
printParameterCheck(writer, method, param.getSimpleName(), typeinfo.getType().getSimpleName(), check_value, can_be_null, param.getAnnotation(NullTerminated.class), indirect_buffer_allowed, out_parameter, generate_error_checks);
|
||||
} else if ( String.class.equals(java_type)) {
|
||||
if (!can_be_null)
|
||||
writer.println("\t\tBufferChecks.checkNotNull(" + param.getSimpleName() + ");");
|
||||
} else if ( java_type.isArray() ) {
|
||||
final TypeInfo typeinfo = typeinfos.get(param);
|
||||
printArrayParameterCheck(writer, param.getSimpleName(), typeinfo.getType().getSimpleName(), check_value, can_be_null);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (method.getAnnotation(CachedResult.class) != null)
|
||||
printParameterCheck(writer, Utils.CACHED_BUFFER_NAME, null, null, true, null, false, false);
|
||||
printParameterCheck(writer, method, Utils.CACHED_BUFFER_NAME, null, null, true, null, false, false, generate_error_checks);
|
||||
}
|
||||
|
||||
private static void printParameterCheck(PrintWriter writer, String name, String type, String check_value, boolean can_be_null, NullTerminated null_terminated, boolean indirect_buffer_allowed, boolean out_parameter) {
|
||||
private static void printParameterCheck(PrintWriter writer, MethodDeclaration method, String name, String type, String check_value, boolean can_be_null, NullTerminated null_terminated, boolean indirect_buffer_allowed, boolean out_parameter, final boolean generate_error_checks) {
|
||||
if (indirect_buffer_allowed && out_parameter) {
|
||||
writer.println("\t\t" + type + " " + name + SAVED_PARAMETER_POSTFIX + " = " + name + ";");
|
||||
}
|
||||
String tabs;
|
||||
if (can_be_null) {
|
||||
writer.println("\t\tif (" + name + " != null)");
|
||||
writer.print("\t");
|
||||
}
|
||||
writer.print("\t\tif (" + name + " != null)");
|
||||
if ( null_terminated != null )
|
||||
writer.println(" {");
|
||||
else
|
||||
writer.println();
|
||||
tabs = "\t\t\t";
|
||||
} else
|
||||
tabs = "\t\t";
|
||||
if (indirect_buffer_allowed) {
|
||||
writer.print("\t\t" + name + " = NondirectBufferWrapper.wrap");
|
||||
writer.print(tabs + name + " = NondirectBufferWrapper.wrap");
|
||||
if (out_parameter)
|
||||
writer.print("NoCopy");
|
||||
} else
|
||||
writer.print("\t\tBufferChecks.check");
|
||||
if (check_value != null && !"".equals(check_value) ) {
|
||||
writer.print("Buffer(" + name + ", " + check_value);
|
||||
writer.print(tabs + "BufferChecks.check");
|
||||
if (check_value != null && check_value.length() > 0) {
|
||||
writer.print("Buffer");
|
||||
if ( "Buffer".equals(type) )
|
||||
writer.print("Size"); // Check size only, Buffer.isDirect() was added in 1.6, cannot use yet. TODO: Remove?
|
||||
writer.print("(" + name + ", " + check_value);
|
||||
} else {
|
||||
writer.print("Direct(" + name);
|
||||
}
|
||||
writer.println(");");
|
||||
if ( can_be_null && generate_error_checks ) {
|
||||
final Check check_annotation = method.getAnnotation(Check.class);
|
||||
if ( check_annotation != null && check_annotation.value().equals(name) ) {
|
||||
writer.println("\t\telse");
|
||||
writer.println("\t\t\t" + name + " = APIUtil.getBufferIntDebug();"); // Use an exclusive buffer here
|
||||
}
|
||||
}
|
||||
if (null_terminated != null) {
|
||||
writer.print("\t\tBufferChecks.checkNullTerminated(");
|
||||
writer.print(tabs + "BufferChecks.checkNullTerminated(");
|
||||
writer.print(name);
|
||||
if ( null_terminated.value().length() > 0 ) {
|
||||
writer.print(", ");
|
||||
writer.print(null_terminated.value());
|
||||
}
|
||||
writer.println(");");
|
||||
if ( can_be_null )
|
||||
writer.println("\t\t}");
|
||||
}
|
||||
}
|
||||
|
||||
private static void printResultType(PrintWriter writer, MethodDeclaration method, boolean native_stub) {
|
||||
if ( native_stub && method.getAnnotation(GLpointer.class) != null )
|
||||
writer.print("long");
|
||||
else if ( !native_stub && method.getAnnotation(GLreturn.class) != null )
|
||||
writer.print(Utils.getMethodReturnType(method, method.getAnnotation(GLreturn.class), false));
|
||||
else
|
||||
writer.print(Utils.getMethodReturnType(method).toString());
|
||||
private static void printArrayParameterCheck(PrintWriter writer, String name, String type, String check_value, boolean can_be_null) {
|
||||
String tabs;
|
||||
if ( can_be_null ) {
|
||||
writer.println("\t\tif (" + name + " != null)");
|
||||
tabs = "\t\t\t";
|
||||
} else
|
||||
tabs = "\t\t";
|
||||
|
||||
writer.print(tabs + "BufferChecks.checkArray(" + name);
|
||||
if ( check_value != null && check_value.length() > 0)
|
||||
writer.print(", " + check_value);
|
||||
writer.println(");");
|
||||
}
|
||||
|
||||
private static String getResultType(MethodDeclaration method, boolean native_stub) {
|
||||
if ( native_stub && method.getAnnotation(PointerWrapper.class) != null )
|
||||
return "long";
|
||||
else if ( !native_stub && method.getAnnotation(GLreturn.class) != null )
|
||||
return Utils.getMethodReturnType(method, method.getAnnotation(GLreturn.class), false);
|
||||
else
|
||||
return Utils.getJavaType(Utils.getMethodReturnType(method)).getSimpleName();
|
||||
}
|
||||
|
||||
private static String getDefaultResultValue(MethodDeclaration method) {
|
||||
if ( method.getAnnotation(GLreturn.class) != null ) {
|
||||
final String type = Utils.getMethodReturnType(method, method.getAnnotation(GLreturn.class), false);
|
||||
if ( "boolean".equals(type) )
|
||||
return "false";
|
||||
else if ( Character.isLowerCase(type.charAt(0)) )
|
||||
return "0";
|
||||
else
|
||||
return "null";
|
||||
} else {
|
||||
final Class type = Utils.getJavaType(Utils.getMethodReturnType(method));
|
||||
if ( type.isPrimitive() ) {
|
||||
if ( type == boolean.class )
|
||||
return "false";
|
||||
else
|
||||
return "0";
|
||||
} else
|
||||
return "null";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -32,11 +32,14 @@
|
|||
|
||||
package org.lwjgl.util.generator;
|
||||
|
||||
import org.lwjgl.opencl.CLMem;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import com.sun.mirror.type.*;
|
||||
import com.sun.mirror.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* A TypeVisitor that translates (annotated) TypeMirrors to
|
||||
* java types (represented by a Class)
|
||||
*
|
||||
|
@ -56,10 +59,42 @@ public class JavaTypeTranslator implements TypeVisitor {
|
|||
}
|
||||
|
||||
public void visitArrayType(ArrayType t) {
|
||||
if ( "java.lang.CharSequence".equals(t.getComponentType().toString()) )
|
||||
final TypeMirror componentType = t.getComponentType();
|
||||
if ( componentType instanceof PrimitiveType ) {
|
||||
type = getPrimitiveArrayClassFromKind(((PrimitiveType)componentType).getKind());
|
||||
} else {
|
||||
try {
|
||||
final Class c = Class.forName(t.getComponentType().toString());
|
||||
if ( CharSequence.class.isAssignableFrom(c) || ByteBuffer.class.isAssignableFrom(c) || org.lwjgl.PointerWrapper.class.isAssignableFrom(c) )
|
||||
type = Class.forName("[L" + t.getComponentType() + ";");
|
||||
else {
|
||||
throw new RuntimeException(t + " is not allowed");
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
final String className = t.getComponentType().toString();
|
||||
if ( "java.lang.CharSequence".equals(className) )
|
||||
type = CharSequence[].class;
|
||||
else if ( "java.nio.ByteBuffer".equals(className) )
|
||||
type = ByteBuffer[].class;
|
||||
else if ( "org.lwjgl.opencl.CLMem".equals(className) )
|
||||
type = CLMem[].class;
|
||||
else
|
||||
throw new RuntimeException(t + " is not allowed");
|
||||
//*/
|
||||
/*
|
||||
try {
|
||||
System.out.println("t = " + t);
|
||||
System.out.println("t.getClass() = " + t.getClass());
|
||||
System.out.println("t.getComponentType() = " + t.getComponentType());
|
||||
type = Class.forName(t.toString());
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}*/
|
||||
}
|
||||
|
||||
public static Class getPrimitiveClassFromKind(PrimitiveType.Kind kind) {
|
||||
|
@ -83,6 +118,27 @@ public class JavaTypeTranslator implements TypeVisitor {
|
|||
}
|
||||
}
|
||||
|
||||
private static Class getPrimitiveArrayClassFromKind(PrimitiveType.Kind kind) {
|
||||
switch ( kind ) {
|
||||
case LONG:
|
||||
return long[].class;
|
||||
case INT:
|
||||
return int[].class;
|
||||
case DOUBLE:
|
||||
return double[].class;
|
||||
case FLOAT:
|
||||
return float[].class;
|
||||
case SHORT:
|
||||
return short[].class;
|
||||
case BYTE:
|
||||
return byte[].class;
|
||||
case BOOLEAN:
|
||||
return boolean[].class;
|
||||
default:
|
||||
throw new RuntimeException(kind + " is not allowed");
|
||||
}
|
||||
}
|
||||
|
||||
public void visitPrimitiveType(PrimitiveType t) {
|
||||
type = getPrimitiveClassFromKind(t.getKind());
|
||||
}
|
||||
|
|
|
@ -41,6 +41,8 @@ package org.lwjgl.util.generator;
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
import org.lwjgl.PointerBuffer;
|
||||
|
||||
import com.sun.mirror.apt.*;
|
||||
import com.sun.mirror.declaration.*;
|
||||
import com.sun.mirror.type.*;
|
||||
|
@ -52,12 +54,13 @@ import java.nio.*;
|
|||
public class NativeMethodStubsGenerator {
|
||||
private static final String BUFFER_ADDRESS_POSTFIX = "_address";
|
||||
public static final String BUFFER_POSITION_POSTFIX = "_position";
|
||||
private static final String STRING_LIST_POSTFIX = "_str";
|
||||
private static final String STRING_LIST_NAME = "_str";
|
||||
private static final String POINTER_LIST_NAME = "_ptr";
|
||||
|
||||
public static void generateNativeMethodStubs(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, InterfaceDeclaration d, boolean generate_error_checks, boolean context_specific) {
|
||||
for (MethodDeclaration method : d.getMethods()) {
|
||||
Alternate alt_annotation = method.getAnnotation(Alternate.class);
|
||||
if ( alt_annotation != null && !alt_annotation.nativeAlt() )
|
||||
if ( (alt_annotation != null && (!alt_annotation.nativeAlt() || alt_annotation.skipNative())) || method.getAnnotation(Reuse.class) != null )
|
||||
continue;
|
||||
generateMethodStub(env, type_map, writer, Utils.getQualifiedClassName(d), method, Mode.NORMAL, generate_error_checks, context_specific);
|
||||
if (Utils.hasMethodBufferObjectParameter(method))
|
||||
|
@ -66,16 +69,20 @@ public class NativeMethodStubsGenerator {
|
|||
}
|
||||
|
||||
private static void generateParameters(PrintWriter writer, Collection<ParameterDeclaration> params, Mode mode) {
|
||||
for (ParameterDeclaration param : params)
|
||||
if (param.getAnnotation(Result.class) == null)
|
||||
for (ParameterDeclaration param : params) {
|
||||
if ( param.getAnnotation(Helper.class) != null || param.getAnnotation(Result.class) != null )
|
||||
continue;
|
||||
final Constant constant_annotation = param.getAnnotation(Constant.class);
|
||||
if ( constant_annotation == null || !constant_annotation.isNative() )
|
||||
generateParameter(writer, param, mode);
|
||||
}
|
||||
}
|
||||
|
||||
private static void generateParameter(PrintWriter writer, ParameterDeclaration param, Mode mode) {
|
||||
writer.print(", ");
|
||||
if (mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null) {
|
||||
writer.print("jlong " + param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX);
|
||||
} else if ( param.getAnnotation(GLpointer.class) != null ) {
|
||||
} else if ( param.getAnnotation(PointerWrapper.class) != null ) {
|
||||
writer.print("jlong " + param.getSimpleName());
|
||||
} else {
|
||||
JNITypeTranslator translator = new JNITypeTranslator();
|
||||
|
@ -92,9 +99,11 @@ public class NativeMethodStubsGenerator {
|
|||
else
|
||||
writer.print("JNIEXPORT ");
|
||||
|
||||
TypeMirror result_type = Utils.getMethodReturnType(method);
|
||||
final TypeMirror result_type = Utils.getMethodReturnType(method);
|
||||
final CachedResult cached_result_annotation = method.getAnnotation(CachedResult.class);
|
||||
final AutoSize auto_size_annotation = method.getAnnotation(AutoSize.class);
|
||||
|
||||
if ( method.getAnnotation(GLpointer.class) != null ) {
|
||||
if ( method.getAnnotation(PointerWrapper.class) != null ) {
|
||||
writer.print("jlong");
|
||||
} else {
|
||||
JNITypeTranslator translator = new JNITypeTranslator();
|
||||
|
@ -109,8 +118,7 @@ public class NativeMethodStubsGenerator {
|
|||
writer.print("(JNIEnv *env, jclass clazz");
|
||||
generateParameters(writer, method.getParameters(), mode);
|
||||
if (Utils.getNIOBufferType(result_type) != null) {
|
||||
CachedResult cached_result_annotation = method.getAnnotation(CachedResult.class);
|
||||
if (cached_result_annotation == null || !cached_result_annotation.isRange())
|
||||
if ( (cached_result_annotation == null || !cached_result_annotation.isRange()) && (auto_size_annotation == null || !auto_size_annotation.isNative()) )
|
||||
writer.print(", jlong " + Utils.RESULT_SIZE_NAME);
|
||||
if (cached_result_annotation != null)
|
||||
writer.print(", jobject " + Utils.CACHED_BUFFER_NAME);
|
||||
|
@ -119,6 +127,7 @@ public class NativeMethodStubsGenerator {
|
|||
writer.print(", jlong " + Utils.FUNCTION_POINTER_VAR_NAME);
|
||||
}
|
||||
writer.println(") {");
|
||||
|
||||
generateBufferParameterAddresses(type_map, writer, method, mode);
|
||||
Alternate alt_annotation = method.getAnnotation(Alternate.class);
|
||||
if (context_specific) {
|
||||
|
@ -127,49 +136,59 @@ public class NativeMethodStubsGenerator {
|
|||
writer.print(" = (" + typedef_name + ")((intptr_t)");
|
||||
writer.println(Utils.FUNCTION_POINTER_VAR_NAME + ");");
|
||||
}
|
||||
generateStringListInits(writer, method.getParameters());
|
||||
|
||||
final Code code_annotation = method.getAnnotation(Code.class);
|
||||
|
||||
final boolean hasResult = !result_type.equals(env.getTypeUtils().getVoidType());
|
||||
final boolean resultPreDeclare = hasResult && (hasPointerArrayInits(method.getParameters()) || (code_annotation != null && (code_annotation.nativeAfterVars().length() > 0 || code_annotation.nativeBeforeCall().length() > 0)));
|
||||
if ( resultPreDeclare )
|
||||
printResultParam(type_map, writer, method, result_type, true);
|
||||
|
||||
if ( code_annotation != null && code_annotation.nativeAfterVars().length() > 0 )
|
||||
writer.println(code_annotation.nativeAfterVars());
|
||||
|
||||
generatePointerArrayInits(type_map, writer, method.getParameters());
|
||||
|
||||
if ( code_annotation != null && code_annotation.nativeBeforeCall().length() > 0 )
|
||||
writer.println(code_annotation.nativeBeforeCall());
|
||||
|
||||
writer.print("\t");
|
||||
if (!result_type.equals(env.getTypeUtils().getVoidType())) {
|
||||
Declaration return_declaration;
|
||||
ParameterDeclaration result_param = Utils.getResultParameter(method);
|
||||
if (result_param != null)
|
||||
return_declaration = result_param;
|
||||
else
|
||||
return_declaration = method;
|
||||
NativeTypeTranslator native_translator = new NativeTypeTranslator(type_map, return_declaration);
|
||||
result_type.accept(native_translator);
|
||||
writer.print(native_translator.getSignature() + " " + Utils.RESULT_VAR_NAME);
|
||||
if (result_param != null) {
|
||||
writer.println(";");
|
||||
writer.print("\t");
|
||||
} else
|
||||
writer.print(" = ");
|
||||
}
|
||||
if ( resultPreDeclare )
|
||||
writer.print(Utils.RESULT_VAR_NAME + " = ");
|
||||
else if ( hasResult )
|
||||
printResultParam(type_map, writer, method, result_type, false);
|
||||
writer.print((alt_annotation == null ? method.getSimpleName() : alt_annotation.value()) + "(");
|
||||
generateCallParameters(writer, type_map, method.getParameters());
|
||||
writer.print(")");
|
||||
writer.println(";");
|
||||
|
||||
if ( code_annotation != null && code_annotation.nativeAfterCall().length() > 0 )
|
||||
writer.println(code_annotation.nativeAfterCall());
|
||||
|
||||
generateStringDeallocations(writer, method.getParameters());
|
||||
if (!result_type.equals(env.getTypeUtils().getVoidType())) {
|
||||
writer.print("\treturn ");
|
||||
Class java_result_type = Utils.getJavaType(result_type);
|
||||
if (Buffer.class.isAssignableFrom(java_result_type)) {
|
||||
if (method.getAnnotation(CachedResult.class) != null)
|
||||
if (cached_result_annotation != null)
|
||||
writer.print("safeNewBufferCached(env, ");
|
||||
else
|
||||
writer.print("safeNewBuffer(env, ");
|
||||
} else if (String.class.equals(java_result_type)) {
|
||||
writer.print("NewStringNativeUnsigned(env, ");
|
||||
} else if ( method.getAnnotation(GLpointer.class) != null ) {
|
||||
} else if ( method.getAnnotation(PointerWrapper.class) != null ) {
|
||||
writer.print("(intptr_t)");
|
||||
}
|
||||
writer.print(Utils.RESULT_VAR_NAME);
|
||||
if (Buffer.class.isAssignableFrom(java_result_type)) {
|
||||
writer.print(", ");
|
||||
if (method.getAnnotation(CachedResult.class) != null && method.getAnnotation(CachedResult.class).isRange())
|
||||
Utils.printExtraCallArguments(writer, method, method.getAnnotation(AutoResultSize.class).value());
|
||||
final String size_parameter_name;
|
||||
if ( auto_size_annotation != null && (auto_size_annotation.isNative() || (cached_result_annotation != null && cached_result_annotation.isRange())) )
|
||||
size_parameter_name = auto_size_annotation.value();
|
||||
else
|
||||
Utils.printExtraCallArguments(writer, method, Utils.RESULT_SIZE_NAME);
|
||||
size_parameter_name = Utils.RESULT_SIZE_NAME;
|
||||
|
||||
writer.print(", ");
|
||||
Utils.printExtraCallArguments(writer, method, size_parameter_name);
|
||||
}
|
||||
if (Buffer.class.isAssignableFrom(java_result_type) ||
|
||||
String.class.equals(java_result_type))
|
||||
|
@ -180,73 +199,116 @@ public class NativeMethodStubsGenerator {
|
|||
writer.println();
|
||||
}
|
||||
|
||||
private static void printResultParam(final TypeMap type_map, final PrintWriter writer, final MethodDeclaration method, final TypeMirror result_type, final boolean preDeclare) {
|
||||
final ParameterDeclaration result_param = Utils.getResultParameter(method);
|
||||
final Declaration return_declaration = result_param == null ? method : result_param;
|
||||
final NativeTypeTranslator result_translator = new NativeTypeTranslator(type_map, return_declaration);
|
||||
result_type.accept(result_translator);
|
||||
if ( preDeclare )
|
||||
writer.print("\t");
|
||||
writer.print(result_translator.getSignature() + " " + Utils.RESULT_VAR_NAME);
|
||||
if ( preDeclare)
|
||||
writer.println(";");
|
||||
else
|
||||
writer.print(result_param == null ? " = " : ";\n\t");
|
||||
}
|
||||
|
||||
private static void generateCallParameters(PrintWriter writer, TypeMap type_map, Collection<ParameterDeclaration> params) {
|
||||
if (params.size() > 0) {
|
||||
Iterator<ParameterDeclaration> it = params.iterator();
|
||||
generateCallParameter(writer, type_map, it.next());
|
||||
while (it.hasNext()) {
|
||||
boolean first = true;
|
||||
for ( ParameterDeclaration param : params ) {
|
||||
if ( param.getAnnotation(Helper.class) != null )
|
||||
continue;
|
||||
|
||||
if ( first )
|
||||
first = false;
|
||||
else
|
||||
writer.print(", ");
|
||||
generateCallParameter(writer, type_map, it.next());
|
||||
|
||||
generateCallParameter(writer, type_map, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void generateCallParameter(PrintWriter writer, TypeMap type_map, ParameterDeclaration param) {
|
||||
if ( param.getAnnotation(Helper.class) != null )
|
||||
return;
|
||||
|
||||
final Constant constant_annotation = param.getAnnotation(Constant.class);
|
||||
if ( constant_annotation != null && constant_annotation.isNative() ) {
|
||||
writer.print(constant_annotation.value());
|
||||
return;
|
||||
}
|
||||
|
||||
boolean is_indirect = param.getAnnotation(Indirect.class) != null;
|
||||
if (is_indirect || param.getAnnotation(StringList.class) != null) {
|
||||
if (is_indirect || param.getAnnotation(PointerArray.class) != null) {
|
||||
writer.print("(");
|
||||
NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param);
|
||||
final NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param);
|
||||
param.getType().accept(translator);
|
||||
writer.print(translator.getSignature());
|
||||
writer.print("*)");
|
||||
}
|
||||
if ( param.getAnnotation(GLpointer.class) != null )
|
||||
writer.print("(" + param.getAnnotation(GLpointer.class).value() + ")(intptr_t)");
|
||||
if ( param.getAnnotation(PointerWrapper.class) != null )
|
||||
writer.print("(" + param.getAnnotation(PointerWrapper.class).value() + ")(intptr_t)");
|
||||
if (param.getAnnotation(Result.class) != null || is_indirect)
|
||||
writer.print("&");
|
||||
if (param.getAnnotation(Result.class) != null) {
|
||||
|
||||
if ( param.getAnnotation(Result.class) != null ) {
|
||||
writer.print(Utils.RESULT_VAR_NAME);
|
||||
} else {
|
||||
writer.print(param.getSimpleName());
|
||||
if ( param.getAnnotation(StringList.class) != null )
|
||||
writer.print(STRING_LIST_POSTFIX);
|
||||
else if (Utils.isAddressableType(param.getType()))
|
||||
if ( param.getAnnotation(PointerArray.class) != null )
|
||||
writer.print(getPointerArrayName(Utils.getJavaType(param.getType())));
|
||||
else if ( Utils.isAddressableType(param.getType()) )
|
||||
writer.print(BUFFER_ADDRESS_POSTFIX);
|
||||
}
|
||||
}
|
||||
|
||||
private static void generateStringDeallocations(PrintWriter writer, Collection<ParameterDeclaration> params) {
|
||||
for (ParameterDeclaration param : params) {
|
||||
if (Utils.getJavaType(param.getType()).equals(String.class) &&
|
||||
param.getAnnotation(Result.class) == null)
|
||||
final Class java_type = Utils.getJavaType(param.getType());
|
||||
if ( java_type.equals(String.class) && param.getAnnotation(Result.class) == null )
|
||||
writer.println("\tfree(" + param.getSimpleName() + BUFFER_ADDRESS_POSTFIX + ");");
|
||||
else if (param.getAnnotation(StringList.class) != null ) // Free the string array mem
|
||||
writer.println("\tfree(" + param.getSimpleName() + STRING_LIST_POSTFIX + ");");
|
||||
else if (param.getAnnotation(PointerArray.class) != null ) // Free the string array mem
|
||||
writer.println("\tfree(" + param.getSimpleName() + getPointerArrayName(java_type) + ");");
|
||||
}
|
||||
}
|
||||
|
||||
private static void generateBufferParameterAddresses(TypeMap type_map, PrintWriter writer, MethodDeclaration method, Mode mode) {
|
||||
boolean loopDeclared = false;
|
||||
for (ParameterDeclaration param : method.getParameters())
|
||||
if (Utils.isAddressableType(param.getType()) && param.getAnnotation(Result.class) == null)
|
||||
loopDeclared = generateBufferParameterAddress(type_map, writer, method, param, mode, loopDeclared);
|
||||
strLoopDeclared = false;
|
||||
ptrLoopDeclared = false;
|
||||
for ( ParameterDeclaration param : method.getParameters() ) {
|
||||
final Constant constant_annotation = param.getAnnotation(Constant.class);
|
||||
if ( param.getAnnotation(Result.class) == null && (constant_annotation == null || !constant_annotation.isNative()) && Utils.isAddressableType(param.getType()))
|
||||
generateBufferParameterAddress(type_map, writer, method, param, mode);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean generateBufferParameterAddress(TypeMap type_map, PrintWriter writer, MethodDeclaration method, ParameterDeclaration param, Mode mode, boolean loopDeclared) {
|
||||
NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param);
|
||||
private static boolean strLoopDeclared;
|
||||
private static boolean ptrLoopDeclared;
|
||||
|
||||
private static void generateBufferParameterAddress(TypeMap type_map, PrintWriter writer, MethodDeclaration method, ParameterDeclaration param, Mode mode) {
|
||||
final Check check_annotation = param.getAnnotation(Check.class);
|
||||
final PointerArray array_annotation = param.getAnnotation(PointerArray.class);
|
||||
final Class java_type = Utils.getJavaType(param.getType());
|
||||
|
||||
final NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param);
|
||||
param.getType().accept(translator);
|
||||
writer.print("\t" + translator.getSignature() + param.getSimpleName());
|
||||
final String native_type = translator.getSignature();
|
||||
|
||||
if ( !java_type.isArray() || CharSequence.class.isAssignableFrom(java_type.getComponentType()) ) {
|
||||
writer.print("\t" + native_type + param.getSimpleName());
|
||||
writer.print(BUFFER_ADDRESS_POSTFIX + " = ((");
|
||||
writer.print(translator.getSignature());
|
||||
Check check_annotation = param.getAnnotation(Check.class);
|
||||
writer.print(native_type);
|
||||
writer.print(")");
|
||||
|
||||
if (mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null) {
|
||||
writer.print("offsetToPointer(" + param.getSimpleName() + Utils.BUFFER_OBJECT_PARAMETER_POSTFIX + "))");
|
||||
} else {
|
||||
Class java_type = Utils.getJavaType(param.getType());
|
||||
if (Buffer.class.isAssignableFrom(java_type) || java_type.equals(CharSequence.class) || java_type.equals(CharSequence[].class)) {
|
||||
if (Buffer.class.isAssignableFrom(java_type) || java_type.equals(CharSequence.class) || java_type.equals(CharSequence[].class) || PointerBuffer.class.isAssignableFrom(java_type) ) {
|
||||
boolean explicitly_byte_sized = java_type.equals(Buffer.class) ||
|
||||
translator.getAnnotationType().equals(type_map.getVoidType());
|
||||
translator.getAnnotationType().equals(type_map.getVoidType()) ||
|
||||
param.getAnnotation(NativeType.class) != null;
|
||||
if (explicitly_byte_sized)
|
||||
writer.print("(((char *)");
|
||||
if (method.getAnnotation(GenerateAutos.class) != null || (check_annotation != null && check_annotation.canBeNull())) {
|
||||
|
@ -260,55 +322,105 @@ public class NativeMethodStubsGenerator {
|
|||
writer.print("))");
|
||||
} else if (java_type.equals(String.class)) {
|
||||
writer.print("GetStringNativeChars(env, " + param.getSimpleName() + "))");
|
||||
} else
|
||||
} else if ( array_annotation == null )
|
||||
throw new RuntimeException("Illegal type " + java_type);
|
||||
}
|
||||
writer.println(";");
|
||||
}
|
||||
|
||||
if ( param.getAnnotation(StringList.class) != null ) {
|
||||
if ( Utils.getJavaType(param.getType()) != CharSequence[].class && (
|
||||
param.getAnnotation(GLchar.class) == null ||
|
||||
param.getAnnotation(NullTerminated.class) == null ||
|
||||
param.getAnnotation(NullTerminated.class).value().length() == 0
|
||||
)
|
||||
)
|
||||
throw new RuntimeException("StringList annotation can only be applied on null-terminated GLchar buffers.");
|
||||
if ( array_annotation != null ) {
|
||||
final String n = getPointerArrayName(java_type);
|
||||
final String arrayType;
|
||||
if ( POINTER_LIST_NAME.equals(n) ) {
|
||||
if ( n.equals(param.getSimpleName()) )
|
||||
throw new RuntimeException("The name '" + n + "' is not valid for object array arguments annotated with PointerArray");
|
||||
|
||||
if ( "_str".equals(param.getSimpleName()) )
|
||||
throw new RuntimeException("The name '_str' is not valid for arguments annotated with StringList");
|
||||
arrayType = translator.getSignature(true) + (org.lwjgl.PointerWrapper.class.isAssignableFrom(java_type.getComponentType()) ? " " : "");
|
||||
|
||||
// Declare loop counters and allocate object array
|
||||
if ( !ptrLoopDeclared ) {
|
||||
writer.println("\tunsigned int " + n + "_i;");
|
||||
writer.println("\tjobject " + n + "_object;");
|
||||
ptrLoopDeclared = true;
|
||||
}
|
||||
} else {
|
||||
if ( n.equals(param.getSimpleName()) )
|
||||
throw new RuntimeException("The name '" + n + "' is not valid for arguments annotated with PointerArray");
|
||||
|
||||
arrayType = translator.getSignature(true);
|
||||
|
||||
// Declare loop counters and allocate string array
|
||||
if ( !loopDeclared ) {
|
||||
writer.println("\tunsigned int _str_i;");
|
||||
writer.println("\tGLchar *_str_address;");
|
||||
loopDeclared = true;
|
||||
if ( !strLoopDeclared ) {
|
||||
writer.println("\tunsigned int " + n + "_i;");
|
||||
writer.println("\t" + arrayType + n + "_address;");
|
||||
strLoopDeclared = true;
|
||||
}
|
||||
writer.println("\tGLchar **" + param.getSimpleName() + STRING_LIST_POSTFIX + " = (GLchar **) malloc(" + param.getAnnotation(StringList.class).value() + "*sizeof(GLchar*));");
|
||||
}
|
||||
return loopDeclared;
|
||||
}
|
||||
|
||||
private static void generateStringListInits(PrintWriter writer, Collection<ParameterDeclaration> params) {
|
||||
writer.print("\t" + arrayType + "*" + param.getSimpleName() + n + " = ");
|
||||
if ( check_annotation != null && check_annotation.canBeNull() )
|
||||
writer.print(array_annotation.value() + " == 0 ? NULL : ");
|
||||
writer.println("(" + arrayType + "*) malloc(" + array_annotation.value() + " * sizeof(" + arrayType + "));");
|
||||
}
|
||||
}
|
||||
|
||||
private static String getPointerArrayName(final Class java_type) {
|
||||
final Class<?> component_type = java_type.getComponentType();
|
||||
if ( component_type != null && (Buffer.class.isAssignableFrom(component_type) || org.lwjgl.PointerWrapper.class.isAssignableFrom(component_type)) )
|
||||
return POINTER_LIST_NAME;
|
||||
else
|
||||
return STRING_LIST_NAME;
|
||||
}
|
||||
|
||||
private static boolean hasPointerArrayInits(Collection<ParameterDeclaration> params) {
|
||||
for ( ParameterDeclaration param : params ) {
|
||||
StringList stringList_annotation = param.getAnnotation(StringList.class);
|
||||
if ( stringList_annotation != null ) {
|
||||
String lengths = stringList_annotation.lengths();
|
||||
PointerArray pointerArray_annotation = param.getAnnotation(PointerArray.class);
|
||||
if ( pointerArray_annotation != null )
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static void generatePointerArrayInits(TypeMap type_map, PrintWriter writer, Collection<ParameterDeclaration> params) {
|
||||
for ( ParameterDeclaration param : params ) {
|
||||
PointerArray pointerArray_annotation = param.getAnnotation(PointerArray.class);
|
||||
if ( pointerArray_annotation != null ) {
|
||||
final Class java_type = Utils.getJavaType(param.getType());
|
||||
final Class<?> component_type = java_type.isArray() ? java_type.getComponentType() : null;
|
||||
final NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param);
|
||||
param.getType().accept(translator);
|
||||
|
||||
final String n = getPointerArrayName(java_type);
|
||||
if ( POINTER_LIST_NAME.equals(n) ) {
|
||||
// Init vars
|
||||
writer.println("\t" + n + "_i = 0;");
|
||||
// Fill pointer array with the buffer pointers
|
||||
writer.println("\twhile ( " + n + "_i < " + pointerArray_annotation.value() + " ) {");
|
||||
if ( component_type.isAssignableFrom(Buffer.class) )
|
||||
writer.println("\t\t" + n + "_object = (*env)->GetObjectArrayElement(env, " + param.getSimpleName() + ", " + n + "_i);");
|
||||
else
|
||||
writer.println("\t\t" + n + "_object = (*env)->GetObjectArrayElement(env, " + param.getSimpleName() + ", " + n + "_i);");
|
||||
writer.println("\t\t" + param.getSimpleName() + n + "[" + n + "_i++] = (" + translator.getSignature(true) + ")(intptr_t)getPointerWrapperAddress(env, " + n + "_object);");
|
||||
writer.println("\t}");
|
||||
} else {
|
||||
final String lengths = pointerArray_annotation.lengths();
|
||||
|
||||
// Init vars
|
||||
writer.println("\t_str_i = 0;");
|
||||
writer.println("\t_str_address = (GLchar *)" + param.getSimpleName() + BUFFER_ADDRESS_POSTFIX + ";");
|
||||
writer.println("\t" + n + "_i = 0;");
|
||||
writer.println("\t" + n + "_address = (" + translator.getSignature(true) + ")" + param.getSimpleName() + BUFFER_ADDRESS_POSTFIX + ";");
|
||||
// Fill string array with the string pointers
|
||||
writer.println("\twhile ( _str_i < " + stringList_annotation.value() + " ) {");
|
||||
writer.println("\twhile ( " + n + "_i < " + pointerArray_annotation.value() + " ) {");
|
||||
if ( lengths.length() == 0 ) {
|
||||
writer.println("\t\t" + param.getSimpleName() + STRING_LIST_POSTFIX + "[_str_i++] = _str_address;");
|
||||
writer.println("\t\t_str_address += strlen(_str_address) + 1;");
|
||||
writer.println("\t\t" + param.getSimpleName() + n + "[" + n + "_i++] = " + n + "_address;");
|
||||
writer.println("\t\t" + n + "_address += strlen(" + n + "_address) + 1;");
|
||||
} else {
|
||||
writer.println("\t\t" + param.getSimpleName() + STRING_LIST_POSTFIX + "[_str_i] = _str_address;");
|
||||
writer.println("\t\t_str_address += " + lengths + BUFFER_ADDRESS_POSTFIX + "[_str_i++];");
|
||||
writer.println("\t\t" + param.getSimpleName() + n + "[" + n + "_i] = " + n + "_address;");
|
||||
writer.println("\t\t" + n + "_address += " + lengths + BUFFER_ADDRESS_POSTFIX + "[" + n + "_i++];");
|
||||
}
|
||||
writer.println("\t}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@ package org.lwjgl.util.generator;
|
|||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
||||
@Target(ElementType.ANNOTATION_TYPE)
|
||||
@Target({ElementType.ANNOTATION_TYPE, ElementType.PARAMETER})
|
||||
public @interface NativeType {
|
||||
String value() default "";
|
||||
}
|
||||
|
|
|
@ -42,22 +42,21 @@ package org.lwjgl.util.generator;
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
import org.lwjgl.opengl.PointerWrapper;
|
||||
|
||||
import com.sun.mirror.declaration.*;
|
||||
import com.sun.mirror.type.*;
|
||||
import com.sun.mirror.util.*;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import java.nio.*;
|
||||
import org.lwjgl.PointerBuffer;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.nio.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import com.sun.mirror.declaration.AnnotationMirror;
|
||||
import com.sun.mirror.declaration.Declaration;
|
||||
import com.sun.mirror.type.*;
|
||||
import com.sun.mirror.util.TypeVisitor;
|
||||
|
||||
/**
|
||||
* $Id$
|
||||
*
|
||||
* <p/>
|
||||
* A TypeVisitor that translates (annotated) TypeMirrors to
|
||||
* native types
|
||||
*
|
||||
|
@ -65,6 +64,7 @@ import java.lang.annotation.Annotation;
|
|||
* @version $Revision$
|
||||
*/
|
||||
public class NativeTypeTranslator implements TypeVisitor {
|
||||
|
||||
private Collection<Class> native_types;
|
||||
private boolean is_indirect;
|
||||
private final Declaration declaration;
|
||||
|
@ -76,24 +76,30 @@ public class NativeTypeTranslator implements TypeVisitor {
|
|||
}
|
||||
|
||||
public String getSignature() {
|
||||
return getSignature(false);
|
||||
}
|
||||
|
||||
public String getSignature(final boolean skipConst) {
|
||||
StringBuilder signature = new StringBuilder();
|
||||
if (declaration.getAnnotation(Const.class) != null)
|
||||
if ( !skipConst && declaration.getAnnotation(Const.class) != null )
|
||||
signature.append("const ");
|
||||
|
||||
if ( declaration.getAnnotation(GLpointer.class) != null ) {
|
||||
signature.append(declaration.getAnnotation(GLpointer.class).value());
|
||||
if ( declaration.getAnnotation(PointerWrapper.class) != null ) {
|
||||
signature.append(declaration.getAnnotation(PointerWrapper.class).value());
|
||||
} else if ( declaration.getAnnotation(NativeType.class) != null ) {
|
||||
signature.append(declaration.getAnnotation(NativeType.class).value());
|
||||
} else {
|
||||
// Use the name of the native type annotation as the C type name
|
||||
signature.append(getAnnotationType().getSimpleName());
|
||||
}
|
||||
|
||||
if (is_indirect)
|
||||
if ( is_indirect )
|
||||
signature.append(" *");
|
||||
return signature.toString();
|
||||
}
|
||||
|
||||
public Class getAnnotationType() {
|
||||
if (native_types.size() != 1)
|
||||
if ( native_types.size() != 1 )
|
||||
throw new RuntimeException("Expected only one native type for declaration " + declaration +
|
||||
", but got " + native_types.size());
|
||||
return native_types.iterator().next();
|
||||
|
@ -104,34 +110,43 @@ public class NativeTypeTranslator implements TypeVisitor {
|
|||
}
|
||||
|
||||
public void visitArrayType(ArrayType t) {
|
||||
if ( "java.lang.CharSequence".equals(t.getComponentType().toString()) ) {
|
||||
final Class<?> type = Utils.getJavaType(t).getComponentType();
|
||||
|
||||
if ( CharSequence.class.isAssignableFrom(type) ) {
|
||||
is_indirect = true;
|
||||
native_types = new ArrayList<Class>();
|
||||
native_types.add(GLchar.class);
|
||||
native_types.add(type_map.getStringArrayType());
|
||||
} else if ( Buffer.class.isAssignableFrom(type) ) {
|
||||
is_indirect = true;
|
||||
native_types = new ArrayList<Class>();
|
||||
native_types.add(type_map.getByteBufferArrayType());
|
||||
} else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(type) ) {
|
||||
is_indirect = false;
|
||||
} else
|
||||
throw new RuntimeException(t + " is not allowed");
|
||||
}
|
||||
|
||||
public static PrimitiveType.Kind getPrimitiveKindFromBufferClass(Class c) {
|
||||
if (IntBuffer.class.equals(c))
|
||||
if ( IntBuffer.class.equals(c) )
|
||||
return PrimitiveType.Kind.INT;
|
||||
else if (DoubleBuffer.class.equals(c))
|
||||
else if ( DoubleBuffer.class.equals(c) )
|
||||
return PrimitiveType.Kind.DOUBLE;
|
||||
else if (ShortBuffer.class.equals(c))
|
||||
else if ( ShortBuffer.class.equals(c) )
|
||||
return PrimitiveType.Kind.SHORT;
|
||||
else if (ByteBuffer.class.equals(c))
|
||||
else if ( ByteBuffer.class.equals(c) || PointerBuffer.class.equals(c) )
|
||||
return PrimitiveType.Kind.BYTE;
|
||||
else if (FloatBuffer.class.equals(c))
|
||||
else if ( FloatBuffer.class.equals(c) )
|
||||
return PrimitiveType.Kind.FLOAT;
|
||||
else if (LongBuffer.class.equals(c))
|
||||
else if ( LongBuffer.class.equals(c) )
|
||||
return PrimitiveType.Kind.LONG;
|
||||
else
|
||||
throw new RuntimeException(c + " is not allowed");
|
||||
}
|
||||
|
||||
public static Class<?> getClassFromType(DeclaredType t) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Class<? extends Annotation> getClassFromType(DeclaredType t) {
|
||||
try {
|
||||
return Class.forName(t.getDeclaration().getQualifiedName());
|
||||
return (Class<? extends Annotation>)Class.forName(t.getDeclaration().getQualifiedName());
|
||||
} catch (ClassNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -139,7 +154,7 @@ public class NativeTypeTranslator implements TypeVisitor {
|
|||
|
||||
private void getNativeTypeFromAnnotatedPrimitiveType(PrimitiveType.Kind kind) {
|
||||
native_types = translateAnnotations();
|
||||
if (native_types.size() == 0)
|
||||
if ( native_types.size() == 0 )
|
||||
native_types.add(type_map.getNativeTypeFromPrimitiveType(kind));
|
||||
}
|
||||
|
||||
|
@ -147,18 +162,21 @@ public class NativeTypeTranslator implements TypeVisitor {
|
|||
is_indirect = true;
|
||||
|
||||
Class<?> c = getClassFromType(t);
|
||||
if (String.class.equals(c)) {
|
||||
if ( String.class.equals(c) ) {
|
||||
native_types = new ArrayList<Class>();
|
||||
native_types.add(type_map.getStringElementType());
|
||||
} else if (Buffer.class.equals(c)) {
|
||||
} else if ( Buffer.class.equals(c) ) {
|
||||
native_types = new ArrayList<Class>();
|
||||
native_types.add(type_map.getVoidType());
|
||||
} else if (Buffer.class.isAssignableFrom(c)) {
|
||||
} else if ( Buffer.class.isAssignableFrom(c) ) {
|
||||
PrimitiveType.Kind kind = getPrimitiveKindFromBufferClass(c);
|
||||
getNativeTypeFromAnnotatedPrimitiveType(kind);
|
||||
} else if ( PointerWrapper.class.isAssignableFrom(c) ) {
|
||||
} else if ( PointerBuffer.class.isAssignableFrom(c) ) {
|
||||
native_types = new ArrayList<Class>();
|
||||
native_types.add(GLpointer.class);
|
||||
native_types.add(PointerBuffer.class);
|
||||
} else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(c) ) {
|
||||
native_types = new ArrayList<Class>();
|
||||
native_types.add(PointerWrapper.class);
|
||||
|
||||
is_indirect = false;
|
||||
} else
|
||||
|
@ -182,13 +200,14 @@ public class NativeTypeTranslator implements TypeVisitor {
|
|||
}
|
||||
|
||||
// Check if the annotation is itself annotated with a certain annotation type
|
||||
|
||||
public static <T extends Annotation> T getAnnotation(AnnotationMirror annotation, Class<T> type) {
|
||||
return annotation.getAnnotationType().getDeclaration().getAnnotation(type);
|
||||
}
|
||||
|
||||
private static Class translateAnnotation(AnnotationMirror annotation) {
|
||||
NativeType native_type = getAnnotation(annotation, NativeType.class);
|
||||
if (native_type != null) {
|
||||
if ( native_type != null ) {
|
||||
return getClassFromType(annotation.getAnnotationType());
|
||||
} else
|
||||
return null;
|
||||
|
@ -196,9 +215,9 @@ public class NativeTypeTranslator implements TypeVisitor {
|
|||
|
||||
private Collection<Class> translateAnnotations() {
|
||||
Collection<Class> result = new ArrayList<Class>();
|
||||
for (AnnotationMirror annotation : Utils.getSortedAnnotations(declaration.getAnnotationMirrors())) {
|
||||
for ( AnnotationMirror annotation : Utils.getSortedAnnotations(declaration.getAnnotationMirrors()) ) {
|
||||
Class translated_result = translateAnnotation(annotation);
|
||||
if (translated_result != null) {
|
||||
if ( translated_result != null ) {
|
||||
result.add(translated_result);
|
||||
}
|
||||
}
|
||||
|
@ -219,7 +238,7 @@ public class NativeTypeTranslator implements TypeVisitor {
|
|||
|
||||
public void visitVoidType(VoidType t) {
|
||||
native_types = translateAnnotations();
|
||||
if (native_types.size() == 0)
|
||||
if ( native_types.size() == 0 )
|
||||
native_types.add(void.class);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ import java.lang.annotation.ElementType;
|
|||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.PARAMETER, ElementType.METHOD})
|
||||
public @interface StringList {
|
||||
public @interface PointerArray {
|
||||
/** Number of values in the string list (name of native-side parameter) */
|
||||
String value();
|
||||
/** List of string lengths (name of native-side parameter) */
|
|
@ -38,7 +38,9 @@ import java.lang.annotation.Target;
|
|||
import java.lang.annotation.ElementType;
|
||||
|
||||
@Target({ElementType.PARAMETER, ElementType.METHOD})
|
||||
public @interface GLpointer {
|
||||
public @interface PointerWrapper {
|
||||
String value(); // The native pointer type.
|
||||
boolean canBeNull() default false; // Whether the pointer may be null.
|
||||
String params() default ""; // Pass these extra parameters when constructing PointerWrapper objects.
|
||||
String factory() default ""; // Use this factory method call instead of normal object construction.
|
||||
}
|
|
@ -46,6 +46,7 @@ import com.sun.mirror.declaration.*;
|
|||
import com.sun.mirror.type.*;
|
||||
import com.sun.mirror.util.*;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.nio.*;
|
||||
|
||||
public class PostfixTranslator implements TypeVisitor {
|
||||
|
@ -108,7 +109,7 @@ public class PostfixTranslator implements TypeVisitor {
|
|||
private boolean translateAnnotation(AnnotationMirror annotation) {
|
||||
NativeType native_type = NativeTypeTranslator.getAnnotation(annotation, NativeType.class);
|
||||
if (native_type != null) {
|
||||
Class annotation_class = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType());
|
||||
Class<? extends Annotation> annotation_class = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType());
|
||||
signature.append(type_map.translateAnnotation(annotation_class));
|
||||
return true;
|
||||
} else
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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;
|
||||
|
||||
/**
|
||||
* Extension templates marked with <code>@Private</code> will result in classes without the <code>public</code> keyword.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
public @interface Private {
|
||||
|
||||
}
|
|
@ -41,6 +41,8 @@ package org.lwjgl.util.generator;
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
import org.lwjgl.opencl.CLMem;
|
||||
|
||||
import com.sun.mirror.declaration.*;
|
||||
import com.sun.mirror.type.*;
|
||||
|
||||
|
@ -52,7 +54,8 @@ public class RegisterStubsGenerator {
|
|||
Iterator<? extends MethodDeclaration> it = d.getMethods().iterator();
|
||||
while (it.hasNext()) {
|
||||
MethodDeclaration method = it.next();
|
||||
if ( method.getAnnotation(Alternate.class) != null )
|
||||
Alternate alt_annotation = method.getAnnotation(Alternate.class);
|
||||
if ( (alt_annotation != null && (!alt_annotation.nativeAlt() || alt_annotation.skipNative())) || method.getAnnotation(Reuse.class) != null )
|
||||
continue;
|
||||
EnumSet<Platform> platforms;
|
||||
PlatformDependent platform_annotation = method.getAnnotation(PlatformDependent.class);
|
||||
|
@ -83,20 +86,30 @@ public class RegisterStubsGenerator {
|
|||
Collection<ParameterDeclaration> params = method.getParameters();
|
||||
String signature = "(";
|
||||
for (ParameterDeclaration param : params) {
|
||||
if (param.getAnnotation(Result.class) != null)
|
||||
if ( param.getAnnotation(Helper.class) != null || param.getAnnotation(Result.class) != null )
|
||||
continue;
|
||||
if (mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null) {
|
||||
|
||||
final Constant constant_annotation = param.getAnnotation(Constant.class);
|
||||
if ( constant_annotation != null && constant_annotation.isNative() )
|
||||
continue;
|
||||
|
||||
if (mode == Mode.BUFFEROBJECT && param.getAnnotation(BufferObject.class) != null)
|
||||
signature += "I";
|
||||
} else {
|
||||
else
|
||||
signature += getTypeSignature(param.getType(), true);
|
||||
}
|
||||
}
|
||||
TypeMirror result_type = Utils.getMethodReturnType(method);
|
||||
if (Utils.getNIOBufferType(result_type) != null)
|
||||
signature += "I";
|
||||
|
||||
final TypeMirror result_type = Utils.getMethodReturnType(method);
|
||||
final CachedResult cached_result_annotation = method.getAnnotation(CachedResult.class);
|
||||
final AutoSize auto_size_annotation = method.getAnnotation(AutoSize.class);
|
||||
|
||||
if ( Utils.getNIOBufferType(result_type) != null && (auto_size_annotation == null || !auto_size_annotation.isNative()) )
|
||||
signature += "J";
|
||||
|
||||
String result_type_signature = getTypeSignature(result_type, false);
|
||||
if (method.getAnnotation(CachedResult.class) != null)
|
||||
if ( cached_result_annotation != null )
|
||||
signature += result_type_signature;
|
||||
|
||||
signature += ")";
|
||||
signature += result_type_signature;
|
||||
return signature;
|
||||
|
@ -110,8 +123,11 @@ public class RegisterStubsGenerator {
|
|||
writer.print(Utils.getQualifiedNativeMethodName(Utils.getQualifiedClassName(d), method, generate_error_checks, context_specific));
|
||||
if (mode == Mode.BUFFEROBJECT)
|
||||
writer.print(Utils.BUFFER_OBJECT_METHOD_POSTFIX);
|
||||
String opengl_handle_name = method.getSimpleName().replaceFirst("gl", platform.getPrefix());
|
||||
writer.print(", \"" + opengl_handle_name + "\", (void *)&" + method.getSimpleName() + "}");
|
||||
|
||||
final Alternate alt_annotation = method.getAnnotation(Alternate.class);
|
||||
final String methodName = alt_annotation == null ? method.getSimpleName() : alt_annotation.value();
|
||||
String opengl_handle_name = methodName.replaceFirst("gl", platform.getPrefix());
|
||||
writer.print(", \"" + opengl_handle_name + "\", (void *)&" + methodName + "}");
|
||||
if (has_more)
|
||||
writer.println(",");
|
||||
}
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Reuse can be used to annotate methods that duplicate functionality that has been already
|
||||
* defined somewhere else. For example, this can be applied to OpenGL core functionality that
|
||||
* exists as an ARB extension as well, but with the exact same entry points.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
public @interface Reuse {
|
||||
/** The extension Class that defines the method. */
|
||||
String value();
|
||||
|
||||
}
|
|
@ -41,6 +41,8 @@ package org.lwjgl.util.generator;
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
import org.lwjgl.PointerBuffer;
|
||||
|
||||
import com.sun.mirror.type.*;
|
||||
import com.sun.mirror.util.*;
|
||||
|
||||
|
@ -67,18 +69,34 @@ class SignatureTranslator implements TypeVisitor {
|
|||
}
|
||||
|
||||
public void visitArrayType(ArrayType t) {
|
||||
final Class type = Utils.getJavaType(t.getComponentType());
|
||||
if ( CharSequence.class.isAssignableFrom(type) )
|
||||
signature.append("Ljava/nio/ByteBuffer;I");
|
||||
else if ( Buffer.class.isAssignableFrom(type) )
|
||||
signature.append("[Ljava/nio/ByteBuffer;");
|
||||
else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(type) )
|
||||
signature.append("[L" + getNativeNameFromClassName(type.getName()) + ";");
|
||||
else
|
||||
throw new RuntimeException(t + " is not allowed");
|
||||
}
|
||||
|
||||
public void visitClassType(ClassType t) {
|
||||
String type_name = getNativeNameFromClassName(t.getDeclaration().getQualifiedName());
|
||||
Class type = NativeTypeTranslator.getClassFromType(t);
|
||||
String type_name;
|
||||
if ( CharSequence.class.isAssignableFrom(type) || CharSequence[].class.isAssignableFrom(type) || PointerBuffer.class.isAssignableFrom(type) )
|
||||
type_name = ByteBuffer.class.getName();
|
||||
else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(type) ) {
|
||||
signature.append("J");
|
||||
return;
|
||||
} else
|
||||
type_name = t.getDeclaration().getQualifiedName();
|
||||
|
||||
signature.append("L");
|
||||
signature.append(type_name);
|
||||
signature.append(getNativeNameFromClassName(type_name));
|
||||
signature.append(";");
|
||||
if (add_position_signature && Buffer.class.isAssignableFrom(NativeTypeTranslator.getClassFromType(t))) {
|
||||
if ( add_position_signature && Utils.isAddressableType(type) )
|
||||
signature.append("I");
|
||||
}
|
||||
}
|
||||
|
||||
public void visitDeclaredType(DeclaredType t) {
|
||||
throw new RuntimeException(t + " is not allowed");
|
||||
|
|
|
@ -41,9 +41,12 @@ package org.lwjgl.util.generator;
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.opengl.GLvoid;
|
||||
|
||||
import com.sun.mirror.declaration.*;
|
||||
import com.sun.mirror.type.*;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.*;
|
||||
import java.nio.*;
|
||||
|
||||
|
@ -95,6 +98,9 @@ public class TypeInfo {
|
|||
case BYTE:
|
||||
type = byte.class;
|
||||
break;
|
||||
case BOOLEAN:
|
||||
type = boolean.class;
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException(kind + " is not allowed");
|
||||
}
|
||||
|
@ -151,7 +157,7 @@ public class TypeInfo {
|
|||
for (AnnotationMirror annotation : annotations) {
|
||||
NativeType native_type_annotation = NativeTypeTranslator.getAnnotation(annotation, NativeType.class);
|
||||
if (native_type_annotation != null) {
|
||||
Class annotation_type = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType());
|
||||
Class<? extends Annotation> annotation_type = NativeTypeTranslator.getClassFromType(annotation.getAnnotationType());
|
||||
Signedness signedness = type_map.getSignednessFromType(annotation_type);
|
||||
Class inverse_type = type_map.getInverseType(annotation_type);
|
||||
String auto_type = type_map.getAutoTypeFromAnnotation(annotation);
|
||||
|
|
|
@ -45,19 +45,25 @@ import com.sun.mirror.declaration.*;
|
|||
import com.sun.mirror.type.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
public interface TypeMap {
|
||||
String getErrorCheckMethodName();
|
||||
void printCapabilitiesInit(PrintWriter writer);
|
||||
String getCapabilities();
|
||||
void printErrorCheckMethod(PrintWriter writer, MethodDeclaration method, String tabs);
|
||||
String getRegisterNativesFunctionName();
|
||||
PrimitiveType.Kind getPrimitiveTypeFromNativeType(Class native_type);
|
||||
String getTypedefPrefix();
|
||||
PrimitiveType.Kind getPrimitiveTypeFromNativeType(Class<? extends Annotation> native_type);
|
||||
String getTypedefPostfix();
|
||||
String getFunctionPrefix();
|
||||
void printNativeIncludes(PrintWriter writer);
|
||||
Class getStringElementType();
|
||||
Class<? extends Annotation> getStringElementType();
|
||||
Class<? extends Annotation> getStringArrayType();
|
||||
Class<? extends Annotation> getByteBufferArrayType();
|
||||
Class[] getValidAnnotationTypes(Class type);
|
||||
Class getVoidType();
|
||||
String translateAnnotation(Class annotation_type);
|
||||
Class<? extends Annotation> getVoidType();
|
||||
String translateAnnotation(Class<? extends Annotation> annotation_type);
|
||||
Class getNativeTypeFromPrimitiveType(PrimitiveType.Kind kind);
|
||||
String getAutoTypeFromAnnotation(AnnotationMirror annotation);
|
||||
Class getInverseType(Class type);
|
||||
Signedness getSignednessFromType(Class type);
|
||||
Class<? extends Annotation> getInverseType(Class<? extends Annotation> type);
|
||||
Signedness getSignednessFromType(Class<? extends Annotation> type);
|
||||
}
|
||||
|
|
|
@ -51,11 +51,12 @@ public class TypedefsGenerator {
|
|||
private static void generateNativeTypedefs(TypeMap type_map, PrintWriter writer, MethodDeclaration method) {
|
||||
TypeMirror return_type = method.getReturnType();
|
||||
writer.print("typedef ");
|
||||
writer.print(type_map.getTypedefPostfix());
|
||||
NativeTypeTranslator translator = new NativeTypeTranslator(type_map, method);
|
||||
return_type.accept(translator);
|
||||
writer.print(translator.getSignature());
|
||||
writer.print(" (");
|
||||
writer.print(type_map.getTypedefPrefix());
|
||||
writer.print(type_map.getFunctionPrefix());
|
||||
writer.print(" *" + Utils.getTypedefName(method) + ") (");
|
||||
generateNativeTypedefsParameters(type_map, writer, method.getParameters());
|
||||
writer.println(");");
|
||||
|
@ -63,11 +64,17 @@ public class TypedefsGenerator {
|
|||
|
||||
private static void generateNativeTypedefsParameters(TypeMap type_map, PrintWriter writer, Collection<ParameterDeclaration> params) {
|
||||
if (params.size() > 0) {
|
||||
Iterator<ParameterDeclaration> it = params.iterator();
|
||||
generateNativeTypedefsParameter(type_map, writer, it.next());
|
||||
while (it.hasNext()) {
|
||||
boolean first = true;
|
||||
for ( ParameterDeclaration param : params ) {
|
||||
if ( param.getAnnotation(Helper.class) != null )
|
||||
continue;
|
||||
|
||||
if ( first )
|
||||
first = false;
|
||||
else
|
||||
writer.print(", ");
|
||||
generateNativeTypedefsParameter(type_map, writer, it.next());
|
||||
|
||||
generateNativeTypedefsParameter(type_map, writer, param);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -76,14 +83,14 @@ public class TypedefsGenerator {
|
|||
NativeTypeTranslator translator = new NativeTypeTranslator(type_map, param);
|
||||
param.getType().accept(translator);
|
||||
writer.print(translator.getSignature());
|
||||
if (param.getAnnotation(Result.class) != null || param.getAnnotation(Indirect.class) != null || param.getAnnotation(StringList.class) != null)
|
||||
if (param.getAnnotation(Result.class) != null || param.getAnnotation(Indirect.class) != null || param.getAnnotation(PointerArray.class) != null)
|
||||
writer.print("*");
|
||||
writer.print(" " + param.getSimpleName());
|
||||
}
|
||||
|
||||
public static void generateNativeTypedefs(TypeMap type_map, PrintWriter writer, Collection<? extends MethodDeclaration> methods) {
|
||||
for (MethodDeclaration method : methods) {
|
||||
if ( method.getAnnotation(Alternate.class) == null )
|
||||
if ( method.getAnnotation(Alternate.class) == null && method.getAnnotation(Reuse.class) == null )
|
||||
generateNativeTypedefs(type_map, writer, method);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,12 @@ package org.lwjgl.util.generator;
|
|||
* $Id$
|
||||
*/
|
||||
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.util.generator.opengl.GLboolean;
|
||||
import org.lwjgl.util.generator.opengl.GLchar;
|
||||
import org.lwjgl.util.generator.opengl.GLcharARB;
|
||||
import org.lwjgl.util.generator.opengl.GLreturn;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
|
@ -75,11 +81,19 @@ public class Utils {
|
|||
}
|
||||
|
||||
public static String getFunctionAddressName(InterfaceDeclaration interface_decl, MethodDeclaration method, boolean forceAlt) {
|
||||
Alternate alt_annotation = method.getAnnotation(Alternate.class);
|
||||
final Alternate alt_annotation = method.getAnnotation(Alternate.class);
|
||||
|
||||
/* Removed prefix so that we can identify reusable entry points, removed postfix because it's not needed and looks nicer.
|
||||
String interfaceName = interface_decl.getSimpleName(); // If we add this back, we need to fix @Reuse (add a param for the template name)
|
||||
if ( alt_annotation == null || (alt_annotation.nativeAlt() && !forceAlt) )
|
||||
return interface_decl.getSimpleName() + "_" + method.getSimpleName() + FUNCTION_POINTER_POSTFIX;
|
||||
return interfaceName + "_" + method.getSimpleName() + FUNCTION_POINTER_POSTFIX;
|
||||
else
|
||||
return interface_decl.getSimpleName() + "_" + alt_annotation.value() + FUNCTION_POINTER_POSTFIX;
|
||||
return interfaceName + "_" + alt_annotation.value() + FUNCTION_POINTER_POSTFIX;
|
||||
*/
|
||||
if ( alt_annotation == null || (alt_annotation.nativeAlt() && !forceAlt) )
|
||||
return method.getSimpleName();
|
||||
else
|
||||
return alt_annotation.value();
|
||||
}
|
||||
|
||||
public static boolean isFinal(InterfaceDeclaration d) {
|
||||
|
@ -115,7 +129,15 @@ public class Utils {
|
|||
}
|
||||
|
||||
public static boolean isAddressableType(Class type) {
|
||||
return Buffer.class.isAssignableFrom(type) || String.class.equals(type) || CharSequence.class.equals(type) || CharSequence[].class.equals(type);
|
||||
if ( type.isArray() ) {
|
||||
final Class component_type = type.getComponentType();
|
||||
return isAddressableTypeImpl(component_type) || org.lwjgl.PointerWrapper.class.isAssignableFrom(component_type);
|
||||
}
|
||||
return isAddressableTypeImpl(type);
|
||||
}
|
||||
|
||||
private static boolean isAddressableTypeImpl(Class type) {
|
||||
return Buffer.class.isAssignableFrom(type) || PointerBuffer.class.isAssignableFrom(type) || CharSequence.class.isAssignableFrom(type);
|
||||
}
|
||||
|
||||
public static Class getJavaType(TypeMirror type_mirror) {
|
||||
|
@ -149,11 +171,23 @@ public class Utils {
|
|||
public static void printDocComment(PrintWriter writer, Declaration decl) {
|
||||
String doc_comment = decl.getDocComment();
|
||||
if (doc_comment != null) {
|
||||
String tab = decl instanceof InterfaceDeclaration ? "" : "\t";
|
||||
final String tab = decl instanceof InterfaceDeclaration ? "" : "\t";
|
||||
writer.println(tab + "/**");
|
||||
StringTokenizer doc_lines = new StringTokenizer(doc_comment, "\n");
|
||||
while (doc_lines.hasMoreTokens())
|
||||
writer.println(tab + " * " + doc_lines.nextToken());
|
||||
|
||||
final StringTokenizer doc_lines = new StringTokenizer(doc_comment, "\n", true);
|
||||
boolean lastWasNL = false;
|
||||
while (doc_lines.hasMoreTokens()) {
|
||||
final String t = doc_lines.nextToken();
|
||||
if ( "\n".equals(t) ) {
|
||||
if ( lastWasNL )
|
||||
writer.println(tab + " *");
|
||||
lastWasNL = true;
|
||||
} else {
|
||||
writer.println(tab + " * " + t);
|
||||
lastWasNL = false;
|
||||
}
|
||||
}
|
||||
|
||||
writer.println(tab + " */");
|
||||
} else if ( (decl instanceof MethodDeclaration) && decl.getAnnotation(Alternate.class) != null )
|
||||
writer.println("\t/** Overloads " + decl.getAnnotation(Alternate.class).value() + " */");
|
||||
|
@ -241,7 +275,7 @@ public class Utils {
|
|||
}
|
||||
|
||||
public static boolean needResultSize(MethodDeclaration method) {
|
||||
return getNIOBufferType(getMethodReturnType(method)) != null && method.getAnnotation(AutoResultSize.class) == null;
|
||||
return getNIOBufferType(getMethodReturnType(method)) != null && method.getAnnotation(AutoSize.class) == null;
|
||||
}
|
||||
|
||||
public static void printExtraCallArguments(PrintWriter writer, MethodDeclaration method, String size_parameter_name) {
|
||||
|
@ -289,7 +323,7 @@ public class Utils {
|
|||
Class<?> param_type = getJavaType(t);
|
||||
if (Buffer.class.isAssignableFrom(param_type))
|
||||
return param_type;
|
||||
else if ( param_type == CharSequence.class || param_type == CharSequence[].class )
|
||||
else if ( param_type == CharSequence.class || param_type == CharSequence[].class || param_type == PointerBuffer.class )
|
||||
return ByteBuffer.class;
|
||||
else
|
||||
return null;
|
||||
|
@ -337,9 +371,9 @@ public class Utils {
|
|||
|
||||
} else if ( type.equals(CharSequence[].class) ) {
|
||||
if ( offset == null )
|
||||
offset = "APIUtils.getTotalLength(" + p.getSimpleName() + ")";
|
||||
offset = "APIUtil.getTotalLength(" + p.getSimpleName() + ")";
|
||||
else
|
||||
offset += " + APIUtils.getTotalLength(" + p.getSimpleName() + ")";
|
||||
offset += " + APIUtil.getTotalLength(" + p.getSimpleName() + ")";
|
||||
if ( p.getAnnotation(NullTerminated.class) != null ) offset += " + " + p.getSimpleName() + ".length";
|
||||
}
|
||||
|
||||
|
@ -352,10 +386,10 @@ public class Utils {
|
|||
|
||||
if ( "String".equals(return_type) ) {
|
||||
if ( !return_annotation.forceMaxLength() ) {
|
||||
writer.println("IntBuffer " + return_annotation.value() + "_length = APIUtils.getLengths();");
|
||||
writer.println("IntBuffer " + return_annotation.value() + "_length = APIUtil.getLengths();");
|
||||
writer.print("\t\t");
|
||||
}
|
||||
writer.print("ByteBuffer " + return_annotation.value() + " = APIUtils.getBufferByte(" + return_annotation.maxLength());
|
||||
writer.print("ByteBuffer " + return_annotation.value() + " = APIUtil.getBufferByte(" + 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
|
||||
|
@ -367,12 +401,17 @@ public class Utils {
|
|||
writer.println(");");
|
||||
} else {
|
||||
final String buffer_type = "Boolean".equals(return_type) ? "Byte" : return_type;
|
||||
writer.print(buffer_type + "Buffer " + return_annotation.value() + " = APIUtils.getBuffer" + buffer_type + "(");
|
||||
writer.print(buffer_type + "Buffer " + return_annotation.value() + " = APIUtil.getBuffer" + buffer_type + "(");
|
||||
if ( "Byte".equals(buffer_type) )
|
||||
writer.print('1');
|
||||
writer.println(");");
|
||||
}
|
||||
|
||||
final Code code_annotation = method.getAnnotation(Code.class);
|
||||
if ( code_annotation != null && code_annotation.tryBlock() ) {
|
||||
writer.println("\t\ttry {");
|
||||
writer.print("\t\t\t");
|
||||
} else
|
||||
writer.print("\t\t");
|
||||
}
|
||||
|
||||
|
@ -389,7 +428,7 @@ public class Utils {
|
|||
else
|
||||
writer.print(return_annotation.value() + "_length.get(0)");
|
||||
writer.println(");");
|
||||
writer.println("\t\treturn APIUtils.getString(" + return_annotation.value() + ");");
|
||||
writer.println("\t\treturn APIUtil.getString(" + return_annotation.value() + ");");
|
||||
} else {
|
||||
writer.print("\t\treturn " + return_annotation.value() + ".get(0)");
|
||||
if ( "Boolean".equals(return_type) )
|
||||
|
|
|
@ -30,21 +30,25 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package org.lwjgl.util.generator;
|
||||
package org.lwjgl.util.generator.openal;
|
||||
|
||||
/**
|
||||
*
|
||||
* The OpenAL specific generator behaviour
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: ALTypeMap.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.Signedness;
|
||||
import org.lwjgl.util.generator.TypeMap;
|
||||
|
||||
import com.sun.mirror.declaration.*;
|
||||
import com.sun.mirror.type.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.*;
|
||||
import java.nio.*;
|
||||
|
||||
|
@ -166,15 +170,27 @@ public class ALTypeMap implements TypeMap {
|
|||
return new Class[]{};
|
||||
}
|
||||
|
||||
public String getErrorCheckMethodName() {
|
||||
return "Util.checkALError()";
|
||||
public void printCapabilitiesInit(final PrintWriter writer) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public String getCapabilities() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void printErrorCheckMethod(final PrintWriter writer, final MethodDeclaration method, final String tabs) {
|
||||
writer.println(tabs + "Util.checkALError();");
|
||||
}
|
||||
|
||||
public String getRegisterNativesFunctionName() {
|
||||
return "extal_InitializeClass";
|
||||
}
|
||||
|
||||
public String getTypedefPrefix() {
|
||||
public String getTypedefPostfix() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getFunctionPrefix() {
|
||||
return "ALAPIENTRY";
|
||||
}
|
||||
|
||||
|
@ -182,7 +198,15 @@ public class ALTypeMap implements TypeMap {
|
|||
writer.println("#include \"extal.h\"");
|
||||
}
|
||||
|
||||
public Class getStringElementType() {
|
||||
public Class<? extends Annotation> getStringElementType() {
|
||||
return ALubyte.class;
|
||||
}
|
||||
|
||||
public Class<? extends Annotation> getStringArrayType() {
|
||||
return ALubyte.class;
|
||||
}
|
||||
|
||||
public Class<? extends Annotation> getByteBufferArrayType() {
|
||||
return ALubyte.class;
|
||||
}
|
||||
|
||||
|
@ -199,11 +223,11 @@ public class ALTypeMap implements TypeMap {
|
|||
return valid_types;
|
||||
}
|
||||
|
||||
public Class getVoidType() {
|
||||
public Class<? extends Annotation> getVoidType() {
|
||||
return ALvoid.class;
|
||||
}
|
||||
|
||||
public Class getInverseType(Class type) {
|
||||
public Class<? extends Annotation> getInverseType(Class type) {
|
||||
if (ALuint.class.equals(type))
|
||||
return ALint.class;
|
||||
else if (ALint.class.equals(type))
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.openal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: ALboolean.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.openal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: ALbyte.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.openal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: ALdouble.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.openal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: ALenum.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.openal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: ALfloat.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.openal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: ALint.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.openal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: ALshort.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.openal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: ALsizei.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.openal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: ALubyte.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.openal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: ALuint.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.openal;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: ALvoid.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
/*
|
||||
* 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
|
||||
import com.sun.mirror.declaration.InterfaceDeclaration;
|
||||
import com.sun.mirror.declaration.MethodDeclaration;
|
||||
import com.sun.mirror.declaration.TypeDeclaration;
|
||||
|
||||
/**
|
||||
* CLCapabilities generator.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public class CLCapabilitiesGenerator {
|
||||
|
||||
private static final String SUPPORTED_EXTS = "supported_extensions";
|
||||
|
||||
static void generateClassPrologue(final PrintWriter writer) {
|
||||
writer.println("public final class " + CLGeneratorProcessorFactory.CLCAPS_CLASS_NAME + " {");
|
||||
writer.println();
|
||||
}
|
||||
|
||||
static void generateSymbolAddresses(final PrintWriter writer, final InterfaceDeclaration d) {
|
||||
final Alias alias_annotation = d.getAnnotation(Alias.class);
|
||||
final boolean aliased = alias_annotation != null && alias_annotation.postfix().length() > 0;
|
||||
|
||||
boolean first = true;
|
||||
for ( final MethodDeclaration method : d.getMethods() ) {
|
||||
if ( method.getAnnotation(Alternate.class) != null || method.getAnnotation(Reuse.class) != null )
|
||||
continue;
|
||||
|
||||
if ( first ) {
|
||||
writer.println("\t// " + d.getSimpleName());
|
||||
first = false;
|
||||
}
|
||||
writer.print("\tstatic final long " + Utils.getFunctionAddressName(d, method) + " = CL.getFunctionAddress(");
|
||||
|
||||
if ( aliased )
|
||||
writer.println("new String [] {\"" + Utils.getFunctionAddressName(d, method) + "\",\"" + method.getSimpleName() + alias_annotation.postfix() + "\"});");
|
||||
else
|
||||
writer.println("\"" + Utils.getFunctionAddressName(d, method) + "\");");
|
||||
}
|
||||
}
|
||||
|
||||
static void generateConstructor(final PrintWriter writer, final Collection<TypeDeclaration> interface_decls) {
|
||||
writer.println("\tprivate static final Set<String> " + SUPPORTED_EXTS + " = new HashSet<String>();");
|
||||
writer.println();
|
||||
writer.println("\tprivate " + CLGeneratorProcessorFactory.CLCAPS_CLASS_NAME + "() {}");
|
||||
writer.println();
|
||||
writer.println("\tstatic {");
|
||||
|
||||
for ( final TypeDeclaration d : interface_decls ) {
|
||||
if ( d.getMethods().isEmpty() )
|
||||
continue;
|
||||
|
||||
writer.println("\t\tif ( " + getExtensionSupportedName(d.getSimpleName()) + "() )");
|
||||
writer.println("\t\t\t" + SUPPORTED_EXTS + ".add(\"" + CLGeneratorProcessorFactory.getExtensionName(d.getSimpleName()) + "\");");
|
||||
}
|
||||
|
||||
writer.println("\t}\n");
|
||||
}
|
||||
|
||||
static void generateExtensionSupported(final PrintWriter writer) {
|
||||
writer.println("\tstatic boolean isExtensionSupported(final String name) {\n" +
|
||||
"\t\treturn " + SUPPORTED_EXTS + ".contains(name);\n" +
|
||||
"\t}\n");
|
||||
}
|
||||
|
||||
static void generateExtensionChecks(final PrintWriter writer, final InterfaceDeclaration d) {
|
||||
Iterator<? extends MethodDeclaration> methods = d.getMethods().iterator();
|
||||
if ( !methods.hasNext() )
|
||||
return;
|
||||
|
||||
writer.println("\tstatic boolean " + getExtensionSupportedName(d.getSimpleName()) + "() {");
|
||||
writer.println("\t\treturn ");
|
||||
|
||||
boolean first = true;
|
||||
while ( methods.hasNext() ) {
|
||||
MethodDeclaration method = methods.next();
|
||||
if ( method.getAnnotation(Alternate.class) != null )
|
||||
continue;
|
||||
|
||||
if ( !first )
|
||||
writer.println(" &");
|
||||
else
|
||||
first = false;
|
||||
|
||||
final boolean optional = method.getAnnotation(Optional.class) != null;
|
||||
|
||||
writer.print("\t\t\t");
|
||||
if ( optional )
|
||||
writer.print('(');
|
||||
writer.print(Utils.getFunctionAddressName(d, method) + " != 0");
|
||||
if ( optional )
|
||||
writer.print(" || true)");
|
||||
}
|
||||
writer.println(";");
|
||||
writer.println("\t}");
|
||||
writer.println();
|
||||
}
|
||||
|
||||
private static String getExtensionSupportedName(final String class_name) {
|
||||
return "is" + class_name + "Supported";
|
||||
}
|
||||
|
||||
public static void generateCapabilitiesGetters(final PrintWriter writer) {
|
||||
writer.println("\tpublic static CLPlatformCapabilities getPlatformCapabilities(final CLPlatform platform) {\n" +
|
||||
"\t\treturn CLPlatformImpl.getCapabilities(platform);\n" +
|
||||
"\t}\n");
|
||||
|
||||
writer.println("\tpublic static CLDeviceCapabilities getDeviceCapabilities(final CLDevice device) {\n" +
|
||||
"\t\treturn CLDeviceImpl.getCapabilities(device);\n" +
|
||||
"\t}\n");
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/** Extension templates marked with @CLDeviceExtension will be considered CL device extensions. */
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface CLDeviceExtension {
|
||||
|
||||
}
|
|
@ -0,0 +1,183 @@
|
|||
/*
|
||||
* 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerWrapper;
|
||||
import org.lwjgl.opencl.CLDevice;
|
||||
import org.lwjgl.opencl.CLPlatform;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
import com.sun.mirror.apt.*;
|
||||
import com.sun.mirror.declaration.AnnotationTypeDeclaration;
|
||||
import com.sun.mirror.declaration.InterfaceDeclaration;
|
||||
import com.sun.mirror.declaration.TypeDeclaration;
|
||||
import com.sun.mirror.util.DeclarationFilter;
|
||||
|
||||
import static java.util.Collections.*;
|
||||
|
||||
/**
|
||||
* Generator tool for creating the OpenCL capabilities classes
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public class CLGeneratorProcessorFactory implements AnnotationProcessorFactory, RoundCompleteListener {
|
||||
|
||||
public static final String CLCAPS_CLASS_NAME = "CLCapabilities";
|
||||
public static final String PLATFORM_CAPS_CLASS_NAME = "CLPlatformCapabilities";
|
||||
public static final String DEVICE_CAPS_CLASS_NAME = "CLDeviceCapabilities";
|
||||
|
||||
private static final String EXTENSION_PREFIX = "CL_";
|
||||
private static final String CORE_PREFIX = "Open";
|
||||
|
||||
private static boolean first_round = true;
|
||||
|
||||
// Process any set of annotations
|
||||
private static final Collection<String> supportedAnnotations = unmodifiableCollection(Arrays.asList("*"));
|
||||
|
||||
public Collection<String> supportedAnnotationTypes() {
|
||||
return supportedAnnotations;
|
||||
}
|
||||
|
||||
public Collection<String> supportedOptions() {
|
||||
return unmodifiableCollection(Arrays.asList("-Acontextspecific"));
|
||||
}
|
||||
|
||||
public void roundComplete(RoundCompleteEvent event) {
|
||||
first_round = false;
|
||||
}
|
||||
|
||||
public AnnotationProcessor getProcessorFor(Set<AnnotationTypeDeclaration> atds, AnnotationProcessorEnvironment env) {
|
||||
// Only process the initial types, not the generated ones
|
||||
if ( first_round ) {
|
||||
env.addListener(this);
|
||||
return new GeneratorProcessor(env);
|
||||
} else
|
||||
return AnnotationProcessors.NO_OP;
|
||||
}
|
||||
|
||||
static String getExtensionName(String interface_name) {
|
||||
if ( interface_name.startsWith("CL") )
|
||||
return CORE_PREFIX + interface_name;
|
||||
else
|
||||
return EXTENSION_PREFIX + interface_name;
|
||||
}
|
||||
|
||||
private static class GeneratorProcessor implements AnnotationProcessor {
|
||||
|
||||
private final AnnotationProcessorEnvironment env;
|
||||
|
||||
GeneratorProcessor(AnnotationProcessorEnvironment env) {
|
||||
this.env = env;
|
||||
}
|
||||
|
||||
public void process() {
|
||||
try {
|
||||
generateCLCapabilitiesSource();
|
||||
generateCLPDCapabilitiesSource(CLPlatformExtension.class, PLATFORM_CAPS_CLASS_NAME, CLPlatform.class, "platform");
|
||||
generateCLPDCapabilitiesSource(CLDeviceExtension.class, DEVICE_CAPS_CLASS_NAME, CLDevice.class, "device");
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void printHeader(final PrintWriter writer) {
|
||||
writer.println("/* MACHINE GENERATED FILE, DO NOT EDIT */");
|
||||
writer.println();
|
||||
writer.println("package org.lwjgl.opencl;");
|
||||
writer.println();
|
||||
writer.println("import java.util.*;");
|
||||
writer.println();
|
||||
}
|
||||
|
||||
private void generateCLCapabilitiesSource() throws IOException {
|
||||
final PrintWriter writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, "org.lwjgl.opencl", new File(CLCAPS_CLASS_NAME + ".java"), null);
|
||||
printHeader(writer);
|
||||
|
||||
CLCapabilitiesGenerator.generateClassPrologue(writer);
|
||||
|
||||
final Collection<TypeDeclaration> templates = DeclarationFilter.getFilter(InterfaceDeclaration.class).filter(env.getSpecifiedTypeDeclarations());
|
||||
|
||||
for ( final TypeDeclaration t : templates ) {
|
||||
if ( t.getAnnotation(CLPlatformExtension.class) == null && t.getAnnotation(CLDeviceExtension.class) == null && !t.getSimpleName().startsWith("CL") )
|
||||
throw new RuntimeException("An OpenCL extension is missing an extension type annotation: " + t.getSimpleName());
|
||||
|
||||
CLCapabilitiesGenerator.generateSymbolAddresses(writer, (InterfaceDeclaration)t);
|
||||
}
|
||||
writer.println();
|
||||
|
||||
CLCapabilitiesGenerator.generateConstructor(writer, templates);
|
||||
|
||||
CLCapabilitiesGenerator.generateCapabilitiesGetters(writer);
|
||||
|
||||
CLCapabilitiesGenerator.generateExtensionSupported(writer);
|
||||
|
||||
for ( final TypeDeclaration template : templates )
|
||||
CLCapabilitiesGenerator.generateExtensionChecks(writer, (InterfaceDeclaration)template);
|
||||
|
||||
writer.println("}");
|
||||
writer.close();
|
||||
}
|
||||
|
||||
private void generateCLPDCapabilitiesSource(final Class<? extends Annotation> capsType, final String capsName, final Class<? extends PointerWrapper> objectType, final String objectName) throws IOException {
|
||||
final PrintWriter writer = env.getFiler().createTextFile(Filer.Location.SOURCE_TREE, "org.lwjgl.opencl", new File(capsName + ".java"), null);
|
||||
printHeader(writer);
|
||||
|
||||
CLPDCapabilitiesGenerator.generateClassPrologue(writer, capsName);
|
||||
|
||||
final Collection<TypeDeclaration> templates = DeclarationFilter.getFilter(InterfaceDeclaration.class).filter(env.getSpecifiedTypeDeclarations());
|
||||
|
||||
for ( final TypeDeclaration t : templates ) {
|
||||
if ( t.getAnnotation(capsType) != null )
|
||||
CLPDCapabilitiesGenerator.generateExtensions(writer, (InterfaceDeclaration)t);
|
||||
}
|
||||
writer.println();
|
||||
|
||||
CLPDCapabilitiesGenerator.generateConstructor(writer, templates, capsType, capsName, objectType, objectName);
|
||||
|
||||
CLPDCapabilitiesGenerator.generateGetters(writer);
|
||||
|
||||
CLPDCapabilitiesGenerator.generateToString(writer, templates, capsType, capsName, objectType, objectName);
|
||||
|
||||
writer.println("}");
|
||||
writer.close();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,147 @@
|
|||
/*
|
||||
* 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerWrapper;
|
||||
import org.lwjgl.util.generator.Private;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.Collection;
|
||||
|
||||
import com.sun.mirror.declaration.InterfaceDeclaration;
|
||||
import com.sun.mirror.declaration.TypeDeclaration;
|
||||
|
||||
/**
|
||||
* CL platform/device capabilities generator.
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
public class CLPDCapabilitiesGenerator {
|
||||
|
||||
// TODO: Add future versions here
|
||||
private static final int[][] CL_VERSIONS = {
|
||||
{ 1 }, // OpenCL 1
|
||||
};
|
||||
|
||||
static void generateClassPrologue(final PrintWriter writer, final String name) {
|
||||
writer.println("public class " + name + " {");
|
||||
writer.println();
|
||||
writer.println("\tpublic final int majorVersion;");
|
||||
writer.println("\tpublic final int minorVersion;");
|
||||
writer.println();
|
||||
for ( int major = 1; major <= CL_VERSIONS.length; major++ ) {
|
||||
for ( final int minor : CL_VERSIONS[major - 1] )
|
||||
writer.println("\tpublic final boolean OpenCL" + Integer.toString(major) + Integer.toString(minor) + ";");
|
||||
}
|
||||
writer.println();
|
||||
}
|
||||
|
||||
static void generateExtensions(final PrintWriter writer, final InterfaceDeclaration d) {
|
||||
writer.print("\t");
|
||||
|
||||
if ( d.getAnnotation(Private.class) == null )
|
||||
writer.print("public ");
|
||||
|
||||
writer.println("final boolean " + CLGeneratorProcessorFactory.getExtensionName(d.getSimpleName()) + ";");
|
||||
}
|
||||
|
||||
static void generateConstructor(final PrintWriter writer, final Collection<TypeDeclaration> templates,
|
||||
final Class<? extends Annotation> capsType, final String capsName,
|
||||
final Class<? extends PointerWrapper> objectType, final String objectName) {
|
||||
writer.println("\tpublic " + capsName + "(final " + objectType.getSimpleName() + ' ' + objectName + ") {");
|
||||
|
||||
final String methodName = Character.toUpperCase(objectName.charAt(0)) + objectName.substring(1);
|
||||
writer.println("\t\tfinal String extensionList = " + objectName + ".getInfoString(CL10.CL_" + objectName.toUpperCase() + "_EXTENSIONS);\n" +
|
||||
"\t\tfinal String version = " + objectName + ".getInfoString(CL10.CL_" + objectName.toUpperCase() + "_VERSION);\n" +
|
||||
"\t\tif ( !version.startsWith(\"OpenCL \") )\n" +
|
||||
"\t\t\tthrow new RuntimeException(\"Invalid OpenCL version string: \" + version);\n\n" +
|
||||
"\t\ttry {\n" +
|
||||
"\t\t\tfinal StringTokenizer tokenizer = new StringTokenizer(version.substring(7), \". \");\n" +
|
||||
"\n" +
|
||||
"\t\t\tmajorVersion = Integer.parseInt(tokenizer.nextToken());\n" +
|
||||
"\t\t\tminorVersion = Integer.parseInt(tokenizer.nextToken());\n");
|
||||
|
||||
for ( int major = 1; major <= CL_VERSIONS.length; major++ ) {
|
||||
for ( final int minor : CL_VERSIONS[major - 1] )
|
||||
writer.println("\t\t\tOpenCL" + Integer.toString(major) + Integer.toString(minor) + " = " + major + " < majorVersion || (" + major + " == majorVersion && " + minor + " <= minorVersion);");
|
||||
}
|
||||
|
||||
writer.println("\t\t} catch (RuntimeException e) {\n" +
|
||||
"\t\t\tthrow new RuntimeException(\"The major and/or minor OpenCL version \\\"\" + version + \"\\\" is malformed: \" + e.getMessage());\n" +
|
||||
"\t\t}\n");
|
||||
|
||||
writer.println("\t\tfinal Set<String> extensions = APIUtil.getExtensions(extensionList);");
|
||||
|
||||
for ( final TypeDeclaration t : templates ) {
|
||||
if ( t.getAnnotation(capsType) == null )
|
||||
continue;
|
||||
|
||||
writer.print("\t\t" + CLGeneratorProcessorFactory.getExtensionName(t.getSimpleName()) + " = extensions.contains(\"" + CLGeneratorProcessorFactory.getExtensionName(t.getSimpleName()).toLowerCase() + "\")");
|
||||
if ( !t.getMethods().isEmpty() )
|
||||
writer.print(" && CLCapabilities.is" + t.getSimpleName() + "Supported()");
|
||||
writer.println(";");
|
||||
}
|
||||
|
||||
writer.println("\t}\n");
|
||||
}
|
||||
|
||||
public static void generateGetters(final PrintWriter writer) {
|
||||
writer.println("\tpublic int getMajorVersion() {");
|
||||
writer.println("\t\treturn majorVersion;");
|
||||
writer.println("\t}\n");
|
||||
|
||||
writer.println("\tpublic int getMinorVersion() {");
|
||||
writer.println("\t\treturn minorVersion;");
|
||||
writer.println("\t}\n");
|
||||
}
|
||||
|
||||
public static void generateToString(final PrintWriter writer, final Collection<TypeDeclaration> templates, final Class<? extends Annotation> capsType, final String capsName, final Class<? extends PointerWrapper> objectType, final String objectName) {
|
||||
writer.println("\tpublic String toString() {");
|
||||
writer.println("\t\tfinal StringBuilder buf = new StringBuilder();\n");
|
||||
|
||||
writer.println("\t\tbuf.append(\"OpenCL \").append(majorVersion).append('.').append(minorVersion);");
|
||||
writer.println();
|
||||
writer.println("\t\tbuf.append(\" - Extensions: \");");
|
||||
for ( final TypeDeclaration t : templates ) {
|
||||
if ( t.getAnnotation(capsType) == null )
|
||||
continue;
|
||||
|
||||
writer.println("\t\tif ( " + CLGeneratorProcessorFactory.getExtensionName(t.getSimpleName()) + " ) buf.append(\"" + CLGeneratorProcessorFactory.getExtensionName(t.getSimpleName()).toLowerCase() + " \");");
|
||||
}
|
||||
|
||||
writer.println("\n\t\treturn buf.toString();");
|
||||
writer.println("\t}\n");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/** Extension templates marked with @CLPlatformExtension will be considered CL platform extensions. */
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface CLPlatformExtension {
|
||||
|
||||
}
|
|
@ -0,0 +1,266 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
/**
|
||||
*
|
||||
* OpenCL specific generator behaviour
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLreturn;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.nio.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.sun.mirror.declaration.AnnotationMirror;
|
||||
import com.sun.mirror.declaration.MethodDeclaration;
|
||||
import com.sun.mirror.declaration.ParameterDeclaration;
|
||||
import com.sun.mirror.type.PrimitiveType;
|
||||
|
||||
public class CLTypeMap implements TypeMap {
|
||||
|
||||
private static final Map<Class, PrimitiveType.Kind> native_types_to_primitive;
|
||||
|
||||
static {
|
||||
native_types_to_primitive = new HashMap<Class, PrimitiveType.Kind>();
|
||||
native_types_to_primitive.put(cl_void.class, PrimitiveType.Kind.BYTE);
|
||||
native_types_to_primitive.put(cl_byte.class, PrimitiveType.Kind.BYTE);
|
||||
native_types_to_primitive.put(cl_char.class, PrimitiveType.Kind.BYTE);
|
||||
native_types_to_primitive.put(cl_uchar.class, PrimitiveType.Kind.BYTE);
|
||||
native_types_to_primitive.put(cl_short.class, PrimitiveType.Kind.SHORT);
|
||||
native_types_to_primitive.put(cl_bool.class, PrimitiveType.Kind.INT);
|
||||
native_types_to_primitive.put(cl_int.class, PrimitiveType.Kind.INT);
|
||||
native_types_to_primitive.put(cl_uint.class, PrimitiveType.Kind.INT);
|
||||
native_types_to_primitive.put(cl_long.class, PrimitiveType.Kind.LONG);
|
||||
native_types_to_primitive.put(size_t.class, PrimitiveType.Kind.LONG);
|
||||
native_types_to_primitive.put(cl_bitfield.class, PrimitiveType.Kind.LONG);
|
||||
native_types_to_primitive.put(cl_float.class, PrimitiveType.Kind.FLOAT);
|
||||
native_types_to_primitive.put(cl_double.class, PrimitiveType.Kind.DOUBLE);
|
||||
}
|
||||
|
||||
public PrimitiveType.Kind getPrimitiveTypeFromNativeType(Class native_type) {
|
||||
PrimitiveType.Kind kind = native_types_to_primitive.get(native_type);
|
||||
if ( kind == null )
|
||||
throw new RuntimeException("Unsupported type " + native_type);
|
||||
return kind;
|
||||
}
|
||||
|
||||
public void printCapabilitiesInit(final PrintWriter writer) {
|
||||
}
|
||||
|
||||
public String getCapabilities() {
|
||||
return "CLCapabilities";
|
||||
}
|
||||
|
||||
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
|
||||
writer.println(tabs + "Util.checkCLError(" + check.value() + ".get(" + check.value() + ".position()));");
|
||||
else {
|
||||
final Class return_type = Utils.getJavaType(method.getReturnType());
|
||||
if ( return_type == int.class )
|
||||
writer.println(tabs + "Util.checkCLError(__result);");
|
||||
else {
|
||||
boolean hasErrCodeParam = false;
|
||||
for ( final ParameterDeclaration param : method.getParameters() ) {
|
||||
if ( "errcode_ret".equals(param.getSimpleName()) && Utils.getJavaType(param.getType()) == IntBuffer.class ) {
|
||||
hasErrCodeParam = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( hasErrCodeParam )
|
||||
throw new RuntimeException("A method is missing the @Check annotation: " + method.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getRegisterNativesFunctionName() {
|
||||
return "extcl_InitializeClass";
|
||||
}
|
||||
|
||||
public Signedness getSignednessFromType(Class type) {
|
||||
if ( cl_uint.class.equals(type) )
|
||||
return Signedness.UNSIGNED;
|
||||
else if ( cl_int.class.equals(type) )
|
||||
return Signedness.SIGNED;
|
||||
else
|
||||
return Signedness.NONE;
|
||||
}
|
||||
|
||||
public String translateAnnotation(Class annotation_type) {
|
||||
if ( annotation_type.equals(cl_uint.class) || annotation_type.equals(cl_int.class) )
|
||||
return "i";
|
||||
else if ( annotation_type.equals(cl_short.class) )
|
||||
return "s";
|
||||
else if ( annotation_type.equals(cl_byte.class) )
|
||||
return "b";
|
||||
else if ( annotation_type.equals(cl_float.class) )
|
||||
return "f";
|
||||
else if ( annotation_type.equals(cl_double.class) )
|
||||
return "d";
|
||||
else
|
||||
throw new RuntimeException(annotation_type + " is not allowed");
|
||||
}
|
||||
|
||||
public Class getNativeTypeFromPrimitiveType(PrimitiveType.Kind kind) {
|
||||
Class type;
|
||||
switch ( kind ) {
|
||||
case INT:
|
||||
type = cl_int.class;
|
||||
break;
|
||||
case DOUBLE:
|
||||
type = cl_double.class;
|
||||
break;
|
||||
case FLOAT:
|
||||
type = cl_float.class;
|
||||
break;
|
||||
case SHORT:
|
||||
type = cl_short.class;
|
||||
break;
|
||||
case BYTE:
|
||||
type = cl_byte.class;
|
||||
break;
|
||||
case LONG:
|
||||
type = cl_long.class;
|
||||
break;
|
||||
case BOOLEAN:
|
||||
type = cl_bool.class;
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException(kind + " is not allowed");
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
public Class<? extends Annotation> getVoidType() {
|
||||
return cl_void.class;
|
||||
}
|
||||
|
||||
public Class<? extends Annotation> getStringElementType() {
|
||||
return cl_char.class;
|
||||
}
|
||||
|
||||
public Class<? extends Annotation> getStringArrayType() {
|
||||
return cl_char.class;
|
||||
}
|
||||
|
||||
public Class<? extends Annotation> getByteBufferArrayType() {
|
||||
return cl_uchar.class;
|
||||
}
|
||||
|
||||
private static Class[] getValidBufferTypes(Class type) {
|
||||
if ( type.equals(IntBuffer.class) )
|
||||
return new Class[] { cl_int.class, cl_uint.class };
|
||||
else if ( type.equals(FloatBuffer.class) )
|
||||
return new Class[] { cl_float.class };
|
||||
else if ( type.equals(ByteBuffer.class) )
|
||||
return new Class[] { cl_byte.class, cl_char.class, cl_uchar.class, cl_void.class };
|
||||
else if ( type.equals(ShortBuffer.class) )
|
||||
return new Class[] { cl_short.class };
|
||||
else if ( type.equals(DoubleBuffer.class) )
|
||||
return new Class[] { cl_double.class };
|
||||
else if ( type.equals(LongBuffer.class) )
|
||||
return new Class[] { cl_long.class };
|
||||
else if ( type.equals(PointerBuffer.class) )
|
||||
return new Class[] { size_t.class };
|
||||
else
|
||||
return new Class[] { };
|
||||
}
|
||||
|
||||
private static Class[] getValidPrimitiveTypes(Class type) {
|
||||
if ( type.equals(long.class) )
|
||||
return new Class[] { cl_long.class, size_t.class, cl_bitfield.class };
|
||||
else if ( type.equals(int.class) )
|
||||
return new Class[] { cl_int.class, cl_uint.class, cl_bool.class };
|
||||
else if ( type.equals(double.class) )
|
||||
return new Class[] { cl_double.class };
|
||||
else if ( type.equals(float.class) )
|
||||
return new Class[] { cl_float.class };
|
||||
else if ( type.equals(short.class) )
|
||||
return new Class[] { cl_short.class };
|
||||
else if ( type.equals(byte.class) )
|
||||
return new Class[] { cl_byte.class, cl_char.class, cl_uchar.class };
|
||||
else if ( type.equals(boolean.class) )
|
||||
return new Class[] { cl_bool.class };
|
||||
else if ( type.equals(void.class) )
|
||||
return new Class[] { cl_void.class };
|
||||
else
|
||||
return new Class[] { };
|
||||
}
|
||||
|
||||
public String getTypedefPostfix() {
|
||||
return "CL_API_ENTRY ";
|
||||
}
|
||||
|
||||
public String getFunctionPrefix() {
|
||||
return "CL_API_CALL";
|
||||
}
|
||||
|
||||
public void printNativeIncludes(PrintWriter writer) {
|
||||
writer.println("#include \"extcl.h\"");
|
||||
}
|
||||
|
||||
public Class[] getValidAnnotationTypes(Class type) {
|
||||
Class[] valid_types;
|
||||
if ( Buffer.class.isAssignableFrom(type) || PointerBuffer.class.isAssignableFrom(type) )
|
||||
valid_types = getValidBufferTypes(type);
|
||||
else if ( type.isPrimitive() )
|
||||
valid_types = getValidPrimitiveTypes(type);
|
||||
else if ( String.class.equals(type) )
|
||||
valid_types = new Class[] { cl_byte.class };
|
||||
else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(type) )
|
||||
valid_types = new Class[] { PointerWrapper.class };
|
||||
else if ( ByteBuffer[].class == type )
|
||||
valid_types = new Class[] { cl_char.class, cl_uchar.class };
|
||||
else if ( void.class.equals(type) )
|
||||
valid_types = new Class[] { GLreturn.class };
|
||||
else
|
||||
valid_types = new Class[] { };
|
||||
return valid_types;
|
||||
}
|
||||
|
||||
public Class<? extends Annotation> getInverseType(Class type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getAutoTypeFromAnnotation(AnnotationMirror annotation) {
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@NativeType
|
||||
@Target({ ElementType.PARAMETER })
|
||||
public @interface cl_bitfield {
|
||||
String alias() default "";
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@NativeType
|
||||
@Target({ ElementType.PARAMETER })
|
||||
public @interface cl_bool {
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@NativeType
|
||||
@Target({ ElementType.PARAMETER, ElementType.METHOD })
|
||||
public @interface cl_byte {
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@NativeType
|
||||
@Target({ ElementType.PARAMETER })
|
||||
public @interface cl_char {
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@NativeType
|
||||
@Target({ ElementType.PARAMETER, ElementType.METHOD })
|
||||
public @interface cl_double {
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@NativeType
|
||||
@Target({ ElementType.PARAMETER, ElementType.METHOD })
|
||||
public @interface cl_float {
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@NativeType
|
||||
@Target({ ElementType.PARAMETER, ElementType.METHOD })
|
||||
public @interface cl_int {
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@NativeType
|
||||
@Target({ ElementType.PARAMETER })
|
||||
public @interface cl_long {
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@NativeType
|
||||
@Target({ ElementType.PARAMETER, ElementType.METHOD })
|
||||
public @interface cl_short {
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@NativeType
|
||||
@Target({ ElementType.PARAMETER })
|
||||
public @interface cl_uchar {
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@NativeType
|
||||
@Target({ ElementType.PARAMETER, ElementType.METHOD })
|
||||
public @interface cl_uint {
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import com.sun.mirror.type.PrimitiveType;
|
||||
|
||||
@NativeType
|
||||
@Target({ ElementType.PARAMETER, ElementType.METHOD })
|
||||
public @interface cl_void {
|
||||
PrimitiveType.Kind value() default PrimitiveType.Kind.BYTE;
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@NativeType
|
||||
@Target({ ElementType.PARAMETER })
|
||||
public @interface size_t {
|
||||
|
||||
}
|
|
@ -30,7 +30,9 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package org.lwjgl.util.generator;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.Arrays;
|
||||
|
@ -46,10 +48,10 @@ import com.sun.mirror.type.InterfaceType;
|
|||
* Generator visitor for the context capabilities generator tool
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 3355 $
|
||||
* $Id: ContextCapabilitiesGenerator.java 3355 2010-05-27 22:56:29Z spasi $
|
||||
*/
|
||||
public class ContextCapabilitiesGenerator {
|
||||
public class GLCapabilitiesGenerator {
|
||||
|
||||
private static final String STUBS_LOADED_NAME = "loaded_stubs";
|
||||
private static final String ALL_INIT_METHOD_NAME = "initAllStubs";
|
||||
|
@ -125,13 +127,13 @@ public class ContextCapabilitiesGenerator {
|
|||
writer.println("\tprivate Set " + ALL_INIT_METHOD_NAME + "(boolean forwardCompatible) throws LWJGLException {");
|
||||
|
||||
// Load the basic pointers we need to detect OpenGL version and supported extensions.
|
||||
writer.println("\t\tGL11_glGetError_pointer = GLContext.getFunctionAddress(\"glGetError\");");
|
||||
writer.println("\t\tGL11_glGetString_pointer = GLContext.getFunctionAddress(\"glGetString\");");
|
||||
writer.println("\t\tglGetError = GLContext.getFunctionAddress(\"glGetError\");");
|
||||
writer.println("\t\tglGetString = GLContext.getFunctionAddress(\"glGetString\");");
|
||||
|
||||
// Initialize GL11.glGetIntegerv and GL30.glGetStringi here, in case we have created an OpenGL 3.0 context.
|
||||
// (they will be used in GLContext.getSupportedExtensions)
|
||||
writer.println("\t\tGL11_glGetIntegerv_pointer = GLContext.getFunctionAddress(\"glGetIntegerv\");");
|
||||
writer.println("\t\tGL30_glGetStringi_pointer = GLContext.getFunctionAddress(\"glGetStringi\");");
|
||||
writer.println("\t\tglGetIntegerv = GLContext.getFunctionAddress(\"glGetIntegerv\");");
|
||||
writer.println("\t\tglGetStringi = GLContext.getFunctionAddress(\"glGetStringi\");");
|
||||
|
||||
// Get the supported extensions set.
|
||||
writer.println("\t\tGLContext.setCapabilities(this);");
|
||||
|
@ -307,8 +309,15 @@ public class ContextCapabilitiesGenerator {
|
|||
}
|
||||
|
||||
public static void generateSymbolAddresses(PrintWriter writer, InterfaceDeclaration d) {
|
||||
for ( MethodDeclaration method : d.getMethods() ) {
|
||||
if ( method.getAnnotation(Alternate.class) == null )
|
||||
boolean first = true;
|
||||
for ( final MethodDeclaration method : d.getMethods() ) {
|
||||
if ( method.getAnnotation(Alternate.class) != null || method.getAnnotation(Reuse.class) != null )
|
||||
continue;
|
||||
|
||||
if ( first ) {
|
||||
writer.println("\t// " + d.getSimpleName());
|
||||
first = false;
|
||||
}
|
||||
writer.println("\tlong " + Utils.getFunctionAddressName(d, method) + ";");
|
||||
}
|
||||
}
|
|
@ -30,7 +30,9 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package org.lwjgl.util.generator;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.Utils;
|
||||
|
||||
import static java.util.Collections.unmodifiableCollection;
|
||||
|
||||
|
@ -59,10 +61,10 @@ import com.sun.mirror.util.DeclarationFilter;
|
|||
* Generator tool for creating the ContexCapabilities class
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 3316 $
|
||||
* $Id: ContextGeneratorProcessorFactory.java 3316 2010-04-09 23:57:40Z spasi $
|
||||
*/
|
||||
public class ContextGeneratorProcessorFactory implements AnnotationProcessorFactory, RoundCompleteListener {
|
||||
public class GLGeneratorProcessorFactory implements AnnotationProcessorFactory, RoundCompleteListener {
|
||||
private static boolean first_round = true;
|
||||
|
||||
// Process any set of annotations
|
||||
|
@ -116,29 +118,27 @@ public class ContextGeneratorProcessorFactory implements AnnotationProcessorFact
|
|||
writer.println();
|
||||
writer.println("import org.lwjgl.LWJGLException;");
|
||||
writer.println("import org.lwjgl.LWJGLUtil;");
|
||||
writer.println("import org.lwjgl.BufferUtils;");
|
||||
writer.println("import java.util.Set;");
|
||||
writer.println("import java.util.HashSet;");
|
||||
writer.println("import java.nio.IntBuffer;");
|
||||
writer.println();
|
||||
ContextCapabilitiesGenerator.generateClassPrologue(writer, context_specific, generate_error_checks);
|
||||
GLCapabilitiesGenerator.generateClassPrologue(writer, context_specific, generate_error_checks);
|
||||
DeclarationFilter filter = DeclarationFilter.getFilter(InterfaceDeclaration.class);
|
||||
Collection<TypeDeclaration> interface_decls = filter.filter(env.getSpecifiedTypeDeclarations());
|
||||
for (TypeDeclaration typedecl : interface_decls) {
|
||||
InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl;
|
||||
if (Utils.isFinal(interface_decl))
|
||||
ContextCapabilitiesGenerator.generateField(writer, interface_decl);
|
||||
GLCapabilitiesGenerator.generateField(writer, interface_decl);
|
||||
}
|
||||
writer.println();
|
||||
for (TypeDeclaration typedecl : interface_decls) {
|
||||
InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl;
|
||||
ContextCapabilitiesGenerator.generateSymbolAddresses(writer, interface_decl);
|
||||
GLCapabilitiesGenerator.generateSymbolAddresses(writer, interface_decl);
|
||||
}
|
||||
writer.println();
|
||||
if (context_specific) {
|
||||
for (TypeDeclaration typedecl : interface_decls) {
|
||||
InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl;
|
||||
ContextCapabilitiesGenerator.generateAddressesInitializers(writer, interface_decl);
|
||||
GLCapabilitiesGenerator.generateAddressesInitializers(writer, interface_decl);
|
||||
}
|
||||
writer.println();
|
||||
}
|
||||
|
@ -148,19 +148,19 @@ public class ContextGeneratorProcessorFactory implements AnnotationProcessorFact
|
|||
writer.println("\t\tsupported_extensions.remove(extension);");
|
||||
writer.println("\t}\n");
|
||||
|
||||
ContextCapabilitiesGenerator.generateInitStubsPrologue(writer, context_specific);
|
||||
GLCapabilitiesGenerator.generateInitStubsPrologue(writer, context_specific);
|
||||
for (TypeDeclaration typedecl : interface_decls) {
|
||||
InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl;
|
||||
ContextCapabilitiesGenerator.generateSuperClassAdds(writer, interface_decl);
|
||||
GLCapabilitiesGenerator.generateSuperClassAdds(writer, interface_decl);
|
||||
}
|
||||
for (TypeDeclaration typedecl : interface_decls) {
|
||||
InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl;
|
||||
String simple_name = interface_decl.getSimpleName();
|
||||
if (simple_name.equals("GL11"))
|
||||
continue;
|
||||
ContextCapabilitiesGenerator.generateInitStubs(writer, interface_decl, context_specific);
|
||||
GLCapabilitiesGenerator.generateInitStubs(writer, interface_decl, context_specific);
|
||||
}
|
||||
ContextCapabilitiesGenerator.generateInitStubsEpilogue(writer, context_specific);
|
||||
GLCapabilitiesGenerator.generateInitStubsEpilogue(writer, context_specific);
|
||||
writer.println();
|
||||
writer.println("\tstatic void unloadAllStubs() {");
|
||||
if (!context_specific) {
|
||||
|
@ -168,17 +168,17 @@ public class ContextGeneratorProcessorFactory implements AnnotationProcessorFact
|
|||
writer.println("\t\t\treturn;");
|
||||
for (TypeDeclaration typedecl : interface_decls) {
|
||||
InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl;
|
||||
ContextCapabilitiesGenerator.generateUnloadStubs(writer, interface_decl);
|
||||
GLCapabilitiesGenerator.generateUnloadStubs(writer, interface_decl);
|
||||
}
|
||||
writer.println("\t\tloaded_stubs = false;");
|
||||
}
|
||||
writer.println("\t}");
|
||||
writer.println();
|
||||
ContextCapabilitiesGenerator.generateInitializerPrologue(writer);
|
||||
GLCapabilitiesGenerator.generateInitializerPrologue(writer);
|
||||
for (TypeDeclaration typedecl : interface_decls) {
|
||||
InterfaceDeclaration interface_decl = (InterfaceDeclaration)typedecl;
|
||||
if (Utils.isFinal(interface_decl))
|
||||
ContextCapabilitiesGenerator.generateInitializer(writer, interface_decl);
|
||||
GLCapabilitiesGenerator.generateInitializer(writer, interface_decl);
|
||||
}
|
||||
writer.println("\t\ttracker.init();");
|
||||
writer.println("\t}");
|
|
@ -30,7 +30,10 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package org.lwjgl.util.generator;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.CachedReference;
|
||||
import org.lwjgl.util.generator.Utils;
|
||||
|
||||
import static java.util.Collections.emptyList;
|
||||
import static java.util.Collections.unmodifiableCollection;
|
||||
|
@ -61,10 +64,10 @@ import com.sun.mirror.util.DeclarationFilter;
|
|||
* Generator tool for creating the References class
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 3237 $
|
||||
* $Id: ReferencesGeneratorProcessorFactory.java 3237 2009-09-08 15:07:15Z spasi $
|
||||
*/
|
||||
public class ReferencesGeneratorProcessorFactory implements AnnotationProcessorFactory, RoundCompleteListener {
|
||||
public class GLReferencesGeneratorProcessorFactory implements AnnotationProcessorFactory, RoundCompleteListener {
|
||||
private final static String REFERENCES_CLASS_NAME = "References";
|
||||
private final static String REFERENCES_PARAMETER_NAME = "references";
|
||||
|
|
@ -30,25 +30,30 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package org.lwjgl.util.generator;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* OpenGL sepcific generator behaviour
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 3392 $
|
||||
* $Id: GLTypeMap.java 3392 2010-07-27 15:33:22Z spasi $
|
||||
*/
|
||||
|
||||
import org.lwjgl.opengl.PointerWrapper;
|
||||
import org.lwjgl.util.generator.NativeTypeTranslator;
|
||||
import org.lwjgl.util.generator.PointerWrapper;
|
||||
import org.lwjgl.util.generator.Signedness;
|
||||
import org.lwjgl.util.generator.TypeMap;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.nio.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.sun.mirror.declaration.AnnotationMirror;
|
||||
import com.sun.mirror.declaration.MethodDeclaration;
|
||||
import com.sun.mirror.type.PrimitiveType;
|
||||
|
||||
public class GLTypeMap implements TypeMap {
|
||||
|
@ -93,8 +98,16 @@ public class GLTypeMap implements TypeMap {
|
|||
return kind;
|
||||
}
|
||||
|
||||
public String getErrorCheckMethodName() {
|
||||
return "Util.checkGLError()";
|
||||
public void printCapabilitiesInit(final PrintWriter writer) {
|
||||
writer.println("\t\tContextCapabilities caps = GLContext.getCapabilities();");
|
||||
}
|
||||
|
||||
public String getCapabilities() {
|
||||
return "caps";
|
||||
}
|
||||
|
||||
public void printErrorCheckMethod(final PrintWriter writer, final MethodDeclaration method, final String tabs) {
|
||||
writer.println(tabs + "Util.checkGLError();");
|
||||
}
|
||||
|
||||
public String getRegisterNativesFunctionName() {
|
||||
|
@ -177,14 +190,22 @@ public class GLTypeMap implements TypeMap {
|
|||
return type;
|
||||
}
|
||||
|
||||
public Class getVoidType() {
|
||||
public Class<? extends Annotation> getVoidType() {
|
||||
return GLvoid.class;
|
||||
}
|
||||
|
||||
public Class getStringElementType() {
|
||||
public Class<? extends Annotation> getStringElementType() {
|
||||
return GLubyte.class;
|
||||
}
|
||||
|
||||
public Class<? extends Annotation> getStringArrayType() {
|
||||
return GLchar.class;
|
||||
}
|
||||
|
||||
public Class<? extends Annotation> getByteBufferArrayType() {
|
||||
return GLchar.class;
|
||||
}
|
||||
|
||||
private static Class[] getValidBufferTypes(Class type) {
|
||||
if ( type.equals(IntBuffer.class) )
|
||||
return new Class[] { GLbitfield.class, GLenum.class, GLhandleARB.class, GLint.class,
|
||||
|
@ -225,7 +246,11 @@ public class GLTypeMap implements TypeMap {
|
|||
return new Class[] { };
|
||||
}
|
||||
|
||||
public String getTypedefPrefix() {
|
||||
public String getTypedefPostfix() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public String getFunctionPrefix() {
|
||||
return "APIENTRY";
|
||||
}
|
||||
|
||||
|
@ -241,8 +266,8 @@ public class GLTypeMap implements TypeMap {
|
|||
valid_types = getValidPrimitiveTypes(type);
|
||||
else if ( String.class.equals(type) )
|
||||
valid_types = new Class[] { GLubyte.class };
|
||||
else if ( PointerWrapper.class.isAssignableFrom(type) )
|
||||
valid_types = new Class[] { GLpointer.class };
|
||||
else if ( org.lwjgl.PointerWrapper.class.isAssignableFrom(type) )
|
||||
valid_types = new Class[] { PointerWrapper.class };
|
||||
else if (void.class.equals(type) )
|
||||
valid_types = new Class[] { GLreturn.class };
|
||||
else
|
||||
|
@ -250,7 +275,7 @@ public class GLTypeMap implements TypeMap {
|
|||
return valid_types;
|
||||
}
|
||||
|
||||
public Class getInverseType(Class type) {
|
||||
public Class<? extends Annotation> getInverseType(Class type) {
|
||||
if ( GLuint.class.equals(type) )
|
||||
return GLint.class;
|
||||
else if ( GLint.class.equals(type) )
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLbitfield.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLboolean.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLbyte.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLchar.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLcharARB.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLclampd.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLclampf.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLdouble.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLenum.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLfloat.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLhalf.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLhandleARB.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLint.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,7 +29,9 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
|
@ -29,7 +29,9 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLintptr.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLintptrARB.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
* When a method is annonated with @GLreturn, the specified output Buffer parameter
|
||||
|
@ -38,6 +38,8 @@ package org.lwjgl.util.generator;
|
|||
*
|
||||
* @author spasi
|
||||
*/
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLshort.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLsizei.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLsizeiptr.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLsizeiptrARB.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
* Unsigned binary representing an absolute absolute or relative time interval.
|
||||
|
@ -38,6 +38,8 @@ package org.lwjgl.util.generator;
|
|||
* @author spasi <spasi@users.sourceforge.net>
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLubyte.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLuint.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,7 +29,9 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
|
@ -29,7 +29,9 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 2983 $
|
||||
* $Id: GLushort.java 2983 2008-04-07 18:36:09Z matzon $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -29,15 +29,17 @@
|
|||
* 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;
|
||||
package org.lwjgl.util.generator.opengl;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author elias_naur <elias_naur@users.sourceforge.net>
|
||||
* @version $Revision$
|
||||
* $Id$
|
||||
* @version $Revision: 3279 $
|
||||
* $Id: GLvoid.java 3279 2010-03-11 21:06:49Z spasi $
|
||||
*/
|
||||
|
||||
import org.lwjgl.util.generator.NativeType;
|
||||
|
||||
import java.lang.annotation.Target;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
|
@ -0,0 +1,998 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008-2010 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
******************************************************************************/
|
||||
|
||||
/* $Revision: 11985 $ on $Date: 2010-07-15 11:16:06 -0700 (Thu, 15 Jul 2010) $ */
|
||||
|
||||
#ifndef __OPENCL_CL_H
|
||||
#define __OPENCL_CL_H
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl_platform.h>
|
||||
#else
|
||||
#include <CL/cl_platform.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
typedef struct _cl_platform_id * cl_platform_id;
|
||||
typedef struct _cl_device_id * cl_device_id;
|
||||
typedef struct _cl_context * cl_context;
|
||||
typedef struct _cl_command_queue * cl_command_queue;
|
||||
typedef struct _cl_mem * cl_mem;
|
||||
typedef struct _cl_program * cl_program;
|
||||
typedef struct _cl_kernel * cl_kernel;
|
||||
typedef struct _cl_event * cl_event;
|
||||
typedef struct _cl_sampler * cl_sampler;
|
||||
|
||||
typedef cl_uint cl_bool; /* WARNING! Unlike cl_ types in cl_platform.h, cl_bool is not guaranteed to be the same size as the bool in kernels. */
|
||||
typedef cl_ulong cl_bitfield;
|
||||
typedef cl_bitfield cl_device_type;
|
||||
typedef cl_uint cl_platform_info;
|
||||
typedef cl_uint cl_device_info;
|
||||
typedef cl_bitfield cl_device_fp_config;
|
||||
typedef cl_uint cl_device_mem_cache_type;
|
||||
typedef cl_uint cl_device_local_mem_type;
|
||||
typedef cl_bitfield cl_device_exec_capabilities;
|
||||
typedef cl_bitfield cl_command_queue_properties;
|
||||
|
||||
typedef intptr_t cl_context_properties;
|
||||
typedef cl_uint cl_context_info;
|
||||
typedef cl_uint cl_command_queue_info;
|
||||
typedef cl_uint cl_channel_order;
|
||||
typedef cl_uint cl_channel_type;
|
||||
typedef cl_bitfield cl_mem_flags;
|
||||
typedef cl_uint cl_mem_object_type;
|
||||
typedef cl_uint cl_mem_info;
|
||||
typedef cl_uint cl_image_info;
|
||||
typedef cl_uint cl_buffer_create_type;
|
||||
typedef cl_uint cl_addressing_mode;
|
||||
typedef cl_uint cl_filter_mode;
|
||||
typedef cl_uint cl_sampler_info;
|
||||
typedef cl_bitfield cl_map_flags;
|
||||
typedef cl_uint cl_program_info;
|
||||
typedef cl_uint cl_program_build_info;
|
||||
typedef cl_int cl_build_status;
|
||||
typedef cl_uint cl_kernel_info;
|
||||
typedef cl_uint cl_kernel_work_group_info;
|
||||
typedef cl_uint cl_event_info;
|
||||
typedef cl_uint cl_command_type;
|
||||
typedef cl_uint cl_profiling_info;
|
||||
|
||||
typedef struct _cl_image_format {
|
||||
cl_channel_order image_channel_order;
|
||||
cl_channel_type image_channel_data_type;
|
||||
} cl_image_format;
|
||||
|
||||
|
||||
typedef struct _cl_buffer_region {
|
||||
size_t origin;
|
||||
size_t size;
|
||||
} cl_buffer_region;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
/* Error Codes */
|
||||
#define CL_SUCCESS 0
|
||||
#define CL_DEVICE_NOT_FOUND -1
|
||||
#define CL_DEVICE_NOT_AVAILABLE -2
|
||||
#define CL_COMPILER_NOT_AVAILABLE -3
|
||||
#define CL_MEM_OBJECT_ALLOCATION_FAILURE -4
|
||||
#define CL_OUT_OF_RESOURCES -5
|
||||
#define CL_OUT_OF_HOST_MEMORY -6
|
||||
#define CL_PROFILING_INFO_NOT_AVAILABLE -7
|
||||
#define CL_MEM_COPY_OVERLAP -8
|
||||
#define CL_IMAGE_FORMAT_MISMATCH -9
|
||||
#define CL_IMAGE_FORMAT_NOT_SUPPORTED -10
|
||||
#define CL_BUILD_PROGRAM_FAILURE -11
|
||||
#define CL_MAP_FAILURE -12
|
||||
#define CL_MISALIGNED_SUB_BUFFER_OFFSET -13
|
||||
#define CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST -14
|
||||
|
||||
#define CL_INVALID_VALUE -30
|
||||
#define CL_INVALID_DEVICE_TYPE -31
|
||||
#define CL_INVALID_PLATFORM -32
|
||||
#define CL_INVALID_DEVICE -33
|
||||
#define CL_INVALID_CONTEXT -34
|
||||
#define CL_INVALID_QUEUE_PROPERTIES -35
|
||||
#define CL_INVALID_COMMAND_QUEUE -36
|
||||
#define CL_INVALID_HOST_PTR -37
|
||||
#define CL_INVALID_MEM_OBJECT -38
|
||||
#define CL_INVALID_IMAGE_FORMAT_DESCRIPTOR -39
|
||||
#define CL_INVALID_IMAGE_SIZE -40
|
||||
#define CL_INVALID_SAMPLER -41
|
||||
#define CL_INVALID_BINARY -42
|
||||
#define CL_INVALID_BUILD_OPTIONS -43
|
||||
#define CL_INVALID_PROGRAM -44
|
||||
#define CL_INVALID_PROGRAM_EXECUTABLE -45
|
||||
#define CL_INVALID_KERNEL_NAME -46
|
||||
#define CL_INVALID_KERNEL_DEFINITION -47
|
||||
#define CL_INVALID_KERNEL -48
|
||||
#define CL_INVALID_ARG_INDEX -49
|
||||
#define CL_INVALID_ARG_VALUE -50
|
||||
#define CL_INVALID_ARG_SIZE -51
|
||||
#define CL_INVALID_KERNEL_ARGS -52
|
||||
#define CL_INVALID_WORK_DIMENSION -53
|
||||
#define CL_INVALID_WORK_GROUP_SIZE -54
|
||||
#define CL_INVALID_WORK_ITEM_SIZE -55
|
||||
#define CL_INVALID_GLOBAL_OFFSET -56
|
||||
#define CL_INVALID_EVENT_WAIT_LIST -57
|
||||
#define CL_INVALID_EVENT -58
|
||||
#define CL_INVALID_OPERATION -59
|
||||
#define CL_INVALID_GL_OBJECT -60
|
||||
#define CL_INVALID_BUFFER_SIZE -61
|
||||
#define CL_INVALID_MIP_LEVEL -62
|
||||
#define CL_INVALID_GLOBAL_WORK_SIZE -63
|
||||
#define CL_INVALID_PROPERTY -64
|
||||
|
||||
/* OpenCL Version */
|
||||
#define CL_VERSION_1_0 1
|
||||
#define CL_VERSION_1_1 1
|
||||
|
||||
/* cl_bool */
|
||||
#define CL_FALSE 0
|
||||
#define CL_TRUE 1
|
||||
|
||||
/* cl_platform_info */
|
||||
#define CL_PLATFORM_PROFILE 0x0900
|
||||
#define CL_PLATFORM_VERSION 0x0901
|
||||
#define CL_PLATFORM_NAME 0x0902
|
||||
#define CL_PLATFORM_VENDOR 0x0903
|
||||
#define CL_PLATFORM_EXTENSIONS 0x0904
|
||||
|
||||
/* cl_device_type - bitfield */
|
||||
#define CL_DEVICE_TYPE_DEFAULT (1 << 0)
|
||||
#define CL_DEVICE_TYPE_CPU (1 << 1)
|
||||
#define CL_DEVICE_TYPE_GPU (1 << 2)
|
||||
#define CL_DEVICE_TYPE_ACCELERATOR (1 << 3)
|
||||
#define CL_DEVICE_TYPE_ALL 0xFFFFFFFF
|
||||
|
||||
/* cl_device_info */
|
||||
#define CL_DEVICE_TYPE 0x1000
|
||||
#define CL_DEVICE_VENDOR_ID 0x1001
|
||||
#define CL_DEVICE_MAX_COMPUTE_UNITS 0x1002
|
||||
#define CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS 0x1003
|
||||
#define CL_DEVICE_MAX_WORK_GROUP_SIZE 0x1004
|
||||
#define CL_DEVICE_MAX_WORK_ITEM_SIZES 0x1005
|
||||
#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR 0x1006
|
||||
#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT 0x1007
|
||||
#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT 0x1008
|
||||
#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG 0x1009
|
||||
#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT 0x100A
|
||||
#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE 0x100B
|
||||
#define CL_DEVICE_MAX_CLOCK_FREQUENCY 0x100C
|
||||
#define CL_DEVICE_ADDRESS_BITS 0x100D
|
||||
#define CL_DEVICE_MAX_READ_IMAGE_ARGS 0x100E
|
||||
#define CL_DEVICE_MAX_WRITE_IMAGE_ARGS 0x100F
|
||||
#define CL_DEVICE_MAX_MEM_ALLOC_SIZE 0x1010
|
||||
#define CL_DEVICE_IMAGE2D_MAX_WIDTH 0x1011
|
||||
#define CL_DEVICE_IMAGE2D_MAX_HEIGHT 0x1012
|
||||
#define CL_DEVICE_IMAGE3D_MAX_WIDTH 0x1013
|
||||
#define CL_DEVICE_IMAGE3D_MAX_HEIGHT 0x1014
|
||||
#define CL_DEVICE_IMAGE3D_MAX_DEPTH 0x1015
|
||||
#define CL_DEVICE_IMAGE_SUPPORT 0x1016
|
||||
#define CL_DEVICE_MAX_PARAMETER_SIZE 0x1017
|
||||
#define CL_DEVICE_MAX_SAMPLERS 0x1018
|
||||
#define CL_DEVICE_MEM_BASE_ADDR_ALIGN 0x1019
|
||||
#define CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE 0x101A
|
||||
#define CL_DEVICE_SINGLE_FP_CONFIG 0x101B
|
||||
#define CL_DEVICE_GLOBAL_MEM_CACHE_TYPE 0x101C
|
||||
#define CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE 0x101D
|
||||
#define CL_DEVICE_GLOBAL_MEM_CACHE_SIZE 0x101E
|
||||
#define CL_DEVICE_GLOBAL_MEM_SIZE 0x101F
|
||||
#define CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE 0x1020
|
||||
#define CL_DEVICE_MAX_CONSTANT_ARGS 0x1021
|
||||
#define CL_DEVICE_LOCAL_MEM_TYPE 0x1022
|
||||
#define CL_DEVICE_LOCAL_MEM_SIZE 0x1023
|
||||
#define CL_DEVICE_ERROR_CORRECTION_SUPPORT 0x1024
|
||||
#define CL_DEVICE_PROFILING_TIMER_RESOLUTION 0x1025
|
||||
#define CL_DEVICE_ENDIAN_LITTLE 0x1026
|
||||
#define CL_DEVICE_AVAILABLE 0x1027
|
||||
#define CL_DEVICE_COMPILER_AVAILABLE 0x1028
|
||||
#define CL_DEVICE_EXECUTION_CAPABILITIES 0x1029
|
||||
#define CL_DEVICE_QUEUE_PROPERTIES 0x102A
|
||||
#define CL_DEVICE_NAME 0x102B
|
||||
#define CL_DEVICE_VENDOR 0x102C
|
||||
#define CL_DRIVER_VERSION 0x102D
|
||||
#define CL_DEVICE_PROFILE 0x102E
|
||||
#define CL_DEVICE_VERSION 0x102F
|
||||
#define CL_DEVICE_EXTENSIONS 0x1030
|
||||
#define CL_DEVICE_PLATFORM 0x1031
|
||||
/* 0x1032 reserved for CL_DEVICE_DOUBLE_FP_CONFIG */
|
||||
/* 0x1033 reserved for CL_DEVICE_HALF_FP_CONFIG */
|
||||
#define CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF 0x1034
|
||||
#define CL_DEVICE_HOST_UNIFIED_MEMORY 0x1035
|
||||
#define CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR 0x1036
|
||||
#define CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT 0x1037
|
||||
#define CL_DEVICE_NATIVE_VECTOR_WIDTH_INT 0x1038
|
||||
#define CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG 0x1039
|
||||
#define CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT 0x103A
|
||||
#define CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE 0x103B
|
||||
#define CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF 0x103C
|
||||
#define CL_DEVICE_OPENCL_C_VERSION 0x103D
|
||||
|
||||
/* cl_device_fp_config - bitfield */
|
||||
#define CL_FP_DENORM (1 << 0)
|
||||
#define CL_FP_INF_NAN (1 << 1)
|
||||
#define CL_FP_ROUND_TO_NEAREST (1 << 2)
|
||||
#define CL_FP_ROUND_TO_ZERO (1 << 3)
|
||||
#define CL_FP_ROUND_TO_INF (1 << 4)
|
||||
#define CL_FP_FMA (1 << 5)
|
||||
#define CL_FP_SOFT_FLOAT (1 << 6)
|
||||
|
||||
/* cl_device_mem_cache_type */
|
||||
#define CL_NONE 0x0
|
||||
#define CL_READ_ONLY_CACHE 0x1
|
||||
#define CL_READ_WRITE_CACHE 0x2
|
||||
|
||||
/* cl_device_local_mem_type */
|
||||
#define CL_LOCAL 0x1
|
||||
#define CL_GLOBAL 0x2
|
||||
|
||||
/* cl_device_exec_capabilities - bitfield */
|
||||
#define CL_EXEC_KERNEL (1 << 0)
|
||||
#define CL_EXEC_NATIVE_KERNEL (1 << 1)
|
||||
|
||||
/* cl_command_queue_properties - bitfield */
|
||||
#define CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE (1 << 0)
|
||||
#define CL_QUEUE_PROFILING_ENABLE (1 << 1)
|
||||
|
||||
/* cl_context_info */
|
||||
#define CL_CONTEXT_REFERENCE_COUNT 0x1080
|
||||
#define CL_CONTEXT_DEVICES 0x1081
|
||||
#define CL_CONTEXT_PROPERTIES 0x1082
|
||||
#define CL_CONTEXT_NUM_DEVICES 0x1083
|
||||
|
||||
/* cl_context_info + cl_context_properties */
|
||||
#define CL_CONTEXT_PLATFORM 0x1084
|
||||
|
||||
/* cl_command_queue_info */
|
||||
#define CL_QUEUE_CONTEXT 0x1090
|
||||
#define CL_QUEUE_DEVICE 0x1091
|
||||
#define CL_QUEUE_REFERENCE_COUNT 0x1092
|
||||
#define CL_QUEUE_PROPERTIES 0x1093
|
||||
|
||||
/* cl_mem_flags - bitfield */
|
||||
#define CL_MEM_READ_WRITE (1 << 0)
|
||||
#define CL_MEM_WRITE_ONLY (1 << 1)
|
||||
#define CL_MEM_READ_ONLY (1 << 2)
|
||||
#define CL_MEM_USE_HOST_PTR (1 << 3)
|
||||
#define CL_MEM_ALLOC_HOST_PTR (1 << 4)
|
||||
#define CL_MEM_COPY_HOST_PTR (1 << 5)
|
||||
|
||||
/* cl_channel_order */
|
||||
#define CL_R 0x10B0
|
||||
#define CL_A 0x10B1
|
||||
#define CL_RG 0x10B2
|
||||
#define CL_RA 0x10B3
|
||||
#define CL_RGB 0x10B4
|
||||
#define CL_RGBA 0x10B5
|
||||
#define CL_BGRA 0x10B6
|
||||
#define CL_ARGB 0x10B7
|
||||
#define CL_INTENSITY 0x10B8
|
||||
#define CL_LUMINANCE 0x10B9
|
||||
#define CL_Rx 0x10BA
|
||||
#define CL_RGx 0x10BB
|
||||
#define CL_RGBx 0x10BC
|
||||
|
||||
/* cl_channel_type */
|
||||
#define CL_SNORM_INT8 0x10D0
|
||||
#define CL_SNORM_INT16 0x10D1
|
||||
#define CL_UNORM_INT8 0x10D2
|
||||
#define CL_UNORM_INT16 0x10D3
|
||||
#define CL_UNORM_SHORT_565 0x10D4
|
||||
#define CL_UNORM_SHORT_555 0x10D5
|
||||
#define CL_UNORM_INT_101010 0x10D6
|
||||
#define CL_SIGNED_INT8 0x10D7
|
||||
#define CL_SIGNED_INT16 0x10D8
|
||||
#define CL_SIGNED_INT32 0x10D9
|
||||
#define CL_UNSIGNED_INT8 0x10DA
|
||||
#define CL_UNSIGNED_INT16 0x10DB
|
||||
#define CL_UNSIGNED_INT32 0x10DC
|
||||
#define CL_HALF_FLOAT 0x10DD
|
||||
#define CL_FLOAT 0x10DE
|
||||
|
||||
/* cl_mem_object_type */
|
||||
#define CL_MEM_OBJECT_BUFFER 0x10F0
|
||||
#define CL_MEM_OBJECT_IMAGE2D 0x10F1
|
||||
#define CL_MEM_OBJECT_IMAGE3D 0x10F2
|
||||
|
||||
/* cl_mem_info */
|
||||
#define CL_MEM_TYPE 0x1100
|
||||
#define CL_MEM_FLAGS 0x1101
|
||||
#define CL_MEM_SIZE 0x1102
|
||||
#define CL_MEM_HOST_PTR 0x1103
|
||||
#define CL_MEM_MAP_COUNT 0x1104
|
||||
#define CL_MEM_REFERENCE_COUNT 0x1105
|
||||
#define CL_MEM_CONTEXT 0x1106
|
||||
#define CL_MEM_ASSOCIATED_MEMOBJECT 0x1107
|
||||
#define CL_MEM_OFFSET 0x1108
|
||||
|
||||
/* cl_image_info */
|
||||
#define CL_IMAGE_FORMAT 0x1110
|
||||
#define CL_IMAGE_ELEMENT_SIZE 0x1111
|
||||
#define CL_IMAGE_ROW_PITCH 0x1112
|
||||
#define CL_IMAGE_SLICE_PITCH 0x1113
|
||||
#define CL_IMAGE_WIDTH 0x1114
|
||||
#define CL_IMAGE_HEIGHT 0x1115
|
||||
#define CL_IMAGE_DEPTH 0x1116
|
||||
|
||||
/* cl_addressing_mode */
|
||||
#define CL_ADDRESS_NONE 0x1130
|
||||
#define CL_ADDRESS_CLAMP_TO_EDGE 0x1131
|
||||
#define CL_ADDRESS_CLAMP 0x1132
|
||||
#define CL_ADDRESS_REPEAT 0x1133
|
||||
#define CL_ADDRESS_MIRRORED_REPEAT 0x1134
|
||||
|
||||
/* cl_filter_mode */
|
||||
#define CL_FILTER_NEAREST 0x1140
|
||||
#define CL_FILTER_LINEAR 0x1141
|
||||
|
||||
/* cl_sampler_info */
|
||||
#define CL_SAMPLER_REFERENCE_COUNT 0x1150
|
||||
#define CL_SAMPLER_CONTEXT 0x1151
|
||||
#define CL_SAMPLER_NORMALIZED_COORDS 0x1152
|
||||
#define CL_SAMPLER_ADDRESSING_MODE 0x1153
|
||||
#define CL_SAMPLER_FILTER_MODE 0x1154
|
||||
|
||||
/* cl_map_flags - bitfield */
|
||||
#define CL_MAP_READ (1 << 0)
|
||||
#define CL_MAP_WRITE (1 << 1)
|
||||
|
||||
/* cl_program_info */
|
||||
#define CL_PROGRAM_REFERENCE_COUNT 0x1160
|
||||
#define CL_PROGRAM_CONTEXT 0x1161
|
||||
#define CL_PROGRAM_NUM_DEVICES 0x1162
|
||||
#define CL_PROGRAM_DEVICES 0x1163
|
||||
#define CL_PROGRAM_SOURCE 0x1164
|
||||
#define CL_PROGRAM_BINARY_SIZES 0x1165
|
||||
#define CL_PROGRAM_BINARIES 0x1166
|
||||
|
||||
/* cl_program_build_info */
|
||||
#define CL_PROGRAM_BUILD_STATUS 0x1181
|
||||
#define CL_PROGRAM_BUILD_OPTIONS 0x1182
|
||||
#define CL_PROGRAM_BUILD_LOG 0x1183
|
||||
|
||||
/* cl_build_status */
|
||||
#define CL_BUILD_SUCCESS 0
|
||||
#define CL_BUILD_NONE -1
|
||||
#define CL_BUILD_ERROR -2
|
||||
#define CL_BUILD_IN_PROGRESS -3
|
||||
|
||||
/* cl_kernel_info */
|
||||
#define CL_KERNEL_FUNCTION_NAME 0x1190
|
||||
#define CL_KERNEL_NUM_ARGS 0x1191
|
||||
#define CL_KERNEL_REFERENCE_COUNT 0x1192
|
||||
#define CL_KERNEL_CONTEXT 0x1193
|
||||
#define CL_KERNEL_PROGRAM 0x1194
|
||||
|
||||
/* cl_kernel_work_group_info */
|
||||
#define CL_KERNEL_WORK_GROUP_SIZE 0x11B0
|
||||
#define CL_KERNEL_COMPILE_WORK_GROUP_SIZE 0x11B1
|
||||
#define CL_KERNEL_LOCAL_MEM_SIZE 0x11B2
|
||||
#define CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE 0x11B3
|
||||
#define CL_KERNEL_PRIVATE_MEM_SIZE 0x11B4
|
||||
|
||||
/* cl_event_info */
|
||||
#define CL_EVENT_COMMAND_QUEUE 0x11D0
|
||||
#define CL_EVENT_COMMAND_TYPE 0x11D1
|
||||
#define CL_EVENT_REFERENCE_COUNT 0x11D2
|
||||
#define CL_EVENT_COMMAND_EXECUTION_STATUS 0x11D3
|
||||
#define CL_EVENT_CONTEXT 0x11D4
|
||||
|
||||
/* cl_command_type */
|
||||
#define CL_COMMAND_NDRANGE_KERNEL 0x11F0
|
||||
#define CL_COMMAND_TASK 0x11F1
|
||||
#define CL_COMMAND_NATIVE_KERNEL 0x11F2
|
||||
#define CL_COMMAND_READ_BUFFER 0x11F3
|
||||
#define CL_COMMAND_WRITE_BUFFER 0x11F4
|
||||
#define CL_COMMAND_COPY_BUFFER 0x11F5
|
||||
#define CL_COMMAND_READ_IMAGE 0x11F6
|
||||
#define CL_COMMAND_WRITE_IMAGE 0x11F7
|
||||
#define CL_COMMAND_COPY_IMAGE 0x11F8
|
||||
#define CL_COMMAND_COPY_IMAGE_TO_BUFFER 0x11F9
|
||||
#define CL_COMMAND_COPY_BUFFER_TO_IMAGE 0x11FA
|
||||
#define CL_COMMAND_MAP_BUFFER 0x11FB
|
||||
#define CL_COMMAND_MAP_IMAGE 0x11FC
|
||||
#define CL_COMMAND_UNMAP_MEM_OBJECT 0x11FD
|
||||
#define CL_COMMAND_MARKER 0x11FE
|
||||
#define CL_COMMAND_ACQUIRE_GL_OBJECTS 0x11FF
|
||||
#define CL_COMMAND_RELEASE_GL_OBJECTS 0x1200
|
||||
#define CL_COMMAND_READ_BUFFER_RECT 0x1201
|
||||
#define CL_COMMAND_WRITE_BUFFER_RECT 0x1202
|
||||
#define CL_COMMAND_COPY_BUFFER_RECT 0x1203
|
||||
#define CL_COMMAND_USER 0x1204
|
||||
|
||||
/* command execution status */
|
||||
#define CL_COMPLETE 0x0
|
||||
#define CL_RUNNING 0x1
|
||||
#define CL_SUBMITTED 0x2
|
||||
#define CL_QUEUED 0x3
|
||||
|
||||
/* cl_buffer_create_type */
|
||||
#define CL_BUFFER_CREATE_TYPE_REGION 0x1220
|
||||
|
||||
/* cl_profiling_info */
|
||||
#define CL_PROFILING_COMMAND_QUEUED 0x1280
|
||||
#define CL_PROFILING_COMMAND_SUBMIT 0x1281
|
||||
#define CL_PROFILING_COMMAND_START 0x1282
|
||||
#define CL_PROFILING_COMMAND_END 0x1283
|
||||
|
||||
/********************************************************************************************************/
|
||||
|
||||
/* Platform API */
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetPlatformIDs(cl_uint /* num_entries */,
|
||||
cl_platform_id * /* platforms */,
|
||||
cl_uint * /* num_platforms */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetPlatformInfo(cl_platform_id /* platform */,
|
||||
cl_platform_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* Device APIs */
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetDeviceIDs(cl_platform_id /* platform */,
|
||||
cl_device_type /* device_type */,
|
||||
cl_uint /* num_entries */,
|
||||
cl_device_id * /* devices */,
|
||||
cl_uint * /* num_devices */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetDeviceInfo(cl_device_id /* device */,
|
||||
cl_device_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* Context APIs */
|
||||
extern CL_API_ENTRY cl_context CL_API_CALL
|
||||
clCreateContext(const cl_context_properties * /* properties */,
|
||||
cl_uint /* num_devices */,
|
||||
const cl_device_id * /* devices */,
|
||||
void (CL_CALLBACK * /* pfn_notify */)(const char *, const void *, size_t, void *),
|
||||
void * /* user_data */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_context CL_API_CALL
|
||||
clCreateContextFromType(const cl_context_properties * /* properties */,
|
||||
cl_device_type /* device_type */,
|
||||
void (CL_CALLBACK * /* pfn_notify*/ )(const char *, const void *, size_t, void *),
|
||||
void * /* user_data */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clRetainContext(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clReleaseContext(cl_context /* context */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetContextInfo(cl_context /* context */,
|
||||
cl_context_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* Command Queue APIs */
|
||||
extern CL_API_ENTRY cl_command_queue CL_API_CALL
|
||||
clCreateCommandQueue(cl_context /* context */,
|
||||
cl_device_id /* device */,
|
||||
cl_command_queue_properties /* properties */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clRetainCommandQueue(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clReleaseCommandQueue(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetCommandQueueInfo(cl_command_queue /* command_queue */,
|
||||
cl_command_queue_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
#ifdef CL_USE_DEPRECATED_OPENCL_1_0_APIS
|
||||
#warning CL_USE_DEPRECATED_OPENCL_1_0_APIS is defined. These APIs are unsupported and untested in OpenCL 1.1!
|
||||
/*
|
||||
* WARNING:
|
||||
* This API introduces mutable state into the OpenCL implementation. It has been REMOVED
|
||||
* to better facilitate thread safety. The 1.0 API is not thread safe. It is not tested by the
|
||||
* OpenCL 1.1 conformance test, and consequently may not work or may not work dependably.
|
||||
* It is likely to be non-performant. Use of this API is not advised. Use at your own risk.
|
||||
*
|
||||
* Software developers previously relying on this API are instructed to set the command queue
|
||||
* properties when creating the queue, instead.
|
||||
*/
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clSetCommandQueueProperty(cl_command_queue /* command_queue */,
|
||||
cl_command_queue_properties /* properties */,
|
||||
cl_bool /* enable */,
|
||||
cl_command_queue_properties * /* old_properties */) CL_EXT_SUFFIX__VERSION_1_0_DEPRECATED;
|
||||
#endif /* CL_USE_DEPRECATED_OPENCL_1_0_APIS */
|
||||
|
||||
/* Memory Object APIs */
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateBuffer(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
size_t /* size */,
|
||||
void * /* host_ptr */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateSubBuffer(cl_mem /* buffer */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_buffer_create_type /* buffer_create_type */,
|
||||
const void * /* buffer_create_info */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1;
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateImage2D(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
const cl_image_format * /* image_format */,
|
||||
size_t /* image_width */,
|
||||
size_t /* image_height */,
|
||||
size_t /* image_row_pitch */,
|
||||
void * /* host_ptr */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateImage3D(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
const cl_image_format * /* image_format */,
|
||||
size_t /* image_width */,
|
||||
size_t /* image_height */,
|
||||
size_t /* image_depth */,
|
||||
size_t /* image_row_pitch */,
|
||||
size_t /* image_slice_pitch */,
|
||||
void * /* host_ptr */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clRetainMemObject(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clReleaseMemObject(cl_mem /* memobj */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetSupportedImageFormats(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_mem_object_type /* image_type */,
|
||||
cl_uint /* num_entries */,
|
||||
cl_image_format * /* image_formats */,
|
||||
cl_uint * /* num_image_formats */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetMemObjectInfo(cl_mem /* memobj */,
|
||||
cl_mem_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetImageInfo(cl_mem /* image */,
|
||||
cl_image_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clSetMemObjectDestructorCallback( cl_mem /* memobj */,
|
||||
void (CL_CALLBACK * /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/),
|
||||
void * /*user_data */ ) CL_API_SUFFIX__VERSION_1_1;
|
||||
|
||||
/* Sampler APIs */
|
||||
extern CL_API_ENTRY cl_sampler CL_API_CALL
|
||||
clCreateSampler(cl_context /* context */,
|
||||
cl_bool /* normalized_coords */,
|
||||
cl_addressing_mode /* addressing_mode */,
|
||||
cl_filter_mode /* filter_mode */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clRetainSampler(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clReleaseSampler(cl_sampler /* sampler */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetSamplerInfo(cl_sampler /* sampler */,
|
||||
cl_sampler_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* Program Object APIs */
|
||||
extern CL_API_ENTRY cl_program CL_API_CALL
|
||||
clCreateProgramWithSource(cl_context /* context */,
|
||||
cl_uint /* count */,
|
||||
const char ** /* strings */,
|
||||
const size_t * /* lengths */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_program CL_API_CALL
|
||||
clCreateProgramWithBinary(cl_context /* context */,
|
||||
cl_uint /* num_devices */,
|
||||
const cl_device_id * /* device_list */,
|
||||
const size_t * /* lengths */,
|
||||
const unsigned char ** /* binaries */,
|
||||
cl_int * /* binary_status */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clRetainProgram(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clReleaseProgram(cl_program /* program */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clBuildProgram(cl_program /* program */,
|
||||
cl_uint /* num_devices */,
|
||||
const cl_device_id * /* device_list */,
|
||||
const char * /* options */,
|
||||
void (CL_CALLBACK * /* pfn_notify */)(cl_program /* program */, void * /* user_data */),
|
||||
void * /* user_data */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clUnloadCompiler(void) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetProgramInfo(cl_program /* program */,
|
||||
cl_program_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetProgramBuildInfo(cl_program /* program */,
|
||||
cl_device_id /* device */,
|
||||
cl_program_build_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* Kernel Object APIs */
|
||||
extern CL_API_ENTRY cl_kernel CL_API_CALL
|
||||
clCreateKernel(cl_program /* program */,
|
||||
const char * /* kernel_name */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clCreateKernelsInProgram(cl_program /* program */,
|
||||
cl_uint /* num_kernels */,
|
||||
cl_kernel * /* kernels */,
|
||||
cl_uint * /* num_kernels_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clRetainKernel(cl_kernel /* kernel */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clReleaseKernel(cl_kernel /* kernel */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clSetKernelArg(cl_kernel /* kernel */,
|
||||
cl_uint /* arg_index */,
|
||||
size_t /* arg_size */,
|
||||
const void * /* arg_value */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetKernelInfo(cl_kernel /* kernel */,
|
||||
cl_kernel_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetKernelWorkGroupInfo(cl_kernel /* kernel */,
|
||||
cl_device_id /* device */,
|
||||
cl_kernel_work_group_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* Event Object APIs */
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clWaitForEvents(cl_uint /* num_events */,
|
||||
const cl_event * /* event_list */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetEventInfo(cl_event /* event */,
|
||||
cl_event_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_event CL_API_CALL
|
||||
clCreateUserEvent(cl_context /* context */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clRetainEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clReleaseEvent(cl_event /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clSetUserEventStatus(cl_event /* event */,
|
||||
cl_int /* execution_status */) CL_API_SUFFIX__VERSION_1_1;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clSetEventCallback( cl_event /* event */,
|
||||
cl_int /* command_exec_callback_type */,
|
||||
void (CL_CALLBACK * /* pfn_notify */)(cl_event, cl_int, void *),
|
||||
void * /* user_data */) CL_API_SUFFIX__VERSION_1_1;
|
||||
|
||||
/* Profiling APIs */
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetEventProfilingInfo(cl_event /* event */,
|
||||
cl_profiling_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* Flush and Finish APIs */
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clFlush(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clFinish(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* Enqueued Commands APIs */
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueReadBuffer(cl_command_queue /* command_queue */,
|
||||
cl_mem /* buffer */,
|
||||
cl_bool /* blocking_read */,
|
||||
size_t /* offset */,
|
||||
size_t /* cb */,
|
||||
void * /* ptr */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueReadBufferRect(cl_command_queue /* command_queue */,
|
||||
cl_mem /* buffer */,
|
||||
cl_bool /* blocking_read */,
|
||||
const size_t * /* buffer_origin */,
|
||||
const size_t * /* host_origin */,
|
||||
const size_t * /* region */,
|
||||
size_t /* buffer_row_pitch */,
|
||||
size_t /* buffer_slice_pitch */,
|
||||
size_t /* host_row_pitch */,
|
||||
size_t /* host_slice_pitch */,
|
||||
void * /* ptr */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueWriteBuffer(cl_command_queue /* command_queue */,
|
||||
cl_mem /* buffer */,
|
||||
cl_bool /* blocking_write */,
|
||||
size_t /* offset */,
|
||||
size_t /* cb */,
|
||||
const void * /* ptr */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueWriteBufferRect(cl_command_queue /* command_queue */,
|
||||
cl_mem /* buffer */,
|
||||
cl_bool /* blocking_write */,
|
||||
const size_t * /* buffer_origin */,
|
||||
const size_t * /* host_origin */,
|
||||
const size_t * /* region */,
|
||||
size_t /* buffer_row_pitch */,
|
||||
size_t /* buffer_slice_pitch */,
|
||||
size_t /* host_row_pitch */,
|
||||
size_t /* host_slice_pitch */,
|
||||
const void * /* ptr */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueCopyBuffer(cl_command_queue /* command_queue */,
|
||||
cl_mem /* src_buffer */,
|
||||
cl_mem /* dst_buffer */,
|
||||
size_t /* src_offset */,
|
||||
size_t /* dst_offset */,
|
||||
size_t /* cb */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueCopyBufferRect(cl_command_queue /* command_queue */,
|
||||
cl_mem /* src_buffer */,
|
||||
cl_mem /* dst_buffer */,
|
||||
const size_t * /* src_origin */,
|
||||
const size_t * /* dst_origin */,
|
||||
const size_t * /* region */,
|
||||
size_t /* src_row_pitch */,
|
||||
size_t /* src_slice_pitch */,
|
||||
size_t /* dst_row_pitch */,
|
||||
size_t /* dst_slice_pitch */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueReadImage(cl_command_queue /* command_queue */,
|
||||
cl_mem /* image */,
|
||||
cl_bool /* blocking_read */,
|
||||
const size_t * /* origin[3] */,
|
||||
const size_t * /* region[3] */,
|
||||
size_t /* row_pitch */,
|
||||
size_t /* slice_pitch */,
|
||||
void * /* ptr */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueWriteImage(cl_command_queue /* command_queue */,
|
||||
cl_mem /* image */,
|
||||
cl_bool /* blocking_write */,
|
||||
const size_t * /* origin[3] */,
|
||||
const size_t * /* region[3] */,
|
||||
size_t /* input_row_pitch */,
|
||||
size_t /* input_slice_pitch */,
|
||||
const void * /* ptr */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueCopyImage(cl_command_queue /* command_queue */,
|
||||
cl_mem /* src_image */,
|
||||
cl_mem /* dst_image */,
|
||||
const size_t * /* src_origin[3] */,
|
||||
const size_t * /* dst_origin[3] */,
|
||||
const size_t * /* region[3] */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueCopyImageToBuffer(cl_command_queue /* command_queue */,
|
||||
cl_mem /* src_image */,
|
||||
cl_mem /* dst_buffer */,
|
||||
const size_t * /* src_origin[3] */,
|
||||
const size_t * /* region[3] */,
|
||||
size_t /* dst_offset */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueCopyBufferToImage(cl_command_queue /* command_queue */,
|
||||
cl_mem /* src_buffer */,
|
||||
cl_mem /* dst_image */,
|
||||
size_t /* src_offset */,
|
||||
const size_t * /* dst_origin[3] */,
|
||||
const size_t * /* region[3] */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY void * CL_API_CALL
|
||||
clEnqueueMapBuffer(cl_command_queue /* command_queue */,
|
||||
cl_mem /* buffer */,
|
||||
cl_bool /* blocking_map */,
|
||||
cl_map_flags /* map_flags */,
|
||||
size_t /* offset */,
|
||||
size_t /* cb */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY void * CL_API_CALL
|
||||
clEnqueueMapImage(cl_command_queue /* command_queue */,
|
||||
cl_mem /* image */,
|
||||
cl_bool /* blocking_map */,
|
||||
cl_map_flags /* map_flags */,
|
||||
const size_t * /* origin[3] */,
|
||||
const size_t * /* region[3] */,
|
||||
size_t * /* image_row_pitch */,
|
||||
size_t * /* image_slice_pitch */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueUnmapMemObject(cl_command_queue /* command_queue */,
|
||||
cl_mem /* memobj */,
|
||||
void * /* mapped_ptr */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueNDRangeKernel(cl_command_queue /* command_queue */,
|
||||
cl_kernel /* kernel */,
|
||||
cl_uint /* work_dim */,
|
||||
const size_t * /* global_work_offset */,
|
||||
const size_t * /* global_work_size */,
|
||||
const size_t * /* local_work_size */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueTask(cl_command_queue /* command_queue */,
|
||||
cl_kernel /* kernel */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueNativeKernel(cl_command_queue /* command_queue */,
|
||||
void (*user_func)(void *),
|
||||
void * /* args */,
|
||||
size_t /* cb_args */,
|
||||
cl_uint /* num_mem_objects */,
|
||||
const cl_mem * /* mem_list */,
|
||||
const void ** /* args_mem_loc */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueMarker(cl_command_queue /* command_queue */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueWaitForEvents(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_events */,
|
||||
const cl_event * /* event_list */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueBarrier(cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* Extension function access
|
||||
*
|
||||
* Returns the extension function address for the given function name,
|
||||
* or NULL if a valid function can not be found. The client must
|
||||
* check to make sure the address is not NULL, before using or
|
||||
* calling the returned function address.
|
||||
*/
|
||||
extern CL_API_ENTRY void * CL_API_CALL clGetExtensionFunctionAddress(const char * /* func_name */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_H */
|
||||
|
|
@ -0,0 +1,126 @@
|
|||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2010 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
#ifndef __OPENCL_CL_D3D10_H
|
||||
#define __OPENCL_CL_D3D10_H
|
||||
|
||||
#include <d3d10.h>
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_platform.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/******************************************************************************
|
||||
* cl_khr_d3d10_sharing */
|
||||
#define cl_khr_d3d10_sharing 1
|
||||
|
||||
typedef cl_uint cl_d3d10_device_source_khr;
|
||||
typedef cl_uint cl_d3d10_device_set_khr;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
// Error Codes
|
||||
#define CL_INVALID_D3D10_DEVICE_KHR -1002
|
||||
#define CL_INVALID_D3D10_RESOURCE_KHR -1003
|
||||
#define CL_D3D10_RESOURCE_ALREADY_ACQUIRED_KHR -1004
|
||||
#define CL_D3D10_RESOURCE_NOT_ACQUIRED_KHR -1005
|
||||
|
||||
// cl_d3d10_device_source_nv
|
||||
#define CL_D3D10_DEVICE_KHR 0x4010
|
||||
#define CL_D3D10_DXGI_ADAPTER_KHR 0x4011
|
||||
|
||||
// cl_d3d10_device_set_nv
|
||||
#define CL_PREFERRED_DEVICES_FOR_D3D10_KHR 0x4012
|
||||
#define CL_ALL_DEVICES_FOR_D3D10_KHR 0x4013
|
||||
|
||||
// cl_context_info
|
||||
#define CL_CONTEXT_D3D10_DEVICE_KHR 0x4014
|
||||
#define CL_CONTEXT_D3D10_PREFER_SHARED_RESOURCES_KHR 0x402C
|
||||
|
||||
// cl_mem_info
|
||||
#define CL_MEM_D3D10_RESOURCE_KHR 0x4015
|
||||
|
||||
// cl_image_info
|
||||
#define CL_IMAGE_D3D10_SUBRESOURCE_KHR 0x4016
|
||||
|
||||
// cl_command_type
|
||||
#define CL_COMMAND_ACQUIRE_D3D10_OBJECTS_KHR 0x4017
|
||||
#define CL_COMMAND_RELEASE_D3D10_OBJECTS_KHR 0x4018
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetDeviceIDsFromD3D10KHR_fn)(
|
||||
cl_platform_id platform,
|
||||
cl_d3d10_device_source_khr d3d_device_source,
|
||||
void * d3d_object,
|
||||
cl_d3d10_device_set_khr d3d_device_set,
|
||||
cl_uint num_entries,
|
||||
cl_device_id * devices,
|
||||
cl_uint * num_devices) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10BufferKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D10Buffer * resource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10Texture2DKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D10Texture2D * resource,
|
||||
UINT subresource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_mem (CL_API_CALL *clCreateFromD3D10Texture3DKHR_fn)(
|
||||
cl_context context,
|
||||
cl_mem_flags flags,
|
||||
ID3D10Texture3D * resource,
|
||||
UINT subresource,
|
||||
cl_int * errcode_ret) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueAcquireD3D10ObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
const cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clEnqueueReleaseD3D10ObjectsKHR_fn)(
|
||||
cl_command_queue command_queue,
|
||||
cl_uint num_objects,
|
||||
cl_mem * mem_objects,
|
||||
cl_uint num_events_in_wait_list,
|
||||
const cl_event * event_wait_list,
|
||||
cl_event * event) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // __OPENCL_CL_D3D10_H
|
||||
|
|
@ -0,0 +1,213 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008-2010 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
******************************************************************************/
|
||||
|
||||
/* $Revision: 11928 $ on $Date: 2010-07-13 09:04:56 -0700 (Tue, 13 Jul 2010) $ */
|
||||
|
||||
/* cl_ext.h contains OpenCL extensions which don't have external */
|
||||
/* (OpenGL, D3D) dependencies. */
|
||||
|
||||
#ifndef __CL_EXT_H
|
||||
#define __CL_EXT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl.h>
|
||||
#include <AvailabilityMacros.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
/* cl_khr_fp64 extension - no extension #define since it has no functions */
|
||||
#define CL_DEVICE_DOUBLE_FP_CONFIG 0x1032
|
||||
|
||||
/* cl_khr_fp16 extension - no extension #define since it has no functions */
|
||||
#define CL_DEVICE_HALF_FP_CONFIG 0x1033
|
||||
|
||||
/* Memory object destruction
|
||||
*
|
||||
* Apple extension for use to manage externally allocated buffers used with cl_mem objects with CL_MEM_USE_HOST_PTR
|
||||
*
|
||||
* Registers a user callback function that will be called when the memory object is deleted and its resources
|
||||
* freed. Each call to clSetMemObjectCallbackFn registers the specified user callback function on a callback
|
||||
* stack associated with memobj. The registered user callback functions are called in the reverse order in
|
||||
* which they were registered. The user callback functions are called and then the memory object is deleted
|
||||
* and its resources freed. This provides a mechanism for the application (and libraries) using memobj to be
|
||||
* notified when the memory referenced by host_ptr, specified when the memory object is created and used as
|
||||
* the storage bits for the memory object, can be reused or freed.
|
||||
*
|
||||
* The application may not call CL api's with the cl_mem object passed to the pfn_notify.
|
||||
*
|
||||
* Please check for the "cl_APPLE_SetMemObjectDestructor" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
|
||||
* before using.
|
||||
*/
|
||||
#define cl_APPLE_SetMemObjectDestructor 1
|
||||
cl_int CL_API_ENTRY clSetMemObjectDestructorAPPLE( cl_mem /* memobj */,
|
||||
void (* /*pfn_notify*/)( cl_mem /* memobj */, void* /*user_data*/),
|
||||
void * /*user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
|
||||
/* Context Logging Functions
|
||||
*
|
||||
* The next three convenience functions are intended to be used as the pfn_notify parameter to clCreateContext().
|
||||
* Please check for the "cl_APPLE_ContextLoggingFunctions" extension using clGetDeviceInfo(CL_DEVICE_EXTENSIONS)
|
||||
* before using.
|
||||
*
|
||||
* clLogMessagesToSystemLog fowards on all log messages to the Apple System Logger
|
||||
*/
|
||||
#define cl_APPLE_ContextLoggingFunctions 1
|
||||
extern void CL_API_ENTRY clLogMessagesToSystemLogAPPLE( const char * /* errstr */,
|
||||
const void * /* private_info */,
|
||||
size_t /* cb */,
|
||||
void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* clLogMessagesToStdout sends all log messages to the file descriptor stdout */
|
||||
extern void CL_API_ENTRY clLogMessagesToStdoutAPPLE( const char * /* errstr */,
|
||||
const void * /* private_info */,
|
||||
size_t /* cb */,
|
||||
void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* clLogMessagesToStderr sends all log messages to the file descriptor stderr */
|
||||
extern void CL_API_ENTRY clLogMessagesToStderrAPPLE( const char * /* errstr */,
|
||||
const void * /* private_info */,
|
||||
size_t /* cb */,
|
||||
void * /* user_data */ ) CL_EXT_SUFFIX__VERSION_1_0;
|
||||
|
||||
|
||||
/************************
|
||||
* cl_khr_icd extension *
|
||||
************************/
|
||||
#define cl_khr_icd 1
|
||||
|
||||
/* cl_platform_info */
|
||||
#define CL_PLATFORM_ICD_SUFFIX_KHR 0x0920
|
||||
|
||||
/* Additional Error Codes */
|
||||
#define CL_PLATFORM_NOT_FOUND_KHR -1001
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clIcdGetPlatformIDsKHR(cl_uint /* num_entries */,
|
||||
cl_platform_id * /* platforms */,
|
||||
cl_uint * /* num_platforms */);
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clIcdGetPlatformIDsKHR_fn)(
|
||||
cl_uint /* num_entries */,
|
||||
cl_platform_id * /* platforms */,
|
||||
cl_uint * /* num_platforms */);
|
||||
|
||||
|
||||
/******************************************
|
||||
* cl_nv_device_attribute_query extension *
|
||||
******************************************/
|
||||
/* cl_nv_device_attribute_query extension - no extension #define since it has no functions */
|
||||
#define CL_DEVICE_COMPUTE_CAPABILITY_MAJOR_NV 0x4000
|
||||
#define CL_DEVICE_COMPUTE_CAPABILITY_MINOR_NV 0x4001
|
||||
#define CL_DEVICE_REGISTERS_PER_BLOCK_NV 0x4002
|
||||
#define CL_DEVICE_WARP_SIZE_NV 0x4003
|
||||
#define CL_DEVICE_GPU_OVERLAP_NV 0x4004
|
||||
#define CL_DEVICE_KERNEL_EXEC_TIMEOUT_NV 0x4005
|
||||
#define CL_DEVICE_INTEGRATED_MEMORY_NV 0x4006
|
||||
|
||||
|
||||
/*********************************
|
||||
* cl_amd_device_attribute_query *
|
||||
*********************************/
|
||||
#define CL_DEVICE_PROFILING_TIMER_OFFSET_AMD 0x4036
|
||||
|
||||
|
||||
#ifdef CL_VERSION_1_1
|
||||
/***********************************
|
||||
* cl_ext_device_fission extension *
|
||||
***********************************/
|
||||
#define cl_ext_device_fission 1
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clReleaseDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL *clReleaseDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clRetainDeviceEXT( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
(CL_API_CALL *clRetainDeviceEXT_fn)( cl_device_id /*device*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef cl_ulong cl_device_partition_property_ext;
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clCreateSubDevicesEXT( cl_device_id /*in_device*/,
|
||||
const cl_device_partition_property_ext * /* properties */,
|
||||
cl_uint /*num_entries*/,
|
||||
cl_device_id * /*out_devices*/,
|
||||
cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
typedef CL_API_ENTRY cl_int
|
||||
( CL_API_CALL * clCreateSubDevicesEXT_fn)( cl_device_id /*in_device*/,
|
||||
const cl_device_partition_property_ext * /* properties */,
|
||||
cl_uint /*num_entries*/,
|
||||
cl_device_id * /*out_devices*/,
|
||||
cl_uint * /*num_devices*/ ) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
/* cl_device_partition_property_ext */
|
||||
#define CL_DEVICE_PARTITION_EQUALLY_EXT 0x4050
|
||||
#define CL_DEVICE_PARTITION_BY_COUNTS_EXT 0x4051
|
||||
#define CL_DEVICE_PARTITION_BY_NAMES_EXT 0x4052
|
||||
#define CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT 0x4053
|
||||
|
||||
/* clDeviceGetInfo selectors */
|
||||
#define CL_DEVICE_PARENT_DEVICE_EXT 0x4054
|
||||
#define CL_DEVICE_PARTITION_TYPES_EXT 0x4055
|
||||
#define CL_DEVICE_AFFINITY_DOMAINS_EXT 0x4056
|
||||
#define CL_DEVICE_REFERENCE_COUNT_EXT 0x4057
|
||||
#define CL_DEVICE_PARTITION_STYLE_EXT 0x4058
|
||||
|
||||
/* error codes */
|
||||
#define CL_DEVICE_PARTITION_FAILED_EXT -1057
|
||||
#define CL_INVALID_PARTITION_COUNT_EXT -1058
|
||||
#define CL_INVALID_PARTITION_NAME_EXT -1059
|
||||
|
||||
/* CL_AFFINITY_DOMAINs */
|
||||
#define CL_AFFINITY_DOMAIN_L1_CACHE_EXT 0x1
|
||||
#define CL_AFFINITY_DOMAIN_L2_CACHE_EXT 0x2
|
||||
#define CL_AFFINITY_DOMAIN_L3_CACHE_EXT 0x3
|
||||
#define CL_AFFINITY_DOMAIN_L4_CACHE_EXT 0x4
|
||||
#define CL_AFFINITY_DOMAIN_NUMA_EXT 0x10
|
||||
#define CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT 0x100
|
||||
|
||||
/* cl_device_partition_property_ext list terminators */
|
||||
#define CL_PROPERTIES_LIST_END_EXT ((cl_device_partition_property_ext) 0)
|
||||
#define CL_PARTITION_BY_COUNTS_LIST_END_EXT ((cl_device_partition_property_ext) 0)
|
||||
#define CL_PARTITION_BY_NAMES_LIST_END_EXT ((cl_device_partition_property_ext) 0 - 1)
|
||||
|
||||
|
||||
|
||||
#endif /* CL_VERSION_1_1 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __CL_EXT_H */
|
|
@ -0,0 +1,155 @@
|
|||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2010 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
/*
|
||||
* cl_gl.h contains Khronos-approved (KHR) OpenCL extensions which have
|
||||
* OpenGL dependencies. The application is responsible for #including
|
||||
* OpenGL or OpenGL ES headers before #including cl_gl.h.
|
||||
*/
|
||||
|
||||
#ifndef __OPENCL_CL_GL_H
|
||||
#define __OPENCL_CL_GL_H
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl.h>
|
||||
#include <OpenGL/CGLDevice.h>
|
||||
#else
|
||||
#include <CL/cl.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef cl_uint cl_gl_object_type;
|
||||
typedef cl_uint cl_gl_texture_info;
|
||||
typedef cl_uint cl_gl_platform_info;
|
||||
typedef struct __GLsync *cl_GLsync;
|
||||
|
||||
/* cl_gl_object_type */
|
||||
#define CL_GL_OBJECT_BUFFER 0x2000
|
||||
#define CL_GL_OBJECT_TEXTURE2D 0x2001
|
||||
#define CL_GL_OBJECT_TEXTURE3D 0x2002
|
||||
#define CL_GL_OBJECT_RENDERBUFFER 0x2003
|
||||
|
||||
/* cl_gl_texture_info */
|
||||
#define CL_GL_TEXTURE_TARGET 0x2004
|
||||
#define CL_GL_MIPMAP_LEVEL 0x2005
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateFromGLBuffer(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLuint /* bufobj */,
|
||||
int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateFromGLTexture2D(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLenum /* target */,
|
||||
cl_GLint /* miplevel */,
|
||||
cl_GLuint /* texture */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateFromGLTexture3D(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLenum /* target */,
|
||||
cl_GLint /* miplevel */,
|
||||
cl_GLuint /* texture */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_mem CL_API_CALL
|
||||
clCreateFromGLRenderbuffer(cl_context /* context */,
|
||||
cl_mem_flags /* flags */,
|
||||
cl_GLuint /* renderbuffer */,
|
||||
cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetGLObjectInfo(cl_mem /* memobj */,
|
||||
cl_gl_object_type * /* gl_object_type */,
|
||||
cl_GLuint * /* gl_object_name */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetGLTextureInfo(cl_mem /* memobj */,
|
||||
cl_gl_texture_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueAcquireGLObjects(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_objects */,
|
||||
const cl_mem * /* mem_objects */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clEnqueueReleaseGLObjects(cl_command_queue /* command_queue */,
|
||||
cl_uint /* num_objects */,
|
||||
const cl_mem * /* mem_objects */,
|
||||
cl_uint /* num_events_in_wait_list */,
|
||||
const cl_event * /* event_wait_list */,
|
||||
cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
/* cl_khr_gl_sharing extension */
|
||||
|
||||
#define cl_khr_gl_sharing 1
|
||||
|
||||
typedef cl_uint cl_gl_context_info;
|
||||
|
||||
/* Additional Error Codes */
|
||||
#define CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR -1000
|
||||
|
||||
/* cl_gl_context_info */
|
||||
#define CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR 0x2006
|
||||
#define CL_DEVICES_FOR_GL_CONTEXT_KHR 0x2007
|
||||
|
||||
/* Additional cl_context_properties */
|
||||
#define CL_GL_CONTEXT_KHR 0x2008
|
||||
#define CL_EGL_DISPLAY_KHR 0x2009
|
||||
#define CL_GLX_DISPLAY_KHR 0x200A
|
||||
#define CL_WGL_HDC_KHR 0x200B
|
||||
#define CL_CGL_SHAREGROUP_KHR 0x200C
|
||||
|
||||
extern CL_API_ENTRY cl_int CL_API_CALL
|
||||
clGetGLContextInfoKHR(const cl_context_properties * /* properties */,
|
||||
cl_gl_context_info /* param_name */,
|
||||
size_t /* param_value_size */,
|
||||
void * /* param_value */,
|
||||
size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
|
||||
|
||||
typedef CL_API_ENTRY cl_int (CL_API_CALL *clGetGLContextInfoKHR_fn)(
|
||||
const cl_context_properties * properties,
|
||||
cl_gl_context_info param_name,
|
||||
size_t param_value_size,
|
||||
void * param_value,
|
||||
size_t * param_value_size_ret);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_GL_H */
|
|
@ -0,0 +1,69 @@
|
|||
/**********************************************************************************
|
||||
* Copyright (c) 2008-2010 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
**********************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
/* cl_gl_ext.h contains vendor (non-KHR) OpenCL extensions which have */
|
||||
/* OpenGL dependencies. */
|
||||
|
||||
#ifndef __OPENCL_CL_GL_EXT_H
|
||||
#define __OPENCL_CL_GL_EXT_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl_gl.h>
|
||||
#else
|
||||
#include <CL/cl_gl.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* For each extension, follow this template
|
||||
* /* cl_VEN_extname extension */
|
||||
/* #define cl_VEN_extname 1
|
||||
* ... define new types, if any
|
||||
* ... define new tokens, if any
|
||||
* ... define new APIs, if any
|
||||
*
|
||||
* If you need GLtypes here, mirror them with a cl_GLtype, rather than including a GL header
|
||||
* This allows us to avoid having to decide whether to include GL headers or GLES here.
|
||||
*/
|
||||
|
||||
/*
|
||||
* cl_khr_gl_event extension
|
||||
* See section 9.9 in the OpenCL 1.1 spec for more information
|
||||
*/
|
||||
#define CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR 0x200D
|
||||
|
||||
extern CL_API_ENTRY cl_event CL_API_CALL
|
||||
clCreateEventFromGLsyncKHR(cl_context /* context */,
|
||||
cl_GLsync /* cl_GLsync */,
|
||||
cl_int * /* errcode_ret */) CL_EXT_SUFFIX__VERSION_1_1;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_CL_GL_EXT_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -45,6 +45,9 @@
|
|||
static bool debug = false;
|
||||
static JavaVM *jvm;
|
||||
|
||||
static jmethodID mByteBuffer_asReadOnlyBuffer;
|
||||
static jmethodID mPointerWrapper_getPointer;
|
||||
|
||||
void initAttribList(attrib_list_t *list) {
|
||||
list->current_index = 0;
|
||||
}
|
||||
|
@ -272,6 +275,11 @@ bool ext_InitializeFunctions(ExtGetProcAddressPROC gpa, int num_functions, ExtFu
|
|||
return true;
|
||||
}
|
||||
|
||||
jobject NewReadOnlyDirectByteBuffer(JNIEnv* env, const void* address, jlong capacity) {
|
||||
jobject buffer = (*env)->NewDirectByteBuffer(env, (void *)address, capacity);
|
||||
return (*env)->CallObjectMethod(env, buffer, mByteBuffer_asReadOnlyBuffer);
|
||||
}
|
||||
|
||||
jobject newJavaManagedByteBuffer(JNIEnv *env, const int size) {
|
||||
jclass bufferutils_class = (*env)->FindClass(env, "org/lwjgl/BufferUtils");
|
||||
jmethodID createByteBuffer = (*env)->GetStaticMethodID(env, bufferutils_class, "createByteBuffer", "(I)Ljava/nio/ByteBuffer;");
|
||||
|
@ -327,14 +335,39 @@ bool getBooleanProperty(JNIEnv *env, const char* propertyName) {
|
|||
return (*env)->CallStaticBooleanMethod(env, org_lwjgl_LWJGLUtil_class, getBoolean, property) ? true : false;
|
||||
}
|
||||
|
||||
jlong getPointerWrapperAddress(JNIEnv *env, jobject wrapper) {
|
||||
return (*env)->CallLongMethod(env, wrapper, mPointerWrapper_getPointer);
|
||||
}
|
||||
|
||||
JNIEnv *getThreadEnv() {
|
||||
JNIEnv *env;
|
||||
(*jvm)->GetEnv(jvm, (void *)&env, JNI_VERSION_1_4);
|
||||
return env;
|
||||
}
|
||||
|
||||
JNIEnv *attachCurrentThread() {
|
||||
JNIEnv *env;
|
||||
(*jvm)->AttachCurrentThread(jvm, (void **)&env, NULL);
|
||||
return env;
|
||||
}
|
||||
|
||||
void detachCurrentThread() {
|
||||
(*jvm)->DetachCurrentThread(jvm);
|
||||
}
|
||||
|
||||
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
|
||||
JNIEnv *env;
|
||||
jclass clazz;
|
||||
|
||||
jvm = vm;
|
||||
env = getThreadEnv();
|
||||
|
||||
clazz = (*env)->FindClass(env, "java/nio/ByteBuffer");
|
||||
mByteBuffer_asReadOnlyBuffer = (*env)->GetMethodID(env, clazz, "asReadOnlyBuffer", "()Ljava/nio/ByteBuffer;");
|
||||
|
||||
clazz = (*env)->FindClass(env, "org/lwjgl/PointerWrapper");
|
||||
mPointerWrapper_getPointer = (*env)->GetMethodID(env, clazz, "getPointer", "()J");
|
||||
|
||||
return JNI_VERSION_1_4;
|
||||
}
|
||||
|
||||
|
|
|
@ -123,6 +123,8 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
extern JNIEnv *getThreadEnv();
|
||||
extern JNIEnv *attachCurrentThread();
|
||||
extern void detachCurrentThread();
|
||||
extern void initAttribList(attrib_list_t *list);
|
||||
extern void putAttrib(attrib_list_t *list, int attrib);
|
||||
|
||||
|
@ -140,8 +142,10 @@ extern bool getBooleanProperty(JNIEnv *env, const char* propertyName);
|
|||
extern char * GetStringNativeChars(JNIEnv *env, jstring jstr);
|
||||
extern jstring NewStringNativeWithLength(JNIEnv *env, const char *str, int length);
|
||||
extern jstring NewStringNativeUnsigned(JNIEnv *env, const unsigned char *str);
|
||||
extern jobject NewReadOnlyDirectByteBuffer(JNIEnv* env, const void* address, jlong capacity);
|
||||
extern jobject newJavaManagedByteBuffer(JNIEnv *env, const int size);
|
||||
extern bool positionBuffer(JNIEnv *env, jobject buffer, jint position);
|
||||
extern jlong getPointerWrapperAddress(JNIEnv *env, jobject wrapper);
|
||||
|
||||
extern void ext_InitializeClass(JNIEnv *env, jclass clazz, ExtGetProcAddressPROC gpa, int num_functions, JavaMethodAndExtFunction *functions);
|
||||
extern bool ext_InitializeFunctions(ExtGetProcAddressPROC gpa, int num_functions, ExtFunction *functions);
|
||||
|
|
|
@ -42,13 +42,13 @@ typedef ALvoid* (ALAPIENTRY *alGetProcAddressPROC)(const ALubyte* fname);
|
|||
*/
|
||||
/*void InitializeOpenAL(JNIEnv *env, jstring oalPath) {
|
||||
//load our library
|
||||
if (!tryLoadLibrary(env, oalPath)) {
|
||||
if (!extal_LoadLibrary(env, oalPath)) {
|
||||
throwException(env, "Could not load openal library.");
|
||||
return;
|
||||
}
|
||||
alGetProcAddress = (alGetProcAddressPROC)NativeGetFunctionPointer("alGetProcAddress");
|
||||
alGetProcAddress = (alGetProcAddressPROC)extal_NativeGetFunctionPointer("alGetProcAddress");
|
||||
if (alGetProcAddress == NULL) {
|
||||
UnLoadOpenAL();
|
||||
extal_UnloadLibrary();
|
||||
throwException(env, "Could not load alGetProcAddress function pointer.");
|
||||
return;
|
||||
}
|
||||
|
@ -64,7 +64,7 @@ void* extal_GetProcAddress(const char* function) {
|
|||
void *p;
|
||||
/* p = alGetProcAddress((const ALubyte*)function);
|
||||
if (p == NULL) {*/
|
||||
p = NativeGetFunctionPointer(function);
|
||||
p = extal_NativeGetFunctionPointer(function);
|
||||
if (p == NULL) {
|
||||
printfDebug("Could not locate symbol %s\n", function);
|
||||
}
|
||||
|
|
|
@ -161,9 +161,9 @@ void* extal_GetProcAddress(const char* function);
|
|||
void extal_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions);
|
||||
|
||||
/* Platform dependent functions */
|
||||
void *NativeGetFunctionPointer(const char *function);
|
||||
void tryLoadLibrary(JNIEnv *env, jstring path);
|
||||
void UnLoadOpenAL();
|
||||
void *extal_NativeGetFunctionPointer(const char *function);
|
||||
void extal_LoadLibrary(JNIEnv *env, jstring path);
|
||||
void extal_UnloadLibrary();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
#include "extcl.h"
|
||||
|
||||
typedef CL_API_ENTRY void * (CL_API_CALL *clGetExtensionFunctionAddressPROC) (const char * func_name);
|
||||
static clGetExtensionFunctionAddressPROC clGetExtensionFunctionAddress;
|
||||
|
||||
/**
|
||||
* Retrieves a pointer to the named function
|
||||
*
|
||||
* @param function Name of function
|
||||
* @return pointer to named function, or NULL if not found
|
||||
*/
|
||||
void* extcl_GetProcAddress(const char * function) {
|
||||
void *p = NULL;
|
||||
|
||||
if ( clGetExtensionFunctionAddress == NULL )
|
||||
clGetExtensionFunctionAddress = extcl_NativeGetFunctionPointer("clGetExtensionFunctionAddress");
|
||||
|
||||
p = clGetExtensionFunctionAddress(function);
|
||||
if ( p == NULL )
|
||||
p = extcl_NativeGetFunctionPointer(function);
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
void extcl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions) {
|
||||
ext_InitializeClass(env, clazz, &extcl_GetProcAddress, num_functions, functions);
|
||||
}
|
||||
|
||||
int extcl_CalculateImageSize(const size_t *region, size_t row_pitch, size_t slice_pitch) {
|
||||
if ( slice_pitch == 0 )
|
||||
return region[1] * row_pitch;
|
||||
else
|
||||
return region[2] * slice_pitch;
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __EXTCL_H__
|
||||
#define __EXTCL_H__
|
||||
|
||||
#include <jni.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl_platform.h>
|
||||
#else
|
||||
#include <CL/cl_platform.h>
|
||||
#endif
|
||||
|
||||
#include "common_tools.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "extgl_types.h"
|
||||
#include "extcl_types.h"
|
||||
|
||||
// -----------------[ OpenGL-dependent typedefs ]-----------------
|
||||
typedef GLsync cl_GLsync;
|
||||
|
||||
// -----------------[ Callback function typedefs ]-----------------
|
||||
|
||||
// TODO: This is a bug in current CL implementations (AMD's only?), remove when fixed. (used for cl_native_kernel_func)
|
||||
#if defined(_WIN32)
|
||||
#define CL_USER_FUNC_CALLBACK __cdecl
|
||||
#else
|
||||
#define CL_USER_FUNC_CALLBACK CL_CALLBACK
|
||||
#endif
|
||||
|
||||
typedef void (CL_CALLBACK * cl_create_context_callback)(const char *errinfo, const void *private_info, size_t cb, void *user_data);
|
||||
typedef void (CL_CALLBACK * cl_mem_object_destructor_callback)(cl_mem memobj, void *user_data);
|
||||
typedef void (CL_CALLBACK * cl_build_program_callback)(cl_program program, void *user_data);
|
||||
typedef void (CL_CALLBACK * cl_event_callback)(cl_event event, cl_int event_command_exec_status, void *user_data);
|
||||
typedef void (CL_USER_FUNC_CALLBACK * cl_native_kernel_func)(void *args);
|
||||
|
||||
// -----------------[ Cross-platform functions ]-----------------
|
||||
|
||||
void* extcl_GetProcAddress(const char* function);
|
||||
void extcl_InitializeClass(JNIEnv *env, jclass clazz, int num_functions, JavaMethodAndExtFunction *functions);
|
||||
int extcl_CalculateImageSize(const size_t *region, size_t row_pitch, size_t slice_pitch);
|
||||
|
||||
// -----------------[ Platform dependent functions ]-----------------
|
||||
|
||||
void *extcl_NativeGetFunctionPointer(const char *function);
|
||||
void extcl_LoadLibrary(JNIEnv *env, jstring path);
|
||||
void extcl_UnloadLibrary();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -0,0 +1,74 @@
|
|||
// -----------------[ Core typedefs ]-----------------
|
||||
|
||||
typedef struct _cl_platform_id * cl_platform_id;
|
||||
typedef struct _cl_device_id * cl_device_id;
|
||||
typedef struct _cl_context * cl_context;
|
||||
typedef struct _cl_command_queue * cl_command_queue;
|
||||
typedef struct _cl_mem * cl_mem;
|
||||
typedef struct _cl_program * cl_program;
|
||||
typedef struct _cl_kernel * cl_kernel;
|
||||
typedef struct _cl_event * cl_event;
|
||||
typedef struct _cl_sampler * cl_sampler;
|
||||
|
||||
typedef cl_uint cl_bool; /* WARNING! Unlike cl_ types in cl_platform.h, cl_bool is not guaranteed to be the same size as the bool in kernels. */
|
||||
typedef cl_ulong cl_bitfield;
|
||||
typedef cl_bitfield cl_device_type;
|
||||
typedef cl_uint cl_platform_info;
|
||||
typedef cl_uint cl_device_info;
|
||||
typedef cl_bitfield cl_device_fp_config;
|
||||
typedef cl_uint cl_device_mem_cache_type;
|
||||
typedef cl_uint cl_device_local_mem_type;
|
||||
typedef cl_bitfield cl_device_exec_capabilities;
|
||||
typedef cl_bitfield cl_command_queue_properties;
|
||||
|
||||
typedef intptr_t cl_context_properties;
|
||||
typedef cl_uint cl_context_info;
|
||||
typedef cl_uint cl_command_queue_info;
|
||||
typedef cl_uint cl_channel_order;
|
||||
typedef cl_uint cl_channel_type;
|
||||
typedef cl_bitfield cl_mem_flags;
|
||||
typedef cl_uint cl_mem_object_type;
|
||||
typedef cl_uint cl_mem_info;
|
||||
typedef cl_uint cl_image_info;
|
||||
typedef cl_uint cl_buffer_create_type;
|
||||
typedef cl_uint cl_addressing_mode;
|
||||
typedef cl_uint cl_filter_mode;
|
||||
typedef cl_uint cl_sampler_info;
|
||||
typedef cl_bitfield cl_map_flags;
|
||||
typedef cl_uint cl_program_info;
|
||||
typedef cl_uint cl_program_build_info;
|
||||
typedef cl_int cl_build_status;
|
||||
typedef cl_uint cl_kernel_info;
|
||||
typedef cl_uint cl_kernel_work_group_info;
|
||||
typedef cl_uint cl_event_info;
|
||||
typedef cl_uint cl_command_type;
|
||||
typedef cl_uint cl_profiling_info;
|
||||
|
||||
typedef struct _cl_image_format {
|
||||
cl_channel_order image_channel_order;
|
||||
cl_channel_type image_channel_data_type;
|
||||
} cl_image_format;
|
||||
|
||||
typedef struct _cl_buffer_region {
|
||||
size_t origin;
|
||||
size_t size;
|
||||
} cl_buffer_region;
|
||||
|
||||
// cl_gl.h
|
||||
typedef cl_uint cl_gl_platform_info;
|
||||
typedef cl_uint cl_gl_context_info;
|
||||
typedef cl_uint cl_gl_object_type;
|
||||
typedef cl_uint cl_gl_texture_info;
|
||||
|
||||
// -----------------[ Extension typedefs ]-----------------
|
||||
|
||||
// EXT_device_fission
|
||||
typedef cl_bitfield cl_device_partition_property_ext;
|
||||
// EXT_migrate_memobject
|
||||
typedef cl_bitfield cl_mem_migration_flags_ext;
|
||||
|
||||
// -----------------[ Convenience typedefs ]-----------------
|
||||
|
||||
typedef void cl_void;
|
||||
//typedef char cl_char;
|
||||
//typedef unsigned char cl_uchar;
|
|
@ -70,68 +70,24 @@ THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <string.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <OpenCL/cl_platform.h>
|
||||
#else
|
||||
#include <CL/cl_platform.h>
|
||||
#endif
|
||||
|
||||
#include "common_tools.h"
|
||||
|
||||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#include <windows.h> // fix APIENTRY macro redefinition
|
||||
# define int64_t __int64
|
||||
# define uint64_t unsigned __int64
|
||||
#endif
|
||||
|
||||
#ifndef APIENTRY
|
||||
#define APIENTRY
|
||||
#define APIENTRY
|
||||
#endif
|
||||
|
||||
#ifdef _MACOSX
|
||||
typedef unsigned long GLenum;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef unsigned long GLbitfield;
|
||||
typedef signed char GLbyte;
|
||||
typedef short GLshort;
|
||||
typedef long GLint;
|
||||
typedef long GLsizei;
|
||||
typedef unsigned char GLubyte;
|
||||
typedef unsigned short GLushort;
|
||||
typedef unsigned long GLuint;
|
||||
typedef float GLfloat;
|
||||
typedef float GLclampf;
|
||||
typedef double GLdouble;
|
||||
typedef double GLclampd;
|
||||
typedef void GLvoid;
|
||||
#else
|
||||
typedef unsigned int GLenum;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef unsigned int GLbitfield;
|
||||
typedef void GLvoid;
|
||||
typedef signed char GLbyte; /* 1-byte signed */
|
||||
typedef short GLshort; /* 2-byte signed */
|
||||
typedef int GLint; /* 4-byte signed */
|
||||
typedef unsigned char GLubyte; /* 1-byte unsigned */
|
||||
typedef unsigned short GLushort; /* 2-byte unsigned */
|
||||
typedef unsigned int GLuint; /* 4-byte unsigned */
|
||||
typedef int GLsizei; /* 4-byte signed */
|
||||
typedef float GLfloat; /* single precision float */
|
||||
typedef float GLclampf; /* single precision float in [0,1] */
|
||||
typedef double GLdouble; /* double precision float */
|
||||
typedef double GLclampd; /* double precision float in [0,1] */
|
||||
#endif
|
||||
|
||||
typedef char GLchar; /* native character */
|
||||
|
||||
typedef ptrdiff_t GLintptr;
|
||||
typedef ptrdiff_t GLsizeiptr;
|
||||
typedef ptrdiff_t GLintptrARB;
|
||||
typedef ptrdiff_t GLsizeiptrARB;
|
||||
typedef char GLcharARB; /* native character */
|
||||
typedef unsigned int GLhandleARB; /* shader object handle */
|
||||
typedef unsigned short GLhalfARB;
|
||||
typedef unsigned short GLhalfNV;
|
||||
typedef unsigned short GLhalf;
|
||||
typedef int64_t GLint64EXT;
|
||||
typedef uint64_t GLuint64EXT;
|
||||
typedef int64_t GLint64;
|
||||
typedef uint64_t GLuint64;
|
||||
typedef struct __GLsync *GLsync;
|
||||
#include "extcl_types.h"
|
||||
#include "extgl_types.h"
|
||||
|
||||
/* AMD_debug_output callback function pointer. */
|
||||
typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam);
|
||||
|
@ -139,8 +95,6 @@ typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id, GLenum category, GLenum sever
|
|||
/* 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 */
|
||||
extern bool extgl_Open(JNIEnv *env);
|
||||
extern void extgl_Close(void);
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
#if defined(_WIN32) || defined(_WIN64)
|
||||
#define int64_t __int64
|
||||
#define uint64_t unsigned __int64
|
||||
#endif
|
||||
|
||||
#ifdef _MACOSX
|
||||
typedef unsigned long GLenum;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef unsigned long GLbitfield;
|
||||
typedef signed char GLbyte;
|
||||
typedef short GLshort;
|
||||
typedef long GLint;
|
||||
typedef long GLsizei;
|
||||
typedef unsigned char GLubyte;
|
||||
typedef unsigned short GLushort;
|
||||
typedef unsigned long GLuint;
|
||||
typedef float GLfloat;
|
||||
typedef float GLclampf;
|
||||
typedef double GLdouble;
|
||||
typedef double GLclampd;
|
||||
typedef void GLvoid;
|
||||
#else
|
||||
typedef unsigned int GLenum;
|
||||
typedef unsigned char GLboolean;
|
||||
typedef unsigned int GLbitfield;
|
||||
typedef void GLvoid;
|
||||
typedef signed char GLbyte; /* 1-byte signed */
|
||||
typedef short GLshort; /* 2-byte signed */
|
||||
typedef int GLint; /* 4-byte signed */
|
||||
typedef unsigned char GLubyte; /* 1-byte unsigned */
|
||||
typedef unsigned short GLushort; /* 2-byte unsigned */
|
||||
typedef unsigned int GLuint; /* 4-byte unsigned */
|
||||
typedef int GLsizei; /* 4-byte signed */
|
||||
typedef float GLfloat; /* single precision float */
|
||||
typedef float GLclampf; /* single precision float in [0,1] */
|
||||
typedef double GLdouble; /* double precision float */
|
||||
typedef double GLclampd; /* double precision float in [0,1] */
|
||||
#endif
|
||||
|
||||
typedef char GLchar; /* native character */
|
||||
|
||||
typedef ptrdiff_t GLintptr;
|
||||
typedef ptrdiff_t GLsizeiptr;
|
||||
typedef ptrdiff_t GLintptrARB;
|
||||
typedef ptrdiff_t GLsizeiptrARB;
|
||||
typedef char GLcharARB; /* native character */
|
||||
typedef unsigned int GLhandleARB; /* shader object handle */
|
||||
typedef unsigned short GLhalfARB;
|
||||
typedef unsigned short GLhalfNV;
|
||||
typedef unsigned short GLhalf;
|
||||
typedef int64_t GLint64EXT;
|
||||
typedef uint64_t GLuint64EXT;
|
||||
typedef int64_t GLint64;
|
||||
typedef uint64_t GLuint64;
|
||||
typedef struct __GLsync * GLsync;
|
|
@ -0,0 +1,56 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2008-2010 The Khronos Group Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and/or associated documentation files (the
|
||||
* "Materials"), to deal in the Materials without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Materials, and to
|
||||
* permit persons to whom the Materials are furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included
|
||||
* in all copies or substantial portions of the Materials.
|
||||
*
|
||||
* THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
******************************************************************************/
|
||||
|
||||
/* $Revision: 11708 $ on $Date: 2010-06-13 23:36:24 -0700 (Sun, 13 Jun 2010) $ */
|
||||
|
||||
#ifndef __OPENCL_H
|
||||
#define __OPENCL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
|
||||
#include <OpenCL/cl.h>
|
||||
#include <OpenCL/cl_gl.h>
|
||||
#include <OpenCL/cl_gl_ext.h>
|
||||
#include <OpenCL/cl_ext.h>
|
||||
|
||||
#else
|
||||
|
||||
#include <CL/cl.h>
|
||||
#include <CL/cl_gl.h>
|
||||
#include <CL/cl_gl_ext.h>
|
||||
#include <CL/cl_ext.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include "common_tools.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __OPENCL_H */
|
||||
|
|
@ -35,11 +35,11 @@
|
|||
#include "extal.h"
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL_nCreate(JNIEnv *env, jclass clazz, jstring oalPath) {
|
||||
tryLoadLibrary(env, oalPath);
|
||||
extal_LoadLibrary(env, oalPath);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL_nDestroy(JNIEnv *env, jclass clazz) {
|
||||
UnLoadOpenAL();
|
||||
extal_UnloadLibrary();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_openal_AL_resetNativeStubs(JNIEnv *env, jclass clazz, jclass al_class) {
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <jni.h>
|
||||
#include "org_lwjgl_opencl_CL.h"
|
||||
#include "extcl.h"
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CL_getFunctionAddress(JNIEnv *env, jclass clazz, jstring function_name) {
|
||||
jlong address_jlong;
|
||||
char *function_name_pointer = GetStringNativeChars(env, function_name);
|
||||
void *address = extcl_GetProcAddress(function_name_pointer);
|
||||
free(function_name_pointer);
|
||||
address_jlong = (jlong)(intptr_t)address;
|
||||
return address_jlong;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_nCreate(JNIEnv *env, jclass clazz, jstring oclPath) {
|
||||
extcl_LoadLibrary(env, oclPath);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_nDestroy(JNIEnv *env, jclass clazz) {
|
||||
extcl_UnloadLibrary();
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_resetNativeStubs(JNIEnv *env, jclass clazz, jclass cl_class) {
|
||||
(*env)->UnregisterNatives(env, cl_class);
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_lwjgl_opencl_CL */
|
||||
|
||||
#ifndef _Included_org_lwjgl_opencl_CL
|
||||
#define _Included_org_lwjgl_opencl_CL
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Inaccessible static: created */
|
||||
/*
|
||||
* Class: org_lwjgl_opencl_CL
|
||||
* Method: nCreate
|
||||
* Signature: (Ljava/lang/String;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_nCreate
|
||||
(JNIEnv *, jclass, jstring);
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_opencl_CL
|
||||
* Method: nCreateDefault
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_nCreateDefault
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_opencl_CL
|
||||
* Method: nDestroy
|
||||
* Signature: ()V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_nDestroy
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_opencl_CL
|
||||
* Method: getFunctionAddress
|
||||
* Signature: (Ljava/lang/String;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CL_getFunctionAddress
|
||||
(JNIEnv *, jclass, jstring);
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_opencl_CL
|
||||
* Method: resetNativeStubs
|
||||
* Signature: (Ljava/lang/Class;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_resetNativeStubs
|
||||
(JNIEnv *, jclass, jclass);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,229 @@
|
|||
/*
|
||||
* 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 "extcl.h"
|
||||
#include "org_lwjgl_opencl_CallbackUtil.h"
|
||||
|
||||
static jmethodID contextCallbackJ;
|
||||
static jmethodID memObjectDestructorCallbackJ;
|
||||
static jmethodID buildProgramCallbackJ;
|
||||
static jmethodID nativeKernelCallbackJ;
|
||||
static jmethodID eventCallbackJ;
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_ncreateGlobalRef(JNIEnv *env, jclass clazz, jobject obj) {
|
||||
return (intptr_t)(*env)->NewGlobalRef(env, obj);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CallbackUtil_deleteGlobalRef(JNIEnv *env, jclass clazz, jlong globalRef) {
|
||||
(*env)->DeleteGlobalRef(env, (jobject)(intptr_t)globalRef);
|
||||
}
|
||||
|
||||
// ----------------- [ CONTEXT CALLBACK ] -----------------
|
||||
|
||||
static void CL_CALLBACK contextCallback(const char *errinfo, const void *private_info, size_t cb, void *user_data) {
|
||||
JNIEnv *env = attachCurrentThread();
|
||||
jobject private_info_buffer = NULL;
|
||||
|
||||
if ( env != NULL && !(*env)->ExceptionOccurred(env) && contextCallbackJ != NULL ) {
|
||||
if ( private_info != NULL )
|
||||
private_info_buffer = NewReadOnlyDirectByteBuffer(env, private_info, cb);
|
||||
|
||||
(*env)->CallVoidMethod(env, (jobject)user_data, contextCallbackJ,
|
||||
NewStringNativeWithLength(env, errinfo, strlen(errinfo)),
|
||||
private_info_buffer
|
||||
);
|
||||
}
|
||||
|
||||
detachCurrentThread();
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getContextCallback(JNIEnv *env, jclass clazz) {
|
||||
// Cache the callback methodID
|
||||
jclass callbackClass;
|
||||
if ( contextCallbackJ == NULL ) {
|
||||
callbackClass = (*env)->FindClass(env, "org/lwjgl/opencl/CLContextCallback");
|
||||
if ( callbackClass != NULL )
|
||||
contextCallbackJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(Ljava/lang/String;Ljava/nio/ByteBuffer;)V");
|
||||
}
|
||||
|
||||
return (jlong)(intptr_t)&contextCallback;
|
||||
}
|
||||
|
||||
// ----------------- [ MEM OBJECT DESTRUCTOR CALLBACK ] -----------------
|
||||
|
||||
static void CL_CALLBACK memObjectDestructorCallback(cl_mem memobj, void *user_data) {
|
||||
JNIEnv *env = attachCurrentThread();
|
||||
|
||||
if ( env != NULL && !(*env)->ExceptionOccurred(env) && memObjectDestructorCallbackJ != NULL ) {
|
||||
(*env)->CallVoidMethod(env, (jobject)user_data, memObjectDestructorCallbackJ,
|
||||
(jlong)(intptr_t)memobj
|
||||
);
|
||||
(*env)->DeleteGlobalRef(env, (jobject)user_data);
|
||||
}
|
||||
|
||||
detachCurrentThread();
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getMemObjectDestructorCallback(JNIEnv *env, jclass clazz) {
|
||||
// Cache the callback methodID
|
||||
jclass callbackClass;
|
||||
if ( memObjectDestructorCallbackJ == NULL ) {
|
||||
callbackClass = (*env)->FindClass(env, "org/lwjgl/opencl/CLMemObjectDestructorCallback");
|
||||
if ( callbackClass != NULL )
|
||||
memObjectDestructorCallbackJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(J)V");
|
||||
}
|
||||
|
||||
return (jlong)(intptr_t)&memObjectDestructorCallback;
|
||||
}
|
||||
|
||||
// ----------------- [ MEM OBJECT DESTRUCTOR CALLBACK ] -----------------
|
||||
|
||||
static void CL_CALLBACK buildProgramCallback(cl_program program, void *user_data) {
|
||||
JNIEnv *env = attachCurrentThread();
|
||||
|
||||
if ( env != NULL && !(*env)->ExceptionOccurred(env) && buildProgramCallbackJ != NULL ) {
|
||||
(*env)->CallVoidMethod(env, (jobject)user_data, buildProgramCallbackJ,
|
||||
(jlong)(intptr_t)program
|
||||
);
|
||||
(*env)->DeleteGlobalRef(env, (jobject)user_data);
|
||||
}
|
||||
|
||||
detachCurrentThread();
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getBuildProgramCallback(JNIEnv *env, jclass clazz) {
|
||||
// Cache the callback methodID
|
||||
jclass callbackClass;
|
||||
if ( buildProgramCallbackJ == NULL ) {
|
||||
callbackClass = (*env)->FindClass(env, "org/lwjgl/opencl/CLBuildProgramCallback");
|
||||
if ( callbackClass != NULL )
|
||||
buildProgramCallbackJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(J)V");
|
||||
}
|
||||
|
||||
return (jlong)(intptr_t)&buildProgramCallback;
|
||||
}
|
||||
|
||||
// ----------------- [ NATIVE KERNEL CALLBACK ] -----------------
|
||||
|
||||
static void CL_USER_FUNC_CALLBACK nativeKernelCallback(void *args) {
|
||||
JNIEnv *env = attachCurrentThread();
|
||||
jobject user_func = (jobject)*(intptr_t *)args;
|
||||
jint num_mem_objects = *(jint *)((char *)args + 8);
|
||||
jobjectArray memobjs = NULL;
|
||||
jobject buffer;
|
||||
jint i;
|
||||
|
||||
if ( env != NULL && !(*env)->ExceptionOccurred(env) && nativeKernelCallbackJ != NULL ) {
|
||||
if ( num_mem_objects > 0 ) {
|
||||
memobjs = (*env)->NewObjectArray(env, num_mem_objects, (*env)->FindClass(env, "java/nio/ByteBuffer"), NULL);
|
||||
for ( i = 0; i < num_mem_objects; i++ ) {
|
||||
buffer = (*env)->NewDirectByteBuffer(env,
|
||||
// Pointer to cl_mem buffer
|
||||
(void *)((char *)args + (12 + 4 + (i * (4 + sizeof(size_t))))),
|
||||
// cl_mem buffer size
|
||||
*((jint *)((char *)args + (12 + (i * (4 + sizeof(size_t))))))
|
||||
);
|
||||
(*env)->SetObjectArrayElement(env, memobjs, i, buffer);
|
||||
}
|
||||
}
|
||||
|
||||
(*env)->CallVoidMethod(env, user_func, nativeKernelCallbackJ, memobjs);
|
||||
|
||||
if ( num_mem_objects > 0 )
|
||||
(*env)->DeleteLocalRef(env, memobjs);
|
||||
(*env)->DeleteGlobalRef(env, user_func);
|
||||
}
|
||||
|
||||
detachCurrentThread();
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getNativeKernelCallback(JNIEnv *env, jclass clazz) {
|
||||
// Cache the callback methodID
|
||||
jclass callbackClass;
|
||||
if ( nativeKernelCallbackJ == NULL ) {
|
||||
callbackClass = (*env)->FindClass(env, "org/lwjgl/opencl/CLNativeKernel");
|
||||
if ( callbackClass != NULL )
|
||||
nativeKernelCallbackJ = (*env)->GetMethodID(env, callbackClass, "execute", "([Ljava/nio/ByteBuffer;)V");
|
||||
}
|
||||
|
||||
return (jlong)(intptr_t)&nativeKernelCallback;
|
||||
}
|
||||
|
||||
// ----------------- [ EVENT CALLBACK ] -----------------
|
||||
|
||||
static void CL_CALLBACK eventCallback(cl_event event, cl_int event_command_exec_status, void *user_data) {
|
||||
JNIEnv *env = attachCurrentThread();
|
||||
|
||||
if ( env != NULL && !(*env)->ExceptionOccurred(env) && eventCallbackJ != NULL ) {
|
||||
(*env)->CallVoidMethod(env, (jobject)user_data, eventCallbackJ,
|
||||
(jlong)(intptr_t)event,
|
||||
event_command_exec_status
|
||||
);
|
||||
(*env)->DeleteGlobalRef(env, (jobject)user_data);
|
||||
}
|
||||
|
||||
detachCurrentThread();
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getEventCallback(JNIEnv *env, jclass clazz) {
|
||||
// Cache the callback methodID
|
||||
jclass callbackClass;
|
||||
if ( eventCallbackJ == NULL ) {
|
||||
callbackClass = (*env)->FindClass(env, "org/lwjgl/opencl/CLEventCallback");
|
||||
if ( callbackClass != NULL )
|
||||
eventCallbackJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(JI)V");
|
||||
}
|
||||
|
||||
return (jlong)(intptr_t)&eventCallback;
|
||||
}
|
||||
|
||||
// ----------------- [ APPLE_ContextLoggingFunctions CALLBACKS ] -----------------
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getLogMessageToSystemLogAPPLE(JNIEnv *env, jclass clazz) {
|
||||
return (jlong)(intptr_t)extcl_GetProcAddress("clLogMessagesToSystemLogAPPLE");
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getLogMessageToStdoutAPPLE(JNIEnv *env, jclass clazz) {
|
||||
return (jlong)(intptr_t)extcl_GetProcAddress("getLogMessageToStdoutAPPLE");
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getLogMessageToStderrAPPLE(JNIEnv *env, jclass clazz) {
|
||||
return (jlong)(intptr_t)extcl_GetProcAddress("getLogMessageToStderrAPPLE");
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_lwjgl_opencl_CallbackUtil */
|
||||
|
||||
#ifndef _Included_org_lwjgl_opencl_CallbackUtil
|
||||
#define _Included_org_lwjgl_opencl_CallbackUtil
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Inaccessible static: contextUserData */
|
||||
/*
|
||||
* Class: org_lwjgl_opencl_CallbackUtil
|
||||
* Method: ncreateGlobalRef
|
||||
* Signature: (Ljava/lang/Object;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_ncreateGlobalRef
|
||||
(JNIEnv *, jclass, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_opencl_CallbackUtil
|
||||
* Method: deleteGlobalRef
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CallbackUtil_deleteGlobalRef
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_opencl_CallbackUtil
|
||||
* Method: getContextCallback
|
||||
* Signature: ()J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getContextCallback
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_opencl_CallbackUtil
|
||||
* Method: getMemObjectDestructorCallback
|
||||
* Signature: ()J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getMemObjectDestructorCallback
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_opencl_CallbackUtil
|
||||
* Method: getBuildProgramCallback
|
||||
* Signature: ()J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getBuildProgramCallback
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_opencl_CallbackUtil
|
||||
* Method: getNativeKernelCallback
|
||||
* Signature: ()J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getNativeKernelCallback
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_opencl_CallbackUtil
|
||||
* Method: getEventCallback
|
||||
* Signature: ()J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getEventCallback
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_opencl_CallbackUtil
|
||||
* Method: getLogMessageToSystemLogAPPLE
|
||||
* Signature: ()J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getLogMessageToSystemLogAPPLE
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_opencl_CallbackUtil
|
||||
* Method: getLogMessageToStdoutAPPLE
|
||||
* Signature: ()J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getLogMessageToStdoutAPPLE
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_opencl_CallbackUtil
|
||||
* Method: getLogMessageToStderrAPPLE
|
||||
* Signature: ()J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opencl_CallbackUtil_getLogMessageToStderrAPPLE
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -1,88 +0,0 @@
|
|||
/*
|
||||
* 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_AMDDebugOutputCallback.h"
|
||||
|
||||
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();
|
||||
if (env != NULL && !(*env)->ExceptionOccurred(env)) {
|
||||
callback_class = (*env)->FindClass(env, "org/lwjgl/opengl/AMDDebugOutputUtil");
|
||||
if ( callback_class != NULL ) {
|
||||
callback_method = (*env)->GetStaticMethodID(env, callback_class, "messageCallback", "(IIILjava/lang/String;Ljava/nio/ByteBuffer;)V");
|
||||
if ( callback_method != NULL ) {
|
||||
(*env)->CallStaticVoidMethod(env, callback_class, callback_method,
|
||||
(jint)id,
|
||||
(jint)category,
|
||||
(jint)severity,
|
||||
NewStringNativeWithLength(env, message, length),
|
||||
NULL
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
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) {
|
||||
// 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;
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
/*
|
||||
* 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_CallbackUtil.h"
|
||||
|
||||
static jmethodID debugOutputCallbackARBJ;
|
||||
static jmethodID debugOutputCallbackAMDJ;
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_ncreateGlobalRef(JNIEnv *env, jclass clazz, jobject obj) {
|
||||
return (jlong)(*env)->NewGlobalRef(env, obj);
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CallbackUtil_deleteGlobalRef(JNIEnv *env, jclass clazz, jlong globalRef) {
|
||||
(*env)->DeleteGlobalRef(env, (jobject)globalRef);
|
||||
}
|
||||
|
||||
// ----------------- [ ARB_debug_output ] -----------------
|
||||
|
||||
static void APIENTRY debugOutputCallbackARB(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam) {
|
||||
JNIEnv *env = attachCurrentThread();
|
||||
|
||||
if ( env != NULL && !(*env)->ExceptionOccurred(env) && debugOutputCallbackARBJ != NULL ) {
|
||||
(*env)->CallVoidMethod(env, (jobject)userParam, debugOutputCallbackARBJ,
|
||||
(jint)source,
|
||||
(jint)type,
|
||||
(jint)id,
|
||||
(jint)severity,
|
||||
NewStringNativeWithLength(env, message, length)
|
||||
);
|
||||
}
|
||||
|
||||
detachCurrentThread();
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_getDebugOutputCallbackARB(JNIEnv *env, jclass clazz) {
|
||||
// Cache the callback methodID
|
||||
jclass callbackClass;
|
||||
if ( debugOutputCallbackARBJ == NULL ) {
|
||||
callbackClass = (*env)->FindClass(env, "org/lwjgl/opengl/ARBDebugOutputCallback$Handler");
|
||||
if ( callbackClass != NULL )
|
||||
debugOutputCallbackARBJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(IIIILjava/lang/String;)V");
|
||||
}
|
||||
|
||||
return (jlong)(intptr_t)&debugOutputCallbackARB;
|
||||
}
|
||||
|
||||
// ----------------- [ AMD_debug_output ] -----------------
|
||||
|
||||
static void APIENTRY debugOutputCallbackAMD(GLuint id, GLenum category, GLenum severity, GLsizei length, const GLchar* message, GLvoid* userParam) {
|
||||
JNIEnv *env = attachCurrentThread();
|
||||
|
||||
if ( env != NULL && !(*env)->ExceptionOccurred(env) && debugOutputCallbackAMDJ != NULL ) {
|
||||
(*env)->CallVoidMethod(env, (jobject)userParam, debugOutputCallbackAMDJ,
|
||||
(jint)id,
|
||||
(jint)category,
|
||||
(jint)severity,
|
||||
NewStringNativeWithLength(env, message, length)
|
||||
);
|
||||
}
|
||||
|
||||
detachCurrentThread();
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_getDebugOutputCallbackAMD(JNIEnv *env, jclass clazz) {
|
||||
// Cache the callback methodID
|
||||
jclass callbackClass;
|
||||
if ( debugOutputCallbackAMDJ == NULL ) {
|
||||
callbackClass = (*env)->FindClass(env, "org/lwjgl/opengl/AMDDebugOutputCallback$Handler");
|
||||
if ( callbackClass != NULL )
|
||||
debugOutputCallbackAMDJ = (*env)->GetMethodID(env, callbackClass, "handleMessage", "(IIILjava/lang/String;)V");
|
||||
}
|
||||
|
||||
return (jlong)(intptr_t)&debugOutputCallbackAMD;
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
/* Header for class org_lwjgl_opengl_CallbackUtil */
|
||||
|
||||
#ifndef _Included_org_lwjgl_opengl_CallbackUtil
|
||||
#define _Included_org_lwjgl_opengl_CallbackUtil
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* Inaccessible static: contextUserParamsARB */
|
||||
/* Inaccessible static: contextUserParamsAMD */
|
||||
/*
|
||||
* Class: org_lwjgl_opengl_CallbackUtil
|
||||
* Method: ncreateGlobalRef
|
||||
* Signature: (Ljava/lang/Object;)J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_ncreateGlobalRef
|
||||
(JNIEnv *, jclass, jobject);
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_opengl_CallbackUtil
|
||||
* Method: deleteGlobalRef
|
||||
* Signature: (J)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_CallbackUtil_deleteGlobalRef
|
||||
(JNIEnv *, jclass, jlong);
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_opengl_CallbackUtil
|
||||
* Method: getDebugOutputCallbackARB
|
||||
* Signature: ()J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_getDebugOutputCallbackARB
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_opengl_CallbackUtil
|
||||
* Method: getDebugOutputCallbackAMD
|
||||
* Signature: ()J
|
||||
*/
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_CallbackUtil_getDebugOutputCallbackAMD
|
||||
(JNIEnv *, jclass);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -41,11 +41,11 @@
|
|||
|
||||
static void* handleOAL;
|
||||
|
||||
void *NativeGetFunctionPointer(const char *function) {
|
||||
void *extal_NativeGetFunctionPointer(const char *function) {
|
||||
return dlsym(handleOAL, function);
|
||||
}
|
||||
|
||||
void tryLoadLibrary(JNIEnv *env, jstring path) {
|
||||
void extal_LoadLibrary(JNIEnv *env, jstring path) {
|
||||
char *path_str = GetStringNativeChars(env, path);
|
||||
printfDebugJava(env, "Testing '%s'", path_str);
|
||||
handleOAL = dlopen(path_str, RTLD_LAZY);
|
||||
|
@ -57,7 +57,7 @@ void tryLoadLibrary(JNIEnv *env, jstring path) {
|
|||
free(path_str);
|
||||
}
|
||||
|
||||
void UnLoadOpenAL() {
|
||||
void extal_UnloadLibrary() {
|
||||
if (handleOAL != NULL) {
|
||||
dlclose(handleOAL);
|
||||
handleOAL = NULL;
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "extcl.h"
|
||||
#include "common_tools.h"
|
||||
|
||||
#include <dlfcn.h>
|
||||
|
||||
static void* handleOCL;
|
||||
|
||||
void *extcl_NativeGetFunctionPointer(const char *function) {
|
||||
return dlsym(handleOCL, function);
|
||||
}
|
||||
|
||||
void extcl_LoadLibrary(JNIEnv *env, jstring path) {
|
||||
char *path_str = GetStringNativeChars(env, path);
|
||||
printfDebugJava(env, "Testing '%s'", path_str);
|
||||
handleOCL = dlopen(path_str, RTLD_LAZY);
|
||||
if (handleOCL != NULL) {
|
||||
printfDebugJava(env, "Found OpenCL at '%s'", path_str);
|
||||
} else {
|
||||
throwException(env, "Could not load OpenCL library");
|
||||
}
|
||||
free(path_str);
|
||||
}
|
||||
|
||||
void extcl_UnloadLibrary() {
|
||||
if (handleOCL != NULL) {
|
||||
dlclose(handleOCL);
|
||||
handleOCL = NULL;
|
||||
}
|
||||
}
|
|
@ -106,6 +106,16 @@ static void createContextGLX(JNIEnv *env, X11PeerInfo *peer_info, X11Context *co
|
|||
context_info->context = context;
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_getGLXContext(JNIEnv *env, jclass clazz, jobject context_handle) {
|
||||
X11Context *context_info = (*env)->GetDirectBufferAddress(env, context_handle);
|
||||
return (intptr_t)context_info->context;
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_getDisplay(JNIEnv *env, jclass clazz, jobject peer_info_handle) {
|
||||
X11PeerInfo *peer_info = (*env)->GetDirectBufferAddress(env, peer_info_handle);
|
||||
return (intptr_t)peer_info->display;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_LinuxContextImplementation_nSetSwapInterval
|
||||
(JNIEnv *env, jclass clazz, jobject context_handle, jint value)
|
||||
{
|
||||
|
|
|
@ -89,7 +89,7 @@ static CFBundleRef tryLoadFramework(JNIEnv *env) {
|
|||
return openal_bundle;
|
||||
}
|
||||
|
||||
void tryLoadLibrary(JNIEnv *env, jstring path) {
|
||||
void extal_LoadLibrary(JNIEnv *env, jstring path) {
|
||||
const char *path_str = (*env)->GetStringUTFChars(env, path, NULL);
|
||||
printfDebugJava(env, "Testing '%s'", path_str);
|
||||
handleOAL = NSAddImage(path_str, NSADDIMAGE_OPTION_RETURN_ON_ERROR);
|
||||
|
@ -104,7 +104,7 @@ void tryLoadLibrary(JNIEnv *env, jstring path) {
|
|||
/**
|
||||
* Unloads the OpenAL Library
|
||||
*/
|
||||
void UnLoadOpenAL() {
|
||||
void extal_UnloadLibrary() {
|
||||
if (openal_bundle != NULL) {
|
||||
CFRelease(openal_bundle);
|
||||
openal_bundle = NULL;
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <mach-o/dyld.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
#include "extcl.h"
|
||||
#include "common_tools.h"
|
||||
|
||||
/**
|
||||
* OpenCL library management
|
||||
*/
|
||||
static const struct mach_header* handleOCL = NULL;
|
||||
static CFBundleRef opencl_bundle = NULL;
|
||||
|
||||
void *NativeGetFunctionPointer(const char *function) {
|
||||
void *address = NULL;
|
||||
if (handleOCL != NULL) {
|
||||
char *mac_symbol_name = (char *)malloc((strlen(function) + 2)*sizeof(char));
|
||||
if (mac_symbol_name == NULL)
|
||||
return NULL;
|
||||
mac_symbol_name[0] = '_';
|
||||
strcpy(&(mac_symbol_name[1]), function);
|
||||
NSSymbol symbol = NSLookupSymbolInImage(handleOCL, mac_symbol_name, NSLOOKUPSYMBOLINIMAGE_OPTION_RETURN_ON_ERROR);
|
||||
free(mac_symbol_name);
|
||||
if (symbol != NULL) {
|
||||
address = NSAddressOfSymbol(symbol);
|
||||
}
|
||||
} else if (opencl_bundle != NULL) {
|
||||
CFStringRef cf_function = CFStringCreateWithCString(NULL, function, kCFStringEncodingUTF8);
|
||||
address = CFBundleGetFunctionPointerForName(opencl_bundle, cf_function);
|
||||
CFRelease(cf_function);
|
||||
}
|
||||
return address;
|
||||
}
|
||||
|
||||
static CFBundleRef tryLoadFramework(JNIEnv *env) {
|
||||
CFStringRef framework_path = CFSTR("/System/Library/Frameworks/OpenCL.framework");
|
||||
if (framework_path == NULL) {
|
||||
printfDebugJava(env, "Failed to allocate string");
|
||||
return NULL;
|
||||
}
|
||||
CFURLRef url = CFURLCreateWithFileSystemPath(NULL, framework_path, kCFURLPOSIXPathStyle, TRUE);
|
||||
if (url == NULL) {
|
||||
printfDebugJava(env, "Failed to allocate URL");
|
||||
return NULL;
|
||||
}
|
||||
CFBundleRef opencl_bundle = CFBundleCreate(NULL, url);
|
||||
CFRelease(url);
|
||||
return opencl_bundle;
|
||||
}
|
||||
|
||||
void extcl_LoadLibrary(JNIEnv *env, jstring path) {
|
||||
const char *path_str = (*env)->GetStringUTFChars(env, path, NULL);
|
||||
printfDebugJava(env, "Testing '%s'", path_str);
|
||||
handleOCL = NSAddImage(path_str, NSADDIMAGE_OPTION_RETURN_ON_ERROR);
|
||||
if (handleOCL != NULL) {
|
||||
printfDebugJava(env, "Found OpenCL at '%s'", path_str);
|
||||
} else {
|
||||
throwException(env, "Could not load OpenCL library");
|
||||
}
|
||||
(*env)->ReleaseStringUTFChars(env, path, path_str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unloads the OpenCL Library
|
||||
*/
|
||||
void extcl_UnloadLibrary() {
|
||||
if (opencl_bundle != NULL) {
|
||||
CFRelease(opencl_bundle);
|
||||
opencl_bundle = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opencl_CL_nCreateDefault(JNIEnv *env, jclass clazz) {
|
||||
opencl_bundle = tryLoadFramework(env);
|
||||
if (opencl_bundle != NULL)
|
||||
printfDebugJava(env, "Found OpenCL Bundle");
|
||||
else
|
||||
throwException(env, "Could not load OpenCL framework");
|
||||
}
|
|
@ -120,6 +120,16 @@ JNIEXPORT jobject JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nCr
|
|||
return context_handle;
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_getHGLRC(JNIEnv *env, jclass clazz, jobject context_handle) {
|
||||
WindowsContext *context_info = (WindowsContext *)(*env)->GetDirectBufferAddress(env, context_handle);
|
||||
return (intptr_t)context_info->context;
|
||||
}
|
||||
|
||||
JNIEXPORT jlong JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_getHDC(JNIEnv *env, jclass clazz, jobject peer_info_handle) {
|
||||
WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
|
||||
return (intptr_t)peer_info->drawable_hdc;
|
||||
}
|
||||
|
||||
JNIEXPORT void JNICALL Java_org_lwjgl_opengl_WindowsContextImplementation_nSwapBuffers
|
||||
(JNIEnv *env, jclass clazz, jobject peer_info_handle) {
|
||||
WindowsPeerInfo *peer_info = (WindowsPeerInfo *)(*env)->GetDirectBufferAddress(env, peer_info_handle);
|
||||
|
|
|
@ -47,11 +47,11 @@
|
|||
/* Handle to OpenAL Library */
|
||||
static HMODULE handleOAL;
|
||||
|
||||
void *NativeGetFunctionPointer(const char *function) {
|
||||
void *extal_NativeGetFunctionPointer(const char *function) {
|
||||
return GetProcAddress(handleOAL, function);
|
||||
}
|
||||
|
||||
void tryLoadLibrary(JNIEnv *env, jstring path) {
|
||||
void extal_LoadLibrary(JNIEnv *env, jstring path) {
|
||||
char *path_str = GetStringNativeChars(env, path);
|
||||
printfDebugJava(env, "Testing '%s'", path_str);
|
||||
handleOAL = LoadLibrary(path_str);
|
||||
|
@ -66,6 +66,6 @@ void tryLoadLibrary(JNIEnv *env, jstring path) {
|
|||
/**
|
||||
* Unloads the OpenAL Library
|
||||
*/
|
||||
void UnLoadOpenAL() {
|
||||
void extal_UnloadLibrary() {
|
||||
FreeLibrary(handleOAL);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <windows.h>
|
||||
#include "extcl.h"
|
||||
#include "common_tools.h"
|
||||
|
||||
/**
|
||||
* This file contains the CL extension assigning mechanism
|
||||
*
|
||||
* @author Spasi
|
||||
*/
|
||||
|
||||
/* Handle to OpenCL Library */
|
||||
static HMODULE handleOCL;
|
||||
|
||||
void * extcl_NativeGetFunctionPointer(const char *func_name) {
|
||||
return GetProcAddress(handleOCL, func_name);
|
||||
}
|
||||
|
||||
void extcl_LoadLibrary(JNIEnv *env, jstring path) {
|
||||
char *path_str = GetStringNativeChars(env, path);
|
||||
printfDebugJava(env, "Testing '%s'", path_str);
|
||||
handleOCL = LoadLibrary(path_str);
|
||||
if (handleOCL != NULL) {
|
||||
printfDebugJava(env, "Found OpenCL at '%s'", path_str);
|
||||
} else {
|
||||
throwFormattedException(env, "Could not load OpenCL library (%d)", GetLastError());
|
||||
}
|
||||
free(path_str);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unloads the OpenCL Library
|
||||
*/
|
||||
void extcl_UnloadLibrary() {
|
||||
if ( handleOCL != NULL ) {
|
||||
FreeLibrary(handleOCL);
|
||||
handleOCL = NULL;
|
||||
}
|
||||
}
|
|
@ -37,6 +37,7 @@ import java.nio.FloatBuffer;
|
|||
import java.nio.DoubleBuffer;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.openal.*;
|
||||
|
||||
/**
|
||||
* <br>
|
||||
|
|
|
@ -31,13 +31,13 @@
|
|||
*/
|
||||
package org.lwjgl.openal;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.DoubleBuffer;
|
||||
|
||||
import org.lwjgl.openal.AL10;
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.openal.ALenum;
|
||||
import org.lwjgl.util.generator.openal.ALuint;
|
||||
import org.lwjgl.util.generator.openal.ALvoid;
|
||||
|
||||
/**
|
||||
* <br>
|
||||
|
|
|
@ -34,19 +34,12 @@ package org.lwjgl.openal;
|
|||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
import org.lwjgl.util.generator.ALenum;
|
||||
import org.lwjgl.util.generator.ALsizei;
|
||||
import org.lwjgl.util.generator.ALuint;
|
||||
import org.lwjgl.util.generator.ALvoid;
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.openal.ALenum;
|
||||
import org.lwjgl.util.generator.openal.ALsizei;
|
||||
import org.lwjgl.util.generator.openal.ALuint;
|
||||
import org.lwjgl.util.generator.openal.ALvoid;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.AutoSize;
|
||||
import org.lwjgl.util.generator.Check;
|
||||
import org.lwjgl.util.generator.Const;
|
||||
import org.lwjgl.util.generator.Constant;
|
||||
import org.lwjgl.util.generator.Indirect;
|
||||
import org.lwjgl.util.generator.OutParameter;
|
||||
import org.lwjgl.util.generator.Result;
|
||||
import org.lwjgl.util.generator.StripPostfix;
|
||||
|
||||
/**
|
||||
* Implementation of the OpenAL extension ALC_EXT_EFX (version 1.0). Contains necessary fields,
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
|
||||
|
||||
@CLDeviceExtension
|
||||
public interface AMD_device_attribute_query {
|
||||
|
||||
/**
|
||||
* Accepted as the <param_name> parameter of clGetDeviceInfo. Return the
|
||||
* offset in nano-seconds between an event timestamp and Epoch.
|
||||
*/
|
||||
int CL_DEVICE_PROFILING_TIMER_OFFSET_AMD = 0x4036;
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
|
||||
|
||||
@CLDeviceExtension
|
||||
public interface AMD_fp64 {
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
|
||||
|
||||
@CLDeviceExtension
|
||||
public interface AMD_media_ops {
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
|
||||
|
||||
@CLDeviceExtension
|
||||
public interface AMD_printf {
|
||||
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
|
||||
import org.lwjgl.util.generator.opencl.cl_char;
|
||||
import org.lwjgl.util.generator.opencl.cl_void;
|
||||
import org.lwjgl.util.generator.opencl.size_t;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
@Private
|
||||
@CLDeviceExtension
|
||||
public interface APPLE_ContextLoggingFunctions {
|
||||
|
||||
@Extern
|
||||
void clLogMessagesToSystemLogAPPLE(@Check @Const @cl_char ByteBuffer errstr,
|
||||
@Const @cl_void ByteBuffer private_info,
|
||||
@AutoSize("private_info") @size_t long cb,
|
||||
@Check @cl_void ByteBuffer user_data);
|
||||
|
||||
@Extern
|
||||
void clLogMessagesToStdoutAPPLE(@Check @Const @cl_char ByteBuffer errstr,
|
||||
@Const @cl_void ByteBuffer private_info,
|
||||
@AutoSize("private_info") @size_t long cb,
|
||||
@Check @cl_void ByteBuffer user_data);
|
||||
|
||||
@Extern
|
||||
void clLogMessagesToStderrAPPLE(@Check @Const @cl_char ByteBuffer errstr,
|
||||
@Const @cl_void ByteBuffer private_info,
|
||||
@AutoSize("private_info") @size_t long cb,
|
||||
@Check @cl_void ByteBuffer user_data);
|
||||
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.Code;
|
||||
import org.lwjgl.util.generator.Constant;
|
||||
import org.lwjgl.util.generator.PointerWrapper;
|
||||
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
|
||||
import org.lwjgl.util.generator.opencl.cl_int;
|
||||
|
||||
@CLDeviceExtension
|
||||
public interface APPLE_SetMemObjectDestructor {
|
||||
|
||||
@Code(
|
||||
tryBlock = true,
|
||||
// Create a GlobalRef to the callback object.
|
||||
javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);",
|
||||
// Check if we need to delete the GlobalRef.
|
||||
javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);"
|
||||
)
|
||||
@cl_int
|
||||
int clSetMemObjectDestructorAPPLE(@PointerWrapper("cl_mem") CLMem memobj,
|
||||
@PointerWrapper("cl_mem_object_destructor_callback") CLMemObjectDestructorCallback pfn_notify,
|
||||
@Constant("user_data") @PointerWrapper("void *") long user_data);
|
||||
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
|
||||
import org.lwjgl.util.generator.opencl.cl_int;
|
||||
import org.lwjgl.util.generator.opencl.cl_void;
|
||||
import org.lwjgl.util.generator.opencl.size_t;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
@CLDeviceExtension
|
||||
@Extension(postfix = "APPLE", className = "APPLEGLSharing")
|
||||
public interface APPLE_gl_sharing {
|
||||
|
||||
/**
|
||||
* This enumerated value can be specified as part of the <properties> argument passed to clCreateContext
|
||||
* to allow OpenCL compliant devices in an existing CGL share group to be used as the devices in
|
||||
* the newly created CL context. GL objects that were allocated in the given CGL share group can
|
||||
* now be shared between CL and GL.
|
||||
*/
|
||||
int CL_CONTEXT_PROPERTY_USE_CGL_SHAREGROUP_APPLE = 0x10000000;
|
||||
|
||||
/**
|
||||
* Returns a cl_device_id for the CL device associated with the virtual screen for
|
||||
* the given CGL context. Return type: cl_device_id
|
||||
*/
|
||||
int CL_CGL_DEVICE_FOR_CURRENT_VIRTUAL_SCREEN_APPLE = 0x10000002;
|
||||
|
||||
/**
|
||||
* Returns an array of cl_device_ids for the CL device(s) corresponding to
|
||||
* the virtual screen(s) for the given CGL context. Return type: cl_device_id[]
|
||||
*/
|
||||
int CL_CGL_DEVICES_FOR_SUPPORTED_VIRTUAL_SCREENS_APPLE = 0x10000003;
|
||||
|
||||
/** Error code returned by clGetGLContextInfoAPPLE if an invalid platform_gl_ctx is provided */
|
||||
int CL_INVALID_GL_CONTEXT_APPLE = -1000;
|
||||
|
||||
@cl_int
|
||||
int clGetGLContextInfoAPPLE(@PointerWrapper("cl_context") CLContext context,
|
||||
@Check("1") @NativeType("cl_void") PointerBuffer platform_gl_ctx,
|
||||
@NativeType("cl_gl_platform_info") int param_name,
|
||||
@AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size,
|
||||
@OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret);
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,138 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opencl.cl_int;
|
||||
import org.lwjgl.util.generator.opencl.cl_uint;
|
||||
import org.lwjgl.util.generator.opencl.cl_void;
|
||||
import org.lwjgl.util.generator.opencl.size_t;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
/** The core OpenCL 1.0 OpenGL interrop functionality. */
|
||||
public interface CL10GL {
|
||||
|
||||
/** cl_gl_object_type */
|
||||
int CL_GL_OBJECT_BUFFER = 0x2000,
|
||||
CL_GL_OBJECT_TEXTURE2D = 0x2001,
|
||||
CL_GL_OBJECT_TEXTURE3D = 0x2002,
|
||||
CL_GL_OBJECT_RENDERBUFFER = 0x2003;
|
||||
|
||||
/** cl_gl_texture_info */
|
||||
int CL_GL_TEXTURE_TARGET = 0x2004,
|
||||
CL_GL_MIPMAP_LEVEL = 0x2005;
|
||||
|
||||
@Check(value = "errcode_ret", canBeNull = true)
|
||||
@PointerWrapper(value = "cl_mem", params = "context")
|
||||
CLMem clCreateFromGLBuffer(@PointerWrapper("cl_context") CLContext context,
|
||||
@NativeType("cl_mem_flags") long flags,
|
||||
@NativeType("GLuint") int bufobj,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret);
|
||||
|
||||
@Check(value = "errcode_ret", canBeNull = true)
|
||||
@PointerWrapper(value = "cl_mem", params = "context")
|
||||
CLMem clCreateFromGLTexture2D(@PointerWrapper("cl_context") CLContext context,
|
||||
@NativeType("cl_mem_flags") long flags,
|
||||
@NativeType("GLenum") int target,
|
||||
@NativeType("GLint") int miplevel,
|
||||
@NativeType("GLuint") int texture,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret);
|
||||
|
||||
@Check(value = "errcode_ret", canBeNull = true)
|
||||
@PointerWrapper(value = "cl_mem", params = "context")
|
||||
CLMem clCreateFromGLTexture3D(@PointerWrapper("cl_context") CLContext context,
|
||||
@NativeType("cl_mem_flags") long flags,
|
||||
@NativeType("GLenum") int target,
|
||||
@NativeType("GLint") int miplevel,
|
||||
@NativeType("GLuint") int texture,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret);
|
||||
|
||||
@Check(value = "errcode_ret", canBeNull = true)
|
||||
@PointerWrapper(value = "cl_mem", params = "context")
|
||||
CLMem clCreateFromGLRenderbuffer(@PointerWrapper("cl_context") CLContext context,
|
||||
@NativeType("cl_mem_flags") long flags,
|
||||
@NativeType("GLuint") int renderbuffer,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret);
|
||||
|
||||
@cl_int
|
||||
int clGetGLObjectInfo(@PointerWrapper("cl_mem") CLMem memobj,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_gl_object_type") IntBuffer gl_object_type,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @NativeType("GLuint") IntBuffer gl_object_name);
|
||||
|
||||
@cl_int
|
||||
int clGetGLTextureInfo(@PointerWrapper("cl_mem") CLMem memobj,
|
||||
@NativeType("cl_gl_texture_info") int param_name,
|
||||
@AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size,
|
||||
@OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret);
|
||||
|
||||
@Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) command_queue.registerCLEvent(event);")
|
||||
@cl_int
|
||||
int clEnqueueAcquireGLObjects(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue,
|
||||
@AutoSize("mem_objects") @cl_uint int num_objects,
|
||||
@Check("1") @Const @NativeType("cl_mem") PointerBuffer mem_objects,
|
||||
@AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list,
|
||||
@Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event);
|
||||
|
||||
@Alternate("clEnqueueAcquireGLObjects")
|
||||
@Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) command_queue.registerCLEvent(event);")
|
||||
@cl_int
|
||||
int clEnqueueAcquireGLObjects(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue,
|
||||
@Constant("1") @cl_uint int num_objects,
|
||||
@Constant(value = "APIUtil.getBufferPointer().put(0, mem_object).getBuffer(), 0", keepParam = true) CLMem mem_object,
|
||||
@AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list,
|
||||
@Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event);
|
||||
|
||||
@Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) command_queue.registerCLEvent(event);")
|
||||
@cl_int
|
||||
int clEnqueueReleaseGLObjects(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue,
|
||||
@AutoSize("mem_objects") @cl_uint int num_objects,
|
||||
@Check("1") @Const @NativeType("cl_mem") PointerBuffer mem_objects,
|
||||
@AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list,
|
||||
@Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event);
|
||||
|
||||
@Alternate("clEnqueueReleaseGLObjects")
|
||||
@Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) command_queue.registerCLEvent(event);")
|
||||
@cl_int
|
||||
int clEnqueueReleaseGLObjects(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue,
|
||||
@Constant("1") @cl_uint int num_objects,
|
||||
@Constant(value = "APIUtil.getBufferPointer().put(0, mem_object).getBuffer(), 0", keepParam = true) CLMem mem_object,
|
||||
@AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list,
|
||||
@Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event);
|
||||
}
|
|
@ -0,0 +1,203 @@
|
|||
/*
|
||||
* 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opencl.*;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
/** The core OpenCL 1.1 API */
|
||||
public interface CL11 {
|
||||
|
||||
/** Error Codes */
|
||||
int CL_MISALIGNED_SUB_BUFFER_OFFSET = -13,
|
||||
CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST = -14,
|
||||
CL_INVALID_PROPERTY = -64;
|
||||
|
||||
/** OpenCL Version */
|
||||
int CL_VERSION_1_1 = 1;
|
||||
|
||||
/** cl_device_info */
|
||||
int CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF = 0x1034,
|
||||
CL_DEVICE_HOST_UNIFIED_MEMORY = 0x1035,
|
||||
CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR = 0x1036,
|
||||
CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT = 0x1037,
|
||||
CL_DEVICE_NATIVE_VECTOR_WIDTH_INT = 0x1038,
|
||||
CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG = 0x1039,
|
||||
CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT = 0x103A,
|
||||
CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE = 0x103B,
|
||||
CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF = 0x103C,
|
||||
CL_DEVICE_OPENCL_C_VERSION = 0x103D;
|
||||
|
||||
/** cl_device_fp_config - bitfield */
|
||||
int CL_FP_SOFT_FLOAT = (1 << 6);
|
||||
|
||||
/** cl_context_info */
|
||||
int CL_CONTEXT_NUM_DEVICES = 0x1083;
|
||||
|
||||
/** cl_channel_order */
|
||||
int CL_Rx = 0x10BA,
|
||||
CL_RGx = 0x10BB,
|
||||
CL_RGBx = 0x10BC;
|
||||
|
||||
/** cl_mem_info */
|
||||
int CL_MEM_ASSOCIATED_MEMOBJECT = 0x1107,
|
||||
CL_MEM_OFFSET = 0x1108;
|
||||
|
||||
/** cl_addressing_mode */
|
||||
int CL_ADDRESS_MIRRORED_REPEAT = 0x1134;
|
||||
|
||||
/** cl_kernel_work_group_info */
|
||||
int CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE = 0x11B3,
|
||||
CL_KERNEL_PRIVATE_MEM_SIZE = 0x11B4;
|
||||
|
||||
/** cl_event_info */
|
||||
int CL_EVENT_CONTEXT = 0x11D4;
|
||||
|
||||
/** cl_command_type */
|
||||
int CL_COMMAND_READ_BUFFER_RECT = 0x1201,
|
||||
CL_COMMAND_WRITE_BUFFER_RECT = 0x1202,
|
||||
CL_COMMAND_COPY_BUFFER_RECT = 0x1203,
|
||||
CL_COMMAND_USER = 0x1204;
|
||||
|
||||
/** cl_buffer_create_type */
|
||||
int CL_BUFFER_CREATE_TYPE_REGION = 0x1220;
|
||||
|
||||
@Check(value = "errcode_ret", canBeNull = true)
|
||||
@PointerWrapper(value = "cl_mem", factory = "CLMem.create", params = "buffer.getParent()")
|
||||
CLMem clCreateSubBuffer(@PointerWrapper("cl_mem") CLMem buffer,
|
||||
@NativeType("cl_mem_flags") long flags,
|
||||
@NativeType("cl_buffer_create_type") int buffer_create_type,
|
||||
@Const @Check("2 * PointerBuffer.getPointerSize()") @NativeType("cl_void") ByteBuffer buffer_create_info,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret);
|
||||
|
||||
@Code(
|
||||
tryBlock = true,
|
||||
// Create a GlobalRef to the callback object.
|
||||
javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);",
|
||||
// Check if we need to delete the GlobalRef.
|
||||
javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);"
|
||||
)
|
||||
@cl_int
|
||||
int clSetMemObjectDestructorCallback(@PointerWrapper("cl_mem") CLMem memobj,
|
||||
@PointerWrapper("cl_mem_object_destructor_callback") CLMemObjectDestructorCallback pfn_notify,
|
||||
@Constant("user_data") @PointerWrapper("void *") long user_data);
|
||||
|
||||
@Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) command_queue.registerCLEvent(event);")
|
||||
@cl_int
|
||||
int clEnqueueReadBufferRect(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue,
|
||||
@PointerWrapper("cl_mem") CLMem buffer,
|
||||
@cl_bool int blocking_read,
|
||||
@Const @Check("3") @NativeType("size_t") PointerBuffer buffer_origin,
|
||||
@Const @Check("3") @NativeType("size_t") PointerBuffer host_origin,
|
||||
@Const @Check("3") @NativeType("size_t") PointerBuffer region,
|
||||
@size_t long buffer_row_pitch,
|
||||
@size_t long buffer_slice_pitch,
|
||||
@size_t long host_row_pitch,
|
||||
@size_t long host_slice_pitch,
|
||||
@OutParameter @Check("CLChecks.calculateBufferRectSize(host_origin, region, host_row_pitch, host_slice_pitch)")
|
||||
@cl_byte
|
||||
@cl_short
|
||||
@cl_int
|
||||
@cl_long
|
||||
@cl_float
|
||||
@cl_double Buffer ptr,
|
||||
@AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list,
|
||||
@Const @Check(canBeNull = true) @NativeType("cl_event") PointerBuffer event_wait_list,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event);
|
||||
|
||||
@Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) command_queue.registerCLEvent(event);")
|
||||
@cl_int
|
||||
int clEnqueueWriteBufferRect(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue,
|
||||
@PointerWrapper("cl_mem") CLMem buffer,
|
||||
@cl_bool int blocking_write,
|
||||
@Const @Check("3") @NativeType("size_t") PointerBuffer buffer_origin,
|
||||
@Const @Check("3") @NativeType("size_t") PointerBuffer host_origin,
|
||||
@Const @Check("3") @NativeType("size_t") PointerBuffer region,
|
||||
@size_t long buffer_row_pitch,
|
||||
@size_t long buffer_slice_pitch,
|
||||
@size_t long host_row_pitch,
|
||||
@size_t long host_slice_pitch,
|
||||
@Const @Check("CLChecks.calculateBufferRectSize(host_origin, region, host_row_pitch, host_slice_pitch)")
|
||||
@cl_byte
|
||||
@cl_short
|
||||
@cl_int
|
||||
@cl_long
|
||||
@cl_float
|
||||
@cl_double Buffer ptr,
|
||||
@AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list,
|
||||
@Const @Check(canBeNull = true) @NativeType("cl_event") PointerBuffer event_wait_list,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event);
|
||||
|
||||
@Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) command_queue.registerCLEvent(event);")
|
||||
@cl_int
|
||||
int clEnqueueCopyBufferRect(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue,
|
||||
@PointerWrapper("cl_mem") CLMem src_buffer,
|
||||
@PointerWrapper("cl_mem") CLMem dst_buffer,
|
||||
@Const @Check("3") @NativeType("size_t") PointerBuffer src_origin,
|
||||
@Const @Check("3") @NativeType("size_t") PointerBuffer dst_origin,
|
||||
@Const @Check("3") @NativeType("size_t") PointerBuffer region,
|
||||
@size_t long src_row_pitch,
|
||||
@size_t long src_slice_pitch,
|
||||
@size_t long dst_row_pitch,
|
||||
@size_t long dst_slice_pitch,
|
||||
@AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list,
|
||||
@Const @Check(canBeNull = true) @NativeType("cl_event") PointerBuffer event_wait_list,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event);
|
||||
|
||||
@Check(value = "errcode_ret", canBeNull = true)
|
||||
@PointerWrapper(value = "cl_event", params = "context")
|
||||
CLEvent clCreateUserEvent(@PointerWrapper("cl_context") CLContext context,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret);
|
||||
|
||||
@cl_int
|
||||
int clSetUserEventStatus(@PointerWrapper("cl_event") CLEvent event,
|
||||
@cl_int int execution_status);
|
||||
|
||||
@Code(
|
||||
tryBlock = true,
|
||||
// Create a GlobalRef to the callback object.
|
||||
javaBeforeNative = "\t\tlong user_data = CallbackUtil.createGlobalRef(pfn_notify);",
|
||||
// Check if we need to delete the GlobalRef.
|
||||
javaFinally = "\t\t\tCallbackUtil.checkCallback(__result, user_data);"
|
||||
)
|
||||
@cl_int
|
||||
int clSetEventCallback(@PointerWrapper("cl_event") CLEvent event,
|
||||
@cl_int int command_exec_callback_type,
|
||||
@PointerWrapper("cl_event_callback") CLEventCallback pfn_notify,
|
||||
@Constant("user_data") @PointerWrapper("void *") long user_data);
|
||||
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
|
||||
import org.lwjgl.util.generator.opencl.cl_int;
|
||||
import org.lwjgl.util.generator.opencl.cl_uint;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.LongBuffer;
|
||||
|
||||
@CLDeviceExtension
|
||||
public interface EXT_device_fission {
|
||||
|
||||
/**
|
||||
* Accepted as a property name in the <properties> parameter of
|
||||
* clCreateSubDeviceEXT:
|
||||
*/
|
||||
int CL_DEVICE_PARTITION_EQUALLY_EXT = 0x4050,
|
||||
CL_DEVICE_PARTITION_BY_COUNTS_EXT = 0x4051,
|
||||
CL_DEVICE_PARTITION_BY_NAMES_EXT = 0x4052,
|
||||
CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN_EXT = 0x4053;
|
||||
|
||||
/**
|
||||
* Accepted as a property name, when accompanying the
|
||||
* CL_DEVICE_PARITION_BY_AFFINITY_DOMAIN_EXT property, in the <properties>
|
||||
* parameter of clCreateSubDeviceEXT:
|
||||
*/
|
||||
int CL_AFFINITY_DOMAIN_L1_CACHE_EXT = 0x1,
|
||||
CL_AFFINITY_DOMAIN_L2_CACHE_EXT = 0x2,
|
||||
CL_AFFINITY_DOMAIN_L3_CACHE_EXT = 0x3,
|
||||
CL_AFFINITY_DOMAIN_L4_CACHE_EXT = 0x4,
|
||||
CL_AFFINITY_DOMAIN_NUMA_EXT = 0x10,
|
||||
CL_AFFINITY_DOMAIN_NEXT_FISSIONABLE_EXT = 0x100;
|
||||
|
||||
/**
|
||||
* Accepted as a property being queried in the <param_name> argument of
|
||||
* clGetDeviceInfo:
|
||||
*/
|
||||
int CL_DEVICE_PARENT_DEVICE_EXT = 0x4054,
|
||||
CL_DEVICE_PARITION_TYPES_EXT = 0x4055,
|
||||
CL_DEVICE_AFFINITY_DOMAINS_EXT = 0x4056,
|
||||
CL_DEVICE_REFERENCE_COUNT_EXT = 0x4057,
|
||||
CL_DEVICE_PARTITION_STYLE_EXT = 0x4058;
|
||||
|
||||
/**
|
||||
* Accepted as the property list terminator in the <properties> parameter of
|
||||
* clCreateSubDeviceEXT:
|
||||
*/
|
||||
int CL_PROPERTIES_LIST_END_EXT = 0x0;
|
||||
|
||||
/**
|
||||
* Accepted as the partition counts list terminator in the <properties>
|
||||
* parameter of clCreateSubDeviceEXT:
|
||||
*/
|
||||
int CL_PARTITION_BY_COUNTS_LIST_END_EXT = 0x0;
|
||||
|
||||
/**
|
||||
* Accepted as the partition names list terminator in the <properties>
|
||||
* parameter of clCreateSubDeviceEXT:
|
||||
*/
|
||||
int CL_PARTITION_BY_NAMES_LIST_END_EXT = -1;
|
||||
|
||||
/**
|
||||
* Returned by clCreateSubDevicesEXT when the indicated partition scheme is
|
||||
* supported by the implementation, but the implementation can not further
|
||||
* partition the device in this way.
|
||||
*/
|
||||
int CL_DEVICE_PARTITION_FAILED_EXT = -1057;
|
||||
|
||||
/**
|
||||
* Returned by clCreateSubDevicesEXT when the total number of compute units
|
||||
* requested exceeds CL_DEVICE_MAX_COMPUTE_UNITS, or the number of compute
|
||||
* units for any one sub-device is less than 1.
|
||||
*/
|
||||
int CL_INVALID_PARTITION_COUNT_EXT = -1058;
|
||||
|
||||
/**
|
||||
* Returned by clCreateSubDevicesEXT when a compute unit name appearing in a
|
||||
* name list following CL_DEVICE_PARTITION_BY_NAMES_EXT is not in range.
|
||||
*/
|
||||
int CL_INVALID_PARTITION_NAME_EXT = -1059;
|
||||
|
||||
@Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) device.retain();")
|
||||
@cl_int
|
||||
int clRetainDeviceEXT(@PointerWrapper("cl_device_id") CLDevice device);
|
||||
|
||||
/**
|
||||
* Warning: LWJGL will not automatically release any objects associated with sub-devices.
|
||||
* The user is responsible for tracking and releasing everything prior to calling this method.
|
||||
*
|
||||
* @param device the parent CLDevice
|
||||
*
|
||||
* @return the error code
|
||||
*/
|
||||
@Code(
|
||||
javaBeforeNative = "\t\tAPIUtil.releaseObjects(device);",
|
||||
javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) device.release();"
|
||||
)
|
||||
@cl_int
|
||||
int clReleaseDeviceEXT(@PointerWrapper("cl_device_id") CLDevice device);
|
||||
|
||||
@Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS && out_devices != null ) in_device.registerSubCLDevices(out_devices);")
|
||||
@cl_int
|
||||
int clCreateSubDevicesEXT(
|
||||
@PointerWrapper("cl_device_id") CLDevice in_device,
|
||||
// TODO: cl_device_partition_property_ext is a cl_bitfield (ulong), but the spec says properties is a {property-value, cl_int[]} list...
|
||||
@NullTerminated @Const @NativeType("cl_device_partition_property_ext") LongBuffer properties,
|
||||
@AutoSize(value = "out_devices", canBeNull = true) @cl_uint int num_entries,
|
||||
@OutParameter @Check(canBeNull = true) @NativeType("cl_device_id") PointerBuffer out_devices,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @cl_uint IntBuffer num_devices);
|
||||
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
|
||||
import org.lwjgl.util.generator.opencl.cl_bitfield;
|
||||
import org.lwjgl.util.generator.opencl.cl_int;
|
||||
import org.lwjgl.util.generator.opencl.cl_uint;
|
||||
|
||||
@CLDeviceExtension
|
||||
public interface EXT_migrate_memobject {
|
||||
|
||||
/**
|
||||
* Besides a value of zero, the following cl_mem_migration_flags_ext values are
|
||||
* allowed:
|
||||
*/
|
||||
int CL_MIGRATE_MEM_OBJECT_HOST_EXT = 0x1;
|
||||
|
||||
/**
|
||||
* Returned in the <param_value> parameter of the clGetEventInfo when
|
||||
* <param_name> is CL_EVENT_COMMAND_TYPE:
|
||||
*/
|
||||
int CL_COMMAND_MIGRATE_MEM_OBJECT_EXT = 0x4040;
|
||||
|
||||
@Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) command_queue.registerCLEvent(event);")
|
||||
@cl_int
|
||||
int clEnqueueMigrateMemObjectEXT(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue,
|
||||
@AutoSize("mem_objects") @cl_uint int num_mem_objects,
|
||||
@Check("1") @Const @NativeType("cl_mem") PointerBuffer mem_objects,
|
||||
@cl_bitfield @NativeType("cl_mem_migration_flags_ext") long flags,
|
||||
@AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list,
|
||||
@Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event);
|
||||
|
||||
@Alternate("clEnqueueMigrateMemObjectEXT")
|
||||
@Code(javaAfterNative = "\t\tif ( __result == CL10.CL_SUCCESS ) command_queue.registerCLEvent(event);")
|
||||
@cl_int
|
||||
int clEnqueueMigrateMemObjectEXT(@PointerWrapper("cl_command_queue") CLCommandQueue command_queue,
|
||||
@Constant("1") @cl_uint int num_mem_objects,
|
||||
@Constant(value = "APIUtil.getBufferPointer().put(0, mem_object).getBuffer(), 0", keepParam = true) CLMem mem_object,
|
||||
@cl_bitfield @NativeType("cl_mem_migration_flags_ext") long flags,
|
||||
@AutoSize(value = "event_wait_list", canBeNull = true) @cl_uint int num_events_in_wait_list,
|
||||
@Check(canBeNull = true) @Const @NativeType("cl_event") PointerBuffer event_wait_list,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @NativeType("cl_event") PointerBuffer event);
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
|
||||
|
||||
@CLDeviceExtension
|
||||
public interface KHR_3d_image_writes {
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
|
||||
|
||||
@CLDeviceExtension
|
||||
public interface KHR_byte_addressable_store {
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
|
||||
|
||||
@CLDeviceExtension
|
||||
public interface KHR_fp16 {
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
|
||||
|
||||
@CLDeviceExtension
|
||||
public interface KHR_fp64 {
|
||||
|
||||
/** cl_device_info */
|
||||
int CL_DEVICE_DOUBLE_FP_CONFIG = 0x1032;
|
||||
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.opengl.GLSync;
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
|
||||
import org.lwjgl.util.generator.opencl.CLPlatformExtension;
|
||||
import org.lwjgl.util.generator.opencl.cl_int;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
@Imports("org.lwjgl.opengl.GLSync")
|
||||
@CLPlatformExtension
|
||||
@CLDeviceExtension
|
||||
@Extension(postfix = "KHR", className = "KHRGLEvent")
|
||||
public interface KHR_gl_event {
|
||||
|
||||
/** Returned by clGetEventInfo when param_name is CL_EVENT_COMMAND_TYPE: */
|
||||
int CL_COMMAND_GL_FENCE_SYNC_OBJECT_KHR = 0x200D;
|
||||
|
||||
@Check(value = "errcode_ret", canBeNull = true)
|
||||
@PointerWrapper(value = "cl_event", params = "context")
|
||||
CLEvent clCreateEventFromGLsyncKHR(@PointerWrapper("cl_context") CLContext context,
|
||||
@PointerWrapper("cl_GLsync") GLSync sync,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @cl_int IntBuffer errcode_ret);
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opencl.*;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
@CLPlatformExtension
|
||||
@CLDeviceExtension
|
||||
@Extension(postfix = "KHR", className = "KHRGLSharing")
|
||||
public interface KHR_gl_sharing {
|
||||
|
||||
/**
|
||||
* Returned by clCreateContext, clCreateContextFromType, and
|
||||
* clGetGLContextInfoKHR when an invalid OpenGL context or share group
|
||||
* object handle is specified in <properties>:
|
||||
*/
|
||||
int CL_INVALID_GL_SHAREGROUP_REFERENCE_KHR = -1000;
|
||||
|
||||
/** Accepted as the <param_name> argument of clGetGLContextInfoKHR: */
|
||||
int CL_CURRENT_DEVICE_FOR_GL_CONTEXT_KHR = 0x2006,
|
||||
CL_DEVICES_FOR_GL_CONTEXT_KHR = 0x2007;
|
||||
|
||||
/**
|
||||
* Accepted as an attribute name in the 'properties' argument of
|
||||
* clCreateContext and clCreateContextFromType:
|
||||
*/
|
||||
int CL_GL_CONTEXT_KHR = 0x2008,
|
||||
CL_EGL_DISPLAY_KHR = 0x2009,
|
||||
CL_GLX_DISPLAY_KHR = 0x200A,
|
||||
CL_WGL_HDC_KHR = 0x200B,
|
||||
CL_CGL_SHAREGROUP_KHR = 0x200C;
|
||||
|
||||
@cl_int
|
||||
int clGetGLContextInfoKHR(@NullTerminated @Const @NativeType("cl_context_properties") PointerBuffer properties,
|
||||
@NativeType("cl_gl_context_info") int param_name,
|
||||
@AutoSize(value = "param_value", canBeNull = true) @size_t long param_value_size,
|
||||
@OutParameter @Check(canBeNull = true) @cl_void ByteBuffer param_value,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @NativeType("size_t") PointerBuffer param_value_size_ret);
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
|
||||
|
||||
@CLDeviceExtension
|
||||
public interface KHR_global_int32_base_atomics {
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
|
||||
|
||||
@CLDeviceExtension
|
||||
public interface KHR_global_int32_extended_atomics {
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.PointerBuffer;
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opencl.CLPlatformExtension;
|
||||
import org.lwjgl.util.generator.opencl.cl_int;
|
||||
import org.lwjgl.util.generator.opencl.cl_uint;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
@CLPlatformExtension
|
||||
@Extension(postfix = "KHR", className = "KHRICD")
|
||||
public interface KHR_icd {
|
||||
|
||||
/** Accepted as <param_name> to the function clGetPlatformInfo */
|
||||
int CL_PLATFORM_ICD_SUFFIX_KHR = 0x0920;
|
||||
|
||||
/** Returned by clGetPlatformIDs when no platforms are found */
|
||||
int CL_PLATFORM_NOT_FOUND_KHR = -1001;
|
||||
|
||||
@cl_int
|
||||
int clIcdGetPlatformIDsKHR(@AutoSize(value = "platforms", canBeNull = true) @cl_uint int num_entries,
|
||||
@OutParameter @Check(canBeNull = true) @NativeType("cl_platform_id") PointerBuffer platforms,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @cl_uint IntBuffer num_platforms);
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
|
||||
|
||||
@CLDeviceExtension
|
||||
public interface KHR_int64_base_atomics {
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
|
||||
|
||||
@CLDeviceExtension
|
||||
public interface KHR_int64_extended_atomics {
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
|
||||
|
||||
@CLDeviceExtension
|
||||
public interface KHR_local_int32_base_atomics {
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Copyright (c) 2002-2010 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.opencl;
|
||||
|
||||
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
|
||||
|
||||
@CLDeviceExtension
|
||||
public interface KHR_local_int32_extended_atomics {
|
||||
|
||||
}
|
|
@ -32,6 +32,10 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.PointerWrapper;
|
||||
import org.lwjgl.util.generator.Alias;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
@ -77,15 +81,16 @@ public interface AMD_debug_output {
|
|||
* The {@code AMDDebugOutputCallback.Handler} implementation passed to this method will be used for
|
||||
* AMD_debug_output messages. If callback is null, any previously registered handler for the current
|
||||
* thread will be unregistered and stop receiving messages.
|
||||
* <p/>
|
||||
* The userParam buffer will be passed to the GL, but the current implementation will ignore it and
|
||||
* never return it to the handler. Instead, users are encouraged to use a custom callback handler
|
||||
* implentation to store context-specific data.
|
||||
*
|
||||
* @param callback the callback function to use
|
||||
* @param userParam the user-specified data
|
||||
*/
|
||||
void glDebugMessageCallbackAMD(@GLpointer(value = "GLDEBUGPROCAMD", canBeNull = true) AMDDebugOutputCallback callback, @Check(canBeNull = true) @GLvoid ByteBuffer userParam);
|
||||
@Code(
|
||||
// Create a GlobalRef to the callback object and register it with the current context.
|
||||
javaBeforeNative = "\t\tlong userParam = callback == null ? 0 : CallbackUtil.createGlobalRef(callback.getHandler());\n" +
|
||||
"\t\tCallbackUtil.registerContextCallbackAMD(userParam);"
|
||||
)
|
||||
void glDebugMessageCallbackAMD(@PointerWrapper(value = "GLDEBUGPROCAMD", canBeNull = true) AMDDebugOutputCallback callback,
|
||||
@Constant("userParam") @PointerWrapper("GLvoid *") long userParam);
|
||||
|
||||
@GLuint
|
||||
int glGetDebugMessageLogAMD(@GLuint int count,
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.GLuint;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
public interface AMD_draw_buffers_blend {
|
||||
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLreturn;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
|
@ -53,7 +58,7 @@ public interface AMD_name_gen_delete {
|
|||
void glDeleteNamesAMD(@GLenum int identifier, @AutoSize("names") @GLsizei int num, @Const @GLuint IntBuffer names);
|
||||
|
||||
@Alternate("glDeleteNamesAMD")
|
||||
void glDeleteNamesAMD(@GLenum int identifier, @Constant("1") @GLsizei int num, @Constant(value = "APIUtils.getBufferInt().put(0, name), 0", keepParam = true) int name);
|
||||
void glDeleteNamesAMD(@GLenum int identifier, @Constant("1") @GLsizei int num, @Constant(value = "APIUtil.getBufferInt().put(0, name), 0", keepParam = true) int name);
|
||||
|
||||
boolean glIsNameAMD(@GLenum int identifier, @GLuint int name);
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
@ -98,12 +100,12 @@ public interface AMD_performance_monitor {
|
|||
void glDeletePerfMonitorsAMD(@AutoSize("monitors") @GLsizei int n, @GLuint IntBuffer monitors);
|
||||
|
||||
@Alternate("glDeletePerfMonitorsAMD")
|
||||
void glDeletePerfMonitorsAMD(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, monitor), 0", keepParam = true) int monitor);
|
||||
void glDeletePerfMonitorsAMD(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, monitor), 0", 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 = "APIUtils.getBufferInt().put(0, counter), 0", keepParam = true) int counter);
|
||||
void glSelectPerfMonitorCountersAMD(@GLuint int monitor, boolean enable, @GLuint int group, @Constant("1") int numCounters, @Constant(value = "APIUtil.getBufferInt().put(0, counter), 0", keepParam = true) int counter);
|
||||
|
||||
void glBeginPerfMonitorAMD(@GLuint int monitor);
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
|
||||
public interface AMD_vertex_shader_tessellator {
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLreturn;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
|
@ -50,7 +55,7 @@ public interface APPLE_fence {
|
|||
void glDeleteFencesAPPLE(@AutoSize("fences") @GLsizei int n, @Const @GLuint IntBuffer fences);
|
||||
|
||||
@Alternate("glDeleteFencesAPPLE")
|
||||
void glDeleteFencesAPPLE(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtils.getBufferInt().put(0, fence), 0", keepParam = true) int fence);
|
||||
void glDeleteFencesAPPLE(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtil.getBufferInt().put(0, fence), 0", keepParam = true) int fence);
|
||||
|
||||
void glSetFenceAPPLE(@GLuint int fence);
|
||||
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.GLintptr;
|
||||
import org.lwjgl.util.generator.GLsizeiptr;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLintptr;
|
||||
import org.lwjgl.util.generator.opengl.GLsizeiptr;
|
||||
|
||||
public interface APPLE_flush_buffer_range {
|
||||
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLreturn;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLvoid;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLreturn;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
|
@ -48,7 +52,7 @@ public interface APPLE_vertex_array_object {
|
|||
void glDeleteVertexArraysAPPLE(@AutoSize("arrays") @GLsizei int n, @Const @GLuint IntBuffer arrays);
|
||||
|
||||
@Alternate("glDeleteVertexArraysAPPLE")
|
||||
void glDeleteVertexArraysAPPLE(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtils.getBufferInt().put(0, array), 0", keepParam = true) int array);
|
||||
void glDeleteVertexArraysAPPLE(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtil.getBufferInt().put(0, array), 0", keepParam = true) int array);
|
||||
|
||||
void glGenVertexArraysAPPLE(@AutoSize("arrays") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays);
|
||||
|
||||
|
|
|
@ -32,9 +32,9 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.AutoSize;
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.GLsizei;
|
||||
import org.lwjgl.util.generator.GLvoid;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLvoid;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ package org.lwjgl.opengl;
|
|||
|
||||
import org.lwjgl.util.generator.Check;
|
||||
import org.lwjgl.util.generator.Const;
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.GLuint;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.DoubleBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
@ -64,17 +65,22 @@ public interface ARB_ES2_compatibility {
|
|||
GL_MEDIUM_INT = 0x8DF4,
|
||||
GL_HIGH_INT = 0x8DF5;
|
||||
|
||||
@Reuse("GL41")
|
||||
void glReleaseShaderCompiler();
|
||||
|
||||
@Reuse("GL41")
|
||||
void glShaderBinary(@AutoSize("shaders") @GLsizei int count, @Const @GLuint IntBuffer shaders,
|
||||
@GLenum int binaryformat, @Const @GLvoid ByteBuffer binary, @AutoSize("binary") @GLsizei int length);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glGetShaderPrecisionFormat(@GLenum int shadertype, @GLenum int precisiontype,
|
||||
@OutParameter @Check("2") IntBuffer range,
|
||||
@OutParameter @Check("1") IntBuffer precision);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glDepthRangef(@GLclampf float n, @GLclampf float f);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glClearDepthf(@GLclampf float d);
|
||||
|
||||
}
|
|
@ -32,6 +32,9 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLchar;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
@ -53,13 +56,17 @@ public interface ARB_blend_func_extended {
|
|||
*/
|
||||
int GL_MAX_DUAL_SOURCE_DRAW_BUFFERS = 0x88FC;
|
||||
|
||||
@Reuse("GL33")
|
||||
void glBindFragDataLocationIndexed(@GLuint int program, @GLuint int colorNumber, @GLuint int index, @NullTerminated @Const @GLchar ByteBuffer name);
|
||||
|
||||
@Reuse("GL33")
|
||||
@Alternate("glBindFragDataLocationIndexed")
|
||||
void glBindFragDataLocationIndexed(@GLuint int program, @GLuint int colorNumber, @GLuint int index, @NullTerminated CharSequence name);
|
||||
|
||||
@Reuse("GL33")
|
||||
int glGetFragDataIndex(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name);
|
||||
|
||||
@Reuse("GL33")
|
||||
@Alternate("glGetFragDataIndex")
|
||||
int glGetFragDataIndex(@GLuint int program, @NullTerminated CharSequence name);
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
|
@ -69,7 +71,7 @@ public interface ARB_buffer_object {
|
|||
void glDeleteBuffersARB(@AutoSize("buffers") @GLsizei int n, @Const @GLuint IntBuffer buffers);
|
||||
|
||||
@Alternate("glDeleteBuffersARB")
|
||||
void glDeleteBuffersARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer);
|
||||
void glDeleteBuffersARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer);
|
||||
|
||||
void glGenBuffersARB(@AutoSize("buffers") @GLsizei int n, @OutParameter @GLuint IntBuffer buffers);
|
||||
|
||||
|
@ -131,7 +133,7 @@ public interface ARB_buffer_object {
|
|||
*/
|
||||
@CachedResult
|
||||
@GLvoid
|
||||
@AutoResultSize("GLChecks.getBufferObjectSizeARB(caps, target)")
|
||||
@AutoSize("GLChecks.getBufferObjectSizeARB(caps, target)")
|
||||
ByteBuffer glMapBufferARB(@GLenum int target, @GLenum int access);
|
||||
|
||||
boolean glUnmapBufferARB(@GLenum int target);
|
||||
|
@ -145,6 +147,6 @@ public interface ARB_buffer_object {
|
|||
void glGetBufferParameterivARB2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params);
|
||||
|
||||
@StripPostfix("pointer")
|
||||
@AutoResultSize("GLChecks.getBufferObjectSizeARB(caps, target)")
|
||||
@AutoSize("GLChecks.getBufferObjectSizeARB(caps, target)")
|
||||
void glGetBufferPointervARB(@GLenum int target, @GLenum int pname, @Result @GLvoid ByteBuffer pointer);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* 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.opencl.CLContext;
|
||||
import org.lwjgl.opencl.CLEvent;
|
||||
import org.lwjgl.util.generator.Extension;
|
||||
import org.lwjgl.util.generator.Imports;
|
||||
import org.lwjgl.util.generator.PointerWrapper;
|
||||
import org.lwjgl.util.generator.opengl.GLbitfield;
|
||||
|
||||
@Imports("org.lwjgl.opencl.*")
|
||||
@Extension(postfix = "ARB", className = "ARBCLEvent")
|
||||
public interface ARB_cl_event {
|
||||
|
||||
/** Returned in <values> for GetSynciv <pname> OBJECT_TYPE. */
|
||||
int GL_SYNC_CL_EVENT_ARB = 0x8240;
|
||||
|
||||
/** Returned in <values> for GetSynciv <pname> SYNC_CONDITION. */
|
||||
int GL_SYNC_CL_EVENT_COMPLETE_ARB = 0x8241;
|
||||
|
||||
@PointerWrapper("GLsync")
|
||||
GLSync glCreateSyncFromCLeventARB(@PointerWrapper("cl_context") CLContext context, @PointerWrapper("cl_event") CLEvent event, @GLbitfield int flags);
|
||||
|
||||
}
|
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
|
||||
public interface ARB_color_buffer_float {
|
||||
|
||||
|
|
|
@ -31,9 +31,10 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.GLintptr;
|
||||
import org.lwjgl.util.generator.GLsizeiptr;
|
||||
import org.lwjgl.util.generator.Reuse;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLintptr;
|
||||
import org.lwjgl.util.generator.opengl.GLsizeiptr;
|
||||
|
||||
public interface ARB_copy_buffer {
|
||||
|
||||
|
@ -47,6 +48,7 @@ public interface ARB_copy_buffer {
|
|||
int GL_COPY_READ_BUFFER = 0x8F36;
|
||||
int GL_COPY_WRITE_BUFFER = 0x8F37;
|
||||
|
||||
@Reuse("GL31")
|
||||
void glCopyBufferSubData(@GLenum int readTarget, @GLenum int writeTarget,
|
||||
@GLintptr long readOffset, @GLintptr long writeOffset,
|
||||
@GLsizeiptr long size);
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLchar;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
@ -103,7 +107,20 @@ public interface ARB_debug_output {
|
|||
@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);
|
||||
/**
|
||||
* The {@code ARBDebugOutputCallback.Handler} implementation passed to this method will be used for
|
||||
* ARB_debug_output messages. If callback is null, any previously registered handler for the current
|
||||
* thread will be unregistered and stop receiving messages.
|
||||
*
|
||||
* @param callback the callback function to use
|
||||
*/
|
||||
@Code(
|
||||
// Create a GlobalRef to the callback object and register it with the current context.
|
||||
javaBeforeNative = "\t\tlong userParam = callback == null ? 0 : CallbackUtil.createGlobalRef(callback.getHandler());\n" +
|
||||
"\t\tCallbackUtil.registerContextCallbackARB(userParam);"
|
||||
)
|
||||
void glDebugMessageCallbackARB(@PointerWrapper(value = "GLDEBUGPROCARB", canBeNull = true) ARBDebugOutputCallback callback,
|
||||
@Constant("userParam") @PointerWrapper("GLvoid *") long userParam);
|
||||
|
||||
@GLuint
|
||||
int glGetDebugMessageLogARB(@GLuint int count,
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
@ -62,5 +65,5 @@ public interface ARB_draw_buffers {
|
|||
void glDrawBuffersARB(@AutoSize("buffers") @GLsizei int size, @Const @GLenum IntBuffer buffers);
|
||||
|
||||
@Alternate("glDrawBuffersARB")
|
||||
void glDrawBuffersARB(@Constant("1") @GLsizei int size, @Constant(value = "APIUtils.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer);
|
||||
void glDrawBuffersARB(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer);
|
||||
}
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.GLuint;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
public interface ARB_draw_buffers_blend {
|
||||
|
||||
|
|
|
@ -32,11 +32,13 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.Buffer;
|
||||
|
||||
public interface ARB_draw_elements_base_vertex {
|
||||
|
||||
@Reuse("GL32")
|
||||
void glDrawElementsBaseVertex(@GLenum int mode, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type,
|
||||
@BufferObject(BufferKind.ElementVBO)
|
||||
@Const
|
||||
|
@ -44,6 +46,7 @@ public interface ARB_draw_elements_base_vertex {
|
|||
@GLushort
|
||||
@GLuint Buffer indices, int basevertex);
|
||||
|
||||
@Reuse("GL32")
|
||||
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
|
||||
|
@ -51,6 +54,7 @@ public interface ARB_draw_elements_base_vertex {
|
|||
@GLushort
|
||||
@GLuint Buffer indices, int basevertex);
|
||||
|
||||
@Reuse("GL32")
|
||||
void glDrawElementsInstancedBaseVertex(@GLenum int mode, @AutoSize("indices") @GLsizei int count, @AutoType("indices") @GLenum int type,
|
||||
@BufferObject(BufferKind.ElementVBO)
|
||||
@Const
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLvoid;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
|
@ -54,8 +56,10 @@ public interface ARB_draw_indirect {
|
|||
*/
|
||||
int GL_DRAW_INDIRECT_BUFFER_BINDING = 0x8F43;
|
||||
|
||||
@Reuse("GL40")
|
||||
void glDrawArraysIndirect(@GLenum int mode, @BufferObject(BufferKind.IndirectBO) @Check("4") @NullTerminated @Const @GLvoid(PrimitiveType.Kind.INT) IntBuffer indirect);
|
||||
|
||||
@Reuse("GL40")
|
||||
void glDrawElementsIndirect(@GLenum int mode, @GLenum int type, @BufferObject(BufferKind.IndirectBO) @Check("5") @NullTerminated @Const @GLvoid(PrimitiveType.Kind.INT) IntBuffer indirect);
|
||||
|
||||
}
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.Buffer;
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
|
@ -184,84 +186,110 @@ public interface ARB_framebuffer_object {
|
|||
/** Accepted by the <value> parameter of GetTexLevelParameter: */
|
||||
int GL_TEXTURE_STENCIL_SIZE = 0x88F1;
|
||||
|
||||
@Reuse("GL30")
|
||||
boolean glIsRenderbuffer(@GLuint int renderbuffer);
|
||||
|
||||
@Reuse("GL30")
|
||||
void glBindRenderbuffer(@GLenum int target, @GLuint int renderbuffer);
|
||||
|
||||
@Reuse("GL30")
|
||||
void glDeleteRenderbuffers(@AutoSize("renderbuffers") @GLsizei int n, @Const @GLuint IntBuffer renderbuffers);
|
||||
|
||||
@Reuse("GL30")
|
||||
@Alternate("glDeleteRenderbuffers")
|
||||
void glDeleteRenderbuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, renderbuffer), 0", keepParam = true) int renderbuffer);
|
||||
void glDeleteRenderbuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, renderbuffer), 0", keepParam = true) int renderbuffer);
|
||||
|
||||
@Reuse("GL30")
|
||||
void glGenRenderbuffers(@AutoSize("renderbuffers") @GLsizei int n, @OutParameter @GLuint IntBuffer renderbuffers);
|
||||
|
||||
@Reuse("GL30")
|
||||
@Alternate("glGenRenderbuffers")
|
||||
@GLreturn("renderbuffers")
|
||||
void glGenRenderbuffers2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer renderbuffers);
|
||||
|
||||
@Reuse("GL30")
|
||||
void glRenderbufferStorage(@GLenum int target, @GLenum int internalformat,
|
||||
@GLsizei int width, @GLsizei int height);
|
||||
|
||||
@Reuse("GL30")
|
||||
void glRenderbufferStorageMultisample(@GLenum int target, @GLsizei int samples,
|
||||
@GLenum int internalformat,
|
||||
@GLsizei int width, @GLsizei int height);
|
||||
|
||||
@Reuse("GL30")
|
||||
@StripPostfix("params")
|
||||
void glGetRenderbufferParameteriv(@GLenum int target, @GLenum int pname, @Check("4") @OutParameter IntBuffer params);
|
||||
|
||||
@Reuse("GL30")
|
||||
@Alternate("glGetRenderbufferParameteriv")
|
||||
@GLreturn("params")
|
||||
@StripPostfix("params")
|
||||
void glGetRenderbufferParameteriv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params);
|
||||
|
||||
@Reuse("GL30")
|
||||
boolean glIsFramebuffer(@GLuint int framebuffer);
|
||||
|
||||
@Reuse("GL30")
|
||||
void glBindFramebuffer(@GLenum int target, @GLuint int framebuffer);
|
||||
|
||||
@Reuse("GL30")
|
||||
void glDeleteFramebuffers(@AutoSize("framebuffers") @GLsizei int n, @Const @GLuint IntBuffer framebuffers);
|
||||
|
||||
@Reuse("GL30")
|
||||
@Alternate("glDeleteFramebuffers")
|
||||
void glDeleteFramebuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, framebuffer), 0", keepParam = true) int framebuffer);
|
||||
void glDeleteFramebuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, framebuffer), 0", keepParam = true) int framebuffer);
|
||||
|
||||
@Reuse("GL30")
|
||||
void glGenFramebuffers(@AutoSize("framebuffers") @GLsizei int n, @OutParameter @GLuint IntBuffer framebuffers);
|
||||
|
||||
@Reuse("GL30")
|
||||
@Alternate("glGenFramebuffers")
|
||||
@GLreturn("framebuffers")
|
||||
void glGenFramebuffers2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer framebuffers);
|
||||
|
||||
@Reuse("GL30")
|
||||
@GLenum
|
||||
int glCheckFramebufferStatus(@GLenum int target);
|
||||
|
||||
@Reuse("GL30")
|
||||
void glFramebufferTexture1D(@GLenum int target, @GLenum int attachment,
|
||||
@GLenum int textarget, @GLuint int texture, int level);
|
||||
|
||||
@Reuse("GL30")
|
||||
void glFramebufferTexture2D(@GLenum int target, @GLenum int attachment,
|
||||
@GLenum int textarget, @GLuint int texture, int level);
|
||||
|
||||
@Reuse("GL30")
|
||||
void glFramebufferTexture3D(@GLenum int target, @GLenum int attachment,
|
||||
@GLenum int textarget, @GLuint int texture,
|
||||
int level, int layer);
|
||||
|
||||
@Reuse("GL30")
|
||||
void glFramebufferTextureLayer(@GLenum int target, @GLenum int attachment,
|
||||
@GLuint int texture, int level, int layer);
|
||||
|
||||
@Reuse("GL30")
|
||||
void glFramebufferRenderbuffer(@GLenum int target, @GLenum int attachment,
|
||||
@GLenum int renderbuffertarget, @GLuint int renderbuffer);
|
||||
|
||||
@Reuse("GL30")
|
||||
@StripPostfix("params")
|
||||
void glGetFramebufferAttachmentParameteriv(@GLenum int target, @GLenum int attachment,
|
||||
@GLenum int pname, @Check("4") @OutParameter IntBuffer params);
|
||||
|
||||
@Reuse("GL30")
|
||||
@Alternate("glGetFramebufferAttachmentParameteriv")
|
||||
@GLreturn("params")
|
||||
@StripPostfix("params")
|
||||
void glGetFramebufferAttachmentParameteriv2(@GLenum int target, @GLenum int attachment,
|
||||
@GLenum int pname, @OutParameter IntBuffer params);
|
||||
|
||||
@Reuse("GL30")
|
||||
void glBlitFramebuffer(int srcX0, int srcY0, int srcX1, int srcY1,
|
||||
int dstX0, int dstY0, int dstX1, int dstY1,
|
||||
@GLbitfield int mask, @GLenum int filter);
|
||||
|
||||
@Reuse("GL30")
|
||||
void glGenerateMipmap(@GLenum int target);
|
||||
|
||||
}
|
|
@ -31,8 +31,8 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.GLuint;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
public interface ARB_geometry_shader4 {
|
||||
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
import org.lwjgl.util.generator.opengl.GLvoid;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
@ -54,13 +58,16 @@ public interface ARB_get_program_binary {
|
|||
int GL_NUM_PROGRAM_BINARY_FORMATS = 0x87FE,
|
||||
GL_PROGRAM_BINARY_FORMATS = 0x87FF;
|
||||
|
||||
@Reuse("GL41")
|
||||
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);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glProgramBinary(@GLuint int program, @GLenum int binaryFormat, @Const @GLvoid ByteBuffer binary, @AutoSize("binary") @GLsizei int length);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glProgramParameteri(@GLuint int program, @GLenum int pname, int value);
|
||||
|
||||
}
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
@ -57,53 +59,71 @@ public interface ARB_gpu_shader_fp64 {
|
|||
int GL_DOUBLE_MAT4x2 = 0x8F4D;
|
||||
int GL_DOUBLE_MAT4x3 = 0x8F4E;
|
||||
|
||||
@Reuse("GL40")
|
||||
void glUniform1d(int location, double x);
|
||||
|
||||
@Reuse("GL40")
|
||||
void glUniform2d(int location, double x, double y);
|
||||
|
||||
@Reuse("GL40")
|
||||
void glUniform3d(int location, double x, double y, double z);
|
||||
|
||||
@Reuse("GL40")
|
||||
void glUniform4d(int location, double x, double y, double z, double w);
|
||||
|
||||
@Reuse("GL40")
|
||||
@StripPostfix("value")
|
||||
void glUniform1dv(int location, @AutoSize("value") @GLsizei int count, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL40")
|
||||
@StripPostfix("value")
|
||||
void glUniform2dv(int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL40")
|
||||
@StripPostfix("value")
|
||||
void glUniform3dv(int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL40")
|
||||
@StripPostfix("value")
|
||||
void glUniform4dv(int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL40")
|
||||
@StripPostfix("value")
|
||||
void glUniformMatrix2dv(int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, boolean transpose, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL40")
|
||||
@StripPostfix("value")
|
||||
void glUniformMatrix3dv(int location, @AutoSize(value = "value", expression = " / (3 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL40")
|
||||
@StripPostfix("value")
|
||||
void glUniformMatrix4dv(int location, @AutoSize(value = "value", expression = " >> 4") @GLsizei int count, boolean transpose, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL40")
|
||||
@StripPostfix("value")
|
||||
void glUniformMatrix2x3dv(int location, @AutoSize(value = "value", expression = " / (2 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL40")
|
||||
@StripPostfix("value")
|
||||
void glUniformMatrix2x4dv(int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL40")
|
||||
@StripPostfix("value")
|
||||
void glUniformMatrix3x2dv(int location, @AutoSize(value = "value", expression = " / (3 * 2)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL40")
|
||||
@StripPostfix("value")
|
||||
void glUniformMatrix3x4dv(int location, @AutoSize(value = "value", expression = " / (3 * 4)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL40")
|
||||
@StripPostfix("value")
|
||||
void glUniformMatrix4x2dv(int location, @AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL40")
|
||||
@StripPostfix("value")
|
||||
void glUniformMatrix4x3dv(int location, @AutoSize(value = "value", expression = " / (4 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL40")
|
||||
@StripPostfix("params")
|
||||
void glGetUniformdv(@GLuint int program, int location, @OutParameter @Check DoubleBuffer params);
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
@ -173,8 +174,10 @@ public interface ARB_imaging {
|
|||
@DeprecatedGL
|
||||
void glGetColorTableParameterfv(@GLenum int target, @GLenum int pname, @Check("4") FloatBuffer params);
|
||||
|
||||
@Reuse("GL14")
|
||||
void glBlendEquation(@GLenum int mode);
|
||||
|
||||
@Reuse("GL14")
|
||||
void glBlendColor(@GLclampf float red, @GLclampf float green, @GLclampf float blue, @GLclampf float alpha);
|
||||
|
||||
@DeprecatedGL
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLuint;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
public interface ARB_instanced_arrays {
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
@ -59,11 +60,13 @@ public interface ARB_map_buffer_range {
|
|||
*
|
||||
* @return A ByteBuffer representing the mapped buffer memory.
|
||||
*/
|
||||
@Reuse("GL30")
|
||||
@CachedResult(isRange = true)
|
||||
@GLvoid
|
||||
@AutoResultSize("length")
|
||||
@AutoSize("length")
|
||||
ByteBuffer glMapBufferRange(@GLenum int target, @GLintptr long offset, @GLsizeiptr long length, @GLbitfield int access);
|
||||
|
||||
@Reuse("GL30")
|
||||
void glFlushMappedBufferRange(@GLenum int target, @GLintptr long offset, @GLsizeiptr long length);
|
||||
|
||||
}
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLclampf;
|
||||
|
||||
public interface ARB_multisample {
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
|
||||
public interface ARB_multitexture {
|
||||
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLreturn;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
|
@ -63,7 +68,7 @@ public interface ARB_occlusion_query {
|
|||
void glDeleteQueriesARB(@AutoSize("ids") @GLsizei int n, @GLuint IntBuffer ids);
|
||||
|
||||
@Alternate("glDeleteQueriesARB")
|
||||
void glDeleteQueriesARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, id), 0", keepParam = true) int id);
|
||||
void glDeleteQueriesARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, id), 0", keepParam = true) int id);
|
||||
|
||||
boolean glIsQueryARB(@GLuint int id);
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
@ -126,7 +128,7 @@ public interface ARB_program {
|
|||
void glDeleteProgramsARB(@AutoSize("programs") @GLsizei int n, @Const @GLuint IntBuffer programs);
|
||||
|
||||
@Alternate("glDeleteProgramsARB")
|
||||
void glDeleteProgramsARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, program), 0", keepParam = true) int program);
|
||||
void glDeleteProgramsARB(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, program), 0", keepParam = true) int program);
|
||||
|
||||
void glGenProgramsARB(@AutoSize("programs") @GLsizei int n, @OutParameter @GLuint IntBuffer programs);
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.Reuse;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
|
||||
public interface ARB_provoking_vertex {
|
||||
|
||||
|
@ -46,6 +47,7 @@ public interface ARB_provoking_vertex {
|
|||
int GL_PROVOKING_VERTEX = 0x8E4F;
|
||||
int GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION = 0x8E4C;
|
||||
|
||||
@Reuse("GL32")
|
||||
void glProvokingVertex(@GLenum int mode);
|
||||
|
||||
}
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLclampf;
|
||||
import org.lwjgl.util.generator.opengl.GLclampf;
|
||||
|
||||
public interface ARB_sample_shading {
|
||||
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLreturn;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
@ -45,64 +50,84 @@ public interface ARB_sampler_objects {
|
|||
*/
|
||||
int GL_SAMPLER_BINDING = 0x8919;
|
||||
|
||||
@Reuse("GL33")
|
||||
void glGenSamplers(@AutoSize("samplers") @GLsizei int count, @OutParameter @GLuint IntBuffer samplers);
|
||||
|
||||
@Reuse("GL33")
|
||||
@Alternate("glGenSamplers")
|
||||
@GLreturn("samplers")
|
||||
void glGenSamplers2(@Constant("1") @GLsizei int count, @OutParameter @GLuint IntBuffer samplers);
|
||||
|
||||
@Reuse("GL33")
|
||||
void glDeleteSamplers(@AutoSize("samplers") @GLsizei int count, @Const @GLuint IntBuffer samplers);
|
||||
|
||||
@Reuse("GL33")
|
||||
@Alternate("glDeleteSamplers")
|
||||
void glDeleteSamplers(@Constant("1") @GLsizei int count, @Constant(value = "APIUtils.getBufferInt().put(0, sampler), 0", keepParam = true) int sampler);
|
||||
void glDeleteSamplers(@Constant("1") @GLsizei int count, @Constant(value = "APIUtil.getBufferInt().put(0, sampler), 0", keepParam = true) int sampler);
|
||||
|
||||
@Reuse("GL33")
|
||||
boolean glIsSampler(@GLuint int sampler);
|
||||
|
||||
@Reuse("GL33")
|
||||
void glBindSampler(@GLenum int unit, @GLuint int sampler);
|
||||
|
||||
@Reuse("GL33")
|
||||
void glSamplerParameteri(@GLuint int sampler, @GLenum int pname, int param);
|
||||
|
||||
@Reuse("GL33")
|
||||
void glSamplerParameterf(@GLuint int sampler, @GLenum int pname, float param);
|
||||
|
||||
@Reuse("GL33")
|
||||
@StripPostfix("params")
|
||||
void glSamplerParameteriv(@GLuint int sampler, @GLenum int pname, @Check("4") @Const IntBuffer params);
|
||||
|
||||
@Reuse("GL33")
|
||||
@StripPostfix("params")
|
||||
void glSamplerParameterfv(@GLuint int sampler, @GLenum int pname, @Check("4") @Const FloatBuffer params);
|
||||
|
||||
@Reuse("GL33")
|
||||
@StripPostfix("params")
|
||||
void glSamplerParameterIiv(@GLuint int sampler, @GLenum int pname, @Check("4") @Const IntBuffer params);
|
||||
|
||||
@Reuse("GL33")
|
||||
@StripPostfix("params")
|
||||
void glSamplerParameterIuiv(@GLuint int sampler, @GLenum int pname, @Check("4") @Const @GLuint IntBuffer params);
|
||||
|
||||
@Reuse("GL33")
|
||||
@StripPostfix("params")
|
||||
void glGetSamplerParameteriv(@GLuint int sampler, @GLenum int pname, @Check("4") @OutParameter IntBuffer params);
|
||||
|
||||
@Reuse("GL33")
|
||||
@Alternate("glGetSamplerParameteriv")
|
||||
@GLreturn("params")
|
||||
@StripPostfix(value = "params", postfix = "v")
|
||||
void glGetSamplerParameteriv2(@GLuint int sampler, @GLenum int pname, @OutParameter IntBuffer params);
|
||||
|
||||
@Reuse("GL33")
|
||||
@StripPostfix("params")
|
||||
void glGetSamplerParameterfv(@GLuint int sampler, @GLenum int pname, @Check("4") @OutParameter FloatBuffer params);
|
||||
|
||||
@Reuse("GL33")
|
||||
@Alternate("glGetSamplerParameterfv")
|
||||
@GLreturn("params")
|
||||
@StripPostfix(value = "params", postfix = "v")
|
||||
void glGetSamplerParameterfv2(@GLuint int sampler, @GLenum int pname, @OutParameter FloatBuffer params);
|
||||
|
||||
@Reuse("GL33")
|
||||
@StripPostfix("params")
|
||||
void glGetSamplerParameterIiv(@GLuint int sampler, @GLenum int pname, @Check("4") @OutParameter IntBuffer params);
|
||||
|
||||
@Reuse("GL33")
|
||||
@Alternate("glGetSamplerParameterIiv")
|
||||
@GLreturn("params")
|
||||
@StripPostfix(value = "params", postfix = "v")
|
||||
void glGetSamplerParameterIiv2(@GLuint int sampler, @GLenum int pname, @OutParameter IntBuffer params);
|
||||
|
||||
@Reuse("GL33")
|
||||
@StripPostfix("params")
|
||||
void glGetSamplerParameterIuiv(@GLuint int sampler, @GLenum int pname, @Check("4") @OutParameter IntBuffer params);
|
||||
|
||||
@Reuse("GL33")
|
||||
@Alternate("glGetSamplerParameterIuiv")
|
||||
@GLreturn("params")
|
||||
@StripPostfix(value = "params", postfix = "v")
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.DoubleBuffer;
|
||||
|
@ -64,202 +66,269 @@ public interface ARB_separate_shader_objects {
|
|||
*/
|
||||
int GL_PROGRAM_PIPELINE_BINDING = 0x825A;
|
||||
|
||||
@Reuse("GL41")
|
||||
void glUseProgramStages(@GLuint int pipeline, @GLbitfield int stages, @GLuint int program);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glActiveShaderProgram(@GLuint int pipeline, @GLuint int program);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix(value = "strings", postfix = "v")
|
||||
@GLuint
|
||||
int glCreateShaderProgramv(@GLenum int type, @GLsizei int count, @Check @Const @Indirect @GLchar ByteBuffer strings);
|
||||
|
||||
@Reuse("GL41")
|
||||
@Alternate("glCreateShaderProgramv")
|
||||
@StripPostfix(value = "string", postfix = "v")
|
||||
@GLuint
|
||||
int glCreateShaderProgramv(@GLenum int type, @Constant("1") @GLsizei int count, @NullTerminated CharSequence string);
|
||||
|
||||
@Reuse("GL41")
|
||||
@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);
|
||||
@Const @NullTerminated @PointerArray(value = "count") CharSequence[] strings);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glBindProgramPipeline(@GLuint int pipeline);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glDeleteProgramPipelines(@AutoSize("pipelines") @GLsizei int n, @Const @GLuint IntBuffer pipelines);
|
||||
|
||||
@Reuse("GL41")
|
||||
@Alternate("glDeleteProgramPipelines")
|
||||
void glDeleteProgramPipelines(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, pipeline), 0", keepParam = true) int pipeline);
|
||||
void glDeleteProgramPipelines(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, pipeline), 0", keepParam = true) int pipeline);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glGenProgramPipelines(@AutoSize("pipelines") @GLsizei int n, @OutParameter @GLuint IntBuffer pipelines);
|
||||
|
||||
@Reuse("GL41")
|
||||
@Alternate("glGenProgramPipelines")
|
||||
@GLreturn("pipelines")
|
||||
void glGenProgramPipelines2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer pipelines);
|
||||
|
||||
@Reuse("GL41")
|
||||
boolean glIsProgramPipeline(@GLuint int pipeline);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glProgramParameteri(@GLuint int program, @GLenum int pname, int value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("params")
|
||||
void glGetProgramPipelineiv(@GLuint int pipeline, @GLenum int pname, @OutParameter @Check("1") IntBuffer params);
|
||||
|
||||
@Reuse("GL41")
|
||||
@Alternate("glGetProgramPipelineiv")
|
||||
@GLreturn("params")
|
||||
@StripPostfix("params")
|
||||
void glGetProgramPipelineiv2(@GLuint int pipeline, @GLenum int pname, @OutParameter IntBuffer params);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glProgramUniform1i(@GLuint int program, int location, int v0);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glProgramUniform2i(@GLuint int program, int location, int v0, int v1);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glProgramUniform3i(@GLuint int program, int location, int v0, int v1, int v2);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glProgramUniform4i(@GLuint int program, int location, int v0, int v1, int v2, int v3);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glProgramUniform1f(@GLuint int program, int location, float v0);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glProgramUniform2f(@GLuint int program, int location, float v0, float v1);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glProgramUniform3f(@GLuint int program, int location, float v0, float v1, float v2);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glProgramUniform4f(@GLuint int program, int location, float v0, float v1, float v2, float v3);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glProgramUniform1d(@GLuint int program, int location, double v0);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glProgramUniform2d(@GLuint int program, int location, double v0, double v1);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glProgramUniform3d(@GLuint int program, int location, double v0, double v1, double v2);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glProgramUniform4d(@GLuint int program, int location, double v0, double v1, double v2, double v3);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform1iv(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const IntBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform2iv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const IntBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform3iv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const IntBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform4iv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const IntBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform1fv(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const FloatBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform2fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const FloatBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform3fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const FloatBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform4fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const FloatBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform1dv(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform2dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform3dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform4dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glProgramUniform1ui(@GLuint int program, int location, int v0);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glProgramUniform2ui(@GLuint int program, int location, int v0, int v1);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glProgramUniform3ui(@GLuint int program, int location, int v0, int v1, int v2);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glProgramUniform4ui(@GLuint int program, int location, int v0, int v1, int v2, int v3);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform1uiv(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const IntBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform2uiv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const IntBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform3uiv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const IntBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform4uiv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const IntBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniformMatrix2fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, boolean transpose, @Const FloatBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniformMatrix3fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 3)") @GLsizei int count, boolean transpose, @Const FloatBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniformMatrix4fv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 4") @GLsizei int count, boolean transpose, @Const FloatBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniformMatrix2dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, boolean transpose, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniformMatrix3dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " / (3 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniformMatrix4dv(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 4") @GLsizei int count, boolean transpose, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniformMatrix2x3fv(@GLuint int program, int location,
|
||||
@AutoSize(value = "value", expression = " / (2 * 3)") @GLsizei int count, boolean transpose, @Const FloatBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniformMatrix3x2fv(@GLuint int program, int location,
|
||||
@AutoSize(value = "value", expression = " / (3 * 2)") @GLsizei int count, boolean transpose, @Const FloatBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniformMatrix2x4fv(@GLuint int program, int location,
|
||||
@AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const FloatBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniformMatrix4x2fv(@GLuint int program, int location,
|
||||
@AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const FloatBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniformMatrix3x4fv(@GLuint int program, int location,
|
||||
@AutoSize(value = "value", expression = " / (3 * 4)") @GLsizei int count, boolean transpose, @Const FloatBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniformMatrix4x3fv(@GLuint int program, int location,
|
||||
@AutoSize(value = "value", expression = " / (4 * 3)") @GLsizei int count, boolean transpose, @Const FloatBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniformMatrix2x3dv(@GLuint int program, int location,
|
||||
@AutoSize(value = "value", expression = " / (2 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniformMatrix3x2dv(@GLuint int program, int location,
|
||||
@AutoSize(value = "value", expression = " / (3 * 2)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniformMatrix2x4dv(@GLuint int program, int location,
|
||||
@AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniformMatrix4x2dv(@GLuint int program, int location,
|
||||
@AutoSize(value = "value", expression = " >> 3") @GLsizei int count, boolean transpose, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniformMatrix3x4dv(@GLuint int program, int location,
|
||||
@AutoSize(value = "value", expression = " / (3 * 4)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniformMatrix4x3dv(@GLuint int program, int location,
|
||||
@AutoSize(value = "value", expression = " / (4 * 3)") @GLsizei int count, boolean transpose, @Const DoubleBuffer value);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glValidateProgramPipeline(@GLuint int pipeline);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glGetProgramPipelineInfoLog(@GLuint int pipeline, @AutoSize("infoLog") @GLsizei int bufSize,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length,
|
||||
@OutParameter @GLchar ByteBuffer infoLog);
|
||||
|
||||
@Reuse("GL41")
|
||||
@Alternate("glGetProgramPipelineInfoLog")
|
||||
@GLreturn(value = "infoLog", maxLength = "bufSize")
|
||||
void glGetProgramPipelineInfoLog2(@GLuint int pipeline, @GLsizei int bufSize,
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
|
@ -107,8 +109,8 @@ public interface ARB_shader_objects {
|
|||
|
||||
@Alternate(value = "glShaderSourceARB", nativeAlt = true)
|
||||
void glShaderSourceARB3(@GLhandleARB int shader, @Constant("strings.length") @GLsizei int count,
|
||||
@Const @StringList(value = "count", lengths = "length") CharSequence[] strings,
|
||||
@Constant("APIUtils.getLengths(strings), 0") @Const IntBuffer length);
|
||||
@Const @PointerArray(value = "count", lengths = "length") CharSequence[] strings,
|
||||
@Constant("APIUtil.getLengths(strings), 0") @Const IntBuffer length);
|
||||
|
||||
void glCompileShaderARB(@GLhandleARB int shaderObj);
|
||||
|
||||
|
@ -232,7 +234,7 @@ public interface ARB_shader_objects {
|
|||
@Alternate(value = "glGetActiveUniformARB", javaAlt = true)
|
||||
@GLreturn(value = "name", maxLength = "maxLength")
|
||||
void glGetActiveUniformARB(@GLhandleARB int programObj, @GLuint int index, @GLsizei int maxLength,
|
||||
@OutParameter @GLsizei @Constant("name_length, 0, APIUtils.getBufferInt(), 0, APIUtils.getBufferInt(), 1") IntBuffer length,
|
||||
@OutParameter @GLsizei @Constant("name_length, 0, APIUtil.getBufferInt(), 0, APIUtil.getBufferInt(), 1") IntBuffer length,
|
||||
@OutParameter @GLcharARB ByteBuffer name);
|
||||
|
||||
/** Overloads glGetActiveUniformARB. This version returns only the uniform size. */
|
||||
|
@ -242,7 +244,7 @@ public interface ARB_shader_objects {
|
|||
@OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
|
||||
@OutParameter IntBuffer size,
|
||||
@OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore
|
||||
@OutParameter @GLcharARB @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
|
||||
@OutParameter @GLcharARB @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
|
||||
|
||||
/** Overloads glGetActiveUniformARB. This version returns only the uniform type. */
|
||||
@Alternate(value = "glGetActiveUniformARB", javaAlt = true)
|
||||
|
@ -251,7 +253,7 @@ public interface ARB_shader_objects {
|
|||
@OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
|
||||
@OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore
|
||||
@OutParameter @GLenum IntBuffer type,
|
||||
@OutParameter @GLcharARB @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
|
||||
@OutParameter @GLcharARB @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
|
||||
|
||||
@StripPostfix("params")
|
||||
void glGetUniformfvARB(@GLhandleARB int programObj, int location, @OutParameter @Check FloatBuffer params);
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
@ -59,55 +61,68 @@ public interface ARB_shader_subroutine {
|
|||
int GL_UNIFORM_SIZE = GL31.GL_UNIFORM_SIZE;
|
||||
int GL_UNIFORM_NAME_LENGTH = GL31.GL_UNIFORM_NAME_LENGTH;
|
||||
|
||||
@Reuse("GL40")
|
||||
int glGetSubroutineUniformLocation(@GLuint int program, @GLenum int shadertype, @Const @NullTerminated ByteBuffer name);
|
||||
|
||||
@Reuse("GL40")
|
||||
@GLuint
|
||||
int glGetSubroutineIndex(@GLuint int program, @GLenum int shadertype, @Const @NullTerminated ByteBuffer name);
|
||||
|
||||
@Reuse("GL40")
|
||||
@StripPostfix("values")
|
||||
void glGetActiveSubroutineUniformiv(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLenum int pname,
|
||||
@Check("1") @OutParameter IntBuffer values);
|
||||
|
||||
@Reuse("GL40")
|
||||
@Alternate("glGetActiveSubroutineUniformiv")
|
||||
@GLreturn("values")
|
||||
@StripPostfix("values")
|
||||
void glGetActiveSubroutineUniformiv2(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLenum int pname,
|
||||
@OutParameter IntBuffer values);
|
||||
|
||||
@Reuse("GL40")
|
||||
void glGetActiveSubroutineUniformName(@GLuint int program, @GLenum int shadertype, @GLuint int index, @AutoSize("name") @GLsizei int bufsize,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length,
|
||||
@OutParameter ByteBuffer name);
|
||||
|
||||
@Reuse("GL40")
|
||||
@Alternate("glGetActiveSubroutineUniformName")
|
||||
@GLreturn(value = "name", maxLength = "bufsize")
|
||||
void glGetActiveSubroutineUniformName2(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLsizei int bufsize,
|
||||
@OutParameter @Constant("name_length, 0") @GLsizei IntBuffer length,
|
||||
@OutParameter @GLchar ByteBuffer name);
|
||||
|
||||
@Reuse("GL40")
|
||||
void glGetActiveSubroutineName(@GLuint int program, @GLenum int shadertype, @GLuint int index, @AutoSize("name") @GLsizei int bufsize,
|
||||
@OutParameter @Check(value = "1", canBeNull = true) @GLsizei IntBuffer length,
|
||||
@OutParameter ByteBuffer name);
|
||||
|
||||
@Reuse("GL40")
|
||||
@Alternate("glGetActiveSubroutineName")
|
||||
@GLreturn(value = "name", maxLength = "bufsize")
|
||||
void glGetActiveSubroutineName2(@GLuint int program, @GLenum int shadertype, @GLuint int index, @GLsizei int bufsize,
|
||||
@OutParameter @Constant("name_length, 0") @GLsizei IntBuffer length,
|
||||
@OutParameter @GLchar ByteBuffer name);
|
||||
|
||||
@Reuse("GL40")
|
||||
@StripPostfix("indices")
|
||||
void glUniformSubroutinesuiv(@GLenum int shadertype, @AutoSize("indices") @GLsizei int count, @Const @GLuint IntBuffer indices);
|
||||
|
||||
@Reuse("GL40")
|
||||
@StripPostfix("params")
|
||||
void glGetUniformSubroutineuiv(@GLenum int shadertype, int location, @Check("1") @OutParameter @GLuint IntBuffer params);
|
||||
|
||||
@Reuse("GL40")
|
||||
@Alternate("glGetUniformSubroutineuiv")
|
||||
@GLreturn("params")
|
||||
@StripPostfix("params")
|
||||
void glGetUniformSubroutineuiv2(@GLenum int shadertype, int location, @OutParameter @GLuint IntBuffer params);
|
||||
|
||||
@Reuse("GL40")
|
||||
@StripPostfix("values")
|
||||
void glGetProgramStageiv(@GLuint int program, @GLenum int shadertype, @GLenum int pname, @Check("1") @OutParameter IntBuffer values);
|
||||
|
||||
@Reuse("GL40")
|
||||
@Alternate("glGetProgramStageiv")
|
||||
@GLreturn("values")
|
||||
@StripPostfix("values")
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
@ -60,13 +62,13 @@ public interface ARB_shading_language_include {
|
|||
void glDeleteNamedStringARB(@Constant("name.length()") int namelen, CharSequence name);
|
||||
|
||||
void glCompileShaderIncludeARB(@GLuint int shader, @GLsizei int count,
|
||||
@Const @NullTerminated("count") @StringList("count") @GLchar ByteBuffer path,
|
||||
@Const @NullTerminated("count") @PointerArray("count") @GLchar ByteBuffer path,
|
||||
@Constant("null, 0") @Const IntBuffer length);
|
||||
|
||||
@Alternate(value = "glCompileShaderIncludeARB", nativeAlt = true)
|
||||
void glCompileShaderIncludeARB2(@GLuint int shader, @Constant("path.length") @GLsizei int count,
|
||||
@Const @StringList(value = "count", lengths = "length") CharSequence[] path,
|
||||
@Constant("APIUtils.getLengths(path), 0") @Const IntBuffer length);
|
||||
@Const @PointerArray(value = "count", lengths = "length") CharSequence[] path,
|
||||
@Constant("APIUtil.getLengths(path), 0") @Const IntBuffer length);
|
||||
|
||||
boolean glIsNamedStringARB(@AutoSize("name") int namelen, @Const @GLchar ByteBuffer name);
|
||||
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.PointerWrapper;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.LongBuffer;
|
||||
|
@ -70,35 +73,44 @@ public interface ARB_sync {
|
|||
int GL_CONDITION_SATISFIED = 0x911C;
|
||||
int GL_WAIT_FAILED = 0x911D;
|
||||
|
||||
@GLpointer("GLsync")
|
||||
@Reuse("GL32")
|
||||
@PointerWrapper("GLsync")
|
||||
GLSync glFenceSync(@GLenum int condition, @GLbitfield int flags);
|
||||
|
||||
boolean glIsSync(@GLpointer("GLsync") GLSync sync);
|
||||
@Reuse("GL32")
|
||||
boolean glIsSync(@PointerWrapper("GLsync") GLSync sync);
|
||||
|
||||
void glDeleteSync(@GLpointer("GLsync") GLSync sync);
|
||||
@Reuse("GL32")
|
||||
void glDeleteSync(@PointerWrapper("GLsync") GLSync sync);
|
||||
|
||||
@Reuse("GL32")
|
||||
@GLenum
|
||||
int glClientWaitSync(@GLpointer("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout);
|
||||
int glClientWaitSync(@PointerWrapper("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout);
|
||||
|
||||
void glWaitSync(@GLpointer("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout);
|
||||
@Reuse("GL32")
|
||||
void glWaitSync(@PointerWrapper("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout);
|
||||
|
||||
@Reuse("GL32")
|
||||
@StripPostfix(value = "params", postfix = "64")
|
||||
void glGetInteger64v(@GLenum int pname, @OutParameter @Check("1") @GLint64 LongBuffer params);
|
||||
|
||||
@Reuse("GL32")
|
||||
@Alternate("glGetInteger64v")
|
||||
@GLreturn("params")
|
||||
@StripPostfix(value = "params", postfix = "64")
|
||||
void glGetInteger64v2(@GLenum int pname, @OutParameter @GLint64 LongBuffer params);
|
||||
|
||||
@Reuse("GL32")
|
||||
@StripPostfix("values")
|
||||
void glGetSynciv(@GLpointer("GLsync") GLSync sync, @GLenum int pname, @AutoSize("values") @GLsizei int bufSize,
|
||||
void glGetSynciv(@PointerWrapper("GLsync") GLSync sync, @GLenum int pname, @AutoSize("values") @GLsizei int bufSize,
|
||||
@OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length,
|
||||
@OutParameter IntBuffer values);
|
||||
|
||||
@Reuse("GL32")
|
||||
@Alternate("glGetSynciv")
|
||||
@GLreturn("values")
|
||||
@StripPostfix("values")
|
||||
void glGetSynciv2(@GLpointer("GLsync") GLSync sync, @GLenum int pname, @Constant("1") @GLsizei int bufSize,
|
||||
void glGetSynciv2(@PointerWrapper("GLsync") GLSync sync, @GLenum int pname, @Constant("1") @GLsizei int bufSize,
|
||||
@OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
|
||||
@OutParameter IntBuffer values);
|
||||
}
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
|
@ -114,8 +115,10 @@ public interface ARB_tessellation_shader {
|
|||
int GL_TESS_EVALUATION_SHADER = 0x8E87;
|
||||
int GL_TESS_CONTROL_SHADER = 0x8E88;
|
||||
|
||||
@Reuse("GL40")
|
||||
void glPatchParameteri(@GLenum int pname, int value);
|
||||
|
||||
@Reuse("GL40")
|
||||
@StripPostfix("values")
|
||||
void glPatchParameterfv(@GLenum int pname, @Check("4") @Const FloatBuffer values);
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.GLuint;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
public interface ARB_texture_buffer_object {
|
||||
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLvoid;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLbitfield;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
|
||||
|
@ -95,17 +99,21 @@ public interface ARB_texture_multisample {
|
|||
int GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910C;
|
||||
int GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 0x910D;
|
||||
|
||||
@Reuse("GL32")
|
||||
void glTexImage2DMultisample(@GLenum int target, @GLsizei int samples, int internalformat,
|
||||
@GLsizei int width, @GLsizei int height,
|
||||
boolean fixedsamplelocations);
|
||||
|
||||
@Reuse("GL32")
|
||||
void glTexImage3DMultisample(@GLenum int target, @GLsizei int samples, int internalformat,
|
||||
@GLsizei int width, @GLsizei int height, @GLsizei int depth,
|
||||
boolean fixedsamplelocations);
|
||||
|
||||
@Reuse("GL32")
|
||||
@StripPostfix("val")
|
||||
void glGetMultisamplefv(@GLenum int pname, @GLuint int index, @OutParameter @Check("2") FloatBuffer val);
|
||||
|
||||
@Reuse("GL32")
|
||||
void glSampleMaski(@GLuint int index, @GLbitfield int mask);
|
||||
|
||||
}
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.LongBuffer;
|
||||
|
||||
|
@ -51,19 +53,24 @@ public interface ARB_timer_query {
|
|||
*/
|
||||
int GL_TIMESTAMP = 0x8E28;
|
||||
|
||||
@Reuse("GL33")
|
||||
void glQueryCounter(@GLuint int id, @GLenum int target);
|
||||
|
||||
@Reuse("GL33")
|
||||
@StripPostfix("params")
|
||||
void glGetQueryObjecti64v(@GLuint int id, @GLenum int pname, @OutParameter @Check("1") @GLint64 LongBuffer params);
|
||||
|
||||
@Reuse("GL33")
|
||||
@Alternate("glGetQueryObjecti64v")
|
||||
@GLreturn("params")
|
||||
@StripPostfix("params")
|
||||
void glGetQueryObjecti64v2(@GLuint int id, @GLenum int pname, @OutParameter @GLint64 LongBuffer params);
|
||||
|
||||
@Reuse("GL33")
|
||||
@StripPostfix("params")
|
||||
void glGetQueryObjectui64v(@GLuint int id, @GLenum int pname, @OutParameter @Check("1") @GLuint64 LongBuffer params);
|
||||
|
||||
@Reuse("GL33")
|
||||
@Alternate("glGetQueryObjectui64v")
|
||||
@GLreturn("params")
|
||||
@StripPostfix("params")
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLreturn;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
|
@ -48,25 +53,34 @@ public interface ARB_transform_feedback2 {
|
|||
int GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE = 0x8E24;
|
||||
int GL_TRANSFORM_FEEDBACK_BINDING = 0x8E25;
|
||||
|
||||
@Reuse("GL40")
|
||||
void glBindTransformFeedback(@GLenum int target, @GLuint int id);
|
||||
|
||||
@Reuse("GL40")
|
||||
void glDeleteTransformFeedbacks(@AutoSize("ids") @GLsizei int n, @Const @GLuint IntBuffer ids);
|
||||
|
||||
@Reuse("GL40")
|
||||
@Alternate("glDeleteTransformFeedbacks")
|
||||
void glDeleteTransformFeedbacks(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, id), 0", keepParam = true) int id);
|
||||
void glDeleteTransformFeedbacks(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, id), 0", keepParam = true) int id);
|
||||
|
||||
@Reuse("GL40")
|
||||
void glGenTransformFeedbacks(@AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids);
|
||||
|
||||
@Reuse("GL40")
|
||||
@Alternate("glGenTransformFeedbacks")
|
||||
@GLreturn("ids")
|
||||
void glGenTransformFeedbacks2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer ids);
|
||||
|
||||
@Reuse("GL40")
|
||||
boolean glIsTransformFeedback(@GLuint int id);
|
||||
|
||||
@Reuse("GL40")
|
||||
void glPauseTransformFeedback();
|
||||
|
||||
@Reuse("GL40")
|
||||
void glResumeTransformFeedback();
|
||||
|
||||
@Reuse("GL40")
|
||||
void glDrawTransformFeedback(@GLenum int mode, @GLuint int id);
|
||||
|
||||
}
|
|
@ -32,6 +32,10 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLreturn;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
|
@ -45,15 +49,20 @@ public interface ARB_transform_feedback3 {
|
|||
int GL_MAX_TRANSFORM_FEEDBACK_BUFFERS = 0x8E70;
|
||||
int GL_MAX_VERTEX_STREAMS = 0x8E71;
|
||||
|
||||
@Reuse("GL40")
|
||||
void glDrawTransformFeedbackStream(@GLenum int mode, @GLuint int id, @GLuint int stream);
|
||||
|
||||
@Reuse("GL40")
|
||||
void glBeginQueryIndexed(@GLenum int target, @GLuint int index, @GLuint int id);
|
||||
|
||||
@Reuse("GL40")
|
||||
void glEndQueryIndexed(@GLenum int target, @GLuint int index);
|
||||
|
||||
@Reuse("GL40")
|
||||
@StripPostfix("params")
|
||||
void glGetQueryIndexediv(@GLenum int target, @GLuint int index, @GLenum int pname, @OutParameter @Check("1") IntBuffer params);
|
||||
|
||||
@Reuse("GL40")
|
||||
@Alternate("glGetQueryIndexediv")
|
||||
@GLreturn("params")
|
||||
@StripPostfix("params")
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
@ -98,21 +100,25 @@ public interface ARB_uniform_buffer_object {
|
|||
/** Returned by GetActiveUniformsivARB and GetUniformBlockIndexARB */
|
||||
int GL_INVALID_INDEX = 0xFFFFFFFF;
|
||||
|
||||
@Reuse("GL31")
|
||||
void glGetUniformIndices(@GLuint int program, @AutoSize("uniformIndices") @GLsizei int uniformCount,
|
||||
@Const @NullTerminated("uniformIndices.remaining()") @GLchar @StringList("uniformCount") ByteBuffer uniformNames,
|
||||
@Const @NullTerminated("uniformIndices.remaining()") @GLchar @PointerArray("uniformCount") ByteBuffer uniformNames,
|
||||
@OutParameter @GLuint IntBuffer uniformIndices);
|
||||
|
||||
@Reuse("GL31")
|
||||
@Alternate(value = "glGetUniformIndices")
|
||||
void glGetUniformIndices(@GLuint int program, @Constant("uniformNames.length") @GLsizei int uniformCount,
|
||||
@Const @NullTerminated @StringList("uniformCount") CharSequence[] uniformNames,
|
||||
@Const @NullTerminated @PointerArray("uniformCount") CharSequence[] uniformNames,
|
||||
@OutParameter @Check("uniformNames.length") @GLuint IntBuffer uniformIndices);
|
||||
|
||||
@Reuse("GL31")
|
||||
@StripPostfix("params")
|
||||
void glGetActiveUniformsiv(@GLuint int program, @AutoSize("uniformIndices") @GLsizei int uniformCount,
|
||||
@Const @GLuint IntBuffer uniformIndices,
|
||||
@GLenum int pname,
|
||||
@OutParameter @Check("uniformIndices.remaining()") @GLint IntBuffer params);
|
||||
|
||||
@Reuse("GL31")
|
||||
@Alternate("glGetActiveUniformsiv")
|
||||
@GLreturn("params")
|
||||
@StripPostfix("params")
|
||||
|
@ -121,55 +127,68 @@ public interface ARB_uniform_buffer_object {
|
|||
@GLenum int pname,
|
||||
@OutParameter @GLint IntBuffer params);
|
||||
|
||||
@Reuse("GL31")
|
||||
void glGetActiveUniformName(@GLuint int program, @GLuint int uniformIndex, @AutoSize("uniformName") @GLsizei int bufSize,
|
||||
@OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length,
|
||||
@OutParameter @GLchar ByteBuffer uniformName);
|
||||
|
||||
@Reuse("GL31")
|
||||
@Alternate("glGetActiveUniformName")
|
||||
@GLreturn(value = "uniformName", maxLength = "bufSize")
|
||||
void glGetActiveUniformName2(@GLuint int program, @GLuint int uniformIndex, @GLsizei int bufSize,
|
||||
@OutParameter @GLsizei @Constant("uniformName_length, 0") IntBuffer length,
|
||||
@OutParameter @GLchar ByteBuffer uniformName);
|
||||
|
||||
@Reuse("GL31")
|
||||
@GLuint
|
||||
int glGetUniformBlockIndex(@GLuint int program, @Const @NullTerminated @GLchar ByteBuffer uniformBlockName);
|
||||
|
||||
@Reuse("GL31")
|
||||
@Alternate("glGetUniformBlockIndex")
|
||||
@GLuint
|
||||
int glGetUniformBlockIndex(@GLuint int program, @NullTerminated CharSequence uniformBlockName);
|
||||
|
||||
@Reuse("GL31")
|
||||
@StripPostfix("params")
|
||||
void glGetActiveUniformBlockiv(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname,
|
||||
@OutParameter @Check(value = "16") @GLint IntBuffer params);
|
||||
|
||||
@Reuse("GL31")
|
||||
@Alternate("glGetActiveUniformBlockiv")
|
||||
@GLreturn("params")
|
||||
@StripPostfix("params")
|
||||
void glGetActiveUniformBlockiv2(@GLuint int program, @GLuint int uniformBlockIndex, @GLenum int pname,
|
||||
@OutParameter @GLint IntBuffer params);
|
||||
|
||||
@Reuse("GL31")
|
||||
void glGetActiveUniformBlockName(@GLuint int program, @GLuint int uniformBlockIndex, @AutoSize("uniformBlockName") @GLsizei int bufSize,
|
||||
@OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length,
|
||||
@OutParameter @GLchar ByteBuffer uniformBlockName);
|
||||
|
||||
@Reuse("GL31")
|
||||
@Alternate("glGetActiveUniformBlockName")
|
||||
@GLreturn(value = "uniformBlockName", maxLength = "bufSize")
|
||||
void glGetActiveUniformBlockName2(@GLuint int program, @GLuint int uniformBlockIndex, @GLsizei int bufSize,
|
||||
@OutParameter @GLsizei @Constant("uniformBlockName_length, 0") IntBuffer length,
|
||||
@OutParameter @GLchar ByteBuffer uniformBlockName);
|
||||
|
||||
@Reuse("GL30")
|
||||
void glBindBufferRange(@GLenum int target, @GLuint int index, @GLuint int buffer, @GLintptr long offset, @GLsizeiptr long size);
|
||||
|
||||
@Reuse("GL30")
|
||||
void glBindBufferBase(@GLenum int target, @GLuint int index, @GLuint int buffer);
|
||||
|
||||
@Reuse("GL30")
|
||||
@StripPostfix(value = "data", extension = "")
|
||||
void glGetIntegeri_v(@GLenum int value, @GLuint int index, @OutParameter @Check("4") IntBuffer data);
|
||||
|
||||
@Reuse("GL30")
|
||||
@Alternate("glGetIntegeri_v")
|
||||
@GLreturn("data")
|
||||
@StripPostfix("data")
|
||||
void glGetIntegeri_v2(@GLenum int value, @GLuint int index, @OutParameter IntBuffer data);
|
||||
|
||||
@Reuse("GL31")
|
||||
void glUniformBlockBinding(@GLuint int program, @GLuint int uniformBlockIndex, @GLuint int uniformBlockBinding);
|
||||
|
||||
}
|
|
@ -32,6 +32,10 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLreturn;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
|
@ -43,19 +47,25 @@ public interface ARB_vertex_array_object {
|
|||
*/
|
||||
int GL_VERTEX_ARRAY_BINDING = 0x85B5;
|
||||
|
||||
@Reuse("GL30")
|
||||
void glBindVertexArray(@GLuint int array);
|
||||
|
||||
@Reuse("GL30")
|
||||
void glDeleteVertexArrays(@AutoSize("arrays") @GLsizei int n, @Const @GLuint IntBuffer arrays);
|
||||
|
||||
@Reuse("GL30")
|
||||
@Alternate("glDeleteVertexArrays")
|
||||
void glDeleteVertexArrays(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, array), 0", keepParam = true) int array);
|
||||
void glDeleteVertexArrays(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, array), 0", keepParam = true) int array);
|
||||
|
||||
@Reuse("GL30")
|
||||
void glGenVertexArrays(@AutoSize("arrays") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays);
|
||||
|
||||
@Reuse("GL30")
|
||||
@Alternate("glGenVertexArrays")
|
||||
@GLreturn("arrays")
|
||||
void glGenVertexArrays2(@Constant("1") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays);
|
||||
|
||||
@Reuse("GL30")
|
||||
boolean glIsVertexArray(@GLuint int array);
|
||||
|
||||
}
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.DoubleBuffer;
|
||||
|
@ -54,31 +55,41 @@ public interface ARB_vertex_attrib_64bit {
|
|||
int GL_DOUBLE_MAT4x2 = 0x8F4D;
|
||||
int GL_DOUBLE_MAT4x3 = 0x8F4E;
|
||||
|
||||
@Reuse("GL41")
|
||||
void glVertexAttribL1d(@GLuint int index, double x);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glVertexAttribL2d(@GLuint int index, double x, double y);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glVertexAttribL3d(@GLuint int index, double x, double y, double z);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glVertexAttribL4d(@GLuint int index, double x, double y, double z, double w);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("v")
|
||||
void glVertexAttribL1dv(@GLuint int index, @Const @Check("1") DoubleBuffer v);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("v")
|
||||
void glVertexAttribL2dv(@GLuint int index, @Const @Check("2") DoubleBuffer v);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("v")
|
||||
void glVertexAttribL3dv(@GLuint int index, @Const @Check("3") DoubleBuffer v);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("v")
|
||||
void glVertexAttribL4dv(@GLuint int index, @Const @Check("4") DoubleBuffer v);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glVertexAttribLPointer(@GLuint int index, int size, @Constant("GL11.GL_DOUBLE") @GLenum int type, @GLsizei int stride,
|
||||
@CachedReference(index = "index", name = "glVertexAttribPointer_buffer")
|
||||
@BufferObject(BufferKind.ArrayVBO)
|
||||
@Check @Const @GLdouble Buffer pointer);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("params")
|
||||
void glGetVertexAttribLdv(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") DoubleBuffer params);
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
@ -79,45 +80,59 @@ public interface ARB_vertex_program extends ARB_program {
|
|||
*/
|
||||
int GL_MAX_VERTEX_ATTRIBS_ARB = 0x8869;
|
||||
|
||||
@Reuse("ARBVertexShader")
|
||||
@NoErrorCheck
|
||||
void glVertexAttrib1sARB(@GLuint int index, short x);
|
||||
|
||||
@Reuse("ARBVertexShader")
|
||||
@NoErrorCheck
|
||||
void glVertexAttrib1fARB(@GLuint int index, float x);
|
||||
|
||||
@Reuse("ARBVertexShader")
|
||||
@NoErrorCheck
|
||||
void glVertexAttrib1dARB(@GLuint int index, double x);
|
||||
|
||||
@Reuse("ARBVertexShader")
|
||||
@NoErrorCheck
|
||||
void glVertexAttrib2sARB(@GLuint int index, short x, short y);
|
||||
|
||||
@Reuse("ARBVertexShader")
|
||||
@NoErrorCheck
|
||||
void glVertexAttrib2fARB(@GLuint int index, float x, float y);
|
||||
|
||||
@Reuse("ARBVertexShader")
|
||||
@NoErrorCheck
|
||||
void glVertexAttrib2dARB(@GLuint int index, double x, double y);
|
||||
|
||||
@Reuse("ARBVertexShader")
|
||||
@NoErrorCheck
|
||||
void glVertexAttrib3sARB(@GLuint int index, short x, short y, short z);
|
||||
|
||||
@Reuse("ARBVertexShader")
|
||||
@NoErrorCheck
|
||||
void glVertexAttrib3fARB(@GLuint int index, float x, float y, float z);
|
||||
|
||||
@Reuse("ARBVertexShader")
|
||||
@NoErrorCheck
|
||||
void glVertexAttrib3dARB(@GLuint int index, double x, double y, double z);
|
||||
|
||||
@Reuse("ARBVertexShader")
|
||||
@NoErrorCheck
|
||||
void glVertexAttrib4sARB(@GLuint int index, short x, short y, short z, short w);
|
||||
|
||||
@Reuse("ARBVertexShader")
|
||||
@NoErrorCheck
|
||||
void glVertexAttrib4fARB(@GLuint int index, float x, float y, float z, float w);
|
||||
|
||||
@Reuse("ARBVertexShader")
|
||||
@NoErrorCheck
|
||||
void glVertexAttrib4dARB(@GLuint int index, double x, double y, double z, double w);
|
||||
|
||||
@Reuse("ARBVertexShader")
|
||||
@NoErrorCheck
|
||||
void glVertexAttrib4NubARB(@GLuint int index, @GLubyte byte x, @GLubyte byte y, @GLubyte byte z, @GLubyte byte w);
|
||||
|
||||
@Reuse("ARBVertexShader")
|
||||
void glVertexAttribPointerARB(@GLuint int index, int size, @AutoType("buffer") @GLenum int type, boolean normalized, @GLsizei int stride,
|
||||
@CachedReference(index = "index", name = "glVertexAttribPointer_buffer")
|
||||
@BufferObject(BufferKind.ArrayVBO)
|
||||
|
@ -132,19 +147,25 @@ public interface ARB_vertex_program extends ARB_program {
|
|||
@GLfloat
|
||||
@GLdouble Buffer buffer);
|
||||
|
||||
@Reuse("ARBVertexShader")
|
||||
void glEnableVertexAttribArrayARB(@GLuint int index);
|
||||
|
||||
@Reuse("ARBVertexShader")
|
||||
void glDisableVertexAttribArrayARB(@GLuint int index);
|
||||
|
||||
@Reuse("ARBVertexShader")
|
||||
@StripPostfix("params")
|
||||
void glGetVertexAttribfvARB(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") FloatBuffer params);
|
||||
|
||||
@Reuse("ARBVertexShader")
|
||||
@StripPostfix("params")
|
||||
void glGetVertexAttribdvARB(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") DoubleBuffer params);
|
||||
|
||||
@Reuse("ARBVertexShader")
|
||||
@StripPostfix("params")
|
||||
void glGetVertexAttribivARB(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") IntBuffer params);
|
||||
|
||||
@Reuse("ARBVertexShader")
|
||||
@StripPostfix("result")
|
||||
void glGetVertexAttribPointervARB(@GLuint int index, @GLenum int pname, @Result @GLvoid ByteBuffer result);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
@ -168,7 +170,7 @@ public interface ARB_vertex_shader {
|
|||
@Alternate(value = "glGetActiveAttribARB", javaAlt = true)
|
||||
@GLreturn(value = "name", maxLength = "maxLength")
|
||||
void glGetActiveAttribARB(@GLhandleARB int programObj, @GLuint int index, @GLsizei int maxLength,
|
||||
@OutParameter @GLsizei @Constant("name_length, 0, APIUtils.getBufferInt(), 0, APIUtils.getBufferInt(), 1") IntBuffer length,
|
||||
@OutParameter @GLsizei @Constant("name_length, 0, APIUtil.getBufferInt(), 0, APIUtil.getBufferInt(), 1") IntBuffer length,
|
||||
@OutParameter @GLcharARB ByteBuffer name);
|
||||
|
||||
/** Overloads glGetActiveAttribARB. This version returns only the attrib size. */
|
||||
|
@ -178,7 +180,7 @@ public interface ARB_vertex_shader {
|
|||
@OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
|
||||
@OutParameter IntBuffer size,
|
||||
@OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore
|
||||
@OutParameter @GLcharARB @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
|
||||
@OutParameter @GLcharARB @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
|
||||
|
||||
/** Overloads glGetActiveAttribARB. This version returns only the attrib type. */
|
||||
@Alternate(value = "glGetActiveAttribARB", javaAlt = true)
|
||||
|
@ -187,7 +189,7 @@ public interface ARB_vertex_shader {
|
|||
@OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
|
||||
@OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore
|
||||
@OutParameter @GLenum IntBuffer type,
|
||||
@OutParameter @GLcharARB @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
|
||||
@OutParameter @GLcharARB @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
|
||||
|
||||
int glGetAttribLocationARB(@GLhandleARB int programObj, @NullTerminated @Const @GLcharARB ByteBuffer name);
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
|
@ -47,135 +49,173 @@ public interface ARB_vertex_type_2_10_10_10_rev {
|
|||
int GL_UNSIGNED_INT_2_10_10_10_REV = GL12.GL_UNSIGNED_INT_2_10_10_10_REV;
|
||||
int GL_INT_2_10_10_10_REV = 0x8D9F;
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
void glVertexP2ui(@GLenum int type, @GLuint int value);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
void glVertexP3ui(@GLenum int type, @GLuint int value);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
void glVertexP4ui(@GLenum int type, @GLuint int value);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
@StripPostfix("value")
|
||||
void glVertexP2uiv(@GLenum int type, @Check("2") @Const @GLuint IntBuffer value);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
@StripPostfix("value")
|
||||
void glVertexP3uiv(@GLenum int type, @Check("3") @Const @GLuint IntBuffer value);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
@StripPostfix("value")
|
||||
void glVertexP4uiv(@GLenum int type, @Check("4") @Const @GLuint IntBuffer value);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
void glTexCoordP1ui(@GLenum int type, @GLuint int coords);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
void glTexCoordP2ui(@GLenum int type, @GLuint int coords);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
void glTexCoordP3ui(@GLenum int type, @GLuint int coords);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
void glTexCoordP4ui(@GLenum int type, @GLuint int coords);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
@StripPostfix("coords")
|
||||
void glTexCoordP1uiv(@GLenum int type, @Check("1") @Const @GLuint IntBuffer coords);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
@StripPostfix("coords")
|
||||
void glTexCoordP2uiv(@GLenum int type, @Check("2") @Const @GLuint IntBuffer coords);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
@StripPostfix("coords")
|
||||
void glTexCoordP3uiv(@GLenum int type, @Check("3") @Const @GLuint IntBuffer coords);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
@StripPostfix("coords")
|
||||
void glTexCoordP4uiv(@GLenum int type, @Check("4") @Const @GLuint IntBuffer coords);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
void glMultiTexCoordP1ui(@GLenum int texture, @GLenum int type, @GLuint int coords);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
void glMultiTexCoordP2ui(@GLenum int texture, @GLenum int type, @GLuint int coords);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
void glMultiTexCoordP3ui(@GLenum int texture, @GLenum int type, @GLuint int coords);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
void glMultiTexCoordP4ui(@GLenum int texture, @GLenum int type, @GLuint int coords);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
@StripPostfix("coords")
|
||||
void glMultiTexCoordP1uiv(@GLenum int texture, @GLenum int type, @Check("1") @Const @GLuint IntBuffer coords);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
@StripPostfix("coords")
|
||||
void glMultiTexCoordP2uiv(@GLenum int texture, @GLenum int type, @Check("2") @Const @GLuint IntBuffer coords);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
@StripPostfix("coords")
|
||||
void glMultiTexCoordP3uiv(@GLenum int texture, @GLenum int type, @Check("3") @Const @GLuint IntBuffer coords);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
@StripPostfix("coords")
|
||||
void glMultiTexCoordP4uiv(@GLenum int texture, @GLenum int type, @Check("4") @Const @GLuint IntBuffer coords);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
void glNormalP3ui(@GLenum int type, @GLuint int coords);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
@StripPostfix("coords")
|
||||
void glNormalP3uiv(@GLenum int type, @Check("3") @Const @GLuint IntBuffer coords);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
void glColorP3ui(@GLenum int type, @GLuint int color);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
void glColorP4ui(@GLenum int type, @GLuint int color);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
@StripPostfix("color")
|
||||
void glColorP3uiv(@GLenum int type, @Check("3") @Const @GLuint IntBuffer color);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
@StripPostfix("color")
|
||||
void glColorP4uiv(@GLenum int type, @Check("4") @Const @GLuint IntBuffer color);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
void glSecondaryColorP3ui(@GLenum int type, @GLuint int color);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
@StripPostfix("color")
|
||||
void glSecondaryColorP3uiv(@GLenum int type, @Check("3") @Const @GLuint IntBuffer color);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
void glVertexAttribP1ui(@GLuint int index, @GLenum int type, boolean normalized, @GLuint int value);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
void glVertexAttribP2ui(@GLuint int index, @GLenum int type, boolean normalized, @GLuint int value);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
void glVertexAttribP3ui(@GLuint int index, @GLenum int type, boolean normalized, @GLuint int value);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
void glVertexAttribP4ui(@GLuint int index, @GLenum int type, boolean normalized, @GLuint int value);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
@StripPostfix("value")
|
||||
void glVertexAttribP1uiv(@GLuint int index, @GLenum int type, boolean normalized, @Check("1") @Const @GLuint IntBuffer value);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
@StripPostfix("value")
|
||||
void glVertexAttribP2uiv(@GLuint int index, @GLenum int type, boolean normalized, @Check("2") @Const @GLuint IntBuffer value);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
@StripPostfix("value")
|
||||
void glVertexAttribP3uiv(@GLuint int index, @GLenum int type, boolean normalized, @Check("3") @Const @GLuint IntBuffer value);
|
||||
|
||||
@Reuse("GL33")
|
||||
@NoErrorCheck
|
||||
@StripPostfix("value")
|
||||
void glVertexAttribP4uiv(@GLuint int index, @GLenum int type, boolean normalized, @Check("4") @Const @GLuint IntBuffer value);
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.DoubleBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
|
@ -71,55 +73,74 @@ public interface ARB_viewport_array {
|
|||
GL_PROVOKING_VERTEX = 0x8E4F,
|
||||
GL_UNDEFINED_VERTEX = 0x8260;
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("v")
|
||||
void glViewportArrayv(@GLuint int first, @AutoSize(value = "v", expression = " >> 2") @GLsizei int count, @Const FloatBuffer v);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glViewportIndexedf(@GLuint int index, float x, float y, float w, float h);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("v")
|
||||
void glViewportIndexedfv(@GLuint int index, @Check("4") @Const FloatBuffer v);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("v")
|
||||
void glScissorArrayv(@GLuint int first, @AutoSize(value = "v", expression = " >> 2") @GLsizei int count, @Const IntBuffer v);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glScissorIndexed(@GLuint int index, int left, int bottom, @GLsizei int width, @GLsizei int height);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("v")
|
||||
void glScissorIndexedv(@GLuint int index, @Check("4") @Const IntBuffer v);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("v")
|
||||
void glDepthRangeArrayv(@GLuint int first, @AutoSize(value = "v", expression = " >> 1") @GLsizei int count, @Const @GLclampd DoubleBuffer v);
|
||||
|
||||
@Reuse("GL41")
|
||||
void glDepthRangeIndexed(@GLuint int index, @GLclampd double n, @GLclampd double f);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("data")
|
||||
void glGetFloati_v(@GLenum int target, @GLuint int index, @Check @OutParameter FloatBuffer data);
|
||||
|
||||
@Reuse("GL41")
|
||||
@Alternate("glGetFloati_v")
|
||||
@GLreturn("data")
|
||||
@StripPostfix("data")
|
||||
void glGetFloati_v2(@GLenum int target, @GLuint int index, @OutParameter FloatBuffer data);
|
||||
|
||||
@Reuse("GL41")
|
||||
@StripPostfix("data")
|
||||
void glGetDoublei_v(@GLenum int target, @GLuint int index, @Check @OutParameter DoubleBuffer data);
|
||||
|
||||
@Reuse("GL41")
|
||||
@Alternate("glGetDoublei_v")
|
||||
@GLreturn("data")
|
||||
@StripPostfix("data")
|
||||
void glGetDoublei_v2(@GLenum int target, @GLuint int index, @OutParameter DoubleBuffer data);
|
||||
|
||||
// TODO: It's glGetIntegerIndexedvEXT in EXT_draw_buffers2, spec typo?
|
||||
//@Reuse(extension = "EXT_draw_buffers2", className = "EXTDrawBuffers2")
|
||||
@StripPostfix(value = "v", extension = "EXT")
|
||||
void glGetIntegerIndexedivEXT(@GLenum int target, @GLuint int index, @Check @OutParameter IntBuffer v);
|
||||
|
||||
// TODO: It's glGetIntegerIndexedvEXT in EXT_draw_buffers2, spec typo?
|
||||
//@Reuse(extension = "EXT_draw_buffers2", className = "EXTDrawBuffers2")
|
||||
@Alternate("glGetIntegerIndexedivEXT")
|
||||
@GLreturn("v")
|
||||
@StripPostfix(value = "v", extension = "EXT")
|
||||
void glGetIntegerIndexedivEXT2(@GLenum int target, @GLuint int index, @OutParameter IntBuffer v);
|
||||
|
||||
@Reuse("EXTDrawBuffers2")
|
||||
void glEnableIndexedEXT(@GLenum int target, @GLuint int index);
|
||||
|
||||
@Reuse("EXTDrawBuffers2")
|
||||
void glDisableIndexedEXT(@GLenum int target, @GLuint int index);
|
||||
|
||||
@Reuse("EXTDrawBuffers2")
|
||||
boolean glIsEnabledIndexedEXT(@GLenum int target, @GLuint int index);
|
||||
|
||||
}
|
|
@ -32,6 +32,9 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
@ -62,5 +65,5 @@ public interface ATI_draw_buffers {
|
|||
void glDrawBuffersATI(@AutoSize("buffers") @GLsizei int size, @Const @GLenum IntBuffer buffers);
|
||||
|
||||
@Alternate("glDrawBuffersATI")
|
||||
void glDrawBuffersATI(@Constant("1") @GLsizei int size, @Constant(value = "APIUtils.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer);
|
||||
void glDrawBuffersATI(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer);
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
import org.lwjgl.util.generator.opengl.GLvoid;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
@ -62,7 +64,7 @@ public interface ATI_map_object_buffer {
|
|||
*/
|
||||
@CachedResult
|
||||
@GLvoid
|
||||
@AutoResultSize("GLChecks.getBufferObjectSizeATI(caps, buffer)")
|
||||
@AutoSize("GLChecks.getBufferObjectSizeATI(caps, buffer)")
|
||||
ByteBuffer glMapObjectBufferATI(@GLuint int buffer);
|
||||
|
||||
void glUnmapObjectBufferATI(@GLuint int buffer);
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
|
||||
public interface ATI_pn_triangles {
|
||||
int GL_PN_TRIANGLES_ATI = 0x87F0;
|
||||
|
|
|
@ -31,7 +31,8 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
public interface ATI_separate_stencil {
|
||||
int GL_STENCIL_BACK_FUNC_ATI = 0x8800;
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
|
||||
public interface ATI_vertex_streams {
|
||||
int GL_MAX_VERTEX_STREAMS_ATI = 0x876B;
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLintptr;
|
||||
import org.lwjgl.util.generator.GLuint;
|
||||
import org.lwjgl.util.generator.opengl.GLintptr;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
public interface EXT_bindable_uniform {
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLclampf;
|
||||
|
||||
public interface EXT_blend_color {
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
|
||||
public interface EXT_blend_equation_separate {
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
|
||||
public interface EXT_blend_func_separate {
|
||||
int GL_BLEND_DST_RGB_EXT = 0x80C8;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
|
||||
public interface EXT_blend_minmax {
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
|
||||
public interface EXT_compiled_vertex_array {
|
||||
int GL_ARRAY_ELEMENT_LOCK_FIRST_EXT = 0x81A8;
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLclampd;
|
||||
|
||||
public interface EXT_depth_bounds_test {
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
@ -598,32 +599,39 @@ public interface EXT_direct_state_access {
|
|||
TODO: Why 1.2.1 and not EXT_draw_buffers2?
|
||||
*/
|
||||
|
||||
@Dependent("GL_EXT_draw_buffers2")
|
||||
@Reuse("EXTDrawBuffers2")
|
||||
@Dependent("OpenGL13")
|
||||
void glEnableIndexedEXT(@GLenum int cap, @GLuint int index);
|
||||
|
||||
@Dependent("GL_EXT_draw_buffers2")
|
||||
@Reuse("EXTDrawBuffers2")
|
||||
@Dependent("OpenGL13")
|
||||
void glDisableIndexedEXT(@GLenum int cap, @GLuint int index);
|
||||
|
||||
@Dependent("GL_EXT_draw_buffers2")
|
||||
@Reuse("EXTDrawBuffers2")
|
||||
@Dependent("OpenGL13")
|
||||
boolean glIsEnabledIndexedEXT(@GLenum int cap, @GLuint int index);
|
||||
|
||||
@Dependent("GL_EXT_draw_buffers2")
|
||||
@Reuse("EXTDrawBuffers2")
|
||||
@Dependent("OpenGL13")
|
||||
@StripPostfix("params")
|
||||
void glGetIntegerIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") IntBuffer params);
|
||||
|
||||
@Reuse("EXTDrawBuffers2")
|
||||
@Alternate("glGetIntegerIndexedvEXT")
|
||||
@GLreturn("params")
|
||||
@Dependent("GL_EXT_draw_buffers2")
|
||||
@Dependent("OpenGL13")
|
||||
@StripPostfix("params")
|
||||
void glGetIntegerIndexedvEXT2(@GLenum int pname, @GLuint int index, @OutParameter IntBuffer params);
|
||||
|
||||
@Dependent("GL_EXT_draw_buffers2")
|
||||
@Reuse("EXTDrawBuffers2")
|
||||
@Dependent("OpenGL13")
|
||||
@StripPostfix("params")
|
||||
void glGetBooleanIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") @GLboolean ByteBuffer params);
|
||||
void glGetBooleanIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("4") @GLboolean ByteBuffer params);
|
||||
|
||||
@Reuse("EXTDrawBuffers2")
|
||||
@Alternate("glGetBooleanIndexedvEXT")
|
||||
@GLreturn("params")
|
||||
@Dependent("GL_EXT_draw_buffers2")
|
||||
@Dependent("OpenGL13")
|
||||
@StripPostfix("params")
|
||||
void glGetBooleanIndexedvEXT2(@GLenum int pname, @GLuint int index, @OutParameter @GLboolean ByteBuffer params);
|
||||
|
||||
|
@ -819,7 +827,7 @@ public interface EXT_direct_state_access {
|
|||
@GLint Buffer img);
|
||||
|
||||
@Dependent("OpenGL13")
|
||||
void glGetCompressedTexImage(@GLenum int target, int lod,
|
||||
void glGetCompressedMultiTexImage(@GLenum int texunit, @GLenum int target, int level,
|
||||
@OutParameter
|
||||
@BufferObject(BufferKind.PackPBO)
|
||||
@Check
|
||||
|
@ -905,7 +913,7 @@ public interface EXT_direct_state_access {
|
|||
@Dependent("OpenGL15")
|
||||
@CachedResult
|
||||
@GLvoid
|
||||
@AutoResultSize("GLChecks.getNamedBufferObjectSize(caps, buffer)")
|
||||
@AutoSize("GLChecks.getNamedBufferObjectSize(caps, buffer)")
|
||||
ByteBuffer glMapNamedBufferEXT(@GLuint int buffer, @GLenum int access);
|
||||
|
||||
@Dependent("OpenGL15")
|
||||
|
@ -923,7 +931,7 @@ public interface EXT_direct_state_access {
|
|||
|
||||
@Dependent("OpenGL15")
|
||||
@StripPostfix("params")
|
||||
@AutoResultSize("GLChecks.getNamedBufferObjectSize(caps, buffer)")
|
||||
@AutoSize("GLChecks.getNamedBufferObjectSize(caps, buffer)")
|
||||
void glGetNamedBufferPointervEXT(@GLuint int buffer, @GLenum int pname, @OutParameter @Result @GLvoid ByteBuffer params);
|
||||
|
||||
@Dependent("OpenGL15")
|
||||
|
@ -1075,7 +1083,7 @@ public interface EXT_direct_state_access {
|
|||
@Alternate("glTextureParameterIivEXT")
|
||||
@Dependent("GL_EXT_texture_integer")
|
||||
@StripPostfix("param")
|
||||
void glTextureParameterIivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtils.getBufferInt().put(0, param), 0", keepParam = true) int param);
|
||||
void glTextureParameterIivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) int param);
|
||||
|
||||
@Dependent("GL_EXT_texture_integer")
|
||||
@StripPostfix("params")
|
||||
|
@ -1084,7 +1092,7 @@ public interface EXT_direct_state_access {
|
|||
@Alternate("glTextureParameterIuivEXT")
|
||||
@Dependent("GL_EXT_texture_integer")
|
||||
@StripPostfix("param")
|
||||
void glTextureParameterIuivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtils.getBufferInt().put(0, param), 0", keepParam = true) @GLuint int param);
|
||||
void glTextureParameterIuivEXT(@GLuint int texture, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) @GLuint int param);
|
||||
|
||||
@Dependent("GL_EXT_texture_integer")
|
||||
@StripPostfix("params")
|
||||
|
@ -1119,7 +1127,7 @@ public interface EXT_direct_state_access {
|
|||
@Alternate("glMultiTexParameterIivEXT")
|
||||
@Dependent("GL_EXT_texture_integer")
|
||||
@StripPostfix("param")
|
||||
void glMultiTexParameterIivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtils.getBufferInt().put(0, param), 0", keepParam = true) int param);
|
||||
void glMultiTexParameterIivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) int param);
|
||||
|
||||
@Dependent("GL_EXT_texture_integer")
|
||||
@StripPostfix("params")
|
||||
|
@ -1128,7 +1136,7 @@ public interface EXT_direct_state_access {
|
|||
@Alternate("glMultiTexParameterIuivEXT")
|
||||
@Dependent("GL_EXT_texture_integer")
|
||||
@StripPostfix("param")
|
||||
void glMultiTexParameterIuivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtils.getBufferInt().put(0, param), 0", keepParam = true) int param);
|
||||
void glMultiTexParameterIuivEXT(@GLenum int texunit, @GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) int param);
|
||||
|
||||
@Dependent("GL_EXT_texture_integer")
|
||||
@StripPostfix("params")
|
||||
|
@ -1505,7 +1513,7 @@ public interface EXT_direct_state_access {
|
|||
@Dependent("OpenGL30")
|
||||
@CachedResult(isRange = true)
|
||||
@GLvoid
|
||||
@AutoResultSize("length")
|
||||
@AutoSize("length")
|
||||
ByteBuffer glMapNamedBufferRangeEXT(@GLuint int buffer, @GLintptr long offset, @GLsizeiptr long length, @GLbitfield int access);
|
||||
|
||||
@Dependent("OpenGL30")
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLboolean;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLreturn;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
import java.nio.ByteBuffer;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.Buffer;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLdouble;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLfloat;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -31,7 +31,9 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLbitfield;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLint;
|
||||
|
||||
public interface EXT_framebuffer_blit {
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
|
||||
public interface EXT_framebuffer_multisample {
|
||||
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLreturn;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
|
@ -131,7 +136,7 @@ public interface EXT_framebuffer_object {
|
|||
void glDeleteRenderbuffersEXT(@AutoSize("renderbuffers") int n, @Const @GLuint IntBuffer renderbuffers);
|
||||
|
||||
@Alternate("glDeleteRenderbuffersEXT")
|
||||
void glDeleteRenderbuffersEXT(@Constant("1") int n, @Constant(value = "APIUtils.getBufferInt().put(0, renderbuffer), 0", keepParam = true) int renderbuffer);
|
||||
void glDeleteRenderbuffersEXT(@Constant("1") int n, @Constant(value = "APIUtil.getBufferInt().put(0, renderbuffer), 0", keepParam = true) int renderbuffer);
|
||||
|
||||
void glGenRenderbuffersEXT(@AutoSize("renderbuffers") int n, @OutParameter @GLuint IntBuffer renderbuffers);
|
||||
|
||||
|
@ -156,7 +161,7 @@ public interface EXT_framebuffer_object {
|
|||
void glDeleteFramebuffersEXT(@AutoSize("framebuffers") int n, @Const @GLuint IntBuffer framebuffers);
|
||||
|
||||
@Alternate("glDeleteFramebuffersEXT")
|
||||
void glDeleteFramebuffersEXT(@Constant("1") int n, @Constant(value = "APIUtils.getBufferInt().put(0, framebuffer), 0", keepParam = true) int framebuffer);
|
||||
void glDeleteFramebuffersEXT(@Constant("1") int n, @Constant(value = "APIUtil.getBufferInt().put(0, framebuffer), 0", keepParam = true) int framebuffer);
|
||||
|
||||
void glGenFramebuffersEXT(@AutoSize("framebuffers") int n, @OutParameter @GLuint IntBuffer framebuffers);
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.GLuint;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
public interface EXT_geometry_shader4 {
|
||||
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
|
||||
public interface EXT_provoking_vertex {
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.Buffer;
|
||||
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLchar;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLbitfield;
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.GLuint;
|
||||
import org.lwjgl.util.generator.opengl.GLbitfield;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
public interface EXT_shader_image_load_store {
|
||||
|
||||
|
|
|
@ -31,7 +31,8 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
public interface EXT_stencil_clear_tag {
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
|
||||
public interface EXT_stencil_two_side {
|
||||
int GL_STENCIL_TEST_TWO_SIDE_EXT = 0x8910;
|
||||
|
|
|
@ -31,8 +31,9 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.GLuint;
|
||||
import org.lwjgl.util.generator.Reuse;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
public interface EXT_texture_array {
|
||||
|
||||
|
@ -83,6 +84,7 @@ public interface EXT_texture_array {
|
|||
int GL_SAMPLER_1D_ARRAY_SHADOW_EXT = 0x8DC3;
|
||||
int GL_SAMPLER_2D_ARRAY_SHADOW_EXT = 0x8DC4;
|
||||
|
||||
@Reuse("EXTGeometryShader4")
|
||||
void glFramebufferTextureLayerEXT(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level, int layer);
|
||||
|
||||
}
|
|
@ -31,8 +31,8 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.GLuint;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
public interface EXT_texture_buffer_object {
|
||||
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLreturn;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
|
@ -114,14 +118,14 @@ public interface EXT_texture_integer {
|
|||
|
||||
@Alternate("glTexParameterIivEXT")
|
||||
@StripPostfix(value = "param", postfix = "v")
|
||||
void glTexParameterIivEXT(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtils.getBufferInt().put(0, param), 0", keepParam = true) int param);
|
||||
void glTexParameterIivEXT(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", 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 = "APIUtils.getBufferInt().put(0, param), 0", keepParam = true) int param);
|
||||
void glTexParameterIuivEXT(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) int param);
|
||||
|
||||
@StripPostfix("params")
|
||||
void glGetTexParameterIivEXT(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params);
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
@ -102,12 +104,12 @@ public interface EXT_transform_feedback {
|
|||
void glEndTransformFeedbackEXT();
|
||||
|
||||
void glTransformFeedbackVaryingsEXT(@GLuint int program, @GLsizei int count,
|
||||
@Const @NullTerminated("count") @GLchar @StringList("count") ByteBuffer varyings,
|
||||
@Const @NullTerminated("count") @GLchar @PointerArray("count") ByteBuffer varyings,
|
||||
@GLenum int bufferMode);
|
||||
|
||||
@Alternate("glTransformFeedbackVaryingsEXT")
|
||||
void glTransformFeedbackVaryingsEXT(@GLuint int program, @Constant("varyings.length") @GLsizei int count,
|
||||
@Const @NullTerminated @StringList("count") CharSequence[] varyings,
|
||||
@Const @NullTerminated @PointerArray("count") CharSequence[] varyings,
|
||||
@GLenum int bufferMode);
|
||||
|
||||
void glGetTransformFeedbackVaryingEXT(@GLuint int program, @GLuint int index, @AutoSize("name") @GLsizei int bufSize,
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.DoubleBuffer;
|
||||
|
@ -81,6 +82,7 @@ public interface EXT_vertex_attrib_64bit {
|
|||
@StripPostfix("params")
|
||||
void glGetVertexAttribLdvEXT(@GLuint int index, @GLenum int pname, @OutParameter @Check("4") DoubleBuffer params);
|
||||
|
||||
@Reuse("ARBVertexAttrib64bit")
|
||||
@Dependent("EXT_direct_state_access")
|
||||
void glVertexArrayVertexAttribLOffsetEXT(@GLuint int vaobj, @GLuint int buffer, @GLuint int index, int size, @GLenum int type, @GLsizei int stride, @GLintptr long offset);
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLfloat;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
@ -782,7 +784,7 @@ public interface GL11 {
|
|||
void glDeleteTextures(@AutoSize("textures") @GLsizei int n, @Const @GLuint IntBuffer textures);
|
||||
|
||||
@Alternate("glDeleteTextures")
|
||||
void glDeleteTextures(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, texture), 0", keepParam = true) int texture);
|
||||
void glDeleteTextures(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, texture), 0", keepParam = true) int texture);
|
||||
|
||||
void glCullFace(@GLenum int mode);
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.Buffer;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
|
@ -95,7 +97,7 @@ public interface GL15 {
|
|||
void glDeleteBuffers(@AutoSize("buffers") @GLsizei int n, @Const @GLuint IntBuffer buffers);
|
||||
|
||||
@Alternate("glDeleteBuffers")
|
||||
void glDeleteBuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer);
|
||||
void glDeleteBuffers(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer);
|
||||
|
||||
void glGenBuffers(@AutoSize("buffers") @GLsizei int n, @OutParameter @GLuint IntBuffer buffers);
|
||||
|
||||
|
@ -156,7 +158,7 @@ public interface GL15 {
|
|||
*/
|
||||
@CachedResult
|
||||
@GLvoid
|
||||
@AutoResultSize("GLChecks.getBufferObjectSize(caps, target)")
|
||||
@AutoSize("GLChecks.getBufferObjectSize(caps, target)")
|
||||
ByteBuffer glMapBuffer(@GLenum int target, @GLenum int access);
|
||||
|
||||
boolean glUnmapBuffer(@GLenum int target);
|
||||
|
@ -170,7 +172,7 @@ public interface GL15 {
|
|||
void glGetBufferParameteriv2(@GLenum int target, @GLenum int pname, @OutParameter IntBuffer params);
|
||||
|
||||
@StripPostfix("pointer")
|
||||
@AutoResultSize("GLChecks.getBufferObjectSize(caps, target)")
|
||||
@AutoSize("GLChecks.getBufferObjectSize(caps, target)")
|
||||
void glGetBufferPointerv(@GLenum int target, @GLenum int pname, @OutParameter @Result @GLvoid ByteBuffer pointer);
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
@ -203,7 +205,7 @@ public interface GL15 {
|
|||
void glDeleteQueries(@AutoSize("ids") @GLsizei int n, @GLuint IntBuffer ids);
|
||||
|
||||
@Alternate("glDeleteQueries")
|
||||
void glDeleteQueries(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, id), 0", keepParam = true) int id);
|
||||
void glDeleteQueries(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, id), 0", keepParam = true) int id);
|
||||
|
||||
boolean glIsQuery(@GLuint int id);
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
@ -105,8 +107,8 @@ public interface GL20 {
|
|||
|
||||
@Alternate(value = "glShaderSource", nativeAlt = true)
|
||||
void glShaderSource3(@GLuint int shader, @Constant("strings.length") @GLsizei int count,
|
||||
@Const @StringList(value = "count", lengths = "length") CharSequence[] strings,
|
||||
@Constant("APIUtils.getLengths(strings), 0") @Const IntBuffer length);
|
||||
@Const @PointerArray(value = "count", lengths = "length") CharSequence[] strings,
|
||||
@Constant("APIUtil.getLengths(strings), 0") @Const IntBuffer length);
|
||||
|
||||
int glCreateShader(@GLuint int type);
|
||||
|
||||
|
@ -255,7 +257,7 @@ public interface GL20 {
|
|||
@Alternate(value = "glGetActiveUniform", javaAlt = true)
|
||||
@GLreturn(value = "name", maxLength = "maxLength")
|
||||
void glGetActiveUniform(@GLuint int program, @GLuint int index, @GLsizei int maxLength,
|
||||
@OutParameter @GLsizei @Constant("name_length, 0, APIUtils.getBufferInt(), 0, APIUtils.getBufferInt(), 1") IntBuffer length,
|
||||
@OutParameter @GLsizei @Constant("name_length, 0, APIUtil.getBufferInt(), 0, APIUtil.getBufferInt(), 1") IntBuffer length,
|
||||
@OutParameter @GLchar ByteBuffer name);
|
||||
|
||||
/** Overloads glGetActiveUniform. This version returns only the uniform size. */
|
||||
|
@ -265,7 +267,7 @@ public interface GL20 {
|
|||
@OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
|
||||
@OutParameter IntBuffer size,
|
||||
@OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore
|
||||
@OutParameter @GLchar @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
|
||||
@OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
|
||||
|
||||
/** Overloads glGetActiveUniform. This version returns only the uniform type. */
|
||||
@Alternate(value = "glGetActiveUniform", javaAlt = true)
|
||||
|
@ -274,7 +276,7 @@ public interface GL20 {
|
|||
@OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
|
||||
@OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore
|
||||
@OutParameter @GLenum IntBuffer type,
|
||||
@OutParameter @GLchar @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
|
||||
@OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
|
||||
|
||||
@StripPostfix("params")
|
||||
void glGetUniformfv(@GLuint int program, int location, @OutParameter @Check FloatBuffer params);
|
||||
|
@ -430,7 +432,7 @@ public interface GL20 {
|
|||
@Alternate(value = "glGetActiveAttrib", javaAlt = true)
|
||||
@GLreturn(value = "name", maxLength = "maxLength")
|
||||
void glGetActiveAttrib(@GLuint int program, @GLuint int index, @GLsizei int maxLength,
|
||||
@OutParameter @GLsizei @Constant("name_length, 0, APIUtils.getBufferInt(), 0, APIUtils.getBufferInt(), 1") IntBuffer length,
|
||||
@OutParameter @GLsizei @Constant("name_length, 0, APIUtil.getBufferInt(), 0, APIUtil.getBufferInt(), 1") IntBuffer length,
|
||||
@OutParameter @GLchar ByteBuffer name);
|
||||
|
||||
/** Overloads glGetActiveAttribARB. This version returns only the attrib size. */
|
||||
|
@ -440,7 +442,7 @@ public interface GL20 {
|
|||
@OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
|
||||
@OutParameter IntBuffer size,
|
||||
@OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore
|
||||
@OutParameter @GLchar @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
|
||||
@OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
|
||||
|
||||
/** Overloads glGetActiveAttrib. This version returns only the attrib type. */
|
||||
@Alternate(value = "glGetActiveAttrib", javaAlt = true)
|
||||
|
@ -449,7 +451,7 @@ public interface GL20 {
|
|||
@OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
|
||||
@OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore
|
||||
@OutParameter @GLenum IntBuffer type,
|
||||
@OutParameter @GLchar @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
|
||||
@OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
|
||||
|
||||
int glGetAttribLocation(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name);
|
||||
|
||||
|
@ -507,7 +509,7 @@ public interface GL20 {
|
|||
void glDrawBuffers(@AutoSize("buffers") @GLsizei int size, @Const @GLenum IntBuffer buffers);
|
||||
|
||||
@Alternate("glDrawBuffers")
|
||||
void glDrawBuffers(@Constant("1") @GLsizei int size, @Constant(value = "APIUtils.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer);
|
||||
void glDrawBuffers(@Constant("1") @GLsizei int size, @Constant(value = "APIUtil.getBufferInt().put(0, buffer), 0", keepParam = true) int buffer);
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// ----------------------[ ARB_point_sprite ]----------------------
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.AutoSize;
|
||||
import org.lwjgl.util.generator.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.StripPostfix;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
@ -294,7 +296,7 @@ public interface GL30 {
|
|||
*/
|
||||
@CachedResult(isRange = true)
|
||||
@GLvoid
|
||||
@AutoResultSize("length")
|
||||
@AutoSize("length")
|
||||
ByteBuffer glMapBufferRange(@GLenum int target, @GLintptr long offset, @GLsizeiptr long length, @GLbitfield int access);
|
||||
|
||||
void glFlushMappedBufferRange(@GLenum int target, @GLintptr long offset, @GLsizeiptr long length);
|
||||
|
@ -526,7 +528,7 @@ public interface GL30 {
|
|||
void glDeleteRenderbuffers(@AutoSize("renderbuffers") int n, @Const @GLuint IntBuffer renderbuffers);
|
||||
|
||||
@Alternate("glDeleteRenderbuffers")
|
||||
void glDeleteRenderbuffers(@Constant("1") int n, @Constant(value = "APIUtils.getBufferInt().put(0, renderbuffer), 0", keepParam = true) int renderbuffer);
|
||||
void glDeleteRenderbuffers(@Constant("1") int n, @Constant(value = "APIUtil.getBufferInt().put(0, renderbuffer), 0", keepParam = true) int renderbuffer);
|
||||
|
||||
void glGenRenderbuffers(@AutoSize("renderbuffers") int n, @OutParameter @GLuint IntBuffer renderbuffers);
|
||||
|
||||
|
@ -551,7 +553,7 @@ public interface GL30 {
|
|||
void glDeleteFramebuffers(@AutoSize("framebuffers") int n, @Const @GLuint IntBuffer framebuffers);
|
||||
|
||||
@Alternate("glDeleteFramebuffers")
|
||||
void glDeleteFramebuffers(@Constant("1") int n, @Constant(value = "APIUtils.getBufferInt().put(0, framebuffer), 0", keepParam = true) int framebuffer);
|
||||
void glDeleteFramebuffers(@Constant("1") int n, @Constant(value = "APIUtil.getBufferInt().put(0, framebuffer), 0", keepParam = true) int framebuffer);
|
||||
|
||||
void glGenFramebuffers(@AutoSize("framebuffers") int n, @OutParameter @GLuint IntBuffer framebuffers);
|
||||
|
||||
|
@ -710,14 +712,14 @@ public interface GL30 {
|
|||
|
||||
@Alternate("glTexParameterIiv")
|
||||
@StripPostfix(value = "param", postfix = "v")
|
||||
void glTexParameterIiv(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtils.getBufferInt().put(0, param), 0", keepParam = true) int param);
|
||||
void glTexParameterIiv(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) int param);
|
||||
|
||||
@StripPostfix("params")
|
||||
void glTexParameterIuiv(@GLenum int target, @GLenum int pname, @Check("4") @GLuint IntBuffer params);
|
||||
|
||||
@Alternate("glTexParameterIuiv")
|
||||
@StripPostfix(value = "param", postfix = "v")
|
||||
void glTexParameterIuiv(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtils.getBufferInt().put(0, param), 0", keepParam = true) int param);
|
||||
void glTexParameterIuiv(@GLenum int target, @GLenum int pname, @Constant(value = "APIUtil.getBufferInt().put(0, param), 0", keepParam = true) int param);
|
||||
|
||||
@StripPostfix("params")
|
||||
void glGetTexParameterIiv(@GLenum int target, @GLenum int pname, @OutParameter @Check("4") IntBuffer params);
|
||||
|
@ -977,12 +979,12 @@ public interface GL30 {
|
|||
void glEndTransformFeedback();
|
||||
|
||||
void glTransformFeedbackVaryings(@GLuint int program, @GLsizei int count,
|
||||
@Const @NullTerminated("count") @GLchar @StringList("count") ByteBuffer varyings,
|
||||
@Const @NullTerminated("count") @GLchar @PointerArray("count") ByteBuffer varyings,
|
||||
@GLenum int bufferMode);
|
||||
|
||||
@Alternate("glTransformFeedbackVaryings")
|
||||
void glTransformFeedbackVaryings(@GLuint int program, @Constant("varyings.length") @GLsizei int count,
|
||||
@Const @NullTerminated @StringList("count") CharSequence[] varyings,
|
||||
@Const @NullTerminated @PointerArray("count") CharSequence[] varyings,
|
||||
@GLenum int bufferMode);
|
||||
|
||||
void glGetTransformFeedbackVarying(@GLuint int program, @GLuint int index, @AutoSize("name") @GLsizei int bufSize,
|
||||
|
@ -1014,7 +1016,7 @@ public interface GL30 {
|
|||
void glDeleteVertexArrays(@AutoSize("arrays") @GLsizei int n, @Const @GLuint IntBuffer arrays);
|
||||
|
||||
@Alternate("glDeleteVertexArrays")
|
||||
void glDeleteVertexArrays(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, array), 0", keepParam = true) int array);
|
||||
void glDeleteVertexArrays(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, array), 0", keepParam = true) int array);
|
||||
|
||||
void glGenVertexArrays(@AutoSize("arrays") @GLsizei int n, @OutParameter @GLuint IntBuffer arrays);
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
|
@ -232,12 +234,12 @@ public interface GL31 {
|
|||
int GL_INVALID_INDEX = 0xFFFFFFFF;
|
||||
|
||||
void glGetUniformIndices(@GLuint int program, @AutoSize("uniformIndices") @GLsizei int uniformCount,
|
||||
@Const @NullTerminated("uniformIndices.remaining()") @GLchar @StringList("uniformCount") ByteBuffer uniformNames,
|
||||
@Const @NullTerminated("uniformIndices.remaining()") @GLchar @PointerArray("uniformCount") ByteBuffer uniformNames,
|
||||
@OutParameter @GLuint IntBuffer uniformIndices);
|
||||
|
||||
@Alternate("glGetUniformIndices")
|
||||
void glGetUniformIndices(@GLuint int program, @Constant("uniformNames.length") @GLsizei int uniformCount,
|
||||
@Const @NullTerminated @StringList("uniformCount") CharSequence[] uniformNames,
|
||||
@Const @NullTerminated @PointerArray("uniformCount") CharSequence[] uniformNames,
|
||||
@OutParameter @Check("uniformNames.length") @GLuint IntBuffer uniformIndices);
|
||||
|
||||
@StripPostfix("params")
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.PointerWrapper;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.FloatBuffer;
|
||||
|
@ -259,8 +262,6 @@ public interface GL32 {
|
|||
|
||||
void glFramebufferTexture(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level);
|
||||
|
||||
void glFramebufferTextureLayer(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level, int layer);
|
||||
|
||||
// --------------------------------------------------------
|
||||
// ----------------------[ ARB_sync ]----------------------
|
||||
// --------------------------------------------------------
|
||||
|
@ -296,17 +297,17 @@ public interface GL32 {
|
|||
int GL_CONDITION_SATISFIED = 0x911C;
|
||||
int GL_WAIT_FAILED = 0x911D;
|
||||
|
||||
@GLpointer("GLsync")
|
||||
@PointerWrapper("GLsync")
|
||||
GLSync glFenceSync(@GLenum int condition, @GLbitfield int flags);
|
||||
|
||||
boolean glIsSync(@GLpointer("GLsync") GLSync sync);
|
||||
boolean glIsSync(@PointerWrapper("GLsync") GLSync sync);
|
||||
|
||||
void glDeleteSync(@GLpointer("GLsync") GLSync sync);
|
||||
void glDeleteSync(@PointerWrapper("GLsync") GLSync sync);
|
||||
|
||||
@GLenum
|
||||
int glClientWaitSync(@GLpointer("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout);
|
||||
int glClientWaitSync(@PointerWrapper("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout);
|
||||
|
||||
void glWaitSync(@GLpointer("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout);
|
||||
void glWaitSync(@PointerWrapper("GLsync") GLSync sync, @GLbitfield int flags, @GLuint64 long timeout);
|
||||
|
||||
@StripPostfix(value = "data", postfix = "64")
|
||||
void glGetInteger64v(@GLenum int pname, @OutParameter @Check("1") @GLint64 LongBuffer data);
|
||||
|
@ -326,14 +327,14 @@ public interface GL32 {
|
|||
void glGetInteger64i_v2(@GLenum int value, @GLuint int index, @OutParameter @GLint64 LongBuffer data);
|
||||
|
||||
@StripPostfix("values")
|
||||
void glGetSynciv(@GLpointer("GLsync") GLSync sync, @GLenum int pname, @AutoSize("values") @GLsizei int bufSize,
|
||||
void glGetSynciv(@PointerWrapper("GLsync") GLSync sync, @GLenum int pname, @AutoSize("values") @GLsizei int bufSize,
|
||||
@OutParameter @GLsizei @Check(value = "1", canBeNull = true) IntBuffer length,
|
||||
@OutParameter IntBuffer values);
|
||||
|
||||
@Alternate("glGetSynciv")
|
||||
@GLreturn("values")
|
||||
@StripPostfix("values")
|
||||
void glGetSynciv2(@GLpointer("GLsync") GLSync sync, @GLenum int pname, @Constant("1") @GLsizei int bufSize,
|
||||
void glGetSynciv2(@PointerWrapper("GLsync") GLSync sync, @GLenum int pname, @Constant("1") @GLsizei int bufSize,
|
||||
@OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
|
||||
@OutParameter IntBuffer values);
|
||||
}
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
|
@ -100,7 +102,7 @@ public interface GL33 {
|
|||
void glDeleteSamplers(@AutoSize("samplers") @GLsizei int count, @Const @GLuint IntBuffer samplers);
|
||||
|
||||
@Alternate("glDeleteSamplers")
|
||||
void glDeleteSamplers(@Constant("1") @GLsizei int count, @Constant(value = "APIUtils.getBufferInt().put(0, sampler), 0", keepParam = true) int sampler);
|
||||
void glDeleteSamplers(@Constant("1") @GLsizei int count, @Constant(value = "APIUtil.getBufferInt().put(0, sampler), 0", keepParam = true) int sampler);
|
||||
|
||||
boolean glIsSampler(@GLuint int sampler);
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.DoubleBuffer;
|
||||
|
@ -401,7 +403,7 @@ public interface GL40 {
|
|||
void glDeleteTransformFeedbacks(@AutoSize("ids") @GLsizei int n, @Const @GLuint IntBuffer ids);
|
||||
|
||||
@Alternate("glDeleteTransformFeedbacks")
|
||||
void glDeleteTransformFeedbacks(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, id), 0", keepParam = true) int id);
|
||||
void glDeleteTransformFeedbacks(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, id), 0", keepParam = true) int id);
|
||||
|
||||
void glGenTransformFeedbacks(@AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids);
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
@ -153,14 +154,14 @@ public interface GL41 {
|
|||
@StripPostfix(value = "strings", postfix = "v")
|
||||
@GLuint
|
||||
int glCreateShaderProgramv(@GLenum int type, @Constant("strings.length") @GLsizei int count,
|
||||
@Const @NullTerminated @StringList(value = "count") CharSequence[] strings);
|
||||
@Const @NullTerminated @PointerArray(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 glDeleteProgramPipelines(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, pipeline), 0", keepParam = true) int pipeline);
|
||||
|
||||
void glGenProgramPipelines(@AutoSize("pipelines") @GLsizei int n, @OutParameter @GLuint IntBuffer pipelines);
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.GLuint;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
public interface NV_conditional_render {
|
||||
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.GLsizei;
|
||||
import org.lwjgl.util.generator.GLuint;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
public interface NV_copy_image {
|
||||
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLfloat;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.FloatBuffer;
|
||||
|
@ -75,17 +77,21 @@ public interface NV_explicit_multisample {
|
|||
int GL_INT_SAMPLER_RENDERBUFFER_NV = 0x8E57;
|
||||
int GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV = 0x8E58;
|
||||
|
||||
@Reuse("EXTDrawBuffers2")
|
||||
@StripPostfix(value = "data", extension = "EXT")
|
||||
void glGetBooleanIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") @GLboolean ByteBuffer data);
|
||||
void glGetBooleanIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("4") @GLboolean ByteBuffer data);
|
||||
|
||||
@Reuse("EXTDrawBuffers2")
|
||||
@Alternate("glGetBooleanIndexedvEXT")
|
||||
@GLreturn("data")
|
||||
@StripPostfix(value = "data", extension = "EXT")
|
||||
void glGetBooleanIndexedvEXT2(@GLenum int pname, @GLuint int index, @OutParameter @GLboolean ByteBuffer data);
|
||||
|
||||
@Reuse("EXTDrawBuffers2")
|
||||
@StripPostfix(value = "data", extension = "EXT")
|
||||
void glGetIntegerIndexedvEXT(@GLenum int pname, @GLuint int index, @OutParameter @Check("16") IntBuffer data);
|
||||
|
||||
@Reuse("EXTDrawBuffers2")
|
||||
@Alternate("glGetIntegerIndexedvEXT")
|
||||
@GLreturn("data")
|
||||
@StripPostfix(value = "data", extension = "EXT")
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLreturn;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
@ -49,7 +54,7 @@ public interface NV_fence {
|
|||
void glDeleteFencesNV(@AutoSize("piFences") @GLsizei int n, @Const @GLuint IntBuffer piFences);
|
||||
|
||||
@Alternate("glDeleteFencesNV")
|
||||
void glDeleteFencesNV(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtils.getBufferInt().put(0, fence), 0", keepParam = true) int fence);
|
||||
void glDeleteFencesNV(@Constant("1") @GLsizei int n, @Const @GLuint @Constant(value = "APIUtil.getBufferInt().put(0, fence), 0", keepParam = true) int fence);
|
||||
|
||||
void glSetFenceNV(@GLuint int fence, @GLenum int condition);
|
||||
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLubyte;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
|
||||
public interface NV_framebuffer_multisample_coverage {
|
||||
|
||||
|
|
|
@ -31,8 +31,9 @@
|
|||
*/
|
||||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.GLenum;
|
||||
import org.lwjgl.util.generator.GLuint;
|
||||
import org.lwjgl.util.generator.Reuse;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
public interface NV_geometry_program4 {
|
||||
|
||||
|
@ -49,10 +50,13 @@ public interface NV_geometry_program4 {
|
|||
|
||||
void glProgramVertexLimitNV(@GLenum int target, int limit);
|
||||
|
||||
@Reuse("EXTGeometryShader4")
|
||||
void glFramebufferTextureEXT(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level);
|
||||
|
||||
@Reuse("EXTGeometryShader4")
|
||||
void glFramebufferTextureLayerEXT(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level, int layer);
|
||||
|
||||
@Reuse("EXTGeometryShader4")
|
||||
void glFramebufferTextureFaceEXT(@GLenum int target, @GLenum int attachment, @GLuint int texture, int level, @GLenum int face);
|
||||
|
||||
}
|
|
@ -32,6 +32,9 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLint64EXT;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
import org.lwjgl.util.generator.opengl.GLuint64EXT;
|
||||
|
||||
import java.nio.LongBuffer;
|
||||
|
||||
|
@ -84,16 +88,16 @@ public interface NV_gpu_shader5 {
|
|||
void glUniform4i64NV(int location, @GLint64EXT long x, @GLint64EXT long y, @GLint64EXT long z, @GLint64EXT long w);
|
||||
|
||||
@StripPostfix("value")
|
||||
void glUniform1i64vNV(int location, @GLsizei int count, @Const @GLint64EXT @Check("1") LongBuffer value);
|
||||
void glUniform1i64vNV(int location, @AutoSize("value") @GLsizei int count, @Const @GLint64EXT LongBuffer value);
|
||||
|
||||
@StripPostfix("value")
|
||||
void glUniform2i64vNV(int location, @GLsizei int count, @Const @GLint64EXT @Check("2") LongBuffer value);
|
||||
void glUniform2i64vNV(int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const @GLint64EXT LongBuffer value);
|
||||
|
||||
@StripPostfix("value")
|
||||
void glUniform3i64vNV(int location, @GLsizei int count, @Const @GLint64EXT @Check("3") LongBuffer value);
|
||||
void glUniform3i64vNV(int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const @GLint64EXT LongBuffer value);
|
||||
|
||||
@StripPostfix("value")
|
||||
void glUniform4i64vNV(int location, @GLsizei int count, @Const @GLint64EXT @Check("4") LongBuffer value);
|
||||
void glUniform4i64vNV(int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const @GLint64EXT LongBuffer value);
|
||||
|
||||
void glUniform1ui64NV(int location, @GLuint64EXT long x);
|
||||
|
||||
|
@ -104,22 +108,22 @@ public interface NV_gpu_shader5 {
|
|||
void glUniform4ui64NV(int location, @GLuint64EXT long x, @GLuint64EXT long y, @GLuint64EXT long z, @GLuint64EXT long w);
|
||||
|
||||
@StripPostfix("value")
|
||||
void glUniform1ui64vNV(int location, @GLsizei int count, @Const @GLuint64EXT @Check("1") LongBuffer value);
|
||||
void glUniform1ui64vNV(int location, @AutoSize("value") @GLsizei int count, @Const @GLuint64EXT LongBuffer value);
|
||||
|
||||
@StripPostfix("value")
|
||||
void glUniform2ui64vNV(int location, @GLsizei int count, @Const @GLuint64EXT @Check("2") LongBuffer value);
|
||||
void glUniform2ui64vNV(int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const @GLuint64EXT LongBuffer value);
|
||||
|
||||
@StripPostfix("value")
|
||||
void glUniform3ui64vNV(int location, @GLsizei int count, @Const @GLuint64EXT @Check("3") LongBuffer value);
|
||||
void glUniform3ui64vNV(int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const @GLuint64EXT LongBuffer value);
|
||||
|
||||
@StripPostfix("value")
|
||||
void glUniform4ui64vNV(int location, @GLsizei int count, @Const @GLuint64EXT @Check("4") LongBuffer value);
|
||||
void glUniform4ui64vNV(int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const @GLuint64EXT LongBuffer value);
|
||||
|
||||
@StripPostfix("params")
|
||||
void glGetUniformi64vNV(@GLuint int program, int location, @GLint64EXT @Check LongBuffer params);
|
||||
void glGetUniformi64vNV(@GLuint int program, int location, @OutParameter @Check("1") @GLint64EXT LongBuffer params);
|
||||
|
||||
@StripPostfix("params")
|
||||
void glGetUniformui64vNV(@GLuint int program, int location, @GLuint64EXT @Check LongBuffer params);
|
||||
void glGetUniformui64vNV(@GLuint int program, int location, @OutParameter @Check("1") @GLuint64EXT LongBuffer params);
|
||||
|
||||
// -------------
|
||||
|
||||
|
@ -137,19 +141,19 @@ public interface NV_gpu_shader5 {
|
|||
|
||||
@Dependent("EXT_direct_state_access")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform1i64vNV(@GLuint int program, int location, @GLsizei int count, @Const @GLint64EXT @Check("1") LongBuffer value);
|
||||
void glProgramUniform1i64vNV(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const @GLint64EXT LongBuffer value);
|
||||
|
||||
@Dependent("EXT_direct_state_access")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform2i64vNV(@GLuint int program, int location, @GLsizei int count, @Const @GLint64EXT @Check("2") LongBuffer value);
|
||||
void glProgramUniform2i64vNV(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const @GLint64EXT LongBuffer value);
|
||||
|
||||
@Dependent("EXT_direct_state_access")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform3i64vNV(@GLuint int program, int location, @GLsizei int count, @Const @GLint64EXT @Check("3") LongBuffer value);
|
||||
void glProgramUniform3i64vNV(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const @GLint64EXT LongBuffer value);
|
||||
|
||||
@Dependent("EXT_direct_state_access")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform4i64vNV(@GLuint int program, int location, @GLsizei int count, @Const @GLint64EXT @Check("4") LongBuffer value);
|
||||
void glProgramUniform4i64vNV(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const @GLint64EXT LongBuffer value);
|
||||
|
||||
@Dependent("EXT_direct_state_access")
|
||||
void glProgramUniform1ui64NV(@GLuint int program, int location, @GLuint64EXT long x);
|
||||
|
@ -165,18 +169,18 @@ public interface NV_gpu_shader5 {
|
|||
|
||||
@Dependent("EXT_direct_state_access")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform1ui64vNV(@GLuint int program, int location, @GLsizei int count, @Const @GLuint64EXT @Check("1") LongBuffer value);
|
||||
void glProgramUniform1ui64vNV(@GLuint int program, int location, @AutoSize("value") @GLsizei int count, @Const @GLuint64EXT LongBuffer value);
|
||||
|
||||
@Dependent("EXT_direct_state_access")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform2ui64vNV(@GLuint int program, int location, @GLsizei int count, @Const @GLuint64EXT @Check("2") LongBuffer value);
|
||||
void glProgramUniform2ui64vNV(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 1") @GLsizei int count, @Const @GLuint64EXT LongBuffer value);
|
||||
|
||||
@Dependent("EXT_direct_state_access")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform3ui64vNV(@GLuint int program, int location, @GLsizei int count, @Const @GLuint64EXT @Check("3") LongBuffer value);
|
||||
void glProgramUniform3ui64vNV(@GLuint int program, int location, @AutoSize(value = "value", expression = " / 3") @GLsizei int count, @Const @GLuint64EXT LongBuffer value);
|
||||
|
||||
@Dependent("EXT_direct_state_access")
|
||||
@StripPostfix("value")
|
||||
void glProgramUniform4ui64vNV(@GLuint int program, int location, @GLsizei int count, @Const @GLuint64EXT @Check("4") LongBuffer value);
|
||||
void glProgramUniform4ui64vNV(@GLuint int program, int location, @AutoSize(value = "value", expression = " >> 2") @GLsizei int count, @Const @GLuint64EXT LongBuffer value);
|
||||
|
||||
}
|
|
@ -32,6 +32,10 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLhalf;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLreturn;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
|
@ -54,7 +59,7 @@ public interface NV_occlusion_query {
|
|||
void glDeleteOcclusionQueriesNV(@AutoSize("piIDs") @GLsizei int n, @Const @GLuint IntBuffer piIDs);
|
||||
|
||||
@Alternate("glDeleteOcclusionQueriesNV")
|
||||
void glDeleteOcclusionQueriesNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, piID), 0", keepParam = true) int piID);
|
||||
void glDeleteOcclusionQueriesNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, piID), 0", keepParam = true) int piID);
|
||||
|
||||
boolean glIsOcclusionQueryNV(@GLuint int id);
|
||||
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
@ForceInit
|
||||
public interface NV_primitive_restart {
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.Buffer;
|
||||
import java.nio.ByteBuffer;
|
||||
|
@ -67,7 +69,7 @@ public interface NV_program {
|
|||
void glDeleteProgramsNV(@AutoSize("programs") @GLsizei int n, @Const @GLuint IntBuffer programs);
|
||||
|
||||
@Alternate("glDeleteProgramsNV")
|
||||
void glDeleteProgramsNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, program), 0", keepParam = true) int program);
|
||||
void glDeleteProgramsNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, program), 0", keepParam = true) int program);
|
||||
|
||||
void glGenProgramsNV(@AutoSize("programs") @GLsizei int n, @OutParameter @GLuint IntBuffer programs);
|
||||
|
||||
|
@ -99,6 +101,6 @@ public interface NV_program {
|
|||
void glRequestResidentProgramsNV(@AutoSize("programIDs") @GLsizei int n, @GLuint IntBuffer programIDs);
|
||||
|
||||
@Alternate("glRequestResidentProgramsNV")
|
||||
void glRequestResidentProgramsNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, programID), 0", keepParam = true) int programID);
|
||||
void glRequestResidentProgramsNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, programID), 0", keepParam = true) int programID);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLreturn;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.LongBuffer;
|
||||
|
||||
|
@ -90,6 +92,7 @@ public interface NV_shader_buffer_load {
|
|||
@StripPostfix("value")
|
||||
void glUniformui64vNV(int location, @AutoSize("value") @GLsizei int count, @Const @GLuint64EXT LongBuffer value);
|
||||
|
||||
@Reuse("NVGpuShader5")
|
||||
@StripPostfix("params")
|
||||
void glGetUniformui64vNV(@GLuint int program, int location, @OutParameter @Check("1") @GLuint64EXT LongBuffer params);
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.IntBuffer;
|
||||
|
@ -150,7 +152,7 @@ public interface NV_transform_feedback {
|
|||
@Alternate(value = "glGetActiveVaryingNV", javaAlt = true)
|
||||
@GLreturn(value = "name", maxLength = "bufSize")
|
||||
void glGetActiveVaryingNV(@GLuint int program, @GLuint int index, @GLsizei int bufSize,
|
||||
@OutParameter @GLsizei @Constant("name_length, 0, APIUtils.getBufferInt(), 0, APIUtils.getBufferInt(), 1") IntBuffer length,
|
||||
@OutParameter @GLsizei @Constant("name_length, 0, APIUtil.getBufferInt(), 0, APIUtil.getBufferInt(), 1") IntBuffer length,
|
||||
@OutParameter @GLchar ByteBuffer name);
|
||||
|
||||
/** Overloads glGetActiveVaryingNV. This version returns only the varying size. */
|
||||
|
@ -160,7 +162,7 @@ public interface NV_transform_feedback {
|
|||
@OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
|
||||
@OutParameter IntBuffer size,
|
||||
@OutParameter @GLenum @Constant("size, 1") IntBuffer type, // Reuse size buffer and ignore
|
||||
@OutParameter @GLchar @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
|
||||
@OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
|
||||
|
||||
/** Overloads glGetActiveVaryingNV. This version returns only the varying type. */
|
||||
@Alternate(value = "glGetActiveVaryingNV", javaAlt = true)
|
||||
|
@ -169,7 +171,7 @@ public interface NV_transform_feedback {
|
|||
@OutParameter @GLsizei @Constant("null, 0") IntBuffer length,
|
||||
@OutParameter @Constant("type, 1") IntBuffer size, // Reuse type buffer and ignore
|
||||
@OutParameter @GLenum IntBuffer type,
|
||||
@OutParameter @GLchar @Constant("APIUtils.getBufferByte(0), 0") ByteBuffer name);
|
||||
@OutParameter @GLchar @Constant("APIUtil.getBufferByte(0), 0") ByteBuffer name);
|
||||
|
||||
void glActiveVaryingNV(@GLuint int program, @NullTerminated @Const @GLchar ByteBuffer name);
|
||||
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.GLenum;
|
||||
import org.lwjgl.util.generator.opengl.GLreturn;
|
||||
import org.lwjgl.util.generator.opengl.GLsizei;
|
||||
import org.lwjgl.util.generator.opengl.GLuint;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
|
@ -54,7 +59,7 @@ public interface NV_transform_feedback2 {
|
|||
void glDeleteTransformFeedbacksNV(@AutoSize("ids") @GLsizei int n, @Const @GLuint IntBuffer ids);
|
||||
|
||||
@Alternate("glDeleteTransformFeedbacksNV")
|
||||
void glDeleteTransformFeedbacksNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtils.getBufferInt().put(0, id), 0", keepParam = true) int id);
|
||||
void glDeleteTransformFeedbacksNV(@Constant("1") @GLsizei int n, @Constant(value = "APIUtil.getBufferInt().put(0, id), 0", keepParam = true) int id);
|
||||
|
||||
void glGenTransformFeedbacksNV(@AutoSize("ids") @GLsizei int n, @OutParameter @GLuint IntBuffer ids);
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
@ -54,7 +55,7 @@ public interface NV_vertex_array_range {
|
|||
|
||||
@PlatformDependent({Platform.WGL, Platform.GLX})
|
||||
@GLvoid
|
||||
@AutoResultSize("size")
|
||||
@AutoSize("size")
|
||||
ByteBuffer glAllocateMemoryNV(int size, float readFrequency, float writeFrequency, float priority);
|
||||
|
||||
@PlatformDependent({Platform.WGL, Platform.GLX})
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.LongBuffer;
|
||||
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.Alternate;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.LongBuffer;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
package org.lwjgl.opengl;
|
||||
|
||||
import org.lwjgl.util.generator.*;
|
||||
import org.lwjgl.util.generator.opengl.*;
|
||||
|
||||
import java.nio.*;
|
||||
|
||||
|
|
Loading…
Reference in New Issue