Findings from CNF that could be implemented #617

Open
opened 2026-12-05 18:19:15 +00:00 by sillyGoober421 · 2 comments

WARNING: This was written with Claude Opus 5.5, so proceed at your own risk.

What you would like

[enhancement] What Darner could take from larp: decoded-texture store, the title's graphics settings in F1, hardware RT replacements, more recording threads

What you would like

Summary. larp is another GPL-3.0-or-later VIctory fork for the same retail image (b99f876b…). Reading both trees side by side, four of its features have no counterpart in Darner and look portable: a store of decoded DirectStorage results kept across runs, the title's own graphics settings in the menu, hand-written replacement shaders that put the ray-traced passes on hardware ray queries, and more command-recording threads than the title has. Each is described below with where it lives in larp, where it would plug into Darner, and what to test. Each would be its own pull request with an A/B result, per CONTRIBUTING.

What was compared, and how.

  • larp: gamingwithhomie/larp at 0f03265 (2026-12-05), whose first commit imports larp 1c2a608.
  • Darner: the GitHub mirror as of 2026-12-05 14:12 CET. Commits on this forge after that were not checked.
  • Method: a static reading of both trees. Nothing was built or run in the game, so every item is a lead to measure, not a confirmed gain.
  • Out of scope: larp's later commits that port from Darner or other forks (DualSense/DS4 HID, the amdxc64 view-handle fix, the water tiles' first-thread init, keyboard and mouse) are left out. So is everything where Darner is already ahead or equal: network isolation, file mapping and crash handling (90-97% of larp's lines in net.rs, files.rs, crash.rs are in Darner's longer versions), pads, Streamline (DLSS, FSR, Reflex), VRAM and texture budgets, the title's thread masks onto fast cores (kernel.rs SetThreadGroupAffinity), letterboxing, the pipeline wait, DSP convolution and Opus.

1. A decoded-result store for DirectStorage (self-contained, lowest effort)

What larp does. crates/larp-hle/src/modules/dstorage/store.rs (646 lines) and stats.rs (312) keep the bytes a BCPack request with a file source decoded to, across runs. A repeat request is then a read and a copy, with no inflate and no BCPack decode.

  • Key: the file as the title opened it (path, size, modification time), the source offset and size, the size between the zlib and BCPack stages, the options' decoding bits, and the destination size. Requests from memory sources and failed decodes are never stored.
  • On disk: data.bin (records appended) and index.bin (one fixed record per entry: key, where its data record starts, its lengths, the CRC-32 of the decoded bytes, the record's own CRC-32).
  • Self-invalidating: both files start with a BLAKE3 identity of the store's format, the BCPack decoder's source and tables, and the module's sources. A different identity empties both.
  • Crash-safe: at start, records that fail their CRC are ignored, and a torn tail or unindexed data from a killed run is cut off. A hit checks magic, key, path and CRC before it is served; one that fails is dropped and decoded again.
  • Bounded: one writer thread from a queue of at most 256 MiB. It stops taking entries at LARP_DSTORAGE_CACHE_GB (256 by default). LARP_DSTORAGE_CACHE_CHECK=1 (diagnostics builds) decodes every hit again and compares.

Darner today. crates/darner-hle/src/modules/dstorage.rs reads the source, inflates and calls bcpack::decode on every request (around the into_destination call). Nothing is kept between runs.

Where it would plug in. In that decode path: look the key up before read_source, and queue the decoded bytes after a successful into_destination. The store would sit under Darner's cache folder.

What to test.

  • A/B the same route twice, cold and warm. Measure load time, CPU time in decode, and stutter while streaming.
  • Disk use per hour of play.
  • A smaller default cap than 256 GB is probably wiser.

2. The title's own graphics settings in the F1 menu

What larp does. crates/larp-game/src/settings.rs (545 lines) maps about 40 fields of the title's settings block: each one's type, the values offered, and when a change reaches the picture.

  • Fields covered: texture distance per category (all, by material, buildings, objects, HD models, distant and far levels), object and grass distance, sun and local shadow quality, sun screen-space shadows, GI, lighting, reflection, mirror, water, particle, volumetrics and decal quality, tessellation, subsurface scattering, ray-tracing structure quality, hair simulation and hair memory budget, damage models, async compute, desired frame rate.
  • How a change applies: larp writes the block and makes it current through the title's own apply path, so the title's code does the work.
  • File and menu: crates/larp-hle/src/settings/file.rs and menu.rs. larp's FAQ already tells 8 GB card users to lower Texture Detail there when VRAM fills.

Darner today. The F1 menu (crates/darner-gpu/src/host/menu.rs) offers host-side controls such as TEXTURE LOD BIAS. I found none of the title's settings fields in Darner.

Where it would plug in. The field table could come across nearly as is, since it targets the same build. Its entries would become lines in host/menu.rs, saved alongside Darner's own settings.

What to test.

  • That each option changes what it says it changes.
  • VRAM use and frame time at the lowest and highest values.
  • Whether a value survives the title's own settings save.

3. Hardware ray tracing: hand-written replacement shaders (and a comparison of the RT paths)

What larp does.

  • larp ships hardware ray tracing on by default whenever the card supports DXR 1.1 (docs/faq.md). In Darner both DARNER_BVH_BUILDER and DARNER_HW_RT are off and described as a trial.
  • Replacement shaders. crates/larp-gpu/src/shader_replace.rs (833 lines) swaps the translation's DXIL for a compiled replacement chosen by program hash.
    • The translation still runs, so its interface is kept. The replacement must bind a subset of it, checked against the container's PSV0 at first use.
    • A refused file, or bindings the host does not declare, leaves the translation in place.
    • <hash>.<stage>.views declares the structure views a replacement traces with ray queries. <hash>.<stage>.interface supplies an interface for a program that does not translate.
    • The binding contract is written up in shaders/replace/README.md. apps/larp/build.rs compiles the HLSL with dxc.
    • larp has 85 replacements; 60 of them trace with host ray queries, across shadows, screen probes, the irradiance cache, reflections and deferred gather.
  • Structure memory. crates/larp-gpu/src/sparse.rs backs RT structure memory and the triangle position pool with reserved buffers mapped chunk by chunk. rt.rs and bvh.rs hold the rest of the path.

Darner today.

  • emit/rayquery.rs lifts traversal loops to RayQuery where every value is accounted for, and falls back to the software walk where it is not.
  • Of the seven screen-probe programs that emit/lower/analysis.rs keeps out of the wave-wide fallback, larp has hand-written replacements for six: 0f9382de73901605, be1e7049f0bd75d0, c44697c4f620d86e, ca91c1392fd098a4, d5f6125b52723fc9, f76abe011ea678b3.

Where it would plug in.

  • Port the loader into darner-gpu pipeline creation.
  • Then adapt the replacements one at a time. They are not drop-in: larp binds structures at t248+, with the position pool and counters at u252. Darner binds at root SRV t230..t241.
  • The six screen-probe programs are the natural first batch, judged with DARNER_HW_RT_WHY=1 and the "ray queries lifted N of M" log lines.

What to test.

  • With DARNER_HW_RT=1, the same scenes with and without each replacement: picture, card time, and the lifted/fell-back counts.
  • Separately, larp's RT path against Darner's in the same scene, for stability and card time. That shows whether anything in larp's rt.rs/sparse.rs handling is worth taking, beyond the shaders.

4. More command-recording threads than the title has (largest possible CPU gain, most fragile)

What larp does. The title records its parallel render phases on five threads, with per-thread static arrays sized for five or six. larp raises that to eight by default (LARP_SUBRENDER_WORKERS, 6 to 8; 5 leaves the title as it is). Before the title runs:

  • it moves those arrays to memory with room behind them, and re-aims the instructions that address them;
  • it gives added threads index bytes the build never used;
  • it detours the setters that change "all six" to a thunk that runs them again for each added element;
  • it handles what the title counts or encodes per thread (the count, task budget words, page reservations, per-texture slot masks).

Files: apps/larp/src/subrender.rs (797 lines), crates/larp-game/src/subrender.rs (331), subrender_table.rs (98), crates/larp-loader/src/replay.rs (414), and the relocation in crates/larp-loader/src/relocate.rs.

Darner today. I found nothing equivalent; the title keeps its five recording threads.

What to test.

  • CPU-bound scenes (dense city, driving) on 8+ core CPUs, at 5 against 8 workers: frame time percentiles, crashes, and any state that only the added threads get wrong.
  • This one touches the most title code; I would only try it after the others.

5. Smaller: time-based mouse look smoothing

larp's gameinput/mouse.rs (larp commit b5e09e0, its issue #11) turns mouse counts into a velocity and smooths it with a time constant (about 20 ms while moving, 12 ms on stopping), scaled by the real time between polls. Darner's gameinput.rs MouseLook blends each 8 ms poll 0.6/0.4 by count. larp made this change against judder between its poll loop and the title's 30-60 Hz reads. Whether Darner's mouse look has the same judder has not been checked.


Credit. larp is GPL-3.0-or-later, like Darner. A port can cite the repository and commit, as cores.rs does for fxceless.

Nothing from the game is attached or quoted here. Program hashes and Darner's own switch names are the only identifiers used.

Drafted with an AI assistant (Claude) from a static reading of both trees, and read by me before posting.

Are you working on a fix?

No

Are you working on a fix?

No

WARNING: This was written with Claude Opus 5.5, so proceed at your own risk. ### What you would like [enhancement] What Darner could take from larp: decoded-texture store, the title's graphics settings in F1, hardware RT replacements, more recording threads ### What you would like **Summary.** larp is another GPL-3.0-or-later VIctory fork for the same retail image (`b99f876b…`). Reading both trees side by side, four of its features have no counterpart in Darner and look portable: a store of decoded DirectStorage results kept across runs, the title's own graphics settings in the menu, hand-written replacement shaders that put the ray-traced passes on hardware ray queries, and more command-recording threads than the title has. Each is described below with where it lives in larp, where it would plug into Darner, and what to test. Each would be its own pull request with an A/B result, per CONTRIBUTING. **What was compared, and how.** - larp: [gamingwithhomie/larp](https://github.com/gamingwithhomie/larp) at `0f03265` (2026-12-05), whose first commit imports larp `1c2a608`. - Darner: the GitHub mirror as of 2026-12-05 14:12 CET. Commits on this forge after that were not checked. - Method: a static reading of both trees. Nothing was built or run in the game, so every item is a lead to measure, not a confirmed gain. - Out of scope: larp's later commits that port from Darner or other forks (DualSense/DS4 HID, the `amdxc64` view-handle fix, the water tiles' first-thread init, keyboard and mouse) are left out. So is everything where Darner is already ahead or equal: network isolation, file mapping and crash handling (90-97% of larp's lines in `net.rs`, `files.rs`, `crash.rs` are in Darner's longer versions), pads, Streamline (DLSS, FSR, Reflex), VRAM and texture budgets, the title's thread masks onto fast cores (`kernel.rs` `SetThreadGroupAffinity`), letterboxing, the pipeline wait, DSP convolution and Opus. --- #### 1. A decoded-result store for DirectStorage (self-contained, lowest effort) **What larp does.** [`crates/larp-hle/src/modules/dstorage/store.rs`](https://github.com/gamingwithhomie/larp/blob/0f03265/crates/larp-hle/src/modules/dstorage/store.rs) (646 lines) and [`stats.rs`](https://github.com/gamingwithhomie/larp/blob/0f03265/crates/larp-hle/src/modules/dstorage/stats.rs) (312) keep the bytes a BCPack request with a file source decoded to, across runs. A repeat request is then a read and a copy, with no inflate and no BCPack decode. - **Key:** the file as the title opened it (path, size, modification time), the source offset and size, the size between the zlib and BCPack stages, the options' decoding bits, and the destination size. Requests from memory sources and failed decodes are never stored. - **On disk:** `data.bin` (records appended) and `index.bin` (one fixed record per entry: key, where its data record starts, its lengths, the CRC-32 of the decoded bytes, the record's own CRC-32). - **Self-invalidating:** both files start with a BLAKE3 identity of the store's format, the BCPack decoder's source and tables, and the module's sources. A different identity empties both. - **Crash-safe:** at start, records that fail their CRC are ignored, and a torn tail or unindexed data from a killed run is cut off. A hit checks magic, key, path and CRC before it is served; one that fails is dropped and decoded again. - **Bounded:** one writer thread from a queue of at most 256 MiB. It stops taking entries at `LARP_DSTORAGE_CACHE_GB` (256 by default). `LARP_DSTORAGE_CACHE_CHECK=1` (diagnostics builds) decodes every hit again and compares. **Darner today.** `crates/darner-hle/src/modules/dstorage.rs` reads the source, inflates and calls `bcpack::decode` on every request (around the `into_destination` call). Nothing is kept between runs. **Where it would plug in.** In that decode path: look the key up before `read_source`, and queue the decoded bytes after a successful `into_destination`. The store would sit under Darner's cache folder. **What to test.** - A/B the same route twice, cold and warm. Measure load time, CPU time in decode, and stutter while streaming. - Disk use per hour of play. - A smaller default cap than 256 GB is probably wiser. #### 2. The title's own graphics settings in the F1 menu **What larp does.** [`crates/larp-game/src/settings.rs`](https://github.com/gamingwithhomie/larp/blob/0f03265/crates/larp-game/src/settings.rs) (545 lines) maps about 40 fields of the title's settings block: each one's type, the values offered, and when a change reaches the picture. - **Fields covered:** texture distance per category (all, by material, buildings, objects, HD models, distant and far levels), object and grass distance, sun and local shadow quality, sun screen-space shadows, GI, lighting, reflection, mirror, water, particle, volumetrics and decal quality, tessellation, subsurface scattering, ray-tracing structure quality, hair simulation and hair memory budget, damage models, async compute, desired frame rate. - **How a change applies:** larp writes the block and makes it current through the title's own apply path, so the title's code does the work. - **File and menu:** [`crates/larp-hle/src/settings/file.rs`](https://github.com/gamingwithhomie/larp/blob/0f03265/crates/larp-hle/src/settings/file.rs) and [`menu.rs`](https://github.com/gamingwithhomie/larp/blob/0f03265/crates/larp-hle/src/settings/menu.rs). larp's FAQ already tells 8 GB card users to lower Texture Detail there when VRAM fills. **Darner today.** The F1 menu (`crates/darner-gpu/src/host/menu.rs`) offers host-side controls such as TEXTURE LOD BIAS. I found none of the title's settings fields in Darner. **Where it would plug in.** The field table could come across nearly as is, since it targets the same build. Its entries would become lines in `host/menu.rs`, saved alongside Darner's own settings. **What to test.** - That each option changes what it says it changes. - VRAM use and frame time at the lowest and highest values. - Whether a value survives the title's own settings save. #### 3. Hardware ray tracing: hand-written replacement shaders (and a comparison of the RT paths) **What larp does.** - larp ships hardware ray tracing **on by default** whenever the card supports DXR 1.1 ([`docs/faq.md`](https://github.com/gamingwithhomie/larp/blob/0f03265/docs/faq.md)). In Darner both `DARNER_BVH_BUILDER` and `DARNER_HW_RT` are off and described as a trial. - **Replacement shaders.** [`crates/larp-gpu/src/shader_replace.rs`](https://github.com/gamingwithhomie/larp/blob/0f03265/crates/larp-gpu/src/shader_replace.rs) (833 lines) swaps the translation's DXIL for a compiled replacement chosen by program hash. - The translation still runs, so its interface is kept. The replacement must bind a subset of it, checked against the container's `PSV0` at first use. - A refused file, or bindings the host does not declare, leaves the translation in place. - `<hash>.<stage>.views` declares the structure views a replacement traces with ray queries. `<hash>.<stage>.interface` supplies an interface for a program that does not translate. - The binding contract is written up in [`shaders/replace/README.md`](https://github.com/gamingwithhomie/larp/blob/0f03265/shaders/replace/README.md). [`apps/larp/build.rs`](https://github.com/gamingwithhomie/larp/blob/0f03265/apps/larp/build.rs) compiles the HLSL with dxc. - larp has 85 replacements; 60 of them trace with host ray queries, across shadows, screen probes, the irradiance cache, reflections and deferred gather. - **Structure memory.** [`crates/larp-gpu/src/sparse.rs`](https://github.com/gamingwithhomie/larp/blob/0f03265/crates/larp-gpu/src/sparse.rs) backs RT structure memory and the triangle position pool with reserved buffers mapped chunk by chunk. [`rt.rs`](https://github.com/gamingwithhomie/larp/blob/0f03265/crates/larp-gpu/src/rt.rs) and [`bvh.rs`](https://github.com/gamingwithhomie/larp/blob/0f03265/crates/larp-gpu/src/bvh.rs) hold the rest of the path. **Darner today.** - `emit/rayquery.rs` lifts traversal loops to `RayQuery` where every value is accounted for, and falls back to the software walk where it is not. - Of the seven screen-probe programs that `emit/lower/analysis.rs` keeps out of the wave-wide fallback, larp has hand-written replacements for six: `0f9382de73901605`, `be1e7049f0bd75d0`, `c44697c4f620d86e`, `ca91c1392fd098a4`, `d5f6125b52723fc9`, `f76abe011ea678b3`. **Where it would plug in.** - Port the loader into `darner-gpu` pipeline creation. - Then adapt the replacements one at a time. They are not drop-in: larp binds structures at `t248+`, with the position pool and counters at `u252`. Darner binds at root SRV `t230..t241`. - The six screen-probe programs are the natural first batch, judged with `DARNER_HW_RT_WHY=1` and the "ray queries lifted N of M" log lines. **What to test.** - With `DARNER_HW_RT=1`, the same scenes with and without each replacement: picture, card time, and the lifted/fell-back counts. - Separately, larp's RT path against Darner's in the same scene, for stability and card time. That shows whether anything in larp's `rt.rs`/`sparse.rs` handling is worth taking, beyond the shaders. #### 4. More command-recording threads than the title has (largest possible CPU gain, most fragile) **What larp does.** The title records its parallel render phases on five threads, with per-thread static arrays sized for five or six. larp raises that to eight by default (`LARP_SUBRENDER_WORKERS`, 6 to 8; 5 leaves the title as it is). Before the title runs: - it moves those arrays to memory with room behind them, and re-aims the instructions that address them; - it gives added threads index bytes the build never used; - it detours the setters that change "all six" to a thunk that runs them again for each added element; - it handles what the title counts or encodes per thread (the count, task budget words, page reservations, per-texture slot masks). Files: [`apps/larp/src/subrender.rs`](https://github.com/gamingwithhomie/larp/blob/0f03265/apps/larp/src/subrender.rs) (797 lines), [`crates/larp-game/src/subrender.rs`](https://github.com/gamingwithhomie/larp/blob/0f03265/crates/larp-game/src/subrender.rs) (331), [`subrender_table.rs`](https://github.com/gamingwithhomie/larp/blob/0f03265/crates/larp-game/src/subrender_table.rs) (98), [`crates/larp-loader/src/replay.rs`](https://github.com/gamingwithhomie/larp/blob/0f03265/crates/larp-loader/src/replay.rs) (414), and the relocation in `crates/larp-loader/src/relocate.rs`. **Darner today.** I found nothing equivalent; the title keeps its five recording threads. **What to test.** - CPU-bound scenes (dense city, driving) on 8+ core CPUs, at 5 against 8 workers: frame time percentiles, crashes, and any state that only the added threads get wrong. - This one touches the most title code; I would only try it after the others. #### 5. Smaller: time-based mouse look smoothing larp's [`gameinput/mouse.rs`](https://github.com/gamingwithhomie/larp/blob/0f03265/crates/larp-hle/src/modules/gameinput/mouse.rs) (larp commit `b5e09e0`, its issue #11) turns mouse counts into a velocity and smooths it with a time constant (about 20 ms while moving, 12 ms on stopping), scaled by the real time between polls. Darner's `gameinput.rs` `MouseLook` blends each 8 ms poll 0.6/0.4 by count. larp made this change against judder between its poll loop and the title's 30-60 Hz reads. Whether Darner's mouse look has the same judder has not been checked. --- **Credit.** larp is GPL-3.0-or-later, like Darner. A port can cite the repository and commit, as `cores.rs` does for fxceless. Nothing from the game is attached or quoted here. Program hashes and Darner's own switch names are the only identifiers used. Drafted with an AI assistant (Claude) from a static reading of both trees, and read by me before posting. ### Are you working on a fix? No ### Are you working on a fix? No

Nice one, bro.

Nice one, bro.

Can't wait to see what CNF's findings could bring to Darner once properly integrated and polished. Great work, keep it up!

Can't wait to see what CNF's findings could bring to Darner once properly integrated and polished. Great work, keep it up!
TrustNo1 changed title from [enhancement] Findings from CNF that could be implemented to Findings from CNF that could be implemented 2026-12-06 03:18:45 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
TrustNo1/Darner#617
No description provided.