1
0
Fork 0
forked from wry/wry

Merge pull request #373 from mahkoh/jorth/descriptor-buffer-too-optimistic

vulkan: don't equate buffer size with allocation size
This commit is contained in:
mahkoh 2025-02-19 11:06:32 +01:00 committed by GitHub
commit 616bd5b3da
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -63,6 +63,8 @@ impl VulkanDescriptorBufferCache {
self: &Rc<Self>,
capacity: DeviceSize,
) -> Result<VulkanDescriptorBuffer, VulkanError> {
const MIN_ALLOCATION: DeviceSize = 1024;
let capacity = capacity.max(MIN_ALLOCATION);
let mut smallest = None;
let mut smallest_size = DeviceSize::MAX;
let mut fitting = None;
@ -128,7 +130,7 @@ impl VulkanDescriptorBufferCache {
cache: self.clone(),
buffer: ManuallyDrop::new(VulkanDescriptorBufferUnused {
device: self.device.clone(),
size: allocation.size,
size,
buffer,
allocation,
address,