nir: Handle barriers with more granularity in combine_stores
authorJason Ekstrand <jason@jlekstrand.net>
Tue, 7 Jan 2020 20:13:43 +0000 (14:13 -0600)
committerMarge Bot <eric+marge@anholt.net>
Mon, 13 Jan 2020 17:23:46 +0000 (17:23 +0000)
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3307>

src/compiler/nir/nir_opt_combine_stores.c

index c59f3ed99365dbab48e1d7717efb21f6d61db34c..6bd2c5349716f8dca221e87a7b0f9e95c1d01130 100644 (file)
@@ -306,16 +306,20 @@ combine_stores_block(struct combine_stores_state *state, nir_block *block)
       case nir_intrinsic_barrier:
       case nir_intrinsic_group_memory_barrier:
       case nir_intrinsic_memory_barrier:
-      case nir_intrinsic_memory_barrier_atomic_counter:
-      case nir_intrinsic_memory_barrier_buffer:
-      case nir_intrinsic_memory_barrier_image:
-      case nir_intrinsic_memory_barrier_shared:
-         /* TODO: Be more granular depending on the barrier. */
          combine_stores_with_modes(state, nir_var_shader_out |
                                               nir_var_mem_ssbo |
                                               nir_var_mem_shared);
          break;
 
+      case nir_intrinsic_memory_barrier_atomic_counter:
+      case nir_intrinsic_memory_barrier_buffer:
+         combine_stores_with_modes(state, nir_var_mem_ssbo);
+         break;
+
+      case nir_intrinsic_memory_barrier_shared:
+         combine_stores_with_modes(state, nir_var_mem_shared);
+         break;
+
       case nir_intrinsic_scoped_memory_barrier:
          if (nir_intrinsic_memory_semantics(intrin) & NIR_MEMORY_RELEASE) {
             combine_stores_with_modes(state,