mirror of
https://github.com/MacosPorters/betterxen.git
synced 2026-11-26 04:19:52 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2713c9e049 | ||
|
|
bd13b17f30 | ||
|
|
b23e6fd6e5 | ||
|
|
d2ca4c3995 | ||
|
|
59b6c4db5e | ||
|
|
8fbef1e31f |
No files matched your search
@@ -12,6 +12,7 @@ remains unsupported.
|
||||
### Added
|
||||
- Review follow-up on the proposed `victory-shader` import (#394): `translate_native` now reports immediate samplers as static samplers (a sampled texel read 0 on the GPU before), BetterXen's GPU tests use a host that `VICTORY_WARP` cannot redirect, the double-precision probes take run-time operands and were rerun (same result), and a per-file provenance review records that the crate was developed against one commercial title's shaders. **The import is not approved; a maintainer decision is required** (`docs/research/victory-shader-provenance.md`). Earlier statements that the crate had nothing game-specific are withdrawn.
|
||||
- Fixed the two wave-operation failures the vendored victory-shader tests showed under D3DMetal (`docs/research/shader-wave-semantics.md`). Device capabilities were measured with a new original D3D12 host (`workloads/d3d12-wave-probe`): shader model 6.6, wave operations, waves exactly 32 lanes, no double-precision shader operations. One failure was a wrong test precondition (a 64-lane lowering run on the 32-lane device); the test now checks the device width and asserts the recompiler's refusal. The other was unsupported double-precision operations: shaders compiled from original HLSL by Microsoft's DXC that use a `double` ran without writing anything, while float wave operations worked. The recompiler's one native-double site (`active_f64_sum`) now builds the console's balanced sum tree with its existing integer fp64 add and no longer declares doubles. Local results on one Apple M4 under CrossOver 26.3, not independently reproduced: the whole suite passes (229 passed, 3 ignored; the vendored original had 2 failures); 24 new GPU cases compare full 64-bit sums with a CPU model of the tree; both regression tests fail against the original lowering. Cost not measured; tree-order fidelity relies on the recompiler's own recognizer.
|
||||
- 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 ten tests or the whole upstream suite. It takes both the runner and the test executable from the messages of the cargo invocations that built them, and stops if a build fails (review fix: an earlier version piped cargo into the parser, so a failed build exited 0 and ran a stale executable, and it assumed the runner was under `target/`). `scripts/hybrid/test-run-shader-gpu-tests.sh` is a stubbed regression test for both. 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; there is no fallback to a guessed path. 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.
|
||||
|
||||
Executable
+67
@@ -0,0 +1,67 @@
|
||||
#!/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"
|
||||
# Both executables are taken from the messages of the cargo invocation that built them, and only
|
||||
# when that invocation succeeded: no path is guessed and nothing left over from an earlier build can
|
||||
# be run. (Cargo is not piped into the parser: under /bin/sh a pipeline reports only the parser's
|
||||
# exit status.)
|
||||
LOG=$(mktemp)
|
||||
trap 'rm -f "$LOG"' EXIT
|
||||
# built_exe <target name> <is test: true|false>: the executable named in $LOG.
|
||||
built_exe() {
|
||||
python3 -I -c '
|
||||
import json, sys
|
||||
name, test, exe = sys.argv[1], sys.argv[2] == "true", ""
|
||||
for line in open(sys.argv[3]):
|
||||
try:
|
||||
m = json.loads(line)
|
||||
except ValueError:
|
||||
continue
|
||||
t = m.get("target", {})
|
||||
if (m.get("reason") == "compiler-artifact" and m.get("executable")
|
||||
and t.get("name", "").replace("-", "_") == name
|
||||
and bool(m.get("profile", {}).get("test")) == test):
|
||||
exe = m["executable"]
|
||||
print(exe)' "$1" "$2" "$LOG"
|
||||
}
|
||||
|
||||
# The host tool first, before the environment is pointed at the Windows toolchain.
|
||||
rustup run 1.100.0 cargo build -q -p betterxen-hybrid --message-format=json-render-diagnostics >"$LOG" \
|
||||
|| { echo "building betterxen-hybrid failed" >&2; exit 1; }
|
||||
B=$(built_exe betterxen_hybrid false)
|
||||
[ -n "$B" ] && [ -x "$B" ] || { echo "the host build named no betterxen-hybrid executable" >&2; exit 1; }
|
||||
|
||||
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"
|
||||
rustup run 1.100.0 cargo test -q -p victory-shader --target x86_64-pc-windows-gnullvm --no-run \
|
||||
--message-format=json-render-diagnostics >"$LOG" \
|
||||
|| { echo "building the victory-shader test executable failed" >&2; exit 1; }
|
||||
EXE=$(built_exe victory_shader true)
|
||||
[ -n "$EXE" ] && [ -f "$EXE" ] || { echo "the build named no 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; }
|
||||
rm -f "$LOG"
|
||||
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
|
||||
# The exact count is deliberate: a looser marker would also accept a filter that matches nothing
|
||||
# ("0 passed"). Update it when BetterXen adds or removes tests in emit/betterxen_tests.rs.
|
||||
exec "$B" run --bottle "$BOTTLE" --timeout 300 --stall-timeout 120 --expect "test result: ok. 10 passed" \
|
||||
--out artifacts/hybrid-runs -- "$EXE" betterxen --test-threads=1
|
||||
fi
|
||||
Executable
+79
@@ -0,0 +1,79 @@
|
||||
#!/bin/sh
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
# Regression test for run-shader-gpu-tests.sh with a stubbed `rustup`/cargo and a stubbed runner:
|
||||
# no toolchain, CrossOver or GPU is needed. Checks that
|
||||
# 1. a failed Windows test build stops the script and the runner is never invoked, even when an
|
||||
# older test executable is lying in the target directory;
|
||||
# 2. a successful build runs exactly the executable that build named;
|
||||
# 3. the host runner is the one the host build named, also with an inherited CARGO_TARGET_DIR.
|
||||
set -u
|
||||
HERE=$(cd "$(dirname "$0")" && pwd)
|
||||
T=$(mktemp -d)
|
||||
trap 'rm -rf "$T"' EXIT
|
||||
fails=0
|
||||
check() { if eval "$2"; then echo "ok $1"; else echo "FAIL $1"; fails=1; fi; }
|
||||
|
||||
# A file `file` reports as an x86-64 PE32+ executable.
|
||||
make_pe() {
|
||||
python3 -I -c '
|
||||
import struct, sys
|
||||
b = bytearray(512); b[0:2] = b"MZ"; struct.pack_into("<I", b, 0x3C, 0x80)
|
||||
b[0x80:0x84] = b"PE\0\0"; struct.pack_into("<HHIIIHH", b, 0x84, 0x8664, 0, 0, 0, 0, 240, 0x22)
|
||||
struct.pack_into("<H", b, 0x98, 0x20B); struct.pack_into("<H", b, 0x98 + 68, 3)
|
||||
open(sys.argv[1], "wb").write(b)' "$1"
|
||||
}
|
||||
|
||||
setup() { # $1 = case directory
|
||||
R=$1/repo
|
||||
mkdir -p "$R/scripts/hybrid" "$1/bin" "$1/tc/bin"
|
||||
cp "$HERE/run-shader-gpu-tests.sh" "$R/scripts/hybrid/"
|
||||
: > "$1/tc/bin/x86_64-w64-mingw32-clang"; chmod +x "$1/tc/bin/x86_64-w64-mingw32-clang"
|
||||
# The stub runner records how it was called.
|
||||
runner() { mkdir -p "$(dirname "$1")"; printf '#!/bin/sh\necho "$0 $*" >> "%s"\n' "$2" > "$1"; chmod +x "$1"; }
|
||||
# A runner left over from an earlier build at the old hard-coded place.
|
||||
runner "$R/target/debug/betterxen-hybrid" "$1/stale-runner.log"
|
||||
# An older test executable lying around in the target directory.
|
||||
old="$R/artifacts/victory-win/x86_64-pc-windows-gnullvm/debug/deps"
|
||||
mkdir -p "$old"; make_pe "$old/victory_shader-0000stale.exe"
|
||||
cat > "$1/bin/rustup" <<STUB
|
||||
#!/bin/sh
|
||||
# stands in for: rustup run 1.100.0 cargo <build|test> ...
|
||||
shift 3
|
||||
cmd=\$1
|
||||
dir=\${CARGO_TARGET_DIR:-$R/target}
|
||||
case "\$cmd" in
|
||||
build)
|
||||
mkdir -p "\$dir/debug"
|
||||
printf '#!/bin/sh\necho "\$0 \$*" >> "%s"\n' "$1/runner.log" > "\$dir/debug/betterxen-hybrid"
|
||||
chmod +x "\$dir/debug/betterxen-hybrid"
|
||||
echo "{\"reason\":\"compiler-artifact\",\"target\":{\"name\":\"betterxen-hybrid\",\"kind\":[\"bin\"]},\"profile\":{\"test\":false},\"executable\":\"\$dir/debug/betterxen-hybrid\"}"
|
||||
;;
|
||||
test)
|
||||
[ "\${STUB_TEST_BUILD_FAILS:-0}" = 1 ] && exit 101
|
||||
mkdir -p "\$dir/fresh"; cp "$old/victory_shader-0000stale.exe" "\$dir/fresh/victory_shader-1111new.exe"
|
||||
echo "{\"reason\":\"compiler-artifact\",\"target\":{\"name\":\"victory_shader\",\"kind\":[\"lib\"]},\"profile\":{\"test\":true},\"executable\":\"\$dir/fresh/victory_shader-1111new.exe\"}"
|
||||
;;
|
||||
esac
|
||||
STUB
|
||||
chmod +x "$1/bin/rustup"
|
||||
}
|
||||
|
||||
# 1. failed test build
|
||||
c=$T/fail; setup "$c"
|
||||
STUB_TEST_BUILD_FAILS=1 PATH="$c/bin:$PATH" sh "$c/repo/scripts/hybrid/run-shader-gpu-tests.sh" "$c/tc" >/dev/null 2>&1; rc=$?
|
||||
check "failed build: script exits non-zero (got $rc)" "[ $rc -ne 0 ]"
|
||||
check "failed build: no runner is invoked" "[ ! -e '$c/runner.log' ] && [ ! -e '$c/stale-runner.log' ]"
|
||||
|
||||
# 2. successful build
|
||||
c=$T/ok; setup "$c"
|
||||
PATH="$c/bin:$PATH" sh "$c/repo/scripts/hybrid/run-shader-gpu-tests.sh" "$c/tc" >/dev/null 2>&1; rc=$?
|
||||
check "good build: script succeeds (got $rc)" "[ $rc -eq 0 ]"
|
||||
check "good build: runs the executable this build named" "grep -q 'victory_shader-1111new.exe' '$c/runner.log' 2>/dev/null"
|
||||
|
||||
# 3. inherited CARGO_TARGET_DIR
|
||||
c=$T/dir; setup "$c"
|
||||
CARGO_TARGET_DIR="$c/elsewhere" PATH="$c/bin:$PATH" sh "$c/repo/scripts/hybrid/run-shader-gpu-tests.sh" "$c/tc" >/dev/null 2>&1; rc=$?
|
||||
check "inherited target dir: script succeeds (got $rc)" "[ $rc -eq 0 ]"
|
||||
check "inherited target dir: the freshly built runner is used" "grep -q '$c/elsewhere/debug/betterxen-hybrid' '$c/runner.log' 2>/dev/null"
|
||||
check "inherited target dir: the stale runner is not used" "[ ! -e '$c/stale-runner.log' ]"
|
||||
exit $fails
|
||||
Reference in new issue
Block a user