Skip to content

Commit

Permalink
[d3d9] Fix pitch when copying straight from mapping buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
K0bin authored and misyltoad committed Jul 23, 2021
1 parent 34101dc commit 584e151
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/d3d9/d3d9_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4364,12 +4364,12 @@ namespace dxvk {
+ boxOffsetBlockCount.y * texLevelExtentBlockCount.width
+ boxOffsetBlockCount.x)
* formatInfo->elementSize;
VkDeviceSize pitch = align(texLevelExtentBlockCount.width * formatInfo->elementSize, 4);

VkDeviceSize rowAlignment = 0;
DxvkBufferSlice copySrcSlice;
if (pResource->DoesStagingBufferUploads(Subresource)) {
VkDeviceSize dirtySize = scaledBoxExtentBlockCount.width * scaledBoxExtentBlockCount.height * scaledBoxExtentBlockCount.depth * formatInfo->elementSize;
VkDeviceSize pitch = align(texLevelExtentBlockCount.width * formatInfo->elementSize, 4);
D3D9BufferSlice slice = AllocTempBuffer<false>(dirtySize);
copySrcSlice = slice.slice;
void* srcData = reinterpret_cast<uint8_t*>(srcSlice.mapPtr) + copySrcOffset;
Expand All @@ -4378,7 +4378,7 @@ namespace dxvk {
pitch, pitch * texLevelExtentBlockCount.height);
} else {
copySrcSlice = DxvkBufferSlice(pResource->GetBuffer(Subresource), copySrcOffset, srcSlice.length);
rowAlignment = 4;
rowAlignment = pitch; // row alignment can act as the pitch parameter
}

EmitCs([
Expand Down

0 comments on commit 584e151

Please sign in to comment.