From b16c618e7b863ce35aeb6988f51129b52fb22e11 Mon Sep 17 00:00:00 2001 From: William Brown <333will333@gmail.com> Date: Tue, 17 Sep 2024 21:12:19 -0400 Subject: [PATCH] Fix some random crashes when using argument buffers Fixes an issue with BitArray enumeration, where it could iterate over bit indices that weren't set This would cause issues in descriptor set allocation, when argument buffers are enabled, where it could select a set index from the pool that isn't freed, and try to create a new set on top of the exiting one --- MoltenVK/MoltenVK/Utility/MVKBitArray.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MoltenVK/MoltenVK/Utility/MVKBitArray.h b/MoltenVK/MoltenVK/Utility/MVKBitArray.h index e7959f7c0..6f9afa3dd 100755 --- a/MoltenVK/MoltenVK/Utility/MVKBitArray.h +++ b/MoltenVK/MoltenVK/Utility/MVKBitArray.h @@ -155,7 +155,7 @@ class MVKBitArray { bool enumerateEnabledBits(bool shouldClear, std::function func) { for (size_t bitIdx = getIndexOfFirstSetBit(shouldClear); bitIdx < _bitCount; - getIndexOfFirstSetBit(++bitIdx, shouldClear)) { + bitIdx = getIndexOfFirstSetBit(++bitIdx, shouldClear)) { if ( !func(bitIdx) ) { return false; } }