Skip to content

Commit

Permalink
[d3d9] ResolveZ: Only copy aspects that both images support
Browse files Browse the repository at this point in the history
  • Loading branch information
K0bin authored and misyltoad committed Sep 24, 2024
1 parent d7c2e3a commit f5ca3cf
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/d3d9/d3d9_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7640,14 +7640,26 @@ namespace dxvk {
const D3D9_VK_FORMAT_MAPPING srcFormatInfo = LookupFormat(srcDesc->Format);
const D3D9_VK_FORMAT_MAPPING dstFormatInfo = LookupFormat(dstDesc->Format);

const VkImageSubresource dstSubresource =
VkImageSubresource dstSubresource =
dstTextureInfo->GetSubresourceFromIndex(
dstFormatInfo.Aspect, 0);

const VkImageSubresource srcSubresource =
VkImageSubresource srcSubresource =
srcTextureInfo->GetSubresourceFromIndex(
srcFormatInfo.Aspect, src->GetSubresource());

if ((dstSubresource.aspectMask & srcSubresource.aspectMask) != 0) {
// for depthStencil -> depth or depthStencil -> stencil copies, only copy the aspect that both images support
dstSubresource.aspectMask = dstSubresource.aspectMask & srcSubresource.aspectMask;
srcSubresource.aspectMask = dstSubresource.aspectMask & srcSubresource.aspectMask;
} else if (unlikely(dstSubresource.aspectMask != VK_IMAGE_ASPECT_COLOR_BIT && srcSubresource.aspectMask != VK_IMAGE_ASPECT_COLOR_BIT)) {
Logger::err(str::format("D3D9DeviceEx::ResolveZ: Trying to blit from ",
srcFormatInfo.FormatColor, " (aspect ", srcSubresource.aspectMask, ")", " to ",
dstFormatInfo.FormatColor, " (aspect ", dstSubresource.aspectMask, ")"
));
return;
}

const VkImageSubresourceLayers dstSubresourceLayers = {
dstSubresource.aspectMask,
dstSubresource.mipLevel,
Expand Down

0 comments on commit f5ca3cf

Please sign in to comment.