Repository navigation
Textures: linear levels are detiled a row at a time - #440
emirduran707 wants to merge 1 commit into
Conversation
Chain::detile_level computed the address of every element and copied it on its own. A linear level (mode 0) keeps each row's elements contiguous, so its rows are now copied whole; which elements are copied when the source is cut short is unchanged. Swizzled modes, a base swizzle and levels in a mip tail keep the element-by-element form. A retail title's intro video is three linear R8 planes per frame (3840x2160 and two 1920x1080), uploaded on every frame through the kept-in-step title textures: release, one plane 56.9 ms -> 1.2 ms and 14.4 ms -> 0.3 ms, about 85 ms -> 2 ms a frame. The video played at 3.5 fps on an RX 9060 XT with the element-by-element form. Test: linear levels give the same bytes by rows as by elements, for every element size, padded rows, every mip and a cut-short source. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Code audit + NVIDIA RTX 5080 test run on ReviewLooks clean and mathematically equivalent to the element-by-element loop:
Tested
Not tested
AI use: code review and test run orchestrated with Antigravity (Gemini 4 Neon) on the hardware listed above. |
|
Thanks @ethandepstein-del for the review and the RTX 5080 run. For whoever merges: #451 (opened after this one) reworks the same function for every mode, so the two conflict, but they speed up different layouts – timings side by side in #451 (comment). I'll rebase whichever lands second. AI use: Claude Code with Claude Opus 5.5 wrote this note. |
…ed a row at a time Their work. The conflict with the fork's threaded detile is resolved by keeping both: the row copy for linear levels, the threads for tiled ones. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Chain::detile_level computed the address of every element and copied it on its own. A linear level (mode 0) keeps each row's elements contiguous, so its rows are now copied whole; which elements are copied when the source is cut short is unchanged. Swizzled modes, a base swizzle and levels in a mip tail keep the per-row form of the previous commit. A retail title's intro video is three linear R8 planes per frame (3840x2160 and two 1920x1080), uploaded on every frame through the kept-in-step title textures: release, one plane 56.9 ms -> 1.2 ms and 14.4 ms -> 0.3 ms, about 85 ms -> 2 ms a frame. The video played at 3.5 fps on an RX 9060 XT with the element-by-element form. Test: linear levels give the same bytes by rows as by elements, for every element size, padded rows, every mip and a cut-short source. From xcl-dev#440 (be722a7), placed in front of the per-row loop of this PR. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent CPU-side detile benchmark on Intel Core i5-8400, Windows 11 Home 26200.9974, Rust 1.100.0 x86_64-pc-windows-msvc. Tested: exact base
The PR's Not tested: retail playback or frame rate, GPU upload timing, and the full workspace suite. AI use: OpenAI Codex (GPT-6) wrote the temporary benchmark, ran the local checks, and reported the measured results. |
|
Test report for #440 at Setup: AMD Radeon RX 9070 XT 16 GB, driver 32.0.32015.2008, Ryzen 7 9800X3D, 31 GB RAM, Windows 11 25H2 build 26200.9974, rustc 1.100.0 Tests: Title runs:
No device removal or crash in any run. Peak commit was 15934 / 15783 MB (main: 15824 / 15815 MB). Regression run (round 1, with the video): main: PR: Not tested: gameplay past the video; any title other than this one. AI use: Claude Code with Claude Opus 5.5 built the commits, ran the tests and the title runs, and wrote this report. The runs were made on my machine. |
|
Closing in favour of #451: its author folded this change into it unchanged as 1f282c7 (with its test), in front of their per-row loop for the swizzled modes – the combined head is faster than either alone (timings in #451 (comment)). Thanks @1984742628, and @ethandepstein-del, @alpz1000 and @Chrysana for the reviews and runs here. AI use: Claude Code with Claude Opus 5.5 wrote this note. |
|
Tested on Windows + NVIDIA: the retail title's intro video goes from about 5 fps to a steady 30 fps with this PR. Setup: RTX 4070 12 GB (driver 617.42), Ryzen 7 7800X3D, 32 GB RAM, Windows 11 26200, release build, warm shader cache.
Not tested: AMD; a longer run past the video. (Report by Claude Code, Claude Opus 5.5; I ran the builds and the smoke runs on the hardware above.) |
A retail title's intro video plays at 3.5 fps on an RX 9060 XT: every frame, the kept-in-step title textures upload its three linear R8 planes (3840x2160 and two 1920x1080), and
Chain::detile_levelcomputes the address of every element and copies it on its own – 8.3 M times for the large plane. A linear level keeps each row's elements contiguous, so its rows are now copied whole. The profiling and the idea are from the comments on #283 (gw1337x, CodeByCon); #334 did the same and was closed by its author.What is in it
gpu/tiling.rs:detile_levelcopies the rows of a linear level (mode 0, no base swizzle, not in a mip tail) whole; which elements are copied when the source is cut short is unchanged. Swizzled modes, a base swizzle and mip-tail levels keep the element-by-element form.linear_levels_detile_by_rows_as_by_elements: the same bytes by rows as by elements for every element size, padded rows, every mip, and a source cut short inside a row and inside an element.Tested
x86_64-pc-windows-msvc; DXC 1.9.2602.17; debug for the suite, release for the runs.cargo test --workspace -- --test-threads=4at be722a7: 677 passed, 0 failed, 41 ignored; noSKIPPEDlines.detile_levelalone (release, a local timing test, not committed): a 3840x2160 R8 plane 56.9 ms → 1.2 ms, 1920x1080 14.4 ms → 0.3 ms; about 85 ms → 2 ms for one video frame.XCL_NETWORK=0 XCL_ACTIVITY=1 XCL_FRAME_DUMP=60: onmain3516080 the video ran at 3.5 fps (7 presents per 2 s) for ~120 s and the world started loading at ~178 s; with this change it ran at 23–27 fps (900 frames presented, 27.2 fps over the last 300) for ~25 s, the world started loading at ~62 s, and the person watching saw it play smoothly.Regression run
60 s, no input (the title stays at its first menu, so this run does not reach the video). The
gpu:line names a virtual display adapter of this machine (what #281 / #282 / #285 fix); XCL's log namesbackend 'real' – AMD Radeon RX 9060 XT (16188 MiB VRAM).main:
PR:
Not tested
AI use