QRhiRenderTarget Class
代表屏幕上(交换链)或屏幕外(纹理)的渲染目标。更多
Header: | #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 |
继承 | QRhiResource |
继承于 |
公共函数
virtual float | devicePixelRatio() const = 0 |
virtual QSize | pixelSize() const = 0 |
QRhiRenderPassDescriptor * | renderPassDescriptor() const |
virtual int | sampleCount() const = 0 |
void | setRenderPassDescriptor(QRhiRenderPassDescriptor *desc) |
详细说明
应用程序不会直接创建该类的实例。相反,API 客户端可通过newTextureRenderTarget() 将子类QRhiTextureRenderTarget 实例化。另一个子类是QRhiSwapChainRenderTarget ,它是QRhiSwapChain 在调用currentFrameRenderTarget() 时返回的类型。
注: 这是一个 RHI API,兼容性保证有限,详情请参见QRhi 。
另请参阅 QRhiSwapChainRenderTarget 和QRhiTextureRenderTarget 。
成员函数文档
[pure virtual]
float QRhiRenderTarget::devicePixelRatio() const
返回设备像素比。对于QRhiTextureRenderTarget ,该值始终为 1。对于从QRhiSwapChain 获取的目标,该值反映了目标QWindow 的device pixel ratio 。
[pure virtual]
QSize QRhiRenderTarget::pixelSize() const
以像素为单位返回大小。
仅在成功调用 create() 后有效。在此之前,结果是默认构建的QSize 。
对于QRhiTextureRenderTarget ,返回的大小是创建()时相关附件的大小,实际上是第一个颜色附件的大小,如果没有颜色附件,则是深度/模板缓冲区的大小。如果之后调整并重建了相关纹理或呈现缓冲区,那么 pixelSize() 会执行一次对 create() 的隐式调用,以重建底层数据结构。这种隐式检查类似于QRhiCommandBuffer::beginPass() 的做法,可以确保返回的尺寸始终是最新的。
QRhiRenderPassDescriptor *QRhiRenderTarget::renderPassDescriptor() const
返回相关的QRhiRenderPassDescriptor 。
另请参阅 setRenderPassDescriptor() 。
[pure virtual]
int QRhiRenderTarget::sampleCount() const
如果多采样抗锯齿与此渲染目标无关,则返回采样计数或 1。
void QRhiRenderTarget::setRenderPassDescriptor(QRhiRenderPassDescriptor *desc)
设置用于此呈现目标的QRhiRenderPassDescriptor desc 。
另请参阅 renderPassDescriptor().
© 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.