From 9dfa91f77a7412fdb31a816269cae8a7e30fb753 Mon Sep 17 00:00:00 2001 From: Wunkolo Date: Tue, 26 May 2026 08:06:51 -0700 Subject: [PATCH] renderer_gl: Implement `TextureRuntime::BlitTextures` direct MSAA bits Re-implement `TextureRuntime::BlitTextures` such that the MSAA render textures are directly blit rather than just resolving an blitting the current texture. Helps ensure that the MSAA and non-MSAA textures are in parity. --- .../renderer_opengl/gl_texture_runtime.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_texture_runtime.cpp b/src/video_core/renderer_opengl/gl_texture_runtime.cpp index 982e227cd..f9f16b799 100644 --- a/src/video_core/renderer_opengl/gl_texture_runtime.cpp +++ b/src/video_core/renderer_opengl/gl_texture_runtime.cpp @@ -303,15 +303,6 @@ bool TextureRuntime::CopyTextures(Surface& source, Surface& dest, bool TextureRuntime::BlitTextures(Surface& source, Surface& dest, const VideoCore::TextureBlit& blit) { - // Must resolve images first - // Todo(wunk): Add a "dirty" flag for msaa resolves to avoid redundant image resolves - if (source.sample_count > 1) { - blit_helper.ResolveTexture(source); - } - if (dest.sample_count > 1) { - blit_helper.ResolveTexture(dest); - } - OpenGLState state = OpenGLState::GetCurState(); state.scissor.enabled = false; state.draw.read_framebuffer = read_fbos[FboIndex(source.type)].handle; @@ -331,6 +322,15 @@ bool TextureRuntime::BlitTextures(Surface& source, Surface& dest, blit.src_rect.top, blit.dst_rect.left, blit.dst_rect.bottom, blit.dst_rect.right, blit.dst_rect.top, buffer_mask, filter); + if (source.GetSampleCount() == dest.GetSampleCount() && source.GetSampleCount() > 1) { + // Blit MSAA too + source.Attach(GL_READ_FRAMEBUFFER, blit.src_level, blit.src_layer, 3); + dest.Attach(GL_DRAW_FRAMEBUFFER, blit.dst_level, blit.dst_layer, 3); + glBlitFramebuffer(blit.src_rect.left, blit.src_rect.bottom, blit.src_rect.right, + blit.src_rect.top, blit.dst_rect.left, blit.dst_rect.bottom, + blit.dst_rect.right, blit.dst_rect.top, buffer_mask, filter); + } + return true; }