summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTriang3l <triang3l@yandex.ru>2023-03-30 22:40:40 +0300
committerTriang3l <triang3l@yandex.ru>2023-03-30 22:40:40 +0300
commitbaa2ff78d8f44883b0d70ab89fd9b4ee53a45e80 (patch)
tree93293b186a3eaae46eb5fda266ff69358d7fb8da
parentc238d8af550c457ac61a4ebef6888b3895802dbb (diff)
[Vulkan] Add missing stencil reference unpack in RT transfer + formatting fix
-rw-r--r--src/xenia/gpu/vulkan/vulkan_render_target_cache.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/xenia/gpu/vulkan/vulkan_render_target_cache.cc b/src/xenia/gpu/vulkan/vulkan_render_target_cache.cc
index ecd4b7fd1..fc9a7bb79 100644
--- a/src/xenia/gpu/vulkan/vulkan_render_target_cache.cc
+++ b/src/xenia/gpu/vulkan/vulkan_render_target_cache.cc
@@ -3174,9 +3174,9 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
source_stencil[0] != spv::NoResult) {
// For the depth -> depth case, write the stencil directly to the output.
assert_true(mode.output == TransferOutput::kDepth);
- builder.createStore(builder.createUnaryOp(spv::OpBitcast, type_int,
- source_stencil[0]),
- output_fragment_stencil_ref);
+ builder.createStore(
+ builder.createUnaryOp(spv::OpBitcast, type_int, source_stencil[0]),
+ output_fragment_stencil_ref);
}
if (dest_is_64bpp) {
@@ -4335,6 +4335,17 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
builder.createOp(spv::OpPhi, type_float, id_vector_temp);
}
builder.createStore(fragment_depth32, output_fragment_depth);
+ // Unpack the stencil into the stencil reference output if needed and
+ // not already written.
+ if (!packed_only_depth &&
+ output_fragment_stencil_ref != spv::NoResult) {
+ builder.createStore(
+ builder.createUnaryOp(
+ spv::OpBitcast, type_int,
+ builder.createBinOp(spv::OpBitwiseAnd, type_uint, packed,
+ builder.makeUintConstant(UINT8_MAX))),
+ output_fragment_stencil_ref);
+ }
}
} break;
case TransferOutput::kStencilBit: {