QRhiD3D11InitParams Struct

Direct3D 11 专用初始化参数。更多

头文件 #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
继承: QRhiInitParams

公共变量

详细描述

注意: 这是一个 RHI API,具有有限的兼容性保证,详情请参见QRhi

基于 D3D11 的QRhi 在初始化时不需要特殊参数。如果需要,可将enableDebugLayer 设置为true ,以启用 Direct3D 调试层。这在开发过程中可能有用,但在生产构建过程中应避免使用。

QRhiD3D11InitParams params;
params.enableDebugLayer = true;
rhi = QRhi::create(QRhi::D3D11, &params);

注意: QRhiSwapChain 只能与表面类型设置为QSurface::Direct3DSurfaceQWindow 实例结合使用。

与现有 Direct3D 11 设备协同工作

与其他图形引擎互操作时,可能需要获取使用相同 Direct3D 设备的QRhi 实例。这可以通过将指向QRhiD3D11NativeHandles 的指针传递给QRhi::create() 来实现。当设备被设置为非空值时,还必须指定设备上下文。QRhi 不拥有任何外部对象的所有权。

有时,例如在与 OpenXR 结合使用QRhi 时,需要指定使用哪种适配器,并可选择在设备上请求哪种功能级别,而将设备创建留给QRhi 。这可以通过将设备和上下文指针设置为空,同时指定适配器 LUID 和功能级别来实现。

注意: QRhi 只适用于即时上下文。延迟上下文不以任何方式使用。

注意: 无论使用导入的设备上下文还是QRhi 创建的设备上下文,都必须支持ID3D11DeviceContext1 接口(Direct3D 11.1)。否则初始化将失败。

成员变量文档

bool QRhiD3D11InitParams::enableDebugLayer

设置为 true 时,假设调试层可用,则会创建一个调试设备。默认值为假。

© 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.