Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Random Crashes when Using Pool with Freeable Descriptor Sets #2388

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion MoltenVK/MoltenVK/GPUObjects/MVKDescriptorSet.mm
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,6 @@ static void populateAuxBuffer(mvk::SPIRVToMSLConversionConfiguration& shaderConf
// on a reset pool), set the offset and update the next available offset value.
if ( !mtlArgBuffOffset && (dsIdx || !_nextMetalArgumentBufferOffset)) {
mtlArgBuffOffset = _nextMetalArgumentBufferOffset;
_nextMetalArgumentBufferOffset += mtlArgBuffEncAlignedSize;
}

// Get the offset of the next desc set, if one exists and
Expand All @@ -780,6 +779,11 @@ static void populateAuxBuffer(mvk::SPIRVToMSLConversionConfiguration& shaderConf
} else {
_descriptorSetAvailablility.disableBit(dsIdx);
_maxAllocDescSetCount = std::max(_maxAllocDescSetCount, dsIdx + 1);
if ((dsIdx + 1) == _maxAllocDescSetCount)
{
// if this is the highest index set, update the next free arg buffer offset
_nextMetalArgumentBufferOffset = mtlArgBuffOffset + mtlArgBuffEncAlignedSize;
}
*pVKDS = (VkDescriptorSet)mvkDS;
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion MoltenVK/MoltenVK/Utility/MVKBitArray.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class MVKBitArray {
for (size_t bitIdx = getIndexOfFirstEnabledBit();
bitIdx < _bitCount;
bitIdx = getIndexOfFirstEnabledBit(++bitIdx)) {

if ( !getBit(bitIdx)) { continue; }
if ( !func(bitIdx) ) { return false; }
}
return true;
Expand Down
Loading