Skip to content

Texture: reuse contiguous column runs across rows - #60

Merged
Marvisak merged 1 commit into
Marvisak:mainfrom
ifBars:perf/reuse-texture-row-spans
Nov 24, 2026
Merged

Marvisak merged 1 commit into
Marvisak:mainfrom
ifBars:perf/reuse-texture-row-spans

Conversation

@ifBars

@ifBars ifBars commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

Tiling and detiling used to calculate every element's address for each row and then scan that row for contiguous runs. Moving to a new row or depth slice adds a common base to the column addresses, so the same runs can be reused throughout a subresource. Linear textures now copy one row at a time.

The synthetic tests check each tiled element against its coordinate address and verify that row and depth padding retain their original bytes. They cover odd texture dimensions, block compression, mip tails, array slices and 3D textures.

On an i5-11600K, a local release-build comparison during the startup movie measured 14.8–15.7 ms per frame in texture preparation before the change and 3.1–3.4 ms afterward. Both runs played at 30 fps. This measurement used a local integration build with the compatibility changes needed by that machine.

Validation

  • cargo test --locked -p victory-formats --lib passed all 17 active tests. Three external-fixture tests were ignored.
  • cargo check --locked --workspace and cargo xtask policy passed.
  • cargo test --locked --workspace --no-fail-fast reported two failures on Windows 10. The WinHTTP test requires a host export missing on this machine, and victory-loader --test load_probe exited with STATUS_ACCESS_VIOLATION (see Loader: preserve an empty import table for Windows 10 static TLS #28). The remaining test targets passed.

Developed with AI assistance.

@DaviTostes

Copy link
Copy Markdown

Tested fc807b6 stacked on #39 on Arch Linux x86_64, rustc 1.98.1: pass (no regression only).

  • cargo test --workspace: 155 passed, 0 failed, 3 ignored; the merge with Build: make workspace tests run on Linux #39 is clean.
  • Scope note: the diff is crates/victory-formats/src/texture.rs only and adds no test, so this run shows the layout conversion still passes its existing cases; it does not measure the row-run reuse itself. A synthetic case whose rows contain both contiguous runs and single pixels would pin the reuse (and the odd-width/tail case).
  • No game data used.

AI-assisted (DeepSeek V4.1 Flash coding agent).

@lordon1a

Copy link
Copy Markdown
Contributor

Verified fc807b6e7 on Windows 11 (x86_64-pc-windows-gnullvm, rustc 1.100.0, applied cleanly to main@35b054ec0): pass.

  • cargo xtask policy: 150 files ok
  • cargo test -p victory-formats: 17 passed, 0 failed, 3 ignored (including texture::tests::addresses_are_a_bijection_and_copies_round_trip with the tightened active/padding slice assertions).

AI-assisted.

@Marvisak
Marvisak merged commit 93bc978 into Marvisak:main Nov 24, 2026
suirentakamura referenced this pull request in suirentakamura/victory-suiren Nov 24, 2026
Texture: reuse contiguous column runs across rows
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants