VulkanDevice: Fix possible null descriptor set with feedback loop

This commit is contained in:
Stenzek 2024-04-30 21:30:59 +10:00
parent cbe95b281a
commit 6a02f9c67b
No known key found for this signature in database

View file

@ -3704,20 +3704,14 @@ void VulkanDevice::PreDrawCheck()
const u32 update_mask = (m_current_feedback_loop ? ~0u : ~DIRTY_FLAG_INPUT_ATTACHMENT); const u32 update_mask = (m_current_feedback_loop ? ~0u : ~DIRTY_FLAG_INPUT_ATTACHMENT);
const u32 dirty = m_dirty_flags & update_mask; const u32 dirty = m_dirty_flags & update_mask;
m_dirty_flags = m_dirty_flags & ~update_mask; m_dirty_flags = m_dirty_flags & ~update_mask;
if (dirty & DIRTY_FLAG_PIPELINE_LAYOUT && !(dirty & DIRTY_FLAG_INPUT_ATTACHMENT))
m_dirty_flags |= DIRTY_FLAG_INPUT_ATTACHMENT; // TODO: FOR NEXT TIME
if (dirty != 0) if (dirty != 0)
{ {
if (dirty & (DIRTY_FLAG_PIPELINE_LAYOUT | DIRTY_FLAG_DYNAMIC_OFFSETS | DIRTY_FLAG_TEXTURES_OR_SAMPLERS | if (!UpdateDescriptorSets(dirty))
DIRTY_FLAG_INPUT_ATTACHMENT))
{ {
if (!UpdateDescriptorSets(dirty)) SubmitCommandBufferAndRestartRenderPass("out of descriptor sets");
{ PreDrawCheck();
SubmitCommandBufferAndRestartRenderPass("out of descriptor sets"); return;
PreDrawCheck();
return;
}
} }
} }
} }
@ -3800,7 +3794,8 @@ bool VulkanDevice::UpdateDescriptorSetsForLayout(u32 dirty)
layout == GPUPipeline::Layout::SingleTextureAndPushConstants || layout == GPUPipeline::Layout::SingleTextureAndPushConstants ||
layout == GPUPipeline::Layout::SingleTextureBufferAndPushConstants) layout == GPUPipeline::Layout::SingleTextureBufferAndPushConstants)
{ {
if (dirty & DIRTY_FLAG_INPUT_ATTACHMENT) if ((dirty & DIRTY_FLAG_INPUT_ATTACHMENT) ||
(dirty & DIRTY_FLAG_PIPELINE_LAYOUT && (m_current_feedback_loop & GPUPipeline::ColorFeedbackLoop)))
{ {
VkDescriptorSet ids = AllocateDescriptorSet(m_feedback_loop_ds_layout); VkDescriptorSet ids = AllocateDescriptorSet(m_feedback_loop_ds_layout);
if (ids == VK_NULL_HANDLE) if (ids == VK_NULL_HANDLE)