aboutsummaryrefslogtreecommitdiff
path: root/tools/fetch-slang.sh
diff options
context:
space:
mode:
authorhachem <im@hachem.wtf>2026-08-20 02:27:02 +0200
committerhachem <im@hachem.wtf>2026-08-20 02:40:07 +0200
commit5b361d81dbd2af0d0e99b9eb1adebea76ff05db0 (patch)
tree34db1df17e8c7248aeeb92156d635d31c2484e3f /tools/fetch-slang.sh
parente3abaaf59777258ba06705135a0cafcb5918ad12 (diff)
[chore]: MASSIVE refactor + more vulkan bs
Diffstat (limited to 'tools/fetch-slang.sh')
-rwxr-xr-xtools/fetch-slang.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/tools/fetch-slang.sh b/tools/fetch-slang.sh
new file mode 100755
index 0000000..5229bf7
--- /dev/null
+++ b/tools/fetch-slang.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+#
+# Fetches the Slang shader-compiler toolchain into tools/slang (gitignored).
+# Slang is the single shader-authoring language for Donut; slangc cross-compiles
+# each assets/shaders/*.slang to GLSL (OpenGL), SPIR-V (Vulkan), and MSL (Metal).
+#
+# Re-run to (re)install. Pin the version here so builds are reproducible.
+set -euo pipefail
+
+VERSION="2026.14.1"
+ROOT="$(cd "$(dirname "$0")/.." && pwd)"
+DEST="$ROOT/tools/slang"
+
+case "$(uname -s)-$(uname -m)" in
+ Darwin-arm64|Darwin-aarch64) ASSET="macos-aarch64" ;;
+ Darwin-x86_64) ASSET="macos-x86_64" ;;
+ Linux-x86_64) ASSET="linux-x86_64" ;;
+ Linux-aarch64|Linux-arm64) ASSET="linux-aarch64" ;;
+ *) echo "fetch-slang: unsupported platform $(uname -s)-$(uname -m)"; exit 1 ;;
+esac
+
+URL="https://github.com/shader-slang/slang/releases/download/v${VERSION}/slang-${VERSION}-${ASSET}.tar.gz"
+
+echo "fetch-slang: downloading Slang ${VERSION} (${ASSET})..."
+rm -rf "$DEST"
+mkdir -p "$DEST"
+curl -fsSL "$URL" | tar -xz -C "$DEST"
+
+"$DEST/bin/slangc" -v >/dev/null 2>&1 && echo "fetch-slang: installed to $DEST (slangc $("$DEST/bin/slangc" -v))"