<div dir="ltr"><div><div>Thanks that was helpful.!<br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jun 17, 2014 at 12:35 PM, Thomas Helland <span dir="ltr"><<a href="mailto:thomashelland90@gmail.com" target="_blank">thomashelland90@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Roshan,<div><br></div><div>I've just gotten into the game myself, so I guess i can provide some newbie-info.</div>
<div>I guess by "the list" you are referring to the suggestions for GSoC projects posted.</div>
<div>I think the application date for GSoC is long passed (so no pay :/ ), </div><div>but I don't think anyone will bash you for taking on the work if you want to.</div><div>Just in case you haven't seen there's also the newbie-projects page[1].</div>

<div>There might be some smaller interesting projects there to.</div><div>These are not to difficult, and will get you accustomed to </div><div>the community, review-process, submitting patches, etc</div><div><br></div><div>

I would love to be proven wrong, but I think the best source of documentation is</div><div>poking around in the source code. There's also some documentation at [2].</div><div>There's also a readme-file in the glsl-directory explaining a bit the IR / compiler.</div>

<div><br></div><div>The shader-compiler does a lot of "optimization passes" over the supplied shaders,<br></div><div>trying to do things like dead-code elimination, cse, algebraic optimizations, etc.</div><div>
As of now I think (but I'm not sure) this is done more or less randomly.</div>
<div>Try a bunch of them multiple times, until there's no proof that we're getting further.</div><div><br></div><div>The static ordering part you are referring to i think is basically the following:</div><div>Find a defined sequence that you can perform these passes</div>

<div>(maybe repeat some of them multiple times), a defined number of times, that</div><div>when completed yields a result that is as good as today's solution;</div><div>1. Less or equal amount of instructions</div><div>

2. Less or equal time to compile shaders.</div><div><br></div><div>Let's say, as an example, dead-code elimination to get rid of some cruft,</div><div>then do some algebraic optimizations, then some constant propagation,</div>

<div>followed by more dead-code elimination, then cse, then repeat everything 2 times.</div><div>Basically trying out a lot of sequences, and testing the results.</div><div><br></div><div>For testing you should use a toolkit to verify your results.</div>

<div>This can be done by compiling mesa with debug-symbols, and using shader-db [3].</div><div>Shader-db does a compilation of a boatload of shaders, and reports time spent</div><div>compiling them along with the end instruction count for each.</div>

<div>Obviously startup-times and FPS in shader-heavy games like Dota2</div><div>are also always a nice addition.</div><div><br></div><div>I will not guarantee that what I've written here is 100% correct, and I'm</div>

<div>not really in a position to give any more details than that, as I'm really</div><div>new to the game myself, and just getting my feet wet with some code-cleanups.</div><div><br></div><div>[1] <a href="http://wiki.freedesktop.org/dri/NewbieProjects/" target="_blank">http://wiki.freedesktop.org/dri/NewbieProjects/</a><br>

</div><div>[2] <a href="http://mesa3d.org/" target="_blank">http://mesa3d.org/</a></div><div>[3] <a href="http://cgit.freedesktop.org/~anholt/shader-db" target="_blank">http://cgit.freedesktop.org/~anholt/shader-db</a></div>
<div><br></div><div>regard,</div>
<div>Thomas</div></div>
</blockquote></div><br></div>