QRhiTextureSubresourceUploadDescription Class

Describes the source for one mip level in a layer in a texture upload operation. More...

Header: #include <QRhiTextureSubresourceUploadDescription>
qmake: QT += rhi

Public Functions

QRhiTextureSubresourceUploadDescription()
QRhiTextureSubresourceUploadDescription(const QImage &image)
QRhiTextureSubresourceUploadDescription(const void *data, int size)
QByteArray data() const
QPoint destinationTopLeft() const
QImage image() const
void setData(const QByteArray &data)
void setDestinationTopLeft(const QPoint &p)
void setImage(const QImage &image)
void setSourceSize(const QSize &size)
void setSourceTopLeft(const QPoint &p)
QSize sourceSize() const
QPoint sourceTopLeft() const

Detailed Description

Describes the source for one mip level in a layer in a texture upload operation.

The source content is specified either as a QImage or as a raw blob. The former is only allowed for uncompressed textures with a format that can be mapped to QImage, while the latter is supported for all formats, including floating point and compressed.

Note: image() and data() cannot be both set at the same time.

destinationTopLeft() specifies the top-left corner of the target rectangle. Defaults to (0, 0).

An empty sourceSize() (the default) indicates that size is assumed to be the size of the subresource. With QImage-based uploads this implies that the size of the source image() must match the subresource. When providing raw data instead, sufficient number of bytes must be provided in data().

Note: With compressed textures the first upload must always match the subresource size due to graphics API limitations with some backends.

sourceTopLeft() is supported only for QImage-based uploads, and specifies the top-left corner of the source rectangle.

Note: Setting sourceSize() or sourceTopLeft() may trigger a QImage copy internally, depending on the format and the backend.

When providing raw data, the stride (row pitch, row length in bytes) of the provided data must be equal to width * pixelSize where pixelSize is the number of bytes used for one pixel, and there must be no additional padding between rows. There is no row start alignment requirement.

Note: The format of the source data must be compatible with the texture format. With many graphics APIs the data is copied as-is into a staging buffer, there is no intermediate format conversion provided by QRhi. This applies to floating point formats as well, with, for example, RGBA16F requiring half floats in the source data.

Member Type Documentation

Property Documentation

Member Function Documentation

QRhiTextureSubresourceUploadDescription::QRhiTextureSubresourceUploadDescription()

Constructs an empty subresource description.

Note: an empty QRhiTextureSubresourceUploadDescription is not useful on its own and should not be submitted to a QRhiTextureUploadEntry. At minimum image or data must be set first.

QRhiTextureSubresourceUploadDescription::QRhiTextureSubresourceUploadDescription(const QImage &image)

Constructs a mip level description with a image.

The size of image must match the size of the mip level. For level 0 that is the texture size.

The bit depth of image must be compatible with the texture format.

To describe a partial upload, call setSourceSize(), setSourceTopLeft(), or setDestinationTopLeft() afterwards.

QRhiTextureSubresourceUploadDescription::QRhiTextureSubresourceUploadDescription(const void *data, int size)

Constructs a mip level description with the image data is specified by data and size. This is suitable for floating point and compressed formats as well.

data can safely be destroyed or changed once this function returns.

QByteArray QRhiTextureSubresourceUploadDescription::data() const

See also setData().

QPoint QRhiTextureSubresourceUploadDescription::destinationTopLeft() const

See also setDestinationTopLeft().

QImage QRhiTextureSubresourceUploadDescription::image() const

See also setImage().

void QRhiTextureSubresourceUploadDescription::setData(const QByteArray &data)

See also data().

void QRhiTextureSubresourceUploadDescription::setDestinationTopLeft(const QPoint &p)

See also destinationTopLeft().

void QRhiTextureSubresourceUploadDescription::setImage(const QImage &image)

See also image().

void QRhiTextureSubresourceUploadDescription::setSourceSize(const QSize &size)

See also sourceSize().

void QRhiTextureSubresourceUploadDescription::setSourceTopLeft(const QPoint &p)

See also sourceTopLeft().

QSize QRhiTextureSubresourceUploadDescription::sourceSize() const

See also setSourceSize().

QPoint QRhiTextureSubresourceUploadDescription::sourceTopLeft() const

See also setSourceTopLeft().

Member Variable Documentation

Related Non-Members

Macro Documentation