aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-02-21 08:38:35 +0100
committerSven Gothel <[email protected]>2014-02-21 08:38:35 +0100
commite1af55978481d03561843c4a82c4995a4f3c858f (patch)
treead7414633a033b916ae1f5c018da1042874df540
parentd4f04ddd3ef3b65b7c31d3504cf55489153c60c1 (diff)
Minor editing: Remove static imports, using 'final' add some '@XXX' decorations to remove warnings.
Note 'static import' is evil .. :)
-rw-r--r--src/com/jogamp/opencl/CLBuffer.java55
-rw-r--r--src/com/jogamp/opencl/CLContext.java129
-rw-r--r--src/com/jogamp/opencl/CLDevice.java185
-rw-r--r--src/com/jogamp/opencl/impl/CLTLInfoAccessor.java37
4 files changed, 203 insertions, 203 deletions
diff --git a/src/com/jogamp/opencl/CLBuffer.java b/src/com/jogamp/opencl/CLBuffer.java
index 873256e..56cbccd 100644
--- a/src/com/jogamp/opencl/CLBuffer.java
+++ b/src/com/jogamp/opencl/CLBuffer.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. 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.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``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 JogAmp Community OR
@@ -20,7 +20,7 @@
* 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.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -29,17 +29,17 @@
package com.jogamp.opencl;
import com.jogamp.common.nio.Buffers;
+
import java.util.List;
+
import com.jogamp.common.nio.PointerBuffer;
-import com.jogamp.opencl.CLMemory.Mem;
import com.jogamp.opencl.llb.CL;
import com.jogamp.opencl.llb.CLBufferBinding;
+
import java.nio.Buffer;
import java.util.ArrayList;
import java.util.Collections;
-import static com.jogamp.opencl.CLException.*;
-
/**
* OpenCL buffer object wrapping an optional NIO buffer.
* @author Michael Bien, et al.
@@ -56,17 +56,17 @@ public class CLBuffer<B extends Buffer> extends CLMemory<B> {
super(context, directBuffer, size, id, flags);
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
static CLBuffer<?> create(CLContext context, int size, int flags) {
if(isHostPointerFlag(flags)) {
throw new IllegalArgumentException("no host pointer defined");
}
- CLBufferBinding binding = context.getPlatform().getBufferBinding();
- int[] result = new int[1];
- long id = binding.clCreateBuffer(context.ID, flags, size, null, result, 0);
- checkForError(result[0], "can not create cl buffer");
+ final CLBufferBinding binding = context.getPlatform().getBufferBinding();
+ final int[] result = new int[1];
+ final long id = binding.clCreateBuffer(context.ID, flags, size, null, result, 0);
+ CLException.checkForError(result[0], "can not create cl buffer");
return new CLBuffer(context, size, id, flags);
}
@@ -85,8 +85,8 @@ public class CLBuffer<B extends Buffer> extends CLMemory<B> {
int[] result = new int[1];
int size = Buffers.sizeOfBufferElem(directBuffer) * directBuffer.capacity();
long id = binding.clCreateBuffer(context.ID, flags, size, host_ptr, result, 0);
- checkForError(result[0], "can not create cl buffer");
-
+ CLException.checkForError(result[0], "can not create cl buffer");
+
return new CLBuffer<B>(context, directBuffer, size, id, flags);
}
@@ -101,24 +101,27 @@ public class CLBuffer<B extends Buffer> extends CLMemory<B> {
*/
public CLSubBuffer<B> createSubBuffer(int offset, int size, Mem... flags) {
- B slice = null;
+ final B slice;
if(buffer != null) {
slice = Buffers.slice(buffer, offset, size);
int elemSize = Buffers.sizeOfBufferElem(buffer);
offset *= elemSize;
size *= elemSize;
+ } else {
+ slice = null;
}
- PointerBuffer info = PointerBuffer.allocateDirect(2);
- info.put(offset).put(size).rewind();
- int bitset = Mem.flagsToInt(flags);
-
- CLBufferBinding binding = getPlatform().getBufferBinding();
- int[] err = new int[1];
- long subID = binding.clCreateSubBuffer(ID, bitset, CL.CL_BUFFER_CREATE_TYPE_REGION, info.getBuffer(), err, 0);
- checkForError(err[0], "can not create sub buffer");
+ final PointerBuffer info = PointerBuffer.allocateDirect(2);
+ info.put(0, offset);
+ info.put(1, size);
+ final int bitset = Mem.flagsToInt(flags);
+
+ final CLBufferBinding binding = getPlatform().getBufferBinding();
+ final int[] err = new int[1];
+ final long subID = binding.clCreateSubBuffer(ID, bitset, CL.CL_BUFFER_CREATE_TYPE_REGION, info.getBuffer(), err, 0);
+ CLException.checkForError(err[0], "can not create sub buffer");
- CLSubBuffer<B> clSubBuffer = new CLSubBuffer<B>(this, offset, size, slice, subID, bitset);
+ final CLSubBuffer<B> clSubBuffer = new CLSubBuffer<B>(this, offset, size, slice, subID, bitset);
if(childs == null) {
childs = new ArrayList<CLSubBuffer<B>>();
}
@@ -136,7 +139,7 @@ public class CLBuffer<B extends Buffer> extends CLMemory<B> {
super.release();
}
- void onReleaseSubBuffer(CLSubBuffer sub) {
+ void onReleaseSubBuffer(CLSubBuffer<?> sub) {
childs.remove(sub);
}
@@ -158,7 +161,7 @@ public class CLBuffer<B extends Buffer> extends CLMemory<B> {
public boolean isSubBuffer() {
return false;
}
-
+
@Override
public <T extends Buffer> CLBuffer<T> cloneWith(T directBuffer) {
return new CLBuffer<T>(context, directBuffer, size, ID, FLAGS);
diff --git a/src/com/jogamp/opencl/CLContext.java b/src/com/jogamp/opencl/CLContext.java
index 378f42f..e801c68 100644
--- a/src/com/jogamp/opencl/CLContext.java
+++ b/src/com/jogamp/opencl/CLContext.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. 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.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``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 JogAmp Community OR
@@ -20,7 +20,7 @@
* 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.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -28,14 +28,6 @@
package com.jogamp.opencl;
-import com.jogamp.opencl.llb.CL;
-import com.jogamp.common.nio.Buffers;
-import com.jogamp.opencl.CLDevice.Type;
-import com.jogamp.opencl.CLSampler.AddressingMode;
-import com.jogamp.opencl.CLSampler.FilteringMode;
-import com.jogamp.common.nio.PointerBuffer;
-import com.jogamp.opencl.llb.CLContextBinding;
-import com.jogamp.opencl.llb.impl.CLImageFormatImpl;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@@ -47,22 +39,25 @@ import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.nio.LongBuffer;
import java.nio.ShortBuffer;
-
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import static java.lang.System.*;
-import static com.jogamp.opencl.CLException.*;
-import static com.jogamp.common.nio.Buffers.*;
-import static com.jogamp.common.os.Platform.*;
-import static com.jogamp.opencl.llb.CL.*;
-import static com.jogamp.opencl.CLBuffer.*;
-import static java.util.Collections.*;
+
+import com.jogamp.common.nio.Buffers;
+import com.jogamp.common.nio.PointerBuffer;
+import com.jogamp.common.os.Platform;
+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.opencl.llb.CL;
+import com.jogamp.opencl.llb.CLContextBinding;
+import com.jogamp.opencl.llb.impl.CLImageFormatImpl;
/**
* CLContext is responsible for managing objects such as command-queues, memory,
@@ -76,10 +71,10 @@ import static java.util.Collections.*;
* <p>
* For a code example see {@link CLPlatform}.
* <p/>
- *
+ *
* concurrency:<br/>
* CLContext is threadsafe.
- *
+ *
* @author Michael Bien, et al.
*/
public class CLContext extends CLObjectResource {
@@ -89,23 +84,23 @@ public class CLContext extends CLObjectResource {
protected final Set<CLProgram> programs;
protected final Set<CLSampler> samplers;
protected final Set<CLMemory<? extends Buffer>> memoryObjects;
-
+
protected final Map<CLDevice, List<CLCommandQueue>> queuesMap;
protected final CLPlatform platform;
-
+
private final ErrorDispatcher errorHandler;
protected CLContext(CLPlatform platform, long contextID, ErrorDispatcher dispatcher) {
super(contextID);
this.platform = platform;
-
- this.programs = synchronizedSet(new HashSet<CLProgram>());
- this.samplers = synchronizedSet(new HashSet<CLSampler>());
- this.memoryObjects = synchronizedSet(new HashSet<CLMemory<? extends Buffer>>());
-
+
+ this.programs = Collections.synchronizedSet(new HashSet<CLProgram>());
+ this.samplers = Collections.synchronizedSet(new HashSet<CLSampler>());
+ this.memoryObjects = Collections.synchronizedSet(new HashSet<CLMemory<? extends Buffer>>());
+
this.queuesMap = new HashMap<CLDevice, List<CLCommandQueue>>();
-
+
this.errorHandler = dispatcher;
/*
@@ -115,25 +110,25 @@ public class CLContext extends CLObjectResource {
}
});
*/
-
+
}
private synchronized void initDevices(CLContextBinding cl) {
-
+
if (devices == null) {
- PointerBuffer deviceCount = PointerBuffer.allocateDirect(1);
+ final PointerBuffer deviceCount = PointerBuffer.allocateDirect(1);
- int ret = cl.clGetContextInfo(ID, CL_CONTEXT_DEVICES, 0, null, deviceCount);
- checkForError(ret, "can not enumerate devices");
+ int ret = cl.clGetContextInfo(ID, CL.CL_CONTEXT_DEVICES, 0, null, deviceCount);
+ CLException.checkForError(ret, "can not enumerate devices");
ByteBuffer deviceIDs = Buffers.newDirectByteBuffer((int)deviceCount.get());
- ret = cl.clGetContextInfo(ID, CL_CONTEXT_DEVICES, deviceIDs.capacity(), deviceIDs, null);
- checkForError(ret, "can not enumerate devices");
+ ret = cl.clGetContextInfo(ID, CL.CL_CONTEXT_DEVICES, deviceIDs.capacity(), deviceIDs, null);
+ CLException.checkForError(ret, "can not enumerate devices");
- devices = new CLDevice[deviceIDs.capacity() / (is32Bit() ? 4 : 8)];
+ devices = new CLDevice[deviceIDs.capacity() / (Platform.is32Bit() ? 4 : 8)];
for (int i = 0; i < devices.length; i++) {
- devices[i] = new CLDevice(this, is32Bit() ? deviceIDs.getInt() : deviceIDs.getLong());
+ devices[i] = new CLDevice(this, Platform.is32Bit() ? deviceIDs.getInt() : deviceIDs.getLong());
}
}
}
@@ -203,17 +198,17 @@ public class CLContext extends CLObjectResource {
}
protected static long createContextFromType(CLPlatform platform, CLErrorHandler handler, PointerBuffer properties, long deviceType) {
- IntBuffer status = newDirectIntBuffer(1);
+ IntBuffer status = Buffers.newDirectIntBuffer(1);
CLContextBinding cl = platform.getContextBinding();
long context = cl.clCreateContextFromType(properties, deviceType, handler, status);
- checkForError(status.get(), "can not create CL context");
+ CLException.checkForError(status.get(), "can not create CL context");
return context;
}
protected static long createContext(CLPlatform platform, CLErrorHandler handler, PointerBuffer properties, CLDevice... devices) {
- IntBuffer status = newDirectIntBuffer(1);
+ IntBuffer status = Buffers.newDirectIntBuffer(1);
PointerBuffer pb = null;
if(devices != null && devices.length != 0) {
pb = PointerBuffer.allocateDirect(devices.length);
@@ -228,7 +223,7 @@ public class CLContext extends CLObjectResource {
CLContextBinding cl = platform.getContextBinding();
long context = cl.clCreateContext(properties, pb, handler, status);
- checkForError(status.get(), "can not create CL context");
+ CLException.checkForError(status.get(), "can not create CL context");
return context;
}
@@ -238,7 +233,7 @@ public class CLContext extends CLObjectResource {
throw new RuntimeException("no OpenCL installation found");
}
- return PointerBuffer.allocateDirect(3).put(CL_CONTEXT_PLATFORM)
+ return PointerBuffer.allocateDirect(3).put(CL.CL_CONTEXT_PLATFORM)
.put(platform.ID).put(0) // 0 terminated array
.rewind();
}
@@ -296,35 +291,35 @@ public class CLContext extends CLObjectResource {
* Creates a CLBuffer with the specified flags and element count. No flags creates a MEM.READ_WRITE buffer.
*/
public final CLBuffer<ShortBuffer> createShortBuffer(int size, Mem... flags) {
- return createBuffer(newDirectShortBuffer(size), flags);
+ return createBuffer(Buffers.newDirectShortBuffer(size), flags);
}
/**
* Creates a CLBuffer with the specified flags and element count. No flags creates a MEM.READ_WRITE buffer.
*/
public final CLBuffer<IntBuffer> createIntBuffer(int size, Mem... flags) {
- return createBuffer(newDirectIntBuffer(size), flags);
+ return createBuffer(Buffers.newDirectIntBuffer(size), flags);
}
/**
* Creates a CLBuffer with the specified flags and element count. No flags creates a MEM.READ_WRITE buffer.
*/
public final CLBuffer<LongBuffer> createLongBuffer(int size, Mem... flags) {
- return createBuffer(newDirectLongBuffer(size), flags);
+ return createBuffer(Buffers.newDirectLongBuffer(size), flags);
}
/**
* Creates a CLBuffer with the specified flags and element count. No flags creates a MEM.READ_WRITE buffer.
*/
public final CLBuffer<FloatBuffer> createFloatBuffer(int size, Mem... flags) {
- return createBuffer(newDirectFloatBuffer(size), flags);
+ return createBuffer(Buffers.newDirectFloatBuffer(size), flags);
}
/**
* Creates a CLBuffer with the specified flags and element count. No flags creates a MEM.READ_WRITE buffer.
*/
public final CLBuffer<DoubleBuffer> createDoubleBuffer(int size, Mem... flags) {
- return createBuffer(newDirectDoubleBuffer(size), flags);
+ return createBuffer(Buffers.newDirectDoubleBuffer(size), flags);
}
/**
@@ -338,7 +333,7 @@ public class CLContext extends CLObjectResource {
* Creates a CLBuffer with the specified flags and buffer size in bytes.
*/
public final CLBuffer<ByteBuffer> createByteBuffer(int size, int flags) {
- return createBuffer(newDirectByteBuffer(size), flags);
+ return createBuffer(Buffers.newDirectByteBuffer(size), flags);
}
/**
@@ -484,7 +479,7 @@ public class CLContext extends CLObjectResource {
public void removeCLErrorHandler(CLErrorHandler handler) {
errorHandler.removeHandler(handler);
}
-
+
private void release(Collection<? extends CLResource> resources) {
// resources remove themselves when released, see above
while(!resources.isEmpty()) {
@@ -513,7 +508,7 @@ public class CLContext extends CLObjectResource {
} finally {
int ret = platform.getContextBinding().clReleaseContext(ID);
- checkForError(ret, "error releasing context");
+ CLException.checkForError(ret, "error releasing context");
}
}
@@ -528,8 +523,8 @@ public class CLContext extends CLObjectResource {
int[] entries = new int[1];
int ret = binding.clGetSupportedImageFormats(ID, flags, type, 0, null, entries, 0);
- if(ret != CL_SUCCESS) {
- throw newException(ret, "error calling clGetSupportedImageFormats");
+ if(ret != CL.CL_SUCCESS) {
+ throw CLException.newException(ret, "error calling clGetSupportedImageFormats");
}
int count = entries[0];
@@ -538,10 +533,10 @@ public class CLContext extends CLObjectResource {
}
CLImageFormat[] formats = new CLImageFormat[count];
- CLImageFormatImpl impl = CLImageFormatImpl.create(newDirectByteBuffer(count * CLImageFormatImpl.size()));
+ CLImageFormatImpl impl = CLImageFormatImpl.create(Buffers.newDirectByteBuffer(count * CLImageFormatImpl.size()));
ret = binding.clGetSupportedImageFormats(ID, flags, type, count, impl, null);
- if(ret != CL_SUCCESS) {
- throw newException(ret, "error calling clGetSupportedImageFormats");
+ if(ret != CL.CL_SUCCESS) {
+ throw CLException.newException(ret, "error calling clGetSupportedImageFormats");
}
ByteBuffer buffer = impl.getBuffer();
@@ -558,14 +553,14 @@ public class CLContext extends CLObjectResource {
* Returns all supported 2d image formats with the (optional) memory allocation flags.
*/
public CLImageFormat[] getSupportedImage2dFormats(Mem... flags) {
- return getSupportedImageFormats(flags==null?0:Mem.flagsToInt(flags), CL_MEM_OBJECT_IMAGE2D);
+ return getSupportedImageFormats(flags==null?0:Mem.flagsToInt(flags), CL.CL_MEM_OBJECT_IMAGE2D);
}
/**
* Returns all supported 3d image formats with the (optional) memory allocation flags.
*/
public CLImageFormat[] getSupportedImage3dFormats(Mem... flags) {
- return getSupportedImageFormats(flags==null?0:Mem.flagsToInt(flags), CL_MEM_OBJECT_IMAGE3D);
+ return getSupportedImageFormats(flags==null?0:Mem.flagsToInt(flags), CL.CL_MEM_OBJECT_IMAGE3D);
}
/**
@@ -586,7 +581,7 @@ public class CLContext extends CLObjectResource {
*/
public List<CLProgram> getPrograms() {
synchronized(programs) {
- return unmodifiableList(new ArrayList<CLProgram>(programs));
+ return Collections.unmodifiableList(new ArrayList<CLProgram>(programs));
}
}
@@ -595,7 +590,7 @@ public class CLContext extends CLObjectResource {
*/
public List<CLMemory<? extends Buffer>> getMemoryObjects() {
synchronized(memoryObjects) {
- return unmodifiableList(new ArrayList<CLMemory<? extends Buffer>>(memoryObjects));
+ return Collections.unmodifiableList(new ArrayList<CLMemory<? extends Buffer>>(memoryObjects));
}
}
@@ -604,7 +599,7 @@ public class CLContext extends CLObjectResource {
*/
public List<CLSampler> getSamplers() {
synchronized(samplers) {
- return unmodifiableList(new ArrayList<CLSampler>(samplers));
+ return Collections.unmodifiableList(new ArrayList<CLSampler>(samplers));
}
}
@@ -730,13 +725,13 @@ public class CLContext extends CLObjectResource {
}
CLErrorHandler[] handlers = new CLErrorHandler[clientHandlers.length+1];
- arraycopy(clientHandlers, 0, handlers, 0, clientHandlers.length);
+ System.arraycopy(clientHandlers, 0, handlers, 0, clientHandlers.length);
handlers[handlers.length-1] = handler;
clientHandlers = handlers;
}
private synchronized void removeHandler(CLErrorHandler handler) {
-
+
if(handler == null) {
throw new IllegalArgumentException("handler was null.");
}
@@ -744,8 +739,8 @@ public class CLContext extends CLObjectResource {
for (int i = 0; i < clientHandlers.length; i++) {
if(handler.equals(clientHandlers[i])) {
CLErrorHandler[] handlers = new CLErrorHandler[clientHandlers.length-1];
- arraycopy(clientHandlers, 0, handlers, 0, i);
- arraycopy(clientHandlers, i, handlers, 0, handlers.length-i);
+ System.arraycopy(clientHandlers, 0, handlers, 0, i);
+ System.arraycopy(clientHandlers, i, handlers, 0, handlers.length-i);
clientHandlers = handlers;
return;
}
diff --git a/src/com/jogamp/opencl/CLDevice.java b/src/com/jogamp/opencl/CLDevice.java
index 860fa1a..d8e9010 100644
--- a/src/com/jogamp/opencl/CLDevice.java
+++ b/src/com/jogamp/opencl/CLDevice.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. 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.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``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 JogAmp Community OR
@@ -20,7 +20,7 @@
* 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.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -28,8 +28,6 @@
package com.jogamp.opencl;
-import com.jogamp.opencl.util.CLUtil;
-import com.jogamp.opencl.spi.CLInfoAccessor;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Collections;
@@ -40,7 +38,9 @@ import java.util.Map;
import java.util.Scanner;
import java.util.Set;
-import static com.jogamp.opencl.llb.CL.*;
+import com.jogamp.opencl.llb.CL;
+import com.jogamp.opencl.spi.CLInfoAccessor;
+import com.jogamp.opencl.util.CLUtil;
/**
* This object represents an OpenCL device.
@@ -108,7 +108,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_NAME")
public String getName() {
- return deviceInfo.getString(CL_DEVICE_NAME);
+ return deviceInfo.getString(CL.CL_DEVICE_NAME);
}
/**
@@ -116,7 +116,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_PROFILE")
public String getProfile() {
- return deviceInfo.getString(CL_DEVICE_PROFILE);
+ return deviceInfo.getString(CL.CL_DEVICE_PROFILE);
}
/**
@@ -124,7 +124,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_VENDOR")
public String getVendor() {
- return deviceInfo.getString(CL_DEVICE_VENDOR);
+ return deviceInfo.getString(CL.CL_DEVICE_VENDOR);
}
/**
@@ -132,7 +132,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_VENDOR_ID")
public long getVendorID() {
- return deviceInfo.getLong(CL_DEVICE_VENDOR_ID);
+ return deviceInfo.getLong(CL.CL_DEVICE_VENDOR_ID);
}
/**
@@ -140,7 +140,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_VERSION")
public CLVersion getVersion() {
- return new CLVersion(deviceInfo.getString(CL_DEVICE_VERSION));
+ return new CLVersion(deviceInfo.getString(CL.CL_DEVICE_VERSION));
}
/**
@@ -148,7 +148,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_OPENCL_C_VERSION")
public CLVersion getCVersion() {
- return new CLVersion(deviceInfo.getString(CL_DEVICE_OPENCL_C_VERSION));
+ return new CLVersion(deviceInfo.getString(CL.CL_DEVICE_OPENCL_C_VERSION));
}
/**
@@ -156,7 +156,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DRIVER_VERSION")
public String getDriverVersion() {
- return deviceInfo.getString(CL_DRIVER_VERSION);
+ return deviceInfo.getString(CL.CL_DRIVER_VERSION);
}
/**
@@ -164,7 +164,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_TYPE")
public Type getType() {
- return Type.valueOf((int)deviceInfo.getLong(CL_DEVICE_TYPE));
+ return Type.valueOf((int)deviceInfo.getLong(CL.CL_DEVICE_TYPE));
}
/**
@@ -173,7 +173,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_ADDRESS_BITS")
public int getAddressBits() {
- return (int)deviceInfo.getLong(CL_DEVICE_ADDRESS_BITS);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_ADDRESS_BITS);
}
/**
@@ -182,7 +182,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT")
public int getPreferredShortVectorWidth() {
- return (int)deviceInfo.getLong(CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT);
}
/**
@@ -191,7 +191,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR")
public int getPreferredCharVectorWidth() {
- return (int)deviceInfo.getLong(CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR);
}
/**
@@ -200,7 +200,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT")
public int getPreferredIntVectorWidth() {
- return (int)deviceInfo.getLong(CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT);
}
/**
@@ -209,7 +209,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG")
public int getPreferredLongVectorWidth() {
- return (int)deviceInfo.getLong(CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG);
}
/**
@@ -218,7 +218,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT")
public int getPreferredFloatVectorWidth() {
- return (int)deviceInfo.getLong(CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT);
}
/**
@@ -227,7 +227,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE")
public int getPreferredDoubleVectorWidth() {
- return (int)deviceInfo.getLong(CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE);
}
/**
@@ -236,7 +236,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR")
public int getNativeCharVectorWidth() {
- return (int)deviceInfo.getLong(CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR);
}
/**
@@ -245,7 +245,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT")
public int getNativeShortVectorWidth() {
- return (int)deviceInfo.getLong(CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT);
}
/**
@@ -254,7 +254,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_NATIVE_VECTOR_WIDTH_INT")
public int getNativeIntVectorWidth() {
- return (int)deviceInfo.getLong(CL_DEVICE_NATIVE_VECTOR_WIDTH_INT);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_NATIVE_VECTOR_WIDTH_INT);
}
/**
@@ -263,7 +263,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG")
public int getNativeLongVectorWidth() {
- return (int)deviceInfo.getLong(CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG);
}
/**
@@ -272,7 +272,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF")
public int getNativeHalfVectorWidth() {
- return (int)deviceInfo.getLong(CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF);
}
/**
@@ -281,7 +281,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT")
public int getNativeFloatVectorWidth() {
- return (int)deviceInfo.getLong(CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT);
}
/**
@@ -290,7 +290,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE")
public int getNativeDoubleVectorWidth() {
- return (int)deviceInfo.getLong(CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE);
}
/**
@@ -299,7 +299,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_MAX_COMPUTE_UNITS")
public int getMaxComputeUnits() {
- return (int) deviceInfo.getLong(CL_DEVICE_MAX_COMPUTE_UNITS);
+ return (int) deviceInfo.getLong(CL.CL_DEVICE_MAX_COMPUTE_UNITS);
}
/**
@@ -309,7 +309,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_MAX_WORK_GROUP_SIZE")
public int getMaxWorkGroupSize() {
- return (int) deviceInfo.getLong(CL_DEVICE_MAX_WORK_GROUP_SIZE);
+ return (int) deviceInfo.getLong(CL.CL_DEVICE_MAX_WORK_GROUP_SIZE);
}
/**
@@ -317,7 +317,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_MAX_CLOCK_FREQUENCY")
public int getMaxClockFrequency() {
- return (int) (deviceInfo.getLong(CL_DEVICE_MAX_CLOCK_FREQUENCY));
+ return (int) (deviceInfo.getLong(CL.CL_DEVICE_MAX_CLOCK_FREQUENCY));
}
/**
@@ -327,7 +327,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS")
public int getMaxWorkItemDimensions() {
- return (int) deviceInfo.getLong(CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS);
+ return (int) deviceInfo.getLong(CL.CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS);
}
/**
@@ -338,7 +338,7 @@ public class CLDevice extends CLObject {
@CLProperty("CL_DEVICE_MAX_WORK_ITEM_SIZES")
public int[] getMaxWorkItemSizes() {
int n = getMaxWorkItemDimensions();
- return deviceInfo.getInts(CL_DEVICE_MAX_WORK_ITEM_SIZES, n);
+ return deviceInfo.getInts(CL.CL_DEVICE_MAX_WORK_ITEM_SIZES, n);
}
/**
@@ -348,7 +348,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_MAX_PARAMETER_SIZE")
public long getMaxParameterSize() {
- return deviceInfo.getLong(CL_DEVICE_MAX_PARAMETER_SIZE);
+ return deviceInfo.getLong(CL.CL_DEVICE_MAX_PARAMETER_SIZE);
}
/**
@@ -373,7 +373,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_GLOBAL_MEM_SIZE")
public long getGlobalMemSize() {
- return deviceInfo.getLong(CL_DEVICE_GLOBAL_MEM_SIZE);
+ return deviceInfo.getLong(CL.CL_DEVICE_GLOBAL_MEM_SIZE);
}
/**
@@ -383,7 +383,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_LOCAL_MEM_SIZE")
public long getLocalMemSize() {
- return deviceInfo.getLong(CL_DEVICE_LOCAL_MEM_SIZE);
+ return deviceInfo.getLong(CL.CL_DEVICE_LOCAL_MEM_SIZE);
}
/**
@@ -391,7 +391,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_HOST_UNIFIED_MEMORY")
public boolean isMemoryUnified() {
- return deviceInfo.getLong(CL_DEVICE_HOST_UNIFIED_MEMORY) == CL_TRUE;
+ return deviceInfo.getLong(CL.CL_DEVICE_HOST_UNIFIED_MEMORY) == CL.CL_TRUE;
}
/**
@@ -400,7 +400,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE")
public long getMaxConstantBufferSize() {
- return deviceInfo.getLong(CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE);
+ return deviceInfo.getLong(CL.CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE);
}
/**
@@ -408,7 +408,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE")
public long getGlobalMemCachelineSize() {
- return deviceInfo.getLong(CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE);
+ return deviceInfo.getLong(CL.CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE);
}
/**
@@ -416,7 +416,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_GLOBAL_MEM_CACHE_SIZE")
public long getGlobalMemCacheSize() {
- return deviceInfo.getLong(CL_DEVICE_GLOBAL_MEM_CACHE_SIZE);
+ return deviceInfo.getLong(CL.CL_DEVICE_GLOBAL_MEM_CACHE_SIZE);
}
/**
@@ -425,7 +425,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_MAX_CONSTANT_ARGS")
public long getMaxConstantArgs() {
- return deviceInfo.getLong(CL_DEVICE_MAX_CONSTANT_ARGS);
+ return deviceInfo.getLong(CL.CL_DEVICE_MAX_CONSTANT_ARGS);
}
/**
@@ -433,7 +433,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_IMAGE_SUPPORT")
public boolean isImageSupportAvailable() {
- return deviceInfo.getLong(CL_DEVICE_IMAGE_SUPPORT) == CL_TRUE;
+ return deviceInfo.getLong(CL.CL_DEVICE_IMAGE_SUPPORT) == CL.CL_TRUE;
}
/**
@@ -442,7 +442,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_MAX_READ_IMAGE_ARGS")
public int getMaxReadImageArgs() {
- return (int)deviceInfo.getLong(CL_DEVICE_MAX_READ_IMAGE_ARGS);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_MAX_READ_IMAGE_ARGS);
}
/**
@@ -451,7 +451,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_MAX_WRITE_IMAGE_ARGS")
public int getMaxWriteImageArgs() {
- return (int)deviceInfo.getLong(CL_DEVICE_MAX_WRITE_IMAGE_ARGS);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_MAX_WRITE_IMAGE_ARGS);
}
/**
@@ -460,7 +460,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_IMAGE2D_MAX_WIDTH")
public int getMaxImage2dWidth() {
- return (int)deviceInfo.getLong(CL_DEVICE_IMAGE2D_MAX_WIDTH);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_IMAGE2D_MAX_WIDTH);
}
/**
@@ -469,7 +469,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_IMAGE2D_MAX_HEIGHT")
public int getMaxImage2dHeight() {
- return (int)deviceInfo.getLong(CL_DEVICE_IMAGE2D_MAX_HEIGHT);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_IMAGE2D_MAX_HEIGHT);
}
/**
@@ -478,7 +478,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_IMAGE3D_MAX_WIDTH")
public int getMaxImage3dWidth() {
- return (int)deviceInfo.getLong(CL_DEVICE_IMAGE3D_MAX_WIDTH);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_IMAGE3D_MAX_WIDTH);
}
/**
@@ -487,7 +487,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_IMAGE3D_MAX_HEIGHT")
public int getMaxImage3dHeight() {
- return (int)deviceInfo.getLong(CL_DEVICE_IMAGE3D_MAX_HEIGHT);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_IMAGE3D_MAX_HEIGHT);
}
/**
@@ -496,7 +496,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_IMAGE3D_MAX_DEPTH")
public int getMaxImage3dDepth() {
- return (int)deviceInfo.getLong(CL_DEVICE_IMAGE3D_MAX_DEPTH);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_IMAGE3D_MAX_DEPTH);
}
/**
@@ -505,7 +505,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_MAX_SAMPLERS")
public int getMaxSamplers() {
- return (int)deviceInfo.getLong(CL_DEVICE_MAX_SAMPLERS);
+ return (int)deviceInfo.getLong(CL.CL_DEVICE_MAX_SAMPLERS);
}
/**
@@ -513,7 +513,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_PROFILING_TIMER_RESOLUTION")
public long getProfilingTimerResolution() {
- return deviceInfo.getLong(CL_DEVICE_PROFILING_TIMER_RESOLUTION);
+ return deviceInfo.getLong(CL.CL_DEVICE_PROFILING_TIMER_RESOLUTION);
}
/**
@@ -521,7 +521,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_EXECUTION_CAPABILITIES")
public EnumSet<Capabilities> getExecutionCapabilities() {
- return Capabilities.valuesOf((int)deviceInfo.getLong(CL_DEVICE_EXECUTION_CAPABILITIES));
+ return Capabilities.valuesOf((int)deviceInfo.getLong(CL.CL_DEVICE_EXECUTION_CAPABILITIES));
}
/**
@@ -534,7 +534,7 @@ public class CLDevice extends CLObject {
@CLProperty("CL_DEVICE_HALF_FP_CONFIG")
public EnumSet<FPConfig> getHalfFPConfig() {
if(isHalfFPAvailable())
- return FPConfig.valuesOf((int)deviceInfo.getLong(CL_DEVICE_HALF_FP_CONFIG));
+ return FPConfig.valuesOf((int)deviceInfo.getLong(CL.CL_DEVICE_HALF_FP_CONFIG));
else
return EnumSet.noneOf(FPConfig.class);
}
@@ -547,7 +547,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_SINGLE_FP_CONFIG")
public EnumSet<FPConfig> getSingleFPConfig() {
- return FPConfig.valuesOf((int)deviceInfo.getLong(CL_DEVICE_SINGLE_FP_CONFIG));
+ return FPConfig.valuesOf((int)deviceInfo.getLong(CL.CL_DEVICE_SINGLE_FP_CONFIG));
}
/**
@@ -560,7 +560,7 @@ public class CLDevice extends CLObject {
@CLProperty("CL_DEVICE_DOUBLE_FP_CONFIG")
public EnumSet<FPConfig> getDoubleFPConfig() {
if(isDoubleFPAvailable())
- return FPConfig.valuesOf((int)deviceInfo.getLong(CL_DEVICE_DOUBLE_FP_CONFIG));
+ return FPConfig.valuesOf((int)deviceInfo.getLong(CL.CL_DEVICE_DOUBLE_FP_CONFIG));
else
return EnumSet.noneOf(FPConfig.class);
}
@@ -570,7 +570,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_LOCAL_MEM_TYPE")
public LocalMemType getLocalMemType() {
- return LocalMemType.valueOf((int)deviceInfo.getLong(CL_DEVICE_LOCAL_MEM_TYPE));
+ return LocalMemType.valueOf((int)deviceInfo.getLong(CL.CL_DEVICE_LOCAL_MEM_TYPE));
}
/**
@@ -578,15 +578,16 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_GLOBAL_MEM_CACHE_TYPE")
public GlobalMemCacheType getGlobalMemCacheType() {
- return GlobalMemCacheType.valueOf((int)deviceInfo.getLong(CL_DEVICE_GLOBAL_MEM_CACHE_TYPE));
+ return GlobalMemCacheType.valueOf((int)deviceInfo.getLong(CL.CL_DEVICE_GLOBAL_MEM_CACHE_TYPE));
}
+
/**
* Returns the command-queue properties supported by the device.
*/
@CLProperty("CL_DEVICE_QUEUE_PROPERTIES")
public EnumSet<CLCommandQueue.Mode> getQueueProperties() {
- return CLCommandQueue.Mode.valuesOf((int)deviceInfo.getLong(CL_DEVICE_QUEUE_PROPERTIES));
+ return CLCommandQueue.Mode.valuesOf((int)deviceInfo.getLong(CL.CL_DEVICE_QUEUE_PROPERTIES));
}
/**
@@ -594,7 +595,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_AVAILABLE")
public boolean isAvailable() {
- return deviceInfo.getLong(CL_DEVICE_AVAILABLE) == CL_TRUE;
+ return deviceInfo.getLong(CL.CL_DEVICE_AVAILABLE) == CL.CL_TRUE;
}
/**
@@ -604,7 +605,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_COMPILER_AVAILABLE")
public boolean isCompilerAvailable() {
- return deviceInfo.getLong(CL_DEVICE_COMPILER_AVAILABLE) == CL_TRUE;
+ return deviceInfo.getLong(CL.CL_DEVICE_COMPILER_AVAILABLE) == CL.CL_TRUE;
}
/**
@@ -612,7 +613,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_ENDIAN_LITTLE")
public boolean isLittleEndian() {
- return deviceInfo.getLong(CL_DEVICE_ENDIAN_LITTLE) == CL_TRUE;
+ return deviceInfo.getLong(CL.CL_DEVICE_ENDIAN_LITTLE) == CL.CL_TRUE;
}
/**
@@ -622,7 +623,7 @@ public class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_ERROR_CORRECTION_SUPPORT")
public boolean isErrorCorrectionSupported() {
- return deviceInfo.getLong(CL_DEVICE_ERROR_CORRECTION_SUPPORT) == CL_TRUE;
+ return deviceInfo.getLong(CL.CL_DEVICE_ERROR_CORRECTION_SUPPORT) == CL.CL_TRUE;
}
/**
@@ -668,7 +669,7 @@ public class CLDevice extends CLObject {
public boolean isExtensionAvailable(String extension) {
return getExtensions().contains(extension);
}
-
+
/**
* Returns {@link ByteOrder#LITTLE_ENDIAN} or {@link ByteOrder#BIG_ENDIAN}.
*/
@@ -688,7 +689,7 @@ public class CLDevice extends CLObject {
if(extensions == null) {
extensions = new HashSet<String>();
- String ext = deviceInfo.getString(CL_DEVICE_EXTENSIONS);
+ String ext = deviceInfo.getString(CL.CL_DEVICE_EXTENSIONS);
Scanner scanner = new Scanner(ext);
while(scanner.hasNext())
@@ -750,12 +751,12 @@ public class CLDevice extends CLObject {
/**
* The OpenCL device can execute OpenCL kernels.
*/
- EXEC_KERNEL(CL_EXEC_KERNEL),
+ EXEC_KERNEL(CL.CL_EXEC_KERNEL),
/**
* The OpenCL device can execute native kernels.
*/
- EXEC_NATIVE_KERNEL(CL_EXEC_NATIVE_KERNEL);
+ EXEC_NATIVE_KERNEL(CL.CL_EXEC_NATIVE_KERNEL);
/**
* Value of wrapped OpenCL device type.
@@ -768,9 +769,9 @@ public class CLDevice extends CLObject {
public static Capabilities valueOf(int caps) {
switch(caps) {
- case(CL_EXEC_KERNEL):
+ case(CL.CL_EXEC_KERNEL):
return EXEC_KERNEL;
- case(CL_EXEC_NATIVE_KERNEL):
+ case(CL.CL_EXEC_NATIVE_KERNEL):
return EXEC_NATIVE_KERNEL;
}
return null;
@@ -798,25 +799,25 @@ public class CLDevice extends CLObject {
/**
* CL_DEVICE_TYPE_CPU
*/
- CPU(CL_DEVICE_TYPE_CPU),
+ CPU(CL.CL_DEVICE_TYPE_CPU),
/**
* CL_DEVICE_TYPE_GPU
*/
- GPU(CL_DEVICE_TYPE_GPU),
+ GPU(CL.CL_DEVICE_TYPE_GPU),
/**
* CL_DEVICE_TYPE_ACCELERATOR
*/
- ACCELERATOR(CL_DEVICE_TYPE_ACCELERATOR),
+ ACCELERATOR(CL.CL_DEVICE_TYPE_ACCELERATOR),
/**
* CL_DEVICE_TYPE_DEFAULT. This type can be used for creating a context on
* the default device, a single device can never have this type.
*/
- DEFAULT(CL_DEVICE_TYPE_DEFAULT),
+ DEFAULT(CL.CL_DEVICE_TYPE_DEFAULT),
/**
* CL_DEVICE_TYPE_ALL. This type can be used for creating a context on
* all devices, a single device can never have this type.
*/
- ALL(CL_DEVICE_TYPE_ALL);
+ ALL(CL.CL_DEVICE_TYPE_ALL);
/**
* Value of wrapped OpenCL device type.
@@ -829,17 +830,17 @@ public class CLDevice extends CLObject {
public static Type valueOf(long clDeviceType) {
- if(clDeviceType == CL_DEVICE_TYPE_ALL)
+ if(clDeviceType == CL.CL_DEVICE_TYPE_ALL)
return ALL;
switch((int)clDeviceType) {
- case(CL_DEVICE_TYPE_DEFAULT):
+ case(CL.CL_DEVICE_TYPE_DEFAULT):
return DEFAULT;
- case(CL_DEVICE_TYPE_CPU):
+ case(CL.CL_DEVICE_TYPE_CPU):
return CPU;
- case(CL_DEVICE_TYPE_GPU):
+ case(CL.CL_DEVICE_TYPE_GPU):
return GPU;
- case(CL_DEVICE_TYPE_ACCELERATOR):
+ case(CL.CL_DEVICE_TYPE_ACCELERATOR):
return ACCELERATOR;
}
return null;
@@ -855,32 +856,32 @@ public class CLDevice extends CLObject {
/**
* denorms are supported.
*/
- DENORM(CL_FP_DENORM),
+ DENORM(CL.CL_FP_DENORM),
/**
* INF and quiet NaNs are supported.
*/
- INF_NAN(CL_FP_INF_NAN),
+ INF_NAN(CL.CL_FP_INF_NAN),
/**
* round to nearest rounding mode supported.
*/
- ROUND_TO_NEAREST(CL_FP_ROUND_TO_NEAREST),
+ ROUND_TO_NEAREST(CL.CL_FP_ROUND_TO_NEAREST),
/**
* round to positive and negative infinity rounding modes supported.
*/
- ROUND_TO_INF(CL_FP_ROUND_TO_INF),
+ ROUND_TO_INF(CL.CL_FP_ROUND_TO_INF),
/**
* round to zero rounding mode supported.
*/
- ROUND_TO_ZERO(CL_FP_ROUND_TO_ZERO),
+ ROUND_TO_ZERO(CL.CL_FP_ROUND_TO_ZERO),
/**
* IEEE754-2008 fused multiply-add is supported.
*/
- FMA(CL_FP_FMA);
+ FMA(CL.CL_FP_FMA);
/**
@@ -918,17 +919,17 @@ public class CLDevice extends CLObject {
/**
* Global memory cache not supported.
*/
- NONE(CL_NONE),
+ NONE(CL.CL_NONE),
/**
* Read only cache.
*/
- READ_ONLY(CL_READ_ONLY_CACHE),
+ READ_ONLY(CL.CL_READ_ONLY_CACHE),
/**
* Read-write cache.
*/
- READ_WRITE(CL_READ_WRITE_CACHE);
+ READ_WRITE(CL.CL_READ_WRITE_CACHE);
/**
@@ -961,12 +962,12 @@ public class CLDevice extends CLObject {
/**
* GLOBAL implies that no dedicated memory storage is available (global mem is used instead).
*/
- GLOBAL(CL_GLOBAL),
+ GLOBAL(CL.CL_GLOBAL),
/**
* LOCAL implies dedicated local memory storage such as SRAM.
*/
- LOCAL(CL_LOCAL);
+ LOCAL(CL.CL_LOCAL);
/**
* Value of wrapped OpenCL value.
@@ -981,9 +982,9 @@ public class CLDevice extends CLObject {
* Returns the matching LocalMemCacheType for the given cl type.
*/
public static LocalMemType valueOf(int clLocalCacheType) {
- if(clLocalCacheType == CL_GLOBAL)
+ if(clLocalCacheType == CL.CL_GLOBAL)
return GLOBAL;
- else if(clLocalCacheType == CL_LOCAL)
+ else if(clLocalCacheType == CL.CL_LOCAL)
return LOCAL;
return null;
}
diff --git a/src/com/jogamp/opencl/impl/CLTLInfoAccessor.java b/src/com/jogamp/opencl/impl/CLTLInfoAccessor.java
index 2811530..f1419c7 100644
--- a/src/com/jogamp/opencl/impl/CLTLInfoAccessor.java
+++ b/src/com/jogamp/opencl/impl/CLTLInfoAccessor.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. 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.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``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 JogAmp Community OR
@@ -20,7 +20,7 @@
* 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.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -28,15 +28,16 @@
package com.jogamp.opencl.impl;
-import com.jogamp.opencl.spi.CLInfoAccessor;
-import com.jogamp.common.nio.PointerBuffer;
-import com.jogamp.common.os.Platform;
-import com.jogamp.opencl.util.CLUtil;
import java.nio.Buffer;
import java.nio.ByteBuffer;
-import static com.jogamp.common.nio.Buffers.*;
-import static com.jogamp.opencl.CLException.*;
+import com.jogamp.common.nio.Buffers;
+import com.jogamp.common.nio.PointerBuffer;
+import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.Bitstream;
+import com.jogamp.opencl.CLException;
+import com.jogamp.opencl.spi.CLInfoAccessor;
+import com.jogamp.opencl.util.CLUtil;
/**
* Internal utility for common OpenCL clGetFooInfo calls.
@@ -51,7 +52,7 @@ public abstract class CLTLInfoAccessor implements CLInfoAccessor {
@Override
protected ByteBuffer initialValue() {
- return newDirectByteBuffer(BB_SIZE);
+ return Buffers.newDirectByteBuffer(BB_SIZE);
}
};
@@ -77,23 +78,23 @@ public abstract class CLTLInfoAccessor implements CLInfoAccessor {
ByteBuffer buffer = getBB(8).putLong(0, 0);
int ret = getInfo(key, 8, buffer, null);
- checkForError(ret, "error while asking for info value");
+ CLException.checkForError(ret, "error while asking for info value");
return buffer.getLong(0);
}
@Override
public final String getString(int key) {
-
+
PointerBuffer sizeBuffer = getNSB();
int ret = getInfo(key, 0, null, sizeBuffer);
- checkForError(ret, "error while asking for info string");
+ CLException.checkForError(ret, "error while asking for info string");
int clSize = (int)sizeBuffer.get(0);
ByteBuffer buffer = getBB(clSize);
ret = getInfo(key, buffer.capacity(), buffer, null);
- checkForError(ret, "error while asking for info string");
+ CLException.checkForError(ret, "error while asking for info string");
byte[] array = new byte[clSize];
buffer.get(array).rewind();
@@ -104,10 +105,10 @@ public abstract class CLTLInfoAccessor implements CLInfoAccessor {
@Override
public final int[] getInts(int key, int n) {
-
+ // FIXME: Really 8 bytes per int on 64bit platforms ?
ByteBuffer buffer = getBB(n * (Platform.is32Bit()?4:8));
int ret = getInfo(key, buffer.capacity(), buffer, null);
- checkForError(ret, "error while asking for info value");
+ CLException.checkForError(ret, "error while asking for info value");
int[] array = new int[n];
for(int i = 0; i < array.length; i++) {
@@ -124,7 +125,7 @@ public abstract class CLTLInfoAccessor implements CLInfoAccessor {
protected ByteBuffer getBB(int minCapacity) {
if(minCapacity > BB_SIZE) {
- return newDirectByteBuffer(minCapacity);
+ return Buffers.newDirectByteBuffer(minCapacity);
}else{
return localBB.get();
}