- Qt 6.8
- Qt GUI
- C++ Classes
- QtGuiPrivate
- QRhiMetalInitParams
- Qt 6.8.2 Reference Documentation

# QRhiMetalInitParams Struct

Metal specific initialization parameters. More...

Header: | `#include <rhi/qrhi.h>`
CMake: | `find_package(Qt6 REQUIRED COMPONENTS Gui)` `target_link_libraries(mytarget PRIVATE Qt6::GuiPrivate)`
qmake: | `QT += gui-private`
Since: | Qt 6.6
Inherits: | QRhiInitParams

## Detailed Description

Note: This is a RHI API with limited compatibility guarantees, see QRhi for details.

A Metal-based QRhi needs no special parameters for initialization.

     QRhiMetalInitParams params;
     rhi = QRhi::create(QRhi::Metal, &params);

Note: Metal API validation cannot be enabled programmatically by the QRhi. Instead, either run the debug build of the application in XCode, by generating a `.xcodeproj` file via `cmake -G Xcode`, or set the environment variable `METAL_DEVICE_WRAPPER_TYPE=1`. The variable needs to be set early on in the environment, perferably before starting the process; attempting to set it at QRhi creation time is not functional in practice. (too late probably)

Note: QRhiSwapChain can only target QWindow instances that have their surface type set to QSurface::MetalSurface.

#### Working with existing Metal devices

When interoperating with another graphics engine, it may be necessary to get a QRhi instance that uses the same Metal device. This can be achieved by passing a pointer to a QRhiMetalNativeHandles to QRhi::create(). The device must be set to a non-null value then. Optionally, a command queue object can be specified as well.

The QRhi does not take ownership of any of the external objects.