diff options
Diffstat (limited to 'src/glsl')
-rw-r--r-- | src/glsl/ir.cpp | 1 | ||||
-rw-r--r-- | src/glsl/ir.h | 7 | ||||
-rw-r--r-- | src/glsl/ir_constant_expression.cpp | 11 | ||||
-rw-r--r-- | src/glsl/ir_validate.cpp | 1 |
4 files changed, 20 insertions, 0 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 99dceacf85f..c6d96d8da03 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 62e3b27ca92..b45e6cbd831 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_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 0a725b45bc4..bf019b95577 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -1375,6 +1375,17 @@ ir_expression::constant_expression_value(struct hash_table *variable_context) break; } + case ir_triop_fma: + assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); + assert(op[1]->type->base_type == GLSL_TYPE_FLOAT); + assert(op[2]->type->base_type == GLSL_TYPE_FLOAT); + + for (unsigned c = 0; c < components; c++) { + data.f[c] = op[0]->value.f[c] * op[1]->value.f[c] + + op[2]->value.f[c]; + } + break; + case ir_triop_lrp: { assert(op[0]->type->base_type == GLSL_TYPE_FLOAT); assert(op[1]->type->base_type == GLSL_TYPE_FLOAT); diff --git a/src/glsl/ir_validate.cpp b/src/glsl/ir_validate.cpp index ce96f6855a7..37f26febe55 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); |