mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-02-20 19:54:19 +01:00
[dxvk] Fix broken row/slice alignment in buffer<->image copies
If the specified row or slice alignment matches the row size exactly but is not a power of two, we could accidentally screw up the alignment.
This commit is contained in:
parent
ba4938e201
commit
9f7a5a077f
@ -2751,12 +2751,12 @@ namespace dxvk {
|
||||
VkDeviceSize rowPitch = blockCount.width * elementSize;
|
||||
|
||||
if (bufferRowAlignment > elementSize)
|
||||
rowPitch = bufferRowAlignment > rowPitch ? bufferRowAlignment : align(rowPitch, bufferRowAlignment);
|
||||
rowPitch = bufferRowAlignment >= rowPitch ? bufferRowAlignment : align(rowPitch, bufferRowAlignment);
|
||||
|
||||
VkDeviceSize slicePitch = blockCount.height * rowPitch;
|
||||
|
||||
if (image->info().type == VK_IMAGE_TYPE_3D && bufferSliceAlignment > elementSize)
|
||||
slicePitch = bufferSliceAlignment > slicePitch ? bufferSliceAlignment : align(slicePitch, bufferSliceAlignment);
|
||||
slicePitch = bufferSliceAlignment >= slicePitch ? bufferSliceAlignment : align(slicePitch, bufferSliceAlignment);
|
||||
|
||||
copyRegion.bufferOffset = aspectOffset;
|
||||
copyRegion.bufferRowLength = formatInfo->blockSize.width * rowPitch / elementSize;
|
||||
@ -2779,7 +2779,7 @@ namespace dxvk {
|
||||
VkDeviceSize layerPitch = aspectOffset - bufferOffset;
|
||||
|
||||
if (bufferSliceAlignment)
|
||||
layerPitch = bufferSliceAlignment > layerPitch ? bufferSliceAlignment : align(layerPitch, bufferSliceAlignment);
|
||||
layerPitch = bufferSliceAlignment >= layerPitch ? bufferSliceAlignment : align(layerPitch, bufferSliceAlignment);
|
||||
|
||||
bufferOffset += layerPitch;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user