mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 13:00:09 +01:00
glsl: Optimize log(exp(x)) and exp(log(x)) into x.
Reviewed-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
parent
2c2aa35336
commit
6d7c123d6c
1 changed files with 36 additions and 0 deletions
|
|
@ -245,6 +245,42 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir)
|
|||
}
|
||||
break;
|
||||
|
||||
case ir_unop_exp:
|
||||
if (op_expr[0] == NULL)
|
||||
break;
|
||||
|
||||
if (op_expr[0]->operation == ir_unop_log) {
|
||||
return op_expr[0]->operands[0];
|
||||
}
|
||||
break;
|
||||
|
||||
case ir_unop_log:
|
||||
if (op_expr[0] == NULL)
|
||||
break;
|
||||
|
||||
if (op_expr[0]->operation == ir_unop_exp) {
|
||||
return op_expr[0]->operands[0];
|
||||
}
|
||||
break;
|
||||
|
||||
case ir_unop_exp2:
|
||||
if (op_expr[0] == NULL)
|
||||
break;
|
||||
|
||||
if (op_expr[0]->operation == ir_unop_log2) {
|
||||
return op_expr[0]->operands[0];
|
||||
}
|
||||
break;
|
||||
|
||||
case ir_unop_log2:
|
||||
if (op_expr[0] == NULL)
|
||||
break;
|
||||
|
||||
if (op_expr[0]->operation == ir_unop_exp2) {
|
||||
return op_expr[0]->operands[0];
|
||||
}
|
||||
break;
|
||||
|
||||
case ir_unop_logic_not: {
|
||||
enum ir_expression_operation new_op = ir_unop_logic_not;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue