[Mesa-dev] [PATCH 51/59] i965/fs: implement d2i and d2u

Samuel Iglesias Gonsálvez siglesias at igalia.com
Fri Apr 29 11:29:48 UTC 2016


From: Iago Toral Quiroga <itoral at igalia.com>

These need the same treatment as d2f, so generalize our d2f lowering to cover
these too.
---
 src/mesa/drivers/dri/i965/brw_fs_lower_d2f.cpp | 6 ++++--
 src/mesa/drivers/dri/i965/brw_fs_nir.cpp       | 2 ++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_lower_d2f.cpp b/src/mesa/drivers/dri/i965/brw_fs_lower_d2f.cpp
index 10ea2b2..606597b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_lower_d2f.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_lower_d2f.cpp
@@ -36,7 +36,9 @@ fs_visitor::lower_d2f()
       if (inst->opcode != BRW_OPCODE_MOV)
          continue;
 
-      if (inst->dst.type != BRW_REGISTER_TYPE_F)
+      if (inst->dst.type != BRW_REGISTER_TYPE_F &&
+          inst->dst.type != BRW_REGISTER_TYPE_D &&
+          inst->dst.type != BRW_REGISTER_TYPE_UD)
          continue;
 
       if (inst->src[0].type != BRW_REGISTER_TYPE_DF)
@@ -58,7 +60,7 @@ fs_visitor::lower_d2f()
        * a strided MOV to get the lower DWord of every Qword that has the
        * result.
        */
-      fs_reg temp = ibld.vgrf(BRW_REGISTER_TYPE_F, 2);
+      fs_reg temp = ibld.vgrf(inst->dst.type, 2);
       ibld.MOV(stride(temp, 2), inst->src[0]);
       ibld.MOV(dst, stride(temp, 2));
 
diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
index 6b1b5b9..4d8cb28 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
@@ -717,6 +717,8 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)
 
    case nir_op_f2d:
    case nir_op_d2f:
+   case nir_op_d2i:
+   case nir_op_d2u:
       inst = bld.MOV(result, op[0]);
       inst->saturate = instr->dest.saturate;
       break;
-- 
2.5.0



More information about the mesa-dev mailing list