QRhiD3D12InitParams Struct
Direct3D 12 专用的初始化参数。更多内容...
| 头文件: | #include <rhi/qrhi.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS GuiPrivate) target_link_libraries(mytarget PRIVATE Qt6::GuiPrivate) |
| qmake: | QT += gui-private |
| 继承自: | QRhiInitParams |
公共变量
| bool | enableDebugLayer |
详细说明
注意:这是一个 兼容性保证有限的 RHI API,详情请参阅QRhi 。
基于 D3D12 的QRhi 无需特殊参数即可初始化。如有需要,可将enableDebugLayer 设置为true 以启用 Direct3D 调试层。这在开发过程中可能很有用,但在生产构建中应避免使用。
QRhiD3D12InitParams params;
params.enableDebugLayer = true;
rhi = QRhi::create(QRhi::D3D12, ¶ms);注意: QRhiSwapChain 仅应与将表面类型设置为QSurface::Direct3DSurface 的QWindow 实例配合使用。
与现有 Direct3D 12 设备的交互
在与其他图形引擎进行互操作时,可能需要获取一个使用同一 Direct3D 设备的QRhi 实例。这可以通过将QRhiD3D12NativeHandles 的指针传递给QRhi::create() 来实现。QRhi 不会接管任何外部对象的所有权。
有时,例如在将QRhi 与 OpenXR 结合使用时,用户可能希望指定要使用的适配器,并可选地指定要在设备上请求的功能级别,同时将设备创建任务交由QRhi 处理。这可以通过将设备指针设置为 null,同时指定适配器的 LUID 和功能级别来实现。
此外,还可以通过将commandQueue 设置为非空值来指定ID3D12CommandQueue。
成员变量文档
bool QRhiD3D12InitParams::enableDebugLayer
当设置为 true 时,如果已安装且可用,则启用调试层。默认值为 false。
来自调试层的消息将通过 `qDebug` 输出,除非该调试层版本过旧而不支持消息回调,在这种情况下,消息将仅发送到调试输出。
© 2026 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.