Vulkan, MoltenVK and Metal fun

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
User avatar
DragonJoker
In need of some credit
In need of some credit
Posts: 2
Joined: Fri Nov 29, 2019 10:42 pm

Vulkan, MoltenVK and Metal fun

Post by DragonJoker » Fri Nov 29, 2019 10:50 pm

Hi,

I've been using wxWidgets for years now, to display the outputs of my 3D engine, and I've based my scene edition tool on wxWidgets.
On Linux and Windows it works perfectly, but now that I own an iMac, I'd like to be able to port my engine on it.

I'm finishing the port of this engine from OpenGL to Vulkan, and MoltenVK is supposed to help in this way (it's an implementation of Vulkan on top of Apple's Metal API).
And here comes my problem : MoltenVK needs a Metal layer, which of course wxWidgets' wxPanel doesn't provide.

So, my question is: is it possible at all on wxWidgets, or will I need some kind of hack, to create this Metal layer ?
I've never had a look at Objective-C, hence I can't tell the feasibility of this.

Has anybody here encountered the same issues ?

User avatar
doublemax
Moderator
Moderator
Posts: 14285
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Vulkan, MoltenVK and Metal fun

Post by doublemax » Sat Nov 30, 2019 8:33 am

I'm pretty sure it's possible, although i can't tell you exactly, how ;)

With Google i found this code snippet:
https://github.com/KhronosGroup/MoltenV ... -369838674

Under OSX, wxWindow::GetHandle() returns a "NSView *", so it looks like it should be possible to call above code to make it CAMetalLayer compatible.

If you don't get a more useful response here on the form, please ask again on the wx-users Google groups where you can reach the core wx developers (this is a user forum): https://groups.google.com/forum/#!forum/wx-users
Use the source, Luke!

User avatar
DragonJoker
In need of some credit
In need of some credit
Posts: 2
Joined: Fri Nov 29, 2019 10:42 pm

Re: Vulkan, MoltenVK and Metal fun

Post by DragonJoker » Mon Dec 02, 2019 5:54 pm

It works like a charm, thanks for that, I didn't find it in my searches.

Post Reply