Skip to content

SSLC Command Line

Sean Moss edited this page Apr 29, 2019 · 3 revisions

This page discusses the use of the sslc command line application for compiling SSL programs.

The SSLC program is written in C# for .Net Core 2.1. Currently, you are required to have .Net Core 2.1+ installed to run the tool, but we are planning on releasing native compiled versions soon, using .Net Native. It acts as a lightweight wrapper around the Compiler API library to allow it to be run from the command line.

If you are only generating glsl and/or reflection info, you do not need to have the Vulkan SDK installed. However, if you are compiling the program into SPIR-V bytecode for final consumption, the Vulkan SDK must be installed and in the PATH system variable. There are no necessary installation requirements for loading the reflection files, as they are simple binary files containing metadata.

The tool must be launched from the command line like such:

sslc[.exe] <args> input_file.ssl

The input file must be the last argument, and all of the flags and values must go before it. All arguments can be specified with -, --, or / (Windows only). The default, no-args functionality is to perform the full compilation/optimization to SPIR-V without generating any files outside of the SPIR-V binary.

Running the command sslc[.exe] /? will print the help message with all arguments described.

Outputs

By default, all output files go into the same directory as the input file, with the same base filename and different extensions. The default extensions are:

  • .spv - The compiled bytecode
  • .refl - The reflection info (both text and binary formats)
  • .vert, .tesc, ... - The generated GLSL sources for each of the stages

The reflection file will have different formats based on the type of reflection requested. If the text reflection is used, then the file will be a simple ASCII-encoded text file with human-readable lines. If the binary reflection is used, then the file will be a little-endian encoded binary file, the format of which can be found on the Reflection Format page.

The generated GLSL will be ASCII-encoded text. The generated GLSL is somewhat clean and understandable, but certainly not optimized (which is why the optimization step for the SPIR-V is important).

The output SPIR-V file will be raw SPIR-V bytecode. It can be loaded directly, and does not require any special transformations before being fed directly to the Vulkan API. Important: When specifying the entry points for the bytecode, use the stage short name, followed by _main (e.g. vert_main, frag_main, ect...).

Arguments

The command line arguments are given in the table below. If the argument has a Y in the "Has Value?" column, then it must be immediately followed by a non-arg value.

Arg Version Has Value? Description
out;o 0.1 Y Specifies the output file to put the final generated SPIR-V into.
ipath;ip 0.1 Y Specifies the output directory to put the generated GLSL files into. The directory must exist already.
rpath;rp 0.1 Y Specifies the output file to put the reflection info into.
timeout;to 0.1 Y Specified the time, in milliseconds, to wait for the compile/optimize step for each shader stage before throwing a compile error. A value of 0 will wait indefinitely. The default timeout is 5 seconds.
rla 0.1 Y The limit on vertex attribute binding slots. Defaults to 16.
rlo 0.1 Y The limit on bound fragment shader outputs. Defaults to 4. Should not generally go above 4.
rli 0.1 Y The limit on internal variable binding slots. Defaults to 16.
rlu 0.1 Y The limit on the number of uniforms. Defaults to 16.
rlsi 0.1 Y The limit on subpass inputs. Defaults to 4. Should not generally go above 4.
help;h;? 0.1 N Prints the usage message and exits immediately.
no-warn;nw 0.1 N Disables printing warning messages to the console. Not recommended as you may miss important warning messages.
no-compile;nc 0.1 N Disables the compiler step that generates SPIR-V. If this is specified, then the tool can be run without the Vulkan SDK installed.
glsl;i 0.1 N Outputs the generated GLSL to files.
no-optimize;Od 0.1 N Disables the optimization step for the generated SPIR-V. Not recommended.
reflect;r 0.1 N Generates the human-readable text reflection information into a file.
binary;b 0.1 N Generates binary reflection info instead of text. Implicitly activates the /reflect flag.
force-cu;fcu 0.1 N Forces the compiler to error out if the uniforms in the shader are not contiguous. Non-contiguous uniforms are valid, but can negatively affect the performance of the shader program.
Clone this wiki locally