From 7ea310f8259e99dc6dd7ec3e56a0bc81dd20dfbc Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Sun, 14 Jun 2026 12:43:49 +0300 Subject: [PATCH] fixed single channel formats (#4435) --- src/video_core/amdgpu/pixel_format.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/video_core/amdgpu/pixel_format.h b/src/video_core/amdgpu/pixel_format.h index 963254c10..7f67a6e0b 100644 --- a/src/video_core/amdgpu/pixel_format.h +++ b/src/video_core/amdgpu/pixel_format.h @@ -288,6 +288,24 @@ constexpr CompMapping RemapSwizzle(const DataFormat format, const CompMapping sw result.a = swizzle.a; return result; } + case DataFormat::Format8: + case DataFormat::Format16: + case DataFormat::Format32: { + // PS4 single-channel formats expose the texel as either R or A depending on dst_sel, + // but Vulkan single-channel formats expose it only via R. Redirect any selector + // that points at Alpha to Red so the texel is read correctly. + CompMapping result = swizzle; + const auto remap_alpha_to_red = [](CompSwizzle& c) { + if (c == CompSwizzle::Alpha) { + c = CompSwizzle::Red; + } + }; + remap_alpha_to_red(result.r); + remap_alpha_to_red(result.g); + remap_alpha_to_red(result.b); + remap_alpha_to_red(result.a); + return result; + } default: return swizzle; }