aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Weissflog <floooh@gmail.com>2026-02-03 19:58:16 +0100
committerAndre Weissflog <floooh@gmail.com>2026-02-03 19:58:16 +0100
commit8c6e2c52c20e45a0ac051db23fc3ed8519ae95ac (patch)
tree4e852d24450301d17a3b337d92cd91e33e3910bf
parentb168233593be1fbbcd6be7f60cd39bdb32dbc6eb (diff)
parente513de7e16db9c432f8b2ffd64843170dee77314 (diff)
Merge branch 'master' into vk-swapchain-maintenance1vk-swapchain-maintenance1
-rw-r--r--CHANGELOG.md21
-rw-r--r--sokol_app.h17
2 files changed, 25 insertions, 13 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 412a748b..02789ce3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,20 @@
## Updates
+### 03-Feb-2026
+
+- sokol_gfx.h vulkan: another round of small fixes and code cleanups in the
+ vulkan backend:
+ - execution wouldn't properly fail when no suitable Vulkan device could be found
+ - minor code cleanup around creating and destroying swapchain image-views
+ - on Windows, the `SAPP_EVENTTYPE_RESIZED` event is now fired in the same place
+ as on Linux, right after recreating swapchain resources
+ - on Windows, the internal framebuffer width/height is now updated only in
+ a single place (right after recreating swapchain resources)
+ - frame time measurement was actually broken on the Windows+Vulkan combination
+ and has been fixed
+
+ PR: https://github.com/floooh/sokol/pull/1433
+
### 01-Feb-2026
- sokol_gfx.h vulkan: the frame-sync-related validation layer errors on Windows
@@ -9,8 +24,10 @@
deal with (especially a very high input-to-display lag compared to the
D3D11/DXGI backend, and moving/resizing the application window is stuttery on
NVIDIA (this is caused by the render-during-window-move/resize code waiting
- for vsync). The next step will be to port the swapchain code to `VK_KHR_swpachain_maintenance1`
- (which probably would have been a good idea right from the start).
+ for vsync). ~~The next step will be to port the swapchain code to `VK_KHR_swpachain_maintenance1`
+ (which probably would have been a good idea right from the start).~~ nvm, I didn't
+ realize how badly supported `VK_[KHR|EXT]_swapchain_maintenenace1` is actually
+ supported when I wrote that heh.
Also please keep in mind that the Vulkan backend is still deep in
'highly experimental state'.
diff --git a/sokol_app.h b/sokol_app.h
index 2be1adf6..9e1f68ce 100644
--- a/sokol_app.h
+++ b/sokol_app.h
@@ -4439,7 +4439,7 @@ _SOKOL_PRIVATE void _sapp_vk_pick_physical_device(void) {
_SAPP_VK_ZERO_COUNT_AND_ARRAY(32, const char*, ext_count, ext_names);
ext_count = _sapp_vk_required_device_extensions(ext_names, 32);
- VkPhysicalDevice suitable_pdev = 0;
+ VkPhysicalDevice picked_pdev = 0;
for (uint32_t pdev_idx = 0; pdev_idx < physical_device_count; pdev_idx++) {
const VkPhysicalDevice pdev = physical_devices[pdev_idx];
_SAPP_STRUCT(VkPhysicalDeviceProperties, dev_props);
@@ -4475,13 +4475,13 @@ _SOKOL_PRIVATE void _sapp_vk_pick_physical_device(void) {
}
// if we arrive here, found a suitable device
- suitable_pdev = pdev;
+ picked_pdev = pdev;
break;
}
- if (0 == suitable_pdev) {
+ if (0 == picked_pdev) {
_SAPP_PANIC(VULKAN_NO_SUITABLE_PHYSICAL_DEVICE_FOUND);
}
- _sapp.vk.physical_device = suitable_pdev;
+ _sapp.vk.physical_device = picked_pdev;
SOKOL_ASSERT(_sapp.vk.physical_device);
}
@@ -4991,7 +4991,6 @@ _SOKOL_PRIVATE void _sapp_x11_app_event(sapp_event_type type);
_SOKOL_PRIVATE void _sapp_win32_app_event(sapp_event_type type);
#endif
-
_SOKOL_PRIVATE void _sapp_vk_recreate_swapchain(void) {
SOKOL_ASSERT(_sapp.vk.device);
vkDeviceWaitIdle(_sapp.vk.device);
@@ -8782,7 +8781,7 @@ _SOKOL_PRIVATE bool _sapp_win32_update_dimensions(void) {
_sapp.window_width = _sapp_roundf_gzero(window_width);
_sapp.window_height = _sapp_roundf_gzero(window_height);
// NOTE: on Vulkan, updating the framebuffer dimensions and firing the resize-event
- // is entirely handled by the swapchain management code
+ // is handled entirely by the swapchain management code
#if !defined(SOKOL_VULKAN)
int fb_width = _sapp_roundf_gzero(window_width * _sapp.win32.dpi.content_scale);
int fb_height = _sapp_roundf_gzero(window_height * _sapp.win32.dpi.content_scale);
@@ -9251,11 +9250,7 @@ _SOKOL_PRIVATE void _sapp_win32_timing_measure(void) {
}
// fallback if swap model isn't "flip-discard" or GetFrameStatistics failed for another reason
_sapp_timing_measure(&_sapp.timing);
- #endif
- #if defined(SOKOL_GLCORE)
- _sapp_timing_measure(&_sapp.timing);
- #endif
- #if defined(SOKOL_NOAPI)
+ #else
_sapp_timing_measure(&_sapp.timing);
#endif
}