Added getter method for the device associated with a command queue

define_list_fix
shamanDevel 9 years ago
parent eb07d69cd8
commit 46db6d95f8
  1. 15
      jme3-core/src/main/java/com/jme3/opencl/CommandQueue.java
  2. 8
      jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclCommandQueue.java
  3. 2
      jme3-jogl/src/main/java/com/jme3/opencl/jocl/JoclContext.java
  4. 5
      jme3-lwjgl/src/main/java/com/jme3/opencl/lwjgl/LwjglCommandQueue.java
  5. 2
      jme3-lwjgl/src/main/java/com/jme3/opencl/lwjgl/LwjglContext.java
  6. 5
      jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglCommandQueue.java
  7. 2
      jme3-lwjgl3/src/main/java/com/jme3/opencl/lwjgl/LwjglContext.java

@ -43,10 +43,23 @@ package com.jme3.opencl;
* @author shaman * @author shaman
*/ */
public abstract class CommandQueue extends AbstractOpenCLObject { public abstract class CommandQueue extends AbstractOpenCLObject {
protected Device device;
protected CommandQueue(ObjectReleaser releaser) { protected CommandQueue(ObjectReleaser releaser, Device device) {
super(releaser); 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 * Issues all previously queued OpenCL commands in command_queue to the

@ -32,11 +32,9 @@
package com.jme3.opencl.jocl; package com.jme3.opencl.jocl;
import com.jme3.opencl.CommandQueue; import com.jme3.opencl.CommandQueue;
import com.jme3.opencl.OpenCLObjectManager; import com.jme3.opencl.Device;
import com.jogamp.opencl.CLCommandQueue;
import com.jogamp.opencl.CLPlatform; import com.jogamp.opencl.CLPlatform;
import com.jogamp.opencl.llb.CL; 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 CL cl;
final long id; final long id;
public JoclCommandQueue(long id) { public JoclCommandQueue(long id, Device device) {
super(new ReleaserImpl(id)); super(new ReleaserImpl(id), device);
this.id = id; this.id = id;
this.cl = CLPlatform.getLowLevelCLInterface(); this.cl = CLPlatform.getLowLevelCLInterface();
} }

@ -88,7 +88,7 @@ public class JoclContext extends Context {
long properties = 0; long properties = 0;
long q = cl.clCreateCommandQueue(id, d, properties, Utils.errorBuffer); long q = cl.clCreateCommandQueue(id, d, properties, Utils.errorBuffer);
Utils.checkError(Utils.errorBuffer, "clCreateCommandQueue"); Utils.checkError(Utils.errorBuffer, "clCreateCommandQueue");
return new JoclCommandQueue(q); return new JoclCommandQueue(q, device);
} }
@Override @Override

@ -32,6 +32,7 @@
package com.jme3.opencl.lwjgl; package com.jme3.opencl.lwjgl;
import com.jme3.opencl.CommandQueue; import com.jme3.opencl.CommandQueue;
import com.jme3.opencl.Device;
import com.jme3.opencl.OpenCLObjectManager; import com.jme3.opencl.OpenCLObjectManager;
import org.lwjgl.opencl.CL10; import org.lwjgl.opencl.CL10;
import org.lwjgl.opencl.CLCommandQueue; import org.lwjgl.opencl.CLCommandQueue;
@ -44,8 +45,8 @@ public class LwjglCommandQueue extends CommandQueue {
private final CLCommandQueue queue; private final CLCommandQueue queue;
public LwjglCommandQueue(CLCommandQueue queue) { public LwjglCommandQueue(CLCommandQueue queue, Device device) {
super(new ReleaserImpl(queue)); super(new ReleaserImpl(queue), device);
this.queue = queue; this.queue = queue;
} }

@ -79,7 +79,7 @@ public class LwjglContext extends Context {
long properties = 0; long properties = 0;
CLCommandQueue q = CL10.clCreateCommandQueue(context, d, properties, Utils.errorBuffer); CLCommandQueue q = CL10.clCreateCommandQueue(context, d, properties, Utils.errorBuffer);
Utils.checkError(Utils.errorBuffer, "clCreateCommandQueue"); Utils.checkError(Utils.errorBuffer, "clCreateCommandQueue");
return new LwjglCommandQueue(q); return new LwjglCommandQueue(q, device);
} }
@Override @Override

@ -32,6 +32,7 @@
package com.jme3.opencl.lwjgl; package com.jme3.opencl.lwjgl;
import com.jme3.opencl.CommandQueue; import com.jme3.opencl.CommandQueue;
import com.jme3.opencl.Device;
import org.lwjgl.opencl.CL10; import org.lwjgl.opencl.CL10;
/** /**
@ -42,8 +43,8 @@ public class LwjglCommandQueue extends CommandQueue {
private final long queue; private final long queue;
public LwjglCommandQueue(long queue) { public LwjglCommandQueue(long queue, Device device) {
super(new ReleaserImpl(queue)); super(new ReleaserImpl(queue), device);
this.queue = queue; this.queue = queue;
} }

@ -79,7 +79,7 @@ public class LwjglContext extends Context {
long properties = 0; long properties = 0;
long q = CL10.clCreateCommandQueue(context, d, properties, Utils.errorBuffer); long q = CL10.clCreateCommandQueue(context, d, properties, Utils.errorBuffer);
Utils.checkError(Utils.errorBuffer, "clCreateCommandQueue"); Utils.checkError(Utils.errorBuffer, "clCreateCommandQueue");
return new LwjglCommandQueue(q); return new LwjglCommandQueue(q, device);
} }
@Override @Override

Loading…
Cancel
Save