From 9162e2f03fba0308f889e74036c77b127fddeba5 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Sat, 28 Dec 2019 16:07:30 +0100 Subject: [PATCH] mesa/st: glsl_to_nir: don't lower atomics to SSBOs if driver supports HW atomics At least on r600 HW atomic operations are way less expensive than SSBO atomic operations. v2: use st->has_hw_atomics (Erik Anholt) v3: remove second invocation of atomic to ssbo lowering (Erik Anholt) Signed-off-by: Gert Wollny Reviewed-by: Eric Anholt Tested-by: Marge Bot Part-of: --- src/mesa/state_tracker/st_glsl_to_nir.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index 322143d1e7b..a277c0eef31 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -504,8 +504,9 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog, (nir_var_shader_in | nir_var_shader_out | nir_var_function_temp ); nir_remove_dead_variables(nir, mask); - NIR_PASS_V(nir, nir_lower_atomics_to_ssbo, - st->ctx->Const.Program[nir->info.stage].MaxAtomicBuffers); + if (!st->has_hw_atomics) + NIR_PASS_V(nir, nir_lower_atomics_to_ssbo, + st->ctx->Const.Program[nir->info.stage].MaxAtomicBuffers); st_finalize_nir_before_variants(nir); -- 2.30.2