aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_lower_variable_initializers.c
diff options
context:
space:
mode:
authorJason Ekstrand <jason@jlekstrand.net>2020-07-21 18:46:24 -0500
committerMarge Bot <eric+marge@anholt.net>2020-07-29 17:38:58 +0000
commitc256cd900e71a44490ed8a248ebc0c7f1abc38c5 (patch)
treed319342992ebbaf03d36c1ffe2fa2b79d3c4c632 /src/compiler/nir/nir_lower_variable_initializers.c
parent4d7e064623ea4db1e5e18e18b0bb958462054ed3 (diff)
downloadexternal_mesa3d-c256cd900e71a44490ed8a248ebc0c7f1abc38c5.tar.gz
external_mesa3d-c256cd900e71a44490ed8a248ebc0c7f1abc38c5.tar.bz2
external_mesa3d-c256cd900e71a44490ed8a248ebc0c7f1abc38c5.zip
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>
Diffstat (limited to 'src/compiler/nir/nir_lower_variable_initializers.c')
-rw-r--r--src/compiler/nir/nir_lower_variable_initializers.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_lower_variable_initializers.c b/src/compiler/nir/nir_lower_variable_initializers.c
index 3a32bbd0533..7b90a196b2d 100644
--- a/src/compiler/nir/nir_lower_variable_initializers.c
+++ b/src/compiler/nir/nir_lower_variable_initializers.c
@@ -88,6 +88,16 @@ nir_lower_variable_initializers(nir_shader *shader, nir_variable_mode modes)
{
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;