diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2022-12-20 00:20:24 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-20 00:20:24 +0800 |
| commit | 145a0f634ac8fb5cefe081237be1610740dd339a (patch) | |
| tree | 49c0a69d1869a12140a47d780656d949215d0414 | |
| parent | 1c2c4908c64396de2d1bee197c8f000ae2fed0fc (diff) | |
Correct user guide's section on preprocessor directives (#2565)
| -rw-r--r-- | docs/api-users-guide.md | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/docs/api-users-guide.md b/docs/api-users-guide.md index d8ab31bc4..1d33c924f 100644 --- a/docs/api-users-guide.md +++ b/docs/api-users-guide.md @@ -92,11 +92,14 @@ If you want any kind of preprocessor macros to be defined when compiling your co spAddPreprocessorDefine(request, "ENABLE_FOO", "1") ``` -Note that Slang currently doesn't provide an automatic definition like `__SLANG__` to identify the compiler, so you might want to do that manually, if you need to have files that are processed by Slang and other tools. +Slang provides the following preprocessor definitions: -```c++ -spAddPreprocessorDefine(request, "__SLANG__", "1") -``` +- `__SLANG_COMPILER__` as `1` +- `__SLANG__` as `1` when compiling in Slang mode and `0` when compiling in HLSL mode. +- `__HLSL__` as `1` when compiling in HLSL mode and `0` when compiling in Slang mode. +- `__HLSL_VERSION` as an integer representing the HLSL language version. + +Note that `__SLANG__` and `__HLSL__` are *always* defined, so best to use a truthiness check such as `#if __SLANG__` to guard code. ### Specify Input Code and Entry Points |
