1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-18 22:54:15 +01:00

[dxvk] Always pass through fully enabled color write masks

May improve performance when rendering to RGB-only or Alpha-only
images, which seems to be especially common in D3D9.
This commit is contained in:
Philip Rebohle 2019-06-14 14:27:21 +02:00
parent c8a429b9e1
commit a715937db1
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -232,11 +232,21 @@ namespace dxvk {
// Fix up color write masks using the component mappings
std::array<VkPipelineColorBlendAttachmentState, MaxNumRenderTargets> omBlendAttachments;
const VkColorComponentFlags fullMask
= VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT
| VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
for (uint32_t i = 0; i < MaxNumRenderTargets; i++) {
omBlendAttachments[i] = state.omBlendAttachments[i];
omBlendAttachments[i].colorWriteMask = util::remapComponentMask(
state.omBlendAttachments[i].colorWriteMask,
state.omComponentMapping[i]);
if (state.omBlendAttachments[i].colorWriteMask == fullMask) {
// Avoid unnecessary partial color write masks
omBlendAttachments[i].colorWriteMask = fullMask;
} else {
omBlendAttachments[i].colorWriteMask = util::remapComponentMask(
state.omBlendAttachments[i].colorWriteMask,
state.omComponentMapping[i]);
}
if ((m_fsOut & (1 << i)) == 0)
omBlendAttachments[i].colorWriteMask = 0;