vello/piet-gpu-hal/examples/dx12_toy.rs
Raph Levien a28c0c8c83 A bit more work
Chipping away at the dx12 backend. This should more or less do the
signalling to the CPU that the command buffer is done (ie wire up the
fence). It also creates buffer objects.
2021-05-16 10:18:58 -07:00

25 lines
722 B
Rust

//! An example to exercise the dx12 backend, while it's being developed.
//! This will probably go away when it's fully implemented and we can
//! just use the hub.
use piet_gpu_hal::{dx12, Device, Error, MemFlags};
fn toy() -> Result<(), Error> {
let instance = dx12::Dx12Instance::new()?;
let device = instance.device()?;
let buf = device.create_buffer(1024, MemFlags::host_coherent())?;
let data: Vec<u32> = (0..256).collect();
unsafe {
device.write_buffer(&buf, &data)?;
let mut readback: Vec<u32> = Vec::new();
device.read_buffer(&buf, &mut readback)?;
println!("{:?}", readback);
}
Ok(())
}
fn main() {
toy().unwrap();
println!("hello dx12");
}