Apple on Metal and Moltenvk

Hello. Curios over here and wanted to ask a certain question. I'm currently doing some research on Metal API and came across some real good demos that uses Metal. However, I stumbled upon A product called MoltenVK. What I heard about this it uses Metal 2 and 3 for portability for vulkan to translate vulkan code to metal code(if this is even true). I wanted your guys opinion about this moltenvk that actually uses metal. Is apple ok with this even though it uses metal api? Let me know. any opinion is fine here

Answered by endecotp in 735426022

MoltenVK is interesting. I've looked at it but never tried to deploy it.

A few years ago, we could write code using C++ and OpenGL ES and it would run on iOS, Android, on the web (using Emscripten and WebGL), and even on desktop Linux and likely Windows. I have a largish demo that does most of that. But since then there has been some unhappy divergence: iOS has deprecated OpenGL ES and invented Metal, and the replacement of ObjC with Swift has made C++ more difficult to use; Android now has Vulkan. So it is tempting to look for tools like MoltenVK that might help to re-unify the platforms.

Right now, my feeling is that the more promising technology medium-term is webgpu.h. WebGPU is a replacement for WebGL that is more "modern" like Metal and Vulkan (but is different from both), and webgpu.h is a native API for it. So you can use it, with C++, on the web (where webgpu.h is a thin wrapper over JS WebGPU), and on native platforms with a library that translates webgpu.h calls to Metal or Vulkan (e.g. Dawn). This doesn't seem to be ready to use quite yet but it's coming soon enough that it's worth considering if you're about to start on a new project.

I would be interested to know if anyone here has any experience with any of these things.

MoltenVK simply calls the Metal API in the end, there isn't any issue at all from an App Store review point of view. The main issues are that it adds an overhead over calling Metal directly, and that it might be missing some of the newer features available in Metal, but it's up to you and to what you actually needs are whether it's could work for your app or not.

I see. So apple is ok with moltenvk usage then? Because I might use it for apple products and don't want to get jn trouble or anything

Accepted Answer

MoltenVK is interesting. I've looked at it but never tried to deploy it.

A few years ago, we could write code using C++ and OpenGL ES and it would run on iOS, Android, on the web (using Emscripten and WebGL), and even on desktop Linux and likely Windows. I have a largish demo that does most of that. But since then there has been some unhappy divergence: iOS has deprecated OpenGL ES and invented Metal, and the replacement of ObjC with Swift has made C++ more difficult to use; Android now has Vulkan. So it is tempting to look for tools like MoltenVK that might help to re-unify the platforms.

Right now, my feeling is that the more promising technology medium-term is webgpu.h. WebGPU is a replacement for WebGL that is more "modern" like Metal and Vulkan (but is different from both), and webgpu.h is a native API for it. So you can use it, with C++, on the web (where webgpu.h is a thin wrapper over JS WebGPU), and on native platforms with a library that translates webgpu.h calls to Metal or Vulkan (e.g. Dawn). This doesn't seem to be ready to use quite yet but it's coming soon enough that it's worth considering if you're about to start on a new project.

I would be interested to know if anyone here has any experience with any of these things.

MoltenVK doesn't use any private API, and it's already used on both the iOS and macOS App Store. You shouldn't have any issue.

So in other words, Apple and The Metal Graphics team is ok with MoltenVK?

There is nothing weird in MoltenVK, it's just another library that calls the Metal API.

I see. So moving onto metal, some demos had objective-c and a few c++ but barely swift. Is objective-c still being used for 2022 and future uses?

So in everyone's opinion on moltenvk, what do you guys think about it?

Apple on Metal and Moltenvk
 
 
Q