From d7c4afbebaff12cfda7c51a0971a4c939e2bb309 Mon Sep 17 00:00:00 2001 From: Robin Kertels Date: Sat, 19 Jun 2021 18:12:07 +0200 Subject: [PATCH] [d3d9] Pass correct element size to texture converter --- src/d3d9/d3d9_device.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index 81079c69..c7ac4944 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -4309,7 +4309,6 @@ namespace dxvk { auto convertFormat = pResource->GetFormatMapping().ConversionFormatInfo; if (likely(convertFormat.FormatType == D3D9ConversionFormat_None)) { - const DxvkFormatInfo* formatInfo = imageFormatInfo(pResource->GetFormatMapping().FormatColor); VkImageSubresourceLayers dstLayers = { VK_IMAGE_ASPECT_COLOR_BIT, subresource.mipLevel, subresource.arrayLayer, 1 }; const D3DBOX& box = pResource->GetDirtyBox(subresource.arrayLayer); @@ -4361,13 +4360,14 @@ namespace dxvk { }); } else { + const DxvkFormatInfo* formatInfo = imageFormatInfo(pResource->GetFormatMapping().FormatColor); VkExtent3D texLevelExtent = image->mipLevelExtent(subresource.mipLevel); VkExtent3D texLevelExtentBlockCount = util::computeBlockCount(texLevelExtent, formatInfo->blockSize); D3D9BufferSlice slice = AllocTempBuffer(srcSlice.length); VkDeviceSize pitch = align(texLevelExtentBlockCount.width * formatInfo->elementSize, 4); util::packImageData( - slice.mapPtr, srcSlice.mapPtr, texLevelExtent, formatInfo->elementSize, + slice.mapPtr, srcSlice.mapPtr, texLevelExtentBlockCount, formatInfo->elementSize, pitch, pitch * texLevelExtentBlockCount.height); Flush();