From f50a6517267230befe7ca5a5fbf064a5d1153f8e Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Mon, 1 Feb 2016 14:59:01 -0800 Subject: [PATCH] nir/spirv: Create integer types of correct signedness. vtn_handle_type() creates a signed type regardless of the value of the signedness flag, which usually doesn't make much of a difference except when the type is used as base sampled type of an image type, what will cause the base type of the NIR image variable to be inconsistent with its format and cause an assertion failure in the back-end (most likely only reproducible on Gen7), and may change the semantics of the image intrinsic subtly (e.g. UMIN may become IMIN). --- src/compiler/nir/spirv/spirv_to_nir.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/spirv/spirv_to_nir.c b/src/compiler/nir/spirv/spirv_to_nir.c index c002457ce12..ee39b333c1a 100644 --- a/src/compiler/nir/spirv/spirv_to_nir.c +++ b/src/compiler/nir/spirv/spirv_to_nir.c @@ -594,9 +594,11 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode, case SpvOpTypeBool: val->type->type = glsl_bool_type(); break; - case SpvOpTypeInt: - val->type->type = glsl_int_type(); + case SpvOpTypeInt: { + const bool signedness = w[3]; + val->type->type = (signedness ? glsl_int_type() : glsl_uint_type()); break; + } case SpvOpTypeFloat: val->type->type = glsl_float_type(); break; -- 2.30.2