Triforce v0.2.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ruckus7382sfgsgdf
2026-11-10 19:32:48 -06:00
commit 34b3683441
1730 changed files with 554853 additions and 0 deletions

166
.github/workflows/linux-appimage.yml vendored Normal file
View File

@@ -0,0 +1,166 @@
# The Linux AppImage (x86_64): Hookshot Builder with the compiler, Python, libraries and the Vulkan back end it builds the
# game with on the player's PC (scripts/linux/deps.sh, scripts/linux/appimage.sh). No game data is involved.
# Built in Ubuntu 22.04, the oldest system it is for (glibc 2.35). A workflow artifact on every run; on a tag, also an
# asset of that tag's release (scripts/release_upload.sh, shared with the Windows builder workflow).
name: Linux AppImage
on:
push:
branches: [main]
tags: ['*']
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: linux-appimage-${{ github.ref }}
# (a pull request's older run is cancelled; a push's or a tag's never is)
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
appimage:
# (builder-parts holds the installer's parts: no AppImage there, and it must never be made "latest")
if: github.ref_name != 'builder-parts' && github.ref_name != 'linux-parts'
runs-on: ubuntu-latest
container: ubuntu:22.04
# (about 4 minutes with the dependencies cached; building them all, as a release does, takes longer)
timeout-minutes: 60
steps:
- name: System packages
env:
DEBIAN_FRONTEND: noninteractive
run: |
# Retry the entire bootstrap: even the first index refresh or the toolchain setup can fail while a mirror syncs.
# Every attempt refreshes the signed indexes; no stale-index or authentication checks are bypassed.
for try in 1 2 3; do
# (libstdc++ 13, from the toolchain PPA: C++20 <format>; linked in statically)
if apt-get update &&
apt-get install -y --no-install-recommends software-properties-common gpg-agent &&
add-apt-repository -y ppa:ubuntu-toolchain-r/test &&
apt-get install -y --no-install-recommends g++-13 libstdc++-13-dev &&
apt-get install -y --no-install-recommends git ca-certificates curl xz-utils zstd file unzip python3 \
build-essential gcc-12 g++-12 libstdc++-12-dev nasm meson ninja-build cmake pkg-config \
libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxi-dev libxss-dev libxfixes-dev libxinerama-dev \
libxkbcommon-dev libwayland-dev wayland-protocols libdecor-0-dev libegl-dev libgles-dev libdrm-dev libgbm-dev \
libpulse-dev libasound2-dev libpipewire-0.3-dev libudev-dev libdbus-1-dev libxft-dev libfontconfig1-dev zlib1g-dev; then
break
else
package_status=$?
fi
if [ "$try" = 3 ]; then exit "$package_status"; fi
sleep 20
done
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- name: Trust the checkout
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
# (a release builds what the AppImage carries from its checked downloads: no built deps from a cache, which other
# runs write. Other runs take the built deps)
- if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: build-linux/deps
key: linux-deps-${{ hashFiles('scripts/linux/deps.sh', 'requirements.txt', 'nx2/prompt_requirements.txt') }}
- if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: build-linux/deps/downloads
key: linux-deps-downloads-${{ hashFiles('scripts/linux/deps.sh') }}
- name: Dependencies (LLVM, Python, FFmpeg with dav1d, SDL2, Vulkan headers)
env:
GH_TOKEN: ${{ github.token }}
run: scripts/linux/deps.sh
# work/: the lists and the play profile made on the development PC (addresses and counts, no game code). When the
# repository does not carry them, the ones in the latest release's app part (named by its hookshot-setup.txt) are
# used; without either the game is built all the same, a little slower in play.
# (not this tag's own release: the Windows builder workflow can make it before this step runs. A fork with no release
# takes upstream's. Downloads are retried: GitHub answers 504 now and then)
- name: Play profile
env:
GH_TOKEN: ${{ github.token }}
SKIP_TAG: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || '' }}
run: |
if [ -f work/hot_order.txt ]; then echo "work/ is in the repository"; exit 0; fi
python3 -I scripts/release_parts.py previous /tmp/setup.txt --repo "$GITHUB_REPOSITORY" --repo NotRexed/Hookshot \
--skip-tag "$SKIP_TAG" ||
{ echo "no release with a setup list: built without the profile"; exit 0; }
python3 -I scripts/release_parts.py profile /tmp/setup.txt work ||
{ echo "the profile did not download: built without it"; exit 0; }
ls -la work work/image
- name: AppImage
run: scripts/linux/appimage.sh
# (AMD FSR 4's Linux side, a build option the AppImage leaves off (gpu/vk/vk_fsr4.cpp: dlopen, the older backend
# description, the unit exposure; the descriptor buffers in vk_main.cpp): built once more in a copy of the back end's
# work folder, where only vk_fsr4.cpp compiles again. The AppImage above is not changed)
- name: hookshot_vk.so with AMD FSR 4 (build check)
shell: bash # (this container's default is sh, which has no PIPESTATUS)
run: |
cp -r build-linux/vk-work "$RUNNER_TEMP/vk-fsr"
rm -f "$RUNNER_TEMP/vk-fsr/sa/build/hookshot_vk.so" # (the AppImage's own, without FSR: the test below is this build's)
D="$PWD/build-linux/deps"
OOT_WORK="$RUNNER_TEMP/vk-fsr" EMSDK="$D/emsdk" RX_CPM="$D/cpm" RX_MARCH=x86-64-v3 RX_VK_ONLY=1 RX_RELEASE=1 HOOKSHOT_FSR=1 \
"$D/python/bin/python3" -I nx2/build.py --standalone --jobs "$(nproc)" |
tee "$RUNNER_TEMP/vk-fsr.log"
test "${PIPESTATUS[0]}" -eq 0
grep -q "with AMD FSR 4" "$RUNNER_TEMP/vk-fsr.log"
test -f "$RUNNER_TEMP/vk-fsr/sa/build/hookshot_vk.so"
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: Hookshot-linux-x86_64
path: build-linux/*.AppImage
if-no-files-found: error
# (a player's build started from the AppImage itself, with no game, up to where the lifted game is needed: a file the
# AppImage does not carry fails here, not in every player's build. 2026-11-10: third_party/fonts, #1567. After the upload,
# so a failing image can be looked at; a tag's release needs this job to pass)
- name: A player's build from the AppImage
run: scripts/linux/check_player_build.sh
# (a tag's update parts, for the release job: scripts/linux/make_parts.py. Not on other runs: about 240 MB)
- if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: Hookshot-linux-parts
path: build-linux/parts/
if-no-files-found: error
release:
name: Release asset
if: startsWith(github.ref, 'refs/tags/') && github.ref_name != 'builder-parts' && github.ref_name != 'linux-parts'
needs: appimage
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
contents: write
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: Hookshot-linux-x86_64
path: dist
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: Hookshot-linux-parts
path: dist/parts
# (the parts to the linux-parts release, which is never "latest"; a part already there is not uploaded again)
- name: Update parts
run: scripts/linux/publish_parts.sh dist/parts
# (the release made here or by the Windows builder workflow, whichever is first; a -rc tag is a prerelease and
# never "latest")
- name: AppImage to the release
run: scripts/release_upload.sh "$GITHUB_REF_NAME" dist/*.AppImage dist/parts/hookshot-linux.txt

63
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,63 @@
# The version, tag and changelog entry for a push to main (stable) or next (release candidates). The tag starts the
# Linux AppImage and Windows builder workflows, which publish the GitHub release with their files. The rules and the one-time v0.1.0 tag are in
# docs/versioning.md. No game data is involved.
name: Release
on:
push:
branches: [main, next]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
# (a manual run on a branch, not on a tag: semantic-release needs a release branch)
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next'
runs-on: ubuntu-latest
timeout-minutes: 15
# (the release commit and the tag are pushed back)
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# the last release tag and the commits since it are part of the analysis
fetch-depth: 0
# the release commit and the tag are pushed with this token; RELEASE_TOKEN lets the tag start the AppImage
# and Windows builder workflows, which publish the GitHub release
token: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
- name: Release tooling
run: npm install --no-audit --no-fund --ignore-scripts
# semantic-release starts at 1.0.0 when it finds no tag. The first version is 0.1.0, tagged by hand on the merge
# that introduces the scheme, so nothing is released before that tag exists.
- name: First release tag
id: first
run: |
if git describe --tags --match 'v[0-9]*' >/dev/null 2>&1; then
echo "released=true" >> "$GITHUB_OUTPUT"
else
echo "released=false" >> "$GITHUB_OUTPUT"
echo "::notice::No version tag yet. Tag the first release by hand (docs/versioning.md)."
fi
# RELEASE_TOKEN is a fine-grained personal access token with contents: write. It is preferred over GITHUB_TOKEN
# because a tag pushed by GITHUB_TOKEN does not start the workflows that publish the release.
# Without the secret, run them by hand and attach their artifacts.
- name: semantic-release
if: steps.first.outputs.released == 'true'
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN || secrets.GITHUB_TOKEN }}
run: npx semantic-release

232
.github/workflows/source-regressions.yml vendored Normal file
View File

@@ -0,0 +1,232 @@
# Every game-free check, on every pull request to main and every push to it: tests/run_all.py runs each
# tests/test_*.py and nx2/test_*.py (all of them, even after a failure), the C++ unit tests under gpu/vk/tests and a
# byte-compile of every tracked Python file, and writes a table of them to the run's summary. A check that needs a GPU,
# the game or MSVC says so, and why, in its own file (RUN_ALL_SKIP). No game data is involved.
name: Game-free source regressions
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
python:
name: Python source checks (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, windows-2022]
runs-on: ${{ matrix.os }}
timeout-minutes: 20
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# (the versions scripts/linux/deps.sh builds the Vulkan back end with)
- name: Check out pinned SPIR-V headers
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: KhronosGroup/SPIRV-Headers
ref: 04f10f650d514df88b76d25e83db360142c7b174 # vulkan-sdk-1.4.341.0
path: _deps/spirv-headers
persist-credentials: false
- name: Check out pinned Vulkan headers
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: KhronosGroup/Vulkan-Headers
ref: 74d8a6cb930c68ef617b202c3ff3c59d919e086b # v1.4.345
path: _deps/vulkan-headers
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: '3.12'
# (the one package a test imports: nx2/test_nup_codec.py's zstandard. The runner itself needs none)
- name: Python packages for the tests
run: python -m pip install --disable-pip-version-check --no-deps zstandard==0.25.0
- name: Compilers and the SPIR-V validator
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y g++ clang spirv-tools
- name: Pinned glslang for generated shader comparisons
if: runner.os == 'Linux'
shell: bash
run: |
# The checked-in shader headers are generated with glslang16.6.0.
# Older distro compilers can lower discard differently even for unchanged GLSL.
tool_dir="$RUNNER_TEMP/glslang-16.6.0"
mkdir -p "$tool_dir"
curl -fL --retry 3 -o "$tool_dir/glslang.tar.gz" https://github.com/KhronosGroup/glslang/releases/download/16.6.0/glslang-16.6.0-linux-x86_64-release.tar.gz
echo '2c34071f56ecf39d16233294d3739cf43f981fd39080f2fd9dccb782101191ce '"$tool_dir/glslang.tar.gz" | sha256sum --check --strict
tar -xzf "$tool_dir/glslang.tar.gz" -C "$tool_dir"
"$tool_dir/bin/glslangValidator" --version
echo "$tool_dir/bin" >> "$GITHUB_PATH"
# (the steps below all run when one before them failed, so one run shows every failure)
- name: Check Windows native source regressions
if: ${{ !cancelled() && runner.os == 'Windows' }}
shell: cmd
run: |
@echo off
set "VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe"
if not exist "%VSWHERE%" (
echo Visual Studio locator not found.
exit /b 1
)
set "VSROOT="
for /f "usebackq delims=" %%i in (`call "%VSWHERE%" -latest -products * -version "[17.0,18.0)" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set "VSROOT=%%i"
if not defined VSROOT (
echo Visual Studio 2022 C++ tools not found.
exit /b 1
)
if not exist "%VSROOT%\Common7\Tools\VsDevCmd.bat" (
echo Visual Studio developer command prompt not found.
exit /b 1
)
call "%VSROOT%\Common7\Tools\VsDevCmd.bat" -arch=x64 -host_arch=x64
if errorlevel 1 exit /b 1
where cl
if errorlevel 1 exit /b 1
cl /nologo /std:c++17 /W4 /WX /EHsc /Fo"%TEMP%\present_rect_test.obj" /Fe:"%TEMP%\present_rect_test.exe" gpu\vk\tests\present_rect_test.cpp
if errorlevel 1 exit /b 1
"%TEMP%\present_rect_test.exe"
if errorlevel 1 exit /b 1
python -I -B tests/test_invalidate_vcore.py --cxx cl
if errorlevel 1 exit /b 1
- name: Set up .NET for Windows Builder checks
if: ${{ !cancelled() && runner.os == 'Windows' }}
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: '8.0.x'
- name: Check Windows Builder worker delivery
if: ${{ !cancelled() && runner.os == 'Windows' }}
shell: pwsh
run: |
dotnet restore tests/builder_workers/BuilderWorkersTests.csproj --configfile tests/builder_workers/NuGet.Config
dotnet run --project tests/builder_workers/BuilderWorkersTests.csproj --configuration Release --no-restore -- (Get-Command python).Source
- name: Compile Windows Builder
if: ${{ !cancelled() && runner.os == 'Windows' }}
run: dotnet build builder/HookshotBuilder/HookshotBuilder.csproj --configuration Debug -p:NuGetAudit=false
# (--strict: a check whose compiler, headers or package is missing here fails instead of being skipped)
- name: Every test
if: ${{ !cancelled() }}
env:
HOOKSHOT_SPIRV_HEADERS: ${{ github.workspace }}/_deps/spirv-headers/include
HOOKSHOT_VULKAN_HEADERS: ${{ github.workspace }}/_deps/vulkan-headers/include
run: python -I -B tests/run_all.py --strict
spirv-global16:
name: SPIR-V global narrow load/store lowering
runs-on: ubuntu-24.04
timeout-minutes: 15
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Check out pinned SPIR-V headers
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: KhronosGroup/SPIRV-Headers
ref: 496543121ce6419f23d6fa5d7194ba66c36212d2
path: _deps/spirv-headers
persist-credentials: false
- name: Install Clang C++20 and SPIR-V validator
run: sudo apt-get update && sudo apt-get install -y clang spirv-tools
- name: Configure the focused real-IR fixture
run: >-
CC=clang CXX=clang++ cmake -S tests/global_load_16 -B ${{ runner.temp }}/global-load-16
-DREPO_ROOT=${{ github.workspace }}
-DSPIRV_HEADERS_ROOT=${{ github.workspace }}/_deps/spirv-headers
- name: Build the focused fixture
run: cmake --build ${{ runner.temp }}/global-load-16 --parallel 2
- name: Emit and inspect real IR modules
run: ${{ runner.temp }}/global-load-16/global_load_16_ir ${{ runner.temp }}/global-load-16/modules
- name: Check real-IR compare-exchange loop contracts
env:
RX_VK_FOLLOW_STORES: '1'
run: ${{ runner.temp }}/global-load-16/global_load_16_ir --cas-loops ${{ runner.temp }}/global-load-16/modules
- name: Validate every emitted module
shell: bash
# (--uniform-buffer-standard-layout: the back end's device has uniformBufferStandardLayout, gpu/vk/vk_main.cpp
# creates it with every feature the GPU reports, so constant buffers are u32 arrays of stride 4)
run: |
for module in "${{ runner.temp }}"/global-load-16/modules/*.spv; do
spirv-val --target-env vulkan1.3 --uniform-buffer-standard-layout "$module"
done
- name: Configure the authored direct surface atomic fixture
run: >-
CC=clang CXX=clang++ cmake -S tests/native_suatom -B ${{ runner.temp }}/native-suatom
-DREPO_ROOT=${{ github.workspace }}
-DSPIRV_HEADERS_ROOT=${{ github.workspace }}/_deps/spirv-headers
- name: Build the direct surface atomic fixture
run: cmake --build ${{ runner.temp }}/native-suatom --parallel 2
- name: Translate authored direct surface atomic programs
run: ${{ runner.temp }}/native-suatom/native_suatom ${{ runner.temp }}/native-suatom/modules
- name: Validate every direct surface atomic module
shell: bash
run: |
for module in "${{ runner.temp }}"/native-suatom/modules/*.spv; do
spirv-val --target-env vulkan1.3 "$module"
done
spirv-f2i-immediate:
name: Native F2I immediate lowering
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Check out pinned SPIR-V headers
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: KhronosGroup/SPIRV-Headers
ref: 496543121ce6419f23d6fa5d7194ba66c36212d2
path: _deps/spirv-headers
persist-credentials: false
- name: Install Clang and validator
run: sudo apt-get update && sudo apt-get install -y clang spirv-tools
- name: Build the focused fixture
run: |
CC=clang CXX=clang++ cmake -S tests/f2i_immediate -B "${{ runner.temp }}/f2i" -DREPO_ROOT="${{ github.workspace }}" -DSPIRV_HEADERS_ROOT="${{ github.workspace }}/_deps/spirv-headers"
cmake --build "${{ runner.temp }}/f2i" --parallel 2
- name: Emit and validate authored modules
run: |
"${{ runner.temp }}/f2i/f2i_immediate" "${{ runner.temp }}/f2i/modules"
for module in "${{ runner.temp }}"/f2i/modules/*.spv; do
spirv-val --target-env vulkan1.3 --uniform-buffer-standard-layout "$module"
done
actionlint:
name: Workflow lint (actionlint)
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# (the release's own binary, checked against its published SHA-256; shellcheck from the runner image checks the
# run: scripts)
- name: actionlint 1.7.12
env:
VERSION: 1.7.12
SHA256: 8aca8db96f1b94770f1b0d72b6dddcb1ebb8123cb3712530b08cc387b349a3d8
run: |
curl -fsSL --retry 5 --retry-delay 10 -o "$RUNNER_TEMP/actionlint.tar.gz" \
"https://github.com/rhysd/actionlint/releases/download/v$VERSION/actionlint_${VERSION}_linux_amd64.tar.gz"
echo "$SHA256 $RUNNER_TEMP/actionlint.tar.gz" | sha256sum -c -
tar -xzf "$RUNNER_TEMP/actionlint.tar.gz" -C "$RUNNER_TEMP" actionlint
- name: Lint the workflows
run: '"$RUNNER_TEMP/actionlint" -color'

127
.github/workflows/vulkan-dlss.yml vendored Normal file
View File

@@ -0,0 +1,127 @@
# NVIDIA DLSS is a local build's option: NVIDIA's SDK is never part of Hookshot or its downloads. This only checks that
# hookshot_vk.dll still compiles and links with it, through llvm-mingw as players build it. It runs by hand, and on a push or
# pull request only when a file DLSS's build depends on changed (the paths below), not on every push. scripts/ngx_sdk.py
# fetches the SDK at its pinned release, SHA-256 checked, without DLSS's runtime: NVIDIA's license is accepted for that run
# alone (--accept-nvidia-license), and nothing of it is uploaded or cached.
# AMD FSR 4 (HOOKSHOT_FSR=1: AMD's MIT headers, nothing downloaded) is built in the same run: both engines share
# vk_temporal.cpp.
name: Vulkan back end with NVIDIA DLSS
on:
push:
branches: [main, dev]
paths:
- 'gpu/vk/vk_dlss*'
- 'gpu/vk/vk_temporal*'
- 'gpu/vk/vk_fsr4*'
- 'third_party/fidelityfx/**'
- 'gpu/vk/vk_reflex*'
- 'gpu/vk/vk_ngx_msvc_rt.cpp'
- 'gpu/vk/upscaler_rows.h'
- 'gpu/vk/dlss_math.h'
- 'gpu/vk/dlss_checks.h'
- 'gpu/vk/shaders/dlss_*'
- 'host/mingw_msvc_shims.c'
- 'nx2/oot_jitter.py'
- 'nx2/build.py'
- 'nx2/make_game.py'
- 'scripts/ngx_sdk.py'
- '.github/workflows/vulkan-dlss.yml'
pull_request:
paths:
- 'gpu/vk/vk_dlss*'
- 'gpu/vk/vk_temporal*'
- 'gpu/vk/vk_fsr4*'
- 'third_party/fidelityfx/**'
- 'gpu/vk/vk_reflex*'
- 'gpu/vk/vk_ngx_msvc_rt.cpp'
- 'gpu/vk/upscaler_rows.h'
- 'gpu/vk/dlss_math.h'
- 'gpu/vk/dlss_checks.h'
- 'gpu/vk/shaders/dlss_*'
- 'host/mingw_msvc_shims.c'
- 'nx2/oot_jitter.py'
- 'nx2/build.py'
- 'nx2/make_game.py'
- 'scripts/ngx_sdk.py'
- '.github/workflows/vulkan-dlss.yml'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
defaults:
run:
shell: bash
jobs:
vulkan-dlss:
name: Windows Vulkan back end with NVIDIA DLSS and AMD FSR 4 (llvm-mingw, link check)
runs-on: windows-2022
timeout-minutes: 45
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Check out pinned Vulkan headers
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: KhronosGroup/Vulkan-Headers
ref: 74d8a6cb930c68ef617b202c3ff3c59d919e086b # v1.4.345
path: _deps/cpm/vulkanheaders/v1.4.345
persist-credentials: false
- name: Check out pinned SPIR-V headers
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: KhronosGroup/SPIRV-Headers
ref: 04f10f650d514df88b76d25e83db360142c7b174 # vulkan-sdk-1.4.341.0
path: _deps/cpm/spirv-headers/vulkan-sdk-1.4.341.0
persist-credentials: false
- name: Check out pinned VulkanMemoryAllocator
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
ref: 1d8f600fd424278486eade7ed3e877c99f0846b1 # v3.3.0
path: _deps/cpm/vulkanmemoryallocator/v3.3.0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: '3.12'
- name: llvm-mingw version
id: llvm
run: echo "name=$(python -I scripts/release_parts.py llvm-mingw --name)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/llvm
key: ${{ steps.llvm.outputs.name }}
- name: llvm-mingw
run: echo "HOOKSHOT_MINGW=$(python -I scripts/release_parts.py llvm-mingw "$RUNNER_TEMP/llvm")" >> "$GITHUB_ENV"
- name: NVIDIA's DLSS SDK (headers and nvsdk_ngx_s.lib)
run: python -I scripts/ngx_sdk.py --platform windows --build-only --accept-nvidia-license "$RUNNER_TEMP/ngx-sdk"
- name: hookshot_vk.dll with NVIDIA DLSS and AMD FSR 4
env:
RX_VK_ONLY: '1'
RX_RELEASE: '1'
HOOKSHOT_FSR: '1'
run: |
OOT_WORK="$RUNNER_TEMP/vk-work" RX_CPM="$GITHUB_WORKSPACE/_deps/cpm" HOOKSHOT_NGX_SDK="$RUNNER_TEMP/ngx-sdk" \
python -I nx2/build.py --standalone --jobs "$NUMBER_OF_PROCESSORS" | tee "$RUNNER_TEMP/vk-build.log"
test "${PIPESTATUS[0]}" -eq 0
grep -q "with NVIDIA DLSS" "$RUNNER_TEMP/vk-build.log"
grep -q "with AMD FSR 4" "$RUNNER_TEMP/vk-build.log"
# (what it loads is only Windows' own: the system DLLs and the UCRT's api-ms-win-crt-*. NVIDIA's runtime, nvngx_dlss.dll,
# is loaded by NGX at run time from the game folder's ngx folder, and its core, _nvngx.dll, from the driver's)
- name: Imports
run: |
dll="$RUNNER_TEMP/vk-work/sa/build/hookshot_vk.dll"
"$HOOKSHOT_MINGW/bin/llvm-objdump" -p "$dll" | sed -n 's/^ *DLL Name: //p' | tr -d '\r' | sort -u | tee "$RUNNER_TEMP/imports.txt"
if grep -viE '^(kernel32|user32|gdi32|advapi32)\.dll$|^api-ms-win-crt-[a-z0-9-]+\.dll$' "$RUNNER_TEMP/imports.txt"; then
echo "::error::hookshot_vk.dll with NVIDIA DLSS imports a DLL that is not Windows' own (above)"
exit 1
fi

241
.github/workflows/windows-builder.yml vendored Normal file
View File

@@ -0,0 +1,241 @@
# What a Windows player downloads, made without game data: HookshotBuilder-Setup.exe (builder/setup/setup.c, with
# llvm-mingw) and the Hookshot Builder package (dotnet publish, versioned from the tag as docs/versioning.md says), split
# into the parts the setup downloads by scripts/make_setup_parts.py. The Python, emsdk, CPM and wgpu-native parts, and the
# third_party part's prebuilt files, are the latest release's (scripts/release_parts.py). The Windows Vulkan back end is
# compiled too, with the same llvm-mingw: players build it on their PC, this only checks that it still builds.
# A workflow artifact on every run; on a tag, the new parts go to the builder-parts release and the setup
# (HookshotBuilder.exe) and its list (hookshot-setup.txt) to the tag's release, beside the Linux AppImage.
name: Windows builder
on:
push:
branches: [main]
tags: ['*']
pull_request:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
defaults:
run:
shell: bash
jobs:
package:
name: Hookshot Builder package and setup
# (builder-parts holds the installer's parts: no package there)
if: github.ref_name != 'builder-parts'
runs-on: windows-2022
timeout-minutes: 30
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# (the version is git describe's: the tags and the history since them)
fetch-depth: 0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: '3.12'
- name: Set up .NET
uses: actions/setup-dotnet@0f4a354dd5547a28c70b7853dbd95d5b67886e73 # v6.1.0
with:
dotnet-version: '8.0.x'
- name: llvm-mingw version
id: llvm
run: echo "name=$(python -I scripts/release_parts.py llvm-mingw --name)" >> "$GITHUB_OUTPUT"
# (a release unpacks llvm-mingw from its checked download, not from a cache other runs write)
- if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/llvm
key: ${{ steps.llvm.outputs.name }}
- name: llvm-mingw
run: echo "LLVM_MINGW=$(python -I scripts/release_parts.py llvm-mingw "$RUNNER_TEMP/llvm")" >> "$GITHUB_ENV"
# (a tag is its own version; any other commit is git describe's: v2.0.1-3-g1a2b3c4, version 2.0.1-3-g1a2b3c4)
- name: Version
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
tag=$GITHUB_REF_NAME
else
tag=$(git describe --tags --match 'v[0-9]*' 2>/dev/null || echo "v0.0.0-$(git rev-parse --short HEAD)")
fi
echo "TAG=$tag" >> "$GITHUB_ENV"
echo "VERSION=${tag#v}" >> "$GITHUB_ENV"
echo "version: $tag"
# (the list of the newest stable release other than this tag: its Python, emsdk, CPM, wgpu-native and third_party
# parts and its play profile. A fork with no release takes upstream's. A release must have one; any other run goes
# on without, and its package lacks those parts)
- name: The latest release's setup list
env:
GH_TOKEN: ${{ github.token }}
run: |
if python -I scripts/release_parts.py previous "$RUNNER_TEMP/previous-setup.txt" \
--repo "$GITHUB_REPOSITORY" --repo NotRexed/Hookshot --skip-tag "$TAG"; then
echo "PREVIOUS=$RUNNER_TEMP/previous-setup.txt" >> "$GITHUB_ENV"
elif [[ $GITHUB_REF == refs/tags/* ]]; then
exit 1
else
echo "::warning::no earlier release's setup list: the package has only the app and .NET parts"
fi
# (work/hookshot.ico is the builder's icon, builder/HookshotBuilder/HookshotBuilder.csproj)
- name: Play profile
if: env.PREVIOUS != ''
run: python -I scripts/release_parts.py profile "$PREVIOUS" work
# (--dependent-load-flag 0x800, LOAD_LIBRARY_SEARCH_SYSTEM32: the libraries it imports come from System32, not from
# the folder it was downloaded to)
- name: HookshotBuilder-Setup.exe
working-directory: builder/setup
run: |
"$LLVM_MINGW/bin/x86_64-w64-mingw32-windres" setup.rc -O coff -o "$RUNNER_TEMP/setup_rc.o"
"$LLVM_MINGW/bin/x86_64-w64-mingw32-clang" -O2 -mwindows -municode setup.c "$RUNNER_TEMP/setup_rc.o" \
-lwinhttp -lbcrypt -lcomctl32 -lshell32 -lole32 -Wl,--dependent-load-flag=0x800 \
-o "$RUNNER_TEMP/HookshotBuilder-Setup.exe"
ls -l "$RUNNER_TEMP/HookshotBuilder-Setup.exe"
- name: Hookshot Builder
run: >-
dotnet publish builder/HookshotBuilder/HookshotBuilder.csproj --configuration Release
-p:Version="$VERSION" -p:NuGetAudit=false --output "$RUNNER_TEMP/publish"
- name: Package folder
run: >-
python -I scripts/release_parts.py package "$RUNNER_TEMP/package"
--publish "$RUNNER_TEMP/publish" --setup "$RUNNER_TEMP/HookshotBuilder-Setup.exe"
${PREVIOUS:+--list "$PREVIOUS" --python-packages nx2/prompt_requirements.txt}
- name: Setup parts
run: |
python -I scripts/make_setup_parts.py "$RUNNER_TEMP/package" "$TAG" dist \
--base "https://github.com/$GITHUB_REPOSITORY/releases/download/builder-parts" ${PREVIOUS:+--reuse "$PREVIOUS"}
# (a release holds the setup as HookshotBuilder.exe: builder/HookshotBuilder/Updater.cs)
cp "$RUNNER_TEMP/HookshotBuilder-Setup.exe" dist/HookshotBuilder.exe
# (RecompLauncher installs this zip: the setup beside its recomplauncher.json, named for its system and processor)
python -I - "dist/Hookshot-$TAG-Windows-x64.zip" <<'PY'
import sys, zipfile
with zipfile.ZipFile(sys.argv[1], "w", zipfile.ZIP_DEFLATED) as z:
z.write("dist/HookshotBuilder.exe", "HookshotBuilder.exe")
z.write("recomplauncher.json", "recomplauncher.json")
PY
cat dist/hookshot-setup.txt
ls -l dist
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: HookshotBuilder-windows
path: dist/
if-no-files-found: error
vulkan:
name: Windows Vulkan back end (llvm-mingw)
if: github.ref_name != 'builder-parts'
runs-on: windows-2022
timeout-minutes: 45
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# (the headers in the CPM cache layout nx2/build.py reads, at the versions scripts/linux/deps.sh pins)
- name: Check out pinned Vulkan headers
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: KhronosGroup/Vulkan-Headers
ref: 74d8a6cb930c68ef617b202c3ff3c59d919e086b # v1.4.345
path: _deps/cpm/vulkanheaders/v1.4.345
persist-credentials: false
- name: Check out pinned SPIR-V headers
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: KhronosGroup/SPIRV-Headers
ref: 04f10f650d514df88b76d25e83db360142c7b174 # vulkan-sdk-1.4.341.0
path: _deps/cpm/spirv-headers/vulkan-sdk-1.4.341.0
persist-credentials: false
- name: Check out pinned VulkanMemoryAllocator
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator
ref: 1d8f600fd424278486eade7ed3e877c99f0846b1 # v3.3.0
path: _deps/cpm/vulkanmemoryallocator/v3.3.0
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@6d4fd22b20465ccc0f7354476588e8df7c9ca0e0 # v7.1.0
with:
python-version: '3.12'
- name: llvm-mingw version
id: llvm
run: echo "name=$(python -I scripts/release_parts.py llvm-mingw --name)" >> "$GITHUB_OUTPUT"
# (a release unpacks llvm-mingw from its checked download, not from a cache other runs write)
- if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/llvm
key: ${{ steps.llvm.outputs.name }}
- name: llvm-mingw
run: echo "HOOKSHOT_MINGW=$(python -I scripts/release_parts.py llvm-mingw "$RUNNER_TEMP/llvm")" >> "$GITHUB_ENV"
# (as scripts/linux/appimage.sh builds Linux's: the back end alone, no lift, no game)
- name: hookshot_vk.dll
env:
RX_VK_ONLY: '1'
RX_RELEASE: '1'
run: |
OOT_WORK="$RUNNER_TEMP/vk-work" RX_CPM="$GITHUB_WORKSPACE/_deps/cpm" \
python -I nx2/build.py --standalone --jobs "$NUMBER_OF_PROCESSORS"
ls -l "$RUNNER_TEMP/vk-work/sa/build/hookshot_vk.dll"
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: hookshot_vk-windows
path: ${{ runner.temp }}/vk-work/sa/build/hookshot_vk.dll
if-no-files-found: error
release:
name: Release assets
# (off until the maintainer switches it on: releases are published by hand with HookshotBuilder.exe and hookshot-setup.txt,
# and a second upload of them on the tag would race that. Set vars.CI_RELEASE_WINDOWS to 'true' to turn it on)
if: startsWith(github.ref, 'refs/tags/') && github.ref_name != 'builder-parts' && vars.CI_RELEASE_WINDOWS == 'true'
needs: [package, vulkan]
runs-on: ubuntu-24.04
timeout-minutes: 15
permissions:
contents: write
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
steps:
- name: Check out source
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: HookshotBuilder-windows
path: dist
# (named by their SHA-256: a part already there is the same file and is not uploaded again. Before the list, which
# names them)
- name: New parts to builder-parts
run: |
if ! gh release view builder-parts >/dev/null 2>&1; then
gh release create builder-parts --prerelease --latest=false --target "$GITHUB_SHA" --title builder-parts \
--notes "The parts HookshotBuilder-Setup.exe downloads, named by each release's hookshot-setup.txt."
fi
have=$(gh release view builder-parts --json assets --jq '.assets[].name')
for f in dist/HookshotBuilder-*.zip; do
if grep -qxF "$(basename "$f")" <<<"$have"; then
echo "$(basename "$f"): already there"
else
gh release upload builder-parts "$f"
fi
done
- name: Setup and its list to the release
run: scripts/release_upload.sh "$GITHUB_REF_NAME" dist/HookshotBuilder.exe dist/hookshot-setup.txt dist/Hookshot-*-Windows-x64.zip