Added getter method for the device associated with a command queue
This commit is contained in:
parent
eb07d69cd8
commit
46db6d95f8
@ -44,8 +44,21 @@ 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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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…
x
Reference in New Issue
Block a user