Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How to have Qt interoperate with Metal (using the new Metal-cpp)?



  • I'm currently considering Qt widgets for a new project, where I would like to write my own rendering pipeline in Metal. Apple recently released bindings to use Metal from C++. I'm now trying to combine this Metal-cpp example with some of the Qt macOS examples found here.

    The problem I'm running into is that the main boundary between Qt and Metal seems to be MetalKit, which is not wrapped by the Metal-cpp library (only Foundation, Metal and QuartzCore are). There is a QuartzCore/CAMetalDrawable.hpp referencing a CAMetalLayer, which seems the way to go, but I'm unsure of how to use it with a Qt window. Could anyone show/tell me how to setup Metal-cpp such that I can render into a QWindow, or even better, into a single widget?