Add the shader GPU test runner script, locating the test executable through cargo's build message

This commit is contained in:
atharvranjan committed 2026-11-25 16:03:39 -06:00
1 parent 6fd254825d
commit 8fbef1e31f
2 files changed
+53

No files matched your search

+1
View File
@@ -10,6 +10,7 @@ Guest execution uses original, purpose-built test programs. Commercial Xbox game
remains unsupported.
### Added
- Added `scripts/hybrid/run-shader-gpu-tests.sh`, which cross-builds the vendored `victory-shader` test executable for Windows and runs it under CrossOver through `betterxen-hybrid run` (supervision, memory guard, stall detection, JSON record), either BetterXen's four fixture tests or the whole upstream suite. It takes the test executable's path from cargo's own build message instead of guessing the target layout (the first version looked in `debug/build/.../out/`; the usual location is `debug/deps/`, which is the fallback). It needs the runner from #384 and #388. Verified on the Apple M4 with CrossOver 26.3: fixtures pass; the whole suite shows the known failures; the `debug/deps` fallback is untested on this machine, whose cargo layout puts the executable elsewhere. Not independently reviewed.
- Integrated skakwy's `victory-shader` (GFX10/RDNA 2 machine code to DXIL SM 6.6 recompiler, about 43,500 lines of Rust) as `crates/victory-shader`, with provenance in its `UPSTREAM.md`, the Mesa notice preserved and 19 lines of lint-only edits to upstream files. Added `translate_native` and tests that translate BetterXen's own gfx1030 fixtures to DXIL and, on Windows targets, run them on the GPU through D3D12. Local results on one Apple M4 with CrossOver 26.3 (D3DMetal), not independently reproduced: 177 upstream CPU-side tests pass on macOS; all 6 fixtures with expected words matched the manifest on the GPU, with a negative control; the GPU tests fail without D3D12 instead of skipping; the full upstream suite under CrossOver has 224 passed, 2 failed, 3 ignored. DXIL validation by `dxil.dll` was not run. The native RDNA-to-Metal compiler is unchanged. See `docs/research/victory-shader-integration.md`.
- Added the upstream research registry and component reuse matrix (`docs/research/`), a public-documentation review (evidence class D, nothing executed) of CrossOver, Wine, DXMT, DXVK, VKD3D-Proton, MoltenVK, FEX, VIctory, VIctory-macOS and PortWatch. VIctory-family projects are excluded from reuse on provenance grounds. The GitHub project board is not yet configured because the token lacks the `project` scope (#346).
- Added hybrid research records: `docs/research/hybrid-backlog-research-2026-11-25.md` (findings and registry candidates, from search summaries) and `docs/research/primary-source-verification-2026-11-25.md` (re-check against CodeWeavers, Apple, DXMT and Wine primary pages). It confirms CrossOver's backend list, finds no public documentation of `CX_GRAPHICS_BACKEND`, and records that two Apple notices on Rosetta's end disagree; D3DMetal's license text and CrossOver's Rosetta and ARM64 plans remain unverified. Eleven issues created from the research were reviewed the same day: #364 and #365 stay in Phase 1, the others are parked and recorded under "Parked ideas" in the roadmap. Rust 1.100.0 (already installed) is the required toolchain; the default `stable` was 1.94.1. Planning only; nothing was installed or run.
+52
View File
@@ -0,0 +1,52 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-3.0-or-later
# Cross-build the vendored victory-shader test executable for Windows and run it under an
# installed CrossOver through `betterxen-hybrid run`, so every GPU test goes through D3D12 on the
# host Apple GPU (D3DMetal). Writes JSON run records under artifacts/hybrid-runs/.
#
# scripts/hybrid/run-shader-gpu-tests.sh <llvm-mingw-dir> [bottle] [fixtures|all]
#
# `fixtures` (default) runs only BetterXen's own gfx1030 fixtures through the recompiler and
# D3D12; `all` runs the whole upstream suite, which currently has two known failures on D3DMetal
# (see docs/research/victory-shader-integration.md). Needs: Rust 1.100.0 with the
# x86_64-pc-windows-gnullvm target, an unpacked llvm-mingw, CrossOver, and a bottle.
set -eu
TC=${1:?usage: $0 <llvm-mingw-dir> [bottle] [fixtures|all]}
BOTTLE=${2:-betterxen-test}
WHICH=${3:-fixtures}
ROOT=$(cd "$(dirname "$0")/../.." && pwd)
cd "$ROOT"
# Build the host tool first, into the normal target directory, before the Windows build redirects it.
rustup run 1.100.0 cargo build -q -p betterxen-hybrid
export PATH="$TC/bin:$PATH"
export CARGO_TARGET_X86_64_PC_WINDOWS_GNULLVM_LINKER="$TC/bin/x86_64-w64-mingw32-clang"
export CARGO_TARGET_DIR="$ROOT/artifacts/victory-win"
# Build the Windows test executable and take its path from cargo's own build message. It normally
# lands in <target>/x86_64-pc-windows-gnullvm/debug/deps/, but cargo's layout can differ with the
# build configuration, so the path is not guessed; `deps/` is only the fallback.
EXE=$(rustup run 1.100.0 cargo test -q -p victory-shader --target x86_64-pc-windows-gnullvm --no-run \
--message-format=json | python3 -I -c '
import json, sys
exe = None
for line in sys.stdin:
try:
m = json.loads(line)
except ValueError:
continue
if m.get("reason") == "compiler-artifact" and m.get("profile", {}).get("test") \
and m.get("target", {}).get("name") in ("victory_shader", "victory-shader") and m.get("executable"):
exe = m["executable"]
print(exe or "")')
if [ -z "$EXE" ]; then
EXE=$(ls -t "$CARGO_TARGET_DIR"/x86_64-pc-windows-gnullvm/debug/deps/victory_shader-*.exe 2>/dev/null | head -1)
fi
[ -n "$EXE" ] && [ -f "$EXE" ] || { echo "could not find the victory-shader test executable" >&2; exit 1; }
file "$EXE" | grep -q "PE32+ executable.*x86-64" || { echo "not an x86-64 PE: $EXE" >&2; exit 1; }
B="$ROOT/target/debug/betterxen-hybrid"
if [ "$WHICH" = all ]; then
exec "$B" run --bottle "$BOTTLE" --timeout 900 --stall-timeout 120 --expect "test result: ok" \
--out artifacts/hybrid-runs -- "$EXE" --test-threads=1
else
exec "$B" run --bottle "$BOTTLE" --timeout 300 --stall-timeout 120 --expect "test result: ok. 4 passed" \
--out artifacts/hybrid-runs -- "$EXE" betterxen --test-threads=1
fi