Fix StandardCommandBufferAllocator deallocation in release mode (#2424)

This commit is contained in:
Adrien Vasseur 2023-12-13 12:17:32 +00:00 committed by GitHub
parent 1f99160067
commit 8608063a04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -305,9 +305,11 @@ unsafe impl CommandBufferAllocator for StandardCommandBufferAllocator {
// the first place, the size of the pool for that level must have been non-zero. // the first place, the size of the pool for that level must have been non-zero.
let buffer_reserve = pool.buffer_reserve[level as usize].as_ref().unwrap(); let buffer_reserve = pool.buffer_reserve[level as usize].as_ref().unwrap();
let res = buffer_reserve.push(allocation.inner);
// This cannot happen because every allocation is (supposed to be) returned to the pool // This cannot happen because every allocation is (supposed to be) returned to the pool
// whence it came, so there must be enough room for it. // whence it came, so there must be enough room for it.
debug_assert!(buffer_reserve.push(allocation.inner).is_ok()); debug_assert!(res.is_ok());
// We have to make sure that we only reset the pool under this condition, because there // We have to make sure that we only reset the pool under this condition, because there
// could be other references in other allocations. // could be other references in other allocations.