Vulkan provides VkPhysicalDeviceLimits::maxDescriptorSetUniformBuffers and VkPhysicalDeviceLimits::maxDescriptorSetStorageBuffers which lets the user know how many uniform/storage buffers (respectively) can be bound per stage. However, Metal has a shared binding count for both uniform (constant) and storage (device) buffers.
Now, MoltenVK sets both VkPhysicalDeviceLimits::maxDescriptorSetUniformBuffers and VkPhysicalDeviceLimits::maxDescriptorSetStorageBuffers to the maximum value Metal provides for buffer bindings. This is an issue because if the user decides to max uniform bindings (for example), and then bind one storage buffer, the storage buffer will go out of the allowed binding range for buffers leading to an error. This is what happens in the test.
A few potential approaches to fix the issue come to mind:
Assign values to VkPhysicalDeviceLimits::maxDescriptorSetUniformBuffers and VkPhysicalDeviceLimits::maxDescriptorSetStorageBuffers such that the addition of both does not go beyond what Metal allows.
Create a flag in the portability extension to let the user know the amount of buffer bindings are allowed, both uniform and storage in total.
Request a waiver (not my preference).
Let me know if I missed something that would render my conclusion obsolete. Let me know if there's a preferred approach for the issue.
Failing CTS test:
Vulkan provides
VkPhysicalDeviceLimits::maxDescriptorSetUniformBuffers
andVkPhysicalDeviceLimits::maxDescriptorSetStorageBuffers
which lets the user know how many uniform/storage buffers (respectively) can be bound per stage. However, Metal has a shared binding count for both uniform (constant) and storage (device) buffers.Now, MoltenVK sets both
VkPhysicalDeviceLimits::maxDescriptorSetUniformBuffers
andVkPhysicalDeviceLimits::maxDescriptorSetStorageBuffers
to the maximum value Metal provides for buffer bindings. This is an issue because if the user decides to max uniform bindings (for example), and then bind one storage buffer, the storage buffer will go out of the allowed binding range for buffers leading to an error. This is what happens in the test.A few potential approaches to fix the issue come to mind:
VkPhysicalDeviceLimits::maxDescriptorSetUniformBuffers
andVkPhysicalDeviceLimits::maxDescriptorSetStorageBuffers
such that the addition of both does not go beyond what Metal allows.Let me know if I missed something that would render my conclusion obsolete. Let me know if there's a preferred approach for the issue.