LunarGLASS is available via a three clause BSD-style open source license.
The primary goals of the LunarGLASS project are:
LunarGLASS is an LLVM-based shader-compiler stack available to open-source developers. It brings a new approach by splitting the common shared intermediate representation (IR) into two levels; the top level is completely platform independent while the bottom level is dynamically tailorable to different families of architecture. Both levels still 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 a long-term compiler stack architecture, 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. The short-term goal is to leverage investments in existing IRs while the long-term goal is to reduce the number of IRs and not require optimization difficulties caused by losing information going through an IR.
The standard way to build is using glslang as the GLSL front end. This is currently done by making them sibling directories:
PathOfYourChoice/glslang
PathOfYourChoice/LunarGLASS
(See https://github.com/KhronosGroup/glslang for details about glslang.)
In PathOfYourChoice, clone the glslang repository from https://github.com/KhronosGroup/glslang, making the glslang subdirectory.
In PathOfYourChoice, clone the LunarGLASS repository from https://github.com/LunarG/LunarGLASS, making the LunarGLASS subdirectory.
Get LLVM. Download the LLVM 3.4 source code from http://llvm.org/releases/download.html#3.4 into your "LunarGLASS/Core/LLVM" directory, then extract it:
cd LunarGLASS/Core/LLVM
tar --gzip -xf llvm-3.4.src.tar.gz
The previous step overrwrote some LLVM files that LunarGLASS changes. Restore them to LunarGLASS's versions, while still in the LunarGLASS/Core/LLVM directory:
git checkout -f . # put back the LunarGLASS versions of some LLVM files
LunarGLASS must be built after glslang and LLVM have been built.
Use CMake, building in the directory PathOfYourChoice/glslang/build:
cmake -DCMAKE_INSTALL_PREFIX="" ..
make
make install DESTDIR=install
Summary: LLVM uses a configure script while glslang and LunarGLASS use CMake.
First build set up:
# first time only
cd LunarGLASS/Core/LLVM/llvm-3.4
mkdir build
cd build
../configure
Build:
# build or rebuild
cd LunarGLASS/Core/LLVM/llvm-3.4/build
make -j 8
make install DESTDIR=`pwd`/install
By default, this builds a command-line tool that translates GLSL -> LunarGLASS -> GLSL.
Use CMake, building in the directory PathOfYourChoice/LunarGLASS/build.
Use a LunarGLASS stack to compile from a driver:
Per driver initialization:
Per compile:
Make a LunarGLASS back end:
Make a LunarGLASS front end: