mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-07 15:31:26 +12:00
vk: Fixup for renderpass issues
This commit is contained in:
parent
066e53da55
commit
e449111c33
3 changed files with 30 additions and 4 deletions
|
@ -803,14 +803,31 @@ void VKGSRender::emit_geometry(u32 sub_index)
|
||||||
m_program->bind_uniform(m_vertex_layout_storage->value, binding_table.vertex_buffers_first_bind_slot + 2, m_current_frame->descriptor_set);
|
m_program->bind_uniform(m_vertex_layout_storage->value, binding_table.vertex_buffers_first_bind_slot + 2, m_current_frame->descriptor_set);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_current_subdraw_id++)
|
bool reload_state = (!m_current_subdraw_id++);
|
||||||
|
vk::renderpass_op(*m_current_command_buffer, [&](VkCommandBuffer cmd, VkRenderPass pass, VkFramebuffer fbo)
|
||||||
{
|
{
|
||||||
|
if (get_render_pass() == pass && m_draw_fbo->value == fbo)
|
||||||
|
{
|
||||||
|
// Nothing to do
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pass)
|
||||||
|
{
|
||||||
|
// Subpass mismatch, end it before proceeding
|
||||||
|
vk::end_renderpass(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
reload_state = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (reload_state)
|
||||||
|
{
|
||||||
|
vkCmdBindPipeline(*m_current_command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_program->pipeline);
|
||||||
|
|
||||||
update_draw_state();
|
update_draw_state();
|
||||||
begin_render_pass();
|
begin_render_pass();
|
||||||
|
|
||||||
// Bind pipeline after starting the renderpass to work around some validation layer spam about format mismatch
|
|
||||||
vkCmdBindPipeline(*m_current_command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_program->pipeline);
|
|
||||||
|
|
||||||
if (cond_render_ctrl.hw_cond_active && m_device->get_conditional_render_support())
|
if (cond_render_ctrl.hw_cond_active && m_device->get_conditional_render_support())
|
||||||
{
|
{
|
||||||
// It is inconvenient that conditional rendering breaks other things like compute dispatch
|
// It is inconvenient that conditional rendering breaks other things like compute dispatch
|
||||||
|
|
|
@ -272,4 +272,10 @@ namespace vk
|
||||||
{
|
{
|
||||||
return g_current_renderpass[cmd].pass != VK_NULL_HANDLE;
|
return g_current_renderpass[cmd].pass != VK_NULL_HANDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void renderpass_op(VkCommandBuffer cmd, const renderpass_op_callback_t& op)
|
||||||
|
{
|
||||||
|
const auto& active = g_current_renderpass[cmd];
|
||||||
|
op(cmd, active.pass, active.fbo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,4 +17,7 @@ namespace vk
|
||||||
void begin_renderpass(VkCommandBuffer cmd, VkRenderPass pass, VkFramebuffer target, const coordu& framebuffer_region);
|
void begin_renderpass(VkCommandBuffer cmd, VkRenderPass pass, VkFramebuffer target, const coordu& framebuffer_region);
|
||||||
void end_renderpass(VkCommandBuffer cmd);
|
void end_renderpass(VkCommandBuffer cmd);
|
||||||
bool is_renderpass_open(VkCommandBuffer cmd);
|
bool is_renderpass_open(VkCommandBuffer cmd);
|
||||||
|
|
||||||
|
using renderpass_op_callback_t = std::function<void(VkCommandBuffer, VkRenderPass, VkFramebuffer)>;
|
||||||
|
void renderpass_op(VkCommandBuffer cmd, const renderpass_op_callback_t& op);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue