[Mesa-dev] [WIP 10/25] i965/fs: Double precision to single conversion support
Topi Pohjolainen
topi.pohjolainen at intel.com
Thu Oct 16 05:24:22 PDT 2014
Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp | 2 +-
src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 13 ++++++++++++-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
index bb698e3..6b04172 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
@@ -217,6 +217,7 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
case ir_unop_bitcast_f2i:
case ir_unop_bitcast_f2u:
case ir_unop_bitcast_u2f:
+ case ir_unop_d2f:
case ir_unop_i2u:
case ir_unop_u2i:
case ir_unop_f2i:
@@ -450,7 +451,6 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
case ir_unop_unpack_double_2x32:
case ir_unop_frexp_sig:
case ir_unop_frexp_exp:
- case ir_unop_d2f:
case ir_unop_f2d:
case ir_unop_d2i:
case ir_unop_i2d:
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 57cd5d4..8c13803 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -787,6 +787,18 @@ fs_visitor::visit(ir_expression *ir)
op[0].type = BRW_REGISTER_TYPE_D;
this->result = op[0];
break;
+ case ir_unop_d2f: {
+ /*
+ * Conversion from double to single precision writes 64 bits per
+ * element leaving the upper 32 bits undefined. Hence there has to be
+ * first a separate conversion followed by copy from the lower 32-bits
+ * to the final destination.
+ */
+ fs_reg tmp(this, glsl_type::double_type);
+ emit(FS_OPCODE_D2F_CONVERT, tmp, op[0]);
+ emit(FS_OPCODE_D2F_MOV_LOW_32BITS, this->result, tmp);
+ break;
+ }
case ir_unop_i2f:
case ir_unop_u2f:
case ir_unop_f2i:
@@ -1038,7 +1050,6 @@ fs_visitor::visit(ir_expression *ir)
unreachable("already handled above");
break;
- case ir_unop_d2f:
case ir_unop_f2d:
case ir_unop_d2i:
case ir_unop_i2d:
--
1.8.3.1
More information about the mesa-dev
mailing list