perf(victory-formats): add packed-linear and 64/256-byte chunked detile/tile fast paths #410

Closed
github-bot wants to merge 1 commit from github-bot/gh-410 into main AGit
Owner

@⁠Lewandox on GitHub · 2026-11-26 17:52 UTC · original
Lewandox:perf/formats-texture-linear-and-wide-runs → main · +104 −3 · 1 files · 1 commits · closed without merging

Summary

Speeds up texture tiling and detiling in victory_formats::texture::Layout (third_party/victory/crates/victory-formats/src/texture.rs):

  1. Packed-linear whole-slice fast path:
    • When Swizzle::LINEAR has matching source/destination row pitch (row_pitch == bytes && m.pitch * element_bytes == bytes), copies each 2D slice in a single copy_from_slice instead of looping row-by-row.
  2. Wide fixed-chunk fast paths (64 and 256 bytes) for both non-XOR and XOR swizzles:
    • Adds 64-byte and 256-byte specialized copy_runs arms (matching common 16-byte BC3/BC5/BC7/RGBA32F micro-tile run sizes on Series X) alongside the existing 8, 16, and 32-byte paths.
    • Applies the same fixed-size chunked copy_runs_xor fast path (8, 16, 32, 64, 256) to XOR-swizzled modes (SW_64KB_*_X) when row_base, xor, and run offsets are aligned to the chunk size, eliminating per-run slice bounds checks in the inner loop.
  3. Unit test:
    • Adds packed_linear_and_wide_runs_round_trip verifying bit-exact tile and detile output against Layout::offset across LINEAR, SW_64KB_S, SW_64KB_S_X, and SW_64KB_R_X.

Verification

  • cargo test -p victory-formats --lib texture
  • cargo xtask policy inside third_party/victory
**@⁠Lewandox** on GitHub · 2026-11-26 17:52 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/410) `Lewandox:perf/formats-texture-linear-and-wide-runs` → `main` · +104 −3 · 1 files · 1 commits · closed without merging ## Summary Speeds up texture tiling and detiling in `victory_formats::texture::Layout` (`third_party/victory/crates/victory-formats/src/texture.rs`): 1. **Packed-linear whole-slice fast path**: - When `Swizzle::LINEAR` has matching source/destination row pitch (`row_pitch == bytes && m.pitch * element_bytes == bytes`), copies each 2D slice in a single `copy_from_slice` instead of looping row-by-row. 2. **Wide fixed-chunk fast paths (`64` and `256` bytes) for both non-XOR and XOR swizzles**: - Adds `64`-byte and `256`-byte specialized `copy_runs` arms (matching common 16-byte BC3/BC5/BC7/RGBA32F micro-tile run sizes on Series X) alongside the existing `8`, `16`, and `32`-byte paths. - Applies the same fixed-size chunked `copy_runs_xor` fast path (`8`, `16`, `32`, `64`, `256`) to XOR-swizzled modes (`SW_64KB_*_X`) when `row_base`, `xor`, and run offsets are aligned to the chunk size, eliminating per-run slice bounds checks in the inner loop. 3. **Unit test**: - Adds `packed_linear_and_wide_runs_round_trip` verifying bit-exact `tile` and `detile` output against `Layout::offset` across `LINEAR`, `SW_64KB_S`, `SW_64KB_S_X`, and `SW_64KB_R_X`. ## Verification - `cargo test -p victory-formats --lib texture` - `cargo xtask policy` inside `third_party/victory`
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 17:52:29 +00:00
github-bot force-pushed github-bot/gh-410 from 382b315003 to 9f468b4270 2026-11-26 19:34:51 +00:00 Compare
github-bot force-pushed github-bot/gh-410 from 9f468b4270 to 7b8d8171b7 2026-11-27 00:36:08 +00:00 Compare
github-bot closed this pull request 2026-11-27 00:36:08 +00:00
Author
Owner

@⁠LooperSalty on GitHub · 2026-11-26 23:09 UTC · original

Closing after #454 moved third_party/victory to the Vice-Tay base (TaynanGT/Vice-Tay a252348).

The file does not apply to the new base any more, and the fast paths came without a measurement (rule 2 of AGENTS.md asks for one for performance work).

Thanks for the work. If you measure a gain on the new base, a new PR against main is welcome.

🤖 Closed by Claude Code on behalf of the maintainer

**@⁠LooperSalty** on GitHub · 2026-11-26 23:09 UTC · [original](https://github.com/LooperSalty/AnyXboxX/pull/410#issuecomment-7205298027) Closing after #454 moved `third_party/victory` to the Vice-Tay base (TaynanGT/Vice-Tay a252348). The file does not apply to the new base any more, and the fast paths came without a measurement (rule 2 of AGENTS.md asks for one for performance work). Thanks for the work. If you measure a gain on the new base, a new PR against `main` is welcome. _🤖 Closed by [Claude Code](https://claude.com/claude-code) on behalf of the maintainer_

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.