Commit 890f8be
Fix shader-coverage demo launch on Windows (#11625)
## Motivation
`run_coverage.py` in both shader-coverage demos fails on Windows because
the demo `.exe` lives in `build/examples/<target>/<config>/` but the
Slang runtime DLLs (`slang.dll`, etc.) live in `build/<config>/bin/`.
The Windows loader only searches the exe's own directory, so the process
aborts immediately with `STATUS_DLL_NOT_FOUND` (0xC0000135).
## Changes
Prepend the runtime DLL directory to the child process `PATH` before
launching the demo binary. The directory is derived from the
already-known
binary path and handles both CMake generator layouts:
```python
_WIN_CONFIGS = {"Release", "Debug", "RelWithDebInfo"}
demo_env = os.environ.copy()
if platform.system() == "Windows" and len(binary.parents) >= 4:
config = (binary.parent.name if binary.parent.name in _WIN_CONFIGS
else binary.parents[2].name)
dll_dir = binary.parents[3] / config / "bin"
demo_env["PATH"] = str(dll_dir) + os.pathsep + demo_env.get("PATH", "")
result = subprocess.run(binary_cmd, env=demo_env)
```
- **Multi-config** (Ninja Multi-Config / Visual Studio): exe at
`<build>/examples/<target>/<config>/<exe>` — config =
`binary.parent.name`.
- **Single-config** (plain Ninja / Makefiles): exe at
`<build>/<config>/examples/<target>/<exe>` — config =
`binary.parents[2].name`.
- In both cases `binary.parents[3]` is the build root and the DLL
directory
is `<build-root>/<config>/bin/`.
- No change on POSIX — `rpath` handles DLL resolution there.
Both `examples/shader-coverage-bvh-traversal/run_coverage.py` and
`examples/shader-coverage-image-pipeline/run_coverage.py` receive the
same fix.
Co-authored-by: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>1 parent 5353bc5 commit 890f8be
2 files changed
Lines changed: 36 additions & 2 deletions
File tree
- examples
- shader-coverage-bvh-traversal
- shader-coverage-image-pipeline
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
72 | 75 | | |
73 | 76 | | |
74 | 77 | | |
| |||
184 | 187 | | |
185 | 188 | | |
186 | 189 | | |
187 | | - | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
188 | 205 | | |
189 | 206 | | |
190 | 207 | | |
| |||
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
72 | 75 | | |
73 | 76 | | |
74 | 77 | | |
| |||
193 | 196 | | |
194 | 197 | | |
195 | 198 | | |
196 | | - | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
197 | 214 | | |
198 | 215 | | |
199 | 216 | | |
| |||
0 commit comments