Skip to content

Commit

Permalink
[hgiVulkan] Fix for HgiVulkanBlitCmds::CopyBufferGpuToCpu.
Browse files Browse the repository at this point in the history
(Internal change: 2332352)
  • Loading branch information
clach authored and pixar-oss committed Jun 28, 2024
1 parent 2d01767 commit 3406250
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions pxr/imaging/hgiVulkan/blitCmds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,9 @@ HgiVulkanBlitCmds::CopyBufferGpuToCpu(HgiBufferGpuToCpuOp const& copyOp)
// Copy from device-local GPU buffer into GPU staging buffer
VkBufferCopy copyRegion = {};
copyRegion.srcOffset = copyOp.sourceByteOffset;
copyRegion.dstOffset = copyOp.destinationByteOffset;
// No need to use dst offset during intermediate step of copying into
// staging buffer.
copyRegion.dstOffset = 0;
copyRegion.size = copyOp.byteSize;
vkCmdCopyBuffer(
_commandBuffer->GetVulkanCommandBuffer(),
Expand All @@ -351,9 +353,10 @@ HgiVulkanBlitCmds::CopyBufferGpuToCpu(HgiBufferGpuToCpuOp const& copyOp)
// Offset into the dst buffer
char* dst = ((char*) copyOp.cpuDestinationBuffer) +
copyOp.destinationByteOffset;

// Offset into the src buffer
const char* src = ((const char*) cpuAddress) + copyOp.sourceByteOffset;

// No need to offset into src buffer since we copied into staging buffer
// without dst offset.
const char* src = ((const char*) cpuAddress);

// bytes to copy
size_t size = copyOp.byteSize;
Expand Down

0 comments on commit 3406250

Please sign in to comment.