nir/lower_variable_initializers: Restrict the modes we lower

This is not a functional change because these are the only modes we
handle.  All others get silently ignored.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966>
diff --git a/src/compiler/nir/nir_lower_variable_initializers.c b/src/compiler/nir/nir_lower_variable_initializers.c
index 3a32bbd..7b90a19 100644
--- a/src/compiler/nir/nir_lower_variable_initializers.c
+++ b/src/compiler/nir/nir_lower_variable_initializers.c
@@ -88,6 +88,16 @@
 {
    bool progress = false;
 
+   /* Only some variables have initializers that we want to lower.  Others
+    * such as uniforms have initializers which are useful later during linking
+    * so we want to skip over those.  Restrict to only variable types where
+    * initializers make sense so that callers can use nir_var_all.
+    */
+   modes &= nir_var_shader_out |
+            nir_var_shader_temp |
+            nir_var_function_temp |
+            nir_var_system_value;
+
    nir_foreach_function(function, shader) {
       if (!function->impl)
 	 continue;