LunarGLASS LLVM-based shader compiler stack

LunarGLASS distribution available on GitHub

LunarGOO is included in the LunarGLASS distribution available on the LunarG GitHub page
Access Github

LunarGLASS Shader-Compiler Stack

LunarGLASS is an LLVM‐based shader‐compiler stack and optimizer for shaders, including front-end adapters for GLSL and SPIR-V and a back-end adapter for GLSL. It significantly reduces the effort required to develop new GPU compiler stacks.

It provides a shared compiler middle end, including:

  • A set of conventions layered on top of LLVM
  • A set of optimization and analysis passes for handling issues special to shaders
  • Graphical pipeline state‐driven code generation
  • Passes tailored by back‐end queries


The primary benefits of LunarGLASS are:

  • Reduces the development burden of creating advanced shader‐compiler stacks
  • Increases the level of optimization achieved by real‐world applications
  • Creates a robust and modular approach that works well across a diverse set of hardware architectures

Modular Approach

LunarGLASS is based on establishing common intermediate representations (IRs) allowing modularity between stack layers. Each source-language front end would benefit from a common set of high- and mid-level optimizations, as would each back end, without the need to invent additional IRs.

It brings a new approach by splitting the common shared intermediate representation (IR) into two levels:

  • Top level IR ‐ completely platform independent
  • Bottom level IR ‐ dynamically tailorable to different families of architecture

Both levels lend themselves to portability and sharing of tools. Together, they solve the problem of having a standard portable IR without being biased toward a specific class of target architecture.


LunarGLASS is open-source software and available on the LunarG GitHub page.

LunarGLASS Technologies

LunarG has developed several technologies based on LunarGLASS, including the LunarGOO back end and the Glassy Mesa translator.


LunarGOO is a back end that regenerates GLSL from LunarGLASS middle-end output.

LunarGOO re-emits GLSL, translated from our optimized LLVM Bottom IR. This back end is used for validating, sanitizing, compressing, or obfuscating shaders. It is also used for testing the GLslang front-end and LunarGLASS middle-end components.

Glassy Mesa

The main component developed for this effort is a translator from LunarGLASS Bottom IR to Mesa GLSL IR. This allows all Mesa back ends that consume Mesa GLSL IR to potentially benefit from this technology.

This component is available under either a GPL-style license or a commercial license directly from LunarG. Contact us to inquire about commercial licensing details.