From 76f917621bd14ad95f7f5516eff357dd93799afb Mon Sep 17 00:00:00 2001 From: Jake Turner Date: Fri, 31 May 2024 11:21:30 +0100 Subject: [PATCH] Ignore static bindings which are not present in the descriptor set layout --- renderdoc/driver/vulkan/vk_info.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/renderdoc/driver/vulkan/vk_info.cpp b/renderdoc/driver/vulkan/vk_info.cpp index 7428bc1c6..3f52e00fe 100644 --- a/renderdoc/driver/vulkan/vk_info.cpp +++ b/renderdoc/driver/vulkan/vk_info.cpp @@ -829,6 +829,8 @@ void VulkanCreationInfo::ShaderEntry::ProcessStaticDescriptorAccess( if(!refl) return; + const uint32_t descSetLayoutsCount = (uint32_t)setLayoutInfos.size(); + DescriptorAccess access; access.stage = refl->stage; @@ -871,6 +873,11 @@ void VulkanCreationInfo::ShaderEntry::ProcessStaticDescriptorAccess( } else { + // Ignore bindings which are not in the descriptor set layouts + if((bind.fixedBindSetOrSpace >= descSetLayoutsCount) || + bind.fixedBindNumber >= setLayoutInfos[bind.fixedBindSetOrSpace]->bindings.size()) + continue; + access.descriptorStore = ResourceId(); // VkShaderStageFlagBits and ShaderStageMask are identical bit-for-bit. @@ -898,6 +905,11 @@ void VulkanCreationInfo::ShaderEntry::ProcessStaticDescriptorAccess( if(bind.bindArraySize > 1) continue; + // Ignore bindings which are not in the descriptor set layouts + if((bind.fixedBindSetOrSpace >= descSetLayoutsCount) || + bind.fixedBindNumber >= setLayoutInfos[bind.fixedBindSetOrSpace]->bindings.size()) + continue; + // VkShaderStageFlagBits and ShaderStageMask are identical bit-for-bit. // this might be deliberate if the binding is never actually used dynamically, only // statically used bindings must be declared @@ -921,6 +933,11 @@ void VulkanCreationInfo::ShaderEntry::ProcessStaticDescriptorAccess( if(bind.bindArraySize > 1) continue; + // Ignore bindings which are not in the descriptor set layouts + if((bind.fixedBindSetOrSpace >= descSetLayoutsCount) || + bind.fixedBindNumber >= setLayoutInfos[bind.fixedBindSetOrSpace]->bindings.size()) + continue; + // VkShaderStageFlagBits and ShaderStageMask are identical bit-for-bit. // this might be deliberate if the binding is never actually used dynamically, only // statically used bindings must be declared @@ -944,6 +961,11 @@ void VulkanCreationInfo::ShaderEntry::ProcessStaticDescriptorAccess( if(bind.bindArraySize > 1) continue; + // Ignore bindings which are not in the descriptor set layouts + if((bind.fixedBindSetOrSpace >= descSetLayoutsCount) || + bind.fixedBindNumber >= setLayoutInfos[bind.fixedBindSetOrSpace]->bindings.size()) + continue; + // VkShaderStageFlagBits and ShaderStageMask are identical bit-for-bit. // this might be deliberate if the binding is never actually used dynamically, only // statically used bindings must be declared