After the WWDC Announcement of deprecating OpenGL, I was a little bit upset.
The OpenGL implementation on Apple was always behind the mainstream, but it was useable. Now with the move to Metal, I had to rethink.
I found a a solution, at least for me… Vulkan from Khronos. There is a Wrapper SDK to Metal called MoltenVK. It can be downloaded at the Khronos WebPage.
And the really nice part. It is a Framework you can simply use in Elements. FxGen is the Keyword here.
What I have done for now is only import the Framework in Fire.
In the MoltenVK, is a example of a terminal app to show all Information about the device.
With the help of oxidizer it was a 10 min thing to compile it with oxygene on Cocoa.
And now the true reason for these post:
Thanks to all people on Remobjects to bring up these kind of tools. Thank you, it is amazing what you have done.
I will port the OpenGl Examples from Element to Vulkan (also the basic Examples from Khronos), (Cocoa, and Island Win and Linux), in the next weeks (I hope no more than 2).
I think it can be a nice thing for doing crossplatform with Elements.
And again, thanks for the tools.
And be fair English is not my native language.
that is really cool! can you share that project so we could make it into a sample? Also, glad to hear that FxGen worked seamlessly!
Out of curiosity: have you considered using Metal directly? or is that too low an API for what you need? (I hav no experience with it, but I’m curious how well It’d work from Elements, especially for more esoteric stuff thats not just “build cocoa code that talks to an API”, such as shaders and other stuff.
Much appreciated, thank you! this is the kind of messages that make it all worthwhile!
Out of curiosity: have you considered using Metal directly? or is that too low an API for what you need? (I hav no experience with it, but I’m curious how well It’d work from Elements, especially for more esoteric stuff thats not just “build cocoa code that talks to an API”, such as shaders and other stuff.
Metal and Vulkan are very similar, the MoltenVK is a small wrapper from Vulkan to Metal. I will use the wrapper because the cross platform possibilities. It is a little bit slower on Mac, but these way I don’t have to support different tools on the platforms.
With these way I can support Cocoa on Mac / Ios and Windows / Linux.
What I can do, is to prepare some samples for using Metal direct. Doing now 3d work with OpenGL and Co now for more than 20 years it should not be a big work (beside the learning Curve on Elements).
Hello Marc,
I have now finished (I hope) the first steps for using Metal with Oxygene.
There is a Pullrequest for the Examples from me.
But, (there is always a but…) can you look if there is a way to compile *.metal files during Build a Project (like Xcode)? At moment the shaders are compiled at runtime, it would be better to compile these at Build-Time. So I think we need a option for resources in Fire like compileShader.
Not a big deal for now, I can setup a corresponding Xcode Project, but would be nice.
I was gonna ask if we need a phase for that. will do. Do you have an Xcode sa mple project handy that I can use to look at what the build does?
BTW, I did fix that .metal files now show as text, using C++ highlighting. I think .metal has some extra keywords but I could not find a full list — do you have one?
If you download the
example from https://developer.apple.com/documentation/metal/hello_triangle
there should be all in for a Build.
if you add the .metal extension for showing as text (C++) can you do it also for .vs and .fs? These are used for OpenGL Shaders. It will make the transition easier when porting OpenglApps.
Keywords I actual know out of brain are fragment vertex
used in front of a method
like here
// Fragment function
fragment float4 fragmentShader(RasterizerData in [[stage_in]])
{
// We return the color we just set which will be written to our color attachment.
return in.color;
}
Yeah, those two I gathered; I was hoping to find a full list before i split this off from C++ and give it a separate syntax definition…
yeah, I won’t go as far as actually adjusting/doing a full parser. This uses the regular C/Objecttve-C highlighting parser, just with it’s own list of keywords.
cool, thanx!
thanx, will have a look (but probably not this week)
Not easy to find something,
But found something for Notepad++.
After a short Test it looks good.
It is a xml so I think you will find all insideNotepadPP_Shaders.xml (9.2 KB)
I can send you a new build (just compiler, not Fire) in 30 or so, to test. Adjust your project manually so the build action for the .metal file is <MetalShader Include="..."> instead of <AppResource Include="..."> (ofc next Fire will let you pick that in the UI, too)