diff --git a/renderdoc/driver/vulkan/vk_shader_feedback.cpp b/renderdoc/driver/vulkan/vk_shader_feedback.cpp index efa1ce633..ff476ccf8 100644 --- a/renderdoc/driver/vulkan/vk_shader_feedback.cpp +++ b/renderdoc/driver/vulkan/vk_shader_feedback.cpp @@ -1573,6 +1573,9 @@ bool VulkanReplay::FetchShaderFeedback(uint32_t eventId) if(pipeLayouts[i] == ResourceId()) continue; + const rdcarray &descSets = + (result.compute ? state.compute.descSets : state.graphics.descSets); + rdcspv::Binding key; for(size_t set = 0; set < pipeInfo.descSetLayouts.size(); set++) @@ -1593,11 +1596,26 @@ bool VulkanReplay::FetchShaderFeedback(uint32_t eventId) if(bindData.descriptorCount > 1 && bindData.layoutDescType != VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK) { + uint32_t descriptorCount = bindData.descriptorCount; + if(bindData.variableSize) + { + if(set < descSets.size()) + { + ResourceId descSet = descSets[set].descSet; + if(descSet != ResourceId()) + { + auto it = m_pDriver->m_DescriptorSetState.find(descSet); + if(it != m_pDriver->m_DescriptorSetState.end()) + descriptorCount = it->second.data.variableDescriptorCount; + } + } + } + key.binding = (uint32_t)binding; - offsetMap[key] = {feedbackStorageSize, bindData.descriptorCount}; + offsetMap[key] = {feedbackStorageSize, descriptorCount}; - feedbackStorageSize += bindData.descriptorCount * sizeof(uint32_t); + feedbackStorageSize += descriptorCount * sizeof(uint32_t); } } }