From 3b1dd90bef13f1f59d109ddf1a625f4721d09ddd Mon Sep 17 00:00:00 2001 From: Niklas Haas <git@haasn.xyz> Date: Thu, 21 May 2020 16:08:12 +0200 Subject: [PATCH] spirv: handle shaderc internal errors properly These don't generate any errors, but the compilation status still isn't "success". Treat these as errors as well, in terms of logging. --- src/spirv_shaderc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/spirv_shaderc.c b/src/spirv_shaderc.c index 947827d6e..dd0feb1a6 100644 --- a/src/spirv_shaderc.c +++ b/src/spirv_shaderc.c @@ -105,13 +105,15 @@ static bool shaderc_compile(struct spirv_compiler *spirv, void *tactx, enum pl_log_level lev = errs ? PL_LOG_ERR : warn ? PL_LOG_INFO : PL_LOG_DEBUG; + int s = shaderc_result_get_compilation_status(res); + bool success = s == shaderc_compilation_status_success; + if (!success) + lev = PL_LOG_ERR; + const char *msg = shaderc_result_get_error_message(res); if (msg[0]) PL_MSG(spirv, lev, "shaderc output:\n%s", msg); - int s = shaderc_result_get_compilation_status(res); - bool success = s == shaderc_compilation_status_success; - static const char *results[] = { [shaderc_compilation_status_success] = "success", [shaderc_compilation_status_invalid_stage] = "invalid stage", -- GitLab