VideoBackends:Vulkan: Make dynamic vertex loader optional

Makes it easier to disable in the future if support for VK_EXT_vertex_input_dynamic_state is added
This commit is contained in:
TellowKrinkle 2022-07-10 20:01:38 -05:00
parent dae56a24b8
commit 28b31b8327
2 changed files with 22 additions and 13 deletions

View file

@ -247,6 +247,10 @@ bool ObjectCache::CreatePipelineLayouts()
// If bounding box is unsupported, don't bother with the SSBO descriptor set.
if (!g_ActiveConfig.backend_info.bSupportsBBox)
pipeline_layout_info[PIPELINE_LAYOUT_STANDARD].setLayoutCount--;
// If neither SSBO-using feature is supported, skip in ubershaders too
if (!g_ActiveConfig.backend_info.bSupportsBBox &&
!g_ActiveConfig.backend_info.bSupportsDynamicVertexLoader)
pipeline_layout_info[PIPELINE_LAYOUT_UBER].setLayoutCount--;
for (size_t i = 0; i < pipeline_layout_info.size(); i++)
{

View file

@ -375,8 +375,9 @@ bool StateTracker::Bind()
// Re-bind parts of the pipeline
const VkCommandBuffer command_buffer = g_command_buffer_mgr->GetCurrentCommandBuffer();
if (m_pipeline->GetUsage() != AbstractPipelineUsage::GXUber &&
(m_dirty_flags & DIRTY_FLAG_VERTEX_BUFFER))
const bool needs_vertex_buffer = !g_ActiveConfig.backend_info.bSupportsDynamicVertexLoader ||
m_pipeline->GetUsage() != AbstractPipelineUsage::GXUber;
if (needs_vertex_buffer && (m_dirty_flags & DIRTY_FLAG_VERTEX_BUFFER))
{
vkCmdBindVertexBuffers(command_buffer, 0, 1, &m_vertex_buffer, &m_vertex_buffer_offset);
m_dirty_flags &= ~DIRTY_FLAG_VERTEX_BUFFER;
@ -530,7 +531,8 @@ bool StateTracker::UpdateGXDescriptorSet()
}
const bool needs_bbox_ssbo = g_ActiveConfig.backend_info.bSupportsBBox;
const bool needs_vertex_ssbo = m_pipeline->GetUsage() == AbstractPipelineUsage::GXUber;
const bool needs_vertex_ssbo = g_ActiveConfig.backend_info.bSupportsDynamicVertexLoader &&
m_pipeline->GetUsage() == AbstractPipelineUsage::GXUber;
const bool needs_ssbo = needs_bbox_ssbo || needs_vertex_ssbo;
if (needs_ssbo &&
@ -546,16 +548,19 @@ bool StateTracker::UpdateGXDescriptorSet()
VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET, nullptr, m_gx_descriptor_sets[2], 0, 0, 1,
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, nullptr, &m_bindings.ssbo, nullptr};
writes[num_writes++] = {VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
nullptr,
m_gx_descriptor_sets[2],
1,
0,
1,
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
nullptr,
&m_bindings.gx_uber_vertex_ssbo,
nullptr};
if (g_ActiveConfig.backend_info.bSupportsDynamicVertexLoader)
{
writes[num_writes++] = {VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
nullptr,
m_gx_descriptor_sets[2],
1,
0,
1,
VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
nullptr,
&m_bindings.gx_uber_vertex_ssbo,
nullptr};
}
m_dirty_flags = (m_dirty_flags & ~DIRTY_FLAG_GX_SSBO) | DIRTY_FLAG_DESCRIPTOR_SETS;
}