Off-and-on for a couple years (no kidding) I've been working on a branch that compiles the assembly shaders (e.g., GL_ARB_vertex_program) to GLSL IR. I even talked about it at XDC 2011. This project has turned into such an incredible rat's nest of irritation that I can't even believe it.

All of that asside, the project reached a significant milestone today. I can run retail Doom3 binaries. There are a couple caveats (incorrect rendering, have to disable HiZ on Sandybridge, etc.), but it's still significant progress. The images below are i965 on Mesa 8.0.2 (with HiZ disabled), i965 on my branch (with HiZ disabled), and classic swrast on my branch. At least at the time of this writing, there are some bugs related to separate stencil on Sandybridge that only occur when HiZ is enabled.

Maybe my Googlefu is failing me, but I can't find a specification for GLSL IR. Is it a khronos thing, or something designed specifically for MESA?
Comment by Anonymous Wed 18 Apr 2012 04:54:08 PM PDT
GLSL IR is just what we've been calling the IR used by the GLSL compiler in Mesa. This name is used primarily to differentiate it from the old, low-level IR in core Mesa (now called "Mesa IR") and the new, low-level IR in Gallium (called TGSI). If you want to look at it, it's it src/glsl/ir.h in the Mesa tree.
Comment by IanRomanick Wed 18 Apr 2012 09:22:50 PM PDT

Thanks for the link.

So is the plan that I could precompile my shaders (or more likely OpenCL kernels!) to the IR and ship that instead of full GLSL? Could this be integrated with a GCC or LLVM backend for direct use within a program, in a similar way to what Microsoft is doing with their AMP C++ extensions (#pragma __restrict(DirectX11) declarations around DirectCompute kernels)?


Comment by Anonymous Thu 19 Apr 2012 12:47:20 AM PDT
It doesn't have anything to do with precompiled shaders or OpenCL. I'm not sure where you got that! I'm just rewriting some driver internals for some old ARB assembly program backends to use some of the more modern (driver) infrastructure. It's all internal to Mesa, and applications shouldn't see any differences... unless I add bugs.
Comment by IanRomanick Mon 23 Apr 2012 07:53:15 AM PDT
I know that Cg sometimes trans-compiles into ARB. So your hardwork won't go unused.
Comment by Michael Fri 20 Jul 2012 12:59:31 AM PDT