[Mesa-dev] Mesa (shader-work): glsl: introduce ir_binop_all_equal and ir_binop_any_equal, allow vector cmps

Luca Barbieri luca at luca-barbieri.com
Wed Sep 8 13:07:49 PDT 2010

> We intend to change the front-end for ARB fp/vp to generate GLSL IR directly.
It's probably a good idea to extend GLSL IR to represent things like
LOG and LIT directly and have optional lowering passes for them, so
that DX9 hardware with native instructions for them can still easily
generate them without complex matching.

> Then it would be compiled via whatever backend path your driver prefers.
> Since we also intend to write direct GLSL IR->915 and GLSL IR->965 backends,
> this would mean that Intel drivers won't use Mesa IR at all.  Ideally, Mesa IR
> should go away eventually

There are non-Intel DRI drivers using Mesa IR though: r200, r300 and r600.
While r300 and r600 seem likely to be eventually dropped in favor of
the gallium drivers, r200 will likely stay.
So it looks like that either r200 needs to be converted to use TGSI
instead of Mesa IR, or vertex program support dropped on r200.

Also, you will need to rewrite the fixed function program generator to
generate GLSL IR.

That said, it seems a very good idea, especially because Mesa IR is
mostly equivalent to TGSI, and would need a truly major update anyway
to be able to represent modern assembly languages like NV_gpu_shader5
and AMD IL.

> - if someone writes a GLSL IR->TGSI converter, none
> of the Gallium drivers would need it...

Gallium could probably add GLSL IR as a shader input format, and
eventually drop TGSI in favor of it, since most drivers don't really
like it.
However a GLSL IR->TGSI pass (which is relatively easy to write by
just refactoring ir_to_mesa.cpp) will still be needed for a while,
since a lot of code depends on TGSI.

BTW, it would be nice to support GL_EXT_separate_shader_objects soon,
since hardware drivers and Gallium will tend to work in that mode

Later (or soon in a driver-initiated fashion), a further transition to
LLVM could be advisable, but this is easy and GLSL IR is still going
to be great as a frontend IR, because as you can see in the glsl2-llvm
branch, converting it to LLVM IR is easy and can work quite well.

More information about the mesa-dev mailing list