Gallium3D's Mesa State Tracker Sees Shaders Ported From TGSI To NIR For Capable Drivers
Written by Michael Larabel in Mesa on 1 February 2019 at 08:57 AM EST. 10 Comments
Kenneth Graunke of Intel's Open-Source Technology Center team is the developer who has been leading the charge for the past year on developing the Intel "Iris" Gallium3D driver that eventually should succeed their "i965" classic Mesa driver for Broadwell hardware and newer. Today he issued a pull request for some improvements to Gallium3D's Mesa state tracker itself.

With the new Intel Gallium3D driver, it's leveraging Intel's existing and mature NIR compiler support that is also used by their ANV Vulkan driver, among other shared code with this new OpenGL driver effort. NIR is also the intermediate representation that's beginning to be used by RadeonSI Gallium3D too in order for getting to OpenGL 4.6, Freedreno and VC4 drivers already make extensive use of NIR, and there is also work ongoing for having Nouveau use NIR. The use of NIR is in place of Gallium3D's long-standing TGSI intermediate representation, which is still used throughout the Gallium3D components in Mesa.

For drivers preferring NIR, in the areas where there still is TGSI, there is a TGSI-to-NIR pass. With Ken's latest Mesa driver work, he is adding support to various built-in shaders for the Mesa state tracker so NIR drivers can use this direct version instead of having to take the TGSI built-in shaders and first convert to NIR using the automated pass.

Having NIR built-in shaders for drivers that prefer it (while still supporting TGSI for the others as well) should hopefully allow for more optimizations and also less latency in avoiding that extra pass.

These NIR shaders are for PBO uploads/downloads, OES_draw_texture built-in, clear shaders, drawpixels Z/stencil fragment shaders, and other bits. The pull request will presumably be ready in time for the current Mesa 19.1 cycle. This effort is just one more step in the direction of a more NIR centered future with much less emphasis/interest these days in the older TGSI.
Related News
About The Author
Author picture

Michael Larabel is the principal author of and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and automated benchmarking software. He can be followed via Twitter or contacted via

Popular News This Week