}
+static bool
+remove_scoped_barriers_impl(nir_builder *b, nir_instr *instr, void *data)
+{
+ if (instr->type != nir_instr_type_intrinsic)
+ return false;
+ nir_intrinsic_instr *intr = nir_instr_as_intrinsic(instr);
+ if (intr->intrinsic != nir_intrinsic_scoped_barrier)
+ return false;
+ if (data) {
+ if (nir_intrinsic_memory_scope(intr) == NIR_SCOPE_WORKGROUP ||
+ nir_intrinsic_memory_scope(intr) == NIR_SCOPE_DEVICE)
+ return false;
+ }
+ nir_instr_remove(instr);
+ return true;
+}
+
+static bool
+remove_scoped_barriers(nir_shader *nir, bool is_compute)
+{
+ return nir_shader_instructions_pass(nir, remove_scoped_barriers_impl, nir_metadata_dominance, (void*)is_compute);
+}
+
static void
lvp_shader_compile_to_ir(struct lvp_pipeline *pipeline,
struct vk_shader_module *module,
free(spec_entries);
+ if (nir->info.stage != MESA_SHADER_TESS_CTRL)
+ NIR_PASS_V(nir, remove_scoped_barriers, nir->info.stage == MESA_SHADER_COMPUTE);
+
const struct nir_lower_sysvals_to_varyings_options sysvals_to_varyings = {
.frag_coord = true,
.point_coord = true,