nir: rename nir_var_ssbo to nir_var_mem_ssbo
authorKarol Herbst <kherbst@redhat.com>
Tue, 15 Jan 2019 23:11:23 +0000 (00:11 +0100)
committerKarol Herbst <kherbst@redhat.com>
Sat, 19 Jan 2019 19:01:41 +0000 (20:01 +0100)
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
15 files changed:
src/compiler/glsl/gl_nir_lower_atomics.c
src/compiler/glsl/glsl_to_nir.cpp
src/compiler/nir/nir.c
src/compiler/nir/nir.h
src/compiler/nir/nir_lower_atomics_to_ssbo.c
src/compiler/nir/nir_lower_io.c
src/compiler/nir/nir_opt_copy_prop_vars.c
src/compiler/nir/nir_opt_dead_write_vars.c
src/compiler/nir/nir_print.c
src/compiler/nir/nir_validate.c
src/compiler/nir/tests/vars_tests.cpp
src/compiler/spirv/vtn_variables.c
src/gallium/drivers/radeonsi/si_shader_nir.c
src/intel/vulkan/anv_pipeline.c
src/mesa/state_tracker/st_glsl_to_nir.cpp

index e0df547416fd02a031d5886c69a69f2f9601c337..8bbce00e467a6f03b918d111eaba8169109e07c4 100644 (file)
@@ -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 */
 
index 6246c99802292df332cdb815ece712397919bf6f..d2db0f95aca1cf4b1b8d840aaa02a5f167b6fc80 100644 (file)
@@ -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:
index fa9f3fe7e4936b7fd825fa38c84630cc8611cc42..2b9b1f7f981ebaacfabece3adb6060852196b363 100644 (file)
@@ -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;
 
index fb264fb982b2aed76961564adc88cb3e1acca5bb..6d4bb4e8095e1e2010431c7f7c7dc854372b8b41 100644 (file)
@@ -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;
index ffa03dc27f802ef84dd263fa80882b3e3c7ccb5d..66040c5f7f88a59851f265a95f111c41cc6a6b45 100644 (file)
@@ -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 = {
index c118842277c06a718ec4586b28d04a0d628aad07..d3d2d95f37588ac94a24400415bbf3b620ef757c 100644 (file)
@@ -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)
index dee4824754918e3d64c6b685c15312aca19fd19a..39c3d52611ade716730fb55899c8d56667f6551f 100644 (file)
@@ -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;
 
index 01f3ce4a9751b3cb0ffa05e4063d471dfda99e2d..6c0539e492eac4335e81c168ca9c87c87166b2cb 100644 (file)
@@ -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;
       }
index d9bc073b2d5f60bab96fd02ee4c190cb303aa971..18a0f8d019a1c01099e033c7988974a99c79e306 100644 (file)
@@ -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];
 
index 22af3b6e75769189cf4744ee7bcb20464121a4fe..ef5156a70dd4834f3ecac1495204abe2921420ff 100644 (file)
@@ -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.
index c94fab95c1b6b68d7fb6e7a119d7c1f929fb4157..774d53da62f8f909cbbb7c6cd089f5c771f95b06 100644 (file)
@@ -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);
index 0ec34ccbe47174646276e7463976c32dbcd6d14b..d634adbd877c69c44c9f348d6c7323959b4e1179 100644 (file)
@@ -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;
index ab8c4486ce7eb0d815582811f9578ad393a4e602..65da6384c7d78e5a28242a05f7fc5223e6f88a3a 100644 (file)
@@ -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);
index 4acbd1040f42030bd5ec53bfc9dcb0bacaea24cb..36204051c35c79f2907ee74aa8a6f2df4997229a 100644 (file)
@@ -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);
index c2a75c8bd08be9770a727c22f2a13099cf1b9cc1..d7f2e3e6eaa98a201a0134f946f2d6526ace3b7a 100644 (file)
@@ -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);