Skip to content

Commit f5be489

Browse files
committed
rsx: Improve framebuffer layout change detection
1 parent 316aa44 commit f5be489

File tree

4 files changed

+25
-10
lines changed

4 files changed

+25
-10
lines changed

rpcs3/Emu/RSX/GL/GLRenderTargets.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool /*
301301
}
302302

303303
m_graphics_state.set(rsx::rtt_config_valid);
304+
on_framebuffer_layout_updated();
304305

305306
check_zcull_status(true);
306307
set_viewport();

rpcs3/Emu/RSX/RSXThread.cpp

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,14 +1740,7 @@ namespace rsx
17401740
}
17411741
}
17421742

1743-
if (::size32(mrt_buffers) != current_fragment_program.mrt_buffers_count &&
1744-
!m_graphics_state.test(rsx::pipeline_state::fragment_program_dirty) &&
1745-
!is_current_program_interpreted())
1746-
{
1747-
// Notify that we should recompile the FS
1748-
m_graphics_state |= rsx::pipeline_state::fragment_program_state_dirty;
1749-
}
1750-
1743+
on_framebuffer_layout_updated();
17511744
return any_found;
17521745
};
17531746

@@ -1845,6 +1838,22 @@ namespace rsx
18451838
}
18461839
}
18471840

1841+
void thread::on_framebuffer_layout_updated()
1842+
{
1843+
if (m_graphics_state.test(rsx::fragment_program_state_dirty))
1844+
{
1845+
return;
1846+
}
1847+
1848+
const auto target = m_ctx->register_state->surface_color_target();
1849+
if (rsx::utility::get_mrt_buffers_count(target) == current_fragment_program.mrt_buffers_count)
1850+
{
1851+
return;
1852+
}
1853+
1854+
m_graphics_state |= rsx::fragment_program_state_dirty;
1855+
}
1856+
18481857
bool thread::get_scissor(areau& region, bool clip_viewport)
18491858
{
18501859
if (!m_graphics_state.test(rsx::pipeline_state::scissor_config_state_dirty))

rpcs3/Emu/RSX/RSXThread.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,10 @@ namespace rsx
257257
void get_framebuffer_layout(rsx::framebuffer_creation_context context, framebuffer_layout &layout);
258258
bool get_scissor(areau& region, bool clip_viewport);
259259

260+
// Notify framebuffer layout has been committed.
261+
// FIXME: This should not be here
262+
void on_framebuffer_layout_updated();
263+
260264
RSXVertexProgram current_vertex_program = {};
261265
RSXFragmentProgram current_fragment_program = {};
262266

rpcs3/Emu/RSX/VK/VKGSRender.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2469,7 +2469,7 @@ void VKGSRender::prepare_rtts(rsx::framebuffer_creation_context context)
24692469
m_surface_info[i].samples = samples;
24702470
}
24712471

2472-
//Process depth surface as well
2472+
// Process depth surface as well
24732473
{
24742474
if (m_depth_surface_info.pitch && g_cfg.video.write_depth_buffer)
24752475
{
@@ -2486,7 +2486,7 @@ void VKGSRender::prepare_rtts(rsx::framebuffer_creation_context context)
24862486
m_depth_surface_info.samples = samples;
24872487
}
24882488

2489-
//Bind created rtts as current fbo...
2489+
// Bind created rtts as current fbo...
24902490
const auto draw_buffers = rsx::utility::get_rtt_indexes(m_framebuffer_layout.target);
24912491
m_draw_buffers.clear();
24922492
m_fbo_images.clear();
@@ -2637,6 +2637,7 @@ void VKGSRender::prepare_rtts(rsx::framebuffer_creation_context context)
26372637

26382638
set_viewport();
26392639
set_scissor(clipped_scissor);
2640+
on_framebuffer_layout_updated();
26402641

26412642
check_zcull_status(true);
26422643
}

0 commit comments

Comments
 (0)