rhi: vulkan: Reduce staging copy size for full-width texture uploads
Pick-to: 6.6 6.5 Task-number: QTBUG-120565 Change-Id: I057f40ee410df35af87f27a0357252bc26234f04 Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit aa12713c1fdb8dfb9034de6f8f162864cf868753) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
4e396bcdc4
commit
191459da49
@ -3225,12 +3225,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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user