From: Francisco Jerez Date: Mon, 1 Feb 2016 22:59:01 +0000 (-0800) Subject: nir/spirv: Create integer types of correct signedness. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f50a6517267230befe7ca5a5fbf064a5d1153f8e;p=mesa.git 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). --- 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;