As a further example that just came to mind, nv40 (GeForce 6-7 and PS3
RSX) supports control flow in fragment shaders, but does not
apparently support the "continue" keyword (since NV_fragment_program2,
which maps almost directly to the hardware, does not have it either).

I implemented TGSI control flow in a private branch, but did not
implement the "continue" keyword.

Implementing "continue" requires to transform the code to generate and
carry around "should continue" flags, or perform even less trivial
transformations including code duplication.

Unfortunately, doing requires non-local modifications, and thus would
require to do something beyond just scanning the TGSI source code as
the nv30/nv40 driver currently does.

If there was a TGSI->LLVM->TGSI module, the LLVM->TGSI control flow
reconstruction would already handle this, and it would be enough to
tell it to not make use of the "continue" instruction: it would then
automatically generate the proper if/endif structure, duplicating code
and/or introducing flags as needed in a generic way.

As things stand now, I'm faced with either just hoping the GLSL
programs don't use "continue", implementing an hack in the nv40 shader
backend (where such an high-level optimization does not belong at all
and can't be done cleanly), or writing the LLVM module myself before
tackling this.

With an LLVM-based infrastructure, there would be a clear and
straightforward way to solve this, will all the supporting
infrastructure already available and the ability to create an
optimization pass reusable by other drivers that may face the same
issue.

This is just an example, by the way: others can be found.

------------------------------------------------------------------------------
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

Reply via email to