[Mesa-dev] [WIP 14/25] i965/fs: Add support for ir_unop_pack_double_2x32

Topi Pohjolainen topi.pohjolainen at intel.com
Thu Oct 16 05:24:26 PDT 2014


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_fs.h                   |  2 ++
 .../drivers/dri/i965/brw_fs_channel_expressions.cpp  |  3 +++
 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp         | 20 ++++++++++++++++++++
 3 files changed, 25 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 66173fe..f7b7b24 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -547,6 +547,8 @@ public:
 
    void emit_interpolate_expression(ir_expression *ir);
 
+   void emit_pack32(ir_expression *ir);
+
    bool try_rewrite_rhs_to_dst(ir_assignment *ir,
 			       fs_reg dst,
 			       fs_reg src,
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 6b04172..748870e 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_channel_expressions.cpp
@@ -82,6 +82,7 @@ channel_expressions_predicate(ir_instruction *ir)
       case ir_unop_interpolate_at_centroid:
       case ir_binop_interpolate_at_offset:
       case ir_binop_interpolate_at_sample:
+      case ir_unop_pack_double_2x32:
          return false;
       default:
          break;
@@ -169,6 +170,7 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
       case ir_unop_interpolate_at_centroid:
       case ir_binop_interpolate_at_offset:
       case ir_binop_interpolate_at_sample:
+      case ir_unop_pack_double_2x32:
          return visit_continue;
 
       default:
@@ -448,6 +450,7 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
       unreachable("not reached: expression operates on scalars only");
 
    case ir_unop_pack_double_2x32:
+      unreachable("not reached: expression merges the input vector");
    case ir_unop_unpack_double_2x32:
    case ir_unop_frexp_sig:
    case ir_unop_frexp_exp:
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 8c13803..e5883a9 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -473,6 +473,22 @@ fs_visitor::emit_interpolate_expression(ir_expression *ir)
 }
 
 void
+fs_visitor::emit_pack32(ir_expression *ir)
+{
+   assert(ir->operands[0]->type == glsl_type::uvec2_type);
+
+   ir_rvalue *rval = ir->operands[0];
+   rval->accept(this);
+
+   fs_reg src(this->result);
+   fs_reg tmp(this, glsl_type::double_type);
+
+   emit(FS_OPCODE_PACK_DOUBLE_2x32, tmp, src, offset(src, 1));
+
+   this->result = tmp;
+}
+
+void
 fs_visitor::visit(ir_expression *ir)
 {
    unsigned int operand;
@@ -497,6 +513,10 @@ fs_visitor::visit(ir_expression *ir)
       emit_interpolate_expression(ir);
       return;
 
+   case ir_unop_pack_double_2x32:
+      emit_pack32(ir);
+      return;
+
    default:
       break;
    }
-- 
1.8.3.1



More information about the mesa-dev mailing list