Don't crash on empty descriptor sets with no bindings

This commit is contained in:
baldurk
2024-04-16 20:03:54 +01:00
parent d4b8504bdc
commit 78e84aa544
3 changed files with 13 additions and 5 deletions
+4 -3
View File
@@ -2044,7 +2044,8 @@ void VulkanReplay::SavePipelineState(uint32_t eventId)
const WrappedVulkan::DescriptorSetInfo &descSetState =
m_pDriver->m_DescriptorSetState[sourceSet];
const DescriptorSetSlot *first = descSetState.data.binds[0];
const DescriptorSetSlot *first =
descSetState.data.binds.empty() ? NULL : descSetState.data.binds[0];
for(size_t b = 0; b < descSetState.data.binds.size(); b++)
{
const DescSetLayout::Binding &layoutBind =
@@ -2435,7 +2436,7 @@ rdcarray<Descriptor> VulkanReplay::GetDescriptors(ResourceId descriptorStore,
size_t dst = 0;
for(const DescriptorRange &r : ranges)
{
const DescriptorSetSlot *desc = set.data.binds[0];
const DescriptorSetSlot *desc = set.data.binds.empty() ? NULL : set.data.binds[0];
const DescriptorSetSlot *end = desc + set.data.totalDescriptorCount();
desc += (r.offset - set.data.inlineBytes.size());
@@ -2508,7 +2509,7 @@ rdcarray<SamplerDescriptor> VulkanReplay::GetSamplerDescriptors(ResourceId descr
size_t dst = 0;
for(const DescriptorRange &r : ranges)
{
const DescriptorSetSlot *desc = set.data.binds[0];
const DescriptorSetSlot *desc = set.data.binds.empty() ? NULL : set.data.binds[0];
const DescriptorSetSlot *end = desc + set.data.totalDescriptorCount();
desc += r.offset;
+1 -1
View File
@@ -209,7 +209,7 @@ public:
const BindingStorage &bindStorage =
m_pDriver->GetCurrentDescSetBindingStorage(srcData.descSet);
const DescriptorSetSlot *first = bindStorage.binds[0];
const DescriptorSetSlot *first = bindStorage.binds.empty() ? NULL : bindStorage.binds[0];
for(size_t b = 0; b < bindStorage.binds.size(); b++)
{
const DescSetLayout::Binding &layoutBind =
+8 -1
View File
@@ -581,8 +581,13 @@ void main()
VkDescriptorSet asm_descset = allocateDescriptorSet(asm_setlayout);
VkDescriptorSetLayout empty_setlayout =
createDescriptorSetLayout(vkh::DescriptorSetLayoutCreateInfo({}));
VkDescriptorSet empty_descset = allocateDescriptorSet(empty_setlayout);
VkPipelineLayout asm_layout = createPipelineLayout(vkh::PipelineLayoutCreateInfo(
{asm_setlayout}, {vkh::PushConstantRange(VK_SHADER_STAGE_VERTEX_BIT, 0, 4)}));
{asm_setlayout, empty_setlayout}, {vkh::PushConstantRange(VK_SHADER_STAGE_VERTEX_BIT, 0, 4)}));
vkh::RenderPassCreator renderPassCreateInfo;
@@ -1755,6 +1760,8 @@ void main()
vkCmdPushConstants(cmd, asm_layout, VK_SHADER_STAGE_VERTEX_BIT, 0, 4, &idx);
vkh::cmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, asm_layout, 0,
{asm_descset}, {});
vkh::cmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_GRAPHICS, asm_layout, 1,
{empty_descset}, {});
setMarker(cmd, "ASM Draw");
vkCmdDraw(cmd, 4, 1, 0, 0);