mirror of
https://github.com/italicsjenga/vello.git
synced 2025-01-10 12:41:30 +11:00
Merge branch 'dx12' into metal
This commit is contained in:
commit
c2965254db
|
@ -87,7 +87,7 @@ fn toy() -> Result<(), Error> {
|
||||||
cmd_buf.host_barrier();
|
cmd_buf.host_barrier();
|
||||||
cmd_buf.finish();
|
cmd_buf.finish();
|
||||||
device.run_cmd_bufs(&[&cmd_buf], &[], &[], Some(&mut fence))?;
|
device.run_cmd_bufs(&[&cmd_buf], &[], &[], Some(&mut fence))?;
|
||||||
device.wait_and_reset(&[&mut fence])?;
|
device.wait_and_reset(vec![&mut fence])?;
|
||||||
let mut readback: Vec<u32> = vec![0u32; 256];
|
let mut readback: Vec<u32> = vec![0u32; 256];
|
||||||
device.read_buffer(&buf, readback.as_mut_ptr() as *mut u8, 0, 1024)?;
|
device.read_buffer(&buf, readback.as_mut_ptr() as *mut u8, 0, 1024)?;
|
||||||
println!("{:?}", readback);
|
println!("{:?}", readback);
|
||||||
|
|
|
@ -405,7 +405,7 @@ impl crate::Device for Dx12Device {
|
||||||
Ok(Fence { fence, event, val })
|
Ok(Fence { fence, event, val })
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn wait_and_reset(&self, fences: &[&mut Self::Fence]) -> Result<(), Error> {
|
unsafe fn wait_and_reset(&self, fences: Vec<&mut Self::Fence>) -> Result<(), Error> {
|
||||||
for fence in fences {
|
for fence in fences {
|
||||||
// TODO: probably handle errors here.
|
// TODO: probably handle errors here.
|
||||||
let _status = fence.event.wait(winapi::um::winbase::INFINITE);
|
let _status = fence.event.wait(winapi::um::winbase::INFINITE);
|
||||||
|
|
|
@ -233,7 +233,7 @@ pub trait Device: Sized {
|
||||||
|
|
||||||
unsafe fn create_semaphore(&self) -> Result<Self::Semaphore, Error>;
|
unsafe fn create_semaphore(&self) -> Result<Self::Semaphore, Error>;
|
||||||
unsafe fn create_fence(&self, signaled: bool) -> Result<Self::Fence, Error>;
|
unsafe fn create_fence(&self, signaled: bool) -> Result<Self::Fence, Error>;
|
||||||
unsafe fn wait_and_reset(&self, fences: &[&mut Self::Fence]) -> Result<(), Error>;
|
unsafe fn wait_and_reset(&self, fences: Vec<&mut Self::Fence>) -> Result<(), Error>;
|
||||||
unsafe fn get_fence_status(&self, fence: &Self::Fence) -> Result<bool, Error>;
|
unsafe fn get_fence_status(&self, fence: &Self::Fence) -> Result<bool, Error>;
|
||||||
|
|
||||||
unsafe fn create_sampler(&self, params: SamplerParams) -> Result<Self::Sampler, Error>;
|
unsafe fn create_sampler(&self, params: SamplerParams) -> Result<Self::Sampler, Error>;
|
||||||
|
|
|
@ -251,7 +251,7 @@ impl crate::Device for MtlDevice {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn wait_and_reset(&self, fences: &[&mut Self::Fence]) -> Result<(), Error> {
|
unsafe fn wait_and_reset(&self, fences: Vec<&mut Self::Fence>) -> Result<(), Error> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,15 +235,15 @@ impl Device {
|
||||||
let mut fences = fences
|
let mut fences = fences
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|f| f.vk_mut())
|
.map(|f| f.vk_mut())
|
||||||
.collect::<SmallVec<[_; 4]>>();
|
.collect::<Vec<_>>();
|
||||||
d.wait_and_reset(&mut fences)
|
d.wait_and_reset(fences)
|
||||||
}
|
}
|
||||||
Device::Dx12(d) => {
|
Device::Dx12(d) => {
|
||||||
let mut fences = fences
|
let mut fences = fences
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|f| f.dx12_mut())
|
.map(|f| f.dx12_mut())
|
||||||
.collect::<SmallVec<[_; 4]>>();
|
.collect::<Vec<_>>();
|
||||||
d.wait_and_reset(&mut fences)
|
d.wait_and_reset(fences)
|
||||||
}
|
}
|
||||||
Device::Mtl(d) => {
|
Device::Mtl(d) => {
|
||||||
let mut fences = fences
|
let mut fences = fences
|
||||||
|
|
|
@ -619,7 +619,7 @@ impl crate::Device for VkDevice {
|
||||||
Ok(device.create_semaphore(&vk::SemaphoreCreateInfo::default(), None)?)
|
Ok(device.create_semaphore(&vk::SemaphoreCreateInfo::default(), None)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe fn wait_and_reset(&self, fences: &[&mut Self::Fence]) -> Result<(), Error> {
|
unsafe fn wait_and_reset(&self, fences: Vec<&mut Self::Fence>) -> Result<(), Error> {
|
||||||
let device = &self.device.device;
|
let device = &self.device.device;
|
||||||
let fences = fences
|
let fences = fences
|
||||||
.iter()
|
.iter()
|
||||||
|
|
Loading…
Reference in a new issue