diff options
author | Eric Anholt <[email protected]> | 2010-05-06 15:52:05 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2010-06-24 15:05:20 -0700 |
commit | 423a75c5d607a33cb5fe76a0a9c903cccc645fa7 (patch) | |
tree | 1b16568dbae8cf4946236899a6d6120df05f48fb | |
parent | 878740bedf418e5bf42ed6d350c938d29abaaf25 (diff) |
ir_to_mesa: Add ir_unop_f2i -> OPCODE_TRUNC.
-rw-r--r-- | ir_to_mesa.cpp | 5 | ||||
-rw-r--r-- | mesa_codegen.brg | 8 |
2 files changed, 12 insertions, 1 deletions
diff --git a/ir_to_mesa.cpp b/ir_to_mesa.cpp index b28747e6a26..77a8822934e 100644 --- a/ir_to_mesa.cpp +++ b/ir_to_mesa.cpp @@ -365,9 +365,12 @@ ir_to_mesa_visitor::visit(ir_expression *ir) this->result = this->create_tree(MB_TERM_rsq_vec4, ir, op[0], op[1]); break; case ir_unop_i2f: - /* Mesa IR lacks types, ints are stored as floats. */ + /* Mesa IR lacks types, ints are stored as truncated floats. */ this->result = op[0]; break; + case ir_unop_f2i: + this->result = this->create_tree(MB_TERM_trunc_vec4, ir, op[0], NULL); + break; default: break; } diff --git a/mesa_codegen.brg b/mesa_codegen.brg index e8d499fd74e..5e7953b75c7 100644 --- a/mesa_codegen.brg +++ b/mesa_codegen.brg @@ -62,6 +62,7 @@ %term sqrt_vec4 %term rsq_vec4 %term swizzle_vec4 +%term trunc_vec4 # Each tree will produce stmt. Currently, the only production for # stmt is from an assign rule -- every statement tree from @@ -245,4 +246,11 @@ vec4: log2_vec4(vec4) 1 tree->left->src_reg); } +vec4: trunc_vec4(vec4) 1 +{ + ir_to_mesa_emit_scalar_op1(tree, OPCODE_TRUNC, + tree->dst_reg, + tree->left->src_reg); +} + %% |