PySide6.QtGui.QRhiReadbackDescription

class QRhiReadbackDescription

Describes a readback (reading back texture contents from possibly GPU-only memory) operation.

Details

The source of the readback operation is either a QRhiTexture or the current backbuffer of the currently targeted QRhiSwapChain . When texture() is not set, the swapchain is used. Otherwise the specified QRhiTexture is treated as the source.

Note

Textures used in readbacks must be created with UsedAsTransferSource .

Note

Swapchains used in readbacks must be created with UsedAsTransferSource .

layer() and level() are only applicable when the source is a QRhiTexture .

Note

Multisample textures cannot be read back. Readbacks are supported for multisample swapchain buffers however.

Note

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

Added in version 6.6.

Synopsis

Methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

__init__()

Constructs an empty texture readback description.

Note

The source texture is set to null by default, which is still a valid readback: it specifies that the backbuffer of the current swapchain is to be read back. (current meaning the frame’s target swapchain at the time of committing the QRhiResourceUpdateBatch with the texture readback on it)

__init__(texture)
Parameters:

textureQRhiTexture

Constructs an texture readback description that specifies that level 0 of layer 0 of texture is to be read back.

Note

texture can also be null in which case this constructor is identical to the argumentless variant.

layer()
Return type:

int

Returns the currently set array layer (cubemap face, array index). Defaults to 0.

Applicable only when the source of the readback is a QRhiTexture .

See also

setLayer()

level()
Return type:

int

Returns the currently set mip level. Defaults to 0.

Applicable only when the source of the readback is a QRhiTexture .

See also

setLevel()

rect()
Return type:

QRect

Returns the rectangle to read back. Defaults to an invalid rectangle.

If invalid, the entire texture or swapchain backbuffer is read back.

See also

setRect()

setLayer(layer)
Parameters:

layer – int

Sets the array layer to read back.

See also

layer()

setLevel(level)
Parameters:

level – int

Sets the mip level to read back.

See also

level()

setRect(rectangle)
Parameters:

rectangleQRect

Sets the rectangle to read back.

See also

rect()

setTexture(tex)
Parameters:

texQRhiTexture

Sets the texture tex as the source of the readback operation.

Setting None is valid too, in which case the current swapchain’s current backbuffer is used. (but then the readback cannot be issued in a non-swapchain-based frame)

Note

Multisample textures cannot be read back. Readbacks are supported for multisample swapchain buffers however.

Note

Textures used in readbacks must be created with UsedAsTransferSource .

Note

Swapchains used in readbacks must be created with UsedAsTransferSource .

See also

texture()

texture()
Return type:

QRhiTexture

Returns the QRhiTexture that is read back. Can be left set to None which indicates that the backbuffer of the current swapchain is to be used instead.

See also

setTexture()