From 482147d92973c73a7a17c6dee631b4b6ef87950a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Gu=C3=A9rin?= Date: Sun, 14 Jan 2018 01:39:59 -0800 Subject: [PATCH] [d3d11] support textures in CopyResource fixes green textures and log spam with TrackMania --- src/d3d11/d3d11_context.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 6f1e8488..0386d43e 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -488,7 +488,26 @@ namespace dxvk { srcBuffer.offset(), srcBuffer.length()); } else { - Logger::err("D3D11DeviceContext::CopyResource: Images not supported"); + const D3D11TextureInfo* dstTextureInfo = GetCommonTextureInfo(pDstResource); + const D3D11TextureInfo* srcTextureInfo = GetCommonTextureInfo(pSrcResource); + + VkExtent3D extent = srcTextureInfo->image->mipLevelExtent( + dstTextureInfo->mappedSubresource.mipLevel); + + const VkImageSubresourceLayers dstLayers = { + dstTextureInfo->mappedSubresource.aspectMask, + dstTextureInfo->mappedSubresource.mipLevel, + dstTextureInfo->mappedSubresource.arrayLayer, 1 }; + + const VkImageSubresourceLayers srcLayers = { + srcTextureInfo->mappedSubresource.aspectMask, + srcTextureInfo->mappedSubresource.mipLevel, + srcTextureInfo->mappedSubresource.arrayLayer, 1 }; + + m_context->copyImage( + dstTextureInfo->image, dstLayers, VkOffset3D { 0, 0, 0 }, + srcTextureInfo->image, srcLayers, VkOffset3D { 0, 0, 0 }, + extent); } }