[Mesa-dev] [PATCH 02/15] glsl: Add support for new fma built-in in ARB_gpu_shader5.

Matt Turner mattst88 at gmail.com
Thu Aug 22 16:08:22 PDT 2013


---
 src/glsl/ir.cpp                            | 1 +
 src/glsl/ir.h                              | 7 +++++++
 src/glsl/ir_validate.cpp                   | 1 +
 src/mesa/program/ir_to_mesa.cpp            | 1 +
 src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 1 +
 5 files changed, 11 insertions(+)

diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 99dceac..c6d96d8 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -515,6 +515,7 @@ static const char *const operator_strs[] = {
    "bfm",
    "ubo_load",
    "vector_extract",
+   "fma",
    "lrp",
    "bfi",
    "bitfield_extract",
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 62e3b27..b45e6cb 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -1169,6 +1169,13 @@ enum ir_expression_operation {
     */
    ir_last_binop = ir_binop_vector_extract,
 
+   /**
+    * \name Fused floating-point multiply-add, part of ARB_gpu_shader5.
+    */
+   /*@{*/
+   ir_triop_fma,
+   /*@}*/
+
    ir_triop_lrp,
 
    /**
diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp
index ce96f68..37f26fe 100644
--- a/src/glsl/ir_validate.cpp
+++ b/src/glsl/ir_validate.cpp
@@ -522,6 +522,7 @@ ir_validate::visit_leave(ir_expression *ir)
              && ir->operands[1]->type->is_integer());
       break;
 
+   case ir_triop_fma:
    case ir_triop_lrp:
       assert(ir->operands[0]->type->base_type == GLSL_TYPE_FLOAT);
       assert(ir->operands[0]->type == ir->operands[1]->type);
diff --git a/src/mesa/program/ir_to_mesa.cpp b/src/mesa/program/ir_to_mesa.cpp
index f612f41..340a449 100644
--- a/src/mesa/program/ir_to_mesa.cpp
+++ b/src/mesa/program/ir_to_mesa.cpp
@@ -1492,6 +1492,7 @@ ir_to_mesa_visitor::visit(ir_expression *ir)
 
    case ir_binop_vector_extract:
    case ir_binop_bfm:
+   case ir_triop_fma:
    case ir_triop_bfi:
    case ir_triop_bitfield_extract:
    case ir_triop_vector_insert:
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index 4e29e45..37779d4 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1972,6 +1972,7 @@ glsl_to_tgsi_visitor::visit(ir_expression *ir)
    case ir_unop_find_msb:
    case ir_unop_find_lsb:
    case ir_binop_bfm:
+   case ir_triop_fma:
    case ir_triop_bfi:
    case ir_triop_bitfield_extract:
    case ir_quadop_bitfield_insert:
-- 
1.8.3.2



More information about the mesa-dev mailing list