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

@ -44,10 +44,23 @@ package com.jme3.opencl;
*/
public abstract class CommandQueue extends AbstractOpenCLObject {
protected CommandQueue(ObjectReleaser releaser) {
protected Device device;
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
* device associated with command queue. Flush only guarantees that all

@ -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();
}

@ -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

@ -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;
}

@ -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

@ -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;
}

@ -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

Loading…
Cancel
Save