From 902da9ce1b01ed8ee0ac787fc7a3bc3258f7e2f4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Mon, 24 Jan 2022 18:40:52 +0000 Subject: [PATCH] make glfw init and vulkan support check fatal failure in any case --- tests/common/vkengine.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/tests/common/vkengine.c b/tests/common/vkengine.c index bc0deae..deb8fb2 100644 --- a/tests/common/vkengine.c +++ b/tests/common/vkengine.c @@ -111,13 +111,17 @@ bool instance_extension_supported (VkExtensionProperties* instanceExtProps, uint } vk_engine_t* vkengine_create (VkPhysicalDeviceType preferedGPU, VkPresentModeKHR presentMode, uint32_t width, uint32_t height) { - glfwSetErrorCallback(glfw_error_callback); + glfwSetErrorCallback(glfw_error_callback); - int res = 0; - res = glfwInit(); - assert (res==GLFW_TRUE && "glfwInit failed."); - res = glfwVulkanSupported(); - assert (res==GLFW_TRUE && "glfwVulkanSupported return false."); + if (!glfwInit()) { + perror ("glfwInit failed"); + exit(-1); + } + + if (!glfwVulkanSupported()) { + perror ("glfwVulkanSupported return false."); + exit(-1); + } uint32_t enabledExtsCount = 0, phyCount = 0; const char** gflwExts = glfwGetRequiredInstanceExtensions (&enabledExtsCount); -- 2.47.3