Mesa Makes Way For Assembly Shaders To GLSL IR
Phoronix: Mesa Makes Way For Assembly Shaders To GLSL IR
Intel's Ian Romanick has made progress in his long side-project of compiling OpenGL assembly shaders to GLSL IR. He's now up to the point of being able to run the Doom 3 binaries with this conversion work for Mesa...
Wrong screenshot, Michael. That's the old, correct path. Ian's new branch is the screenshot in the middle, where rendering errors are apparent.
Anyway, I'm kind of losing track of what is going on, and what the plan is. This eliminates Mesa IR, right? What is left?
As I understand, before Gallium3D in Mesa GLSL used to be compiled to some Mesa IR, which was tied to OpenGL API, thus forbidding other APIs to be implemented on top of it. Then the Tungsten Graphics developed Gallium3D, and now Gallium3D OpenGL state tracker translates GLSL directly to their API-independent TGSI, and other state trackers as well. Then idea of using LLVM for common optimizations came out, TGSI->LLVM translator was written and now LunarG crew is working on their stack which uses LLVM as its only IR.
So what is "GLSL IR" and what is its place in all this?
The old mesa drivers got Mesa IR from both these assembly shaders and the old GLSL compiler. It was limited to GL 1.x features i think.
Originally Posted by shatsky
When Gallium3D was added, it converted this Mesa IR into TGSI for gallium drivers to use. TGSI was actually a similar format, i think, but better defined, cross-platform, and with more features available.
Around Mesa 7.10 or so, Intel committed a new GLSL compiler, which generates GLSL IR natively (IR is a common compiler term - internal representation). At first, this GLSL IR was converted into Mesa IR for backwards compatibility - then sent off to the classic drivers or turned into TGSI for gallium. Later, the i965 driver gained the ability to work on GLSL IR directly, and gallium converted directly from it into TGSI to bypass the Mesa IR as well. That was important because Mesa IR was getting old and missing features that both GLSL IR and TGSI had that were necessary for newer GL features.
My understanding of the current LLVM work is that it would directly replace TGSI in the gallium stack (as an alternative option) - although it's still early and many different things could eventually end up happening. There's also been whispers of possibly replacing TGSI with GLSL IR, or it could introduce multiple levels where it starts as one language and is later converted to another.
It is "Intermediate Representation".
Originally Posted by smitty3268
LLVM will not replace TGSI in near term. It is used only in AMD backend for the moment, where TGSI IR is converted to LLVM IR, to be optimized further and converted to VLIW for r600 class hardware, or SIMD for GCN.
My inderstanding so far is that TGSI is modelled after DX intermediate representation, so if anyone wants Mesa to be replacement GPU driver implementation for windows, TGSI should stay.
Last edited by Drago; 04-18-2012 at 03:41 PM.
I know what intermediate representation is. TGSI, LLVM IRs, AMD IL - they all are documented and their usage is clear enough. My question is what exactly GLSL IR is and where is it documented. Here, for example, it's mentioned that ARB assembly language itself is used as an IR. And here such things as High level IR, Mesa IR and GLSL IR are mentioned.
In this "GLSL IR to TSGI" message the example code seems to be ARB assembly. But the words "compiling assembly shaders (e.g. GL_ARB_vertex_program) to GLSL IR" clearly state that these two are not equal.