diff options
author | Michael Bien <[email protected]> | 2010-05-31 19:51:46 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2010-05-31 19:51:46 +0200 |
commit | c5b1dc47f398597a127ebb7cdf72ab324b08a174 (patch) | |
tree | 690599a569f5f5a78f190eff45e414b4574759fd | |
parent | 8a5bbd80a3ffc3154b637e0b6c40342dfacb3576 (diff) |
changes due to gluegen size_t fix. Switched back to PointerBuffer. 32bit systems are now supported again.
-rw-r--r-- | resources/clImplCustomCode.java | 4 | ||||
-rw-r--r-- | resources/stubs_includes/common/stddef.h | 5 | ||||
-rw-r--r-- | resources/stubs_includes/common/stdint.h | 2 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLCommandQueue.java | 47 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLContext.java | 3 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLDevice.java | 4 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLEvent.java | 6 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLImage.java | 4 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLInfoAccessor.java | 12 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLKernel.java | 4 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLPlatform.java | 4 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLProgram.java | 23 | ||||
-rw-r--r-- | src/com/jogamp/opencl/CLSampler.java | 4 | ||||
-rw-r--r-- | test/com/jogamp/opencl/CLProgramTest.java | 12 | ||||
-rw-r--r-- | test/com/jogamp/opencl/LowLevelBindingTest.java | 21 |
15 files changed, 74 insertions, 81 deletions
diff --git a/resources/clImplCustomCode.java b/resources/clImplCustomCode.java index 4f9f4c2e..654df082 100644 --- a/resources/clImplCustomCode.java +++ b/resources/clImplCustomCode.java @@ -91,8 +91,8 @@ @param event a direct {@link com.jogamp.common.nio.PointerBuffer} @param errcode_ret a direct {@link java.nio.IntBuffer} */ public java.nio.ByteBuffer clEnqueueMapImage(long command_queue, long image, int blocking_map, long map_flags, - Int64Buffer origin, Int64Buffer range, - Int64Buffer image_row_pitch, Int64Buffer image_slice_pitch, + PointerBuffer origin, PointerBuffer range, + PointerBuffer image_row_pitch, PointerBuffer image_slice_pitch, int num_events_in_wait_list, PointerBuffer event_wait_list, PointerBuffer event, java.nio.IntBuffer errcode_ret) { diff --git a/resources/stubs_includes/common/stddef.h b/resources/stubs_includes/common/stddef.h index da2325af..c05f1d44 100644 --- a/resources/stubs_includes/common/stddef.h +++ b/resources/stubs_includes/common/stddef.h @@ -1,3 +1,4 @@ + #if defined(_WIN64) typedef __int64 ptrdiff_t; #elif defined(__ia64__) || defined(__x86_64__) @@ -7,4 +8,6 @@ #endif #define NULL ((void *)0) - typedef int wchar_t; + +typedef int wchar_t; +typedef unsigned long size_t;
\ No newline at end of file diff --git a/resources/stubs_includes/common/stdint.h b/resources/stubs_includes/common/stdint.h index 5c2a4a2e..d6a5dd23 100644 --- a/resources/stubs_includes/common/stdint.h +++ b/resources/stubs_includes/common/stdint.h @@ -18,8 +18,6 @@ typedef long intptr_t; typedef unsigned long uintptr_t; - typedef unsigned long size_t; - /* Greatest-width integer types */ /* Modern GCCs provide __INTMAX_TYPE__ */ #if defined(__INTMAX_TYPE__) diff --git a/src/com/jogamp/opencl/CLCommandQueue.java b/src/com/jogamp/opencl/CLCommandQueue.java index 288e5b00..def422e0 100644 --- a/src/com/jogamp/opencl/CLCommandQueue.java +++ b/src/com/jogamp/opencl/CLCommandQueue.java @@ -1,6 +1,5 @@ package com.jogamp.opencl; -import com.jogamp.common.nio.Int64Buffer; import com.jogamp.opencl.gl.CLGLI; import com.jogamp.common.nio.PointerBuffer; import java.nio.ByteBuffer; @@ -33,9 +32,9 @@ public class CLCommandQueue extends CLObject implements CLResource { * Those direct memory buffers are used to move data between the JVM and OpenCL. */ private final PointerBuffer pbA; - private final Int64Buffer ibA; - private final Int64Buffer ibB; - private final Int64Buffer ibC; + private final PointerBuffer ibA; + private final PointerBuffer ibB; + private final PointerBuffer ibC; private CLCommandQueue(CLContext context, long id, CLDevice device, long properties) { super(context, id); @@ -43,9 +42,9 @@ public class CLCommandQueue extends CLObject implements CLResource { this.device = device; this.properties = properties; - this.ibA = Int64Buffer.allocateDirect(3); - this.ibB = Int64Buffer.allocateDirect(3); - this.ibC = Int64Buffer.allocateDirect(3); + this.ibA = PointerBuffer.allocateDirect(3); + this.ibB = PointerBuffer.allocateDirect(3); + this.ibC = PointerBuffer.allocateDirect(3); this.pbA = PointerBuffer.allocateDirect(1); @@ -1171,9 +1170,9 @@ public class CLCommandQueue extends CLObject implements CLResource { * Calls {@native clEnqueueNDRangeKernel}. */ public CLCommandQueue put1DRangeKernel(CLKernel kernel, long globalWorkOffset, long globalWorkSize, long localWorkSize, CLEventList condition, CLEventList events) { - Int64Buffer globWO = null; - Int64Buffer globWS = null; - Int64Buffer locWS = null; + PointerBuffer globWO = null; + PointerBuffer globWS = null; + PointerBuffer locWS = null; if(globalWorkOffset != 0) { globWO = copy2NIO(ibA, globalWorkOffset); @@ -1222,9 +1221,9 @@ public class CLCommandQueue extends CLObject implements CLResource { public CLCommandQueue put2DRangeKernel(CLKernel kernel, long globalWorkOffsetX, long globalWorkOffsetY, long globalWorkSizeX, long globalWorkSizeY, long localWorkSizeX, long localWorkSizeY, CLEventList condition, CLEventList events) { - Int64Buffer globalWorkOffset = null; - Int64Buffer globalWorkSize = null; - Int64Buffer localWorkSize = null; + PointerBuffer globalWorkOffset = null; + PointerBuffer globalWorkSize = null; + PointerBuffer localWorkSize = null; if(globalWorkOffsetX != 0 && globalWorkOffsetY != 0) { globalWorkOffset = copy2NIO(ibA, globalWorkOffsetX, globalWorkOffsetY); @@ -1242,7 +1241,7 @@ public class CLCommandQueue extends CLObject implements CLResource { /** * Calls {@native clEnqueueNDRangeKernel}. */ - public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, Int64Buffer globalWorkOffset, Int64Buffer globalWorkSize, Int64Buffer localWorkSize) { + public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, PointerBuffer globalWorkOffset, PointerBuffer globalWorkSize, PointerBuffer localWorkSize) { this.putNDRangeKernel(kernel, workDimension, globalWorkOffset, globalWorkSize, localWorkSize, null, null); return this; } @@ -1250,7 +1249,7 @@ public class CLCommandQueue extends CLObject implements CLResource { /** * Calls {@native clEnqueueNDRangeKernel}. */ - public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, Int64Buffer globalWorkOffset, Int64Buffer globalWorkSize, Int64Buffer localWorkSize, CLEventList events) { + public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, PointerBuffer globalWorkOffset, PointerBuffer globalWorkSize, PointerBuffer localWorkSize, CLEventList events) { this.putNDRangeKernel(kernel, workDimension, globalWorkOffset, globalWorkSize, localWorkSize, null, events); return this; } @@ -1258,8 +1257,8 @@ public class CLCommandQueue extends CLObject implements CLResource { /** * Calls {@native clEnqueueNDRangeKernel}. */ - public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, Int64Buffer globalWorkOffset, - Int64Buffer globalWorkSize, Int64Buffer localWorkSize, CLEventList condition, CLEventList events) { + public CLCommandQueue putNDRangeKernel(CLKernel kernel, int workDimension, PointerBuffer globalWorkOffset, + PointerBuffer globalWorkSize, PointerBuffer localWorkSize, CLEventList condition, CLEventList events) { PointerBuffer conditionIDs = null; int conditions = 0; @@ -1439,19 +1438,15 @@ public class CLCommandQueue extends CLObject implements CLResource { // return buffer.rewind().put(a).put(b).put(c).rewind(); // } - private static Int64Buffer copy2NIO(Int64Buffer buffer, long a) { - return (Int64Buffer) buffer.put(2, a).position(2); + private static PointerBuffer copy2NIO(PointerBuffer buffer, long a, long b) { + return (PointerBuffer) ((PointerBuffer)buffer.position(1)).put(a).put(b).position(1); } - private static Int64Buffer copy2NIO(Int64Buffer buffer, long a, long b) { - return (Int64Buffer) ((Int64Buffer)buffer.position(1)).put(a).put(b).position(1); + private static PointerBuffer copy2NIO(PointerBuffer buffer, long a, long b, long c) { + return (PointerBuffer) ((PointerBuffer)buffer.rewind()).put(a).put(b).put(c).rewind(); } - private static Int64Buffer copy2NIO(Int64Buffer buffer, long a, long b, long c) { - return (Int64Buffer) ((Int64Buffer)buffer.rewind()).put(a).put(b).put(c).rewind(); - } - - private static String toStr(Int64Buffer buffer) { + private static String toStr(PointerBuffer buffer) { if(buffer == null) { return null; } diff --git a/src/com/jogamp/opencl/CLContext.java b/src/com/jogamp/opencl/CLContext.java index b200e3a5..72694d61 100644 --- a/src/com/jogamp/opencl/CLContext.java +++ b/src/com/jogamp/opencl/CLContext.java @@ -4,7 +4,6 @@ import com.jogamp.opencl.CLDevice.Type; import com.jogamp.opencl.CLMemory.Mem; import com.jogamp.opencl.CLSampler.AddressingMode; import com.jogamp.opencl.CLSampler.FilteringMode; -import com.jogamp.common.nio.Int64Buffer; import com.jogamp.common.nio.PointerBuffer; import java.io.BufferedReader; import java.io.IOException; @@ -72,7 +71,7 @@ public class CLContext extends CLObject implements CLResource { if (devices == null) { - Int64Buffer deviceCount = Int64Buffer.allocateDirect(1); + PointerBuffer deviceCount = PointerBuffer.allocateDirect(1); int ret = cl.clGetContextInfo(ID, CL.CL_CONTEXT_DEVICES, 0, null, deviceCount); checkForError(ret, "can not enumerate devices"); diff --git a/src/com/jogamp/opencl/CLDevice.java b/src/com/jogamp/opencl/CLDevice.java index 3b26e507..99ef3fe9 100644 --- a/src/com/jogamp/opencl/CLDevice.java +++ b/src/com/jogamp/opencl/CLDevice.java @@ -1,7 +1,7 @@ package com.jogamp.opencl; import com.jogamp.opencl.util.CLUtil; -import com.jogamp.common.nio.Int64Buffer; +import com.jogamp.common.nio.PointerBuffer; import com.jogamp.common.os.Platform; import java.nio.Buffer; import java.nio.ByteBuffer; @@ -516,7 +516,7 @@ public final class CLDevice extends CLObject { private final class CLDeviceInfoAccessor extends CLInfoAccessor { @Override - protected int getInfo(int name, long valueSize, Buffer value, Int64Buffer valueSizeRet) { + protected int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) { return cl.clGetDeviceInfo(ID, name, valueSize, value, valueSizeRet); } diff --git a/src/com/jogamp/opencl/CLEvent.java b/src/com/jogamp/opencl/CLEvent.java index 46b92a6d..bf4ac690 100644 --- a/src/com/jogamp/opencl/CLEvent.java +++ b/src/com/jogamp/opencl/CLEvent.java @@ -1,6 +1,6 @@ package com.jogamp.opencl; -import com.jogamp.common.nio.Int64Buffer; +import com.jogamp.common.nio.PointerBuffer; import java.nio.Buffer; import static com.jogamp.opencl.CL.*; @@ -93,7 +93,7 @@ public class CLEvent extends CLObject implements CLResource { private class CLEventInfoAccessor extends CLInfoAccessor { @Override - protected int getInfo(int name, long valueSize, Buffer value, Int64Buffer valueSizeRet) { + protected int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) { return cl.clGetEventInfo(ID, name, valueSize, value, valueSizeRet); } @@ -102,7 +102,7 @@ public class CLEvent extends CLObject implements CLResource { private class CLEventProfilingInfoAccessor extends CLInfoAccessor { @Override - protected int getInfo(int name, long valueSize, Buffer value, Int64Buffer valueSizeRet) { + protected int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) { return cl.clGetEventProfilingInfo(ID, name, valueSize, value, valueSizeRet); } diff --git a/src/com/jogamp/opencl/CLImage.java b/src/com/jogamp/opencl/CLImage.java index f8916fdb..cc1eb59e 100644 --- a/src/com/jogamp/opencl/CLImage.java +++ b/src/com/jogamp/opencl/CLImage.java @@ -1,6 +1,6 @@ package com.jogamp.opencl; -import com.jogamp.common.nio.Int64Buffer; +import com.jogamp.common.nio.PointerBuffer; import java.nio.Buffer; import static com.jogamp.opencl.CL.*; @@ -81,7 +81,7 @@ public abstract class CLImage<B extends Buffer> extends CLMemory<B> { this.id = id; } @Override - public int getInfo(int name, long valueSize, Buffer value, Int64Buffer valueSizeRet) { + public int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) { return cl.clGetImageInfo(id, name, valueSize, value, valueSizeRet); } } diff --git a/src/com/jogamp/opencl/CLInfoAccessor.java b/src/com/jogamp/opencl/CLInfoAccessor.java index 56f2318d..8db06d38 100644 --- a/src/com/jogamp/opencl/CLInfoAccessor.java +++ b/src/com/jogamp/opencl/CLInfoAccessor.java @@ -1,7 +1,7 @@ package com.jogamp.opencl; import com.jogamp.common.nio.Buffers; -import com.jogamp.common.nio.Int64Buffer; +import com.jogamp.common.nio.PointerBuffer; import com.jogamp.opencl.util.CLUtil; import java.nio.Buffer; import java.nio.ByteBuffer; @@ -23,11 +23,11 @@ abstract class CLInfoAccessor { } }; - protected final static ThreadLocal<Int64Buffer> localPB = new ThreadLocal<Int64Buffer>() { + protected final static ThreadLocal<PointerBuffer> localPB = new ThreadLocal<PointerBuffer>() { @Override - protected Int64Buffer initialValue() { - return Int64Buffer.allocateDirect(1); + protected PointerBuffer initialValue() { + return PointerBuffer.allocateDirect(1); } }; @@ -44,7 +44,7 @@ abstract class CLInfoAccessor { public final String getString(int key) { ByteBuffer buffer = localBB.get(); - Int64Buffer sizeBuffer = localPB.get(); + PointerBuffer sizeBuffer = localPB.get(); int ret = getInfo(key, buffer.capacity(), buffer, sizeBuffer); checkForError(ret, "error while asking for info string"); @@ -56,7 +56,7 @@ abstract class CLInfoAccessor { } - protected abstract int getInfo(int name, long valueSize, Buffer value, Int64Buffer valueSizeRet); + protected abstract int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet); } diff --git a/src/com/jogamp/opencl/CLKernel.java b/src/com/jogamp/opencl/CLKernel.java index f3a8684f..8fa000dc 100644 --- a/src/com/jogamp/opencl/CLKernel.java +++ b/src/com/jogamp/opencl/CLKernel.java @@ -2,7 +2,7 @@ package com.jogamp.opencl; import com.jogamp.opencl.util.CLUtil; import com.jogamp.common.nio.Buffers; -import com.jogamp.common.nio.Int64Buffer; +import com.jogamp.common.nio.PointerBuffer; import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.ByteOrder; @@ -39,7 +39,7 @@ public class CLKernel extends CLObject implements CLResource, Cloneable { this.program = program; this.buffer = Buffers.newDirectByteBuffer((is32Bit()?4:8)*3); - Int64Buffer size = Int64Buffer.allocateDirect(1); + PointerBuffer size = PointerBuffer.allocateDirect(1); // get function name int ret = cl.clGetKernelInfo(ID, CL_KERNEL_FUNCTION_NAME, 0, null, size); diff --git a/src/com/jogamp/opencl/CLPlatform.java b/src/com/jogamp/opencl/CLPlatform.java index e2ece1ef..60eb2db0 100644 --- a/src/com/jogamp/opencl/CLPlatform.java +++ b/src/com/jogamp/opencl/CLPlatform.java @@ -45,7 +45,7 @@ public final class CLPlatform { static{ try { -// new UnixDynamicLinkerImpl().openLibraryGlobal("/usr/lib/jvm/java-6-sun/jre/lib/amd64/lbjsig.so", true); +// new UnixDynamicLinkerImpl().openLibraryGlobal("/usr/lib/jvm/java-6-sun/jre/lib/amd64/libjsig.so", true); // run the whole static initialization privileged to speed up, // since this skips checking further access @@ -283,7 +283,7 @@ public final class CLPlatform { * Returns a info string in exchange for a key (CL_PLATFORM_*). */ public String getInfoString(int key) { - Int64Buffer size = Int64Buffer.allocateDirect(1); + PointerBuffer size = PointerBuffer.allocateDirect(1); // TODO use cache/query size ByteBuffer bb = ByteBuffer.allocateDirect(512); diff --git a/src/com/jogamp/opencl/CLProgram.java b/src/com/jogamp/opencl/CLProgram.java index 7ccc3bc8..c56c04c9 100644 --- a/src/com/jogamp/opencl/CLProgram.java +++ b/src/com/jogamp/opencl/CLProgram.java @@ -2,7 +2,6 @@ package com.jogamp.opencl; import com.jogamp.opencl.util.CLProgramConfiguration; import com.jogamp.opencl.util.CLUtil; -import com.jogamp.common.nio.Int64Buffer; import com.jogamp.common.os.Platform; import com.jogamp.common.nio.PointerBuffer; import com.jogamp.opencl.impl.BuildProgramCallback; @@ -49,7 +48,7 @@ public class CLProgram extends CLObject implements CLResource { IntBuffer status = newDirectByteBuffer(4).asIntBuffer(); // Create the program long id = context.cl.clCreateProgramWithSource(context.ID, 1, new String[] {src}, - (Int64Buffer)Int64Buffer.allocateDirect(1).put(src.length()), status); + (PointerBuffer)PointerBuffer.allocateDirect(1).put(src.length()), status); int err = status.get(); if(err != CL_SUCCESS) { @@ -63,7 +62,7 @@ public class CLProgram extends CLObject implements CLResource { PointerBuffer devices = PointerBuffer.allocateDirect(binaries.size()); PointerBuffer codeBuffers = PointerBuffer.allocateDirect(binaries.size()); - Int64Buffer lengths = Int64Buffer.allocateDirect(binaries.size()); + PointerBuffer lengths = PointerBuffer.allocateDirect(binaries.size()); int i = 0; Set<CLDevice> keys = binaries.keySet(); @@ -120,7 +119,7 @@ public class CLProgram extends CLObject implements CLResource { return ""; } - Int64Buffer size = Int64Buffer.allocateDirect(1); + PointerBuffer size = PointerBuffer.allocateDirect(1); int ret = cl.clGetProgramBuildInfo(ID, device.ID, flag, 0, null, size); if(ret != CL_SUCCESS) { @@ -143,7 +142,7 @@ public class CLProgram extends CLObject implements CLResource { return ""; } - Int64Buffer size = Int64Buffer.allocateDirect(1); + PointerBuffer size = PointerBuffer.allocateDirect(1); int ret = cl.clGetProgramInfo(ID, flag, 0, null, size); checkForError(ret, "on clGetProgramInfo"); @@ -462,7 +461,7 @@ public class CLProgram extends CLObject implements CLResource { if(released) { return new CLDevice[0]; } - Int64Buffer size = Int64Buffer.allocateDirect(1); + PointerBuffer size = PointerBuffer.allocateDirect(1); int ret = cl.clGetProgramInfo(ID, CL_PROGRAM_DEVICES, 0, null, size); if(ret != CL_SUCCESS) { throw newException(ret, "on clGetProgramInfo of "+this); @@ -567,15 +566,15 @@ public class CLProgram extends CLObject implements CLResource { CLDevice[] devices = getCLDevices(); - ByteBuffer sizes = newDirectByteBuffer(8*devices.length); - int ret = cl.clGetProgramInfo(ID, CL_PROGRAM_BINARY_SIZES, sizes.capacity(), sizes, null); + PointerBuffer sizes = PointerBuffer.allocateDirect(devices.length); + int ret = cl.clGetProgramInfo(ID, CL_PROGRAM_BINARY_SIZES, sizes.capacity()*PointerBuffer.elementSize(), sizes.getBuffer(), null); if(ret != CL_SUCCESS) { throw newException(ret, "on clGetProgramInfo(CL_PROGRAM_BINARY_SIZES) of "+this); } int binariesSize = 0; while(sizes.remaining() != 0) { - int size = (int) sizes.getLong(); + int size = (int) sizes.get(); binariesSize += size; } ByteBuffer binaries = newDirectByteBuffer(binariesSize); @@ -586,10 +585,10 @@ public class CLProgram extends CLObject implements CLResource { sizes.rewind(); while(sizes.remaining() != 0) { addresses.put(address); - address += sizes.getLong(); + address += sizes.get(); } - ret = cl.clGetProgramInfo(ID, CL_PROGRAM_BINARIES, addresses.capacity(), addresses.getBuffer(), null); + ret = cl.clGetProgramInfo(ID, CL_PROGRAM_BINARIES, addresses.capacity()*PointerBuffer.elementSize(), addresses.getBuffer(), null); if(ret != CL_SUCCESS) { throw newException(ret, "on clGetProgramInfo(CL_PROGRAM_BINARIES) of "+this); } @@ -597,7 +596,7 @@ public class CLProgram extends CLObject implements CLResource { Map<CLDevice, byte[]> map = new LinkedHashMap<CLDevice, byte[]>(); sizes.rewind(); for (int i = 0; i < devices.length; i++) { - byte[] bytes = new byte[(int)sizes.getLong()]; + byte[] bytes = new byte[(int)sizes.get()]; binaries.get(bytes); map.put(devices[i], bytes); } diff --git a/src/com/jogamp/opencl/CLSampler.java b/src/com/jogamp/opencl/CLSampler.java index 5f6a9485..cd5001bf 100644 --- a/src/com/jogamp/opencl/CLSampler.java +++ b/src/com/jogamp/opencl/CLSampler.java @@ -1,6 +1,6 @@ package com.jogamp.opencl; -import com.jogamp.common.nio.Int64Buffer; +import com.jogamp.common.nio.PointerBuffer; import java.nio.Buffer; @@ -60,7 +60,7 @@ public class CLSampler extends CLObject implements CLResource { private class CLSamplerInfoAccessor extends CLInfoAccessor { @Override - protected int getInfo(int name, long valueSize, Buffer value, Int64Buffer valueSizeRet) { + protected int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) { return cl.clGetSamplerInfo(ID, name, valueSize, value, valueSizeRet); } diff --git a/test/com/jogamp/opencl/CLProgramTest.java b/test/com/jogamp/opencl/CLProgramTest.java index b25230f8..fd98e78e 100644 --- a/test/com/jogamp/opencl/CLProgramTest.java +++ b/test/com/jogamp/opencl/CLProgramTest.java @@ -189,7 +189,7 @@ public class CLProgramTest { .withDefine("ENABLE_FOOBAR"); out.println(builder); - + // async build test { final CountDownLatch countdown = new CountDownLatch(1); @@ -233,7 +233,7 @@ public class CLProgramTest { program = programConfig.build(); assertTrue(program.isExecutable()); - + // cloneing assertEquals(builder, builder.clone()); @@ -277,5 +277,13 @@ public class CLProgramTest { } +// @Test + public void loadTest() throws IOException, ClassNotFoundException, InterruptedException { + for(int i = 0; i < 100; i++) { + rebuildProgramTest(); + builderTest(); + programBinariesTest(); + } + } } diff --git a/test/com/jogamp/opencl/LowLevelBindingTest.java b/test/com/jogamp/opencl/LowLevelBindingTest.java index af72c46f..e7ffadba 100644 --- a/test/com/jogamp/opencl/LowLevelBindingTest.java +++ b/test/com/jogamp/opencl/LowLevelBindingTest.java @@ -2,7 +2,6 @@ package com.jogamp.opencl; import java.util.Random; import com.jogamp.opencl.impl.BuildProgramCallback; -import com.jogamp.common.nio.Int64Buffer; import com.jogamp.common.nio.PointerBuffer; import java.nio.ByteBuffer; @@ -87,7 +86,7 @@ public class LowLevelBindingTest { checkForError(ret); // print platform info - Int64Buffer longBuffer = Int64Buffer.allocateDirect(1); + PointerBuffer longBuffer = PointerBuffer.allocateDirect(1); ByteBuffer bb = newDirectByteBuffer(128); for (int i = 0; i < platformId.capacity(); i++) { @@ -167,7 +166,7 @@ public class LowLevelBindingTest { checkError("on clCreateContext", intBuffer.get()); //get number of devices - Int64Buffer longBuffer = Int64Buffer.allocateDirect(1); + PointerBuffer longBuffer = PointerBuffer.allocateDirect(1); ret = cl.clGetContextInfo(context, CL.CL_CONTEXT_DEVICES, 0, null, longBuffer); checkError("on clGetContextInfo", ret); @@ -186,15 +185,6 @@ public class LowLevelBindingTest { out.println(" - - - lowLevelTest2; VectorAdd kernel - - - "); -// CreateContextCallback cb = new CreateContextCallback() { -// @Override -// public void createContextCallback(String errinfo, ByteBuffer private_info, long cb, Object user_data) { -// throw new RuntimeException("not yet implemented..."); -// } -// }; - - Int64Buffer longBuffer = Int64Buffer.allocateDirect(1); - CL cl = CLPlatform.getLowLevelCLInterface(); int ret = CL.CL_SUCCESS; @@ -217,6 +207,7 @@ public class LowLevelBindingTest { out.println("context handle: "+context); checkError("on clCreateContextFromType", ret); + PointerBuffer longBuffer = PointerBuffer.allocateDirect(1); ret = cl.clGetContextInfo(context, CL.CL_CONTEXT_DEVICES, 0, null, longBuffer); checkError("on clGetContextInfo", ret); @@ -260,7 +251,7 @@ public class LowLevelBindingTest { // Create the program - Int64Buffer lengths = (Int64Buffer)Int64Buffer.allocateDirect(1).put(programSource.length()); + PointerBuffer lengths = (PointerBuffer)PointerBuffer.allocateDirect(1).put(programSource.length()); final long program = cl.clCreateProgramWithSource(context, 1, new String[] {programSource}, lengths, intBuffer); out.println("program id: "+program); checkError("on clCreateProgramWithSource", intBuffer.get(0)); @@ -347,8 +338,8 @@ public class LowLevelBindingTest { checkError("on clEnqueueWriteBuffer", ret); // Launch kernel - Int64Buffer gWS = (Int64Buffer) Int64Buffer.allocateDirect(1).put(globalWorkSize).rewind(); - Int64Buffer lWS = (Int64Buffer) Int64Buffer.allocateDirect(1).put(localWorkSize).rewind(); + PointerBuffer gWS = (PointerBuffer) PointerBuffer.allocateDirect(1).put(globalWorkSize).rewind(); + PointerBuffer lWS = (PointerBuffer) PointerBuffer.allocateDirect(1).put(localWorkSize).rewind(); ret = cl.clEnqueueNDRangeKernel(commandQueue, kernel, 1, null, gWS, lWS, 0, null, null); checkError("on clEnqueueNDRangeKernel", ret); |