diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 86935d5c..6444577a 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -1217,9 +1217,7 @@ namespace dxvk { DxvkDataSlice imageDataBuffer = AllocUpdateBufferSlice(bytesTotal); - util::packImageData( - reinterpret_cast(imageDataBuffer.ptr()), - reinterpret_cast(pSrcData), + util::packImageData(imageDataBuffer.ptr(), pSrcData, regionExtent, formatInfo->elementSize, SrcRowPitch, SrcDepthPitch); diff --git a/src/dxvk/dxvk_context.cpp b/src/dxvk/dxvk_context.cpp index 3f419c0c..664d35ba 100644 --- a/src/dxvk/dxvk_context.cpp +++ b/src/dxvk/dxvk_context.cpp @@ -1947,10 +1947,7 @@ namespace dxvk { formatInfo->elementSize * util::flattenImageExtent(elementCount)); auto stagingHandle = stagingSlice.getSliceHandle(); - auto dstData = reinterpret_cast(stagingHandle.mapPtr); - auto srcData = reinterpret_cast(data); - - util::packImageData(dstData, srcData, + util::packImageData(stagingHandle.mapPtr, data, elementCount, formatInfo->elementSize, pitchPerRow, pitchPerLayer); @@ -2035,9 +2032,7 @@ namespace dxvk { VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); - util::packImageData( - reinterpret_cast(tmpBuffer->mapPtr(0)), - reinterpret_cast(data), + util::packImageData(tmpBuffer->mapPtr(0), data, extent3D, formatInfo->elementSize, pitchPerRow, pitchPerLayer); diff --git a/src/dxvk/dxvk_util.cpp b/src/dxvk/dxvk_util.cpp index a600f015..bde6df40 100644 --- a/src/dxvk/dxvk_util.cpp +++ b/src/dxvk/dxvk_util.cpp @@ -39,12 +39,15 @@ namespace dxvk::util { void packImageData( - char* dstData, - const char* srcData, + void* dstBytes, + const void* srcBytes, VkExtent3D blockCount, VkDeviceSize blockSize, VkDeviceSize pitchPerRow, VkDeviceSize pitchPerLayer) { + auto dstData = reinterpret_cast< char*>(dstBytes); + auto srcData = reinterpret_cast(srcBytes); + const VkDeviceSize bytesPerRow = blockCount.width * blockSize; const VkDeviceSize bytesPerLayer = blockCount.height * bytesPerRow; const VkDeviceSize bytesTotal = blockCount.depth * bytesPerLayer; diff --git a/src/dxvk/dxvk_util.h b/src/dxvk/dxvk_util.h index 86bb44e9..86d8b79c 100644 --- a/src/dxvk/dxvk_util.h +++ b/src/dxvk/dxvk_util.h @@ -24,16 +24,16 @@ namespace dxvk::util { /** * \brief Writes tightly packed image data to a buffer * - * \param [in] dstData Destination buffer pointer - * \param [in] srcData Pointer to source data + * \param [in] dstBytes Destination buffer pointer + * \param [in] srcBytes Pointer to source data * \param [in] blockCount Number of blocks to copy * \param [in] blockSize Number of bytes per block * \param [in] pitchPerRow Number of bytes between rows * \param [in] pitchPerLayer Number of bytes between layers */ void packImageData( - char* dstData, - const char* srcData, + void* dstBytes, + const void* srcBytes, VkExtent3D blockCount, VkDeviceSize blockSize, VkDeviceSize pitchPerRow,