gpu(native): detile big textures on the rayon pool #604
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/604"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T11:57:02Z.
Refs #179
What
A changed texture was detiled mip by mip, slice by slice on a single submission thread. A 4K RGBA texture (32 MiB mip 0) spent its whole detile serialized on one core while the other 11 idled — the dominant CPU cost of uploading a big streamed texture, and exactly what stands between the native host and Series X-class frame times on M1.
Each (mip, slice) level reads the tiled bytes and writes only its own staging buffer, so levels are independent:
detile_changednow collects the work items and runs them on the rayon pool when the texture is at least 1 MiB. Smaller textures stay serial (no pool scheduling overhead). The all-zero fine-mip skip now checks its slices withinto_par_iter().all(..)on big textures, andis_all_zerochecks ranges >= 1 MiB withpar_iteras well.Results are sorted back into (mip, slice) order, so upload order and the
detiled_mipsbitmask are exactly what the serial loop produced. Error behavior: the first error is reported, as before.Adds
rayonas a workspace dependency ofvictory-gpu(already in the lock via blake3's rayon feature; therayoncrate itself is new to the lock).Correctness
A unit test detile a 1024x1024 array-of-4 RGBA texture (22 MiB, takes the parallel path) with
uploaded_mips = u32::MAXand compares every level — mip, slice, row, slice_pitch, and every texel byte — against the serial per-leveldetile_level, plus the bitmask.Testing
cargo test -p victory-hle -p victory -p victory-gpu -p xtask(host arm64) — all pass, incl.detile_changed_parallel_path_matches_serial_level_by_levelcargo test --target x86_64-apple-darwin -p victory-gpu --lib textures::— 19 pass, 0 failcargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings— cleancargo xtask policy— 404 files okChecklist
vibe/detile-rayon-1705acfromupstream/main, pushed to my fork onlyImported from LakshanSivakumar/Native-Victory-macOS. Originally posted by AnastasisKon on 2026-11-28T12:05:08Z.
CI green (check + macos-scripts SUCCESS), marked ready for review.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.