mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 20:51:29 +11:00
a28c0c8c83
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.
25 lines
722 B
Rust
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");
|
|
}
|