Add QRhiTextureSubresourceUploadDescription QByteArray constructor

Change-Id: I1be4ef1a15c4049f19d0401d6a1a62b3117180a0
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
This commit is contained in:
Jonas Karlsson 2020-12-28 13:38:39 +01:00
parent 162a859045
commit a0aafefd00
2 changed files with 14 additions and 2 deletions

View File

@ -1609,6 +1609,16 @@ QRhiTextureSubresourceUploadDescription::QRhiTextureSubresourceUploadDescription
{
}
/*!
Constructs a mip level description with the image data specified by \a data. This is suitable
for floating point and compressed formats as well.
*/
QRhiTextureSubresourceUploadDescription::QRhiTextureSubresourceUploadDescription(
const QByteArray &data)
: m_data(data)
{
}
/*!
\class QRhiTextureUploadEntry
\internal
@ -5002,7 +5012,8 @@ void QRhiResourceUpdateBatch::uploadTexture(QRhiTexture *tex, const QRhiTextureU
*/
void QRhiResourceUpdateBatch::uploadTexture(QRhiTexture *tex, const QImage &image)
{
uploadTexture(tex, QRhiTextureUploadEntry(0, 0, image));
uploadTexture(tex,
QRhiTextureUploadEntry(0, 0, QRhiTextureSubresourceUploadDescription(image)));
}
/*!

View File

@ -505,8 +505,9 @@ class Q_GUI_EXPORT QRhiTextureSubresourceUploadDescription
{
public:
QRhiTextureSubresourceUploadDescription() = default;
QRhiTextureSubresourceUploadDescription(const QImage &image);
explicit QRhiTextureSubresourceUploadDescription(const QImage &image);
QRhiTextureSubresourceUploadDescription(const void *data, int size);
explicit QRhiTextureSubresourceUploadDescription(const QByteArray &data);
QImage image() const { return m_image; }
void setImage(const QImage &image) { m_image = image; }