From d858b13d071e1fb3fd06ab62e97a34e0e831eeae Mon Sep 17 00:00:00 2001 From: Yuxiao Mao Date: Mon, 11 Sep 2023 09:52:38 +0200 Subject: [PATCH] HL_XBS: dx12 minor workaround --- libs/directx/dx12.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libs/directx/dx12.cpp b/libs/directx/dx12.cpp index 69327df80..b03729cd0 100644 --- a/libs/directx/dx12.cpp +++ b/libs/directx/dx12.cpp @@ -579,16 +579,20 @@ void HL_NAME(resource_unmap)( ID3D12Resource *res, int subres, D3D12_RANGE *rang int64 HL_NAME(get_required_intermediate_size)( ID3D12Resource *res, int first, int count ) { auto desc = res->GetDesc(); UINT64 size = 0; +#ifndef HL_XBS static_driver->device->GetCopyableFootprints(&desc, first, count, 0, NULL, NULL, NULL, &size); -#ifdef HL_XBS +#else D3D12_PLACED_SUBRESOURCE_FOOTPRINT pLayouts; - static_driver->device->GetCopyableFootprints(&desc, first, 1, 0, &pLayouts, NULL, NULL, NULL); + static_driver->device->GetCopyableFootprints(&desc, first + count - 1, 1, 0, &pLayouts, NULL, NULL, &size); size += pLayouts.Offset; #endif return size; } bool HL_NAME(update_sub_resource)( ID3D12GraphicsCommandList *cmd, ID3D12Resource *res, ID3D12Resource *tmp, int64 tmpOffs, int first, int count, D3D12_SUBRESOURCE_DATA *data ) { +#ifdef HL_XBS + tmpOffs = 0; +#endif return UpdateSubresources(cmd,res,tmp,(UINT64)tmpOffs,(UINT)first,(UINT)count,data) != 0; }