out_type is always GLSL_TYPE_FLOAT, so we don't get the ftrunc otherwise since there are no other conversions needed, use fmov for the other cases (there is the f2b case, but the 1-bit bool patches should fix that)
Signed-off-by: Jonathan Marek <jonat...@marek.ca> --- src/compiler/glsl/glsl_to_nir.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 22863c072f..5d1ae85924 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -1560,6 +1560,19 @@ nir_visitor::visit(ir_expression *ir) case ir_unop_u2i: case ir_unop_i642u64: case ir_unop_u642i64: { + if (!supports_ints) { + switch (ir->operation) { + case ir_unop_f2i: + case ir_unop_f2u: + result = nir_ftrunc(&b, srcs[0]); + break; + default: + result = nir_fmov(&b, srcs[0]); + break; + } + break; + } + nir_alu_type src_type = nir_get_nir_type_for_glsl_base_type(types[0]); nir_alu_type dst_type = nir_get_nir_type_for_glsl_base_type(out_type); result = nir_build_alu(&b, nir_type_conversion_op(src_type, dst_type, -- 2.17.1 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev