glsl: Remove the extra scope in gl_nir_link_uniforms.c
authorYonggang Luo <luoyonggang@gmail.com>
Wed, 28 Jun 2023 14:12:38 +0000 (22:12 +0800)
committerMarge Bot <emma+marge@anholt.net>
Thu, 29 Jun 2023 11:29:54 +0000 (11:29 +0000)
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23920>

src/compiler/glsl/gl_nir_link_uniforms.c

index 7f8ca8e..c6e0cb5 100644 (file)
@@ -518,60 +518,58 @@ add_var_use_shader(nir_shader *shader, struct hash_table *live)
    unsigned derefs_size = 0;
 
    nir_foreach_function_impl(impl, shader) {
-      {
-         nir_foreach_block(block, impl) {
-            nir_foreach_instr(instr, block) {
-               if (instr->type == nir_instr_type_intrinsic) {
-                  nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
-                  switch (intr->intrinsic) {
-                  case nir_intrinsic_atomic_counter_read_deref:
-                  case nir_intrinsic_atomic_counter_inc_deref:
-                  case nir_intrinsic_atomic_counter_pre_dec_deref:
-                  case nir_intrinsic_atomic_counter_post_dec_deref:
-                  case nir_intrinsic_atomic_counter_add_deref:
-                  case nir_intrinsic_atomic_counter_min_deref:
-                  case nir_intrinsic_atomic_counter_max_deref:
-                  case nir_intrinsic_atomic_counter_and_deref:
-                  case nir_intrinsic_atomic_counter_or_deref:
-                  case nir_intrinsic_atomic_counter_xor_deref:
-                  case nir_intrinsic_atomic_counter_exchange_deref:
-                  case nir_intrinsic_atomic_counter_comp_swap_deref:
-                  case nir_intrinsic_image_deref_load:
-                  case nir_intrinsic_image_deref_store:
-                  case nir_intrinsic_image_deref_atomic:
-                  case nir_intrinsic_image_deref_atomic_swap:
-                  case nir_intrinsic_image_deref_size:
-                  case nir_intrinsic_image_deref_samples:
-                  case nir_intrinsic_load_deref:
-                  case nir_intrinsic_store_deref:
-                     add_var_use_deref(nir_src_as_deref(intr->src[0]), live,
-                                       &derefs, &derefs_size);
-                     break;
+      nir_foreach_block(block, impl) {
+         nir_foreach_instr(instr, block) {
+            if (instr->type == nir_instr_type_intrinsic) {
+               nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
+               switch (intr->intrinsic) {
+               case nir_intrinsic_atomic_counter_read_deref:
+               case nir_intrinsic_atomic_counter_inc_deref:
+               case nir_intrinsic_atomic_counter_pre_dec_deref:
+               case nir_intrinsic_atomic_counter_post_dec_deref:
+               case nir_intrinsic_atomic_counter_add_deref:
+               case nir_intrinsic_atomic_counter_min_deref:
+               case nir_intrinsic_atomic_counter_max_deref:
+               case nir_intrinsic_atomic_counter_and_deref:
+               case nir_intrinsic_atomic_counter_or_deref:
+               case nir_intrinsic_atomic_counter_xor_deref:
+               case nir_intrinsic_atomic_counter_exchange_deref:
+               case nir_intrinsic_atomic_counter_comp_swap_deref:
+               case nir_intrinsic_image_deref_load:
+               case nir_intrinsic_image_deref_store:
+               case nir_intrinsic_image_deref_atomic:
+               case nir_intrinsic_image_deref_atomic_swap:
+               case nir_intrinsic_image_deref_size:
+               case nir_intrinsic_image_deref_samples:
+               case nir_intrinsic_load_deref:
+               case nir_intrinsic_store_deref:
+                  add_var_use_deref(nir_src_as_deref(intr->src[0]), live,
+                                    &derefs, &derefs_size);
+                  break;
 
-                  default:
-                     /* Nothing to do */
-                     break;
-                  }
-               } else if (instr->type == nir_instr_type_tex) {
-                  nir_tex_instr *tex_instr = nir_instr_as_tex(instr);
-                  int sampler_idx =
-                     nir_tex_instr_src_index(tex_instr,
-                                             nir_tex_src_sampler_deref);
-                  int texture_idx =
-                     nir_tex_instr_src_index(tex_instr,
-                                             nir_tex_src_texture_deref);
-
-                  if (sampler_idx >= 0) {
-                     nir_deref_instr *deref =
-                        nir_src_as_deref(tex_instr->src[sampler_idx].src);
-                     add_var_use_deref(deref, live, &derefs, &derefs_size);
-                  }
+               default:
+                  /* Nothing to do */
+                  break;
+               }
+            } else if (instr->type == nir_instr_type_tex) {
+               nir_tex_instr *tex_instr = nir_instr_as_tex(instr);
+               int sampler_idx =
+                  nir_tex_instr_src_index(tex_instr,
+                                          nir_tex_src_sampler_deref);
+               int texture_idx =
+                  nir_tex_instr_src_index(tex_instr,
+                                          nir_tex_src_texture_deref);
+
+               if (sampler_idx >= 0) {
+                  nir_deref_instr *deref =
+                     nir_src_as_deref(tex_instr->src[sampler_idx].src);
+                  add_var_use_deref(deref, live, &derefs, &derefs_size);
+               }
 
-                  if (texture_idx >= 0) {
-                     nir_deref_instr *deref =
-                        nir_src_as_deref(tex_instr->src[texture_idx].src);
-                     add_var_use_deref(deref, live, &derefs, &derefs_size);
-                  }
+               if (texture_idx >= 0) {
+                  nir_deref_instr *deref =
+                     nir_src_as_deref(tex_instr->src[texture_idx].src);
+                  add_var_use_deref(deref, live, &derefs, &derefs_size);
                }
             }
          }