diff options
author | Michael Bien <[email protected]> | 2011-05-26 02:01:18 +0200 |
---|---|---|
committer | Michael Bien <[email protected]> | 2011-05-26 02:01:18 +0200 |
commit | 08a479b22d4ba9da9ee79fc938ac4de7fb83dc5a (patch) | |
tree | 145abdd2ebc083e7167ccceb3d13a398c57a1dd0 /src/com/jogamp/opencl/CLDevice.java | |
parent | cb859fd580d3e1f5afb3c0f77cee0a5e82a394bb (diff) |
introduced CLAccessorFactory spi and threadlocal default impl for CLDevice and CLPlatform.
Diffstat (limited to 'src/com/jogamp/opencl/CLDevice.java')
-rw-r--r-- | src/com/jogamp/opencl/CLDevice.java | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/src/com/jogamp/opencl/CLDevice.java b/src/com/jogamp/opencl/CLDevice.java index 84a27f33..6ca4cf38 100644 --- a/src/com/jogamp/opencl/CLDevice.java +++ b/src/com/jogamp/opencl/CLDevice.java @@ -29,9 +29,7 @@ package com.jogamp.opencl; import com.jogamp.opencl.util.CLUtil; -import com.jogamp.common.nio.NativeSizeBuffer; import com.jogamp.opencl.spi.CLInfoAccessor; -import java.nio.Buffer; import java.nio.ByteOrder; import java.util.ArrayList; import java.util.Collections; @@ -59,22 +57,16 @@ public class CLDevice extends CLObject { private final CLInfoAccessor deviceInfo; private final CLPlatform platform; - CLDevice(CL cl, CLPlatform platform, long id) { + protected CLDevice(CL cl, CLPlatform platform, long id) { super(cl, id); this.platform = platform; - this.deviceInfo = new CLDeviceInfoAccessor(cl, id); + this.deviceInfo = platform.getAccessorFactory().createDeviceInfoAccessor(cl, id); } - protected CLDevice(CL cl, CLPlatform platform, CLInfoAccessor deviceAccessor, long id) { - super(cl, id); - this.platform = platform; - this.deviceInfo = deviceAccessor; - } - - CLDevice(CLContext context, long id) { + protected CLDevice(CLContext context, long id) { super(context, id); this.platform = context.getPlatform(); - this.deviceInfo = new CLDeviceInfoAccessor(context.getCL(), id); + this.deviceInfo = platform.getAccessorFactory().createDeviceInfoAccessor(cl, id); } public CLCommandQueue createCommandQueue() { @@ -698,21 +690,8 @@ public class CLDevice extends CLObject { return CLUtil.obtainDeviceProperties(this); } - private final static class CLDeviceInfoAccessor extends CLTLInfoAccessor { - - private final CL cl; - private final long ID; - - private CLDeviceInfoAccessor(CL cl, long id) { - this.cl = cl; - this.ID = id; - } - - @Override - protected int getInfo(int name, long valueSize, Buffer value, NativeSizeBuffer valueSizeRet) { - return cl.clGetDeviceInfo(ID, name, valueSize, value, valueSizeRet); - } - + public final CLInfoAccessor getCLAccessor() { + return deviceInfo; } @Override |