rhi: vulkan: Reduce staging copy size for full-width texture uploads

Pick-to: 6.7 6.6 6.5
Task-number: QTBUG-120565
Change-Id: I057f40ee410df35af87f27a0357252bc26234f04
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
bb10
Laszlo Agocs 2024-04-30 11:57:08 +02:00
parent db7b00c4b7
commit aa12713c1f
1 changed files with 6 additions and 6 deletions

View File

@ -3497,12 +3497,12 @@ void QRhiVulkan::prepareUploadSubres(QVkTexture *texD, int layer, int level,
const int sy = subresDesc.sourceTopLeft().y();
if (!subresDesc.sourceSize().isEmpty())
size = subresDesc.sourceSize();
if (image.depth() == 32) {
// The staging buffer will get the full image
// regardless, just adjust the vk
// buffer-to-image copy start offset.
copyInfo.bufferOffset += VkDeviceSize(sy * image.bytesPerLine() + sx * 4);
// bufferRowLength remains set to the original image's width
if (size.width() == image.width()) {
// No need to make a QImage copy here, can copy from the source
// QImage into staging directly.
src = image.constBits() + sy * image.bytesPerLine() + sx * bpc;
copySizeBytes = size.height() * image.bytesPerLine();
} else {
image = image.copy(sx, sy, size.width(), size.height());
src = image.constBits();