You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/nsc-prebuilds.md
+8-25Lines changed: 8 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,7 @@ Keys are strings that match the output layout:
60
60
-`INPUT` (string, required): path to `.hlsl` (relative to `CMAKE_CURRENT_SOURCE_DIR` or absolute).
61
61
-`KEY` (string, required): base key (prefer without `.spv`; it is always appended, so using `foo.spv` will result in `foo.spv.spv`).
62
62
-`COMPILE_OPTIONS` (array of strings, optional): per-input extra options (e.g. `["-T","cs_6_8"]`).
63
-
-`DEPENDS` (array of strings, optional): per-input dependencies (extra files that should trigger rebuild).
63
+
-`DEPENDS` (array of strings, optional): extra per-input dependencies that are not discovered via `#include` (see below).
64
64
-`CAPS` (array, optional): permutation caps (see below).
65
65
66
66
You can register many rules in a single call, and you can call the function multiple times to append rules to the same `TARGET`.
@@ -87,31 +87,21 @@ The helper also exposes CMake options that append NSC debug flags **only for Deb
87
87
88
88
## Source files and rebuild dependencies (important)
89
89
90
-
Make sure shader inputs and includes are:
90
+
NSC supports depfiles and the CMake custom commands consume them, so **changes in any `#include`d HLSL file automatically trigger recompilation of the affected `.spv` outputs**. In most cases you no longer need to list includes manually.
91
91
92
-
1. Marked as header-only on your target (so the IDE shows them, but the build system doesn't try to compile them with default HLSL rules like `fxc`):
92
+
Use `DEPENDS`only for **extra** inputs that are not discovered via `#include` (e.g. a generated header that is not included, a config file read by a custom include generator, or any non-HLSL file that should trigger a rebuild). You can register those extra dependencies if you need them, but in most projects `DEPENDS` should stay empty.
By default `NBL_CREATE_NSC_COMPILE_RULES` also collects `*.hlsl` files for IDE visibility. It recursively scans the current source directory (or `GLOB_DIR` if provided), adds those files as header-only, and groups them under `HLSL Files`. If you do not want this behavior, pass `DISCARD_DEFAULT_GLOB`.
98
95
99
-
2. Listed as dependencies of the NSC custom commands (so editing any of them triggers a rebuild of the `.spv` outputs).
100
-
101
-
This is what the `DEPENDS` argument of `NBL_CREATE_NSC_COMPILE_RULES` (and/or per-input JSON `DEPENDS`) is for. Always include the main `INPUT` file itself and any files it includes; otherwise the build system might not re-run `nsc` when you change them.
96
+
-`GLOB_DIR` (optional): root directory for the default `*.hlsl` scan.
97
+
-`DISCARD_DEFAULT_GLOB` (flag): disables the default scan and IDE grouping.
102
98
103
99
## Minimal usage (no permutations)
104
100
105
101
Example pattern (as in `examples_tests/27_MPMCScheduler/CMakeLists.txt`):
NSC emits depfiles and the custom commands consume them, so changes in `#include`d HLSL files automatically trigger recompilation of the affected outputs. In most cases you do not need to list includes manually. Use `DEPENDS` only for extra inputs that are not discovered via `#include`.
0 commit comments