vk/gl: Omit unlocked data when grabbing flip sources from texture cache

This commit is contained in:
kd-11 2019-03-15 18:25:25 +03:00 committed by kd-11
commit 385485204b
3 changed files with 11 additions and 4 deletions

View file

@ -1100,12 +1100,19 @@ namespace rsx
return results; return results;
} }
template <bool check_unlocked = false>
section_storage_type *find_texture_from_dimensions(u32 rsx_address, u16 width = 0, u16 height = 0, u16 depth = 0, u16 mipmaps = 0) section_storage_type *find_texture_from_dimensions(u32 rsx_address, u16 width = 0, u16 height = 0, u16 depth = 0, u16 mipmaps = 0)
{ {
auto &block = m_storage.block_for(rsx_address); auto &block = m_storage.block_for(rsx_address);
for (auto &tex : block) for (auto &tex : block)
{ {
if (tex.matches(rsx_address, width, height, depth, mipmaps) && !tex.is_dirty()) if constexpr (check_unlocked)
{
if (!tex.is_locked())
continue;
}
if (!tex.is_dirty() && tex.matches(rsx_address, width, height, depth, mipmaps))
{ {
return &tex; return &tex;
} }

View file

@ -1673,11 +1673,11 @@ void GLGSRender::flip(int buffer)
} }
} }
} }
else if (auto surface = m_gl_texture_cache.find_texture_from_dimensions(absolute_address, buffer_width, buffer_height)) else if (auto surface = m_gl_texture_cache.find_texture_from_dimensions<true>(absolute_address, buffer_width, buffer_height))
{ {
//Hack - this should be the first location to check for output //Hack - this should be the first location to check for output
//The render might have been done offscreen or in software and a blit used to display //The render might have been done offscreen or in software and a blit used to display
image = surface->get_raw_texture()->id(); if (const auto tex = surface->get_raw_texture(); tex) image = tex->id();
} }
if (!image) if (!image)

View file

@ -3310,7 +3310,7 @@ void VKGSRender::flip(int buffer)
} }
} }
} }
else if (auto surface = m_texture_cache.find_texture_from_dimensions(absolute_address, buffer_width, buffer_height)) else if (auto surface = m_texture_cache.find_texture_from_dimensions<true>(absolute_address, buffer_width, buffer_height))
{ {
//Hack - this should be the first location to check for output //Hack - this should be the first location to check for output
//The render might have been done offscreen or in software and a blit used to display //The render might have been done offscreen or in software and a blit used to display