vk: Fix edge cases in descriptor update logic

This commit is contained in:
kd-11 2025-06-15 22:05:36 +03:00 committed by kd-11
parent bb1c0a5eee
commit 5417d4854d
2 changed files with 9 additions and 3 deletions

View file

@ -399,12 +399,11 @@ namespace vk
{ {
if (!set.m_device) if (!set.m_device)
{ {
break; continue;
} }
bind_sets[count++] = set.m_descriptor_set.value(); // Current set pointer for binding bind_sets[count++] = set.m_descriptor_set.value(); // Current set pointer for binding
set.m_descriptor_set.on_bind(); // Notify async queue set.on_bind(); // Notify bind event. Internally updates handles and triggers flushing.
set.next_descriptor_set(); // Flush queue and update pointers
} }
vkCmdBindPipeline(cmd, bind_point, m_pipeline); vkCmdBindPipeline(cmd, bind_point, m_pipeline);
@ -528,6 +527,7 @@ namespace vk
m_descriptor_set.push(m_copy_cmds, type_mask); // Write previous state m_descriptor_set.push(m_copy_cmds, type_mask); // Write previous state
m_descriptor_set = allocate_descriptor_set(); m_descriptor_set = allocate_descriptor_set();
m_any_descriptors_dirty = false;
} }
void descriptor_table_t::create_descriptor_set_layout() void descriptor_table_t::create_descriptor_set_layout()

View file

@ -138,6 +138,12 @@ namespace vk
VkDescriptorSet allocate_descriptor_set(); VkDescriptorSet allocate_descriptor_set();
void next_descriptor_set(); void next_descriptor_set();
inline void on_bind()
{
next_descriptor_set(); // Enqueue changes and update pointers
m_descriptor_set.on_bind(); // Notify async queue to flush any pending changes
}
template <typename T> template <typename T>
inline void notify_descriptor_slot_updated(u32 slot, const T& data) inline void notify_descriptor_slot_updated(u32 slot, const T& data)
{ {