diff --git a/rpcs3/Emu/RSX/Common/surface_utils.h b/rpcs3/Emu/RSX/Common/surface_utils.h index 05e1993780..03c5b5e6f2 100644 --- a/rpcs3/Emu/RSX/Common/surface_utils.h +++ b/rpcs3/Emu/RSX/Common/surface_utils.h @@ -435,7 +435,7 @@ namespace rsx memory_tag_samples[0].second = ~memory_tag_samples[0].second; } - bool test() + bool test() const { for (const auto& e : memory_tag_samples) { diff --git a/rpcs3/Emu/RSX/GL/GLTextureCache.h b/rpcs3/Emu/RSX/GL/GLTextureCache.h index 7348fd5936..45d787c184 100644 --- a/rpcs3/Emu/RSX/GL/GLTextureCache.h +++ b/rpcs3/Emu/RSX/GL/GLTextureCache.h @@ -69,7 +69,10 @@ namespace gl void create(u16 w, u16 h, u16 depth, u16 mipmaps, gl::texture* image, u32 rsx_pitch, bool managed, gl::texture::format gl_format = gl::texture::format::rgba, gl::texture::type gl_type = gl::texture::type::ubyte, bool swap_bytes = false) { - if (vram_texture && !managed_texture && get_protection() == utils::protection::no) + auto new_texture = static_cast(image); + ensure(!exists() || !is_managed() || vram_texture == new_texture); + + if (vram_texture != new_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)->on_swap_out(); @@ -81,8 +84,6 @@ namespace gl } } - auto new_texture = static_cast(image); - ensure(!exists() || !is_managed() || vram_texture == new_texture); vram_texture = new_texture; if (managed) diff --git a/rpcs3/Emu/RSX/VK/VKTextureCache.h b/rpcs3/Emu/RSX/VK/VKTextureCache.h index d7d3f81e8d..0228bd538e 100644 --- a/rpcs3/Emu/RSX/VK/VKTextureCache.h +++ b/rpcs3/Emu/RSX/VK/VKTextureCache.h @@ -47,7 +47,10 @@ namespace vk void create(u16 w, u16 h, u16 depth, u16 mipmaps, vk::image* image, u32 rsx_pitch, bool managed, u32 gcm_format, bool pack_swap_bytes = false) { - if (vram_texture && !managed_texture && get_protection() == utils::protection::no) + auto new_texture = static_cast(image); + ensure(!exists() || !is_managed() || vram_texture == new_texture); + + if (vram_texture != new_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)->on_swap_out(); @@ -59,8 +62,6 @@ namespace vk } } - auto new_texture = static_cast(image); - ensure(!exists() || !is_managed() || vram_texture == new_texture); vram_texture = new_texture; ensure(rsx_pitch);