diff --git a/jme3-core/src/main/java/com/jme3/opencl/CommandQueue.java b/jme3-core/src/main/java/com/jme3/opencl/CommandQueue.java index 6d54237f9..a2bfeb4fd 100644 --- a/jme3-core/src/main/java/com/jme3/opencl/CommandQueue.java +++ b/jme3-core/src/main/java/com/jme3/opencl/CommandQueue.java @@ -43,10 +43,23 @@ package com.jme3.opencl; * @author shaman */ public abstract class CommandQueue extends AbstractOpenCLObject { + + protected Device device; - protected CommandQueue(ObjectReleaser releaser) { + protected CommandQueue(ObjectReleaser releaser, Device device) { super(releaser); + this.device = device; } + + /** + * Returns the device associated with this command queue. + * It can be used to query properties of the device that is used to execute + * the commands issued to this command queue. + * @return the associated device + */ + public Device getDevice() { + return device; + } /** * Issues all previously queued OpenCL commands in command_queue to the diff --git a/jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclCommandQueue.java b/jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclCommandQueue.java index e7b8a3743..702300ddf 100644 --- a/jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclCommandQueue.java +++ b/jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclCommandQueue.java @@ -32,11 +32,9 @@ package com.jme3.opencl.jocl; import com.jme3.opencl.CommandQueue; -import com.jme3.opencl.OpenCLObjectManager; -import com.jogamp.opencl.CLCommandQueue; +import com.jme3.opencl.Device; import com.jogamp.opencl.CLPlatform; import com.jogamp.opencl.llb.CL; -import com.jogamp.opencl.llb.CLCommandQueueBinding; /** * @@ -47,8 +45,8 @@ public class JoclCommandQueue extends CommandQueue { final CL cl; final long id; - public JoclCommandQueue(long id) { - super(new ReleaserImpl(id)); + public JoclCommandQueue(long id, Device device) { + super(new ReleaserImpl(id), device); this.id = id; this.cl = CLPlatform.getLowLevelCLInterface(); } diff --git a/jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclContext.java b/jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclContext.java index d372587f1..8e06cb3e2 100644 --- a/jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclContext.java +++ b/jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclContext.java @@ -88,7 +88,7 @@ public class JoclContext extends Context { long properties = 0; long q = cl.clCreateCommandQueue(id, d, properties, Utils.errorBuffer); Utils.checkError(Utils.errorBuffer, "clCreateCommandQueue"); - return new JoclCommandQueue(q); + return new JoclCommandQueue(q, device); } @Override diff --git a/jme3-lwjgl/src/main/java/com/jme3/opencl/lwjgl/LwjglCommandQueue.java b/jme3-lwjgl/src/main/java/com/jme3/opencl/lwjgl/LwjglCommandQueue.java index c413d6a8e..28c867620 100644 --- a/jme3-lwjgl/src/main/java/com/jme3/opencl/lwjgl/LwjglCommandQueue.java +++ b/jme3-lwjgl/src/main/java/com/jme3/opencl/lwjgl/LwjglCommandQueue.java @@ -32,6 +32,7 @@ package com.jme3.opencl.lwjgl; import com.jme3.opencl.CommandQueue; +import com.jme3.opencl.Device; import com.jme3.opencl.OpenCLObjectManager; import org.lwjgl.opencl.CL10; import org.lwjgl.opencl.CLCommandQueue; @@ -44,8 +45,8 @@ public class LwjglCommandQueue extends CommandQueue { private final CLCommandQueue queue; - public LwjglCommandQueue(CLCommandQueue queue) { - super(new ReleaserImpl(queue)); + public LwjglCommandQueue(CLCommandQueue queue, Device device) { + super(new ReleaserImpl(queue), device); this.queue = queue; } diff --git a/jme3-lwjgl/src/main/java/com/jme3/opencl/lwjgl/LwjglContext.java b/jme3-lwjgl/src/main/java/com/jme3/opencl/lwjgl/LwjglContext.java index c0b05c673..96b34eb10 100644 --- a/jme3-lwjgl/src/main/java/com/jme3/opencl/lwjgl/LwjglContext.java +++ b/jme3-lwjgl/src/main/java/com/jme3/opencl/lwjgl/LwjglContext.java @@ -79,7 +79,7 @@ public class LwjglContext extends Context { long properties = 0; CLCommandQueue q = CL10.clCreateCommandQueue(context, d, properties, Utils.errorBuffer); Utils.checkError(Utils.errorBuffer, "clCreateCommandQueue"); - return new LwjglCommandQueue(q); + return new LwjglCommandQueue(q, device); } @Override diff --git a/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglCommandQueue.java b/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglCommandQueue.java index 5be22813a..88a34ac31 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglCommandQueue.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglCommandQueue.java @@ -32,6 +32,7 @@ package com.jme3.opencl.lwjgl; import com.jme3.opencl.CommandQueue; +import com.jme3.opencl.Device; import org.lwjgl.opencl.CL10; /** @@ -42,8 +43,8 @@ public class LwjglCommandQueue extends CommandQueue { private final long queue; - public LwjglCommandQueue(long queue) { - super(new ReleaserImpl(queue)); + public LwjglCommandQueue(long queue, Device device) { + super(new ReleaserImpl(queue), device); this.queue = queue; } diff --git a/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglContext.java b/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglContext.java index 83d43ca77..53267f4cc 100644 --- a/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglContext.java +++ b/jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglContext.java @@ -79,7 +79,7 @@ public class LwjglContext extends Context { long properties = 0; long q = CL10.clCreateCommandQueue(context, d, properties, Utils.errorBuffer); Utils.checkError(Utils.errorBuffer, "clCreateCommandQueue"); - return new LwjglCommandQueue(q); + return new LwjglCommandQueue(q, device); } @Override