From 9cb58a47cd1e0133b3678f327cfb26cb38026209 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Tue, 27 Jun 2017 18:19:06 +0300 Subject: [PATCH] gl: Avoid creating surface copies when strict mode is disabled. --- rpcs3/Emu/RSX/GL/GLTextureCache.h | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/rpcs3/Emu/RSX/GL/GLTextureCache.h b/rpcs3/Emu/RSX/GL/GLTextureCache.h index 53aa452e1a..8ede3c3fee 100644 --- a/rpcs3/Emu/RSX/GL/GLTextureCache.h +++ b/rpcs3/Emu/RSX/GL/GLTextureCache.h @@ -781,10 +781,23 @@ namespace gl LOG_WARNING(RSX, "Surface blit from a compressed texture"); } - if (!rsc.is_bound) + if (!rsc.is_bound || !g_cfg.video.strict_rendering_mode) { if (rsc.w == tex_width && rsc.h == tex_height) + { + if (rsc.is_bound) + { + LOG_WARNING(RSX, "Sampling from a currently bound render target @ 0x%x", texaddr); + + auto &caps = gl::get_driver_caps(); + if (caps.ARB_texture_barrier_supported) + glTextureBarrier(); + else if (caps.NV_texture_barrier_supported) + glTextureBarrierNV(); + } + rsc.surface->bind(); + } else bound_index = create_temporary_subresource(rsc.surface->id(), (GLenum)rsc.surface->get_compatible_internal_format(), rsc.x, rsc.y, rsc.w, rsc.h); }