diff options
author | Jonathan Marek <[email protected]> | 2018-11-12 17:00:08 -0500 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2019-01-11 19:16:11 +0000 |
commit | b27ad171158a89758662294072398745b2f5d623 (patch) | |
tree | 52d3d1fb139a027e68667bfbeeb258f362bc96ca | |
parent | d3b47e073e002a01261dacf11e04e37b812736e6 (diff) |
glsl/nir: ftrunc for native_integers=false float to int cast
out_type in the default cast case is always GLSL_TYPE_FLOAT, so we get a
mov otherwise.
Signed-off-by: Jonathan Marek <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
-rw-r--r-- | src/compiler/glsl/glsl_to_nir.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index 8a19399d890..00380f482d0 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -1643,7 +1643,11 @@ nir_visitor::visit(ir_expression *ir) result = supports_ints ? nir_b2f32(&b, srcs[0]) : nir_fmov(&b, srcs[0]); break; case ir_unop_f2i: + result = supports_ints ? nir_f2i32(&b, srcs[0]) : nir_ftrunc(&b, srcs[0]); + break; case ir_unop_f2u: + result = supports_ints ? nir_f2u32(&b, srcs[0]) : nir_ftrunc(&b, srcs[0]); + break; case ir_unop_f2b: case ir_unop_i2b: case ir_unop_b2i: |