[Mesa-dev] [PATCH 11/11] glsl: Optimize X / X == 1
From: Thomas Helland Shows no changes for shader-db. Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 21bf332..a49752d 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -513,6 +513,8 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) } if (is_vec_one(op_const[1])) return ir->operands[0]; + if(ir->operands[0]->equals(ir->operands[1])) + return new(mem_ctx) ir_constant(1.0f, 1); break; case ir_binop_dot: -- 2.0.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 10/11] glsl: Optimize X + neg(X) == 0 and the other way around
From: Thomas Helland Since we lower A - B to A + neg(B) on some architectures lets add a optimization for this pattern. This yields some gains in a shader-db run with extra shaders added from Team Fortress 2 and Portal. helped: shaders/tf2/1684.shader_test fs16: 62 -> 60 (-3.23%) helped: shaders/tf2/1684.shader_test fs8:62 -> 60 (-3.23%) helped: shaders/tf2/5861.shader_test fs16: 68 -> 66 (-2.94%) helped: shaders/tf2/5861.shader_test fs8:68 -> 66 (-2.94%) helped: shaders/tf2/5986.shader_test fs16: 68 -> 66 (-2.94%) helped: shaders/tf2/5986.shader_test fs8:68 -> 66 (-2.94%) helped: shaders/tf2/6926.shader_test fs16: 62 -> 60 (-3.23%) helped: shaders/tf2/6926.shader_test fs8:62 -> 60 (-3.23%) total instructions in shared programs: 731050 -> 731034 (-0.00%) instructions in affected programs: 520 -> 504 (-3.08%) GAINED:0 LOST: 0 Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 9 + 1 file changed, 9 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 4008fe7..21bf332 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -364,6 +364,15 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) if (is_vec_zero(op_const[1])) return ir->operands[0]; + /* X + neg(X) == 0 */ + if (op_expr[1] && op_expr[1]->operation == ir_unop_neg && + ir->operands[0]->equals(op_expr[1]->operands[0])) + return ir_constant::zero(ir, ir->type); + /* neg(X) + X == 0 */ + if (op_expr[0] && op_expr[0]->operation == ir_unop_neg && + ir->operands[1]->equals(op_expr[0]->operands[0])) + return ir_constant::zero(ir, ir->type); + /* Reassociate addition of constants so that we can do constant * folding. */ -- 2.0.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v3 09/11] glsl: Optimize logic operation A || (A && B)
From: Thomas Helland Let's cut the needless A && B here. v1 -> v2: Correct the comments, return A instead of A && B v2 -> v3: Rebase on top of this series Signed-off-by: Thomas Helland --- This was originally posted here: http://lists.freedesktop.org/archives/mesa-dev/2014-July/063129.html v2 of the patch got no responses, so I'm reposting it here. This used to give some effect on a clean shader-db with some extra shaders from TF2 and portal; helped: shaders/tf2/2042.shader_test fs16:23 -> 21 (-8.70%) helped: shaders/tf2/2042.shader_test fs8: 23 -> 21 (-8.70%) helped: shaders/tf2/4624.shader_test fs16:21 -> 19 (-9.52%) helped: shaders/tf2/4624.shader_test fs8: 21 -> 19 (-9.52%) helped: shaders/tf2/763.shader_test fs16: 23 -> 21 (-8.70%) helped: shaders/tf2/763.shader_test fs8: 23 -> 21 (-8.70%) HURT: shaders/orbital_explorer.shader_test vs: 1049 -> 1052 (0.29%) total instructions in shared programs: 758979 -> 758970 (-0.00%) instructions in affected programs: 1183 -> 1174 (-0.76%) GAINED:0 LOST: 0 However, current master gets this optimized, probably in i965 backend; the previously affected shaders now get the same amount of instructions with master as they did with this patch, and this patch has no effect. It does, however, cause 5 extra crashes in a piglit-quick run. I have not investigated this any further. --- src/glsl/opt_algebraic.cpp | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index c673495..4008fe7 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -647,7 +647,17 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) data.b[i] = true; return new(mem_ctx) ir_constant(ir->type, &data); - } + } else if (op_expr[0] && op_expr[0]->operation == ir_binop_logic_and && + (op_expr[0]->operands[0]->equals(op_expr[1]) || + op_expr[0]->operands[1]->equals(op_expr[1]))) { + /* (A && B) || A == A or (B && A) || A == A */ + return ir->operands[1]; + } else if (op_expr[1] && op_expr[1]->operation == ir_binop_logic_and && + (op_expr[1]->operands[0]->equals(op_expr[0]) || + op_expr[1]->operands[1]->equals(op_expr[0]))) { + /* A || (A && B) == A or A || (B && A) == A */ + return ir->operands[0]; + } break; case ir_binop_pow: -- 2.0.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 05/11] glsl: Optimize log(x) + log(y) == log(x*y)
From: Thomas Helland And the log2() equivalent. v1 -> v2: Correct trailing whitespace Signed-off-by: Thomas Helland Reviewed-by: Eric Anholt --- src/glsl/opt_algebraic.cpp | 12 1 file changed, 12 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 42a70e3..141b930 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -380,6 +380,18 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) return expr; } + /* log(x) + log(y) == log(x*y) */ + if (op_expr[0] && op_expr[0]->operation == ir_unop_log && + op_expr[1] && op_expr[1]->operation == ir_unop_log) + return new(mem_ctx) ir_expression( +ir_unop_log, mul(op_expr[0]->operands[0], op_expr[1]->operands[0]) ); + + /* log2(x) + log2(y) == log2(x*y) */ + if (op_expr[0] && op_expr[0]->operation == ir_unop_log2 && + op_expr[1] && op_expr[1]->operation == ir_unop_log2) + return new(mem_ctx) ir_expression( +ir_unop_log2, mul(op_expr[0]->operands[0], op_expr[1]->operands[0]) ); + /* Replace (-x + y) * a + x and commutative variations with lrp(x, y, a). * * (-x + y) * a + x -- 2.0.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 08/11] glsl: Optimize A - neg(B) = A + B
From: Thomas Helland v1 -> v2: Drop the neg(A) - B == neg(A+B) part Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 0ecadbe..c673495 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -454,6 +454,9 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) /* X - X == 0 */ if (ir->operands[0]->equals(ir->operands[1])) return ir_constant::zero(ir, ir->type); + /* A - neg(B) = A + B */ + if (op_expr[1] && op_expr[1]->operation == ir_unop_neg) + return add(ir->operands[0], op_expr[1]->operands[0]); break; case ir_binop_mul: -- 2.0.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 06/11] glsl: Optimize exp(x) * exp(y) == exp(x*y)
From: Thomas Helland And it's exp2() equivalent. Signed-off-by: Thomas Helland Reviewed-by: Eric Anholt --- src/glsl/opt_algebraic.cpp | 11 +++ 1 file changed, 11 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 141b930..0e21ff8 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -470,6 +470,17 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) if (is_vec_negative_one(op_const[1])) return neg(ir->operands[0]); + if (op_expr[0] && op_expr[1]) { + /* exp(x) * exp(y) == exp(x+y) */ + if (op_expr[0]->operation == ir_unop_exp && + op_expr[1]->operation == ir_unop_exp) +return exp(add(op_expr[0]->operands[0], op_expr[1]->operands[0])); + /* exp2(x) * exp2(y) == exp2(x+y) */ + if (op_expr[0]->operation == ir_unop_exp2 && + op_expr[1]->operation == ir_unop_exp2) +return new (mem_ctx) ir_expression(ir_unop_exp2, + add(op_expr[0]->operands[0], op_expr[1]->operands[0])); + } /* Reassociate multiplication of constants so that we can do * constant folding. -- 2.0.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 04/11] glsl: Optimize (A || B) && A == A
From: Thomas Helland And it's cousins v1 -> v2: Correct indentation Correct returned operand from second if statement Signed-off-by: Thomas Helland Reviewed-by: Eric Anholt --- src/glsl/opt_algebraic.cpp | 10 ++ 1 file changed, 10 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index cdabdb8..42a70e3 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -559,6 +559,16 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) ir->operands[0]->equals(op_expr[1]->operands[0])) { /* A && !A == 0 */ return ir_constant::zero(mem_ctx, ir->type); + } else if (op_expr[0] && op_expr[0]->operation == ir_binop_logic_or && + (op_expr[0]->operands[0]->equals(ir->operands[1]) || + op_expr[0]->operands[1]->equals(ir->operands[1]))) { + /* (A || B) && A == A or (B || A) && A == A */ + return ir->operands[1]; + } else if (op_expr[1] && op_expr[1]->operation == ir_binop_logic_or && + (op_expr[1]->operands[0]->equals(ir->operands[0]) || + op_expr[1]->operands[1]->equals(ir->operands[0]))) { + /* A && (A || B) == A or A && (B || A) == A */ + return ir->operands[0]; } break; -- 2.0.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 07/11] glsl: Optimize some more pow() special cases
From: Thomas Helland Specifically x^-1 = rcp(x) .0^x = 0 .x^0 = 1 v1 -> v2: Correct indentation Signed-off-by: Thomas Helland Reviewed-by: Eric Anholt --- src/glsl/opt_algebraic.cpp | 15 +++ 1 file changed, 15 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 0e21ff8..0ecadbe 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -656,6 +656,21 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) if (is_vec_one(op_const[1])) return ir->operands[0]; + /* x^-1 == rcp(x) */ + if (is_vec_negative_one(op_const[1])) + return new(mem_ctx) ir_expression(ir_unop_rcp, + ir->operands[0]->type, + ir->operands[0], + NULL); + + /* 0^x == 0 */ + if (is_vec_zero(op_const[0])) + return ir_constant::zero(ir, ir->type); + + /* x^0 == 1 */ + if (is_vec_zero(op_const[1])) + return new(mem_ctx) ir_constant(1.0f, 1); + /* pow(2,x) == exp2(x) */ if (is_vec_two(op_const[0])) return expr(ir_unop_exp2, ir->operands[1]); -- 2.0.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/11] glsl: Optimize !A && A == 0
From: Thomas Helland Signed-off-by: Thomas Helland Reviewed-by: Eric Anholt --- src/glsl/opt_algebraic.cpp | 8 1 file changed, 8 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 67326c5..cdabdb8 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -551,6 +551,14 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) } else if (ir->operands[0]->equals(ir->operands[1])) { /* (a && a) == a */ return ir->operands[0]; + } else if (op_expr[0] && op_expr[0]->operation == ir_unop_logic_not && + ir->operands[1]->equals(op_expr[0]->operands[0])) { + /* !A && A == 0 */ + return ir_constant::zero(mem_ctx, ir->type); + } else if (op_expr[1] && op_expr[1]->operation == ir_unop_logic_not && + ir->operands[0]->equals(op_expr[1]->operands[0])) { + /* A && !A == 0 */ + return ir_constant::zero(mem_ctx, ir->type); } break; -- 2.0.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 02/11] glsl: Optimize !A || A == 1
From: Thomas Helland v1 -> v2: Correct indentation Signed-off-by: Thomas Helland Reviewed-by: Eric Anholt --- src/glsl/opt_algebraic.cpp | 12 1 file changed, 12 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index c179d53..67326c5 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -591,6 +591,18 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) } else if (ir->operands[0]->equals(ir->operands[1])) { /* (a || a) == a */ return ir->operands[0]; + } else if ( (op_expr[0] && op_expr[0]->operation == ir_unop_logic_not && + ir->operands[1]->equals(op_expr[0]->operands[0])) || + /* !A || A == 1 */ + (op_expr[1] && op_expr[1]->operation == ir_unop_logic_not && + ir->operands[0]->equals(op_expr[1]->operands[0])) ) { + /* A || !A == 1 */ + ir_constant_data data; + + for (unsigned i = 0; i < 16; i++) +data.b[i] = true; + + return new(mem_ctx) ir_constant(ir->type, &data); } break; -- 2.0.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH v2 01/11] glsl: Optimize X - X == 0
From: Thomas Helland v1 -> v2: Corrected indentation. Signed-off-by: Thomas Helland Reviewed-by: Eric Anholt --- src/glsl/opt_algebraic.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index ac7514a..c179d53 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -439,6 +439,9 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) return neg(ir->operands[1]); if (is_vec_zero(op_const[1])) return ir->operands[0]; + /* X - X == 0 */ + if (ir->operands[0]->equals(ir->operands[1])) + return ir_constant::zero(ir, ir->type); break; case ir_binop_mul: -- 2.0.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 00/11] glsl: Collection of algebraic optimizations
From: Thomas Helland Some of these patches have been posted to the list before. Eric showed interest in these being merged, so I addressed his points. Pathces 1 - 7 I've added Eric's R-B on. Patch 8 drops the part that people had doubt on. Patch 9 has been posted before, and seemed to be accepted as OK. However, it no longer gives us the same profit, but instead causes some more crashes in a piglit quick run. Patch 10 gives us some profit on some TF2 shaders. Patch 11 is a hit-and-miss since patch 10 proved usefull. This shows no effect on shader-db however. If anyone want's to see them merged then maybe that person could push them upstream? I don't have commit access, and currently don't feel git-savvy enough that I feel comfortable pokeing around in upstream either :) Thomas Helland (11): glsl: Optimize X - X == 0 glsl: Optimize !A || A == 1 glsl: Optimize !A && A glsl: Optimize (A || B) && A == A glsl: Optimize log(x) + log(y) == log(x*y) glsl: Optimize exp(x) * exp(y) == exp(x*y) glsl: Optimize some more pow() special cases glsl: Optimize A - neg(B) = A + B glsl: Optimize logic operation A || (A && B) glsl: Optimize X + neg(X) == 0 and the other way around glsl: Optimize X / X == 1 src/glsl/opt_algebraic.cpp | 97 +- 1 file changed, 96 insertions(+), 1 deletion(-) -- 2.0.3 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 00/10] [RFC] Probably useless algebraic optimizations
From: Thomas Helland When writing that A || (A && B) patch some days ago I also wrote some other patches that have no impact on my collection of shaders. (shader-db + Some TF2 and Portal-shaders). No reduction in instruction count, and no significant increase in compilation time. I decided to put them up here anyway, as with your collection of shaders maybe YMMV. These are mostly RFC-quality, and not all are as complete and nicely formatted as they could be. Possibly some are also implemented incorrectly. (I'm still trying to get a good understanding of the buildup of the ir, the visitors, etc) Feel free to do with these patches as you please; Ignore, test, review, flame, make cookies... Thomas Helland (10): glsl: Optimize X - X -> 0 glsl: Optimize !A || A == 1 glsl: Optimize !A && A == 0 glsl: Optimize (A || B) && A == A glsl: Optimize min(-8, sin(x)) == -8 and similar glsl: Optimize max(8, sin(x)) == 8 and similar glsl: Optimize log(x) + log(y) == log(x*y) glsl: Optimize exp(x)*exp(y) == exp(x+y) glsl: Optimize A - neg(B) == A + B and neg(A) - B == neg(A + B) glsl: Optimize some more pow() special cases src/glsl/opt_algebraic.cpp | 152 + 1 file changed, 152 insertions(+) -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 06/10] glsl: Optimize max(8, sin(x)) == 8 and similar
From: Thomas Helland This also only handles floats. ir_unop_saturate should also be added when the support for this lands in the ir. Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 38 ++ 1 file changed, 38 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 90b6cae..deaa49e 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -684,6 +684,44 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) break; } + case ir_binop_max: { + ir_rvalue *tempExpr; + ir_rvalue *tempConst; + + if (op_expr[0] && op_const[1]) { + tempExpr = ir->operands[0]; + tempConst = ir->operands[1]; + } else if (op_expr[1] && op_const[0]) { + tempExpr = ir->operands[1]; + tempConst = ir->operands[0]; + } else { + break; + } + + if(tempConst->type->is_float()) { + float constValue = *(tempConst->constant_expression_value()->value.f); + switch(tempExpr->as_expression()->operation) { + case ir_unop_cos: + case ir_unop_sin: + case ir_unop_sign: +/* If we are comparing an expression bound between -1 and 1 + * with a const >= 1 we know that const will be the largest + */ +if(constValue >= 1.0f) + return tempConst; +/* If we are comparing an expression bound between -1 and 1 + * with a const <= -1 we know that const will be the smallest + */ +if(constValue <= -1.0f) + return tempExpr; +break; + default: +break; + } + } + break; + } + case ir_unop_rcp: if (op_expr[0] && op_expr[0]->operation == ir_unop_rcp) return op_expr[0]->operands[0]; -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/10] glsl: Optimize !A && A == 0
From: Thomas Helland Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 8 1 file changed, 8 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 385f0a2..748fd05 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -551,6 +551,14 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) } else if (ir->operands[0]->equals(ir->operands[1])) { /* (a && a) == a */ return ir->operands[0]; + } else if (op_expr[0] && op_expr[0]->operation == ir_unop_logic_not && + ir->operands[1]->equals(op_expr[0]->operands[0])) { + /* !A && A == 0 */ + return ir_constant::zero(mem_ctx, ir->type); + } else if (op_expr[1] && op_expr[1]->operation == ir_unop_logic_not && + ir->operands[0]->equals(op_expr[1]->operands[0])) { + /* A && !A == 0 */ + return ir_constant::zero(mem_ctx, ir->type); } break; -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 01/10] glsl: Optimize X - X -> 0
From: Thomas Helland Silly optimization indeed, but who knows. Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index ac7514a..c179d53 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -439,6 +439,9 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) return neg(ir->operands[1]); if (is_vec_zero(op_const[1])) return ir->operands[0]; + /* X - X == 0 */ + if (ir->operands[0]->equals(ir->operands[1])) + return ir_constant::zero(ir, ir->type); break; case ir_binop_mul: -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 10/10] glsl: Optimize some more pow() special cases
From: Thomas Helland Specifically x^-1 = rcp(x) .0^x = 0 .x^0 = 1 Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 15 +++ 1 file changed, 15 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index fba9de6..1382067 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -662,6 +662,21 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) if (is_vec_one(op_const[1])) return ir->operands[0]; + /* x^-1 == rcp(x) */ + if (is_vec_negative_one(op_const[1])) + return new(mem_ctx) ir_expression(ir_unop_rcp, + ir->operands[0]->type, + ir->operands[0], + NULL); + + /* 0^x == 0 */ + if (is_vec_zero(op_const[0])) + return ir_constant::zero(ir, ir->type); + + /* x^0 == 1 */ + if (is_vec_zero(op_const[1])) + return new(mem_ctx) ir_constant(1.0f, 1); + /* pow(2,x) == exp2(x) */ if (is_vec_two(op_const[0])) return expr(ir_unop_exp2, ir->operands[1]); -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 02/10] glsl: Optimize !A || A == 1
From: Thomas Helland Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 12 1 file changed, 12 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index c179d53..385f0a2 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -591,6 +591,18 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) } else if (ir->operands[0]->equals(ir->operands[1])) { /* (a || a) == a */ return ir->operands[0]; + } else if ( (op_expr[0] && op_expr[0]->operation == ir_unop_logic_not && + ir->operands[1]->equals(op_expr[0]->operands[0])) || + /* !A || A == 1 */ + (op_expr[1] && op_expr[1]->operation == ir_unop_logic_not && + ir->operands[0]->equals(op_expr[1]->operands[0])) ) { + /* A || !A == 1 */ + ir_constant_data data; + +for (unsigned i = 0; i < 16; i++) + data.b[i] = true; + +return new(mem_ctx) ir_constant(ir->type, &data); } break; -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 08/10] glsl: Optimize exp(x)*exp(y) == exp(x+y)
From: Thomas Helland And it's exp2() equivalent. Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 11 +++ 1 file changed, 11 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index e2abf5f..2361d0f 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -470,6 +470,17 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) if (is_vec_negative_one(op_const[1])) return neg(ir->operands[0]); + if (op_expr[0] && op_expr[1]) { + /* exp(x) * exp(y) == exp(x+y) */ + if (op_expr[0]->operation == ir_unop_exp && + op_expr[1]->operation == ir_unop_exp) +return exp(add(op_expr[0]->operands[0], op_expr[1]->operands[0])); + /* exp2(x) * exp2(y) == exp2(x+y) */ + if (op_expr[0]->operation == ir_unop_exp2 && + op_expr[1]->operation == ir_unop_exp2) +return new (mem_ctx) ir_expression(ir_unop_exp2, + add(op_expr[0]->operands[0], op_expr[1]->operands[0])); + } /* Reassociate multiplication of constants so that we can do * constant folding. -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 05/10] glsl: Optimize min(-8, sin(x)) == -8 and similar
From: Thomas Helland This patch is a bit sketchy. It only handles float-constants, otherwise it bails. Also, ir_unop_saturate should be added here when support for it lands in the ir. Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 37 + 1 file changed, 37 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 230fb1b..90b6cae 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -647,6 +647,43 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) break; + case ir_binop_min: { + ir_rvalue *tempExpr; + ir_rvalue *tempConst; + + if (op_expr[0] && op_const[1]) { + tempExpr = ir->operands[0]; + tempConst = ir->operands[1]; + } else if (op_expr[1] && op_const[0]) { + tempExpr = ir->operands[1]; + tempConst = ir->operands[0]; + } else { + break; + } + if(tempConst->type->is_float()) { + float constValue = *(tempConst->constant_expression_value()->value.f); + switch(tempExpr->as_expression()->operation) { + case ir_unop_cos: + case ir_unop_sin: + case ir_unop_sign: +/* If we are comparing an expression bound between -1 and 1 + * with a const >= 1 we know that const will be the largest + */ +if(constValue >= 1.0f) + return tempExpr; +/* If we are comparing an expression bound between -1 and 1 + * with a const <= -1 we know that const will be the smallest + */ +if(constValue <= -1.0f) + return tempConst; +break; + default: +break; + } + } + break; + } + case ir_unop_rcp: if (op_expr[0] && op_expr[0]->operation == ir_unop_rcp) return op_expr[0]->operands[0]; -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 09/10] glsl: Optimize A - neg(B) == A + B
From: Thomas Helland ...and neg(A) - B == neg(A + B) Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 6 ++ 1 file changed, 6 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 2361d0f..fba9de6 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -454,6 +454,12 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) /* X - X == 0 */ if (ir->operands[0]->equals(ir->operands[1])) return ir_constant::zero(ir, ir->type); + /* A - neg(B) = A + B */ + if (op_expr[1] && op_expr[1]->operation == ir_unop_neg) + return add(ir->operands[0], op_expr[1]->operands[0]); + /* neg(A) - B = neg(A + B) */ + if (op_expr[0] && op_expr[0]->operation == ir_unop_neg) + return neg(add(op_expr[0]->operands[0], ir->operands[1])); break; case ir_binop_mul: -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 07/10] glsl: Optimize log(x) + log(y) == log(x*y)
From: Thomas Helland And the log2() equivalent. Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 12 1 file changed, 12 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index deaa49e..e2abf5f 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -380,6 +380,18 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) return expr; } + /* log(x) + log(y) == log(x*y) */ + if (op_expr[0] && op_expr[0]->operation == ir_unop_log && + op_expr[1] && op_expr[1]->operation == ir_unop_log) + return new(mem_ctx) ir_expression( +ir_unop_log, mul(op_expr[0]->operands[0], op_expr[1]->operands[0]) ); + + /* log2(x) + log2(y) == log2(x*y) */ + if (op_expr[0] && op_expr[0]->operation == ir_unop_log2 && + op_expr[1] && op_expr[1]->operation == ir_unop_log2) + return new(mem_ctx) ir_expression( +ir_unop_log2, mul(op_expr[0]->operands[0], op_expr[1]->operands[0]) ); + /* Replace (-x + y) * a + x and commutative variations with lrp(x, y, a). * * (-x + y) * a + x -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 04/10] glsl: Optimize (A || B) && A == A
From: Thomas Helland And it's cousins Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 10 ++ 1 file changed, 10 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index 748fd05..230fb1b 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -559,6 +559,16 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) ir->operands[0]->equals(op_expr[1]->operands[0])) { /* A && !A == 0 */ return ir_constant::zero(mem_ctx, ir->type); + } else if (op_expr[0] && op_expr[0]->operation == ir_binop_logic_or && + (op_expr[0]->operands[0]->equals(ir->operands[1]) || + op_expr[0]->operands[1]->equals(ir->operands[1]))) { + /* (A || B) && A == A or (B || A) && A == A */ + return ir->operands[1]; + } else if (op_expr[1] && op_expr[1]->operation == ir_binop_logic_or && + (op_expr[1]->operands[0]->equals(ir->operands[0]) || + op_expr[1]->operands[1]->equals(ir->operands[0]))) { + /* A && (A || B) == A or A && (B || A) == A */ + return ir->operands[1]; } break; -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glsl: Optimize logic operation A || (A && B) v2
From: Thomas Helland Let's cut the needless A && B here. Gives some effect on a clean shader-db with some extra shaders from TF2 and portal. helped: shaders/tf2/2042.shader_test fs16:23 -> 21 (-8.70%) helped: shaders/tf2/2042.shader_test fs8: 23 -> 21 (-8.70%) helped: shaders/tf2/4624.shader_test fs16:21 -> 19 (-9.52%) helped: shaders/tf2/4624.shader_test fs8: 21 -> 19 (-9.52%) helped: shaders/tf2/763.shader_test fs16: 23 -> 21 (-8.70%) helped: shaders/tf2/763.shader_test fs8: 23 -> 21 (-8.70%) HURT: shaders/orbital_explorer.shader_test vs: 1049 -> 1052 (0.29%) total instructions in shared programs: 758979 -> 758970 (-0.00%) instructions in affected programs: 1183 -> 1174 (-0.76%) GAINED:0 LOST: 0 v1 -> v2: Correct the comments, return A instead of A && B Interestingly, returning A instead of A && B does not improve the results in shader-db like I would've expected. I would've expected it to cut of another instruction or so. Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 11 +++ 1 file changed, 11 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index ac7514a..fe7166d 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -588,7 +588,18 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) } else if (ir->operands[0]->equals(ir->operands[1])) { /* (a || a) == a */ return ir->operands[0]; + } else if (op_expr[0] && op_expr[0]->operation == ir_binop_logic_and && +(op_expr[0]->operands[0]->equals(op_expr[1]) || + op_expr[0]->operands[1]->equals(op_expr[1]))) { + /* (A && B) || A == A or (B && A) || A == A */ + return ir->operands[1]; + } else if (op_expr[1] && op_expr[1]->operation == ir_binop_logic_and && +(op_expr[1]->operands[0]->equals(op_expr[0]) || + op_expr[1]->operands[1]->equals(op_expr[0]))) { + /* A || (A && B) == A or A || (B && A) == A */ + return ir->operands[0]; } + break; case ir_binop_pow: -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] glsl: Optimize logic operation A || (A && B)
From: Thomas Helland Let's cut the needless A && B here. Gives some effect on a clean shader-db with some extra shaders from TF2 and portal. helped: shaders/tf2/2042.shader_test fs16:23 -> 21 (-8.70%) helped: shaders/tf2/2042.shader_test fs8: 23 -> 21 (-8.70%) helped: shaders/tf2/4624.shader_test fs16:21 -> 19 (-9.52%) helped: shaders/tf2/4624.shader_test fs8: 21 -> 19 (-9.52%) helped: shaders/tf2/763.shader_test fs16: 23 -> 21 (-8.70%) helped: shaders/tf2/763.shader_test fs8: 23 -> 21 (-8.70%) HURT: shaders/orbital_explorer.shader_test vs: 1049 -> 1052 (0.29%) total instructions in shared programs: 758979 -> 758970 (-0.00%) instructions in affected programs: 1183 -> 1174 (-0.76%) GAINED:0 LOST: 0 Signed-off-by: Thomas Helland --- src/glsl/opt_algebraic.cpp | 10 ++ 1 file changed, 10 insertions(+) diff --git a/src/glsl/opt_algebraic.cpp b/src/glsl/opt_algebraic.cpp index ac7514a..8f3a505 100644 --- a/src/glsl/opt_algebraic.cpp +++ b/src/glsl/opt_algebraic.cpp @@ -588,6 +588,16 @@ ir_algebraic_visitor::handle_expression(ir_expression *ir) } else if (ir->operands[0]->equals(ir->operands[1])) { /* (a || a) == a */ return ir->operands[0]; + } else if (op_expr[0] && op_expr[0]->operation == ir_binop_logic_and && +(op_expr[0]->operands[0]->equals(op_expr[1]) || + op_expr[0]->operands[1]->equals(op_expr[1]))) { + /* A || (A && B) or A || (B && A) */ + return ir->operands[0]; + } else if (op_expr[1] && op_expr[1]->operation == ir_binop_logic_and && +(op_expr[1]->operands[0]->equals(op_expr[0]) || + op_expr[1]->operands[1]->equals(op_expr[0]))) { + /* (A && B) || A or (B && A) || A */ + return ir->operands[1]; } break; -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 09/11] glsl: Remove unused include from ir_constant_expression.cpp
From: Thomas Helland Found with IWYU. Compile-tested on my Ivy-bridge system. Signed-off-by: Thomas Helland --- src/glsl/ir_constant_expression.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/glsl/ir_constant_expression.cpp b/src/glsl/ir_constant_expression.cpp index 8afe8f7..7b4a22d 100644 --- a/src/glsl/ir_constant_expression.cpp +++ b/src/glsl/ir_constant_expression.cpp @@ -36,7 +36,6 @@ #include #include "main/core.h" /* for MAX2, MIN2, CLAMP */ #include "ir.h" -#include "ir_visitor.h" #include "glsl_types.h" #include "program/hash_table.h" -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 07/11] glsl: Remove unused include from hir_field_selection.cpp
From: Thomas Helland Found with IWYU. Compile-tested on my Ivy-bridge system Signed-off-by: Thomas Helland --- src/glsl/hir_field_selection.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/glsl/hir_field_selection.cpp b/src/glsl/hir_field_selection.cpp index 1e92c89..0fa9768 100644 --- a/src/glsl/hir_field_selection.cpp +++ b/src/glsl/hir_field_selection.cpp @@ -22,7 +22,6 @@ */ #include "ir.h" -#include "program/symbol_table.h" #include "glsl_parser_extras.h" #include "ast.h" #include "glsl_types.h" -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 10/11] glsl: Remove unused include in ir.cpp
From: Thomas Helland Found with IWYU. Compile-tested on my Ivy-bridge system. Signed-off-by: Thomas Helland --- src/glsl/ir.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp index 8fed768..10c0006 100644 --- a/src/glsl/ir.cpp +++ b/src/glsl/ir.cpp @@ -23,7 +23,6 @@ #include #include "main/core.h" /* for MAX2 */ #include "ir.h" -#include "ir_visitor.h" #include "glsl_types.h" ir_rvalue::ir_rvalue(enum ir_node_type t) -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 06/11] glsl: Remove unused include from glsl_symbol_table.h
From: Thomas Helland Only function-defs use glsl_type so forward declare instead. Compile-tested on my Ivy-bridge system. IWYU also suggests removing #include , and this compiles fine. I'm not familiar enough with memory management in C/C++ that I feel comfortable removing this. Insights would be appreciated. Signed-off-by: Thomas Helland --- src/glsl/glsl_symbol_table.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/glsl/glsl_symbol_table.h b/src/glsl/glsl_symbol_table.h index f323fc3..39b84e4 100644 --- a/src/glsl/glsl_symbol_table.h +++ b/src/glsl/glsl_symbol_table.h @@ -32,9 +32,9 @@ extern "C" { #include "program/symbol_table.h" } #include "ir.h" -#include "glsl_types.h" class symbol_table_entry; +class glsl_type; /** * Facade class for _mesa_symbol_table -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 11/11] glsl: Remove unused include in expr.flatt.
From: Thomas Helland Found with IWYU. Compile-tested on my Ivy-bridge system. Signed-off-by: Thomas Helland --- src/glsl/ir_expression_flattening.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/glsl/ir_expression_flattening.cpp b/src/glsl/ir_expression_flattening.cpp index c1cadb1..0b1ada5 100644 --- a/src/glsl/ir_expression_flattening.cpp +++ b/src/glsl/ir_expression_flattening.cpp @@ -32,10 +32,8 @@ */ #include "ir.h" -#include "ir_visitor.h" #include "ir_rvalue_visitor.h" #include "ir_expression_flattening.h" -#include "glsl_types.h" class ir_expression_flattening_visitor : public ir_rvalue_visitor { public: -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 08/11] glsl: Remove unused include from ir_basic_block.cpp
From: Thomas Helland Found with IWYU. Compile-tested on my Ivy-bridge system. Signed-off-by: Thomas Helland --- src/glsl/ir_basic_block.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/glsl/ir_basic_block.cpp b/src/glsl/ir_basic_block.cpp index 426fda2..74ee4b6 100644 --- a/src/glsl/ir_basic_block.cpp +++ b/src/glsl/ir_basic_block.cpp @@ -28,9 +28,7 @@ */ #include "ir.h" -#include "ir_visitor.h" #include "ir_basic_block.h" -#include "glsl_types.h" /** * Calls a user function for every basic block in the instruction stream. -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 04/11] glsl: Remove unused include from builtin_variables.cpp
From: Thomas Helland Found with IWYU. Compile-tested on my Ivy-bridge system. Signed-off-by: Thomas Helland --- src/glsl/builtin_variables.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/glsl/builtin_variables.cpp b/src/glsl/builtin_variables.cpp index 9b35850..e22b083 100644 --- a/src/glsl/builtin_variables.cpp +++ b/src/glsl/builtin_variables.cpp @@ -26,7 +26,6 @@ #include "glsl_symbol_table.h" #include "main/core.h" #include "main/uniforms.h" -#include "program/prog_parameter.h" #include "program/prog_statevars.h" #include "program/prog_instruction.h" -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 00/11] glsl: Remove unused includes found with IWYU
From: Thomas Helland This series removes some unused includes in the glsl-directory. These were found with Google's include-what-you-use plugin for clang. Patches have been compile-tested and a quick glxgears-run has been done. I have not done a full piglit-run, let me know if that's wanted. Oh, and excuse me if I've messed up something. First run with git and mailing-lists, so lots to learn. Thomas Helland (11): glsl: Remove unused includes in link_uniform_init. glsl: Remove unused includes in link_uniform_block_active_visitor.h glsl: Remove unused include in ast_to_hir.cpp glsl: Remove unused include from builtin_variables.cpp glsl: Remove unused include from glsl_types.cpp glsl: Remove unused include from glsl_symbol_table.h glsl: Remove unused include from hir_field_selection.cpp glsl: Remove unused include from ir_basic_block.cpp glsl: Remove unused include from ir_constant_expression.cpp glsl: Remove unused include in ir.cpp glsl: Remove unused include in expr.flatt. src/glsl/ast_to_hir.cpp | 1 - src/glsl/builtin_variables.cpp | 1 - src/glsl/glsl_symbol_table.h | 2 +- src/glsl/glsl_types.cpp | 4 +--- src/glsl/hir_field_selection.cpp | 1 - src/glsl/ir.cpp | 1 - src/glsl/ir_basic_block.cpp | 2 -- src/glsl/ir_constant_expression.cpp | 1 - src/glsl/ir_expression_flattening.cpp| 2 -- src/glsl/link_uniform_block_active_visitor.h | 2 -- src/glsl/link_uniform_initializers.cpp | 2 -- 11 files changed, 2 insertions(+), 17 deletions(-) -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 03/11] glsl: Remove unused include in ast_to_hir.cpp
From: Thomas Helland Found with IWYU. Comment says it's for struct gl_extensions. Grepping for gl_extensions shows no uses. Tested by compiling on my Ivy-bridge system. Signed-off-by: Thomas Helland --- src/glsl/ast_to_hir.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp index 00a59a5..140bb74 100644 --- a/src/glsl/ast_to_hir.cpp +++ b/src/glsl/ast_to_hir.cpp @@ -49,7 +49,6 @@ * parser (and lexer) sources. */ -#include "main/core.h" /* for struct gl_extensions */ #include "glsl_symbol_table.h" #include "glsl_parser_extras.h" #include "ast.h" -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 02/11] glsl: Remove unused includes in link_uniform_block_active_visitor.h
From: Thomas Helland Found with IWYU, compile-tested on my Ivy-bridge system. This is not used in the header, and is included in the source. Signed-off-by: Thomas Helland --- src/glsl/link_uniform_block_active_visitor.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/glsl/link_uniform_block_active_visitor.h b/src/glsl/link_uniform_block_active_visitor.h index d76dbca..524cd6b 100644 --- a/src/glsl/link_uniform_block_active_visitor.h +++ b/src/glsl/link_uniform_block_active_visitor.h @@ -26,8 +26,6 @@ #define LINK_UNIFORM_BLOCK_ACTIVE_VISITOR_H #include "ir.h" -#include "ir_visitor.h" -#include "glsl_types.h" #include "main/hash_table.h" struct link_uniform_block_active { -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 05/11] glsl: Remove unused include from glsl_types.cpp
From: Thomas Helland Found with IWYU. Compile-tested on my Ivy-bridge system. Added comment about core.h being used for MAX2. Signed-off-by: Thomas Helland --- src/glsl/glsl_types.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/glsl/glsl_types.cpp b/src/glsl/glsl_types.cpp index e77146c..62a9087 100644 --- a/src/glsl/glsl_types.cpp +++ b/src/glsl/glsl_types.cpp @@ -22,9 +22,7 @@ */ #include -#include -#include "main/core.h" /* for Elements */ -#include "glsl_symbol_table.h" +#include "main/core.h" /* for Elements, MAX2 */ #include "glsl_parser_extras.h" #include "glsl_types.h" extern "C" { -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 01/11] glsl: Remove unused includes in link_uniform_init.
From: Thomas Helland Found with IWYU, confirmed with grepping for "hash" and "symbol". No negative effects on compilation. IWYU also reported core.h and linker.h could be removed, but I'm unsure if those are false positives. Signed-off-by: Thomas Helland --- src/glsl/link_uniform_initializers.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/glsl/link_uniform_initializers.cpp b/src/glsl/link_uniform_initializers.cpp index 2100e05..d755cec 100644 --- a/src/glsl/link_uniform_initializers.cpp +++ b/src/glsl/link_uniform_initializers.cpp @@ -25,8 +25,6 @@ #include "ir.h" #include "linker.h" #include "ir_uniform.h" -#include "glsl_symbol_table.h" -#include "program/hash_table.h" /* These functions are put in a "private" namespace instead of being marked * static so that the unit tests can access them. See -- 2.0.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev