Added OpenAL & OpenCL generated native paths.

Added support for AMD_device_memory_flags, AMD_offline_devices, AMD_popcnt [OpenCL]
Minor bugs fixed in high-level OpenCL API.
This commit is contained in:
Ioannis Tsakpinis 2011-06-04 00:53:04 +00:00
parent 1dd8817855
commit af0ed1d1c4
12 changed files with 147 additions and 13 deletions

View File

@ -79,6 +79,8 @@
<mapper type="glob" from="*.c" to="*.o"/>
<fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/common/opengl" includes="*.c"/>
<fileset dir="${native}/generated/openal" includes="*.c"/>
<fileset dir="${native}/generated/opencl" includes="*.c"/>
<fileset dir="${native}/generated/opengl" includes="*.c"/>
<fileset dir="${native}/linux" includes="*.c"/>
<fileset dir="${native}/linux/opengl" includes="*.c"/>

View File

@ -79,6 +79,8 @@
<mapper type="glob" from="*.c" to="*.o"/>
<fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/common/opengles" includes="*.c"/>
<fileset dir="${native}/generated/openal" includes="*.c"/>
<fileset dir="${native}/generated/opencl" includes="*.c"/>
<fileset dir="${native}/generated/opengles" includes="*.c"/>
<fileset dir="${native}/linux" includes="*.c"/>
<fileset dir="${native}/linux/opengles" includes="*.c"/>

View File

@ -7,7 +7,7 @@
<mkdir dir="i386"/>
<mkdir dir="x86_64"/>
</target>
<target name="clean">
<delete failonerror="false">
<fileset dir="i386"/>
@ -26,10 +26,12 @@
<fileset dir="${native}/macosx" includes="*.m"/>
<fileset dir="${native}/macosx" includes="*.c"/>
<fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/generated" includes="*.c"/>
<fileset dir="${native}/generated/openal" includes="*.c"/>
<fileset dir="${native}/generated/opencl" includes="*.c"/>
<fileset dir="${native}/generated/opengl" includes="*.c"/>
</apply>
</target>
<target name="link">
<apply dir="${objdir}" parallel="true" executable="${linker}" os="Mac OS X" failonerror="true" skipemptyfilesets="true">
<arg line="${linkerflags} -exported_symbols_list ../lwjgl.symbols -dynamiclib -o ${libname} -framework Foundation -framework AppKit -framework JavaVM -framework Carbon"/>
@ -40,7 +42,7 @@
<fileset dir="." file="${libname}"/>
</apply>
</target>
<target name="nativelibrary" depends="init">
<property name="universal_sdkroot" location="/Developer/SDKs/MacOSX10.4u.sdk"/>
<property name="ppc_sdkroot" location="/Developer/SDKs/MacOSX10.4u.sdk"/>

View File

@ -22,7 +22,9 @@
<srcfile/>
<fileset dir="${native}/windows" includes="*.c"/>
<fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/generated" includes="*.c"/>
<fileset dir="${native}/generated/openal" includes="*.c"/>
<fileset dir="${native}/generated/opencl" includes="*.c"/>
<fileset dir="${native}/generated/opengl" includes="*.c"/>
<mapper type="glob" from="*.c" to="*.o"/>
</apply>
</target>
@ -53,7 +55,7 @@
<fileset dir="." includes="*.dll"/>
</delete>
</target>
<target name="compile">
<property name="libs" value="-lkernel32 -lole32 -lopengl32 -lversion -luser32 -lgdi32 -ladvapi32 -lwinmm"/>
<antcall target="compile_dir"/>

View File

@ -18,6 +18,8 @@
<srcfile/>
<fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/common/opengl" includes="*.c"/>
<fileset dir="${native}/generated/openal" includes="*.c"/>
<fileset dir="${native}/generated/opencl" includes="*.c"/>
<fileset dir="${native}/generated/opengl" includes="*.c"/>
<fileset dir="${native}/windows" includes="*.c"/>
<fileset dir="${native}/windows/opengl" includes="*.c"/>

View File

@ -18,6 +18,8 @@
<srcfile/>
<fileset dir="${native}/common" includes="*.c"/>
<fileset dir="${native}/common/opengles" includes="*.c"/>
<fileset dir="${native}/generated/openal" includes="*.c"/>
<fileset dir="${native}/generated/opencl" includes="*.c"/>
<fileset dir="${native}/generated/opengles" includes="*.c"/>
<fileset dir="${native}/windows" includes="*.c"/>
<fileset dir="${native}/windows/opengles" includes="*.c"/>

View File

@ -453,7 +453,7 @@ final class APIUtil {
*/
static void releaseObjects(final CLDevice device) {
// Release objects only if we're about to hit 0.
if ( device.getReferenceCount() > 1 )
if ( !device.isValid() || device.getReferenceCount() > 1 )
return;
releaseObjects(device.getSubCLDeviceRegistry(), DESTRUCTOR_CLSubDevice);
@ -466,7 +466,7 @@ final class APIUtil {
*/
static void releaseObjects(final CLContext context) {
// Release objects only if we're about to hit 0.
if ( context.getReferenceCount() > 1 )
if ( !context.isValid() || context.getReferenceCount() > 1 )
return;
releaseObjects(context.getCLEventRegistry(), DESTRUCTOR_CLEvent);
@ -483,7 +483,7 @@ final class APIUtil {
*/
static void releaseObjects(final CLProgram program) {
// Release objects only if we're about to hit 0.
if ( program.getReferenceCount() > 1 )
if ( !program.isValid() || program.getReferenceCount() > 1 )
return;
releaseObjects(program.getCLKernelRegistry(), DESTRUCTOR_CLKernel);
@ -496,7 +496,7 @@ final class APIUtil {
*/
static void releaseObjects(final CLCommandQueue queue) {
// Release objects only if we're about to hit 0.
if ( queue.getReferenceCount() > 1 )
if ( !queue.isValid() || queue.getReferenceCount() > 1 )
return;
releaseObjects(queue.getCLEventRegistry(), DESTRUCTOR_CLEvent);

View File

@ -118,7 +118,7 @@ final class InfoUtilFactory {
final long user_data = pfn_notify == null || pfn_notify.isCustom() ? 0 : CallbackUtil.createGlobalRef(pfn_notify);
CLContext __result = null;
try {
__result = new CLContext(nclCreateContext(properties.getBuffer(), 0, devices.size(), properties.getBuffer(), propertyCount * PointerBuffer.getPointerSize(), pfn_notify == null ? 0 : pfn_notify.getPointer(), user_data, errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), platform);
__result = new CLContext(nclCreateContext(properties.getBuffer(), 0, devices.size(), properties.getBuffer(), propertyCount, pfn_notify == null ? 0 : pfn_notify.getPointer(), user_data, errcode_ret, errcode_ret != null ? errcode_ret.position() : 0, function_pointer), platform);
if ( LWJGLUtil.DEBUG )
Util.checkCLError(errcode_ret.get(0));
return __result;

View File

@ -395,7 +395,8 @@ public final class SpriteShootoutCL {
}
private void destroy() {
clReleaseContext(clContext);
if ( clContext != null )
clReleaseContext(clContext);
Display.destroy();
System.exit(0);
}
@ -422,7 +423,6 @@ public final class SpriteShootoutCL {
kernel.setArg(0, SCREEN_WIDTH);
kernel.setArg(1, SCREEN_HEIGHT);
kernel.setArg(2, ballSize * 0.5f);
}
protected void createProgram(final int vshID) {

View File

@ -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 AMD_device_memory_flags {
/** Alloc from GPU's CPU visible heap. */
int CL_MEM_USE_PERSISTENT_MEM_AMD = (1 << 6);
}

View File

@ -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.opencl;
import org.lwjgl.util.generator.opencl.CLDeviceExtension;
@CLDeviceExtension
public interface AMD_offline_devices {
int CL_CONTEXT_OFFLINE_DEVICES_AMD = 0x403F;
}

View File

@ -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_popcnt {
}