From 18f1c9bfe854df3f3d6e3bb321eb6a56185cb43a Mon Sep 17 00:00:00 2001 From: Andre Weissflog Date: Tue, 3 Feb 2026 18:25:46 +0100 Subject: sokol_app.h vk: fix case where no suitable physical device is found --- sokol_app.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sokol_app.h b/sokol_app.h index eef6c736..560043e9 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -4432,9 +4432,9 @@ _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 pdev = 0; + VkPhysicalDevice picked_pdev = 0; for (uint32_t pdev_idx = 0; pdev_idx < physical_device_count; pdev_idx++) { - pdev = physical_devices[pdev_idx]; + const VkPhysicalDevice pdev = physical_devices[pdev_idx]; _SAPP_STRUCT(VkPhysicalDeviceProperties, dev_props); vkGetPhysicalDeviceProperties(pdev, &dev_props); if (dev_props.apiVersion < VK_API_VERSION_1_3) { @@ -4468,12 +4468,13 @@ _SOKOL_PRIVATE void _sapp_vk_pick_physical_device(void) { } // if we arrive here, found a suitable device + picked_pdev = pdev; break; } - if (0 == pdev) { + if (0 == picked_pdev) { _SAPP_PANIC(VULKAN_NO_SUITABLE_PHYSICAL_DEVICE_FOUND); } - _sapp.vk.physical_device = pdev; + _sapp.vk.physical_device = picked_pdev; SOKOL_ASSERT(_sapp.vk.physical_device); } -- cgit v1.2.3