Mesa (master): glsl: stop cascading errors if process_parameters() fails

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed May 27 00:54:59 UTC 2020


Module: Mesa
Branch: master
Commit: f6214750eb4d53296e674dd26fc668b1029a1c8b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f6214750eb4d53296e674dd26fc668b1029a1c8b

Author: Timothy Arceri <tarceri at itsqueeze.com>
Date:   Tue May 26 12:14:13 2020 +1000

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 <tapani.palli at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5205>

---

 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);



More information about the mesa-commit mailing list