diff options
-rw-r--r-- | src/compiler/glsl/glsl_to_nir.cpp | 69 |
1 files changed, 32 insertions, 37 deletions
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 3a71afd1866..e67688c50d0 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -1464,52 +1464,47 @@ nir_visitor::visit(ir_expression *ir) case ir_unop_b2f: result = supports_ints ? nir_b2f(&b, srcs[0]) : nir_fmov(&b, srcs[0]); break; - case ir_unop_f2i: result = nir_f2i(&b, srcs[0]); break; - case ir_unop_f2u: result = nir_f2u(&b, srcs[0]); break; - case ir_unop_f2b: result = nir_f2b(&b, srcs[0]); break; - case ir_unop_i2b: result = nir_i2b(&b, srcs[0]); break; - case ir_unop_b2i: result = nir_b2i(&b, srcs[0]); break; - case ir_unop_b2i64:result = nir_b2i64(&b, srcs[0]); break; - case ir_unop_d2f: result = nir_d2f(&b, srcs[0]); break; - case ir_unop_f2d: result = nir_f2d(&b, srcs[0]); break; - case ir_unop_d2i: result = nir_d2i(&b, srcs[0]); break; - case ir_unop_d2u: result = nir_d2u(&b, srcs[0]); break; - case ir_unop_d2b: result = nir_d2b(&b, srcs[0]); break; + case ir_unop_f2i: + case ir_unop_f2u: + case ir_unop_f2b: + case ir_unop_i2b: + case ir_unop_b2i: + case ir_unop_b2i64: + case ir_unop_d2f: + case ir_unop_f2d: + case ir_unop_d2i: + case ir_unop_d2u: + case ir_unop_d2b: case ir_unop_i2d: - assert(supports_ints); - result = nir_i2d(&b, srcs[0]); - break; case ir_unop_u2d: - assert(supports_ints); - result = nir_u2d(&b, srcs[0]); - break; - case ir_unop_i642i: result = nir_i2i32(&b, srcs[0]); break; - case ir_unop_i642u: result = nir_i2u32(&b, srcs[0]); break; - case ir_unop_i642f: result = nir_i642f(&b, srcs[0]); break; - case ir_unop_i642b: result = nir_i642b(&b, srcs[0]); break; - case ir_unop_i642d: result = nir_i642d(&b, srcs[0]); break; - - case ir_unop_u642i: result = nir_u2i32(&b, srcs[0]); break; - case ir_unop_u642u: result = nir_u2u32(&b, srcs[0]); break; - case ir_unop_u642f: result = nir_u642f(&b, srcs[0]); break; - case ir_unop_u642d: result = nir_u642d(&b, srcs[0]); break; - - case ir_unop_i2i64: result = nir_i2i64(&b, srcs[0]); break; - case ir_unop_u2i64: result = nir_u2i64(&b, srcs[0]); break; + case ir_unop_i642i: + case ir_unop_i642u: + case ir_unop_i642f: + case ir_unop_i642b: + case ir_unop_i642d: + case ir_unop_u642i: + case ir_unop_u642u: + case ir_unop_u642f: + case ir_unop_u642d: + case ir_unop_i2i64: + case ir_unop_u2i64: case ir_unop_f2i64: case ir_unop_d2i64: - result = nir_f2i64(&b, srcs[0]); - break; - case ir_unop_i2u64: result = nir_i2u64(&b, srcs[0]); break; - case ir_unop_u2u64: result = nir_u2u64(&b, srcs[0]); break; + case ir_unop_i2u64: + case ir_unop_u2u64: case ir_unop_f2u64: case ir_unop_d2u64: - result = nir_f2u64(&b, srcs[0]); - break; case ir_unop_i2u: case ir_unop_u2i: case ir_unop_i642u64: - case ir_unop_u642i64: + case ir_unop_u642i64: { + 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), + srcs[0], NULL, NULL, NULL); + break; + } + case ir_unop_bitcast_i2f: case ir_unop_bitcast_f2i: case ir_unop_bitcast_u2f: |