SecondHalfGames / yakui

yakui is a declarative Rust UI library for games
Apache License 2.0
237 stars 21 forks source link

vulkan: Fix validation warnings on macOS #160

Closed kanerogers closed 6 months ago

kanerogers commented 6 months ago

Background

macOS devices running on MoltenVK have bizarrely low physical limits, especially for image samplers. We work around this by using descriptor indexing features, however, they must be configured correctly in order appease the validation layers:

VUID-VkPipelineLayoutCreateInfo-descriptorType-03016(ERROR / SPEC): msgNum: 1451322977 - Validation Error: [ VUID-VkPipelineLayoutCreateInfo-descriptorType-03016 ] | MessageID = 0x56816e61 | vkCreatePipelineLayout():  max per-stage sampler bindings count (1000) exceeds device maxPerStageDescriptorSamplers limit (16). The Vulkan spec states: The total number of descriptors in descriptor set layouts created without the VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT bit set with a descriptorType of VK_DESCRIPTOR_TYPE_SAMPLER and VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER accessible to any given shader stage across all elements of pSetLayouts must be less than or equal to VkPhysicalDeviceLimits::maxPerStageDescriptorSamplers (https://vulkan.lunarg.com/doc/view/1.3.280.0/mac/1.3-extensions/vkspec.html#VUID-VkPipelineLayoutCreateInfo-descriptorType-03016)
    Objects: 0
VUID-VkPipelineLayoutCreateInfo-descriptorType-06939(ERROR / SPEC): msgNum: 1621066779 - Validation Error: [ VUID-VkPipelineLayoutCreateInfo-descriptorType-06939 ] | MessageID = 0x609f841b | vkCreatePipelineLayout():  max per-stage sampled image bindings count (1000) exceeds device maxPerStageDescriptorSampledImages limit (128). The Vulkan spec states: The total number of descriptors in descriptor set layouts created without the VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT bit set with a descriptorType of VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, VK_DESCRIPTOR_TYPE_SAMPLE_WEIGHT_IMAGE_QCOM, VK_DESCRIPTOR_TYPE_BLOCK_MATCH_IMAGE_QCOM, and VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER, accessible to any given shader stage across all elements of pSetLayouts must be less than or equal to VkPhysicalDeviceLimits::maxPerStageDescriptorSampledImages (https://vulkan.lunarg.com/doc/view/1.3.280.0/mac/1.3-extensions/vkspec.html#VUID-VkPipelineLayoutCreateInfo-descriptorType-06939)
    Objects: 0
VUID-VkPipelineLayoutCreateInfo-descriptorType-03028(ERROR / SPEC): msgNum: 1649030924 - Validation Error: [ VUID-VkPipelineLayoutCreateInfo-descriptorType-03028 ] | MessageID = 0x624a370c | vkCreatePipelineLayout():  sum of sampler bindings among all stages (1000) exceeds device maxDescriptorSetSamplers limit (80). The Vulkan spec states: The total number of descriptors in descriptor set layouts created without the VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT bit set with a descriptorType of VK_DESCRIPTOR_TYPE_SAMPLER and VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER accessible across all shader stages and across all elements of pSetLayouts must be less than or equal to VkPhysicalDeviceLimits::maxDescriptorSetSamplers (https://vulkan.lunarg.com/doc/view/1.3.280.0/mac/1.3-extensions/vkspec.html#VUID-VkPipelineLayoutCreateInfo-descriptorType-03028)
    Objects: 0
VUID-VkPipelineLayoutCreateInfo-descriptorType-03033(ERROR / SPEC): msgNum: 1719637218 - Validation Error: [ VUID-VkPipelineLayoutCreateInfo-descriptorType-03033 ] | MessageID = 0x667f94e2 | vkCreatePipelineLayout():  sum of sampled image bindings among all stages (1000) exceeds device maxDescriptorSetSampledImages limit (640). The Vulkan spec states: The total number of descriptors in descriptor set layouts created without the VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT bit set with a descriptorType of VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, and VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER accessible across all shader stages and across all elements of pSetLayouts must be less than or equal to VkPhysicalDeviceLimits::maxDescriptorSetSampledImages (https://vulkan.lunarg.com/doc/view/1.3.280.0/mac/1.3-extensions/vkspec.html#VUID-VkPipelineLayoutCreateInfo-descriptorType-03033)
    Objects: 0
VUID-VkGraphicsPipelineCreateInfo-layout-01688(ERROR / SPEC): msgNum: 1143872976 - Validation Error: [ VUID-VkGraphicsPipelineCreateInfo-layout-01688 ] | MessageID = 0x442e1dd0 | vkCreateGraphicsPipelines(): pCreateInfos[0].pStages[1] VK_SHADER_STAGE_FRAGMENT_BIT exceeds component limit VkPhysicalDeviceLimits::maxPerStageResources (159). The Vulkan spec states: The number of resources in layout accessible to each shader stage that is used by the pipeline must be less than or equal to VkPhysicalDeviceLimits::maxPerStageResources (https://vulkan.lunarg.com/doc/view/1.3.280.0/mac/1.3-extensions/vkspec.html#VUID-VkGraphicsPipelineCreateInfo-layout-01688)
    Objects: 0

TODO