From: Karol Herbst Date: Tue, 15 Jan 2019 23:11:23 +0000 (+0100) Subject: nir: rename nir_var_ssbo to nir_var_mem_ssbo X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6fefd6972438054e3fb45666b6714a5c9c4859b9;p=mesa.git nir: rename nir_var_ssbo to nir_var_mem_ssbo Signed-off-by: Karol Herbst Acked-by: Jason Ekstrand Reviewed-by: Eric Anholt Reviewed-by: Kenneth Graunke Reviewed-by: Bas Nieuwenhuizen --- diff --git a/src/compiler/glsl/gl_nir_lower_atomics.c b/src/compiler/glsl/gl_nir_lower_atomics.c index e0df547416f..8bbce00e467 100644 --- a/src/compiler/glsl/gl_nir_lower_atomics.c +++ b/src/compiler/glsl/gl_nir_lower_atomics.c @@ -101,7 +101,7 @@ lower_deref_instr(nir_builder *b, nir_intrinsic_instr *instr, nir_variable *var = nir_deref_instr_get_variable(deref); if (var->data.mode != nir_var_uniform && - var->data.mode != nir_var_ssbo && + var->data.mode != nir_var_mem_ssbo && var->data.mode != nir_var_shared) return false; /* atomics passed as function arguments can't be lowered */ diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 6246c998022..d2db0f95aca 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -373,7 +373,7 @@ nir_visitor::visit(ir_variable *ir) break; case ir_var_shader_storage: - var->data.mode = nir_var_ssbo; + var->data.mode = nir_var_mem_ssbo; break; case ir_var_system_value: diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c index fa9f3fe7e49..2b9b1f7f981 100644 --- a/src/compiler/nir/nir.c +++ b/src/compiler/nir/nir.c @@ -143,7 +143,7 @@ nir_shader_add_variable(nir_shader *shader, nir_variable *var) case nir_var_uniform: case nir_var_mem_ubo: - case nir_var_ssbo: + case nir_var_mem_ssbo: exec_list_push_tail(&shader->uniforms, &var->node); break; diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h index fb264fb982b..6d4bb4e8095 100644 --- a/src/compiler/nir/nir.h +++ b/src/compiler/nir/nir.h @@ -102,7 +102,7 @@ typedef enum { nir_var_uniform = (1 << 4), nir_var_mem_ubo = (1 << 5), nir_var_system_value = (1 << 6), - nir_var_ssbo = (1 << 7), + nir_var_mem_ssbo = (1 << 7), nir_var_shared = (1 << 8), nir_var_all = ~0, } nir_variable_mode; diff --git a/src/compiler/nir/nir_lower_atomics_to_ssbo.c b/src/compiler/nir/nir_lower_atomics_to_ssbo.c index ffa03dc27f8..66040c5f7f8 100644 --- a/src/compiler/nir/nir_lower_atomics_to_ssbo.c +++ b/src/compiler/nir/nir_lower_atomics_to_ssbo.c @@ -223,7 +223,7 @@ nir_lower_atomics_to_ssbo(nir_shader *shader, unsigned ssbo_offset) snprintf(name, sizeof(name), "counter%d", var->data.binding); - ssbo = nir_variable_create(shader, nir_var_ssbo, type, name); + ssbo = nir_variable_create(shader, nir_var_mem_ssbo, type, name); ssbo->data.binding = var->data.binding; struct glsl_struct_field field = { diff --git a/src/compiler/nir/nir_lower_io.c b/src/compiler/nir/nir_lower_io.c index c118842277c..d3d2d95f375 100644 --- a/src/compiler/nir/nir_lower_io.c +++ b/src/compiler/nir/nir_lower_io.c @@ -54,7 +54,7 @@ nir_assign_var_locations(struct exec_list *var_list, unsigned *size, * UBOs have their own address spaces, so don't count them towards the * number of global uniforms */ - if (var->data.mode == nir_var_mem_ubo || var->data.mode == nir_var_ssbo) + if (var->data.mode == nir_var_mem_ubo || var->data.mode == nir_var_mem_ssbo) continue; var->data.driver_location = location; @@ -590,7 +590,7 @@ build_explicit_io_load(nir_builder *b, nir_intrinsic_instr *intrin, case nir_var_mem_ubo: op = nir_intrinsic_load_ubo; break; - case nir_var_ssbo: + case nir_var_mem_ssbo: op = nir_intrinsic_load_ssbo; break; default: @@ -628,7 +628,7 @@ build_explicit_io_store(nir_builder *b, nir_intrinsic_instr *intrin, nir_intrinsic_op op; switch (mode) { - case nir_var_ssbo: + case nir_var_mem_ssbo: op = nir_intrinsic_store_ssbo; break; default: @@ -666,7 +666,7 @@ build_explicit_io_atomic(nir_builder *b, nir_intrinsic_instr *intrin, nir_intrinsic_op op; switch (mode) { - case nir_var_ssbo: + case nir_var_mem_ssbo: switch (intrin->intrinsic) { #define OP(O) case nir_intrinsic_deref_##O: op = nir_intrinsic_ssbo_##O; break; OP(atomic_exchange) diff --git a/src/compiler/nir/nir_opt_copy_prop_vars.c b/src/compiler/nir/nir_opt_copy_prop_vars.c index dee48247549..39c3d52611a 100644 --- a/src/compiler/nir/nir_opt_copy_prop_vars.c +++ b/src/compiler/nir/nir_opt_copy_prop_vars.c @@ -135,7 +135,7 @@ gather_vars_written(struct copy_prop_var_state *state, written->modes |= nir_var_shader_out | nir_var_shader_temp | nir_var_function_temp | - nir_var_ssbo | + nir_var_mem_ssbo | nir_var_shared; continue; } @@ -148,7 +148,7 @@ gather_vars_written(struct copy_prop_var_state *state, case nir_intrinsic_barrier: case nir_intrinsic_memory_barrier: written->modes |= nir_var_shader_out | - nir_var_ssbo | + nir_var_mem_ssbo | nir_var_shared; break; @@ -626,7 +626,7 @@ copy_prop_vars_block(struct copy_prop_var_state *state, apply_barrier_for_modes(copies, nir_var_shader_out | nir_var_shader_temp | nir_var_function_temp | - nir_var_ssbo | + nir_var_mem_ssbo | nir_var_shared); continue; } @@ -639,7 +639,7 @@ copy_prop_vars_block(struct copy_prop_var_state *state, case nir_intrinsic_barrier: case nir_intrinsic_memory_barrier: apply_barrier_for_modes(copies, nir_var_shader_out | - nir_var_ssbo | + nir_var_mem_ssbo | nir_var_shared); break; diff --git a/src/compiler/nir/nir_opt_dead_write_vars.c b/src/compiler/nir/nir_opt_dead_write_vars.c index 01f3ce4a975..6c0539e492e 100644 --- a/src/compiler/nir/nir_opt_dead_write_vars.c +++ b/src/compiler/nir/nir_opt_dead_write_vars.c @@ -121,7 +121,7 @@ remove_dead_write_vars_local(void *mem_ctx, nir_block *block) clear_unused_for_modes(&unused_writes, nir_var_shader_out | nir_var_shader_temp | nir_var_function_temp | - nir_var_ssbo | + nir_var_mem_ssbo | nir_var_shared); continue; } @@ -134,7 +134,7 @@ remove_dead_write_vars_local(void *mem_ctx, nir_block *block) case nir_intrinsic_barrier: case nir_intrinsic_memory_barrier: { clear_unused_for_modes(&unused_writes, nir_var_shader_out | - nir_var_ssbo | + nir_var_mem_ssbo | nir_var_shared); break; } diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c index d9bc073b2d5..18a0f8d019a 100644 --- a/src/compiler/nir/nir_print.c +++ b/src/compiler/nir/nir_print.c @@ -417,7 +417,7 @@ get_variable_mode_str(nir_variable_mode mode, bool want_local_global_mode) return "ubo"; case nir_var_system_value: return "system"; - case nir_var_ssbo: + case nir_var_mem_ssbo: return "ssbo"; case nir_var_shared: return "shared"; @@ -507,7 +507,7 @@ print_var_decl(nir_variable *var, print_state *state) var->data.mode == nir_var_shader_out || var->data.mode == nir_var_uniform || var->data.mode == nir_var_mem_ubo || - var->data.mode == nir_var_ssbo) { + var->data.mode == nir_var_mem_ssbo) { const char *loc = NULL; char buf[4]; diff --git a/src/compiler/nir/nir_validate.c b/src/compiler/nir/nir_validate.c index 22af3b6e757..ef5156a70dd 100644 --- a/src/compiler/nir/nir_validate.c +++ b/src/compiler/nir/nir_validate.c @@ -447,7 +447,7 @@ validate_deref_instr(nir_deref_instr *instr, validate_state *state) case nir_deref_type_array: case nir_deref_type_array_wildcard: if (instr->mode == nir_var_mem_ubo || - instr->mode == nir_var_ssbo || + instr->mode == nir_var_mem_ssbo || instr->mode == nir_var_shared) { /* Shared variables and UBO/SSBOs have a bit more relaxed rules * because we need to be able to handle array derefs on vectors. diff --git a/src/compiler/nir/tests/vars_tests.cpp b/src/compiler/nir/tests/vars_tests.cpp index c94fab95c1b..774d53da62f 100644 --- a/src/compiler/nir/tests/vars_tests.cpp +++ b/src/compiler/nir/tests/vars_tests.cpp @@ -237,7 +237,7 @@ TEST_F(nir_redundant_load_vars_test, invalidate_live_load_in_the_end_of_loop) * body. */ - nir_variable *v = create_int(nir_var_ssbo, "v"); + nir_variable *v = create_int(nir_var_mem_ssbo, "v"); nir_load_var(b, v); @@ -433,7 +433,7 @@ TEST_F(nir_copy_prop_vars_test, store_store_load_different_components_in_many_bl TEST_F(nir_copy_prop_vars_test, memory_barrier_in_two_blocks) { - nir_variable **v = create_many_int(nir_var_ssbo, "v", 4); + nir_variable **v = create_many_int(nir_var_mem_ssbo, "v", 4); nir_store_var(b, v[0], nir_imm_int(b, 1), 1); nir_store_var(b, v[1], nir_imm_int(b, 2), 1); @@ -490,7 +490,7 @@ TEST_F(nir_copy_prop_vars_test, simple_store_load_in_two_blocks) TEST_F(nir_dead_write_vars_test, no_dead_writes_in_block) { - nir_variable **v = create_many_int(nir_var_ssbo, "v", 2); + nir_variable **v = create_many_int(nir_var_mem_ssbo, "v", 2); nir_store_var(b, v[0], nir_load_var(b, v[1]), 1); @@ -500,7 +500,7 @@ TEST_F(nir_dead_write_vars_test, no_dead_writes_in_block) TEST_F(nir_dead_write_vars_test, no_dead_writes_different_components_in_block) { - nir_variable **v = create_many_ivec2(nir_var_ssbo, "v", 3); + nir_variable **v = create_many_ivec2(nir_var_mem_ssbo, "v", 3); nir_store_var(b, v[0], nir_load_var(b, v[1]), 1 << 0); nir_store_var(b, v[0], nir_load_var(b, v[2]), 1 << 1); @@ -511,7 +511,7 @@ TEST_F(nir_dead_write_vars_test, no_dead_writes_different_components_in_block) TEST_F(nir_dead_write_vars_test, no_dead_writes_in_if_statement) { - nir_variable **v = create_many_int(nir_var_ssbo, "v", 6); + nir_variable **v = create_many_int(nir_var_mem_ssbo, "v", 6); nir_store_var(b, v[2], nir_load_var(b, v[0]), 1); nir_store_var(b, v[3], nir_load_var(b, v[1]), 1); @@ -531,7 +531,7 @@ TEST_F(nir_dead_write_vars_test, no_dead_writes_in_if_statement) TEST_F(nir_dead_write_vars_test, no_dead_writes_in_loop_statement) { - nir_variable **v = create_many_int(nir_var_ssbo, "v", 3); + nir_variable **v = create_many_int(nir_var_mem_ssbo, "v", 3); nir_store_var(b, v[0], nir_load_var(b, v[1]), 1); @@ -553,7 +553,7 @@ TEST_F(nir_dead_write_vars_test, no_dead_writes_in_loop_statement) TEST_F(nir_dead_write_vars_test, dead_write_in_block) { - nir_variable **v = create_many_int(nir_var_ssbo, "v", 3); + nir_variable **v = create_many_int(nir_var_mem_ssbo, "v", 3); nir_store_var(b, v[0], nir_load_var(b, v[1]), 1); nir_ssa_def *load_v2 = nir_load_var(b, v[2]); @@ -571,7 +571,7 @@ TEST_F(nir_dead_write_vars_test, dead_write_in_block) TEST_F(nir_dead_write_vars_test, dead_write_components_in_block) { - nir_variable **v = create_many_ivec2(nir_var_ssbo, "v", 3); + nir_variable **v = create_many_ivec2(nir_var_mem_ssbo, "v", 3); nir_store_var(b, v[0], nir_load_var(b, v[1]), 1 << 0); nir_ssa_def *load_v2 = nir_load_var(b, v[2]); @@ -595,7 +595,7 @@ TEST_F(nir_dead_write_vars_test, dead_write_components_in_block) TEST_F(nir_dead_write_vars_test, DISABLED_dead_write_in_two_blocks) { - nir_variable **v = create_many_int(nir_var_ssbo, "v", 3); + nir_variable **v = create_many_int(nir_var_mem_ssbo, "v", 3); nir_store_var(b, v[0], nir_load_var(b, v[1]), 1); nir_ssa_def *load_v2 = nir_load_var(b, v[2]); @@ -617,7 +617,7 @@ TEST_F(nir_dead_write_vars_test, DISABLED_dead_write_in_two_blocks) TEST_F(nir_dead_write_vars_test, DISABLED_dead_write_components_in_two_blocks) { - nir_variable **v = create_many_ivec2(nir_var_ssbo, "v", 3); + nir_variable **v = create_many_ivec2(nir_var_mem_ssbo, "v", 3); nir_store_var(b, v[0], nir_load_var(b, v[1]), 1 << 0); @@ -639,7 +639,7 @@ TEST_F(nir_dead_write_vars_test, DISABLED_dead_write_components_in_two_blocks) TEST_F(nir_dead_write_vars_test, DISABLED_dead_writes_in_if_statement) { - nir_variable **v = create_many_int(nir_var_ssbo, "v", 4); + nir_variable **v = create_many_int(nir_var_mem_ssbo, "v", 4); /* Both branches will overwrite, making the previous store dead. */ nir_store_var(b, v[0], nir_load_var(b, v[1]), 1); @@ -670,7 +670,7 @@ TEST_F(nir_dead_write_vars_test, DISABLED_dead_writes_in_if_statement) TEST_F(nir_dead_write_vars_test, DISABLED_memory_barrier_in_two_blocks) { - nir_variable **v = create_many_int(nir_var_ssbo, "v", 2); + nir_variable **v = create_many_int(nir_var_mem_ssbo, "v", 2); nir_store_var(b, v[0], nir_imm_int(b, 1), 1); nir_store_var(b, v[1], nir_imm_int(b, 2), 1); @@ -693,7 +693,7 @@ TEST_F(nir_dead_write_vars_test, DISABLED_memory_barrier_in_two_blocks) TEST_F(nir_dead_write_vars_test, DISABLED_unrelated_barrier_in_two_blocks) { - nir_variable **v = create_many_int(nir_var_ssbo, "v", 3); + nir_variable **v = create_many_int(nir_var_mem_ssbo, "v", 3); nir_variable *out = create_int(nir_var_shader_out, "out"); nir_store_var(b, out, nir_load_var(b, v[1]), 1); diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index 0ec34ccbe47..d634adbd877 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -259,7 +259,7 @@ vtn_nir_deref_pointer_dereference(struct vtn_builder *b, assert(base->mode == vtn_variable_mode_ssbo || base->mode == vtn_variable_mode_ubo); nir_variable_mode nir_mode = - base->mode == vtn_variable_mode_ssbo ? nir_var_ssbo : nir_var_mem_ubo; + base->mode == vtn_variable_mode_ssbo ? nir_var_mem_ssbo : nir_var_mem_ubo; tail = nir_build_deref_cast(&b->nb, desc, nir_mode, type->type, base->ptr_type->stride); @@ -1665,7 +1665,7 @@ vtn_storage_class_to_mode(struct vtn_builder *b, nir_mode = nir_var_mem_ubo; } else if (interface_type->buffer_block) { mode = vtn_variable_mode_ssbo; - nir_mode = nir_var_ssbo; + nir_mode = nir_var_mem_ssbo; } else { /* Default-block uniforms, coming from gl_spirv */ mode = vtn_variable_mode_uniform; @@ -1674,7 +1674,7 @@ vtn_storage_class_to_mode(struct vtn_builder *b, break; case SpvStorageClassStorageBuffer: mode = vtn_variable_mode_ssbo; - nir_mode = nir_var_ssbo; + nir_mode = nir_var_mem_ssbo; break; case SpvStorageClassUniformConstant: mode = vtn_variable_mode_uniform; diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index ab8c4486ce7..65da6384c7d 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -701,7 +701,7 @@ void si_nir_scan_shader(const struct nir_shader *nir, _mesa_set_add(ubo_set, variable->interface_type); } - if (variable->data.mode == nir_var_ssbo) { + if (variable->data.mode == nir_var_mem_ssbo) { /* TODO: make this more accurate */ info->shader_buffers_declared = u_bit_consecutive(0, SI_NUM_SHADER_BUFFERS); diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c index 4acbd1040f4..36204051c35 100644 --- a/src/intel/vulkan/anv_pipeline.c +++ b/src/intel/vulkan/anv_pipeline.c @@ -211,7 +211,7 @@ anv_shader_compile_to_nir(struct anv_device *device, NIR_PASS_V(nir, nir_remove_dead_variables, nir_var_shader_in | nir_var_shader_out | nir_var_system_value); - NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_mem_ubo | nir_var_ssbo, + NIR_PASS_V(nir, nir_lower_explicit_io, nir_var_mem_ubo | nir_var_mem_ssbo, nir_address_format_vk_index_offset); NIR_PASS_V(nir, nir_propagate_invariant); diff --git a/src/mesa/state_tracker/st_glsl_to_nir.cpp b/src/mesa/state_tracker/st_glsl_to_nir.cpp index c2a75c8bd08..d7f2e3e6eaa 100644 --- a/src/mesa/state_tracker/st_glsl_to_nir.cpp +++ b/src/mesa/state_tracker/st_glsl_to_nir.cpp @@ -253,7 +253,7 @@ st_nir_assign_uniform_locations(struct gl_context *ctx, * UBO's have their own address spaces, so don't count them towards the * number of global uniforms */ - if (uniform->data.mode == nir_var_mem_ubo || uniform->data.mode == nir_var_ssbo) + if (uniform->data.mode == nir_var_mem_ubo || uniform->data.mode == nir_var_mem_ssbo) continue; const struct glsl_type *type = glsl_without_array(uniform->type);