On Tue, Mar 30, 2010 at 6:26 PM, Nicolai Haehnle <nhaeh...@gmail.com> wrote: > Reply to all this time... > > On Tue, Mar 30, 2010 at 8:13 AM, Marek Olšák <mar...@gmail.com> wrote: >>> > 1) Branching and looping >>> > >>> > This is the most important one and there are 3 things which need to be >>> > done. >>> > * Unrolling loops and converting conditionals to multiplications. This >>> > is >>> > crucial for R3xx-R4xx GLSL support. I don't say it will work in all >>> > cases >>> > but should be fine for the most common ones. This is kind of a standard >>> > in >>> > all proprietary drivers supporting shaders 2.0. It would be nice have it >>> > work with pure TGSI shaders so that drivers like nvfx can reuse it too >>> > and I >>> > personally prefer to have this feature first before going on. >>> >>> Would you be able to provide a small example of how to convert the >>> conditionals to multiplications? I understand the basic idea is to mask >>> values based on the result of the conditional, but it would help me to see >>> an example. On IRC, eosie mentioned an alternate technique for emulating >>> conditionals: Save the values of variables that might be affected by >>> the conditional statement. Then, after executing both the if and the else >>> branches, roll back the variables that were affected by the branch that >>> was not supposed to be taken. Would this technique work as well? >> >> Well, I am eosie, thanks for the info, it's always cool to be reminded what >> I've written on IRC. ;) >> >> Another idea was to convert TGSI to a SSA form. That would make unrolling >> branches much easier as the Phi function would basically become a linear >> interpolation, loops and subroutines with conditional return statements >> might be trickier. The r300 compiler already uses SSA for its optimization >> passes so maybe you wouldn't need to mess with TGSI that much... > > Note that my Git repository already contains an implementation of > branch emulation and some additional optimizations, see here: > http://cgit.freedesktop.org/~nh/mesa/log/?h=r300g-glsl > > Shame on me for abandoning it - I should really get around to make > sure it fits in with recent changes and merge it to master. The main > problem is that it produces "somewhat" inefficient code. Adding and > improving peephole and similar optimizations should help tremendously.
git rebases cleanly onto master, and piglit has -2 for me here texCube->fail glsl-fs-fragcoord -> fail Now it might be other things I haven't had to time to investigate, just letting you know that merging it might not a bad plan, Dave. ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Mesa3d-dev mailing list Mesa3d-dev@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mesa3d-dev