|
|
|
@ -30,6 +30,7 @@ pub struct CompuState {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl CompuState {
|
|
|
|
|
|
|
|
|
|
pub fn new() -> CompuState {
|
|
|
|
|
CompuState {
|
|
|
|
|
compute_buffers: vec![],
|
|
|
|
@ -44,11 +45,11 @@ impl CompuState {
|
|
|
|
|
device: Arc<Device>) -> Arc<CompuBufferHandle> {
|
|
|
|
|
|
|
|
|
|
let handle = Arc::new(CompuBufferHandle {
|
|
|
|
|
handle: self.compute_buffers.len() as u32 + 1
|
|
|
|
|
handle: self.compute_buffers.len() as u32
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
self.compute_buffers.push(
|
|
|
|
|
CompuBuffers::new(device.clone(), data, dimensions, stride, handle.clone()));
|
|
|
|
|
(CompuBuffers::new(device.clone(), data, dimensions, stride, handle.clone())));
|
|
|
|
|
|
|
|
|
|
handle
|
|
|
|
|
}
|
|
|
|
@ -66,14 +67,23 @@ impl CompuState {
|
|
|
|
|
device: Arc<Device>) -> Arc<CompuKernelHandle> {
|
|
|
|
|
|
|
|
|
|
let handle = Arc::new(CompuKernelHandle {
|
|
|
|
|
handle: self.kernels.len() as u32 + 1
|
|
|
|
|
handle: self.kernels.len() as u32
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
self.kernels.push(CompuKernel::new(filename, device.clone(), handle.clone()));
|
|
|
|
|
self.kernels.push((CompuKernel::new(filename, device.clone(), handle.clone())));
|
|
|
|
|
|
|
|
|
|
handle
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn get_kernel_handle(&self, kernel_name: String) -> Option<Arc<CompuKernelHandle>> {
|
|
|
|
|
for i in self.kernels.clone() {
|
|
|
|
|
if i.get_name() == kernel_name {
|
|
|
|
|
return Some(i.get_handle());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
None
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn compute_commands(&mut self,
|
|
|
|
|
compute_frame: CompuFrame,
|
|
|
|
|
mut command_buffer: AutoCommandBufferBuilder,
|
|
|
|
|