aspect: ultrawide camera and field of view (VICTORY_ASPECT, VICTORY_FOV) #472

Open
github-bot wants to merge 1 commit from github-bot/gh-472 into main AGit
Owner

@⁠mirrox1337 on GitHub · 2026-12-04 15:03 UTC · original
mirrox1337:ultrawide-fov → main · +212 −0 · 5 files · 1 commits · open

What

Two settings that change what the title's camera shows, without touching the title's code:

Setting Values Effect
VICTORY_ASPECT 2560x1080, 3440x1440, 5120x1440, or a ratio such as 2.39 Ultrawide: the horizontal field is widened to that shape; the vertical one is kept
VICTORY_FOV 0.5 to 2.0 Field of view on both axes, as a factor on what the camera sees (1.25 is a quarter more each way)

Both are off unless set.

How

The title's 16:9 perspective projections are rewritten in the sources of the copies that go up to the card, just before they are copied (host/send.rs): _22 is divided by the field factor and _11 becomes _22 / aspect. Orthographic (interface) matrices and projections that are not at 16:9 (shadow cascades, cube maps) are left alone.

The picture stays 16:9. With VICTORY_ASPECT it is an anamorphic one that the screen or compositor has to stretch, for example gamescope -W 3440 -H 1440 -w 2560 -h 1440 -S stretch.

crate::aspect is Kemerd/VIctory-NVIDIA-RT's crates/victory-gpu/src/aspect.rs (GPL-3.0), called at the same point as there. VICTORY_FOV (fov, on) is added here.

Files

  • crates/victory-gpu/src/aspect.rs: the module (new).
  • crates/victory-gpu/src/host/send.rs: the call before the copies (7 lines); lib.rs: mod aspect.
  • docs/SETTINGS.md, run.conf.default: both settings, so the F1 menu lists them.

Tested

  • PKG=victory-gpu ./build.sh test aspect: 4 tests pass (one added for the field arithmetic). cargo xtask policy passes.
  • Played on one machine: Ryzen 5 9600X, RX 9060 XT, Series S profile at 1920x1080, a 3440x1440 screen through gamescope with -S stretch. VICTORY_ASPECT=3440x1440 fills the screen with a correctly proportioned world.
  • VICTORY_FOV=1.15 was set in the same sessions; it has had less attention than the aspect.

Known limits

  • The interface is drawn in the same 16:9 picture, so it is stretched with it.
  • The title still culls for its own 16:9 camera: things can be missing at the far left and right, more so with a larger VICTORY_FOV.
  • Horizontal sharpness is that of the 16:9 picture.
  • VICTORY_FOV without VICTORY_ASPECT leaves a rewritten matrix at 16:9, so a block copied again without the title rewriting it would be scaled again (noted in the code); not seen in play, since the title writes its projections every frame.
  • Not tried: Series X profile, frame generation together with it, ray tracing on.

🤖 Generated with Claude Code

**@⁠mirrox1337** on GitHub · 2026-12-04 15:03 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/472) `mirrox1337:ultrawide-fov` → `main` · +212 −0 · 5 files · 1 commits · open ## What Two settings that change what the title's camera shows, without touching the title's code: | Setting | Values | Effect | |---|---|---| | `VICTORY_ASPECT` | `2560x1080`, `3440x1440`, `5120x1440`, or a ratio such as `2.39` | Ultrawide: the horizontal field is widened to that shape; the vertical one is kept | | `VICTORY_FOV` | `0.5` to `2.0` | Field of view on both axes, as a factor on what the camera sees (`1.25` is a quarter more each way) | Both are off unless set. ## How The title's 16:9 perspective projections are rewritten in the sources of the copies that go up to the card, just before they are copied (`host/send.rs`): `_22` is divided by the field factor and `_11` becomes `_22 / aspect`. Orthographic (interface) matrices and projections that are not at 16:9 (shadow cascades, cube maps) are left alone. The picture stays 16:9. With `VICTORY_ASPECT` it is an anamorphic one that the screen or compositor has to stretch, for example `gamescope -W 3440 -H 1440 -w 2560 -h 1440 -S stretch`. `crate::aspect` is [Kemerd/VIctory-NVIDIA-RT](https://github.com/Kemerd/VIctory-NVIDIA-RT)'s `crates/victory-gpu/src/aspect.rs` (GPL-3.0), called at the same point as there. `VICTORY_FOV` (`fov`, `on`) is added here. ## Files - `crates/victory-gpu/src/aspect.rs`: the module (new). - `crates/victory-gpu/src/host/send.rs`: the call before the copies (7 lines); `lib.rs`: `mod aspect`. - `docs/SETTINGS.md`, `run.conf.default`: both settings, so the F1 menu lists them. ## Tested - `PKG=victory-gpu ./build.sh test aspect`: 4 tests pass (one added for the field arithmetic). `cargo xtask policy` passes. - Played on one machine: Ryzen 5 9600X, RX 9060 XT, Series S profile at 1920x1080, a 3440x1440 screen through gamescope with `-S stretch`. `VICTORY_ASPECT=3440x1440` fills the screen with a correctly proportioned world. - `VICTORY_FOV=1.15` was set in the same sessions; it has had less attention than the aspect. ## Known limits - The interface is drawn in the same 16:9 picture, so it is stretched with it. - The title still culls for its own 16:9 camera: things can be missing at the far left and right, more so with a larger `VICTORY_FOV`. - Horizontal sharpness is that of the 16:9 picture. - `VICTORY_FOV` without `VICTORY_ASPECT` leaves a rewritten matrix at 16:9, so a block copied again without the title rewriting it would be scaled again (noted in the code); not seen in play, since the title writes its projections every frame. - Not tried: Series X profile, frame generation together with it, ray tracing on. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The title's 16:9 perspective projections are rewritten in the copies'
sources just before they go up: VICTORY_ASPECT=3440x1440 (or a ratio)
widens the horizontal field to that shape, VICTORY_FOV=<0.5..2.0> scales
the field on both axes. The picture stays 16:9 and is stretched by the
screen or compositor (gamescope -S stretch); the title still culls for
its own camera.

crate::aspect is Kemerd/VIctory-NVIDIA-RT's (GPL-3.0), with VICTORY_FOV
added. Both settings are listed in docs/SETTINGS.md and run.conf.default,
so the menu shows them.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-04 15:08:32 +00:00
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-12-04 15:04 UTC · original · edited 2026-12-04 15:08 UTC

Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-04T15:08:49.940196Z d2976c2 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review" or "@⁠codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-12-04 15:04 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/472#issuecomment-7415287900) · edited 2026-12-04 15:08 UTC <!-- codex-pull-request-review-summary --> <!-- codex-review-state:v1 {"code_review":{"commit_sha":"d2976c247a388c8aa9d38ba2b02400b3bf475dda","has_any_findings":true,"has_unresolved_findings":true,"status":"completed"},"security_review":{"commit_sha":null,"has_any_findings":null,"has_unresolved_findings":null,"status":null}} --> <details> <summary><strong>Codex Review Summary</strong>: ✅ Completed</summary> This comment shows the latest Codex review activity on this pull request. | Review | Status | Commit | Review trigger | | --- | --- | --- | --- | | 📝 **Code Review** | ✅ **Completed** <relative-time datetime="2026-12-04T15:08:49.940196Z">2026-12-04T15:08:49.940196Z</relative-time> | `d2976c2` | PR opened | <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review" or "@⁠codex security review". Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. </details> </details>
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-12-04 15:08 UTC · original · reviewed

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d2976c247a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@⁠codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback".

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-12-04 15:08 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/472#pullrequestreview-6191340241) · **reviewed** <!-- codex-review-receipt:v1 --> ### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `d2976c247a` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@⁠codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@⁠codex address that feedback". </details>
@ -227,1 +227,4 @@
};
// VICTORY_ASPECT (crate::aspect): the title's 16:9 projections in what is about to go up are widened first.
if crate::aspect::on() {
for &(src, _, len) in moves.iter().filter(|m| m.0 != 0 && m.2 != 0) {
Author
Owner

@⁠chatgpt-codex-connector[bot] on GitHub · 2026-12-04 15:08 UTC · original

P2 Badge Scan complete matrices before splitting dirty sends

When a camera projection arrives in a ≤256-byte, dword-aligned dirty span, take routes it through the scatter work, but moves contains only the non-short copy.runs, so this loop never tunes it and the scatter then uploads the raw _11/_22, undoing a prior rewrite. Even long spans are scanned relative to their own start, although dirty runs are only dword-aligned and tune advances in 16-byte steps, so a matrix in a phase-shifted run is missed too; scan complete matrices on their buffer-aligned grid before splitting sends.

Useful? React with 👍 / 👎.

**@⁠chatgpt-codex-connector[bot]** on GitHub · 2026-12-04 15:08 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/472#discussion_r4801607938) **<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Scan complete matrices before splitting dirty sends** When a camera projection arrives in a ≤256-byte, dword-aligned dirty span, `take` routes it through the scatter work, but `moves` contains only the non-short `copy.runs`, so this loop never tunes it and the scatter then uploads the raw `_11`/`_22`, undoing a prior rewrite. Even long spans are scanned relative to their own start, although dirty runs are only dword-aligned and `tune` advances in 16-byte steps, so a matrix in a phase-shifted run is missed too; scan complete matrices on their buffer-aligned grid before splitting sends. Useful? React with 👍 / 👎. <!-- codex-code-review-finding:v1 -->
Author
Owner

@⁠Kal0s-design on GitHub · 2026-12-04 17:04 UTC · original

Checked d2976c2 against main. Tests ran natively on Windows (MSVC build, not Wine). I did not try it in game.

Off by default holds. With both variables unset the only new work on the send path is one aspect::on() check per take() call (send.rs:229), which is two cached OnceLock reads. It is not per copy and nothing else in take() changes. The full victory-gpu lib suite gives 343 passed, 5 failed, and all 5 also fail on main (the two indirect host_list tests, the two pipeline library loads, and the flaky watch test). The 4 aspect tests pass. There are no send-specific unit tests, and the host and shadow tests pass apart from those same known ones.

Parsing, from a child process per value (aspect.rs:33-62)

  • 3440x1440, 2560X1080, 5120 x 1440, 2.39 all parse as expected.
  • 21:9 and 32/9 turn the feature off silently. People will type 21:9, so either accept : or log a line when the value is rejected. Same for VICTORY_FOV=1,25 or 2.01, which quietly fall back to 1.0.
  • 0x0, 1x0, NaN, inf and 8 are rejected, so no NaN or inf reaches the matrix. -3440x-1440 is accepted as 2.39, which does no harm.
  • An FOV outside 0.5..2.0 or a NaN gives 1.0. That's fine.

Math

  • _11 = _22 / aspect keeps the vertical field and widens the horizontal one, which is correct Hor+. With a 60 degree vertical field, 3440x1440 gives about 108 degrees horizontal against 91.5 at 16:9, and the vertical stays at 60.
  • VICTORY_FOV divides _22, so it scales tan(half fov) as documented.
  • With VICTORY_ASPECT set, a rewritten matrix is no longer picked up again, so rewriting the same bytes repeatedly is a no-op. I checked down to 1.7979.
  • With VICTORY_FOV alone, running the same bytes through five times rewrote them five times (60 to about 121 degrees vertical at 1.25). You already note this. I could not find a path where the same CPU side goes up twice without a refresh from title memory in between, but I did not prove there is none.

Detector (aspect.rs:73-89), from a local test I am not pushing

  • 2M dense random matrices: 0 hits. 2M raw random bit patterns: 0 hits.
  • 2M sparse matrices (70% zeros, 20% ±1, 10% random): 1 hit.
  • 200k real 16:9 projections with random fov 5 to 120 and random near/far, in the layout with _43 = ±1: all found, for standard, reversed and infinite reversed z. The 1:1 (shadow/cube), 16:10, orthographic, inverse projection and projection-times-view cases are all left alone.
  • It only matches that one layout. The same projections in the XMMatrixPerspectiveFovLH layout (_34 = 1, _43 = -zn*q) are never found: 0 of 200k. A projection with TAA jitter or an off-centre term in _13/_23 (or _31/_32) is also skipped, and so is one with _22 < 0. You saw it working in game, so the title's matrix presumably has the matched shape. These misses go in the safe direction.
  • False positives come from _44 == 1 being accepted (aspect.rs:80). Any affine matrix that has a 16:9 ratio between its x and y scales, no x/y translation and a z translation of exactly ±1 is taken as a projection, and so is an orthographic one that maps z with _43 = -1. In the affine set, all of those I built were matched and nothing else was. Every perspective I tried has _44 == 0, so requiring that would remove this class without losing any of them.

Where it runs

  • tune runs on the submitting thread inside take(), before the pair work and before copy_all (send.rs:228-242), so the ordering against the copy up is right. It writes to the same memory the existing code already assumes only this thread touches at that point.
  • It writes into shadow.card_data(), which is the copy's CPU side (shadow.rs:1442-1444), not title memory. The module doc at aspect.rs:15-17 says the opposite, and aspect.rs:6 points to crate::shadow::tune_aspect, which does not exist in this repo. Worth fixing so the next reader doesn't rely on it.
  • Only moves are scanned. Runs that are 4-byte aligned and up to 256 bytes go as pairs (send.rs:27-29, 169, 211-224) and are sent untouched. So a projection that goes up in a small run, for example a small title buffer copy through send_copied, keeps 16:9.
  • The scan walks 16-byte steps from the start of each run (aspect.rs:115), not from the buffer, so a matrix that is 4, 8 or 12 bytes off that grid is missed. My grid probe confirms it.
  • The f32 slice cast at aspect.rs:113 needs 4-byte alignment. Runs that are not 4-aligned go to moves too (send.rs:27-29). In a debug build the same cast on an odd address aborts the process with Rust's unsafe precondition check. I reproduced that in a test. Release builds don't check, and x86 copes, but it is UB on paper. Reading with read_unaligned/write_unaligned, or skipping misaligned runs, avoids it.

Cost when on: the scan reads every byte of every large send once more on the submitting thread. In an unoptimized test build it took about 1.3 to 2 ms per MiB. A release build will be much faster, but I did not measure one.

So it does nothing when off, which is the main thing. When on, the detector looks safe on random data. Suggestions are _44 == 0, an accepted 21:9 or a log line on a bad value, an unaligned-safe read, and a corrected doc comment. The small-run and grid gaps are worth a note in Known limits unless the title's camera buffer is known to always go up as a large aligned run.

AI-assisted: yes

**@⁠Kal0s-design** on GitHub · 2026-12-04 17:04 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/472#issuecomment-7418382945) Checked d2976c2 against main. Tests ran natively on Windows (MSVC build, not Wine). I did not try it in game. Off by default holds. With both variables unset the only new work on the send path is one `aspect::on()` check per `take()` call (send.rs:229), which is two cached OnceLock reads. It is not per copy and nothing else in `take()` changes. The full victory-gpu lib suite gives 343 passed, 5 failed, and all 5 also fail on main (the two indirect host_list tests, the two pipeline library loads, and the flaky watch test). The 4 aspect tests pass. There are no send-specific unit tests, and the host and shadow tests pass apart from those same known ones. Parsing, from a child process per value (aspect.rs:33-62) - `3440x1440`, `2560X1080`, ` 5120 x 1440 `, `2.39` all parse as expected. - `21:9` and `32/9` turn the feature off silently. People will type `21:9`, so either accept `:` or log a line when the value is rejected. Same for `VICTORY_FOV=1,25` or `2.01`, which quietly fall back to 1.0. - `0x0`, `1x0`, `NaN`, `inf` and `8` are rejected, so no NaN or inf reaches the matrix. `-3440x-1440` is accepted as 2.39, which does no harm. - An FOV outside 0.5..2.0 or a NaN gives 1.0. That's fine. Math - `_11 = _22 / aspect` keeps the vertical field and widens the horizontal one, which is correct Hor+. With a 60 degree vertical field, 3440x1440 gives about 108 degrees horizontal against 91.5 at 16:9, and the vertical stays at 60. - `VICTORY_FOV` divides `_22`, so it scales tan(half fov) as documented. - With `VICTORY_ASPECT` set, a rewritten matrix is no longer picked up again, so rewriting the same bytes repeatedly is a no-op. I checked down to 1.7979. - With `VICTORY_FOV` alone, running the same bytes through five times rewrote them five times (60 to about 121 degrees vertical at 1.25). You already note this. I could not find a path where the same CPU side goes up twice without a refresh from title memory in between, but I did not prove there is none. Detector (aspect.rs:73-89), from a local test I am not pushing - 2M dense random matrices: 0 hits. 2M raw random bit patterns: 0 hits. - 2M sparse matrices (70% zeros, 20% ±1, 10% random): 1 hit. - 200k real 16:9 projections with random fov 5 to 120 and random near/far, in the layout with `_43 = ±1`: all found, for standard, reversed and infinite reversed z. The 1:1 (shadow/cube), 16:10, orthographic, inverse projection and projection-times-view cases are all left alone. - It only matches that one layout. The same projections in the XMMatrixPerspectiveFovLH layout (`_34 = 1`, `_43 = -zn*q`) are never found: 0 of 200k. A projection with TAA jitter or an off-centre term in `_13/_23` (or `_31/_32`) is also skipped, and so is one with `_22 < 0`. You saw it working in game, so the title's matrix presumably has the matched shape. These misses go in the safe direction. - False positives come from `_44 == 1` being accepted (aspect.rs:80). Any affine matrix that has a 16:9 ratio between its x and y scales, no x/y translation and a z translation of exactly ±1 is taken as a projection, and so is an orthographic one that maps z with `_43 = -1`. In the affine set, all of those I built were matched and nothing else was. Every perspective I tried has `_44 == 0`, so requiring that would remove this class without losing any of them. Where it runs - `tune` runs on the submitting thread inside `take()`, before the pair work and before `copy_all` (send.rs:228-242), so the ordering against the copy up is right. It writes to the same memory the existing code already assumes only this thread touches at that point. - It writes into `shadow.card_data()`, which is the copy's CPU side (shadow.rs:1442-1444), not title memory. The module doc at aspect.rs:15-17 says the opposite, and aspect.rs:6 points to `crate::shadow::tune_aspect`, which does not exist in this repo. Worth fixing so the next reader doesn't rely on it. - Only `moves` are scanned. Runs that are 4-byte aligned and up to 256 bytes go as pairs (send.rs:27-29, 169, 211-224) and are sent untouched. So a projection that goes up in a small run, for example a small title buffer copy through `send_copied`, keeps 16:9. - The scan walks 16-byte steps from the start of each run (aspect.rs:115), not from the buffer, so a matrix that is 4, 8 or 12 bytes off that grid is missed. My grid probe confirms it. - The `f32` slice cast at aspect.rs:113 needs 4-byte alignment. Runs that are not 4-aligned go to `moves` too (send.rs:27-29). In a debug build the same cast on an odd address aborts the process with Rust's unsafe precondition check. I reproduced that in a test. Release builds don't check, and x86 copes, but it is UB on paper. Reading with `read_unaligned`/`write_unaligned`, or skipping misaligned runs, avoids it. Cost when on: the scan reads every byte of every large send once more on the submitting thread. In an unoptimized test build it took about 1.3 to 2 ms per MiB. A release build will be much faster, but I did not measure one. So it does nothing when off, which is the main thing. When on, the detector looks safe on random data. Suggestions are `_44 == 0`, an accepted `21:9` or a log line on a bad value, an unaligned-safe read, and a corrected doc comment. The small-run and grid gaps are worth a note in Known limits unless the title's camera buffer is known to always go up as a large aligned run. AI-assisted: yes
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/472/head:github-bot/gh-472'
git switch 'github-bot/gh-472'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-472'
git switch 'github-bot/gh-472'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-472'
git switch 'github-bot/gh-472'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-472'
git switch 'main'
git merge --squash 'github-bot/gh-472'
git switch 'main'
git merge --ff-only 'github-bot/gh-472'
git switch 'main'
git merge 'github-bot/gh-472'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.