Mesa (staging/20.0): spirv: Allow constants and NULLs in SpvOpConvertUToPtr
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Apr 27 18:08:04 UTC 2020
Module: Mesa
Branch: staging/20.0
Commit: cacb0c02681f257a385d77ac83754cdf54b090ff
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=cacb0c02681f257a385d77ac83754cdf54b090ff
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Wed Apr 22 02:50:30 2020 -0500
spirv: Allow constants and NULLs in SpvOpConvertUToPtr
We were accidentally asserting that the value had to be a vtn_ssa_value
which isn't true if it, for instance, comes from a spec constant.
Fixes: fb282a68bc46 "spirv: Implement OpConvertPtrToU and OpConvertUToPtr"
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira at intel.com>
Acked-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4675>
(cherry picked from commit 64e4297629a1c4be501b40fb3529ff11441eff99)
---
.pick_status.json | 2 +-
src/compiler/spirv/vtn_variables.c | 5 +++--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 19ffbac413a..e0b674193ff 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -1255,7 +1255,7 @@
"description": "spirv: Allow constants and NULLs in SpvOpConvertUToPtr",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "fb282a68bc46a1e28eaedb2670be241401f2b9da"
},
diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c
index 95e941c481a..42f98eb49c5 100644
--- a/src/compiler/spirv/vtn_variables.c
+++ b/src/compiler/spirv/vtn_variables.c
@@ -2751,7 +2751,7 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
case SpvOpConvertUToPtr: {
struct vtn_value *ptr_val =
vtn_push_value(b, w[2], vtn_value_type_pointer);
- struct vtn_value *u_val = vtn_value(b, w[3], vtn_value_type_ssa);
+ struct vtn_value *u_val = vtn_untyped_value(b, w[3]);
vtn_fail_if(ptr_val->type->type == NULL,
"OpConvertUToPtr can only be used on physical pointers");
@@ -2761,7 +2761,8 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
"OpConvertUToPtr can only be used to cast from a vector or "
"scalar type");
- nir_ssa_def *ptr_ssa = nir_sloppy_bitcast(&b->nb, u_val->ssa->def,
+ struct vtn_ssa_value *u_ssa = vtn_ssa_value(b, w[3]);
+ nir_ssa_def *ptr_ssa = nir_sloppy_bitcast(&b->nb, u_ssa->def,
ptr_val->type->type);
ptr_val->pointer = vtn_pointer_from_ssa(b, ptr_ssa, ptr_val->type);
vtn_foreach_decoration(b, ptr_val, ptr_decoration_cb, ptr_val->pointer);
More information about the mesa-commit
mailing list