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

[d3d11] copy all layers and mipmaps in CopyResource

avoid using potentially undefined mappedSubresource
This commit is contained in:
Clément Guérin 2018-01-14 12:17:51 -08:00
parent 482147d929
commit 340438954d

View File

@ -491,23 +491,25 @@ namespace dxvk {
const D3D11TextureInfo* dstTextureInfo = GetCommonTextureInfo(pDstResource);
const D3D11TextureInfo* srcTextureInfo = GetCommonTextureInfo(pSrcResource);
VkExtent3D extent = srcTextureInfo->image->mipLevelExtent(
dstTextureInfo->mappedSubresource.mipLevel);
const DxvkFormatInfo* dstFormatInfo = imageFormatInfo(dstTextureInfo->image->info().format);
const DxvkFormatInfo* srcFormatInfo = imageFormatInfo(srcTextureInfo->image->info().format);
const VkImageSubresourceLayers dstLayers = {
dstTextureInfo->mappedSubresource.aspectMask,
dstTextureInfo->mappedSubresource.mipLevel,
dstTextureInfo->mappedSubresource.arrayLayer, 1 };
for (uint32_t i = 0; i < srcTextureInfo->image->info().mipLevels; i++) {
VkExtent3D extent = srcTextureInfo->image->mipLevelExtent(i);
const VkImageSubresourceLayers srcLayers = {
srcTextureInfo->mappedSubresource.aspectMask,
srcTextureInfo->mappedSubresource.mipLevel,
srcTextureInfo->mappedSubresource.arrayLayer, 1 };
const VkImageSubresourceLayers dstLayers = {
dstFormatInfo->aspectMask & srcFormatInfo->aspectMask,
i, 0, dstTextureInfo->image->info().numLayers };
m_context->copyImage(
dstTextureInfo->image, dstLayers, VkOffset3D { 0, 0, 0 },
srcTextureInfo->image, srcLayers, VkOffset3D { 0, 0, 0 },
extent);
const VkImageSubresourceLayers srcLayers = {
dstFormatInfo->aspectMask & srcFormatInfo->aspectMask,
i, 0, srcTextureInfo->image->info().numLayers };
m_context->copyImage(
dstTextureInfo->image, dstLayers, VkOffset3D { 0, 0, 0 },
srcTextureInfo->image, srcLayers, VkOffset3D { 0, 0, 0 },
extent);
}
}
}