[Mesa-dev] [PATCH 00/10] [RFC] Probably useless algebraic optimizations

thomashelland90 at gmail.com thomashelland90 at gmail.com
Mon Jul 14 15:22:29 PDT 2014


From: Thomas Helland <thomashelland90 at gmail.com>

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



More information about the mesa-dev mailing list