Getting back up to date

This commit is contained in:
2020-01-18 22:30:46 -08:00
parent 88b078d1ff
commit 8a83a1f12a
5 changed files with 554 additions and 30 deletions

View File

@@ -23,13 +23,14 @@ use crate::compute::compu_buffer::{CompuBuffers, CompuBufferHandle};
use crate::compute::compu_frame::CompuFrame;
// Canvas analog
/// State holding the compute buffers for computation and the kernels which will compute them
pub struct CompuState {
compute_buffers: Vec<CompuBuffers>,
kernels: Vec<CompuKernel>,
}
impl CompuState {
pub fn new() -> CompuState {
CompuState {
compute_buffers: vec![],
@@ -37,11 +38,13 @@ impl CompuState {
}
}
/// Creates a 2d compute buffer from incoming data
pub fn new_compute_buffer(&mut self,
data: Vec<u8>,
dimensions: (u32, u32),
stride: u32,
device: Arc<Device>) -> Arc<CompuBufferHandle> {
let handle = Arc::new(CompuBufferHandle {
handle: self.compute_buffers.len() as u32
});
@@ -52,13 +55,18 @@ impl CompuState {
handle
}
/// Read the compute buffer back into a Vec (TODO BROKEN)
pub fn read_compute_buffer(&mut self, handle: Arc<CompuBufferHandle>) -> Vec<u8> {
// This is way more difficult than it should be
//let compute_buffer : CompuBuffers = self.compute_buffers.get(handle.into()).unwrap();
//compute_buffer.read_output_buffer().to_vec()
Vec::new()
unimplemented!("read_compute_buffer is not implemented")
}
/// Write to the compute buffer, ostensibly overwriting what's already there
pub fn write_compute_buffer(&self, handle: Arc<CompuBufferHandle>, data: Vec<u8>) {
unimplemented!("read_compute_buffer is not implemented")
}
pub fn write_compute_buffer(&self, handle: Arc<CompuBufferHandle>, data: Vec<u8>) {}
pub fn new_kernel(&mut self,
filename: String,