summaryrefslogtreecommitdiffstats
path: root/src/com/jogamp/opencl/CLDevice.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-05-18 03:51:10 +0200
committerSven Gothel <[email protected]>2011-05-18 03:51:10 +0200
commit773060662ef81707f70c447b71e664635ac45e2a (patch)
treef52c9e24b80902b08422005192df5b525f85489b /src/com/jogamp/opencl/CLDevice.java
parenteceed6e10c7d6cb19e8ad3c1bf5ea20450d6fae1 (diff)
parentf12e3a9d7ac644abc98a51dc51786cf7c5b67851 (diff)
resolve conflicts
Diffstat (limited to 'src/com/jogamp/opencl/CLDevice.java')
-rw-r--r--src/com/jogamp/opencl/CLDevice.java44
1 files changed, 15 insertions, 29 deletions
diff --git a/src/com/jogamp/opencl/CLDevice.java b/src/com/jogamp/opencl/CLDevice.java
index 1e9a94dd..0381038e 100644
--- a/src/com/jogamp/opencl/CLDevice.java
+++ b/src/com/jogamp/opencl/CLDevice.java
@@ -29,10 +29,8 @@
package com.jogamp.opencl;
import com.jogamp.opencl.util.CLUtil;
-import com.jogamp.common.nio.PointerBuffer;
-import com.jogamp.common.os.Platform;
+import com.jogamp.common.nio.NativeSizeBuffer;
import java.nio.Buffer;
-import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Collections;
@@ -63,13 +61,13 @@ public final class CLDevice extends CLObject {
CLDevice(CL cl, CLPlatform platform, long id) {
super(cl, id);
this.platform = platform;
- this.deviceInfo = new CLDeviceInfoAccessor();
+ this.deviceInfo = new CLDeviceInfoAccessor(cl, id);
}
CLDevice(CLContext context, long id) {
super(context, id);
this.platform = context.getPlatform();
- this.deviceInfo = new CLDeviceInfoAccessor();
+ this.deviceInfo = new CLDeviceInfoAccessor(context.getCL(), id);
}
public CLCommandQueue createCommandQueue() {
@@ -340,8 +338,8 @@ public final class CLDevice extends CLObject {
*/
@CLProperty("CL_DEVICE_MAX_WORK_ITEM_SIZES")
public int[] getMaxWorkItemSizes() {
- int n = (int) deviceInfo.getLong(CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS);
- return deviceInfo.getInts(n, CL_DEVICE_MAX_WORK_ITEM_SIZES);
+ int n = getMaxWorkItemDimensions();
+ return deviceInfo.getInts(CL_DEVICE_MAX_WORK_ITEM_SIZES, n);
}
/**
@@ -693,35 +691,23 @@ public final class CLDevice extends CLObject {
return CLUtil.obtainDeviceProperties(this);
}
- private final class CLDeviceInfoAccessor extends CLInfoAccessor {
+ private final static class CLDeviceInfoAccessor extends CLInfoAccessor {
- @Override
- protected int getInfo(int name, long valueSize, Buffer value, PointerBuffer valueSizeRet) {
- return cl.clGetDeviceInfo(ID, name, valueSize, value, valueSizeRet);
- }
+ private final CL cl;
+ private final long ID;
- private int[] getInts(int n, int key) {
-
- ByteBuffer buffer = localBB.get();
- int ret = getInfo(key, buffer.capacity(), buffer, null);
- CLException.checkForError(ret, "error while asking device for infos");
-
- int[] array = new int[n];
- for(int i = 0; i < array.length; i++) {
- if(Platform.is32Bit()) {
- array[i] = buffer.getInt();
- }else{
- array[i] = (int)buffer.getLong();
- }
- }
- buffer.rewind();
+ private CLDeviceInfoAccessor(CL cl, long id) {
+ this.cl = cl;
+ this.ID = id;
+ }
- return array;
+ @Override
+ protected int getInfo(int name, long valueSize, Buffer value, NativeSizeBuffer valueSizeRet) {
+ return cl.clGetDeviceInfo(ID, name, valueSize, value, valueSizeRet);
}
}
-
@Override
public String toString() {
return "CLDevice [id: " + ID