Mesa (master): spirv: Require a storage type for OpStore destinations

Jason Ekstrand jekstrand at kemper.freedesktop.org
Mon Jan 8 23:16:06 UTC 2018


Module: Mesa
Branch: master
Commit: 986303cb928f1de3297c3f52a8ea52971e222472
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=986303cb928f1de3297c3f52a8ea52971e222472

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Wed Jan  3 09:05:31 2018 -0800

spirv: Require a storage type for OpStore destinations

This rules out things such as trying to store a pointer to a local
variable.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>

---

 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 2b3b3405e4..399860b808 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");
 




More information about the mesa-commit mailing list