1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-11-29 10:24:10 +01:00

[d3d9] Fix FlushImage extent for smaller mip maps

This commit is contained in:
Robin Kertels 2021-07-10 15:04:27 +02:00 committed by Joshie
parent 9f0775b1ac
commit 5f1629f2cb

View File

@ -4327,9 +4327,9 @@ namespace dxvk {
int32_t(alignDown(box.Front >> subresource.mipLevel, formatInfo->blockSize.depth)) int32_t(alignDown(box.Front >> subresource.mipLevel, formatInfo->blockSize.depth))
}; };
VkExtent3D scaledBoxExtent = util::computeMipLevelExtent({ VkExtent3D scaledBoxExtent = util::computeMipLevelExtent({
uint32_t(box.Right - scaledBoxOffset.x), uint32_t(box.Right - int32_t(alignDown(box.Left, formatInfo->blockSize.width))),
uint32_t(box.Bottom - scaledBoxOffset.y), uint32_t(box.Bottom - int32_t(alignDown(box.Top, formatInfo->blockSize.height))),
uint32_t(box.Back - scaledBoxOffset.z) uint32_t(box.Back - int32_t(alignDown(box.Front, formatInfo->blockSize.depth)))
}, subresource.mipLevel); }, subresource.mipLevel);
VkExtent3D scaledBoxExtentBlockCount = util::computeBlockCount(scaledBoxExtent, formatInfo->blockSize); VkExtent3D scaledBoxExtentBlockCount = util::computeBlockCount(scaledBoxExtent, formatInfo->blockSize);
VkExtent3D scaledAlignedBoxExtent = util::computeBlockExtent(scaledBoxExtentBlockCount, formatInfo->blockSize); VkExtent3D scaledAlignedBoxExtent = util::computeBlockExtent(scaledBoxExtentBlockCount, formatInfo->blockSize);
@ -4337,9 +4337,9 @@ namespace dxvk {
VkExtent3D texLevelExtent = image->mipLevelExtent(subresource.mipLevel); VkExtent3D texLevelExtent = image->mipLevelExtent(subresource.mipLevel);
VkExtent3D texLevelExtentBlockCount = util::computeBlockCount(texLevelExtent, formatInfo->blockSize); VkExtent3D texLevelExtentBlockCount = util::computeBlockCount(texLevelExtent, formatInfo->blockSize);
scaledAlignedBoxExtent.width = std::min<uint32_t>(texLevelExtent.width, scaledAlignedBoxExtent.width); scaledAlignedBoxExtent.width = std::min<uint32_t>(texLevelExtent.width - scaledBoxOffset.x, scaledAlignedBoxExtent.width);
scaledAlignedBoxExtent.height = std::min<uint32_t>(texLevelExtent.height, scaledAlignedBoxExtent.height); scaledAlignedBoxExtent.height = std::min<uint32_t>(texLevelExtent.height - scaledBoxOffset.y, scaledAlignedBoxExtent.height);
scaledAlignedBoxExtent.depth = std::min<uint32_t>(texLevelExtent.depth, scaledAlignedBoxExtent.depth); scaledAlignedBoxExtent.depth = std::min<uint32_t>(texLevelExtent.depth - scaledBoxOffset.z, scaledAlignedBoxExtent.depth);
VkDeviceSize dirtySize = scaledBoxExtentBlockCount.width * scaledBoxExtentBlockCount.height * scaledBoxExtentBlockCount.depth * formatInfo->elementSize; VkDeviceSize dirtySize = scaledBoxExtentBlockCount.width * scaledBoxExtentBlockCount.height * scaledBoxExtentBlockCount.depth * formatInfo->elementSize;
D3D9BufferSlice slice = AllocTempBuffer<false>(dirtySize); D3D9BufferSlice slice = AllocTempBuffer<false>(dirtySize);