From 6f16385fa1ea6ad22f70c09e7d00b92ceb262793 Mon Sep 17 00:00:00 2001 From: bjorn Date: Wed, 8 Jun 2022 23:59:36 -0700 Subject: [PATCH] Improve graphics error handling; --- src/core/gpu_vk.c | 4 ++-- src/modules/graphics/graphics.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/gpu_vk.c b/src/core/gpu_vk.c index 7ea1871a..575467e9 100644 --- a/src/core/gpu_vk.c +++ b/src/core/gpu_vk.c @@ -1352,7 +1352,7 @@ void gpu_pipeline_destroy(gpu_pipeline* pipeline) { gpu_stream* gpu_stream_begin(const char* label) { gpu_tick* tick = &state.ticks[state.tick[CPU] & TICK_MASK]; - CHECK(state.streamCount < COUNTOF(tick->streams), "Too many streams") return NULL; + CHECK(state.streamCount < COUNTOF(tick->streams), "Too many passes") return NULL; gpu_stream* stream = &tick->streams[state.streamCount]; nickname(stream->commands, VK_OBJECT_TYPE_COMMAND_BUFFER, label); @@ -2691,7 +2691,7 @@ static void nickname(void* handle, VkObjectType type, const char* name) { static bool vcheck(VkResult result, const char* message) { if (result >= 0) return true; if (!state.config.callback) return false; -#define CASE(x) case x: state.config.callback(state.config.userdata, "Vulkan error: " #x, false); break; +#define CASE(x) case x: state.config.callback(state.config.userdata, "Vulkan error: " #x, true); break; switch (result) { CASE(VK_ERROR_OUT_OF_HOST_MEMORY); CASE(VK_ERROR_OUT_OF_DEVICE_MEMORY); diff --git a/src/modules/graphics/graphics.c b/src/modules/graphics/graphics.c index 47891ee4..4832a806 100644 --- a/src/modules/graphics/graphics.c +++ b/src/modules/graphics/graphics.c @@ -2861,7 +2861,7 @@ static void checkShaderFeatures(uint32_t* features, uint32_t count) { static void onMessage(void* context, const char* message, bool severe) { if (severe) { - lovrLog(LOG_ERROR, "GPU", message); + lovrThrow("GPU error: %s", message); } else { lovrLog(LOG_DEBUG, "GPU", message); }