Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion examples/shader-coverage-bvh-traversal/run_coverage.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ def _candidate_paths(slang_root: Path) -> list:
# Windows .exe variants (multi-config)
*(slang_root / "build" / "examples" / _TARGET / config / (_TARGET + ".exe")
for config in ("Release", "Debug", "RelWithDebInfo")),
# Windows .exe variants (single-config)
*(slang_root / "build" / config / "examples" / _TARGET / (_TARGET + ".exe")
for config in ("Release", "Debug", "RelWithDebInfo")),
]


Expand Down Expand Up @@ -184,7 +187,21 @@ def main(argv=None):
binary_cmd = [str(binary), f"--mode={mode}",
f"--output-dir={output_dir}", *demo_args]
print(f"[1/3] running demo: {' '.join(str(a) for a in binary_cmd)}")
result = subprocess.run(binary_cmd)
# On Windows the runtime DLLs (slang.dll etc.) live in
# <build-root>/<config>/bin/, not next to the demo exe. Prepend that
# directory to PATH so the loader finds them (otherwise STATUS_DLL_NOT_FOUND).
# Multi-config layout: exe at <build>/examples/<target>/<config>/<exe>
# Single-config layout: exe at <build>/<config>/examples/<target>/<exe>
# In both cases binary.parents[3] is the build root and the config name
# sits one level above the exe (multi) or two levels above (single).
_WIN_CONFIGS = {"Release", "Debug", "RelWithDebInfo"}
demo_env = os.environ.copy()
Comment thread
jvepsalainen-nv marked this conversation as resolved.
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", "")
Comment thread
coderabbitai[bot] marked this conversation as resolved.
result = subprocess.run(binary_cmd, env=demo_env)
if result.returncode != 0:
sys.exit(f"error: demo exited with code {result.returncode}")

Expand Down
19 changes: 18 additions & 1 deletion examples/shader-coverage-image-pipeline/run_coverage.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ def _candidate_paths(slang_root: Path) -> list:
# Windows .exe variants (multi-config)
*(slang_root / "build" / "examples" / _TARGET / config / (_TARGET + ".exe")
for config in ("Release", "Debug", "RelWithDebInfo")),
# Windows .exe variants (single-config)
*(slang_root / "build" / config / "examples" / _TARGET / (_TARGET + ".exe")
for config in ("Release", "Debug", "RelWithDebInfo")),
]


Expand Down Expand Up @@ -193,7 +196,21 @@ def main(argv=None):
binary_cmd = [str(binary), f"--mode={mode}",
f"--output-dir={output_dir}", *demo_args]
print(f"[1/2] running demo: {' '.join(str(a) for a in binary_cmd)}")
result = subprocess.run(binary_cmd)
# On Windows the runtime DLLs (slang.dll etc.) live in
# <build-root>/<config>/bin/, not next to the demo exe. Prepend that
# directory to PATH so the loader finds them (otherwise STATUS_DLL_NOT_FOUND).
# Multi-config layout: exe at <build>/examples/<target>/<config>/<exe>
# Single-config layout: exe at <build>/<config>/examples/<target>/<exe>
# In both cases binary.parents[3] is the build root and the config name
# sits one level above the exe (multi) or two levels above (single).
_WIN_CONFIGS = {"Release", "Debug", "RelWithDebInfo"}
demo_env = os.environ.copy()
Comment thread
jvepsalainen-nv marked this conversation as resolved.
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)
if result.returncode != 0:
sys.exit(f"error: demo exited with code {result.returncode}")

Expand Down
Loading