From 73bcaa6237a9d075fc67663fab330a19ca64c767 Mon Sep 17 00:00:00 2001 From: "Herman S." <429230+has207@users.noreply.github.com> Date: Sat, 17 Jan 2026 20:05:17 +0900 Subject: [PATCH] [GPU] Fix exp_bias for k_2_10_10_10_FLOAT Only skip exp_bias on alpha for k_2_10_10_10_FLOAT if dest format has limited alpha range. Fixes GoW2 --- src/xenia/gpu/shaders/resolve.xesli | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/xenia/gpu/shaders/resolve.xesli b/src/xenia/gpu/shaders/resolve.xesli index 07413f1b5..85ed9cf10 100644 --- a/src/xenia/gpu/shaders/resolve.xesli +++ b/src/xenia/gpu/shaders/resolve.xesli @@ -629,11 +629,15 @@ uint XeResolveEdramPixelStrideInts(XeResolveInfo resolve_info) { } } // For k_2_10_10_10_FLOAT, only apply exp_bias to RGB (7e3 float), not - // alpha (2-bit fixed-point [0, 1]). - dont_flatten_xe if (resolve_info.edram_format == - kXenosColorRenderTargetFormat_2_10_10_10_FLOAT || - resolve_info.edram_format == - kXenosColorRenderTargetFormat_2_10_10_10_FLOAT_AS_16_16_16_16) { + // alpha (2-bit fixed-point [0, 1]) - unless the destination format can + // store alpha > 1.0 (float formats), in which case apply to all channels + // as the game expects the expanded range. + dont_flatten_xe if ((resolve_info.edram_format == + kXenosColorRenderTargetFormat_2_10_10_10_FLOAT || + resolve_info.edram_format == + kXenosColorRenderTargetFormat_2_10_10_10_FLOAT_AS_16_16_16_16) && + resolve_info.dest_format != kXenosFormat_16_16_16_16_FLOAT && + resolve_info.dest_format != kXenosFormat_32_32_32_32_FLOAT) { pixel_0.xyz *= exp_bias; pixel_1.xyz *= exp_bias; } else { @@ -708,11 +712,15 @@ uint XeResolveEdramPixelStrideInts(XeResolveInfo resolve_info) { } } // For k_2_10_10_10_FLOAT, only apply exp_bias to RGB (7e3 float), not - // alpha (2-bit fixed-point [0, 1]). - dont_flatten_xe if (resolve_info.edram_format == - kXenosColorRenderTargetFormat_2_10_10_10_FLOAT || - resolve_info.edram_format == - kXenosColorRenderTargetFormat_2_10_10_10_FLOAT_AS_16_16_16_16) { + // alpha (2-bit fixed-point [0, 1]) - unless the destination format can + // store alpha > 1.0 (float formats), in which case apply to all channels + // as the game expects the expanded range. + dont_flatten_xe if ((resolve_info.edram_format == + kXenosColorRenderTargetFormat_2_10_10_10_FLOAT || + resolve_info.edram_format == + kXenosColorRenderTargetFormat_2_10_10_10_FLOAT_AS_16_16_16_16) && + resolve_info.dest_format != kXenosFormat_16_16_16_16_FLOAT && + resolve_info.dest_format != kXenosFormat_32_32_32_32_FLOAT) { pixel_0.xyz *= exp_bias; pixel_1.xyz *= exp_bias; pixel_2.xyz *= exp_bias;