vk/gl: Fix byte order for RGB565 formats in line with hardware tests

This commit is contained in:
kd-11
2026-09-07 21:09:01 +03:00
committed by kd-11
parent 244491298b
commit 78cb66ecfe
2 changed files with 9 additions and 8 deletions
+5 -4
View File
@@ -1695,15 +1695,16 @@ namespace rsx
std::pair<u32, bool> get_compatible_gcm_format(rsx::surface_color_format format)
{
// NOTE: HW tests prove that all multibyte formats need to swap bytes
switch (format)
{
case rsx::surface_color_format::r5g6b5:
return{ CELL_GCM_TEXTURE_R5G6B5, false };
return{ CELL_GCM_TEXTURE_R5G6B5, true };
case rsx::surface_color_format::x8r8g8b8_z8r8g8b8:
case rsx::surface_color_format::x8r8g8b8_o8r8g8b8:
case rsx::surface_color_format::a8r8g8b8:
return{ CELL_GCM_TEXTURE_A8R8G8B8, true }; //verified
return{ CELL_GCM_TEXTURE_A8R8G8B8, true };
case rsx::surface_color_format::x8b8g8r8_o8b8g8r8:
case rsx::surface_color_format::x8b8g8r8_z8b8g8r8:
@@ -1718,7 +1719,7 @@ namespace rsx
case rsx::surface_color_format::x1r5g5b5_o1r5g5b5:
case rsx::surface_color_format::x1r5g5b5_z1r5g5b5:
return{ CELL_GCM_TEXTURE_A1R5G5B5, false };
return{ CELL_GCM_TEXTURE_A1R5G5B5, true };
case rsx::surface_color_format::b8:
return{ CELL_GCM_TEXTURE_B8, false };
@@ -1727,7 +1728,7 @@ namespace rsx
return{ CELL_GCM_TEXTURE_G8B8, true };
case rsx::surface_color_format::x32:
return{ CELL_GCM_TEXTURE_X32_FLOAT, true }; //verified
return{ CELL_GCM_TEXTURE_X32_FLOAT, true };
default:
fmt::throw_exception("Unhandled surface format 0x%x", static_cast<u32>(format));
}
+4 -4
View File
@@ -16,9 +16,9 @@ color_format rsx::internals::surface_color_format_to_gl(rsx::surface_color_forma
case rsx::surface_color_format::a8r8g8b8:
return{ ::gl::texture::type::uint_8_8_8_8_rev, ::gl::texture::format::bgra, ::gl::texture::internal_format::bgra8, true };
//These formats discard their alpha component, forced to 0 or 1
//All XBGR formats will have remapping before they can be read back in shaders as DRGB8
//Prefix o = 1, z = 0
// These formats discard their alpha component, forced to 0 or 1
// 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,
{ ::gl::texture::channel::one, ::gl::texture::channel::r, ::gl::texture::channel::g, ::gl::texture::channel::b } };
@@ -54,7 +54,7 @@ color_format rsx::internals::surface_color_format_to_gl(rsx::surface_color_forma
{ ::gl::texture::channel::one, ::gl::texture::channel::r, ::gl::texture::channel::r, ::gl::texture::channel::r } };
case rsx::surface_color_format::g8b8:
return{ ::gl::texture::type::ubyte, ::gl::texture::format::rg, ::gl::texture::internal_format::rg8, false,
return{ ::gl::texture::type::ubyte, ::gl::texture::format::rg, ::gl::texture::internal_format::rg8, true,
{ ::gl::texture::channel::g, ::gl::texture::channel::r, ::gl::texture::channel::g, ::gl::texture::channel::r } };
case rsx::surface_color_format::x32: