Mesa (master): nir/vars_to_ssa: Handle missing struct members in foreach_deref_node

Timothy Arceri tarceri at kemper.freedesktop.org
Wed Jul 19 01:06:39 UTC 2017


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

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Tue Jul 18 16:50:39 2017 -0700

nir/vars_to_ssa: Handle missing struct members in foreach_deref_node

This can happen if, for instance, you have an array of structs and there
are both direct and wildcard references to the same struct and some
members only have direct or only have indirect.

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>
Cc: mesa-stable at lists.freedesktop.org

---

 src/compiler/nir/nir_lower_vars_to_ssa.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/compiler/nir/nir_lower_vars_to_ssa.c b/src/compiler/nir/nir_lower_vars_to_ssa.c
index e5a12eb971..e8cfe308d2 100644
--- a/src/compiler/nir/nir_lower_vars_to_ssa.c
+++ b/src/compiler/nir/nir_lower_vars_to_ssa.c
@@ -245,8 +245,12 @@ foreach_deref_node_worker(struct deref_node *node, nir_deref *deref,
 
       case nir_deref_type_struct: {
          nir_deref_struct *str = nir_deref_as_struct(deref->child);
-         return foreach_deref_node_worker(node->children[str->index],
-                                          deref->child, cb, state);
+         if (node->children[str->index] &&
+             !foreach_deref_node_worker(node->children[str->index],
+                                        deref->child, cb, state))
+            return false;
+
+         return true;
       }
 
       default:




More information about the mesa-commit mailing list