mirror of
https://github.com/shinyobjectz/raea.git
synced 2026-12-01 12:44:11 -10:00
sdk/raea/bench/bevy-plugins/hanabi.tsx, with seed 7 on both fountains, differed from itself on the same build: 110 to 113 of its 120 frame hashes, from frame 7 or so (seen in #38's live-3d corpus as a route difference; it wasn't one). Only the alpha-blended fountain varied. bevy_hanabi (rev 77630ff) builds its draw list with atomicAdd, so blended particles drew in an order that changed from run to run, and it seeds a new particle from the dead slot it recycles, which threads take in atomic order too, so once particles die the new ones differed as well. vendor/bevy_hanabi is that rev, src/ byte for byte but for four files, all marked raea: (tools/vendor: 104 lines): - vfx_init.wesl: a new particle's seed is its index in this frame's spawns, not its slot; - mod.rs, sort.rs, vfx_sort_fill.wesl: blended effects (not opaque, not alpha-masked) go through the sort pass that only ribbons used, keyed by view depth from the main camera (the near plane of SimParams' frustum, which sort-fill now binds), far first as Bevy sorts its transparent phase, AGE breaking ties. The sort's layout key no longer needs RIBBON_ID or AGE. Its Cargo.toml drops the examples, GPU tests, dev-dependencies and [workspace] (Cargo.toml.orig is upstream's). A git [patch] in the root Cargo.toml points at it; only the plugin build compiles it (raea-cli without plugins doesn't). LICENSES/bevy_hanabi moves into the vendored folder, as for the other vendored crates (tools/licenses.sh). engine/bevy-plugins' hanabi.rs tags the first 3D camera HanabiMainCamera, so the sort has a camera. bench/hanabi-repeat/check.sh renders it 4 times on the program route: before, 110 to 113 of 120 frames differed run to run; now every frame is the same, and program vs live (RAEA_LIVE3D_CHECK) matches on all 120 frames. At frame 30, before any particle dies, sorted vs unsorted (the same build, sort switched off) differs in 9 pixels, as two unsorted runs do (8.5): order where particles overlap, not coverage. bevy-ts plugin-hanabi passes.
24 lines
1.6 KiB
Bash
Executable File
24 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
# #52: GPU particles rendered again give the same frames. sdk/raea/bench/bevy-plugins/hanabi.tsx (two seeded fountains,
|
|
# one opaque and one alpha-blended) is rendered RUNS times (4), all 120 frames to hashes, and every run must match the
|
|
# first. Before vendor/bevy_hanabi, its draw list and its recycled slots were taken with GPU atomics, in an order that
|
|
# changed from run to run: the blended fountain differed from frame 7 or so (draw order), and once particles died both
|
|
# could (a new particle was seeded by the slot it took). Needs the plugin build.
|
|
# bench/hanabi-repeat/check.sh (RAEA_PLUGIN_BIN: the plugin build, default sdk/raea/bench/bevy-plugins/motion.sh;
|
|
# RUNS: how many runs)
|
|
cd "$(dirname "$0")/../.." || exit 2
|
|
BIN=${RAEA_PLUGIN_BIN:-$PWD/sdk/raea/bench/bevy-plugins/motion.sh}
|
|
RUNS=${RUNS:-4}
|
|
export RAEA_SIGN=0 RAEA_MARK=0 RAEA_EXPORT_CACHE=0 RAEA_3D=program
|
|
OUT=$(mktemp -d "${TMPDIR:-/tmp}/raea-hanabi-repeat.XXXXXX")
|
|
trap 'rm -rf "$OUT"' EXIT
|
|
status=0
|
|
for i in $(seq 1 "$RUNS"); do
|
|
"$BIN" render sdk/raea/bench/bevy-plugins/hanabi.tsx -o "$OUT/$i.txt" > "$OUT/$i.log" 2>&1 || { echo "FAIL: run $i failed"; tail -5 "$OUT/$i.log"; exit 1; }
|
|
[ "$i" = 1 ] && continue
|
|
d=$(diff "$OUT/1.txt" "$OUT/$i.txt" | grep '^<' | cut -d' ' -f2 | head -5 | tr '\n' ' ')
|
|
[ -z "$d" ] || { echo "FAIL: run $i differs from run 1 at frames ${d}($(diff "$OUT/1.txt" "$OUT/$i.txt" | grep -c '^<') of $(wc -l < "$OUT/1.txt"))"; status=1; }
|
|
done
|
|
[ $status = 0 ] && echo "PASS: $RUNS runs of hanabi, every frame the same"
|
|
exit $status
|