From 8ee70317425136d447699ec37b922602b935dd2e Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Tue, 29 Oct 2024 22:15:07 +0100 Subject: [PATCH] [d3d11] Simplify InitHostVisibleBuffer --- src/d3d11/d3d11_initializer.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/d3d11/d3d11_initializer.cpp b/src/d3d11/d3d11_initializer.cpp index 79873054d..4ec1c1e03 100644 --- a/src/d3d11/d3d11_initializer.cpp +++ b/src/d3d11/d3d11_initializer.cpp @@ -118,18 +118,10 @@ namespace dxvk { // If the buffer is mapped, we can write data directly // to the mapped memory region instead of doing it on // the GPU. Same goes for zero-initialization. - DxvkBufferSlice bufferSlice = pBuffer->GetBufferSlice(); - - if (pInitialData != nullptr && pInitialData->pSysMem != nullptr) { - std::memcpy( - bufferSlice.mapPtr(0), - pInitialData->pSysMem, - bufferSlice.length()); - } else { - std::memset( - bufferSlice.mapPtr(0), 0, - bufferSlice.length()); - } + if (pInitialData && pInitialData->pSysMem) + std::memcpy(pBuffer->GetMapPtr(), pInitialData->pSysMem, pBuffer->Desc()->ByteWidth); + else + std::memset(pBuffer->GetMapPtr(), 0, pBuffer->Desc()->ByteWidth); }