<div dir="ltr">So, a little update on these patches.<div>I've written some shaders for hitting each</div><div>specific case in the patch-series.</div><div><br></div><div>This shows that:<br></div><div>Patch 1 (X - X) == 0, and</div>
<div>Patch 9 (A - neg(B)) == A + B</div><div>have no effect at all.</div><div><br></div><div>The rest of the patches do indeed have</div><div>a positive effect on the special-case shader.</div><div><br></div><div>If anyone wants to have a look at the shaders</div>
<div>then let me know. I could always put them</div><div>in a dropbox-folder, or github, or something.</div><div><br></div><div>The report from shader-db (sorted by patch-number): </div><div><br></div><div><div>Patch 2:</div>
<div>helped: shaders/mine/a_or_nota.shader_test fs16: 16 -> 5 (-68.75%)</div><div>helped: shaders/mine/a_or_nota.shader_test fs8: 16 -> 5 (-68.75%)</div><div>helped: shaders/mine/a_or_nota.shader_test vs: 11 -> 5 (-54.55%)</div>
<div><br></div><div>Patch 3:</div><div>helped: shaders/mine/a_and_nota.shader_test fs16: 16 -> 5 (-68.75%)</div><div>helped: shaders/mine/a_and_nota.shader_test fs8: 16 -> 5 (-68.75%)</div><div>helped: shaders/mine/a_and_nota.shader_test vs: 11 -> 5 (-54.55%)</div>
<div><div><br></div><div>Patch 4:</div><div>helped: shaders/mine/or_and.shader_test fs16: 16 -> 14 (-12.50%)</div><div>helped: shaders/mine/or_and.shader_test fs8: 16 -> 14 (-12.50%)</div><div>
helped: shaders/mine/or_and.shader_test vs: 11 -> 10 (-9.09%)</div></div><div><br></div><div>Patch 5:<br class="">helped: shaders/mine/minOver.shader_test fs16: 8 -> 5 (-37.50%)</div><div>helped: shaders/mine/minOver.shader_test fs8: 8 -> 5 (-37.50%)</div>
<div>helped: shaders/mine/minOver.shader_test vs: 6 -> 5 (-16.67%)</div><div>helped: shaders/mine/minUnder.shader_test fs16: 8 -> 5 (-37.50%)</div><div>helped: shaders/mine/minUnder.shader_test fs8: 8 -> 5 (-37.50%)</div>
<div>helped: shaders/mine/minUnder.shader_test vs: 6 -> 5 (-16.67%)</div><div><br></div><div>Patch 6</div><div>helped: shaders/mine/maxOver.shader_test fs16: 8 -> 5 (-37.50%)</div><div>helped: shaders/mine/maxOver.shader_test fs8: 8 -> 5 (-37.50%)</div>
<div>helped: shaders/mine/maxOver.shader_test vs: 6 -> 5 (-16.67%)</div><div>helped: shaders/mine/maxUnder.shader_test fs16: 8 -> 5 (-37.50%)</div><div>helped: shaders/mine/maxUnder.shader_test fs8: 8 -> 5 (-37.50%)</div>
<div>helped: shaders/mine/maxUnder.shader_test vs: 6 -> 5 (-16.67%)</div><div><div><div><br></div><div>Patch 7:</div><div>helped: shaders/mine/loglog.shader_test fs16: 17 -> 11 (-35.29%)</div>
<div>helped: shaders/mine/loglog.shader_test fs8: 17 -> 11 (-35.29%)</div><div>helped: shaders/mine/loglog.shader_test vs: 7 -> 6 (-14.29%)</div><div><br></div><div>Patch 8:</div>helped: shaders/mine/expexp.shader_test fs16: 17 -> 11 (-35.29%)</div>
<div>helped: shaders/mine/expexp.shader_test fs8: 17 -> 11 (-35.29%)</div><div>helped: shaders/mine/expexp.shader_test vs: 7 -> 6 (-14.29%)</div></div><div><br></div><div>Patch 10:</div><div>
helped: shaders/mine/pow0x.shader_test fs16: 8 -> 5 (-37.50%)</div><div>helped: shaders/mine/pow0x.shader_test fs8: 8 -> 5 (-37.50%)</div><div>helped: shaders/mine/pow0x.shader_test vs: 6 -> 5 (-16.67%)</div>
<div>helped: shaders/mine/powx-1.shader_test fs16: 11 -> 5 (-54.55%)</div><div>helped: shaders/mine/powx-1.shader_test fs8: 11 -> 5 (-54.55%)</div><div>helped: shaders/mine/powx-1.shader_test vs: 7 -> 5 (-28.57%)</div>
<div>helped: shaders/mine/powx0.shader_test fs16: 8 -> 5 (-37.50%)</div><div>helped: shaders/mine/powx0.shader_test fs8: 8 -> 5 (-37.50%)</div><div>helped: shaders/mine/powx0.shader_test vs: 6 -> 5 (-16.67%)</div>
</div><div><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-07-15 0:22 GMT+02:00 <span dir="ltr"><<a href="mailto:thomashelland90@gmail.com" target="_blank">thomashelland90@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">From: Thomas Helland <<a href="mailto:thomashelland90@gmail.com">thomashelland90@gmail.com</a>><br>
<br>
When writing that A || (A && B) patch some<br>
days ago I also wrote some other patches<br>
that have no impact on my collection of shaders.<br>
(shader-db + Some TF2 and Portal-shaders).<br>
No reduction in instruction count, and no<br>
significant increase in compilation time.<br>
<br>
I decided to put them up here anyway, as<br>
with your collection of shaders maybe YMMV.<br>
<br>
These are mostly RFC-quality, and not all are<br>
as complete and nicely formatted as they could be.<br>
Possibly some are also implemented incorrectly.<br>
(I'm still trying to get a good understanding of<br>
the buildup of the ir, the visitors, etc)<br>
<br>
Feel free to do with these patches as you please;<br>
Ignore, test, review, flame, make cookies...<br>
<br>
Thomas Helland (10):<br>
glsl: Optimize X - X -> 0<br>
glsl: Optimize !A || A == 1<br>
glsl: Optimize !A && A == 0<br>
glsl: Optimize (A || B) && A == A<br>
glsl: Optimize min(-8, sin(x)) == -8 and similar<br>
glsl: Optimize max(8, sin(x)) == 8 and similar<br>
glsl: Optimize log(x) + log(y) == log(x*y)<br>
glsl: Optimize exp(x)*exp(y) == exp(x+y)<br>
glsl: Optimize A - neg(B) == A + B and neg(A) - B == neg(A + B)<br>
glsl: Optimize some more pow() special cases<br>
<br>
src/glsl/opt_algebraic.cpp | 152 +++++++++++++++++++++++++++++++++++++++++++++<br>
1 file changed, 152 insertions(+)<br>
<span class=""><font color="#888888"><br>
--<br>
2.0.0<br>
<br>
</font></span></blockquote></div><br></div></div>