vulkano-rs / vulkano

Safe and rich Rust wrapper around the Vulkan API
Apache License 2.0
4.48k stars 433 forks source link

How/when are underlying Vulkan objects destroyed? #2458

Closed johan-overbye closed 7 months ago

johan-overbye commented 7 months ago

Say for example there are no more app-side references to my vulkano::device::Device, but I hold on to a vulkano::buffer::Buffer reference. Is it correct to assume that the VkDevice is still alive because the Buffer has an Arc<Device> somewhere?

If so, is there an idiomatic way to at least assert that my device is destroyed when I expect it to be? I guess I could try_unwrap the Arc<Device> maybe?

Rua commented 7 months ago

Yes, any object that belongs to Device will hold a reference to it and keep it alive. Using try_unwrap will work.

johan-overbye commented 7 months ago

Thanks!