summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/nir')
-rw-r--r--src/compiler/nir/nir.c3
-rw-r--r--src/compiler/nir/nir.h3
-rw-r--r--src/compiler/nir/nir_lower_atomics_to_ssbo.c3
-rw-r--r--src/compiler/nir/nir_lower_io.c3
-rw-r--r--src/compiler/nir/nir_opt_copy_prop_vars.c8
-rw-r--r--src/compiler/nir/nir_opt_dead_write_vars.c4
-rw-r--r--src/compiler/nir/nir_print.c9
-rw-r--r--src/compiler/nir/tests/vars_tests.cpp26
8 files changed, 31 insertions, 28 deletions
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 3c80e03a091..b0b031cde61 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -142,7 +142,8 @@ nir_shader_add_variable(nir_shader *shader, nir_variable *var)
break;
case nir_var_uniform:
- case nir_var_shader_storage:
+ case nir_var_ubo:
+ case nir_var_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 497327eaca8..e72585000d4 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -100,8 +100,9 @@ typedef enum {
nir_var_global = (1 << 2),
nir_var_local = (1 << 3),
nir_var_uniform = (1 << 4),
- nir_var_shader_storage = (1 << 5),
+ nir_var_ubo = (1 << 5),
nir_var_system_value = (1 << 6),
+ nir_var_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 cdc660981fc..d9acc5c3a79 100644
--- a/src/compiler/nir/nir_lower_atomics_to_ssbo.c
+++ b/src/compiler/nir/nir_lower_atomics_to_ssbo.c
@@ -223,8 +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_shader_storage,
- type, name);
+ ssbo = nir_variable_create(shader, nir_var_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 64424307812..2ccba8c032b 100644
--- a/src/compiler/nir/nir_lower_io.c
+++ b/src/compiler/nir/nir_lower_io.c
@@ -54,8 +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_uniform || var->data.mode == nir_var_shader_storage) &&
- var->interface_type != NULL)
+ if (var->data.mode == nir_var_ubo || var->data.mode == nir_var_ssbo)
continue;
var->data.driver_location = location;
diff --git a/src/compiler/nir/nir_opt_copy_prop_vars.c b/src/compiler/nir/nir_opt_copy_prop_vars.c
index e109814abcd..36403e87e8f 100644
--- a/src/compiler/nir/nir_opt_copy_prop_vars.c
+++ b/src/compiler/nir/nir_opt_copy_prop_vars.c
@@ -136,7 +136,7 @@ gather_vars_written(struct copy_prop_var_state *state,
written->modes |= nir_var_shader_out |
nir_var_global |
nir_var_local |
- nir_var_shader_storage |
+ nir_var_ssbo |
nir_var_shared;
continue;
}
@@ -149,7 +149,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_shader_storage |
+ nir_var_ssbo |
nir_var_shared;
break;
@@ -617,7 +617,7 @@ copy_prop_vars_block(struct copy_prop_var_state *state,
apply_barrier_for_modes(copies, nir_var_shader_out |
nir_var_global |
nir_var_local |
- nir_var_shader_storage |
+ nir_var_ssbo |
nir_var_shared);
continue;
}
@@ -630,7 +630,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_shader_storage |
+ nir_var_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 75814738d84..2ae5f78b791 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_global |
nir_var_local |
- nir_var_shader_storage |
+ nir_var_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_shader_storage |
+ nir_var_ssbo |
nir_var_shared);
break;
}
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index 5f1b547ea37..95d9bc85656 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -412,10 +412,12 @@ get_variable_mode_str(nir_variable_mode mode, bool want_local_global_mode)
return "shader_out";
case nir_var_uniform:
return "uniform";
- case nir_var_shader_storage:
- return "shader_storage";
+ case nir_var_ubo:
+ return "ubo";
case nir_var_system_value:
return "system";
+ case nir_var_ssbo:
+ return "ssbo";
case nir_var_shared:
return "shared";
case nir_var_global:
@@ -503,7 +505,8 @@ print_var_decl(nir_variable *var, print_state *state)
if (var->data.mode == nir_var_shader_in ||
var->data.mode == nir_var_shader_out ||
var->data.mode == nir_var_uniform ||
- var->data.mode == nir_var_shader_storage) {
+ var->data.mode == nir_var_ubo ||
+ var->data.mode == nir_var_ssbo) {
const char *loc = NULL;
char buf[4];
diff --git a/src/compiler/nir/tests/vars_tests.cpp b/src/compiler/nir/tests/vars_tests.cpp
index 32763d2db64..74bf5c05023 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_shader_storage, "v");
+ nir_variable *v = create_int(nir_var_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_shader_storage, "v", 4);
+ nir_variable **v = create_many_int(nir_var_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_shader_storage, "v", 2);
+ nir_variable **v = create_many_int(nir_var_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_shader_storage, "v", 3);
+ nir_variable **v = create_many_ivec2(nir_var_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_shader_storage, "v", 6);
+ nir_variable **v = create_many_int(nir_var_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_shader_storage, "v", 3);
+ nir_variable **v = create_many_int(nir_var_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_shader_storage, "v", 3);
+ nir_variable **v = create_many_int(nir_var_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_shader_storage, "v", 3);
+ nir_variable **v = create_many_ivec2(nir_var_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_shader_storage, "v", 3);
+ nir_variable **v = create_many_int(nir_var_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_shader_storage, "v", 3);
+ nir_variable **v = create_many_ivec2(nir_var_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_shader_storage, "v", 4);
+ nir_variable **v = create_many_int(nir_var_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_shader_storage, "v", 2);
+ nir_variable **v = create_many_int(nir_var_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_shader_storage, "v", 3);
+ nir_variable **v = create_many_int(nir_var_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);