diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2024-04-30 11:57:08 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2024-05-02 12:45:59 +0200 |
commit | aa12713c1fdb8dfb9034de6f8f162864cf868753 (patch) | |
tree | c389505227d2bdf9ab23d70f68fb73d31ea9e2fe /src/gui/rhi | |
parent | db7b00c4b79bf2700d816879c25243b3a3336dd7 (diff) |
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>
Diffstat (limited to 'src/gui/rhi')
-rw-r--r-- | src/gui/rhi/qrhivulkan.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index f0b51146cc..ccfba7493f 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -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(); |