Formats: inline repeated micro-tile copies when detiling textures #603
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!603
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/603/head"
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?
@AwsAli05 on GitHub · 2026-11-24 05:24 UTC · original
AwsAli05:formats/detile-copy-runs→main· +26 −2 · 1 files · 1 commits · merged 2026-11-25 00:20 UTCTexture uploads convert console micro-tiles to linear rows before the host GPU can sample them. The existing row walk finds contiguous runs, but passes a runtime length to every copy. This change checks the repeated run length once per subresource. It dispatches 8-, 16- and 32-byte runs once per row, which lets the compiler inline the individual copies. The final run and irregular rows still use their recorded lengths.
Detile timings
Single-threaded
Layout::detileon a Ryzen 7 7700 with Rust 1.98.1, x86_64-pc-windows-gnu, optimized library linked from a separate binary. Times are milliseconds per complete texture. Each process measured seven batches of 16 copies after warm-up. The table gives the median across three process medians for each revision, with run order reversed for the middle pair.d2a4baeAll 20 active
victory-formatstests pass, including byte-for-byte comparisons against per-element swizzled offsets, round trips, mip tails and padding checks. Three reference-data tests were ignored. These timings measure conversion on the CPU. Gameplay frame time is unmeasured. The full diagnostics workspace run on this GNU target also reported two failures outside the changed crate. The loader fixture passes /DELAYLOAD to the GNU linker, and the PE test expects a TLS directory in its own test binary.Reproduce the benchmark
Save the Rust source below as
bench.rsoutside the checkout. From that directory, run the following on each revision, with$reposet to its checkout path.@fromthemoonx on GitHub · 2026-11-24 08:12 UTC · original
Tested
705a2f6merged onto currentmain(f67c50c, merges cleanly) on another CPU and the MSVC target.Environment: Windows 11 Pro build 26300, AMD Ryzen 7 5700X (Zen 3), 16 GB, Rust 1.98.1
x86_64-pc-windows-msvc.Same output as
main. A throwaway in-crate test (not pushed) detiles every subresource, then tiles it back, and hashes everything (FNV-1a), across:LINEAR, the 256B/4KB/64KB S and D modes, the_Tand the_Xonesmainf67c50cf393252946004ca1main+ this PRf393252946004ca1So
detileandtileare byte-identical, including the error results for invalid combinations.Timing (single-threaded
Layout::detile, release test binary, 16 copies per batch, 10 measured batches, medians of three alternating runs per revision):mainEvery run of the PR was faster than every run of
mainon all four inputs. The gains here (about 1.7–3×) are larger than on your Zen 4 numbers, mostly becausemainis slower on this CPU.Other checks (on the merge):
cargo test --locked -p victory-formats: 20 passed, 3 ignoredcargo test --locked --workspace: 291 passed, 0 failed, 5 ignoredcargo clippy -p victory-formats --all-targets: no warningscargo xtask policy: 152 files ok;git diff --check: cleancargo fmt --checklists the same 35 places intexture.rsonmain,d2a4baeand this PR: none are newNot tested: real title textures or frame time (no game data).
AI-assisted (Claude Code) ran the checks and drafted this comment.