Textures: alias copies texture to texture by default (DARNER_ALIAS_DIRECT on) #282

Open
cafe wants to merge 1 commit from cafe/alias-direct-default into Main AGit
Contributor

What it changes

  • The README row of DARNER_ALIAS_DIRECT says "not measured", and the switch is off.
  • When the game reads light it wrote as R32_UINT through an R9G9B9E5 view of the same memory, Darner copies texture → buffer → texture, about 81 times a frame. DARNER_ALIAS_DIRECT=1 makes that one copy, texture to texture, for the formats D3D12 copies bit for bit (R32_UINT / R32_SINT and R9G9B9E5_SHAREDEXP).
  • This turns it on by default; DARNER_ALIAS_DIRECT=0 turns it off. The README row is updated. One test that assumed the switch was off now asks direct() which way the layouts were made, so it passes either way.

How it was tested

  • RTX 2080 Ti, Windows 10 22H2, Series S profile, 1440p output, DLSS Performance, hardware RT.
  • House save, 30 s after the world shows, warm pipelines. Both sides use the same other switches; only DARNER_ALIAS_DIRECT differs:
off on
GPU time a frame 48.5, 48.5 ms 46.8, 46.8 ms
fps 20.1, 20.2 20.7, 20.7

The heavy opening pan is about −1.5 ms.

  • Picture: a recorded frame of the same place, replayed with these copies made texture to texture, gives the same picture to the pixel.
  • On f3840d73d + this commit:
    • build and clippy: OK
    • darner-gpu lib tests: the same 5 failures as without the change, plus two watch:: tests that are flaky either way. Tests that need Shader Model 6.6 can't run on Windows 10's own D3D12.
  • Not tested: AMD, Intel, Windows 11; no check by eye in play yet.

Checked for overlap

gtahub PR 50 also changes texture.rs, but in other functions. No PR or issue mentions DARNER_ALIAS_DIRECT.

## What it changes - The README row of `DARNER_ALIAS_DIRECT` says "not measured", and the switch is off. - When the game reads light it wrote as R32_UINT through an R9G9B9E5 view of the same memory, Darner copies texture → buffer → texture, about 81 times a frame. `DARNER_ALIAS_DIRECT=1` makes that one copy, texture to texture, for the formats D3D12 copies bit for bit (R32_UINT / R32_SINT and R9G9B9E5_SHAREDEXP). - This turns it on by default; `DARNER_ALIAS_DIRECT=0` turns it off. The README row is updated. One test that assumed the switch was off now asks `direct()` which way the layouts were made, so it passes either way. ## How it was tested - RTX 2080 Ti, Windows 10 22H2, Series S profile, 1440p output, DLSS Performance, hardware RT. - House save, 30 s after the world shows, warm pipelines. Both sides use the same other switches; only `DARNER_ALIAS_DIRECT` differs: | | off | on | |---|---|---| | GPU time a frame | 48.5, 48.5 ms | 46.8, 46.8 ms | | fps | 20.1, 20.2 | 20.7, 20.7 | The heavy opening pan is about −1.5 ms. - Picture: a recorded frame of the same place, replayed with these copies made texture to texture, gives the same picture to the pixel. - On f3840d73d + this commit: - build and clippy: OK - `darner-gpu` lib tests: the same 5 failures as without the change, plus two `watch::` tests that are flaky either way. Tests that need Shader Model 6.6 can't run on Windows 10's own D3D12. - Not tested: AMD, Intel, Windows 11; no check by eye in play yet. ## Checked for overlap gtahub PR 50 also changes `texture.rs`, but in other functions. No PR or issue mentions `DARNER_ALIAS_DIRECT`.
Author
Contributor

Another small GPU perf PR, anyone running ABBA tests, especially on a GPU bound machine, would be greatly appreciated ❤️
This one is just a default switch change, so even just testing this switch on top of your worktree helps if you can't be bothered rebuilding.

Another small GPU perf PR, anyone running ABBA tests, especially on a GPU bound machine, would be greatly appreciated ❤️ This one is just a default switch change, so even just testing this switch on top of your worktree helps if you can't be bothered rebuilding.
Contributor

Windows 11 test of this switch: in-run A/B on a GPU-bound laptop.

Setup

  • RTX 5080 Laptop GPU 16 GB, Core Ultra 9 275HX, 64 GB, Windows 11 (26300), driver 621.47.
  • f3840d73 + this PR (7e53e473), release build with --features ab. The translator id is unchanged, so the warm cache was used (pipeline library 938 MB).
  • Series X profile, 2560x1440, DLSS Quality, no frame generation, no frame cap, ray tracing off.
  • DARNER_AB=15,DARNER_ALIAS_DIRECT: the switch flipped every 15 s during one 16.7-minute run, so both sides saw the same places (moving around the city, not one fixed spot). DARNER_CARD_TIMES=1 on both sides.
  • The path is hit here: the written_as=42 read_as=67 view line was logged 1861 times with direct=false and 1802 times with direct=true.

Result (61 phases in the world, 30 off and 31 on, 60 neighbouring pairs)

off on on − off
frame time, mean of the phase means 37.08 ms 36.94 ms pairs: mean −0.19, median −0.60 ms; on faster in 33 of 60
card time in the title's lists 32.19 ms 31.65 ms pairs: mean −0.47, median −0.64 ms; on faster in 35 of 60
card time, adjusted for draws a frame (least squares) −1.07 ms (95 % CI −2.48 to +0.33)
every frame (CSV): p50 / p99 / p99.9 35.1 / 65.2 / 112.1 ms 35.1 / 65.0 / 105.7 ms
1 % / 0.1 % low 10.8 / 4.5 fps 10.1 / 3.2 fps the on side holds the world-entry frame (1276 ms: 59 pipelines loaded from the library)
frames over 100 ms / over 500 ms 18 / 1 18 / 2
  • The card is the limit on this machine: DARNER_CARD_TIMES gives 32.0 ms busy a frame (the union of the lists) against frames of about 37 ms.
  • The longest frames on both sides are pipeline waits (library loads at world entry, one or two new pipelines later), not these copies.
  • Same direction as your 2080 Ti numbers, about −1 ms of card time (≈ 3 %), but with this many phases it is within the noise (sign test p = 0.25 for card time). No regression in frame time or in the tails.
  • By eye: no change in the picture at the 15-second flips (lighting, reflections, flicker).
Windows 11 test of this switch: in-run A/B on a GPU-bound laptop. **Setup** - RTX 5080 Laptop GPU 16 GB, Core Ultra 9 275HX, 64 GB, Windows 11 (26300), driver 621.47. - `f3840d73` + this PR (`7e53e473`), release build with `--features ab`. The translator id is unchanged, so the warm cache was used (pipeline library 938 MB). - Series X profile, 2560x1440, DLSS Quality, no frame generation, no frame cap, ray tracing off. - `DARNER_AB=15,DARNER_ALIAS_DIRECT`: the switch flipped every 15 s during one 16.7-minute run, so both sides saw the same places (moving around the city, not one fixed spot). `DARNER_CARD_TIMES=1` on both sides. - The path is hit here: the `written_as=42 read_as=67` view line was logged 1861 times with `direct=false` and 1802 times with `direct=true`. **Result** (61 phases in the world, 30 off and 31 on, 60 neighbouring pairs) | | off | on | on − off | |---|---|---|---| | frame time, mean of the phase means | 37.08 ms | 36.94 ms | pairs: mean −0.19, median −0.60 ms; on faster in 33 of 60 | | card time in the title's lists | 32.19 ms | 31.65 ms | pairs: mean −0.47, median −0.64 ms; on faster in 35 of 60 | | card time, adjusted for draws a frame (least squares) | | | −1.07 ms (95 % CI −2.48 to +0.33) | | every frame (CSV): p50 / p99 / p99.9 | 35.1 / 65.2 / 112.1 ms | 35.1 / 65.0 / 105.7 ms | | | 1 % / 0.1 % low | 10.8 / 4.5 fps | 10.1 / 3.2 fps | the on side holds the world-entry frame (1276 ms: 59 pipelines loaded from the library) | | frames over 100 ms / over 500 ms | 18 / 1 | 18 / 2 | | - The card is the limit on this machine: `DARNER_CARD_TIMES` gives 32.0 ms busy a frame (the union of the lists) against frames of about 37 ms. - The longest frames on both sides are pipeline waits (library loads at world entry, one or two new pipelines later), not these copies. - Same direction as your 2080 Ti numbers, about −1 ms of card time (≈ 3 %), but with this many phases it is within the noise (sign test p = 0.25 for card time). No regression in frame time or in the tails. - By eye: no change in the picture at the 15-second flips (lighting, reflections, flicker).
First-time contributor

Replay A/B on RTX 5070 Ti desktop (Windows 11): about +5 % fps with DARNER_ALIAS_DIRECT=1

This adds a desktop Windows 11 data point next to the 2080 Ti and 5080 Laptop numbers above, with a well-sampled release baseline.

Measured release v2026.12.03.02 (f3840d73) with DARNER_ALIAS_DIRECT=1 against the same release with the switch unset. This PR only flips that default (plus README and a test), so the switch-on runs exercise the same code. Route: ~6.5 minutes replayed from the same save with recorded controller input (a cutscene, a scene cut and a stretch of free play). The path is hit: the R32_UINT → R9G9B9E5 view line is logged 59 times per run, direct=true with the switch, direct=false without.

Build runs fps (range) CPU prep ms on the GPU ms (host line) median ms p95 ms p99 ms frames over 100 ms per run
v2026.12.03.02 11 37.99 (37.70-38.26) 9.86 4.07 26.9 29.6 35.6 6-11
+ DARNER_ALIAS_DIRECT=1 2 39.81 (39.73-39.90) 9.89 3.17 25.8 28.1 33.5 12 / 6
  • Mean fps +4.8 %; both switch-on runs are above the fastest of the 11 release runs. CPU prep is unchanged, so the gain is on the card side, consistent with one copy instead of two.
  • Crashes: none in any run. The long frames over 100 ms (including one ~2.7-3.6 s frame early in the route) are present in every release run too, not caused by the switch.
  • Only 2 switch-on runs so far; the release spread comes from 11 runs on the same day.

Config: RTX 5070 Ti 16 GB, Ryzen 7 9800X3D, 32 GB RAM, Windows 11; scripts\play-nvidia.ps1 -Build release (Series X, 1440p native, DLSS Quality, no frame generation, ray tracing off, fullscreen, no fps cap). Each configuration had an unmeasured warm-up run first.

Measured unattended on a replay bench (same save, recorded controller input); numbers and text prepared with Claude.

### Replay A/B on RTX 5070 Ti desktop (Windows 11): about +5 % fps with `DARNER_ALIAS_DIRECT=1` This adds a desktop Windows 11 data point next to the 2080 Ti and 5080 Laptop numbers above, with a well-sampled release baseline. Measured release v2026.12.03.02 (`f3840d73`) with `DARNER_ALIAS_DIRECT=1` against the same release with the switch unset. This PR only flips that default (plus README and a test), so the switch-on runs exercise the same code. Route: ~6.5 minutes replayed from the same save with recorded controller input (a cutscene, a scene cut and a stretch of free play). The path is hit: the R32_UINT → R9G9B9E5 view line is logged 59 times per run, `direct=true` with the switch, `direct=false` without. | Build | runs | fps (range) | CPU prep ms | `on the GPU` ms (host line) | median ms | p95 ms | p99 ms | frames over 100 ms per run | |---|---:|---:|---:|---:|---:|---:|---:|---| | v2026.12.03.02 | 11 | 37.99 (37.70-38.26) | 9.86 | 4.07 | 26.9 | 29.6 | 35.6 | 6-11 | | + `DARNER_ALIAS_DIRECT=1` | 2 | 39.81 (39.73-39.90) | 9.89 | 3.17 | 25.8 | 28.1 | 33.5 | 12 / 6 | - Mean fps +4.8 %; both switch-on runs are above the fastest of the 11 release runs. CPU prep is unchanged, so the gain is on the card side, consistent with one copy instead of two. - Crashes: none in any run. The long frames over 100 ms (including one ~2.7-3.6 s frame early in the route) are present in every release run too, not caused by the switch. - Only 2 switch-on runs so far; the release spread comes from 11 runs on the same day. Config: RTX 5070 Ti 16 GB, Ryzen 7 9800X3D, 32 GB RAM, Windows 11; `scripts\play-nvidia.ps1 -Build release` (Series X, 1440p native, DLSS Quality, no frame generation, ray tracing off, fullscreen, no fps cap). Each configuration had an unmeasured warm-up run first. Measured unattended on a replay bench (same save, recorded controller input); numbers and text prepared with Claude.
Contributor

Test report on an RTX 4080 with hardware ray tracing: about 0.85 ms of card time a frame less, picture unchanged.

PC: RTX 4080 16 GB (driver 621.40), i7-13700K, 64 GB, Windows 11 26300. Series X profile, 1440p with DLSS Quality, frame generation off, hardware ray tracing on, Reflex off.
Build: main 47d21cd + #334, #337, #457, #274, #397, #312, #304, #303, #438, #439, warm pipelines; only DARNER_ALIAS_DIRECT differs between the two runs (the switch, as in the release, so the same code this PR turns on).
Method: the opening scene of one save, entered the same way every run (no input after the start screen); medians of per-second values from the host log in three 45-second windows from the moment the world appears; one run each.

DARNER_ALIAS_DIRECT unset =1
card time in the title's lists, ms a frame 23.4 / 23.3 / 23.4 22.6 / 22.4 / 22.6
frame time, ms 25.6 / 25.5 / 25.6 25.9 / 25.0 / 25.0
fps 39 / 39 / 39 39 / 40 / 40

So about 0.85 ms (3.6%) less card time with ray tracing on, next to the other cards above. The lit room 60 s in looks the same in both screenshots, and the logs have no errors besides Streamline's presentCommon() was not observed once at start, in both runs.

Not tested: more than one run each, a scene outdoors.

Test report on an RTX 4080 with hardware ray tracing: about 0.85 ms of card time a frame less, picture unchanged. **PC:** RTX 4080 16 GB (driver 621.40), i7-13700K, 64 GB, Windows 11 26300. Series X profile, 1440p with DLSS Quality, frame generation off, **hardware ray tracing on**, Reflex off. **Build:** main 47d21cd + #334, #337, #457, #274, #397, #312, #304, #303, #438, #439, warm pipelines; only `DARNER_ALIAS_DIRECT` differs between the two runs (the switch, as in the release, so the same code this PR turns on). **Method:** the opening scene of one save, entered the same way every run (no input after the start screen); medians of per-second values from the host log in three 45-second windows from the moment the world appears; one run each. | | `DARNER_ALIAS_DIRECT` unset | `=1` | |---|---|---| | card time in the title's lists, ms a frame | 23.4 / 23.3 / 23.4 | 22.6 / 22.4 / 22.6 | | frame time, ms | 25.6 / 25.5 / 25.6 | 25.9 / 25.0 / 25.0 | | fps | 39 / 39 / 39 | 39 / 40 / 40 | So about 0.85 ms (3.6%) less card time with ray tracing on, next to the other cards above. The lit room 60 s in looks the same in both screenshots, and the logs have no errors besides Streamline's `presentCommon() was not observed` once at start, in both runs. Not tested: more than one run each, a scene outdoors.
First-time contributor

Integrated cleanly onto c8258f9, passed cargo xtask policy, clippy --all-features --all-targets -- -D warnings (0 warnings), and full unit tests (1,819 in darner-gpu, 219 in darner), and ran stably over 30,000+ frames of Series X gameplay on RTX 5070 Ti 16 GB / Core Ultra 7 265KF / 64 GB DDR5-6400 (handling up to 26,087 MB of texture uploads cleanly, including aliased R32/R9G9B9E5 light views) with zero crashes or visual regressions.

Integrated cleanly onto `c8258f9`, passed `cargo xtask policy`, `clippy --all-features --all-targets -- -D warnings` (0 warnings), and full unit tests (`1,819` in `darner-gpu`, `219` in `darner`), and ran stably over 30,000+ frames of Series X gameplay on RTX 5070 Ti 16 GB / Core Ultra 7 265KF / 64 GB DDR5-6400 (handling up to `26,087 MB` of texture uploads cleanly, including aliased R32/R9G9B9E5 light views) with zero crashes or visual regressions.
TrustNo1 changed title from [perf] Textures: alias copies texture to texture by default (DARNER_ALIAS_DIRECT on) to Textures: alias copies texture to texture by default (DARNER_ALIAS_DIRECT on) 2026-12-06 03:30:32 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/282/head:cafe/alias-direct-default'
git switch 'cafe/alias-direct-default'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'Main'
git merge --no-ff 'cafe/alias-direct-default'
git switch 'cafe/alias-direct-default'
git rebase 'Main'
git switch 'Main'
git merge --ff-only 'cafe/alias-direct-default'
git switch 'cafe/alias-direct-default'
git rebase 'Main'
git switch 'Main'
git merge --no-ff 'cafe/alias-direct-default'
git switch 'Main'
git merge --squash 'cafe/alias-direct-default'
git switch 'Main'
git merge --ff-only 'cafe/alias-direct-default'
git switch 'Main'
git merge 'cafe/alias-direct-default'
git push origin 'Main'
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
5 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!282
No description provided.