LibCore: Print error code returned by vkCreateInstance()

Good to have at least some information about instance creation failure.
This commit is contained in:
Aliaksandr Kalenik 2024-07-06 18:19:21 +02:00 committed by Tim Ledbetter
parent e1c61d654f
commit 172e080b07
Notes: sideshowbarker 2024-07-17 05:21:12 +09:00

View file

@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <AK/Format.h>
#include <AK/Vector.h>
#include <LibCore/VulkanContext.h>
@ -25,7 +26,9 @@ ErrorOr<VkInstance> create_instance(uint32_t api_version)
create_info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
create_info.pApplicationInfo = &app_info;
if (vkCreateInstance(&create_info, nullptr, &instance) != VK_SUCCESS) {
auto result = vkCreateInstance(&create_info, nullptr, &instance);
if (result != VK_SUCCESS) {
dbgln("vkCreateInstance returned {}", to_underlying(result));
return Error::from_string_view("Application instance creation failed"sv);
}