nir/propagate_invariant: Skip unknown vars
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 13 Dec 2018 20:06:48 +0000 (14:06 -0600)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 18 Dec 2018 19:13:28 +0000 (13:13 -0600)
If we can't find the variable from the deref, just assume it isn't
invariant and continue on.  This can happen if, for instance, we're
writing to a deref that points into an SSBO.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/compiler/nir/nir_propagate_invariant.c

index eb858f50f038f07ceb97500946555a2c2a7bb287..7e253492ba853d229da1369e13fde5b70c197c3d 100644 (file)
@@ -71,7 +71,7 @@ add_var(nir_variable *var, struct set *invariants)
 static bool
 var_is_invariant(nir_variable *var, struct set * invariants)
 {
-   return var->data.invariant || _mesa_set_search(invariants, var);
+   return var && (var->data.invariant || _mesa_set_search(invariants, var));
 }
 
 static void