gsk/vulkan: using more sampled images that maxPerStageDescriptorUpdateAfterBindSampledImages
This was found using the rpi4/rpi400, while debugging nautilus issues using the vulkan renderer, mentioned here #6726 (comment 2121079).
Using the Validation Layers we get the following:
VUID-VkPipelineLayoutCreateInfo-descriptorType-06939(ERROR / SPEC): msgNum: 1621066779 - Validation Error: [ VUID-VkPipelineLayoutCreateInfo-descriptorType-06939 ] | MessageID = 0x609f841b | vkCreatePipelineLayout(): max per-stage sampled image bindings count (17) exceeds device maxPerStageDescriptorSampledImages 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_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://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkPipelineLayoutCreateInfo-descriptorType-06939)
Current value for maxPerStageDescriptorSampledImages on v3dv is 16. v3dv tries to keep the maximum amount of descriptors limited to avoid too much register pressure when compiling the shaders.
Doing a quick experiment to increase that value, the warning goes away when we increase it to 33.
Having said so, skimming quickly the gtk code, the code is already trying to take into account that limit, like for example some checks at gsk_vulkan_real_descriptors_add_image
.