From f6214750eb4d53296e674dd26fc668b1029a1c8b Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Tue, 26 May 2020 12:14:13 +1000 Subject: [PATCH] glsl: stop cascading errors if process_parameters() fails MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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: --- src/compiler/glsl/ast_function.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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); -- 2.30.2