[Vulkan] Add missing stencil reference unpack in RT transfer + formatting fix

This commit is contained in:
Triang3l 2023-03-30 22:40:40 +03:00
parent c238d8af55
commit baa2ff78d8
1 changed files with 14 additions and 3 deletions

View File

@ -3174,9 +3174,9 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
source_stencil[0] != spv::NoResult) { source_stencil[0] != spv::NoResult) {
// For the depth -> depth case, write the stencil directly to the output. // For the depth -> depth case, write the stencil directly to the output.
assert_true(mode.output == TransferOutput::kDepth); assert_true(mode.output == TransferOutput::kDepth);
builder.createStore(builder.createUnaryOp(spv::OpBitcast, type_int, builder.createStore(
source_stencil[0]), builder.createUnaryOp(spv::OpBitcast, type_int, source_stencil[0]),
output_fragment_stencil_ref); output_fragment_stencil_ref);
} }
if (dest_is_64bpp) { if (dest_is_64bpp) {
@ -4335,6 +4335,17 @@ VkShaderModule VulkanRenderTargetCache::GetTransferShader(
builder.createOp(spv::OpPhi, type_float, id_vector_temp); builder.createOp(spv::OpPhi, type_float, id_vector_temp);
} }
builder.createStore(fragment_depth32, output_fragment_depth); 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; } break;
case TransferOutput::kStencilBit: { case TransferOutput::kStencilBit: {