What does HackerNews think of MoltenVK?

MoltenVK is a Vulkan Portability implementation. It layers a subset of the high-performance, industry-standard Vulkan graphics and compute API over Apple's Metal graphics framework, enabling Vulkan applications to run on macOS, iOS and tvOS.

Language: Objective-C++


Translating between rendering APIs is not really the problem. The GPU design is more different than the API is.

Khronos maintains MoltenVk though, which is as "official" as it gets: https://github.com/KhronosGroup/MoltenVK

...technically, Vulkan on Windows is also only supported via 3rd-parties (the GPU vendors), so the situation isn't actually all that different. The "Vulkan driver" is just bundled with the application on Mac instead of installed separately.

It's not made by Apple, but MoltenVK is free, open source, actively developed/maintained and works well on M1/M2 hardware. It's used by many commercial game ports to Mac/iOS devices.


With regards to Vulkan support on macOS, there’s MoltenVK [0].

> MoltenVK is a Vulkan Portability implementation. It layers a subset of the high-performance, industry-standard Vulkan graphics and compute API over Apple's Metal graphics framework, enabling Vulkan applications to run on macOS, iOS and tvOS.


[0]: https://github.com/KhronosGroup/MoltenVK

Wouldn't it make more sense for the developers to target something more universal like Vulkan and then add an abstraction layer like MoltenVK[1] to make it work on MacOS if needed?

[1]: https://github.com/KhronosGroup/MoltenVK


This is a very nice comparison for people looking to explore Vulkan...even versus native frameworks like Metal (on OSX).

P.S. I dont think OpenGL is supported on OSX anymore. However Vulkan has MoltenVK which works on OSX - https://github.com/KhronosGroup/MoltenVK MoltenVK is officially supported and is a big part of the Vulkan Portability initiative - https://www.vulkan.org/portability

MoltenVK is fully production ready. Multiple games use MoltenVK to run on OSX using Vulkan. Including the big one - DOTA 2 (https://www.gamingonlinux.com/2021/09/dota-2-to-drop-opengl-...). The bug tracker for DOTA2/Vulkan is here - https://github.com/ValveSoftware/Dota-2-Vulkan

https://www.youtube.com/watch?v=xDGQcjqpYqI (M1 macbooks running moltenvk games)

They would because it would mean more software support.

Proper support for Vulkan would not be an abstraction layer. Metal is not the language of the hardware, GPUs operate on assembly like instructions. These are not publicly documented or AFAIK exposed on Mac OS so only Apple would be capable of creating a proper Vulkan driver.

> They don't control the API - not what is in it, the direction it is going, nor when it is updated. That means they can't integrate it tightly with their OSs. Not from a tech standpoint and not from a release standpoint.

What if I told you I can transfer a file between my Mac and PC using software built into Mac OS from a standard controlled by Microsoft.

> Supporting it in MacOS would mean just having a team working for Khronos, implementing Vulkan on top of MacOS's actual graphics API, Metal, and releasing when they could.

This is like saying because Mac and Safari support HTML 5 its like the dev team is working for W3C. Khronos group is a standards organization not generally the implementer.

> Not sure who that would be because there doesn't seem to be a good enough reason for any group to do it.


Plenty of "native" Mac games can't be bothered to utilize Metal directly and just use this instead. This generally results in less than optimal performance or efficiency.

> GPU makers, even at the best of times, have never been interested, and, of course, they can look forward to zero Mac business in the near future, so that isn't going to change.

GPU makers are plenty interested because it sells GPUs and it is exactly how its done on Windows. Back when Nvidia worked on Mac OS they implemented CUDA and OpenGL on Mac.

Apple does not care about non-mobile games.

They stopped supporting OpenGL [0] and Vulkan support is a community effort [1].

[0] https://www.anandtech.com/show/12894/apple-deprecates-opengl...

[1] https://github.com/KhronosGroup/MoltenVK

edit: If you have something to add to the conversation, feel free to enlighten us. It does gets tiring discussing anything Apple around here because of the sheer bias.

Makes sense, though I'd dispute that Vulkan is "too complex". It's definitely not simple, but that's because it's a complex problem. The driver guesswork that something like OpenGL uses comes with costs, too.

Vulkan is supported pretty well on Apple through MoltenVK: https://github.com/KhronosGroup/MoltenVK

Mesa does software implementation of Vulkan, too: https://en.wikipedia.org/wiki/Mesa_(computer_graphics)

I really don't know why they do not like Vulkan or don't want to provide a compatibility layer for it.

Metal was released before Vulkan existed, and Khronos already has a compatibility layer available (https://github.com/KhronosGroup/MoltenVK) - I don’t think graphics APIs are the issue here.

I would have loved to have seen a Vulkan implementation combined with MoltenVK[1] for Metal compatibility instead of a direct Metal implementation. This means that Java will now have to maintain two separate graphics implementations.

[1] https://github.com/KhronosGroup/MoltenVK

I'd assume there's other considerations because if that were the only concern why not go with Vulkan, an industry standard?


Battery life might be a good reason

For reference:

"MoltenVK is a Vulkan Portability implementation. It layers a subset of the high-performance, industry-standard Vulkan graphics and compute API over Apple's Metal graphics framework, enabling Vulkan applications to run on iOS and macOS." [1]

[0] https://moltengl.com/moltenvk/

[1] https://github.com/KhronosGroup/MoltenVK

MoltenVK is the most prominent Vulkan to Metal translation library. Technically, it's a 1st party library, since it's the core of the Khronos Group's Vulkan SDK on mac/iOS.


Valve uses MoltenVK[1] on their own games. They have used it since 2018 for Dota 2[2], but I can't find a lot of uptake by others.

[1] https://github.com/KhronosGroup/MoltenVK [2] https://www.khronos.org/news/permalink/vulkan-support-for-do...

Vulkan (MoltenVK) does seem to be a valid option for those heavily invested or interested in porting existing OpenGL projects (I plan on evaluating it): https://github.com/KhronosGroup/MoltenVK
It's probably possible yes.

I don't know if one already exist for OpenGL, but for Vulkan there's MoltenVK: https://github.com/KhronosGroup/MoltenVK

Although not an ideal solution, MoltenVK [1] does a great job at bridging that gap

[1] https://github.com/KhronosGroup/MoltenVK

No, they only support Metal, but there is MoltenVK: https://github.com/KhronosGroup/MoltenVK
Yeah there is MoltenGL which will probably be open sourced eventually. The real future is Vulkan which is moving to replace OpenGL and for the Apple platforms there is MoltenVK [0] (Vulkan re-implemented on top of Apple's new Metal) which is open source. Magnum has an initial Vulkan backend [1], and many other engines have them or are building them as well.

0 - https://github.com/KhronosGroup/MoltenVK

1 - https://blog.magnum.graphics/announcements/2018.10/

You can use MoltenVK to run Vulkan via Metal (https://github.com/KhronosGroup/MoltenVK). Apparently performance is quite good for regular 3D rendering, compute support is officially listed, but I'm not at all sure what performance is like.

Q: Any plans for macOS support?

While Wine and Proton work on macOS, there are no plans to support the new Steam Play functionality on macOS at the moment.




I saw MoltenVK under KhronosGroup control here, which led to my confusion once more: https://github.com/KhronosGroup/MoltenVK

And yea, the messaging is confusing because of this line on their site:

> As a first deliverable from the Vulkan Portability Initiative, Khronos members Valve, LunarG, and The Brenwill Workshop have released a collection of free and open source set of tools, SDKs, and runtime libraries to enable Vulkan development on macOS and deployment on macOS and iOS platforms

Source: https://www.khronos.org/vulkan/portability-initiative

That led me to think they’re sponsoring it.

It looks like MoltenVK was created by The Brenwill Workshop.

While not the best solution, there is MoltenVK [0] which handles Metal from Vulkan code.

0: https://github.com/KhronosGroup/MoltenVK

They do make some money on Macs, and Mac software, but not nearly as much as on iOS.

Providing macOS gives a developer and designer platform for iOS. That is really important for them. So Metal being available on macOS is important for that reason. But it's also important in that the Mac platform is still important, just not nearly as important as iOS.

OpenGL doesn't really have much of a future. Everyone is moving towards the next generation frameworks. It just happens that there was a lot of uncertainty about whether OpenGL could adapt or whether there would be a successor, and during that time Apple decided to invest in developing Metal. It wasn't until a couple of years later than Vulkan was released.

In the meantime, Apple has built up quite a lot of tooling around Metal.

And it's not like it's that difficult to write cross platform apps that target the Mac. If you write against major engines, they will already have support for the different backends. If you are writing your own software, you can still target OpenGL, or you can target Vulkan and use MoltenVK to run it on macOS.

And for the next several years, people writing portable software are going to have to either just target OpenGL, for compatibility with older graphics cards, or maintain at least two backends, OpenGL and Vulkan. Given that lots of games target DirectX first, and consider any of the cross-platform frameworks a porting effort, Apple probably doesn't consider it a big loss to add one more platform that needs to be ported to.

What's going to wind up happening is more software like ANGLE (https://github.com/google/angle), MoltenVK (https://github.com/KhronosGroup/MoltenVK), and gfx-rs (https://github.com/gfx-rs/gfx and https://github.com/gfx-rs/portability, see http://gfx-rs.github.io/2018/04/09/vulkan-portability.html for details) for providing one set of abstractions on top of several different backends.