I am back and I have another release for you all!
We finally have Vulkan support now in FPL and a much cleaner video backend architecture ;-)
Also i added seamless resize support for windows using fibers. In addition i fixed lots of bugs, updated a few demos and more.
As usual, the release is tagged as "0.9.7-beta" and the documentation are updated.
To get the release I recommend cloning the repo (https://github.com/f1nalspace/final_game_tech) and build the demos.
Vulkan support:
After a very long fight, FPL now officially supports Vulkan.
Initially i wanted just to add a function for creating the Surface, but i found a much cleaner way which fits FPL better:
- Pass in your existing VkInstance to the fplSettings or let FPL create the VkInstance for you
- Call fplPlatformInit() and the VkSurfaceKHR is created
- Use fplGetVideoSurface() to get the VkInstance and the VkSurfaceKHR
- After that the normal Vulkan process continues: Physical-Device, Logical-Device, Swap-Chain, etc.
The full process looks like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | fplSettings settings = fplMakeDefaultSettings(); settings.video.backend = fplVideoBackendType_Vulkan; fplVulkanSettings *vulkanSettings = &settings.graphics.vulkan; // Create an instance vulkanSettings->apiVersion = fplStructInit(fplVersionInfo, "1.1.0", "1", "1", "0"); vulkanSettings->appName = "My app"; vulkanSettings->appVersion = fplStructInit(fplVersionInfo, "1.0.0", "1", "0", "0"); vulkanSettings->engineName = "My engine"; vulkanSettings->engineVersion = fplStructInit(fplVersionInfo, "1.0.0", "1", "0", "0"); vulkanSettings->validationLayerMode = fplVulkanValidationLayerMode_Logging; // or pass in an existing instance vulkanSettings->instanceHandle = yourVulkanInstance; if (fplPlatformInit(fplInitFlags_All, &settings)) { const fplVideoSurface *surface = fplGetVideoSurface(); VkInstance instanceHandle = surface->vulkan.instance; VkSurfaceKHR surfaceHandle = surface->vulkan.surfaceKHR; // ... continue with the massive initialization of Vulkan.... Physical-Device, Logical-Device, Swap-Chain, etc. fplPlatformRelease(); } |
One thing which held me up a lot, was a crash in X11 when XCloseDisplay() was called.
You dont want to destroy the VkInstance or unload the Vulkan Library, while a X11 window is still active!
New demo: FPL_Vulkan
To test the new Vulkan backend, i added a new demo which initializes Vulkan and renders a blue window to the screen. Ya i know, its not much - but it will be improved a lot!
So if you want to play around with Vulkan, you can compile and run the demo.
- > It would be nice, to get some feedback for that. Does it work? Compile errors?
Seamless window resize on Win32
This version of FPL uses fibers for handling window messages now, but only when fplPollEvents() is used instead of fplPollEvent()!
The advantage of that is, if you resize your window, all video backends will resize properly - without locking the window.
In the future fplPollEvent() should use fibers as well, but this function only polls one event from the OS and therefore the fiber polling for all events wont work here :-(
If someone have an idea, how to translate the fiber event handling technique to a single event polling, please contact me!
Console handling
In the previous releases of FPL, the console is created after the platform has been initialized - which is bad, if you log the initialization to the console.
Therefore i changed that now, that a console window will always be created before main() is called, but is hidden when fplInitFlags_Console is not set.
This way i can have a console to print stuff without requiring to initialize the platform, which is nice.
Of course if the console is fully disabled (FPL_APPTYPE_WINDOW) then even before main() no console is open.
Future
For the next version i will simplify a few things (Fullscreen-Support) and hopefully implement the rest of the X11 methods which are missing (Styles, Clipboard, Cursor). Also i want to get more into linux, to fix the lock-to-device /dev/input/js0 problem.
In addition i want to improve all the demos which renders fonts, because i have 4 different font renderers and want to merge it down to just one.
See full project log for more details: https://github.com/f1nalspace/final_game_tech/projects/5
Full changelog
## v0.9.7-beta
### Short
- Added Vulkan support
- Added seamless window resizing support for Win32
- Added query functions for accessing video backend handles
- Improved video system stability
- Improved console window handling for Win32
- Fixed some major & minor bugs
### Detail
- New: Added structs fplVideoRequirements, fplVideoRequirementsVulkan
- New: Added function fplGetVideoRequirements() to query any requirements for a particular video backend
- New: Added macro fplAssertPtr() for simply (exp != fpl_null) assertions
- New: Added typedef fplVulkanValidationLayerCallback
- New: Added enums fplVulkanValidationLayerMode, fplVulkanValidationSeverity
- New: Added struct fplVulkanSettings
- New: Added structs fplVideoWindow, fplVideoWindowWin32, fplVideoWindowX11
- New: Added structs fplVideoSurface, fplVideoSurfaceOpenGL, fplVideoSurfaceVulkan
- New: Added function fplGetVideoSurface() for query the current @ref fplVideoSurface
- New[#48]: Added function fplGetVideoProcedure() for query functions from the active video backend
- New[#18]: [Win32] Support for message proc fibers to support seamless window resize -> works only with fplPollEvents()
- New[#105]: [Win32] Added support for creating and using a console in addition to a window
- New[#31]: [Win32] Added support for Vulkan
- New[#32]: [X11] Added support for Vulkan
- Changed: Changed video system to use jump tables instead, to support more backends in the future
- Changed: Added field @ref fplVulkanSettings to @ref fplGraphicsApiSettings
- Changed[#116]: AudioDriver/VideoDriver renamed to AudioBackend/VideoBackend
- Changed[#98]: [Win32] Use YieldProcessor instead of SwitchToThread for fplThreadYield()
- Changed[#111]: [Win32] Use SetConsoleTitle with @ref fplConsoleSettings.title
- Changed[#113]: [Win32] Properly show window on initialize (Foreground, Focus)
- Fixed[#109]: fplS32ToString is not working anymore
- Fixed[#121]: fplMutexHandle isValid flag was never working properly
- Fixed[#122]: Compile errors on Arm32/C99 for "asm volatile"
- Fixed[#123]: Compile error for wrong usage of fplStructInit in fplCPUID() for non-x86 architectures
- Fixed[#110]: [Win32] Erasing of background when no video driver hides window always
- Fixed[#114]: [Win32] Console window does not appear at the very first