From fc5b6baaa778ffa3eeec2e878f2b8d43760bdc90 Mon Sep 17 00:00:00 2001 From: kuba Date: Fri, 31 Jul 2026 11:11:44 +0200 Subject: [PATCH] gpu: size single-channel 16-bit and two-channel 8-bit formats (#715) GetFormatCompatibilityClass listed only R16Sfloat in the 16-bit class, so GetVulkanImageByteCount computed zero bytes for R16Unorm, R16SNorm, R16Uint, R16Sint and the R8G8 family. UploadGuestImageInitialData treats a zero expected size as an incompatible upload and drops it, which leaves the texture blank for the rest of the run rather than failing loudly. Silent Hill uploads R16Unorm at 144x81, 240x135, 256x256, 512x512 and 1024x1024, and every one was rejected: the guest supplied exactly width*height*2 bytes each time (23328 for 144x81) against an expected zero. Also adds R8SNorm to the 8-bit class, which was missing for the same reason. --- .../VideoOut/VulkanVideoPresenter.cs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/SharpEmu.Libs/VideoOut/VulkanVideoPresenter.cs b/src/SharpEmu.Libs/VideoOut/VulkanVideoPresenter.cs index 6417b336..af8032d0 100644 --- a/src/SharpEmu.Libs/VideoOut/VulkanVideoPresenter.cs +++ b/src/SharpEmu.Libs/VideoOut/VulkanVideoPresenter.cs @@ -14185,8 +14185,23 @@ internal static unsafe class VulkanVideoPresenter { Format.R8Unorm or Format.R8Uint or - Format.R8Sint => 8, - Format.R16Sfloat => 16, + Format.R8Sint or + Format.R8SNorm => 8, + // Every single-channel 16-bit format shares this class, not just + // the float one. Omitting the rest made GetVulkanImageByteCount + // return zero for them, and a zero expected size rejects the + // guest's upload outright — the texture then samples as blank + // for the life of the run. Silent Hill uploads R16Unorm at + // 144x81 through 1024x1024 and every one was dropped. + Format.R16Sfloat or + Format.R16Unorm or + Format.R16SNorm or + Format.R16Uint or + Format.R16Sint or + Format.R8G8Unorm or + Format.R8G8SNorm or + Format.R8G8Uint or + Format.R8G8Sint => 16, Format.R32Uint or Format.R32Sint or Format.R32Sfloat or