Add logging

This commit is contained in:
2025-01-26 22:49:15 +01:00
parent 639de20a5b
commit 55d7b8c5b5
4 changed files with 14 additions and 7 deletions

View File

@ -5,6 +5,7 @@ cc_binary(
],
deps = [
"@asl//asl",
"@asl//asl/log",
"@sdl3_windows//:sdl3",
"//hk21/vulkan_loader",
],

View File

@ -1,5 +1,6 @@
#include <asl/print.hpp>
#include <asl/buffer.hpp>
#include <asl/log/log.hpp>
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
@ -40,7 +41,7 @@ int SDL_main(int /* argc */, char* /* argv */[])
auto status = vulkan_loader::load_global(vkGetInstanceProcAddr);
if (!status.ok())
{
asl::eprint("Couldn't load global Vulkan functions: {}\n", status);
ASL_LOG_ERROR("Couldn't load global Vulkan functions: {}", status);
return 1;
}
@ -52,7 +53,7 @@ int SDL_main(int /* argc */, char* /* argv */[])
if (vk_major != 1 || vk_minor < 3)
{
asl::eprint("Incompatible Vulkan version: {}.{}\n", vk_major, vk_minor);
ASL_LOG_ERROR("Incompatible Vulkan version: {}.{}", vk_major, vk_minor);
return 1;
}
@ -81,14 +82,14 @@ int SDL_main(int /* argc */, char* /* argv */[])
VkResult res = vkCreateInstance(&instance_create_info, VK_ALLOCATOR, &instance);
if (res != VK_SUCCESS)
{
asl::eprint("Couldn't create Vulkan instance: {}\n", res);
ASL_LOG_ERROR("Couldn't create Vulkan instance: {}", res);
return 1;
}
status = vulkan_loader::load_instance(vkGetInstanceProcAddr, instance);
if (!status.ok())
{
asl::eprint("Couldn't load instance Vulkan functions: {}\n", status);
ASL_LOG_ERROR("Couldn't load instance Vulkan functions: {}", status);
return 1;
}