QRhiReadbackDescription Class

描述回读(从可能的 GPU 专用内存中读取纹理内容)操作。更多

头文件: #include <rhi/qrhi.h>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::GuiPrivate)
qmake: QT += gui-private
Qt 6.6

公共函数

QRhiReadbackDescription()
QRhiReadbackDescription(QRhiTexture *texture)
int layer() const
int level() const
void setLayer(int layer)
void setLevel(int level)
void setTexture(QRhiTexture *tex)
QRhiTexture *texture() const

详细说明

回读操作的源是QRhiTexture 或当前目标QRhiSwapChain 的当前回缓冲区。当texture() 未设置时,将使用 swapchain。否则,指定的QRhiTexture 将被视为源。

注意: 回读中使用的纹理必须通过QRhiTexture::UsedAsTransferSource 创建。

注: 回读中使用的交换链必须通过QRhiSwapChain::UsedAsTransferSource 创建。

layer() 和level() 仅适用于源为QRhiTexture 的情况。

注意: 无法回读多采样纹理。但多采样交换链缓冲区支持回读。

注: 这是一个 RHI API,兼容性保证有限,详情请查看QRhi

成员函数文档

[constexpr noexcept] QRhiReadbackDescription::QRhiReadbackDescription()

构造一个空纹理回读描述。

注意: 源纹理默认设置为空,这仍然是一个有效的回读:它指定回读当前交换链的后缓冲区。(当前指的是提交QRhiResourceUpdateBatch 时的帧目标交换链,texture readback

QRhiReadbackDescription::QRhiReadbackDescription(QRhiTexture *texture)

构造一个纹理回读描述,指定回读texture 第 0 层的第 0 层。

注: texture 也可以为空,在这种情况下,该构造函数与无参数变体相同。

int QRhiReadbackDescription::layer() const

返回当前设置的阵列层(cubemap 面、阵列索引)。默认为 0。

仅适用于回读源为QRhiTexture 的情况。

另请参阅 setLayer().

int QRhiReadbackDescription::level() const

返回当前设置的 mip 级别。默认为 0。

仅适用于回读源为QRhiTexture 的情况。

另请参阅 setLevel() 。

void QRhiReadbackDescription::setLayer(int layer)

设置要回读的数组layer

另请参阅 layer().

void QRhiReadbackDescription::setLevel(int level)

设置要回读的 miplevel

另请参阅 level().

void QRhiReadbackDescription::setTexture(QRhiTexture *tex)

将纹理tex 设置为回读操作的源。

设置nullptr 也有效,在这种情况下,将使用当前交换链的当前后端缓冲区。(但这样就无法在非交换链帧中进行回读操作)

注意: 无法回读多采样纹理。但多采样交换链缓冲区支持回读。

注意: 回读中使用的纹理必须使用QRhiTexture::UsedAsTransferSource 创建。

注意: 回读中使用的交换链必须通过QRhiSwapChain::UsedAsTransferSource 创建。

另请参阅 texture() 。

QRhiTexture *QRhiReadbackDescription::texture() const

返回读回的QRhiTexture 。可将其设置为nullptr ,表示使用当前 swapchain 的后缓冲区。

另请参见 setTexture().

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.