[Mesa-dev] [PATCH 18/22] nir/spirv: handle SpvStorageClassCrossWorkgroup
Karol Herbst
kherbst at redhat.com
Tue Nov 13 15:48:22 UTC 2018
Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
src/compiler/nir/nir.c | 4 ++++
src/compiler/nir/nir.h | 1 +
src/compiler/nir/nir_print.c | 2 ++
src/compiler/spirv/vtn_private.h | 1 +
src/compiler/spirv/vtn_variables.c | 4 ++++
5 files changed, 12 insertions(+)
diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 27f5d1b7bca..ca258b7c80e 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -129,6 +129,10 @@ nir_shader_add_variable(nir_shader *shader, nir_variable *var)
assert(!"nir_shader_add_variable cannot be used for local variables");
break;
+ case nir_var_global:
+ assert(!"nir_shader_add_variable cannot be used for global memory");
+ break;
+
case nir_var_private:
exec_list_push_tail(&shader->globals, &var->node);
break;
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h
index 78f3204d3e2..35f2ec02c31 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -102,6 +102,7 @@ typedef enum {
nir_var_shader_storage = (1 << 5),
nir_var_system_value = (1 << 6),
nir_var_shared = (1 << 8),
+ nir_var_global = (1 << 9),
nir_var_all = ~0,
} nir_variable_mode;
diff --git a/src/compiler/nir/nir_print.c b/src/compiler/nir/nir_print.c
index 88f91087134..2fb041039c6 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -420,6 +420,8 @@ get_variable_mode_str(nir_variable_mode mode, bool want_local_global_mode)
return want_local_global_mode ? "private" : "";
case nir_var_local:
return want_local_global_mode ? "local" : "";
+ case nir_var_global:
+ return want_local_global_mode ? "global" : "";
default:
return "";
}
diff --git a/src/compiler/spirv/vtn_private.h b/src/compiler/spirv/vtn_private.h
index 86f98083f58..4dec2b66ff0 100644
--- a/src/compiler/spirv/vtn_private.h
+++ b/src/compiler/spirv/vtn_private.h
@@ -424,6 +424,7 @@ enum vtn_variable_mode {
vtn_variable_mode_ssbo,
vtn_variable_mode_push_constant,
vtn_variable_mode_workgroup,
+ vtn_variable_mode_cross_workgroup,
vtn_variable_mode_input,
vtn_variable_mode_output,
};
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 5738941ffb6..7896e58f7e5 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1572,6 +1572,9 @@ vtn_storage_class_to_mode(struct vtn_builder *b,
nir_mode = nir_var_uniform;
break;
case SpvStorageClassCrossWorkgroup:
+ mode = vtn_variable_mode_cross_workgroup;
+ nir_mode = nir_var_global;
+ break;
case SpvStorageClassGeneric:
default:
vtn_fail("Unhandled variable storage class");
@@ -1830,6 +1833,7 @@ vtn_create_variable(struct vtn_builder *b, struct vtn_value *val,
case vtn_variable_mode_ubo:
case vtn_variable_mode_ssbo:
case vtn_variable_mode_push_constant:
+ case vtn_variable_mode_cross_workgroup:
/* These don't need actual variables. */
break;
}
--
2.19.1
More information about the mesa-dev
mailing list