1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 20:52:10 +01:00

[dxvk] Use void pointers for packImageData

Makes this function a bit less annoying to use.
This commit is contained in:
Philip Rebohle 2019-06-25 14:17:03 +02:00
parent 3293bd21d1
commit 4d4db6c683
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
4 changed files with 12 additions and 16 deletions

View File

@ -1217,9 +1217,7 @@ namespace dxvk {
DxvkDataSlice imageDataBuffer = AllocUpdateBufferSlice(bytesTotal);
util::packImageData(
reinterpret_cast<char*>(imageDataBuffer.ptr()),
reinterpret_cast<const char*>(pSrcData),
util::packImageData(imageDataBuffer.ptr(), pSrcData,
regionExtent, formatInfo->elementSize,
SrcRowPitch, SrcDepthPitch);

View File

@ -1947,10 +1947,7 @@ namespace dxvk {
formatInfo->elementSize * util::flattenImageExtent(elementCount));
auto stagingHandle = stagingSlice.getSliceHandle();
auto dstData = reinterpret_cast<char*>(stagingHandle.mapPtr);
auto srcData = reinterpret_cast<const char*>(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<char*>(tmpBuffer->mapPtr(0)),
reinterpret_cast<const char*>(data),
util::packImageData(tmpBuffer->mapPtr(0), data,
extent3D, formatInfo->elementSize,
pitchPerRow, pitchPerLayer);

View File

@ -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<const char*>(srcBytes);
const VkDeviceSize bytesPerRow = blockCount.width * blockSize;
const VkDeviceSize bytesPerLayer = blockCount.height * bytesPerRow;
const VkDeviceSize bytesTotal = blockCount.depth * bytesPerLayer;

View File

@ -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,