QRhiD3D12InitParams Struct
Direct3D 12 专用初始化参数。更多
头文件 | #include <rhi/qrhi.h> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) 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 不会获取任何外部对象的所有权。
有时,例如在结合 OpenXR 使用QRhi 时,需要指定使用哪种适配器,以及在设备上请求哪种功能级别,而将设备创建留给QRhi 。这可以通过将设备指针设置为空,同时指定适配器 LUID 和功能级别来实现。
通过将commandQueue
设置为非空值,还可选择指定 ID3D12CommandQueue。
© 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.