Skip to content

Commit

Permalink
MVKDevice: Clamp max per-set descriptor limit to minimum 1024.
Browse files Browse the repository at this point in the history
As required by the Vulkan spec.

Fixes the CTS tests
`dEQP-VK.api.info.vulkan1p2_limits_validation.khr_maintenance_3` and
`dEQP-VK.api.maintenance3_check.maintenance3_properties`.
  • Loading branch information
cdavis5e committed Nov 21, 2023
1 parent a7dc8da commit 3f88fbb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,9 @@
supportedProps11.maxMultiviewViewCount = 32;
supportedProps11.maxMultiviewInstanceIndex = canUseInstancingForMultiview() ? uintMax / 32 : uintMax;
supportedProps11.protectedNoFault = false;
supportedProps11.maxPerSetDescriptors = 4 * (_metalFeatures.maxPerStageBufferCount +
supportedProps11.maxPerSetDescriptors = max(4 * (_metalFeatures.maxPerStageBufferCount +
_metalFeatures.maxPerStageTextureCount +
_metalFeatures.maxPerStageSamplerCount);
_metalFeatures.maxPerStageSamplerCount), 1024u);
supportedProps11.maxMemoryAllocationSize = _metalFeatures.maxMTLBufferSize;

// Create a SSOT for these Vulkan 1.2 properties, which can be queried via two mechanisms here.
Expand Down Expand Up @@ -3499,7 +3499,9 @@ static uint32_t mvkGetEntryProperty(io_registry_entry_t entry, CFStringRef prope
for (uint32_t i = 0; i < pCreateInfo->bindingCount; i++) {
descriptorCount += pCreateInfo->pBindings[i].descriptorCount;
}
pSupport->supported = (descriptorCount < ((_physicalDevice->_metalFeatures.maxPerStageBufferCount + _physicalDevice->_metalFeatures.maxPerStageTextureCount + _physicalDevice->_metalFeatures.maxPerStageSamplerCount) * 2));
pSupport->supported = (descriptorCount < max(4 * (_physicalDevice->_metalFeatures.maxPerStageBufferCount +
_physicalDevice->_metalFeatures.maxPerStageTextureCount +
_physicalDevice->_metalFeatures.maxPerStageSamplerCount), 1024u));

// Check whether the layout has a variable-count descriptor, and if so, whether we can support it.
for (auto* next = (VkBaseOutStructure*)pSupport->pNext; next; next = next->pNext) {
Expand Down

0 comments on commit 3f88fbb

Please sign in to comment.