From 24f90c0efc407fdb055efd881cbc251ac46432de Mon Sep 17 00:00:00 2001 From: "Herman S." <429230+has207@users.noreply.github.com> Date: Mon, 22 Dec 2025 00:45:07 +0900 Subject: [PATCH] [Vulkan] Fix stencil bit transfer shaders not discarding pixels "packed" was never set because source_depth_texture isn't created for stencil bit output. This caused the discard logic to be skipped resulting in stencil being incorrectly incremented on every transfer draw until it saturated at 0xFF. Fixes many remaining Vulkan rendering issues, e.g. Brothers, Orange Box, Arkham Origins, many others. --- src/xenia/gpu/vulkan/vulkan_render_target_cache.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/xenia/gpu/vulkan/vulkan_render_target_cache.cc b/src/xenia/gpu/vulkan/vulkan_render_target_cache.cc index d927f43f0..97fd8d3c4 100644 --- a/src/xenia/gpu/vulkan/vulkan_render_target_cache.cc +++ b/src/xenia/gpu/vulkan/vulkan_render_target_cache.cc @@ -3741,6 +3741,10 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader( } } } + // For stencil bit output, use stencil directly for the discard check. + if (packed == spv::NoResult && mode.output == TransferOutput::kStencilBit) { + packed = source_stencil[0]; + } switch (mode.output) { case TransferOutput::kColor: { // Unless a special path was taken, unpack the raw 32bpp value into the