1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-03 22:24:13 +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,34 +491,36 @@ namespace dxvk {
const D3D11TextureInfo* dstTextureInfo = GetCommonTextureInfo(pDstResource); const D3D11TextureInfo* dstTextureInfo = GetCommonTextureInfo(pDstResource);
const D3D11TextureInfo* srcTextureInfo = GetCommonTextureInfo(pSrcResource); const D3D11TextureInfo* srcTextureInfo = GetCommonTextureInfo(pSrcResource);
VkExtent3D extent = srcTextureInfo->image->mipLevelExtent( const DxvkFormatInfo* dstFormatInfo = imageFormatInfo(dstTextureInfo->image->info().format);
dstTextureInfo->mappedSubresource.mipLevel); const DxvkFormatInfo* srcFormatInfo = imageFormatInfo(srcTextureInfo->image->info().format);
const VkImageSubresourceLayers dstLayers = { for (uint32_t i = 0; i < srcTextureInfo->image->info().mipLevels; i++) {
dstTextureInfo->mappedSubresource.aspectMask, VkExtent3D extent = srcTextureInfo->image->mipLevelExtent(i);
dstTextureInfo->mappedSubresource.mipLevel,
dstTextureInfo->mappedSubresource.arrayLayer, 1 };
const VkImageSubresourceLayers srcLayers = { const VkImageSubresourceLayers dstLayers = {
srcTextureInfo->mappedSubresource.aspectMask, dstFormatInfo->aspectMask & srcFormatInfo->aspectMask,
srcTextureInfo->mappedSubresource.mipLevel, i, 0, dstTextureInfo->image->info().numLayers };
srcTextureInfo->mappedSubresource.arrayLayer, 1 };
m_context->copyImage( const VkImageSubresourceLayers srcLayers = {
dstTextureInfo->image, dstLayers, VkOffset3D { 0, 0, 0 }, dstFormatInfo->aspectMask & srcFormatInfo->aspectMask,
srcTextureInfo->image, srcLayers, VkOffset3D { 0, 0, 0 }, i, 0, srcTextureInfo->image->info().numLayers };
extent);
m_context->copyImage(
dstTextureInfo->image, dstLayers, VkOffset3D { 0, 0, 0 },
srcTextureInfo->image, srcLayers, VkOffset3D { 0, 0, 0 },
extent);
}
} }
} }
void STDMETHODCALLTYPE D3D11DeviceContext::CopyStructureCount( void STDMETHODCALLTYPE D3D11DeviceContext::CopyStructureCount(
ID3D11Buffer* pDstBuffer, ID3D11Buffer* pDstBuffer,
UINT DstAlignedByteOffset, UINT DstAlignedByteOffset,
ID3D11UnorderedAccessView* pSrcView) { ID3D11UnorderedAccessView* pSrcView) {
auto buf = static_cast<D3D11Buffer*>(pDstBuffer); auto buf = static_cast<D3D11Buffer*>(pDstBuffer);
auto uav = static_cast<D3D11UnorderedAccessView*>(pSrcView); auto uav = static_cast<D3D11UnorderedAccessView*>(pSrcView);
const DxvkBufferSlice dstSlice = buf->GetBufferSlice(DstAlignedByteOffset); const DxvkBufferSlice dstSlice = buf->GetBufferSlice(DstAlignedByteOffset);
const DxvkBufferSlice srcSlice = uav->GetCounterSlice(); const DxvkBufferSlice srcSlice = uav->GetCounterSlice();