Mesa (main): intel/fs: tidy up lower of ray queries

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 19 13:25:04 UTC 2022


Module: Mesa
Branch: main
Commit: 8ef8e72aac81ba52d2e9ae1b05d74b82c993b250
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8ef8e72aac81ba52d2e9ae1b05d74b82c993b250

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Wed Apr 13 16:04:25 2022 +0300

intel/fs: tidy up lower of ray queries

We already expect a single function.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Reviewed-by: Marcin Ślusarz <marcin.slusarz at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15946>

---

 src/intel/compiler/brw_nir_lower_ray_queries.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/src/intel/compiler/brw_nir_lower_ray_queries.c b/src/intel/compiler/brw_nir_lower_ray_queries.c
index 68304feb544..6aa61a35c5b 100644
--- a/src/intel/compiler/brw_nir_lower_ray_queries.c
+++ b/src/intel/compiler/brw_nir_lower_ray_queries.c
@@ -562,29 +562,21 @@ brw_nir_lower_ray_queries(nir_shader *shader,
    assert(exec_list_length(&shader->functions) == 1);
 
    /* Find query variables */
-   nir_foreach_function(function, shader) {
-      if (!function->impl)
-         continue;
-
-      nir_foreach_block_safe(block, function->impl) {
-         nir_foreach_instr(instr, block)
-            maybe_create_brw_var(instr, &state);
-      }
+   nir_function_impl *impl = nir_shader_get_entrypoint(shader);
+   nir_foreach_block_safe(block, impl) {
+      nir_foreach_instr(instr, block)
+         maybe_create_brw_var(instr, &state);
    }
 
-   bool progress = false;
-   if (_mesa_hash_table_num_entries(state.queries) > 0) {
-      nir_foreach_function(function, shader) {
-         if (function->impl)
-            lower_ray_query_impl(function->impl, &state);
-      }
+   bool progress = _mesa_hash_table_num_entries(state.queries) > 0;
+
+   if (progress) {
+      lower_ray_query_impl(impl, &state);
 
       nir_remove_dead_derefs(shader);
       nir_remove_dead_variables(shader,
                                 nir_var_shader_temp | nir_var_function_temp,
                                 NULL);
-
-      progress = true;
    }
 
    ralloc_free(state.queries);



More information about the mesa-commit mailing list