Unfortunately I'm no longer maintaining this project - I've left the company that was sponsoring it, and since then they've been developing this library internally. It diverged a lot from what's currently hosted here and nobody has the time to merge these changes back.
I recommend everyone to use https://github.com/bkaradzic/bgfx instead - it's stable, reliable and has excellent documentation.
I thank everyone who was involved in developing this little library.
Sigrlinn is an abstract cross platform graphical API, that tries to make you forget about different GPU APIs and their evolution in time.
Sigrlinn is the name of a pretty Scandinavian princess, daugther of the king Sváfnir of Sváfaland, from the Helgakviða Hjörvarðssonar poem.
Here are several interesting screenshots in a clockwise order:
- Dynamic Vertex Pulling combined with GPU Driven Occlusion Culling. Warning: sample code is far from being optimal.
- GPU-driven particle system where individual particles can collide with the scene and stay on top of it persistently.
- Order independent transparency with per-pixel linked lists.
- Lionheads Mega Meshes implementation (continuous multi resolution surface). This does not include: a DCC plugin or any mesh sculpting code; streaming; texturing.
There are 2 major cross-platform problems: the APIs and the shaders. In the nearest future we will have to support 5 (!) graphics APIs: DX11, DX12, OpenGL (ES?), Metal and Vulkan, and 4 (!) shader languages: HLSL, GLSL, Metal and Vulkan shaders (GLSL? I hope so).
SGFX tries to address only the first issue by providing an extremely thin layer that connects your application code to all 5 graphics APIs and does not stand in your way. It is designed with simplicity and flexibility in mind, it is open source (MIT license), and it is extremely small and easy to integrate.
It features DX12-like interface, all API functions are inside a single header file, while implementations are in several source files (typically one source file per gfx backend). Everything is somewhere around 5 KLOC, so it is also easy to contribute new features, modify and debug the code and even replace the parts you don’t like.
This library is intented for those developers, who either have their own graphics engine, or use an open source one which may or will not be updated for some reasons. SGFX aims to simplify different platforms and different graphics API support, which in turn allows developers to focus more on the game visuals rather then fiddling with platform support and API-specific bugs.
The abstraction layer is as thin as possible, therefore it allows transparent API debugging and it makes that SGFX code will also run at roughly the same performance across different rendering backends.
The performance statement should be explained. There are 2 different groups of supported APIs: next-gen group and legacy group. The code performance is the same between different APIs from the same group, e.g. SGFX with DX12 backend will run at the same speed as SGFX with Vulkan backend.
Here is the table that shows API groups:
Next-Gen | Legacy |
---|---|
D3D12 | OpenGL |
Mantle | D3D11 |
Metal | |
Vulkan | |
GNM |
SGFX is designed with common legacy engines in mind, therefore certain decisions are made to simplify integration process. For instance, SGFX does not sort the draw calls for you, it does not ship with a custom cross-API shader language, etc.
Library complilation is also as simple, as possible: just drag and drop the source files to your solution or simply use the bundled CMake script. No extra dependencies or any additional include directories are required (except for the DX SDK, but you probably already have this).
At the current stage of development the library supports:
API | Status |
---|---|
D3D11 | Full support (starting from feature level 10.0) |
OpenGL 4.0 | Partial support (WIP) |
Apple METAL | WIP |
D3D12 | WIP |
AMD Mantle | Abandoned in favor of Vulkan |
Khronos Vulkan | WIP |
PlayStation 4 libGNM | Possible, but not planned for the nearest future |
OpenGL ES 3.0 | Possible, but not planned for the nearest future |
- It is not a game/graphics engine
- It is not a library that loads textures and 3D models
- It is not a new universal standard that covers everyone's use cases
- It is not a native graphics API - there will always be some limitations and overheads
- It is not a thing that you can easily drag-n-drop to your engine to enable fancy graphics
-
BGFX - A similar library that does the same things differently.
- It supports DX9 and above, while SGFX aims at DX10 and above. Supporting higher feature level simplifies library design and removes a lot of legacy. Use BGFX if you need to support DX9 or WindowsXP! SGFX will likely never support those.
- It strictly supports mobile platforms, while SGFX has no plans for it. This may change in the future, however.
- It adresses cross-platform shaders issue, however this is somewhat limiting. SGFX intentionally does not address this.
- It does a lot of additional work under the hood (e.g. draw call sorting). SGFX has a different puprose and different target audience, therefore it avoids doing extra work unless this is vital. SGFX assumes that users graphics engine already has draw call sorting and other important things as well.
- It ships with its own tools for shader compiling, texture compressing, etc. which are meant to be used with the library. SGFX assumes that users graphics engine already has this.
-
More similar libraries, anyone?
- BitBox, Ltd. is going to use the library in their current big project, Life is Feudal, as well, as in the future projects (that’s why it is sponsoring SGFX development!)
- Bug-Zen is using the library in one of their unannounced projects (thanks for the valuable feedback!)
- Peter Ellsum from Westwood 3D has provided lots of valuable feedback.
- Luis Anton Rebollo from BeamNG has participated in the library design and implementation.
Name | Role | Position |
---|---|---|
Kirill Bazhenov aka bazhenovc | Library developer | Lead graphics programmer at BitBox Ltd |
Peter Ellsum aka CfeHunter | Feedback | Lead graphics programmer at Westwood 3D |
Luis Anton Rebollo | Ideas and feedback | Lead graphics programmer at BeamNG |
Linda MacGill aka Methelina | Marketing and support | Technical art director at Westwood 3D |
Current library maintainer is Kirill Bazhenov, bazhenovc AT gmail DOT com.