[pr-feature][rendering] Lens flares down (DARNER_LENS_FLARE=0, off by default; F1 PICTURE > LENS FLARES, live) #16

Open
Jesper-A wants to merge 4 commits from Jesper-A/Darner:pr6-lens-flare into main
Contributor

Depends on #12

Contributor role (optional)

  • Fluxer ID:

What it changes

Re-filed from an earlier CodeFloe PR (that repo is gone; nothing was migrated). Same branch and commit.

Base: the branch (4 commits: the 2 of pr6-vignette and 2 of its own) is on 4db98e011, the main commit it was cut from. main is now 4a92569fb. Not rebased (WIP; we rebase before WIP comes off, or sooner if you ask). A text-only trial merge (git merge-tree --write-tree --name-only trustno1/main pr6-lens-flare) conflicts in crates/darner-gpu/src/host/menu.rs (the F1 menu table) only; README.md, apps/darner/src/play.rs, apps/darner/src/run.rs and crates/darner-hle/src/lib.rs merge cleanly.

This is a draft and it stays one until the vignette PR (#12) is merged. It has not been run in the game; the cargo results are below.

This branch carries the two commits of the vignette PR (#12) under its own. They share the new files view_fx.rs and viewhook.rs and the F1 row code, so this change cannot stand on main alone. Until #12 merges, this PR's "Files changed" also shows the vignette. This PR's own part is the last two commits (8dee95499, 696d53064): 7 files against the vignette branch (README.md, apps/darner/src/play.rs, apps/darner/src/run.rs, crates/darner-gpu/src/host/menu.rs, crates/darner-gpu/src/view_fx.rs, crates/darner-hle/src/viewhook.rs, docs/findings.md). It contains no depth-of-field code (that is branch pr4-dof).

New switch: DARNER_LENS_FLARE=0. Default: not set, meaning the game's own lens flares, nothing changed and no byte of the title written. With the switch at 0 the lens flares are turned down to their least.

How: the title updates its picture-adjustment presets once a frame, first calling a routine for a fading one. A call-site redirect (darner_loader::callhook::redirect_call, in darner_hle::viewhook) puts a routine of ours before that call. With the switch at 0 it looks up the title's preset for the least flares (by its hash, view_fx::LENS_FLARES_MIN) in the title's own preset table, with the title's own lookup, and applies it at strength 1 with the title's own apply, the way the title applies its presets itself. With the switch on or unset, nothing is looked up.

  • Live. Read each frame (darner_gpu::view_fx); F1 > PICTURE > LENS FLARES (ON / OFF) changes it while the game runs.
  • Armed only when the variable is present at the start (any value; 1 arms it with the flares on). Unset: no hook is installed and nothing is written; the F1 row says NOT ARMED.
  • Checked first. The preset table, the lookup, the apply and the call site are compared with the expected bytes. If one differs, the hook is not put in, lens flares: NOT ACTIVE is logged and F1 shows NOT ACTIVE. If this build's table has no such preset, one warning is logged, nothing is applied and F1 shows MISSING. Offsets are for the one known build of the title.
  • No shader change, so the shader cache key is unchanged. Unit tests use stand-in routines and synthetic bytes.
  • Also: a README row (Picture and upscaling), a docs/findings.md entry, the name in players_own in apps/darner/src/play.rs.

Credit: a port of the lens flare part of a pull request in the project's earlier GitHub repository (author NICKNAMErutschovkonikovan; that repository is gone, so there is no link). The idea, the place in the title's code, the table and the offsets are theirs. The code is re-written with our names for this tree. The commit message carries a Co-authored-by line for them. They had it on by default; here it is off by default.

No upstream issue covers this, so there is no Fixes or Refs line.

Spec dependence

  • Likely general: CPU-side code in the title's image, no GPU, driver or shader involvement.
  • May depend on our setup (RTX 2070 SUPER 8 GB Turing, ReBAR off, Ryzen 7 5800X, 32 GB, Series S + DLSS Performance): nothing known. It depends on the title build matching the expected bytes and holding the preset, not on the PC.
  • Untested elsewhere: every other setup; we have no game run of it.

How it was tested

  • Tested revision: 696d53064 (branch pr6-lens-flare, based on 4db98e011, including the vignette commits; main has moved, see Base).
  • Commands and results:
    • cargo clippy --workspace --all-targets --locked -- -D warnings with -A clippy::unnecessary_lazy_evaluations added: passed. The exact command without that flag was not run.
    • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings, the same flag added: passed.
    • Tests: darner-hle and darner (the crates this touches outside the GPU crate): passed. darner-gpu, full library: one test failed, watch::tests::ask_once_by_res_splits_reservations_without_refusals (once also watch_pipe_epoch_tests::ask_once_delta_reask_direct_carves_refreshes_and_updates_page_epochs). It is in a test file this change does not touch and it passes when run alone. We did not run main for comparison, so we do not know whether it is flaky or an old failure. cargo test --workspace --locked as one command was not run.
    • cargo xtask policy: passed.
    • There is no CI upstream; nothing here was checked by CI.
  • Gameplay, when relevant: not run for this switch.
  • Before and after, when relevant: none.
  • Shader wave sizes tested, when relevant: not relevant (no shader change).
  • Coverage gaps: not run in the game at all, so it is not known how much the flares go down, whether other adjustments the same preset table holds change too, or whether the preset exists in every build; a title build other than the known one (the NOT ACTIVE path is covered by synthetic bytes only); cutscenes; other GPUs; Series X profile; the branch on current main.

Checklist

  • This PR contains one change based on main. (Not yet: it carries the two vignette commits. Own part: 7 files on top of #12. To be ticked when #12 has merged.)
  • The diff follows docs/asset-policy.md. (Text only; cargo xtask policy passed.)
  • I recorded this PR's dependencies below.
    • Depends on #12 (it creates view_fx.rs and viewhook.rs, which this extends)

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: none found for lens flares. On 2026-12-03 this host had 3 issues (#1, #2, #4) and 8 pull requests (#3 by another contributor; #5 to #11 ours, WIP) in total; I searched their titles and bodies for flare, glare and vignette: nothing. The other contributor's pull request (#3, ray tracing mode in F1) changes host/menu.rs, host/panel.rs and hwrt.rs: same file menu.rs as this change's F1 row, different change. #12 (ours, same new files; this depends on it); branch pr4-dof (ours, DARNER_DOF=0) also creates view_fx.rs and viewhook.rs. Expect small merge conflicts in the F1 menu table.
  • Our own re-filed PRs that touch the same files: #6 (README.md, crates/darner-gpu/src/lib.rs, docs/findings.md); #7 (docs/findings.md); #8 (README.md, crates/darner-gpu/src/host/menu.rs, crates/darner-gpu/src/lib.rs, docs/findings.md); #9 (README.md, apps/darner/src/play.rs, apps/darner/src/run.rs, crates/darner-gpu/src/host/menu.rs, crates/darner-gpu/src/lib.rs, crates/darner-gpu/src/view_fx.rs, crates/darner-hle/src/lib.rs, crates/darner-hle/src/viewhook.rs, docs/findings.md); #10 (README.md, docs/findings.md); #11 (README.md, apps/darner/src/run.rs). #5 share no file. Different changes; whichever lands first, the others take its rows when they are rebased.

Update 2026-12-03: marked ready as it stands, by decision, although it still depends on #12. Its two vignette commits (0ac6486dd and b566aa117) sit under this one, so merging this also brings in #12, or #12 can go first. The 'draft until #12 is merged' and 'not rebased' wording above is out of date, and the 'one change' checkbox stays unticked for that reason. It has not been run in the game at all; only the cargo results above exist. The maintainer will handle the rebase.

This change was made with AI assistance (Claude Code).

Depends on #12 ## Contributor role (optional) - Fluxer ID: ## What it changes Re-filed from an earlier CodeFloe PR (that repo is gone; nothing was migrated). Same branch and commit. **Base:** the branch (4 commits: the 2 of `pr6-vignette` and 2 of its own) is on `4db98e011`, the `main` commit it was cut from. `main` is now `4a92569fb`. Not rebased (WIP; we rebase before WIP comes off, or sooner if you ask). A text-only trial merge (`git merge-tree --write-tree --name-only trustno1/main pr6-lens-flare`) **conflicts** in `crates/darner-gpu/src/host/menu.rs` (the F1 menu table) only; `README.md`, `apps/darner/src/play.rs`, `apps/darner/src/run.rs` and `crates/darner-hle/src/lib.rs` merge cleanly. This is a draft and it stays one until the vignette PR (#12) is merged. It has not been run in the game; the cargo results are below. **This branch carries the two commits of the vignette PR (#12) under its own.** They share the new files `view_fx.rs` and `viewhook.rs` and the F1 row code, so this change cannot stand on `main` alone. Until #12 merges, this PR's "Files changed" also shows the vignette. This PR's own part is the last two commits (`8dee95499`, `696d53064`): 7 files against the vignette branch (`README.md`, `apps/darner/src/play.rs`, `apps/darner/src/run.rs`, `crates/darner-gpu/src/host/menu.rs`, `crates/darner-gpu/src/view_fx.rs`, `crates/darner-hle/src/viewhook.rs`, `docs/findings.md`). It contains no depth-of-field code (that is branch `pr4-dof`). **New switch: `DARNER_LENS_FLARE=0`.** Default: not set, meaning the game's own lens flares, nothing changed and no byte of the title written. With the switch at 0 the lens flares are turned down to their least. How: the title updates its picture-adjustment presets once a frame, first calling a routine for a fading one. A call-site redirect (`darner_loader::callhook::redirect_call`, in `darner_hle::viewhook`) puts a routine of ours before that call. With the switch at 0 it looks up the title's preset for the least flares (by its hash, `view_fx::LENS_FLARES_MIN`) in the title's own preset table, with the title's own lookup, and applies it at strength 1 with the title's own apply, the way the title applies its presets itself. With the switch on or unset, nothing is looked up. - **Live.** Read each frame (`darner_gpu::view_fx`); F1 > PICTURE > LENS FLARES (ON / OFF) changes it while the game runs. - **Armed only when the variable is present at the start** (any value; `1` arms it with the flares on). Unset: no hook is installed and nothing is written; the F1 row says NOT ARMED. - **Checked first.** The preset table, the lookup, the apply and the call site are compared with the expected bytes. If one differs, the hook is not put in, `lens flares: NOT ACTIVE` is logged and F1 shows NOT ACTIVE. If this build's table has no such preset, one warning is logged, nothing is applied and F1 shows MISSING. Offsets are for the one known build of the title. - No shader change, so the shader cache key is unchanged. Unit tests use stand-in routines and synthetic bytes. - Also: a README row (Picture and upscaling), a `docs/findings.md` entry, the name in `players_own` in `apps/darner/src/play.rs`. **Credit:** a port of the lens flare part of a pull request in the project's earlier GitHub repository (author **NICKNAMErutschovkonikovan**; that repository is gone, so there is no link). The idea, the place in the title's code, the table and the offsets are theirs. The code is re-written with our names for this tree. The commit message carries a `Co-authored-by` line for them. They had it on by default; here it is off by default. No upstream issue covers this, so there is no `Fixes` or `Refs` line. ### Spec dependence - **Likely general:** CPU-side code in the title's image, no GPU, driver or shader involvement. - **May depend on our setup** (RTX 2070 SUPER 8 GB Turing, ReBAR off, Ryzen 7 5800X, 32 GB, Series S + DLSS Performance): nothing known. It depends on the title build matching the expected bytes and holding the preset, not on the PC. - **Untested elsewhere:** every other setup; we have no game run of it. ## How it was tested - Tested revision: `696d53064` (branch `pr6-lens-flare`, based on `4db98e011`, including the vignette commits; `main` has moved, see Base). - Commands and results: - `cargo clippy --workspace --all-targets --locked -- -D warnings` with `-A clippy::unnecessary_lazy_evaluations` added: passed. The exact command without that flag was not run. - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`, the same flag added: passed. - Tests: `darner-hle` and `darner` (the crates this touches outside the GPU crate): passed. `darner-gpu`, full library: one test failed, `watch::tests::ask_once_by_res_splits_reservations_without_refusals` (once also `watch_pipe_epoch_tests::ask_once_delta_reask_direct_carves_refreshes_and_updates_page_epochs`). It is in a test file this change does not touch and it passes when run alone. We did not run `main` for comparison, so we do not know whether it is flaky or an old failure. `cargo test --workspace --locked` as one command was not run. - `cargo xtask policy`: passed. - There is no CI upstream; nothing here was checked by CI. - Gameplay, when relevant: not run for this switch. - Before and after, when relevant: none. - Shader wave sizes tested, when relevant: not relevant (no shader change). - Coverage gaps: not run in the game at all, so it is not known how much the flares go down, whether other adjustments the same preset table holds change too, or whether the preset exists in every build; a title build other than the known one (the NOT ACTIVE path is covered by synthetic bytes only); cutscenes; other GPUs; Series X profile; the branch on current `main`. ## Checklist - [ ] This PR contains one change based on `main`. (Not yet: it carries the two vignette commits. Own part: 7 files on top of #12. To be ticked when #12 has merged.) - [x] The diff follows `docs/asset-policy.md`. (Text only; `cargo xtask policy` passed.) - [x] I recorded this PR's dependencies below. - Depends on #12 (it creates `view_fx.rs` and `viewhook.rs`, which this extends) ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: none found for lens flares. On 2026-12-03 this host had 3 issues (#1, #2, #4) and 8 pull requests (#3 by another contributor; #5 to #11 ours, WIP) in total; I searched their titles and bodies for flare, glare and vignette: nothing. The other contributor's pull request (#3, ray tracing mode in F1) changes `host/menu.rs`, `host/panel.rs` and `hwrt.rs`: same file `menu.rs` as this change's F1 row, different change. #12 (ours, same new files; this depends on it); branch `pr4-dof` (ours, `DARNER_DOF=0`) also creates `view_fx.rs` and `viewhook.rs`. Expect small merge conflicts in the F1 menu table. - Our own re-filed PRs that touch the same files: #6 (`README.md`, `crates/darner-gpu/src/lib.rs`, `docs/findings.md`); #7 (`docs/findings.md`); #8 (`README.md`, `crates/darner-gpu/src/host/menu.rs`, `crates/darner-gpu/src/lib.rs`, `docs/findings.md`); #9 (`README.md`, `apps/darner/src/play.rs`, `apps/darner/src/run.rs`, `crates/darner-gpu/src/host/menu.rs`, `crates/darner-gpu/src/lib.rs`, `crates/darner-gpu/src/view_fx.rs`, `crates/darner-hle/src/lib.rs`, `crates/darner-hle/src/viewhook.rs`, `docs/findings.md`); #10 (`README.md`, `docs/findings.md`); #11 (`README.md`, `apps/darner/src/run.rs`). #5 share no file. Different changes; whichever lands first, the others take its rows when they are rebased. Update 2026-12-03: marked ready as it stands, by decision, although it still depends on #12. Its two vignette commits (0ac6486dd and b566aa117) sit under this one, so merging this also brings in #12, or #12 can go first. The 'draft until #12 is merged' and 'not rebased' wording above is out of date, and the 'one change' checkbox stays unticked for that reason. It has not been run in the game at all; only the cargo results above exist. The maintainer will handle the rebase. This change was made with AI assistance (Claude Code).
Port of the vignette part of PR #3590 of the earlier GitHub repo (author
NICKNAMErutschovkonikovan), as carried on our branches (c32297b6b), with the
Darner names.

An entry hook on the title's vignette packer hands it a per-thread copy of
the vignette with strength 0 while the setting is off; the title's own values
are never written. The hook is armed only when DARNER_VIGNETTE is present at
the start (any value); unset installs nothing and writes no byte. The packer,
its inner bytes and its two call sites are checked first; when they differ it
logs NOT ACTIVE once and does nothing. The F1 row says NOT ARMED / NOT ACTIVE.
No shader change. Unit tests use synthetic code and images only.

Co-authored-by: NICKNAMErutschovkonikovan <[email protected]>

This change was made with AI assistance (Claude Code).
The row and the findings entry for the vignette switch of the commit before (port of PR #3590 of the earlier GitHub repo, author NICKNAMErutschovkonikovan).

This change was made with AI assistance (Claude Code).
Port of the lens flare part of PR #3590 of the earlier GitHub repo (author
NICKNAMErutschovkonikovan), as carried on our branches (6c17332a4), with the
Darner names.

A call-site redirect puts a routine of ours before the title's per-frame
update of its picture-adjustment presets; with the switch at 0 it looks up
the least-flares preset (by hash) in the title's own table with the title's
own lookup and applies it at strength 1 with the title's own apply. Armed only
when DARNER_LENS_FLARE is present at the start; unset writes no byte. The
table, lookup, apply and call site are checked first (NOT ACTIVE otherwise);
a build without the preset logs once and the F1 row says MISSING. No shader
change. Unit tests use stand-in routines and synthetic bytes.

Co-authored-by: NICKNAMErutschovkonikovan <[email protected]>

This change was made with AI assistance (Claude Code).
The row and the findings entry for the lens flare switch of the commit before (port of PR #3590 of the earlier GitHub repo, author NICKNAMErutschovkonikovan).

This change was made with AI assistance (Claude Code).
Jesper-A changed title from WIP: [pr-feature][rendering] Lens flares down (DARNER_LENS_FLARE=0, off by default; F1 PICTURE > LENS FLARES, live) to [pr-feature][rendering] Lens flares down (DARNER_LENS_FLARE=0, off by default; F1 PICTURE > LENS FLARES, live) 2026-12-03 20:28:53 +00:00
This pull request has changes conflicting with the target branch.
  • README.md
  • crates/darner-gpu/src/host/menu.rs
  • docs/findings.md
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'pr6-lens-flare:Jesper-A-pr6-lens-flare'
git switch 'Jesper-A-pr6-lens-flare'

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 'Jesper-A-pr6-lens-flare'
git switch 'Jesper-A-pr6-lens-flare'
git rebase 'main'
git switch 'main'
git merge --ff-only 'Jesper-A-pr6-lens-flare'
git switch 'Jesper-A-pr6-lens-flare'
git rebase 'main'
git switch 'main'
git merge --no-ff 'Jesper-A-pr6-lens-flare'
git switch 'main'
git merge --squash 'Jesper-A-pr6-lens-flare'
git switch 'main'
git merge --ff-only 'Jesper-A-pr6-lens-flare'
git switch 'main'
git merge 'Jesper-A-pr6-lens-flare'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
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!16
No description provided.