[pr-feature][rendering] Depth of field off (DARNER_DOF=0, off by default; F1 PICTURE > DEPTH OF FIELD, next start) #9
Loading…
Reference in a new issue
No description provided.
Delete branch "Jesper-A/Darner:pr4-dof"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Contributor role (optional)
What it changes
Re-filed from CodeFloe #316 (the CodeFloe repo is gone; nothing was migrated). Same branch and commit.
This is a draft. The change has not been run in the game on this base yet (see "How it was tested"), and current
mainconflicts with it in two files (see "Checklist").Base: the branch is on
f2bccf656, themaincommit it was cut from.mainis nowdd2f061d5. Not rebased (we rebase only if you ask). A text-only trial merge (git merge-tree --write-tree trustno1/main pr4-dof) conflicts incrates/darner-gpu/src/host/menu.rsanddocs/findings.md; the other files merge cleanly.Credit: a port of the depth of field part of PR #3590 of 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 and the offsets are theirs. The code is re-written with our names for the current tree and without the lens flare switch it sat on there. The commit message names them.
New switch:
DARNER_DOF=0. Default: off, meaning not set: the title's own depth of field, nothing written. WithDARNER_DOF=0at the start, the game's depth of field (blur by distance, in cutscenes and scopes too) is set up as none.How: the title has one depth of field object whose kind is decided once, when the object is made, and read every frame. Kind 0 (what a failed setup leaves) skips all its passes. The kind comes from a small routine that stores a kind pair. With the switch at 0, the kind's byte in that routine is patched to 0 before any title thread runs (
darner_hle::viewhook::install,darner_loader::callhook::patch_bytes, which checks the old byte). The routine, its one call site and the place where the setup takes the kind are compared with their expected bytes first. If any differs (a build of the title this does not know), nothing is written,depth of field: NOT ACTIVEis logged and F1 shows NOT ACTIVE.viewhook::installis called only whenDARNER_DOF=0is in the environment at the start (Armed::from_env().dof, inapps/darner/src/run.rs, with a// SAFETY:comment). Unset or any other value: nothing is read or written.Not live: changing the kind while the title runs would leave its targets unresized on a resolution change, so F1 > PICTURE > DEPTH OF FIELD (ON / OFF) applies at the next start. No shader change, so the shader cache key is unchanged.
Also: a README row (Picture and upscaling, 27 to 28 settings) and a
docs/findings.mdentry.Files (
git diff --stat f2bccf656 ba8cf0e4e, 9 files, +387/-2):crates/darner-hle/src/viewhook.rs(new, 246 lines),crates/darner-gpu/src/view_fx.rs(new, 99 lines),crates/darner-gpu/src/host/menu.rs,crates/darner-gpu/src/lib.rs,crates/darner-hle/src/lib.rs,apps/darner/src/play.rs,apps/darner/src/run.rs,README.md,docs/findings.md.Spec dependence
Likely general: no GPU or shader code is touched, so no card, driver or wave size dependence is expected. The F1 row and the README text are plain UI and docs.
May depend on our setup: the patch is a byte in the title's own code, so it depends on the title build, not on the card. The offsets are for one known build; the checks above refuse anything else. Our PC, where nothing was run for this commit yet: RTX 2070 SUPER 8 GB (Turing), driver 621.40, Resizable BAR off, Ryzen 7 5800X, 32 GB, Windows 11 Pro Insider 26320, Series S profile with DLSS Performance.
Untested elsewhere: any other card, any other title build (it should answer NOT ACTIVE; not tried), cutscenes and scopes one by one, DLSS and frame generation combinations.
How it was tested
ba8cf0e4eonmainf2bccf656.mainhas moved since (nowdd2f061d5); not retested there.ba8cf0e4e):cargo test --locked -p darner-gpu --lib -- view_fx menu: 40 passed, 0 failed, 1 ignored.cargo test --locked -p darner-hle --lib viewhook: 4 passed.cargo clippy --locked --all-features -p darner-gpu -p darner-hle -p darner -- -D warnings -A clippy::unnecessary_lazy_evaluations: clean. This is narrower than upstream's gate 2 (three crates, no--workspace --all-targets, and one lint allowed).cargo xtask policy: ok.cargo clippy --workspace --all-targets --locked -- -D warnings), gate 2 (the same with--all-features) and gate 3 (cargo test --workspace --locked). There is no CI upstream, so nothing else has checked this.Checklist
main(f2bccf656; see the last bullet).docs/asset-policy.md(cargo xtask policy: ok). No game data: the code holds a few expected instruction bytes and offsets for the checks.main: a trial merge ofba8cf0e4eintodd2f061d5(git merge-tree --write-tree) conflicts incrates/darner-gpu/src/host/menu.rsanddocs/findings.md(the other files merge cleanly). This PR stays onf2bccf656; I will update this same PR if the maintainer asks, and retest then.mainhas added picture rows to F1 since, so the DEPTH OF FIELD row's place and the menu tests will need adjusting then.Checked for overlap
DARNER_DOF,viewhookor blur, andDARNER_DOFis not onmain(dd2f061d5). The one open pull request (#3, ray tracing mode in F1) changeshost/menu.rs,host/panel.rsandhwrt.rs: same filemenu.rsas this change's F1 row, different change. The earlier CodeFloe search (nothing about depth of field among 19 open pull requests; CodeFloe numbers, not migrated) found the same.README.md,crates/darner-gpu/src/host/menu.rs,crates/darner-gpu/src/lib.rs,docs/findings.md), #6 (radial wheel hold:README.md,crates/darner-gpu/src/lib.rs,docs/findings.md) and #7 (long frames:docs/findings.md). Different changes; whichever lands first, the others take the new rows when they are rebased.Update 2026-12-03: marked ready as it stands; the 'draft' and 'not rebased' wording above is out of date, nothing was re-run in the game, and the maintainer will handle the rebase.
This change was made with AI assistance (Claude Code).
darner rig, F1 AUTO-DETECT row, per-start switches (DARNER_AUTO_SWITCHES, on by default, =0 turns it off) #25WIP: [pr-feature][rendering] Depth of field off (DARNER_DOF=0, off by default; F1 PICTURE > DEPTH OF FIELD, next start)to [pr-feature][rendering] Depth of field off (DARNER_DOF=0, off by default; F1 PICTURE > DEPTH OF FIELD, next start)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.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.