Mesa (staging/20.0): glsl: stop cascading errors if process_parameters() fails

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu May 28 18:58:04 UTC 2020


Module: Mesa
Branch: staging/20.0
Commit: 1e5bbe8d09170db73588b2220cad7bd57a305a6d
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1e5bbe8d09170db73588b2220cad7bd57a305a6d

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>
(cherry picked from commit f6214750eb4d53296e674dd26fc668b1029a1c8b)

---

 .pick_status.json                  | 2 +-
 src/compiler/glsl/ast_function.cpp | 9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index f63ceac4d2f..fc2c91a4c93 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -553,7 +553,7 @@
         "description": "glsl: stop cascading errors if process_parameters() fails",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "53e4159eaaf692071bf63365eb27a16c97c9a3e5"
     },
diff --git a/src/compiler/glsl/ast_function.cpp b/src/compiler/glsl/ast_function.cpp
index 590fe15aacd..b1e1036725c 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