[VideoOut] Fall back to 8-bit RGBA for unknown pixel formats instead of silently failing (#294)

Changes MapPixelFormatToGuestTextureFormat to default to format 56 (8-bit
RGBA) when the game uses a pixel format not yet in the known list, with a
stderr warning that reports the exact format value for project issue reports.

Previously, unknown formats returned 0, which caused RegisterKnownDisplayBuffer
to skip registration entirely. The GPU backend then couldn't find the buffer
during flip, producing vk.flip_capture_failed, and some games later hit a
Debug.Assert in ExecuteOrderedGuestFlipWait.

The fallback produces wrong colors for the affected games but lets them render
and display output, which is strictly better than a black screen or access
violation crash. The pixel format is printed to stderr so developers can
identify it and add proper support.

Co-authored-by: meowman <haadii2005@gamil.com>
This commit is contained in:
Hadi Abdulrahman
2026-07-17 05:35:57 +04:00
committed by GitHub
parent 488b285ecb
commit faf3a397a8
2 changed files with 150 additions and 2 deletions
+17 -2
View File
@@ -1646,8 +1646,12 @@ public static class VideoOutExports
// Maps the PS5 VideoOut pixel format space to the AGC "guest texture format" tags
// the backend keys its guest-image registry on (see VulkanVideoPresenter.
// GetGuestTextureFormat: format=10 => 56 for 8-bit RGBA variants, format=9 => 9 for 10-bit).
private static uint MapPixelFormatToGuestTextureFormat(ulong pixelFormat) =>
NormalizePixelFormat(pixelFormat) switch
// Unknown formats default to 56 (8-bit RGBA) with a logged warning so games
// display something rather than silently failing the flip pipeline.
private static uint MapPixelFormatToGuestTextureFormat(ulong pixelFormat)
{
var normalized = NormalizePixelFormat(pixelFormat);
var result = normalized switch
{
SceVideoOutPixelFormatA8R8G8B8Srgb or
SceVideoOutPixelFormatA8B8G8R8Srgb or
@@ -1665,6 +1669,17 @@ public static class VideoOutExports
_ => 0u,
};
if (result == 0u)
{
Console.Error.WriteLine(
$"[LOADER][WARN] vk: unknown pixel format 0x{pixelFormat:X16} (normalized=0x{normalized:X16}) " +
$"— falling back to format 56 (8-bit RGBA). Report this format to the project.");
result = 56u;
}
return result;
}
internal static bool TryPackRgba8Pixel(
ulong pixelFormat,
byte red,