[Mesa-dev] [PATCH 06/12] nir/spirv: handle SpvStorageClassCrossWorkgroup
Karol Herbst
kherbst at redhat.com
Tue Dec 4 18:26:44 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 45c4a3e8375..7f16200015f 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 30d22fb9d7d..e9f8f15d387 100644
--- a/src/compiler/nir/nir.h
+++ b/src/compiler/nir/nir.h
@@ -103,6 +103,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 1d409b1da7b..f509c92e0cd 100644
--- a/src/compiler/nir/nir_print.c
+++ b/src/compiler/nir/nir_print.c
@@ -413,6 +413,8 @@ get_variable_mode_str(nir_variable_mode mode, bool want_local_global_mode)
return want_local_global_mode ? "private" : "";
case nir_var_function:
return want_local_global_mode ? "function" : "";
+ 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 b84ac2cf0b4..e380d8e82ff 100644
--- a/src/compiler/spirv/vtn_private.h
+++ b/src/compiler/spirv/vtn_private.h
@@ -417,6 +417,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 b911b114b70..5bf407eb8a7 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -1582,6 +1582,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");
@@ -1841,6 +1844,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.2
More information about the mesa-dev
mailing list