Compiler Reference
Complete guide to the GPULang compiler and command-line options
Installation
The GPULang compiler can be installed through multiple methods depending on your platform and needs.
Download Prebuilt Binaries
Download the latest compiler binaries from our download page or directly from the GitHub releases page.
Build from Source
To build the compiler from source, you'll need CMake and a C++17 compatible compiler:
Basic Usage
The GPULang compiler (gpulangc
) transforms .gpul source files into target-specific
shader binaries and reflection data.
Simple Compilation
This compiles shader.gpul
and outputs the results to output
. The embedded binary is SPIR-V by default.
With Reflection Data
Generates both static (C++ headers) and dynamic (binary metadata) reflection data.
Command-Line Options
Option | Description | Example |
---|---|---|
-o |
Output file path (without extension) | -o build/shader |
-I |
Add include directory. Can be repeated multiple times. | -I include/ |
-h |
Static reflection header output path | -h include/reflection.h |
-g |
Set the implicit binding group for resources without an explicit one | -g 1 |
-v/-validate |
Run backend validation | n/a |
-Ox/-optimize |
Optimize shader code. Can't be used with -s/-symbols | n/a |
-p/-profile |
Output profiling information to stdout | n/a |
-s/-symbols |
Emit debug symbols in the backend. Can't be used with -Ox/-optimize | n/a |
Target Platforms
GPULang supports compilation to multiple graphics API targets, each with specific output formats and capabilities.
Vulkan
Versions: 1.0, 1.1, 1.2, 1.3
Features: Multi-platform, cross-vendor support, SPIR-V output
Work in progressDirectX
Versions: DirectX 12
Features: Windows platform, Xbox support
Work in progressMetal
Versions: 2.0 - 2.4
Features: Apple platforms, iOS, macOS
Work in progressWebGPU
Versions: Current specification
Features: Web browsers, cross-platform