mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-27 12:35:41 +00:00
rsx: Handle some corner cases in surface locking
This commit is contained in:
parent
bf96cbe980
commit
90cf47cdce
@ -722,6 +722,30 @@ namespace rsx
|
||||
release();
|
||||
}
|
||||
|
||||
void on_swap_out()
|
||||
{
|
||||
if (is_locked())
|
||||
{
|
||||
on_unlock();
|
||||
}
|
||||
else
|
||||
{
|
||||
release();
|
||||
}
|
||||
}
|
||||
|
||||
void on_swap_in(bool lock)
|
||||
{
|
||||
if (!is_locked() && lock)
|
||||
{
|
||||
on_lock();
|
||||
}
|
||||
else
|
||||
{
|
||||
add_ref();
|
||||
}
|
||||
}
|
||||
|
||||
bool is_locked() const
|
||||
{
|
||||
return texture_cache_metadata.locked;
|
||||
|
@ -1375,17 +1375,17 @@ namespace rsx
|
||||
if (context == rsx::texture_upload_context::framebuffer_storage && !Emu.IsStopped())
|
||||
{
|
||||
// Lock, unlock
|
||||
auto surface = derived()->get_render_target();
|
||||
|
||||
if (prot == utils::protection::no && old_prot != utils::protection::no)
|
||||
{
|
||||
// Locked memory. We have to take ownership of the object in the surface cache as well
|
||||
auto surface = derived()->get_render_target();
|
||||
surface->on_lock();
|
||||
}
|
||||
else if (old_prot == utils::protection::no && prot != utils::protection::no)
|
||||
{
|
||||
// Release the surface, the cache can remove it if needed
|
||||
ensure(prot == utils::protection::rw);
|
||||
auto surface = derived()->get_render_target();
|
||||
surface->on_unlock();
|
||||
}
|
||||
}
|
||||
|
@ -70,12 +70,12 @@ namespace gl
|
||||
if (vram_texture && !managed_texture && get_protection() == utils::protection::no)
|
||||
{
|
||||
// In-place image swap, still locked. Likely a color buffer that got rebound as depth buffer or vice-versa.
|
||||
gl::as_rtt(vram_texture)->release();
|
||||
gl::as_rtt(vram_texture)->on_swap_out();
|
||||
|
||||
if (!managed)
|
||||
{
|
||||
// Incoming is also an external resource, reference it immediately
|
||||
gl::as_rtt(image)->add_ref();
|
||||
gl::as_rtt(image)->on_swap_in(is_locked());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,12 +50,12 @@ namespace vk
|
||||
if (vram_texture && !managed_texture && get_protection() == utils::protection::no)
|
||||
{
|
||||
// In-place image swap, still locked. Likely a color buffer that got rebound as depth buffer or vice-versa.
|
||||
vk::as_rtt(vram_texture)->release();
|
||||
vk::as_rtt(vram_texture)->on_swap_out();
|
||||
|
||||
if (!managed)
|
||||
{
|
||||
// Incoming is also an external resource, reference it immediately
|
||||
vk::as_rtt(image)->add_ref();
|
||||
vk::as_rtt(image)->on_swap_in(is_locked());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user