From 4f8da62c34a7fe38a7ad6789cd920901f5d08640 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Wed, 16 Mar 2022 19:31:37 +0100 Subject: [PATCH] [dxvk] Fix color write mask normalization Previously we'd set too many bits by accident here. Also, we should not modify partial write masks to include unnecessary bits. Only do this if we can actually promote to a full write mask for consistency. --- src/dxvk/dxvk_graphics.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/dxvk/dxvk_graphics.cpp b/src/dxvk/dxvk_graphics.cpp index deb1b62b..4a21eb9b 100644 --- a/src/dxvk/dxvk_graphics.cpp +++ b/src/dxvk/dxvk_graphics.cpp @@ -213,11 +213,13 @@ namespace dxvk { omBlendAttachments[i].colorWriteMask = util::remapComponentMask( state.omBlend[i].colorWriteMask(), state.omSwizzle[i].mapping()); } - + omBlendAttachments[i].colorWriteMask &= formatInfo->componentMask; - if (omBlendAttachments[i].colorWriteMask) - omBlendAttachments[i].colorWriteMask |= ~formatInfo->componentMask; + if (omBlendAttachments[i].colorWriteMask == formatInfo->componentMask) { + omBlendAttachments[i].colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT + | VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT; + } } }