[dxvk] Apply view swizzles to image clears

Fixes tone mapping in Yakuza Kiwami 2, which uses an A8_UNORM
render target and clears the alpha component to 1.
This commit is contained in:
Philip Rebohle 2019-05-14 21:21:29 +02:00
parent 0b61901424
commit 9c93ca451d
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
1 changed files with 11 additions and 0 deletions

View File

@ -622,6 +622,12 @@ namespace dxvk {
depthOp.loadLayout = VK_IMAGE_LAYOUT_UNDEFINED;
}
// Make sure the color components are ordered correctly
if (clearAspects & VK_IMAGE_ASPECT_COLOR_BIT) {
clearValue.color = util::swizzleClearColor(clearValue.color,
util::invertComponentMapping(imageView->info().swizzle));
}
// Check whether the render target view is an attachment
// of the current framebuffer and is included entirely.
// If not, we need to create a temporary framebuffer.
@ -738,6 +744,11 @@ namespace dxvk {
VkClearValue value) {
const VkImageUsageFlags viewUsage = imageView->info().usage;
if (aspect & VK_IMAGE_ASPECT_COLOR_BIT) {
value.color = util::swizzleClearColor(value.color,
util::invertComponentMapping(imageView->info().swizzle));
}
if (viewUsage & (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT))
this->clearImageViewFb(imageView, offset, extent, aspect, value);
else if (viewUsage & VK_IMAGE_USAGE_STORAGE_BIT)