From: Joshua Simmons Date: Sat, 4 Oct 2025 20:53:16 +0000 (+0200) Subject: narcissus-gpu: Add storage images to descriptor pool X-Git-Url: https://git.nega.tv//gitweb.cgi?a=commitdiff_plain;h=4c9cbf9277df2233d8723731d255723be37bf570;p=josh%2Fnarcissus narcissus-gpu: Add storage images to descriptor pool --- diff --git a/engine/narcissus-gpu/src/backend/vulkan/mod.rs b/engine/narcissus-gpu/src/backend/vulkan/mod.rs index b9c032e..9180c01 100644 --- a/engine/narcissus-gpu/src/backend/vulkan/mod.rs +++ b/engine/narcissus-gpu/src/backend/vulkan/mod.rs @@ -84,6 +84,8 @@ pub struct VulkanConstants { descriptor_pool_storage_buffer_count: u32, /// The number of sampled image descriptors available in each descriptor pool. descriptor_pool_sampled_image_count: u32, + /// The number of storage image descriptors available in each descriptor pool. + descriptor_pool_storage_image_count: u32, } const VULKAN_CONSTANTS: VulkanConstants = VulkanConstants { @@ -98,6 +100,7 @@ const VULKAN_CONSTANTS: VulkanConstants = VulkanConstants { descriptor_pool_uniform_buffer_count: 500, descriptor_pool_storage_buffer_count: 500, descriptor_pool_sampled_image_count: 500, + descriptor_pool_storage_image_count: 500, }; #[macro_export] @@ -804,6 +807,10 @@ impl VulkanDevice { descriptor_type: vk::DescriptorType::SampledImage, descriptor_count: VULKAN_CONSTANTS.descriptor_pool_sampled_image_count, }, + vk::DescriptorPoolSize { + descriptor_type: vk::DescriptorType::StorageImage, + descriptor_count: VULKAN_CONSTANTS.descriptor_pool_storage_image_count, + }, ]; let mut descriptor_pool = vk::DescriptorPool::null(); let create_info = vk::DescriptorPoolCreateInfo { @@ -976,7 +983,7 @@ impl Device for VulkanDevice { if image_desc.dimension == ImageDimension::TypeCube { debug_assert!( - image_desc.layer_count % 6 == 0, + image_desc.layer_count.is_multiple_of(6), "cubemaps must have 6 layers each" ); debug_assert_eq!(image_desc.depth, 1, "cubemap faces must be 2d"); @@ -2782,7 +2789,7 @@ impl Device for VulkanDevice { vk_check!(unsafe { self.device_fn.device_wait_idle(self.device) }); } - fn begin_frame(&self) -> Frame { + fn begin_frame(&self) -> Frame<'_> { let device_fn = &self.device_fn; let device = self.device;