rsx: Avoid clobbering CELL memory when splitting fbos

This commit is contained in:
kd-11 2022-10-02 18:18:43 +03:00 committed by kd-11
parent 4417701ea7
commit 765208a181
3 changed files with 28 additions and 2 deletions

View file

@ -3237,6 +3237,22 @@ namespace rsx
return m_predictor;
}
bool is_protected(u32 section_base_address)
{
reader_lock lock(m_cache_mutex);
const auto& block = m_storage.block_for(section_base_address);
for (const auto& tex : block)
{
if (tex.get_section_base() == section_base_address)
{
return tex.is_locked();
}
}
return false;
}
/**
* The read only texture invalidate flag is set if a read only texture is trampled by framebuffer memory

View file

@ -318,9 +318,14 @@ void GLGSRender::init_buffers(rsx::framebuffer_creation_context context, bool /*
for (auto& [base_addr, surface] : m_rtts.orphaned_surfaces)
{
const bool lock = surface->is_depth_surface() ? !!g_cfg.video.write_depth_buffer :
bool lock = surface->is_depth_surface() ? !!g_cfg.video.write_depth_buffer :
!!g_cfg.video.write_color_buffers;
if (lock && !m_gl_texture_cache.is_protected(base_addr))
{
lock = false;
}
if (!lock) [[likely]]
{
m_gl_texture_cache.commit_framebuffer_memory_region(cmd, surface->get_memory_range());

View file

@ -2423,9 +2423,14 @@ void VKGSRender::prepare_rtts(rsx::framebuffer_creation_context context)
for (auto& [base_addr, surface] : m_rtts.orphaned_surfaces)
{
const bool lock = surface->is_depth_surface() ? !!g_cfg.video.write_depth_buffer :
bool lock = surface->is_depth_surface() ? !!g_cfg.video.write_depth_buffer :
!!g_cfg.video.write_color_buffers;
if (lock && !m_texture_cache.is_protected(base_addr))
{
lock = false;
}
if (!lock) [[likely]]
{
m_texture_cache.commit_framebuffer_memory_region(*m_current_command_buffer, surface->get_memory_range());