From a3409242ce98691fbc8c9991b3a5d9830e4be00c Mon Sep 17 00:00:00 2001 From: kd-11 Date: Thu, 1 Oct 2026 15:44:58 +0300 Subject: [PATCH] gl: Fix texture layout for RGB5A1 and BGR5A1 surfaces for readback/upload --- rpcs3/Emu/RSX/GL/GLRenderTargets.cpp | 4 ++-- rpcs3/Emu/RSX/GL/GLTexture.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp b/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp index 526b69539b..ef89ebdd5d 100644 --- a/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp +++ b/rpcs3/Emu/RSX/GL/GLRenderTargets.cpp @@ -20,11 +20,11 @@ color_format rsx::internals::surface_color_format_to_gl(rsx::surface_color_forma // All XBGR formats will have remapping before they can be read back in shaders as DRGB8 // Prefix o = 1, z = 0 case rsx::surface_color_format::x1r5g5b5_o1r5g5b5: - return{ ::gl::texture::type::ushort_5_5_5_1, ::gl::texture::format::rgb, ::gl::texture::internal_format::bgr5a1, true, + return{ ::gl::texture::type::ushort_1_5_5_5_rev, ::gl::texture::format::bgra, ::gl::texture::internal_format::bgr5a1, true, { ::gl::texture::channel::one, ::gl::texture::channel::r, ::gl::texture::channel::g, ::gl::texture::channel::b } }; case rsx::surface_color_format::x1r5g5b5_z1r5g5b5: - return{ ::gl::texture::type::ushort_5_5_5_1, ::gl::texture::format::rgb, ::gl::texture::internal_format::bgr5a1, true, + return{ ::gl::texture::type::ushort_1_5_5_5_rev, ::gl::texture::format::bgra, ::gl::texture::internal_format::bgr5a1, true, { ::gl::texture::channel::zero, ::gl::texture::channel::r, ::gl::texture::channel::g, ::gl::texture::channel::b } }; case rsx::surface_color_format::x8r8g8b8_z8r8g8b8: diff --git a/rpcs3/Emu/RSX/GL/GLTexture.cpp b/rpcs3/Emu/RSX/GL/GLTexture.cpp index 362b6c4d66..6546f616f0 100644 --- a/rpcs3/Emu/RSX/GL/GLTexture.cpp +++ b/rpcs3/Emu/RSX/GL/GLTexture.cpp @@ -175,9 +175,9 @@ namespace gl case texture::internal_format::rgb565: return { .format = GL_RGB, .type = GL_UNSIGNED_SHORT_5_6_5, .block_size = 2, .swap_bytes = true }; case texture::internal_format::rgb5a1: - return { .format = GL_RGB, .type = GL_UNSIGNED_SHORT_5_5_5_1, .block_size = 2, .swap_bytes = true }; + return { .format = GL_RGBA, .type = GL_UNSIGNED_SHORT_5_5_5_1, .block_size = 2, .swap_bytes = true }; case texture::internal_format::bgr5a1: - return { .format = GL_RGB, .type = GL_UNSIGNED_SHORT_1_5_5_5_REV, .block_size = 2, .swap_bytes = true }; + return { .format = GL_BGRA, .type = GL_UNSIGNED_SHORT_1_5_5_5_REV, .block_size = 2, .swap_bytes = true }; case texture::internal_format::rgba4: return { .format = GL_BGRA, .type = GL_UNSIGNED_SHORT_4_4_4_4, .block_size = 2, .swap_bytes = false }; case texture::internal_format::rgba8: