From c7f8267f9802e29fc47934c50b93fe8713bb29f1 Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Thu, 8 Jul 2021 22:36:59 -0700 Subject: [PATCH] [d3d9] Fix NV12 conversion Froggy is the right color now --- src/d3d9/d3d9_device.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index d2f46b54..3e40c341 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -4372,12 +4372,16 @@ namespace dxvk { const DxvkFormatInfo* formatInfo = imageFormatInfo(pResource->GetFormatMapping().FormatColor); VkExtent3D texLevelExtent = image->mipLevelExtent(subresource.mipLevel); VkExtent3D texLevelExtentBlockCount = util::computeBlockCount(texLevelExtent, formatInfo->blockSize); + // Add more blocks for the other planes that we might have. + // TODO: PLEASE CLEAN ME + texLevelExtentBlockCount.height *= std::min(convertFormat.PlaneCount, 2u); D3D9BufferSlice slice = AllocTempBuffer(srcSlice.length); VkDeviceSize pitch = align(texLevelExtentBlockCount.width * formatInfo->elementSize, 4); + util::packImageData( slice.mapPtr, srcSlice.mapPtr, texLevelExtentBlockCount, formatInfo->elementSize, - pitch, pitch * texLevelExtentBlockCount.height); + pitch, std::min(convertFormat.PlaneCount, 2u) * pitch * texLevelExtentBlockCount.height); Flush(); SynchronizeCsThread();