QSSGRhiContext Class
QSSGRhiContext.更多
Header: | #include <QSSGRhiContext> |
Since: | Qt 6.7 |
公共函数
void | checkAndAdjustForNPoT(QRhiTexture *texture, QSSGRhiSamplerDescription *samplerDescription) |
QRhiCommandBuffer * | commandBuffer() const |
QRhiCommandBuffer::BeginPassFlags | commonPassFlags() const |
QRhiTexture * | dummyTexture(QRhiTexture::Flags flags, QRhiResourceUpdateBatch *rub, const QSize &size = QSize(64, 64), const QColor &fillColor = Qt::black, int arraySize = 0) |
bool | isValid() const |
int | mainPassSampleCount() const |
int | mainPassViewCount() const |
QRhiRenderPassDescriptor * | mainRenderPassDescriptor() const |
QRhiRenderTarget * | renderTarget() const |
QRhi * | rhi() const |
QRhiSampler * | sampler(const QSSGRhiSamplerDescription &samplerDescription) |
成员函数文档
void QSSGRhiContext::checkAndAdjustForNPoT(QRhiTexture *texture, QSSGRhiSamplerDescription *samplerDescription)
根据texture 的像素大小调整samplerDescription 的平铺和过滤模式。
在大多数情况下,samplerDescription 。不过,在使用旧式 3D API 时,对于宽度或高度不为 2 的纹理,有可能不支持平铺模式(如QRhiSampler::Repeat )。
此便捷函数有助于创建强大的应用程序,即使在运行时 OpenGL ES 2.0 或 WebGL 1 实现不支持QRhi::NPOTTextureRepeat 等功能时,应用程序仍能正常运行。
QRhiCommandBuffer *QSSGRhiContext::commandBuffer() const
返回Qt Quick 3D 渲染器使用的当前帧命令缓冲区。
QRhiCommandBuffer::BeginPassFlags QSSGRhiContext::commonPassFlags() const
返回调用QRhiCommandBuffer::beginPass() 时推荐使用的标志。
QRhiTexture *QSSGRhiContext::dummyTexture(QRhiTexture::Flags flags, QRhiResourceUpdateBatch *rub, const QSize &size = QSize(64, 64), const QColor &fillColor = Qt::black, int arraySize = 0)
返回具有指定flags 和像素size 的纹理。
这样做的目的是为了有效地访问一个 "虚拟 "纹理,该纹理填充了指定的fillColor ,并在渲染堆栈的不同位置重复使用。
rub 必须是一个有效的 ,因为如果找不到合适的缓存对象,该函数将创建一个新纹理并为其生成内容。然后,必要的上传操作会在给定的更新批次上排队。QRhiResourceUpdateBatch
当arraySize 为 2 或更多时,将返回一个二维纹理数组。
返回纹理的所有权归Qt Quick 3D 所有。
bool QSSGRhiContext::isValid() const
如果已成功初始化呈现器,则返回 true。
int QSSGRhiContext::mainPassSampleCount() const
返回主渲染通道中使用的采样计数。
int QSSGRhiContext::mainPassViewCount() const
返回主渲染传递中使用的多视图计数。当使用多视图渲染时,该值为 2,否则为 1(无多视图)。
QRhiRenderPassDescriptor *QSSGRhiContext::mainRenderPassDescriptor() const
返回Qt Quick 3D 渲染器主渲染通道使用的QRhiRenderPassDescriptor 。
QRhiRenderTarget *QSSGRhiContext::renderTarget() const
返回Qt Quick 3D 渲染器在当前帧的主渲染通道中使用的渲染目标。
如果View3D 使用的呈现模式(renderMode)不是 Offscreen(屏幕外),那么它实际上就是交换链中的一个呈现目标。更常见的情况是,渲染目标指的是纹理(即QRhiTextureRenderTarget ),例如,因为渲染模式是默认的 Offscreen(屏幕外),或者因为使用了后处理特效。
QRhi *QSSGRhiContext::rhi() const
返回Qt Quick 3D 渲染器使用的QRhi 对象。
QRhiSampler *QSSGRhiContext::sampler(const QSSGRhiSamplerDescription &samplerDescription)
返回一个具有samplerDescription 中指定的滤波器和平铺模式的采样器。
生成的QRhiSampler 对象会被缓存并重复使用。因此,这是访问具有给定设置的QRhiSampler 的便捷方法,而无需一直创建一个新的专用对象。
返回的QRhiSampler 的所有权归Qt Quick 3D 所有。
© 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.