These opcodes don't care about src/dst type, only src/dst size. Signed-off-by: Rob Clark <robdcl...@gmail.com> --- src/compiler/spirv/vtn_alu.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/compiler/spirv/vtn_alu.c b/src/compiler/spirv/vtn_alu.c index f0b69b38f83..1ca1f951200 100644 --- a/src/compiler/spirv/vtn_alu.c +++ b/src/compiler/spirv/vtn_alu.c @@ -349,11 +349,17 @@ vtn_nir_alu_op_for_spirv_opcode(struct vtn_builder *b, /* Conversions: */ case SpvOpQuantizeToF16: return nir_op_fquantize2f16; + +#define nir_type_cast(type, basetype) (nir_alu_type_get_type_size(type) | nir_type_ ## basetype) +#define typed_conversion_op(src, srctype, dst, dsttype) \ + nir_type_conversion_op(nir_type_cast(src, srctype), nir_type_cast(dst, dsttype), nir_rounding_mode_undef) + + case SpvOpConvertFToU: return typed_conversion_op(src, float, dst, uint); + case SpvOpConvertFToS: return typed_conversion_op(src, float, dst, int); + case SpvOpConvertSToF: return typed_conversion_op(src, int, dst, float); + case SpvOpConvertUToF: return typed_conversion_op(src, uint, dst, float); + case SpvOpUConvert: - case SpvOpConvertFToU: - case SpvOpConvertFToS: - case SpvOpConvertSToF: - case SpvOpConvertUToF: case SpvOpSConvert: case SpvOpFConvert: return nir_type_conversion_op(src, dst, nir_rounding_mode_undef); -- 2.14.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev