From: Timothy Arceri Date: Tue, 26 May 2020 02:14:13 +0000 (+1000) Subject: glsl: stop cascading errors if process_parameters() fails X-Git-Url: https://git.libre-soc.org/?p=mesa.git;a=commitdiff_plain;h=f6214750eb4d53296e674dd26fc668b1029a1c8b glsl: stop cascading errors if process_parameters() fails Generally we do not completely stop compilation as soon as we see an error, instead we continue on to attemp to find any futher errors. This means we shouldn't be checking state->error to see if any error has happened during the compilation process, doing so was causing process_parameters() to fail on completely valid functions if there was any error found in the shader previously. This then caused the valid functions not to be found because the paramlist was considered empty, resulting in the compiler spewing out misleading error messages. Here we simply add the IR error value to the param list when we have an issue with processing a parameter, this leads to much better error messaging. Fixes: 53e4159eaaf6 ("glsl: stop processing function parameters if error happened") Reviewed-by: Tapani Pälli Part-of: --- diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp index 08a200347af..b6b81bf1e14 100644 --- a/src/compiler/glsl/ast_function.cpp +++ b/src/compiler/glsl/ast_function.cpp @@ -49,9 +49,12 @@ process_parameters(exec_list *instructions, exec_list *actual_parameters, ast->set_is_lhs(true); ir_rvalue *result = ast->hir(instructions, state); - /* Error happened, bail out. */ - if (state->error) - return 0; + /* Error happened processing function parameter */ + if (!result) { + actual_parameters->push_tail(ir_rvalue::error_value(mem_ctx)); + count++; + continue; + } ir_constant *const constant = result->constant_expression_value(mem_ctx);