aboutsummaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_metadata.c
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2020-05-21 21:37:33 -0500
committerMarge Bot <[email protected]>2020-06-11 05:08:12 +0000
commitb0d1f9a72ff6e1c7164dc22ff5eb3e817f245d13 (patch)
tree2b7ddf09899516dfb836a91262cd2c75b58de967 /src/compiler/nir/nir_metadata.c
parente017ee95c113b3306708f54262d614cdf7440274 (diff)
nir: Add a nir_shader_preserve_all_metadata helper
There are some passes which really work on the shader level and it's easier if we have a helper which preserves metadata on the whole shader. Reviewed-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5171>
Diffstat (limited to 'src/compiler/nir/nir_metadata.c')
-rw-r--r--src/compiler/nir/nir_metadata.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_metadata.c b/src/compiler/nir/nir_metadata.c
index e681ba34f75..6122394d8b5 100644
--- a/src/compiler/nir/nir_metadata.c
+++ b/src/compiler/nir/nir_metadata.c
@@ -59,6 +59,15 @@ nir_metadata_preserve(nir_function_impl *impl, nir_metadata preserved)
impl->valid_metadata &= preserved;
}
+void
+nir_shader_preserve_all_metadata(nir_shader *shader)
+{
+ nir_foreach_function(function, shader) {
+ if (function->impl)
+ nir_metadata_preserve(function->impl, nir_metadata_all);
+ }
+}
+
#ifndef NDEBUG
/**
* Make sure passes properly invalidate metadata (part 1).