summaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2023-05-02 11:10:58 -0400
committerGitHub <noreply@github.com>2023-05-02 11:10:58 -0400
commit29cb65585782f71a9c6fa1062eaa0b8de8359604 (patch)
treecdd820f2c4a8b26933ba4f5057f92e84b8dc01eb /docs
parent19c0866b050a022406867aa650302f4efbf8e010 (diff)
Markdown CommandOptions (#2860)
* WIP CommandOptions * Fix some output issues. * Simplify word wrapping. * Add file extensions. * Change how lookup takes place. Add appendSplit functions to StringUtil. Make Categories hold the index range of their options. * Small improvement. * Lookup with partial option names. * Associate user values. * Encoding flags in the name. * Refactor setting up of command options. * Use CommandOptions in slang-options. * Remove old help text. * Cache the CommandOptions on the Session. * Range checking. Fix bug in the Options handling. * Extra checks for validity. * Get categories directly. * Slight improvements over output. * Added NameValue types. * Fix typo. Remove some now unused diagnostics. Fix diagnostic in testing, as output has changed. * Add minimal usage message. * Remove platform executable extension from diagnostics output. * Some improvements around getting names from NameValue types. * Improve some option descriptions. * Small fixes. * WIP improvements around CommandOptions. * Split out CommandOptionsWriter. * Add links to options. * Add command line options reference. * Link to the reference command line information. * Add quick links. * Improvements around lookup. Add categories to linking. * Small additional fixes. * Add LinkFlags control. * Small text fixes. * Fix typo. * Fix typo. * Fix typo. * Add support for -g and -O using CommandOptions. * Improve generated doc output/descriptions. Remove options listed directly in documentation.
Diffstat (limited to 'docs')
-rw-r--r--docs/command-line-slangc-reference.md788
-rw-r--r--docs/command-line-slangc.md101
2 files changed, 807 insertions, 82 deletions
diff --git a/docs/command-line-slangc-reference.md b/docs/command-line-slangc-reference.md
new file mode 100644
index 000000000..e61c4245b
--- /dev/null
+++ b/docs/command-line-slangc-reference.md
@@ -0,0 +1,788 @@
+# Slang Command Line Options
+
+*Usage:*
+```
+slangc [options...] [--] <input files>
+
+# For help
+slangc -h
+
+# To generate this file
+slangc -help-style markdown -h
+```
+## Quick Links
+
+* [General](#General)
+* [Target](#Target)
+* [Downstream](#Downstream)
+* [Debugging](#Debugging)
+* [Experimental](#Experimental)
+* [Internal](#Internal)
+* [Depreciated](#Depreciated)
+* [compiler](#compiler)
+* [language](#language)
+* [archive-type](#archive-type)
+* [line-directive-mode](#line-directive-mode)
+* [debug-info-format](#debug-info-format)
+* [fp-mode](#fp-mode)
+* [help-style](#help-style)
+* [optimization-level](#optimization-level)
+* [debug-level](#debug-level)
+* [file-system-type](#file-system-type)
+* [target](#target)
+* [stage](#stage)
+* [capability](#capability)
+* [file-extension](#file-extension)
+
+<a id="General"></a>
+# General
+
+General options
+
+<a id="D"></a>
+## -D
+
+**-D&lt;name&gt;\[=&lt;value&gt;\], -D &lt;name&gt;\[=&lt;value&gt;\]**
+
+Insert a preprocessor macro.
+
+The space between - D and &lt;name&gt; is optional. If no &lt;value&gt; is specified, Slang will define the macro with an empty value.
+
+
+<a id="depfile"></a>
+## -depfile
+
+**-depfile &lt;path&gt;**
+
+Save the source file dependency list in a file.
+
+
+<a id="entry"></a>
+## -entry
+
+**-entry &lt;name&gt;**
+
+Specify the name of an entry-point function.
+
+When compiling from a single file, this defaults to main if you specify a stage using [-stage](#stage-1).
+
+Multiple [-entry](#entry) options may be used in a single invocation. When they do, the file associated with the entry point will be the first one found when searching to the left in the command line.
+
+If no [-entry](#entry) options are given, compiler will use \[shader(...)\] attributes to detect entry points.
+
+
+<a id="emit-ir"></a>
+## -emit-ir
+Emit IR typically as a '.slang-module' when outputting to a container.
+
+
+<a id="h"></a>
+## -h, -help, --help
+
+**-h or -h &lt;help-category&gt;**
+
+Print this message, or help in specified category.
+
+
+<a id="help-style-1"></a>
+## -help-style
+
+**-help-style &lt;[help-style](#help-style)&gt;**
+
+Help formatting style
+
+
+<a id="I"></a>
+## -I
+
+**-I&lt;path&gt;, -I &lt;path&gt;**
+
+Add a path to be used in resolving '#include' and 'import' operations.
+
+
+<a id="lang"></a>
+## -lang
+
+**-lang &lt;[language](#language)&gt;**
+
+Set the language for the following input files.
+
+
+<a id="matrix-layout-column-major"></a>
+## -matrix-layout-column-major
+Set the default matrix layout to column-major.
+
+
+<a id="matrix-layout-row-major"></a>
+## -matrix-layout-row-major
+Set the default matrix layout to row-major.
+
+
+<a id="module-name"></a>
+## -module-name
+
+**-module-name &lt;name&gt;**
+
+Set the module name to use when compiling multiple .slang source files into a single module.
+
+
+<a id="o"></a>
+## -o
+
+**-o &lt;path&gt;**
+
+Specify a path where generated output should be written.
+
+If no [-target](#target-1) or [-stage](#stage-1) is specified, one may be inferred from file extension (see [&lt;file-extension&gt;](#file-extension)). If multiple [-target](#target-1) options and a single [-entry](#entry) are present, each [-o](#o) associates with the first [-target](#target-1) to its left. Otherwise, if multiple [-entry](#entry) options are present, each [-o](#o) associates with the first [-entry](#entry) to its left, and with the [-target](#target-1) that matches the one inferred from &lt;path&gt;.
+
+
+<a id="profile"></a>
+## -profile
+
+**-profile &lt;profile&gt;\[+&lt;[capability](#capability)&gt;...\]**
+
+Specify the shader profile for code generation.
+
+Accepted profiles are:
+
+* sm_{4_0,4_1,5_0,5_1,6_0,6_1,6_2,6_3,6_4,6_5,6_6}
+
+* glsl_{110,120,130,140,150,330,400,410,420,430,440,450,460}
+
+Additional profiles that include [-stage](#stage-1) information:
+
+* {vs,hs,ds,gs,ps}_&lt;version&gt;
+
+See [-capability](#capability-1) for information on [&lt;capability&gt;](#capability)
+
+When multiple [-target](#target-1) options are present, each [-profile](#profile) associates with the first [-target](#target-1) to its left.
+
+
+<a id="stage-1"></a>
+## -stage
+
+**-stage &lt;[stage](#stage)&gt;**
+
+Specify the stage of an entry-point function.
+
+When multiple [-entry](#entry) options are present, each [-stage](#stage-1) associated with the first [-entry](#entry) to its left.
+
+May be omitted if entry-point function has a \[shader(...)\] attribute; otherwise required for each [-entry](#entry) option.
+
+
+<a id="target-1"></a>
+## -target
+
+**-target &lt;[target](#target)&gt;**
+
+Specifies the format in which code should be generated.
+
+
+<a id="v"></a>
+## -v, -version
+Display the build version. This is the contents of git describe --tags.
+
+It is typically only set from automated builds(such as distros available on github).A user build will by default be 'unknown'.
+
+
+<a id="warnings-as-errors"></a>
+## -warnings-as-errors
+
+**-warnings-as-errors all or -warnings-as-errors &lt;id&gt;\[,&lt;id&gt;...\]**
+
+all - Treat all warnings as errors.
+
+&lt;id&gt;\[,&lt;id&gt;...\]: Treat specific warning ids as errors.
+
+
+
+
+<a id="warnings-disable"></a>
+## -warnings-disable
+
+**-warnings-disable &lt;id&gt;\[,&lt;id&gt;...\]**
+
+Disable specific warning ids.
+
+
+<a id="W"></a>
+## -W
+
+**-W&lt;id&gt;**
+
+Enable a warning with the specified id.
+
+
+<a id="Wno"></a>
+## -Wno-
+
+**-Wno-&lt;id&gt;**
+
+Disable warning with &lt;id&gt;
+
+
+<a id="dump-warning-diagnostics"></a>
+## -dump-warning-diagnostics
+Dump to output list of warning diagnostic numeric and name ids.
+
+
+<a id="id"></a>
+## --
+Treat the rest of the command line as input files.
+
+
+
+<a id="Target"></a>
+# Target
+
+Target code generation options
+
+<a id="capability-1"></a>
+## -capability
+
+**-capability &lt;[capability](#capability)&gt;\[+&lt;[capability](#capability)&gt;...\]**
+
+Add optional capabilities to a code generation target. See Capabilities below.
+
+
+<a id="default-image-format-unknown"></a>
+## -default-image-format-unknown
+Set the format of R/W images with unspecified format to 'unknown'. Otherwise try to guess the format.
+
+
+<a id="disable-dynamic-dispatch"></a>
+## -disable-dynamic-dispatch
+Disables generating dynamic dispatch code.
+
+
+<a id="disable-specialization"></a>
+## -disable-specialization
+Disables generics and specialization pass.
+
+
+<a id="fp-mode-1"></a>
+## -fp-mode, -floating-point-mode
+
+**-fp-mode &lt;[fp-mode](#fp-mode)&gt;, -floating-point-mode &lt;[fp-mode](#fp-mode)&gt;**
+
+Control floating point optimizations
+
+
+<a id="g"></a>
+## -g
+
+**-g, -g&lt;[debug-info-format](#debug-info-format)&gt;, -g&lt;[debug-level](#debug-level)&gt;**
+
+Include debug information in the generated code, where possible.
+
+[&lt;debug-level&gt;](#debug-level) is the amount of information, 0..3, unspecified means 2
+
+[&lt;debug-info-format&gt;](#debug-info-format) specifies a debugging info format
+
+It is valid to have multiple [-g](#g) options, such as a [&lt;debug-level&gt;](#debug-level) and a [&lt;debug-info-format&gt;](#debug-info-format)
+
+
+<a id="line-directive-mode-1"></a>
+## -line-directive-mode
+
+**-line-directive-mode &lt;[line-directive-mode](#line-directive-mode)&gt;**
+
+Sets how the `#line` directives should be produced. Available options are:
+
+If not specified, default behavior is to use C-style `#line` directives for HLSL and C/C++ output, and traditional GLSL-style `#line` directives for GLSL output.
+
+
+<a id="O"></a>
+## -O
+
+**-O&lt;[optimization-level](#optimization-level)&gt;**
+
+Set the optimization level.
+
+
+<a id="obfuscate"></a>
+## -obfuscate
+Remove all source file information from outputs.
+
+
+
+<a id="Downstream"></a>
+# Downstream
+
+Downstream compiler options
+
+<a id="none-path"></a>
+## -none-path, -fxc-path, -dxc-path, -glslang-path, -visualstudio-path, -clang-path, -gcc-path, -genericcpp-path, -nvrtc-path, -llvm-path
+
+**-&lt;[compiler](#compiler)&gt;-path &lt;path&gt;**
+
+Specify path to a downstream [&lt;compiler&gt;](#compiler) executable or library.
+
+
+
+
+<a id="default-downstream-compiler"></a>
+## -default-downstream-compiler
+
+**-default-downstream-compiler &lt;[language](#language)&gt; &lt;[compiler](#compiler)&gt;**
+
+Set a default compiler for the given language. See [-lang](#lang) for the list of languages.
+
+
+<a id="X"></a>
+## -X
+
+**-X&lt;[compiler](#compiler)&gt; &lt;option&gt; -X&lt;[compiler](#compiler)&gt;... &lt;options&gt; -X.**
+
+Pass arguments to downstream [&lt;compiler&gt;](#compiler). Just [-X&lt;compiler&gt;](#X) passes just the next argument to the downstream compiler. [-X&lt;compiler&gt;](#X)... options [-X](#X). will pass *all* of the options inbetween the opening [-X](#X) and [-X](#X). to the downstream compiler.
+
+
+<a id="pass-through"></a>
+## -pass-through
+
+**-pass-through &lt;[compiler](#compiler)&gt;**
+
+Pass the input through mostly unmodified to the existing compiler [&lt;compiler&gt;](#compiler).
+
+These are intended for debugging/testing purposes, when you want to be able to see what these existing compilers do with the "same" input and options
+
+
+
+<a id="Debugging"></a>
+# Debugging
+
+Compiler debugging/instrumentation options
+
+<a id="dump-ast"></a>
+## -dump-ast
+Dump the AST to a .slang-ast file next to the input.
+
+
+<a id="dump-intermediate-prefix"></a>
+## -dump-intermediate-prefix
+
+**-dump-intermediate-prefix &lt;prefix&gt;**
+
+File name prefix for [-dump-intermediates](#dump-intermediates) outputs, default is 'slang-dump-'
+
+
+<a id="dump-intermediates"></a>
+## -dump-intermediates
+Dump intermediate outputs for debugging.
+
+
+<a id="dump-ir"></a>
+## -dump-ir
+Dump the IR for debugging.
+
+
+<a id="dump-ir-ids"></a>
+## -dump-ir-ids
+Dump the IDs with [-dump-ir](#dump-ir) (debug builds only)
+
+
+<a id="dump-repro"></a>
+## -dump-repro
+Dump a `.slang-repro` file that can be used to reproduce a compilation on another machine.
+
+
+
+
+<a id="dump-repro-on-error"></a>
+## -dump-repro-on-error
+Dump `.slang-repro` file on any compilation error.
+
+
+<a id="E"></a>
+## -E, -output-preprocessor
+Output the preprocessing result and exit.
+
+
+<a id="extract-repro"></a>
+## -extract-repro
+
+**-extract-repro &lt;name&gt;**
+
+Extract the repro files into a folder.
+
+
+<a id="load-repro-directory"></a>
+## -load-repro-directory
+
+**-load-repro-directory &lt;path&gt;**
+
+Use repro along specified path
+
+
+<a id="load-repro"></a>
+## -load-repro
+
+**-load-repro &lt;name&gt;**
+
+Load repro
+
+
+<a id="no-codegen"></a>
+## -no-codegen
+Skip the code generation step, just check the code and generate layout.
+
+
+<a id="output-includes"></a>
+## -output-includes
+Print the hierarchy of the processed source files.
+
+
+<a id="repro-file-system"></a>
+## -repro-file-system
+
+**-repro-file-system &lt;name&gt;**
+
+Use a repro as a file system
+
+
+<a id="serial-ir"></a>
+## -serial-ir
+Serialize the IR between front-end and back-end.
+
+
+<a id="skip-codegen"></a>
+## -skip-codegen
+Skip the code generation phase.
+
+
+<a id="validate-ir"></a>
+## -validate-ir
+Validate the IR between the phases.
+
+
+<a id="verbose-paths"></a>
+## -verbose-paths
+When displaying diagnostic output aim to display more detailed path information. In practice this is typically the complete 'canonical' path to the source file used.
+
+
+<a id="verify-debug-serial-ir"></a>
+## -verify-debug-serial-ir
+Verify IR in the front-end.
+
+
+
+<a id="Experimental"></a>
+# Experimental
+
+Experimental options (use at your own risk)
+
+<a id="emit-spirv-directly"></a>
+## -emit-spirv-directly
+Generate SPIR-V output directly (otherwise through GLSL and using the glslang compiler)
+
+
+<a id="file-system"></a>
+## -file-system
+
+**-file-system &lt;[file-system-type](#file-system-type)&gt;**
+
+Set the filesystem hook to use for a compile request.
+
+
+<a id="heterogeneous"></a>
+## -heterogeneous
+Output heterogeneity-related code.
+
+
+<a id="no-mangle"></a>
+## -no-mangle
+Do as little mangling of names as possible.
+
+
+
+<a id="Internal"></a>
+# Internal
+
+Internal-use options (use at your own risk)
+
+<a id="archive-type-1"></a>
+## -archive-type
+
+**-archive-type &lt;[archive-type](#archive-type)&gt;**
+
+Set the archive type for [-save-stdlib](#save-stdlib). Default is zip.
+
+
+<a id="compile-stdlib"></a>
+## -compile-stdlib
+Compile the StdLib from embedded sources. Will return a failure if there is already a StdLib available.
+
+
+<a id="doc"></a>
+## -doc
+Write documentation for [-compile-stdlib](#compile-stdlib)
+
+
+<a id="ir-compression"></a>
+## -ir-compression
+
+**-ir-compression &lt;type&gt;**
+
+Set compression for IR and AST outputs.
+
+Accepted compression types: none, lite
+
+
+<a id="load-stdlib"></a>
+## -load-stdlib
+
+**-load-stdlib &lt;filename&gt;**
+
+Load the StdLib from file.
+
+
+<a id="r"></a>
+## -r
+
+**-r &lt;name&gt;**
+
+reference module &lt;name&gt;
+
+
+<a id="save-stdlib"></a>
+## -save-stdlib
+
+**-save-stdlib &lt;filename&gt;**
+
+Save the StdLib modules to an archive file.
+
+
+<a id="save-stdlib-bin-source"></a>
+## -save-stdlib-bin-source
+
+**-save-stdlib-bin-source &lt;filename&gt;**
+
+Same as [-save-stdlib](#save-stdlib) but output the data as a C array.
+
+
+
+
+<a id="track-liveness"></a>
+## -track-liveness
+Enable liveness tracking. Places SLANG_LIVE_START, and SLANG_LIVE_END in output source to indicate value liveness.
+
+
+
+<a id="Depreciated"></a>
+# Depreciated
+
+Deprecated options (allowed but ignored; may be removed in future)
+
+<a id="parameter-blocks-use-register-spaces"></a>
+## -parameter-blocks-use-register-spaces
+Parameter blocks will use register spaces
+
+
+
+<a id="compiler"></a>
+# compiler
+
+Downstream Compilers (aka Pass through)
+
+* `none` : Unknown
+* `fxc` : FXC HLSL compiler
+* `dxc` : DXC HLSL compiler
+* `glslang` : GLSLANG GLSL compiler
+* `visualstudio`, `vs` : Visual Studio C/C++ compiler
+* `clang` : Clang C/C++ compiler
+* `gcc` : GCC C/C++ compiler
+* `genericcpp`, `c`, `cpp` : A generic C++ compiler (can be any one of visual studio, clang or gcc depending on system and availability)
+* `nvrtc` : NVRTC CUDA compiler
+* `llvm` : LLVM/Clang `slang-llvm`
+
+<a id="language"></a>
+# language
+
+Language
+
+* `c`, `C` : C language
+* `cpp`, `c++`, `C++`, `cxx` : C++ language
+* `slang` : Slang language
+* `glsl` : GLSL language
+* `hlsl` : HLSL language
+* `cu`, `cuda` : CUDA
+
+<a id="archive-type"></a>
+# archive-type
+
+Archive Type
+
+* `riff-deflate` : Slang RIFF using deflate compression
+* `riff-lz4` : Slang RIFF using LZ4 compression
+* `zip` : Zip file
+* `riff` : Slang RIFF without compression
+
+<a id="line-directive-mode"></a>
+# line-directive-mode
+
+Line Directive Mode
+
+* `none` : Don't emit `#line` directives at all
+* `source-map` : Use source map to track line associations (doen't emit #line)
+* `default` : Default behavior
+* `standard` : Emit standard C-style `#line` directives.
+* `glsl` : Emit GLSL-style directives with file *number* instead of name.
+
+<a id="debug-info-format"></a>
+# debug-info-format
+
+Debug Info Format
+
+* `default-format` : Use the default debugging format for the target
+* `c7` : CodeView C7 format (typically means debugging infomation is embedded in the binary)
+* `pdb` : Program database
+* `stabs` : STABS debug format
+* `coff` : COFF debug format
+* `dwarf` : DWARF debug format
+
+<a id="fp-mode"></a>
+# fp-mode
+
+Floating Point Mode
+
+* `precise` : Disable optimization that could change the output of floating-point computations, including around infinities, NaNs, denormalized values, and negative zero. Prefer the most precise versions of special functions supported by the target.
+* `fast` : Allow optimizations that may change results of floating-point computations. Prefer the fastest version of special functions supported by the target.
+* `default` : Default floating point mode
+
+<a id="help-style"></a>
+# help-style
+
+Help Style
+
+* `text` : Text suitable for output to a terminal
+* `markdown` : Markdown
+* `no-link-markdown` : Markdown without links
+
+<a id="optimization-level"></a>
+# optimization-level
+
+Optimization Level
+
+* `0`, `none` : Disable all optimizations
+* `1`, `default` : Enable a default level of optimization.This is the default if no [-o](#o) options are used.
+* `2`, `high` : Enable aggressive optimizations for speed.
+* `3`, `maximal` : Enable further optimizations, which might have a significant impact on compile time, or involve unwanted tradeoffs in terms of code size.
+
+<a id="debug-level"></a>
+# debug-level
+
+Debug Level
+
+* `0`, `none` : Don't emit debug information at all.
+* `1`, `minimal` : Emit as little debug information as possible, while still supporting stack traces.
+* `2`, `standard` : Emit whatever is the standard level of debug information for each target.
+* `3`, `maximal` : Emit as much debug information as possible for each target.
+
+<a id="file-system-type"></a>
+# file-system-type
+
+File System Type
+
+* `default` : Default fike system.
+* `load-file` : Just implements loadFile interface, so will be wrapped with CacheFileSystem internally.
+* `os` : Use the OS based file system directly (without file system caching)
+
+<a id="target"></a>
+# target
+
+Target
+
+* `unknown`
+* `none`
+* `hlsl` : HLSL source code
+* `dxbc` : DirectX shader bytecode binary
+* `dxbc-asm`, `dxbc-assembly` : DirectX shader bytecode assembly
+* `dxil` : DirectX Intermediate Language binary
+* `dxil-asm`, `dxil-assembly` : DirectX Intermediate Language assembly
+* `glsl` : GLSL source code
+* `glsl-vulkan` : GLSL Vulkan source code
+* `glsl-vulkan-one-desc` : GLSL Vulkan source code
+* `spirv` : SPIR-V binary
+* `spirv-asm`, `spirv-assembly` : SPIR-V assembly
+* `c` : C source code
+* `cpp`, `c++`, `cxx` : C++ source code
+* `torch`, `torch-binding`, `torch-cpp`, `torch-cpp-binding` : C++ for pytorch binding
+* `host-cpp`, `host-c++`, `host-cxx` : C++ source for host execution
+* `exe`, `executable` : Executable binary
+* `sharedlib`, `sharedlibrary`, `dll` : Shared library/Dll
+* `cuda`, `cu` : CUDA source code
+* `ptx` : PTX assembly
+* `cuobj`, `cubin` : CUDA binary
+* `host-callable`, `callable` : Host callable
+* `object-code` : Object code
+* `host-host-callable` : Host callable for host execution
+
+<a id="stage"></a>
+# stage
+
+Stage
+
+* `vertex`
+* `hull`
+* `domain`
+* `geometry`
+* `pixel`, `fragment`
+* `compute`
+* `raygeneration`
+* `intersection`
+* `anyhit`
+* `closesthit`
+* `miss`
+* `callable`
+* `mesh`
+* `amplification`
+
+<a id="capability"></a>
+# capability
+
+A capability describes an optional feature that a target may or may not support. When a [-capability](#capability-1) is specified, the compiler may assume that the target supports that capability, and generate code accordingly.
+
+* `spirv_1_{ 0`, `1`, `2`, `3`, `4`, `5 }` : minimum supported SPIR - V version
+* `invalid`
+* `hlsl`
+* `glsl`
+* `c`
+* `cpp`
+* `cuda`
+* `spirv_direct`
+* `GL_NV_ray_tracing` : enables the GL_NV_ray_tracing extension
+* `GL_EXT_ray_tracing` : enables the GL_EXT_ray_tracing extension
+* `GL_NV_fragment_shader_barycentric` : enables the GL_NV_fragment_shader_barycentric extension
+* `GL_EXT_fragment_shader_barycentric` : enables the GL_EXT_fragment_shader_barycentric extension
+
+<a id="file-extension"></a>
+# file-extension
+
+A [&lt;language&gt;](#language), &lt;format&gt;, and/or [&lt;stage&gt;](#stage) may be inferred from the extension of an input or [-o](#o) path
+
+* `hlsl`, `fx` : hlsl
+* `dxbc`
+* `dxbc-asm` : dxbc-assembly
+* `dxil`
+* `dxil-asm` : dxil-assembly
+* `glsl`
+* `vert` : glsl (vertex)
+* `frag` : glsl (fragment)
+* `geom` : glsl (geoemtry)
+* `tesc` : glsl (hull)
+* `tese` : glsl (domain)
+* `comp` : glsl (compute)
+* `slang`
+* `spv` : SPIR-V
+* `spv-asm` : SPIR-V assembly
+* `c`
+* `cpp`, `c++`, `cxx` : C++
+* `exe` : executable
+* `dll`, `so` : sharedlibrary/dll
+* `cu` : CUDA
+* `ptx` : PTX
+* `obj`, `o` : object-code
+* `zip` : container
+* `slang-module`, `slang-library` : Slang Module/Library
+* `dir` : Container as a directory
+
diff --git a/docs/command-line-slangc.md b/docs/command-line-slangc.md
index 2947c8184..d95365083 100644
--- a/docs/command-line-slangc.md
+++ b/docs/command-line-slangc.md
@@ -5,9 +5,20 @@ The `slangc` command-line tool is used to compile or cross-compile shader source
```
slangc [<options>] <file1> [<file2>...]
+```
+
+## Options
+
+The available options are in [the command line option reference](command-line-slangc-reference.md).
+This information is also available from `slangc` via
+
+```
+slangc -h
```
+The sections below describe usage in more detail.
+
Simple Examples
---------------
@@ -49,8 +60,10 @@ To write DXBC, SPIR-V, or GLSL to files, use:
slangc my-shader.slang -profile sm_6_0 -entry main -stage fragment -o my-shader.dxil
slangc my-shader.slang -profile glsl_450 -entry main -stage fragment -o my-shader.spv
-Multiple Entry Points
----------------------
+Usage
+-----
+
+## Multiple Entry Points
`slangc` can compile multiple entry points, which may span multiple files in a single invocation.
This is useful when you are taking advantage of Slang's ability to automatically assign binding locations to shader parameters, because the compiler can take all of your entry points into account when assigning location (avoiding overlap between entry points that will be used together).
@@ -75,84 +88,8 @@ These long command lines obviously aren't pleasant.
We encourage applications that require complex shader compilation workflows to use the Slang API directly so that they can implement compilation that follows application conventions/policy.
The ability to specify compilation actions like this on the command line is primarily intended a testing and debugging tool.
-Options
--------
-
-For completeness, here are the options that `slangc` currently accepts:
-
-* `-v`: Displays the build version. This is the contents of `git describe --tags`. It is typically only set from automated builds (such as distros available on github). A user build will by default be 'unknown'.
-
-* `-D <name>[=<value>]`: Insert a preprocessor macro definition
- * The space between `-D` and `<name>` is optional
- * If no `<value>` is specified, Slang will define the macro with an empty value
-
-* `-I <path>`: Add a path to be used in resolving `#include` and `import` operations
- * The space between `-I` and `<path>` is optional
-
-* `-entry <name>`: Specify the name of the entry-point function
- * When compiling from a single file, this defaults to `main` *if* you specify a stage using `-stage`
- * Multiple `-entry` options may appear on the command line. When they do, the file associated with the entry point will be the first one found when searching to the left in the command line.
-
-* `-stage <name>`: Specify the stage of an entry-point function
- * When there are multiple entry points, a `-stage` option applies to the most recent `-entry` point specified
- * When there is only a single entry point, the `-stage` option may appear anywhere on the command line
- * The traditional stages are named as follows:
- * `vertex`
- * `hull`: D3D Hull Shader and GL/VK Tessellation Control Shader
- * `domain`: D3D Domain Shader and GL/VK Tessellation Evaluation Shader
- * `geometry`
- * `fragment` / `pixel`: D3D Pixel Shader and GL/VK Fragment Shader
- * `compute`
- * The stages for ray tracing use the following names:
- * `raygeneration`
- * `intersection`
- * `anyhit`
- * `closesthit`
- * `miss`
- * `callable`
-
-* `-target <format>`: Specifies the format in which code should be generated. Values for `<target>` are:
- * `glsl`: GLSL source code
- * `hlsl`: HLSL source code
- * `spirv`: SPIR-V intermediate language binary.
- * `spirv-assembly` / `spirv-asm`: SPIR-V intermediate language assembly
- * `dxbc`: DirectX shader bytecode binary
- * `dxbc-assembly` / `dxbc-asm`: DirectX shader bytecode assembly
- * `dxil`: DirectX Intermediate Language binary
- * `dxil-assembly` / `dxil-asm`: DirectX Intermediate Language assembly
-
-* `-profile <profile>`: Specify the "profile" to use for the code generation target, which represents an abstact feature level as defined by a particular API standard. Available values include:
- * The Direct3D "Shader Model" levels are available as `sm_{4_0,4_1,5_0,5_1,6_0,6_1,6_2,6_3,6_4,6_5,6_6}`
- * Profiles corresponding to GLSL langauge versions are available as `glsl_{110,120,130,140,150,330,400,410,420,430,440,450,460}`
- * As a convenience, names matching traditional HLSL shader profiles are provided such that, e.g., `-profile vs_5_0` is an abbreviation for `-profile sm_5_0 -stage vertex`
-
-* `-o <path>`: Specify a path where generated output should be written
- * When multiple `-entry` options are present, each `-o` associates with the first `-entry` to its left.
-
-* `-pass-through <name>`: Don't actually perform Slang parsing/checking/etc. on the input and instead pass it through (more or less) unmodified to the existing compiler `<name>`
- * `fxc`: Use the `D3DCompile` API as exposed by `d3dcompiler_47.dll`
- * `glslang`: Use Slang's internal version of `glslang` as exposed by `slang-glslang.dll`
- * `dxc`: Use DirectXShaderCompiler (https://github.com/Microsoft/DirectXShaderCompiler)
- * These are intended for debugging/testing purposes, when you want to be able to see what these existing compilers do with the "same" input and options
-
-* `-verbose-paths`: When displaying diagnostic output aim to display more detailed path information. In practice this is typically the complete 'canonical' path to the source file used.
-
-* `-g`: Include debug information in the generated code, where possible. Currently only supported for DXBC and DXIL output (not SPIR-V).
-
-* `-O`: Control optimization levels. This currently only affects DXBC and DXIL generation.
- * `-O0`: Disable all optimizations
- * `-O1`, `-O`: Enable a default level of optimization. This is the default if no `-O` options are used.
- * `-O2`: Enable aggressive optimizations for speed.
- * `-O3`: Enable further optimizations, which might have a significant impact on compile time, or involve unwanted tradeoffs in terms of code size.
-
-* `--`: Stop parsing options, and treat the rest of the command line as input paths
-
-* `-output-includes`: After pre-processing has been performed will output to via the diagnostics the hierarchy of paths to source files reached
-
-* -Xname to specify arguments to downstream tool `name` (covered in more detail in "Downstream Arguments")
-
<a id="downstream-arguments"></a>
-### Downstream Arguments
+## Downstream Arguments
During a Slang compilation work may be performed by multiple other stages including downstream compilers and linkers. It isn't possible in general or perhaps even desirable to provide Slang command line equivalents of every option available at every stage of compilation. It is useful to be able to set options specific to a particular compilation stage - to alter code generation, linkage and other options.
@@ -245,16 +182,16 @@ For example to specify an include path "somePath" to DXC you can use...
-Xdxc -IsomePath
```
-### Specifying where dlls/shared libraries are loaded from
+## Specifying where dlls/shared libraries are loaded from
On windows if you want a dll loaded from a specific path, the path must be specified absolutely. See the [LoadLibrary documentation](https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibrarya) for more details. A relative path will cause Windows to check all locations along it's search procedure.
On linux it's similar, but any path (relative or not) will override the regular search mechanism. See [dlopen](https://man7.org/linux/man-pages/man3/dlopen.3.html) for more details.
-* `-dxc-path`: Sets the path where dxc dll/shared libraries are loaded from (dxcompiler & dxil).
+See [the reference for a complete list](#command-line-slangc-reference.md#none-path)
+* `-dxc-path`: Sets the path where dxc dll/shared libraries are loaded from (dxcompiler & dxil).
* `-fxc-path`: Sets the path where fxc dll is loaded from (d3dcompiler_47.dll).
-
* `-glslang-path`: Sets where the Slang specific 'slang-glslang' is loaded from
Paths can specify a directory that holds the appropriate binaries. It can also be used to name a specific downstream binary - be it a shared library or an executable. Note that if it is a shared library, it is not necessary to provide the full filesystem name - just the path and/or name that will be used to load it. For example on windows `fxc` can be loaded from `D:/mydlls` with