[Mesa-dev] [PATCH v3 4/6] spirv: Require a storage type for OpStore destinations
Jason Ekstrand
jason at jlekstrand.net
Thu Jan 4 01:34:23 UTC 2018
This rules out things such as trying to store a pointer to a local
variable.
---
src/compiler/spirv/vtn_variables.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 2b3b340..399860b 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -2009,6 +2009,10 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
struct vtn_pointer *dest = dest_val->pointer;
struct vtn_value *src_val = vtn_untyped_value(b, w[2]);
+ /* OpStore requires us to actually have a storage type */
+ vtn_fail_if(dest->type->type == NULL,
+ "Invalid destination type for OpStore");
+
vtn_fail_if(dest_val->type->deref != src_val->type,
"Value and pointer types of OpStore do not match");
--
2.5.0.400.gff86faf
More information about the mesa-dev
mailing list