]> git.nega.tv - josh/narcissus/commitdiff
narcissus-gpu: Add storage images to descriptor pool
authorJoshua Simmons <josh@nega.tv>
Sat, 4 Oct 2025 20:53:16 +0000 (22:53 +0200)
committerJoshua Simmons <josh@nega.tv>
Sat, 4 Oct 2025 21:03:36 +0000 (23:03 +0200)
engine/narcissus-gpu/src/backend/vulkan/mod.rs

index b9c032e952348c48f84b1441bd82946d82061c53..9180c01acbc9fbfcfb8508badaaeb554d30befa7 100644 (file)
@@ -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;