[RFE] Metal API Bindings?

Started by jackd5011, September 06, 2024, 07:20:50

Previous topic - Next topic

jackd5011

Has there been any consideration to add native bindings for Metal on Apple devices?

I know we have Vulkan bindings which uses MoltenVK under the hood, but in my experience the compatibility with M2 macs isn't great and I came across a lot of issues following a standard Vulkan tutorial, and the MoltenVK docs specifically say that it doesn't have perfect compatibility with the standard Vulkan API.

So until Apple adds proper support for Vulkan (which they never would), is there any consideration for LWJGL to create Metal bindings?

spasi

Hey jackd5011,

No, LWJGL provides C bindings only. There are a few options for Metal:

1. Vulkan over MoltenVK (indirect)
2. bgfx with the Metal backend (indirect)
3. Use the Objective-C Runtime bindings to call the Metal API (direct).

The third option is what C++ wrappers do to expose Metal. Performance-wise it's equivalent to using Metal directly via Obj-C/Swift.

A final option would be writing a renderer using native Metal, wrapping it in a shared library, then use that from Java (with a custom, application-specific API).