rhi: gl: Avoid a copy in partial texture uploads
Pick-to: 6.7 6.6 6.5 Task-number: QTBUG-120565 Change-Id: I7f1f8c42b98c5743708c4ff80e401070d8ab24ac Reviewed-by: Andy Nichols <andy.nichols@qt.io>bb10
parent
d6bc7613ac
commit
690bb2e0c4
|
|
@ -2377,7 +2377,15 @@ void QRhiGles2::enqueueSubresUpload(QGles2Texture *texD, QGles2CommandBuffer *cb
|
|||
const QPoint sp = subresDesc.sourceTopLeft();
|
||||
if (!subresDesc.sourceSize().isEmpty())
|
||||
size = subresDesc.sourceSize();
|
||||
img = img.copy(sp.x(), sp.y(), size.width(), size.height());
|
||||
|
||||
if (caps.unpackRowLength) {
|
||||
cbD->retainImage(img);
|
||||
// create a non-owning wrapper for the subimage
|
||||
const uchar *data = img.constBits() + sp.y() * img.bytesPerLine() + sp.x() * (qMax(1, img.depth() / 8));
|
||||
img = QImage(data, size.width(), size.height(), img.bytesPerLine(), img.format());
|
||||
} else {
|
||||
img = img.copy(sp.x(), sp.y(), size.width(), size.height());
|
||||
}
|
||||
}
|
||||
|
||||
setCmdByNotCompressedData(cbD->retainImage(img), size, img.bytesPerLine());
|
||||
|
|
|
|||
Loading…
Reference in New Issue