Skip to content

Commit

Permalink
Handle variable sized descriptor sets in FetchShaderFeedback
Browse files Browse the repository at this point in the history
For variable sized descriptor sets compute feedbackStorageSize using the active descriptor set layout instead of the creation time data.
  • Loading branch information
Zorro666 committed Nov 1, 2023
1 parent d37026d commit 9204451
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions renderdoc/driver/vulkan/vk_shader_feedback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1579,6 +1579,9 @@ bool VulkanReplay::FetchShaderFeedback(uint32_t eventId)
if(pipeLayouts[i] == ResourceId())
continue;

const rdcarray<VulkanStatePipeline::DescriptorAndOffsets> &descSets =
(result.compute ? state.compute.descSets : state.graphics.descSets);

rdcspv::Binding key;

for(size_t set = 0; set < pipeInfo.descSetLayouts.size(); set++)
Expand All @@ -1599,11 +1602,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);
}
}
}
Expand Down

0 comments on commit 9204451

Please sign in to comment.