QRhiTextureCopyDescription Class

Describes a texture-to-texture copy operation. More...

Header: #include <QRhiTextureCopyDescription>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
Since: Qt 6.6

Public Functions

QRhiTextureCopyDescription()
int destinationLayer() const
int destinationLevel() const
QPoint destinationTopLeft() const
QSize pixelSize() const
void setDestinationLayer(int layer)
void setDestinationLevel(int level)
void setDestinationTopLeft(const QPoint &p)
void setPixelSize(const QSize &sz)
void setSourceLayer(int layer)
void setSourceLevel(int level)
void setSourceTopLeft(const QPoint &p)
int sourceLayer() const
int sourceLevel() const
QPoint sourceTopLeft() const

Detailed Description

An empty pixelSize() indicates that the entire subresource is to be copied. A default constructed copy description therefore leads to copying the entire subresource at level 0 of layer 0.

Note: The source texture must be created with QRhiTexture::UsedAsTransferSource.

Note: The source and destination rectangles defined by pixelSize(), sourceTopLeft(), and destinationTopLeft() must fit the source and destination textures, respectively. The behavior is undefined otherwise.

With cubemaps, 3D textures, and texture arrays one face or slice can be copied at a time. The face or slice is specified by the source and destination layer indices. With mipmapped textures one mip level can be copied at a time. The source and destination layer and mip level indices can differ, but the size and position must be carefully controlled to avoid out of bounds copies, in which case the behavior is undefined.

Note: This is a RHI API with limited compatibility guarantees, see QRhi for details.

Member Function Documentation

[constexpr noexcept] QRhiTextureCopyDescription::QRhiTextureCopyDescription()

Constructs an empty texture copy description.

int QRhiTextureCopyDescription::destinationLayer() const

Returns the destination array layer (cubemap face or array layer index). Default to 0.

See also setDestinationLayer().

int QRhiTextureCopyDescription::destinationLevel() const

Returns the destionation mip level. Defaults to 0.

See also setDestinationLevel().

QPoint QRhiTextureCopyDescription::destinationTopLeft() const

Returns the destionation top-left position in pixels. Defaults to (0, 0).

See also setDestinationTopLeft().

QSize QRhiTextureCopyDescription::pixelSize() const

Returns the size of the region to copy.

Note: An empty pixelSize() indicates that the entire subresource is to be copied. A default constructed copy description therefore leads to copying the entire subresource at level 0 of layer 0.

See also setPixelSize().

void QRhiTextureCopyDescription::setDestinationLayer(int layer)

Sets the destination array layer.

See also destinationLayer().

void QRhiTextureCopyDescription::setDestinationLevel(int level)

Sets the destination mip level.

See also destinationLevel().

void QRhiTextureCopyDescription::setDestinationTopLeft(const QPoint &p)

Sets the destination top-left position p.

See also destinationTopLeft().

void QRhiTextureCopyDescription::setPixelSize(const QSize &sz)

Sets the size of the region to copy to sz.

See also pixelSize().

void QRhiTextureCopyDescription::setSourceLayer(int layer)

Sets the source array layer.

See also sourceLayer().

void QRhiTextureCopyDescription::setSourceLevel(int level)

Sets the source mip level.

See also sourceLevel().

void QRhiTextureCopyDescription::setSourceTopLeft(const QPoint &p)

Sets the source top-left position to p.

See also sourceTopLeft().

int QRhiTextureCopyDescription::sourceLayer() const

Returns the source array layer (cubemap face or array layer index). Defaults to 0.

See also setSourceLayer().

int QRhiTextureCopyDescription::sourceLevel() const

Returns the source mip level. Defaults to 0.

See also setSourceLevel().

QPoint QRhiTextureCopyDescription::sourceTopLeft() const

Returns the source top-left position (in pixels). Defaults to (0, 0).

See also setSourceTopLeft().