From a217a0b48aa6a484005017b03103a43a69685139 Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Fri, 17 Apr 2026 00:28:07 -0700 Subject: [PATCH] vk: fix descriptor uniform size overallocation --- blade-graphics/Cargo.toml | 2 +- blade-graphics/src/vulkan/descriptor.rs | 8 +++++++- docs/CHANGELOG.md | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/blade-graphics/Cargo.toml b/blade-graphics/Cargo.toml index 0bbeb548..94ef44ed 100644 --- a/blade-graphics/Cargo.toml +++ b/blade-graphics/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "blade-graphics" -version = "0.8.2" +version = "0.8.3" edition = "2024" description = "Graphics abstraction for Blade" keywords = ["graphics"] diff --git a/blade-graphics/src/vulkan/descriptor.rs b/blade-graphics/src/vulkan/descriptor.rs index 73f1d2c4..dc9e09a6 100644 --- a/blade-graphics/src/vulkan/descriptor.rs +++ b/blade-graphics/src/vulkan/descriptor.rs @@ -3,6 +3,12 @@ use ash::vk; //TODO: replace by an abstraction in `gpu-descriptor` // https://github.com/zakarumych/gpu-descriptor/issues/42 const COUNT_BASE: u32 = 16; +/// Budget for inline uniform block bytes per descriptor set. +/// The hardware max (e.g. 4 MiB on RADV) is far larger than actual +/// usage (typically 32–256 bytes of push constants per set). +/// Using the hardware max as the multiplier causes pool creation to +/// request more memory than the device has (e.g. 4096 sets × 4 MiB = 16 GiB). +const IUB_BYTES_PER_SET: u32 = 4096; #[derive(Debug)] pub struct DescriptorPool { @@ -34,7 +40,7 @@ impl super::Device { if self.max_inline_uniform_block_size > 0 { descriptor_sizes.push(vk::DescriptorPoolSize { ty: vk::DescriptorType::INLINE_UNIFORM_BLOCK_EXT, - descriptor_count: max_sets * self.max_inline_uniform_block_size, + descriptor_count: max_sets * IUB_BYTES_PER_SET, }); } // Always include UBO type: needed as fallback when bindings exceed diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 54506d7b..055b1fc5 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,6 +1,10 @@ Changelog for *Blade* project -## blade-graphics-0.8.2 (4 Apr 2026) +## blade-graphics-0.8.3 (17 Apr 2026) + +- vk: fix descriptor over-allocation for uniform data + +## blade-graphics-0.8.2 (14 Apr 2026) - add `ComputeCommandEncoder::barrier()` for inline compute-to-compute synchronization within a pass - enable `naga::valid::Capabilities::SUBGROUP` for shader validation