From: Joshua Simmons Date: Tue, 25 Jul 2023 07:43:18 +0000 (+0200) Subject: narcissus-gpu: Add Default bound to Tlsf super blocks X-Git-Url: https://git.nega.tv//gitweb.cgi?a=commitdiff_plain;h=939f36a986c06a88fe6aa3a7e5d25cb771cb0cf4;p=josh%2Fnarcissus narcissus-gpu: Add Default bound to Tlsf super blocks --- diff --git a/libs/narcissus-gpu/src/backend/vulkan/allocator.rs b/libs/narcissus-gpu/src/backend/vulkan/allocator.rs index 565fa19..59f18b8 100644 --- a/libs/narcissus-gpu/src/backend/vulkan/allocator.rs +++ b/libs/narcissus-gpu/src/backend/vulkan/allocator.rs @@ -90,6 +90,17 @@ pub struct VulkanSuperBlockInfo { memory_type_index: u32, } +impl Default for VulkanSuperBlockInfo { + fn default() -> Self { + Self { + memory: vk::DeviceMemory::null(), + mapped_ptr: std::ptr::null_mut(), + non_linear: false, + memory_type_index: !0, + } + } +} + #[derive(Clone)] pub struct VulkanMemoryDedicated { memory: vk::DeviceMemory, diff --git a/libs/narcissus-gpu/src/tlsf.rs b/libs/narcissus-gpu/src/tlsf.rs index 5e812a7..2d99c4d 100644 --- a/libs/narcissus-gpu/src/tlsf.rs +++ b/libs/narcissus-gpu/src/tlsf.rs @@ -115,7 +115,7 @@ struct SuperBlockIndex(u32); pub struct SuperBlock where - T: Copy, + T: Copy + Default, { _first_block_index: BlockIndex, pub user_data: T, @@ -234,7 +234,7 @@ impl IndexMut for Vec { impl Index for Vec> where - T: Copy, + T: Copy + Default, { type Output = SuperBlock; @@ -246,7 +246,7 @@ where impl IndexMut for Vec> where - T: Copy, + T: Copy + Default, { #[inline(always)] fn index_mut(&mut self, index: SuperBlockIndex) -> &mut Self::Output { @@ -275,7 +275,7 @@ impl Allocation { pub struct Tlsf where - T: Copy, + T: Copy + Default, { bitmap_0: u32, bitmap_1: [u32; BIN_COUNT], @@ -289,7 +289,7 @@ where impl Default for Tlsf where - T: Copy, + T: Copy + Default, { fn default() -> Self { Self::new() @@ -298,7 +298,7 @@ where impl Tlsf where - T: Copy, + T: Copy + Default, { pub fn new() -> Self { Self {