From d0975bfc4ab766a6a0fd65d3f54a608fa5622f59 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 20 Dec 2019 13:52:06 -0800 Subject: [PATCH] nir: Drop the ssbo_offset to atomic lowering. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The arguments passed in were: - prog->info.num_ssbos - prog->nir->info.num_ssbos - arbitrary values for standalone compilers The num_ssbos should match between the prog's info and prog->nir's info until this lowering happens. Reviewed-by: Marek Olšák Part-of: --- src/compiler/nir/nir.h | 2 +- src/compiler/nir/nir_lower_atomics_to_ssbo.c | 6 ++++-- src/gallium/drivers/freedreno/ir3/ir3_cmdline.c | 2 +- src/gallium/drivers/lima/standalone/lima_compiler_cmdline.c | 2 +- src/mesa/drivers/dri/i965/brw_link.cpp | 3 +-- src/mesa/state_tracker/st_glsl_to_nir.cpp | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index 0ac3f45ccec..6f72e43cf60 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -4100,7 +4100,7 @@ typedef struct nir_lower_bitmap_options { void nir_lower_bitmap(nir_shader *shader, const nir_lower_bitmap_options *options); -bool nir_lower_atomics_to_ssbo(nir_shader *shader, unsigned ssbo_offset); +bool nir_lower_atomics_to_ssbo(nir_shader *shader); typedef enum { nir_lower_int_source_mods = 1 << 0, diff --git a/src/compiler/nir/nir_lower_atomics_to_ssbo.c b/src/compiler/nir/nir_lower_atomics_to_ssbo.c index df6f959c4b5..a72c20e5491 100644 --- a/src/compiler/nir/nir_lower_atomics_to_ssbo.c +++ b/src/compiler/nir/nir_lower_atomics_to_ssbo.c @@ -32,7 +32,8 @@ #endif /* - * Remap atomic counters to SSBOs, starting from the passed in ssbo_offset. + * Remap atomic counters to SSBOs, starting from the shader's next SSBO slot + * (info.num_ssbos). */ static bool @@ -161,8 +162,9 @@ is_atomic_uint(const struct glsl_type *type) } bool -nir_lower_atomics_to_ssbo(nir_shader *shader, unsigned ssbo_offset) +nir_lower_atomics_to_ssbo(nir_shader *shader) { + unsigned ssbo_offset = shader->info.num_ssbos; bool progress = false; nir_foreach_function(function, shader) { diff --git a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c index 271ee23a9c2..aa680a3aae6 100644 --- a/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c +++ b/src/gallium/drivers/freedreno/ir3/ir3_cmdline.c @@ -142,7 +142,7 @@ load_glsl(unsigned num_files, char* const* files, gl_shader_stage stage) NIR_PASS_V(nir, nir_lower_var_copies); nir_print_shader(nir, stdout); NIR_PASS_V(nir, gl_nir_lower_atomics, prog, true); - NIR_PASS_V(nir, nir_lower_atomics_to_ssbo, 8); + NIR_PASS_V(nir, nir_lower_atomics_to_ssbo); nir_print_shader(nir, stdout); switch (stage) { diff --git a/src/gallium/drivers/lima/standalone/lima_compiler_cmdline.c b/src/gallium/drivers/lima/standalone/lima_compiler_cmdline.c index c040d6a0657..e43dc2dc303 100644 --- a/src/gallium/drivers/lima/standalone/lima_compiler_cmdline.c +++ b/src/gallium/drivers/lima/standalone/lima_compiler_cmdline.c @@ -135,7 +135,7 @@ load_glsl(unsigned num_files, char* const* files, gl_shader_stage stage) NIR_PASS_V(nir, nir_lower_var_copies); nir_print_shader(nir, stdout); NIR_PASS_V(nir, gl_nir_lower_atomics, prog, true); - NIR_PASS_V(nir, nir_lower_atomics_to_ssbo, 8); + NIR_PASS_V(nir, nir_lower_atomics_to_ssbo); nir_print_shader(nir, stdout); switch (stage) { diff --git a/src/mesa/drivers/dri/i965/brw_link.cpp b/src/mesa/drivers/dri/i965/brw_link.cpp index c439fcbc930..67e4a36103f 100644 --- a/src/mesa/drivers/dri/i965/brw_link.cpp +++ b/src/mesa/drivers/dri/i965/brw_link.cpp @@ -332,8 +332,7 @@ brw_link_shader(struct gl_context *ctx, struct gl_shader_program *shProg) brw_shader_gather_info(prog->nir, prog); NIR_PASS_V(prog->nir, gl_nir_lower_atomics, shProg, false); - NIR_PASS_V(prog->nir, nir_lower_atomics_to_ssbo, - prog->nir->info.num_ssbos); + NIR_PASS_V(prog->nir, nir_lower_atomics_to_ssbo); nir_sweep(prog->nir); diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index fadd1b4ba81..35464c982a6 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -504,7 +504,7 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog, nir_remove_dead_variables(nir, mask); if (!st->has_hw_atomics) - NIR_PASS_V(nir, nir_lower_atomics_to_ssbo, prog->info.num_ssbos); + NIR_PASS_V(nir, nir_lower_atomics_to_ssbo); st_finalize_nir_before_variants(nir); -- 2.30.2