1
0
Fork 0
mirror of https://github.com/italicsjenga/portability.git synced 2025-02-23 17:47:43 +11:00

Release physical devices properly

This commit is contained in:
Dzmitry Malyshau 2018-04-18 18:37:14 -04:00
parent 78cfa871dd
commit 4005f014bd
2 changed files with 9 additions and 9 deletions
libportability-gfx/src

View file

@ -60,8 +60,9 @@ pub extern "C" fn gfxDestroyInstance(
instance: VkInstance, instance: VkInstance,
_pAllocator: *const VkAllocationCallbacks, _pAllocator: *const VkAllocationCallbacks,
) { ) {
let _ = instance.unbox(); for adapter in instance.unbox().adapters {
//let it drop let _ = adapter.unbox();
}
} }
#[inline] #[inline]

View file

@ -32,14 +32,8 @@ pub use impls::*;
// Vulkan objects // Vulkan objects
pub type VkPhysicalDevice = Handle<hal::Adapter<B>>;
pub struct RawInstance {
pub backend: back::Instance,
pub adapters: Vec<VkPhysicalDevice>,
}
pub type VkInstance = Handle<RawInstance>; pub type VkInstance = Handle<RawInstance>;
pub type VkPhysicalDevice = Handle<hal::Adapter<B>>;
pub type VkDevice = DispatchHandle<Gpu<B>>; pub type VkDevice = DispatchHandle<Gpu<B>>;
pub type VkQueue = DispatchHandle<<B as hal::Backend>::CommandQueue>; pub type VkQueue = DispatchHandle<<B as hal::Backend>::CommandQueue>;
pub type VkCommandPool = Handle<CommandPool<B>>; pub type VkCommandPool = Handle<CommandPool<B>>;
@ -63,6 +57,11 @@ pub type VkPipeline = Handle<Pipeline<B>>;
pub type QueueFamilyIndex = u32; pub type QueueFamilyIndex = u32;
pub struct RawInstance {
pub backend: back::Instance,
pub adapters: Vec<VkPhysicalDevice>,
}
pub struct Gpu<B: hal::Backend> { pub struct Gpu<B: hal::Backend> {
device: B::Device, device: B::Device,
queues: HashMap<QueueFamilyIndex, Vec<VkQueue>>, queues: HashMap<QueueFamilyIndex, Vec<VkQueue>>,