From fbe70c60ae69be2ba193aa7c7a7cc91a489244a8 Mon Sep 17 00:00:00 2001 From: "Herman S." <429230+has207@users.noreply.github.com> Date: Mon, 26 Jan 2026 14:49:42 +0900 Subject: [PATCH] [D3D12] Remove gamma from source_is_64bpp calculation When gamma_render_target_as_unorm16_ is enabled gamma render targets are stored as R16G16B16A16_UNORM. However true 64bpp formats store TWO 32bpp pixels packed together in memory. Gamma as R16G16B16A16 stores ONE pixel with 4 components at higher precision. It's 64bpp in memory size but represents a single pixel, not two packed pixels. The transfer shader code assumes 64bpp means "two 32bpp halves packed together" and applies coordinate transformations accordingly (halving X coordinates, selecting high/low halves). This is wrong for gamma - it has a 1:1 pixel mapping, just with more precision per pixel. Marking gamma as 64bpp for dest is fine because the shader writes the correct number of bytes. But marking it for source triggers incorrect coordinate math that cuts the image in half (as seen in Just Cause 2). --- src/xenia/gpu/d3d12/d3d12_render_target_cache.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/xenia/gpu/d3d12/d3d12_render_target_cache.cc b/src/xenia/gpu/d3d12/d3d12_render_target_cache.cc index 260d62698..b4b09bc88 100644 --- a/src/xenia/gpu/d3d12/d3d12_render_target_cache.cc +++ b/src/xenia/gpu/d3d12/d3d12_render_target_cache.cc @@ -2172,10 +2172,7 @@ D3D12RenderTargetCache::GetOrCreateTransferPipelines(TransferShaderKey key) { assert_zero(rs & kTransferUsedRootParameterDepthSRVBit); assert_zero(rs & kTransferUsedRootParameterStencilSRVBit); source_is_64bpp = - xenos::IsColorRenderTargetFormat64bpp(source_color_format) || - (source_color_format == - xenos::ColorRenderTargetFormat::k_8_8_8_8_GAMMA && - gamma_render_target_as_unorm16_); + xenos::IsColorRenderTargetFormat64bpp(source_color_format); source_color_format_component_count = xenos::GetColorRenderTargetFormatComponentCount(source_color_format); if (dest_is_stencil_bit) {