1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-21 13:29:26 +01:00

[d3d9] Calculate slice alignment when uploading straight from the mapping buffer

This commit is contained in:
Robin Kertels 2022-04-06 17:03:55 +02:00 committed by Joshie
parent 957a305ca8
commit 42c66c410e

View File

@ -4478,6 +4478,7 @@ namespace dxvk {
+ srcOffsetBlockCount.y * pitch + srcOffsetBlockCount.y * pitch
+ srcOffsetBlockCount.x * formatInfo->elementSize; + srcOffsetBlockCount.x * formatInfo->elementSize;
VkDeviceSize sliceAlignment = 1;
VkDeviceSize rowAlignment = 1; VkDeviceSize rowAlignment = 1;
DxvkBufferSlice copySrcSlice; DxvkBufferSlice copySrcSlice;
if (pSrcTexture->DoesStagingBufferUploads(SrcSubresource)) { if (pSrcTexture->DoesStagingBufferUploads(SrcSubresource)) {
@ -4490,7 +4491,9 @@ namespace dxvk {
pitch, pitch * srcTexLevelExtentBlockCount.height); pitch, pitch * srcTexLevelExtentBlockCount.height);
} else { } else {
copySrcSlice = DxvkBufferSlice(pSrcTexture->GetBuffer(SrcSubresource), copySrcOffset, srcSlice.length); copySrcSlice = DxvkBufferSlice(pSrcTexture->GetBuffer(SrcSubresource), copySrcOffset, srcSlice.length);
rowAlignment = pitch; // row alignment can act as the pitch parameter // row/slice alignment can act as the pitch parameter
rowAlignment = pitch;
sliceAlignment = srcTexLevelExtentBlockCount.height * pitch;
} }
EmitCs([ EmitCs([
@ -4499,13 +4502,14 @@ namespace dxvk {
cDstLayers = dstLayers, cDstLayers = dstLayers,
cDstLevelExtent = alignedExtent, cDstLevelExtent = alignedExtent,
cOffset = alignedDestOffset, cOffset = alignedDestOffset,
cRowAlignment = rowAlignment cRowAlignment = rowAlignment,
cSliceAlignment = sliceAlignment
] (DxvkContext* ctx) { ] (DxvkContext* ctx) {
ctx->copyBufferToImage( ctx->copyBufferToImage(
cDstImage, cDstLayers, cDstImage, cDstLayers,
cOffset, cDstLevelExtent, cOffset, cDstLevelExtent,
cSrcSlice.buffer(), cSrcSlice.offset(), cSrcSlice.buffer(), cSrcSlice.offset(),
cRowAlignment, 0); cRowAlignment, cSliceAlignment);
}); });
TrackTextureMappingBufferSequenceNumber(pSrcTexture, SrcSubresource); TrackTextureMappingBufferSequenceNumber(pSrcTexture, SrcSubresource);