Skip to content

Commit 4a60126

Browse files
committed
Confirmed bug: RGUI renders with swapped R and B channels on Metal
The convert_bgra4444_to_bgra8888 kernel in Shaders.metal expects input bits laid out as B(15:12) G(11:8) R(7:4) A(3:0) — the D3D10/11/12 packing convention. But when the Metal driver is active, rgui_set_pixel_format_function (menu/drivers/rgui.c:1412-1413) falls through to the else branch and packs with argb32_to_rgba4444, producing R(15:12) G(11:8) B(7:4) A(3:0). The shader then decodes the bytes swapped — a red RGUI pixel 0xF00F gets rendered as blue. This has presumably been wrong since whenever the Metal driver first shipped with 4444 support, but nobody ever pulled the thread.
1 parent 3a3a940 commit 4a60126

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

menu/drivers/rgui.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1400,7 +1400,8 @@ static bool rgui_set_pixel_format_function(void)
14001400
argb32_to_pixel_platform_format = argb32_to_argb4444;
14011401
else if ( string_is_equal(driver_ident, "d3d10") /* D3D10/11/12 */
14021402
|| string_is_equal(driver_ident, "d3d11")
1403-
|| string_is_equal(driver_ident, "d3d12"))
1403+
|| string_is_equal(driver_ident, "d3d12")
1404+
|| string_is_equal(driver_ident, "metal")) /* Metal */
14041405
argb32_to_pixel_platform_format = argb32_to_bgra4444;
14051406
else if ( string_is_equal(driver_ident, "sdl_dingux") /* DINGUX SDL */
14061407
|| string_is_equal(driver_ident, "sdl_rs90")

0 commit comments

Comments
 (0)