QRhiMetalInitParams Struct
针对特定金属的初始化参数。更多内容...
| 标题: | #include <rhi/qrhi.h> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS GuiPrivate) target_link_libraries(mytarget PRIVATE Qt6::GuiPrivate) |
| qmake: | QT += gui-private |
| 自: | Qt 6.6 |
| 继承自: | QRhiInitParams |
详细说明
注意:这是一个 RHI API,兼容性保证有限,详情请参阅QRhi 。
基于 Metal 的QRhi 初始化时无需任何特殊参数。
QRhiMetalInitParams params;
rhi = QRhi::create(QRhi::Metal, ¶ms);注意: 无法通过QRhi 以编程方式启用Metal API 验证。相反,请在XCode中运行应用程序的调试版本(通过cmake -G Xcode 生成.xcodeproj 文件),或设置环境变量METAL_DEVICE_WRAPPER_TYPE=1 。该变量需在环境早期设置,最好在启动进程之前;尝试在QRhi 创建时设置该变量实际上并不可行。 (可能为时已晚)
注意: QRhiSwapChain 只能针对将表面类型设置为QSurface::MetalSurface 的QWindow 实例。
与现有 Metal 设备配合使用
在与其他图形引擎互操作时,可能需要获取一个使用同一 Metal 设备的QRhi 实例。这可以通过将QRhiMetalNativeHandles 的指针传递给QRhi::create() 来实现。此时,该设备必须设置为非空值。此外,还可以可选地指定一个命令队列对象。
QRhi 不会拥有任何外部对象的所有权。
© 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.