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

Author: Tapani Pälli <[email protected]>
Date:   Sat Mar 14 08:57:02 2020 +0200

glsl: set error_emitted true if type not ok for assignment

Patch changes also existing assert to not trigger when we have
error types in assignment.

v2: simplify, cleanup (Ian)

Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2629
Fixes: d1fa69ed61d ("glsl: do not attempt assignment if operand type not parsed 
correctly")
Signed-off-by: Tapani Pälli <[email protected]>
Reviewed-by: Ian Romanick <[email protected]>
Tested-by: Marge Bot 
<https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4178>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4178>
(cherry picked from commit 0847fe6e7fa6ee07420c6eed95bfee036748bc6a)

---

 .pick_status.json                | 2 +-
 src/compiler/glsl/ast_to_hir.cpp | 7 +++++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 4b6aa6079f7..589b3581dc8 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -697,7 +697,7 @@
         "description": "glsl: set error_emitted true if type not ok for 
assignment",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "d1fa69ed61d5aebeb69ce8a415c098035a953d48"
     },
diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
index 7b7f6aff62a..be567b85857 100644
--- a/src/compiler/glsl/ast_to_hir.cpp
+++ b/src/compiler/glsl/ast_to_hir.cpp
@@ -1689,8 +1689,11 @@ ast_expression::do_hir(exec_list *instructions,
 
       /* Break out if operand types were not parsed successfully. */
       if ((op[0]->type == glsl_type::error_type ||
-           op[1]->type == glsl_type::error_type))
+           op[1]->type == glsl_type::error_type)) {
+         type = glsl_type::error_type;
+         error_emitted = true;
          break;
+      }
 
       type = arithmetic_result_type(op[0], op[1],
                                     (this->oper == ast_mul_assign),
@@ -2131,7 +2134,7 @@ ast_expression::do_hir(exec_list *instructions,
    }
    }
    type = NULL; /* use result->type, not type. */
-   assert(result != NULL || !needs_rvalue);
+   assert(error_emitted || (result != NULL || !needs_rvalue));
 
    if (result && result->type->is_error() && !error_emitted)
       _mesa_glsl_error(& loc, state, "type mismatch");

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to