Our great sponsors
-
igl
Intermediate Graphics Library (IGL) is a cross-platform library that commands the GPU. It provides a single low-level cross-platform interface on top of various graphics APIs (e.g. OpenGL, Metal and Vulkan).
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
-
InfluxDB
Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
-
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.
For an intermediate library, it doesn't seem to be actually very much backend-independent. At least the desktop sample [1] has a disappointing amount of code paths with parallel implementations for OpenGL and Vulkan, switched at compile time using "#if USE_OPENGL_BACKEND".
I guess this means that this sample will use OpenGL rather than Metal on macOS? They claim there's a Metal backend, but how would one enable that for the "Tiny" sample? By manually adding a third parallel implementation with "#elif USE_METAL_BACKEND" everywhere?
[1] https://github.com/facebook/igl/blob/main/samples/desktop/Ti...
If you're looking for something like this, Sokol is a much simpler alternative:
https://github.com/floooh/sokol
It doesn't support vulkan though, but if that's important to you you're probably much better off just using vulkan directly since it's supported on all the major platforms.
The WGPU people are still working through lock conflicts in that area. The idea with Vulkan land is that you should be able to load content while rendering is in progress. For that to be useful, all the layers above Vulkan also have to have their locking problems hammered out. Most open source game engines don't do that yet. Unreal Engine and Unity do, which is why you pay for them for your AAA title.
[1] https://raw.githubusercontent.com/BVE-Reborn/rend3/trunk/exa...
[2] https://github.com/BVE-Reborn/rend3/blob/trunk/examples/scen...
[3] https://video.hardlimit.com/w/sFPkECUxRUSxbKXRkCmjJK
Sokol also provides a solution for shader cross-compilation (https://github.com/floooh/sokol-tools/blob/master/docs/sokol...), so you only need to write your shaders once no matter if you're targeting OpenGL, Metal, or DirectX.
There are other tools you could use out there with IGL, but Sokol's solution streamlines the whole process.
You probably have already seen this, but I would take a look at libfive for inspiration
https://libfive.com/
It integrates quite easily with SFML. I took the Tiny example, removed the OpenGL branching and replaced the GLFW code with SFML.
260 LoC Vulkan / IGL / SFML example: https://github.com/eXpl0it3r/SFML-IGL
Khronos maintains MoltenVk though, which is "official" as it gets: https://github.com/KhronosGroup/MoltenVK
...technically, Vulkan on Windows is also only supported via 3rd-parties (the GPU vendors), Microsoft doesn't support Vulkan either ;)