fix(vk): the Lens of Truth's eye at the picture's own shape on ultrawide and 16:10 screens #2713

Merged
HumanBean merged 6 commits from bulldogsajr22/Longshot:fix/lens-eye-ultrawide into main 2026-11-28 04:20:34 +00:00
Contributor

Summary

On a picture wider than 16:9, the Lens of Truth's purple eye is drawn stretched to the screen's width, but what the Lens reveals is not: the reveal stays 1.4 half heights wide, as on 16:9. Between the reveal's edge and the drawn eye's tips, a strip inside each side of the eye shows the scene un-revealed: the "white sliver" a player sees inside the eye's tips, most visible where a wall is behind it (the left wall in the screenshots below).

To see it on main: Graphics, Aspect ratio 21:9 and Output resolution 5120x2160 (or any 21:9 size), the Shadow Temple B4 (the corridor in the screenshots), put the Lens on. The drawn eye's tips are 1.86 half heights from the centre; the reveal stops at 1.40, leaving 0.46 half heights unrevealed inside each tip. On main the eye is always 79 % of the picture's width (1.4 half heights at 16:9), so at 32:9 its tips reach 2.8 half heights. On a picture narrower than 16:9 the eye is too narrow instead: at 16:10 (the Steam Deck's shape) its tips are 1.25–1.28 half heights from the centre, and the reveal reaches 0.14 half heights past them, under the swirl, where it is hard to see.

Why: the eye is drawn by one program, d547af983903a518, over a ring mesh across the picture. Its fragment program works out each pixel's place in the eye with 16:9 baked in: the eye's edge is 0.9 (1 - (1.26984131 x)^2), where 1.26984131 is 16:9 over the eye's half width of 1.4 (GlassTruthControllerParam's RadiusX), and it takes x into half heights for the eye's ring, bands and edge distance as 3.55555558 u - 1.77777779 (and -1.77777779 again on the edge's slope). The reveal is sized in half heights by the game's code at every shape, so on any other shape the two part. Three more 16:9 assumptions show once that is fixed:

  • the vertex program leaves a hole in the ring mesh at 16:9's x; on a wider picture that is wider than the eye at its own shape, so the eye's sides went undrawn (the sliver stayed);
  • it gives the swirl's noise texture its place across the picture's width, so on a wider picture the swirl's sparkles stretch sideways (1.75 times as wide as high at 32:9);
  • outside the eye the swirl glows from the edge value and its square, unclamped, which 16:9 never takes past its own side; at 32:9 the far sides burnt out in green-white streaks that shimmered under DLSS while the camera turned.

This adds an IR pass, lens_eye_pass.h, run on that program as it is translated:

  • LensEyePass (fragment): finds the eye's edge by its shape (FPMul by 1.26984131, squared, FPFma(sq, -0.9, 0.9); exactly one such edge, in a fragment program reading the effect's camera bank 13). It takes the picture's shape from that bank's projection, P[1][1] / P[0][0] (+0x94 / +0x80), once at the program's start, and gives the eye's scale that shape over 1.4, and the program's ±16:9 and ±2×16:9 immediates (in its float multiplies, adds and fused multiply-adds) that shape and twice it. The eye's x (x / 1.4 in half heights) is then clamped at 16:9's side, ±1.26984131, for everything that reads it: inside 16:9's side nothing changes; past it, on a wider picture, the swirl keeps the glow of 16:9's side out to the picture's own.
  • LensEyeVertexPass (vertex, only for the program whose fragment program LensEyePass changed): narrows the ring's hole with the eye, x times (1 - w) 16:9/shape + w, with the same weight the game gives y for the eye's opening (0 on the hole's edge, 1 at the picture's); and gives the swirl noise's u the vertex's place in 16:9's terms, 0.5 + x' (shape / 16:9) / 2, x' the ring's x after that.

A projection with no sane shape (outside 1:2 to 10:1, NaN, an unbound bank) keeps the game's constants. At 16:9 the pass gives back the game's values (in the test: the eye's constant within 2e-7, the place in half heights to the bit, the ring's x and the noise's u within 1e-5; in the game: the same eye, measured below). The camera bank's bound size is raised to cover +0x94 when the game's program read less.

Read first: gpu/vk/eden/shader_recompiler/ir_opt/lens_eye_pass.h, then its two calls in gpu/vk/vk_shader.cpp (translate(), and the graphics pair after it), then tests/lens_eye_ir.cpp and tests/test_lens_eye_pass.py.

No issue or pull request covers it (forge.py search --state all for lens, truth, GlassTruth, ultrawide, 21:9 and the program's key). Related, not changed here: #1867, the Lens's purple effect distorting under FSR 3.1 frame generation at 16:9.

Testing

Tested: Windows 11 Pro (26H2, build 26300), RTX 5090, NVIDIA 621.40, HDR, DLSS, 5120x2160 21:9 monitor. The Shadow Temple B4 save, the Lens on and off, the camera turned both ways. Each part was played in the build that added it, and the whole of it (this head's game code, before its rebase from a3591a98 onto a845154d, which changes neither the eye's instructions nor the IR passes) at 21:9, 32:9 and 16:9; the 21:9 and 16:10 screenshots and the cost are of this head's game code on a845154d:

  • 21:9 (5120x2160): the eye's tips at 1.40 half heights (main @ a845154d at the same spot: 1.86), meeting the reveal: no unrevealed strip (screenshots below). The swirl looks as on 16:9.
  • 32:9 (5120x1440): the eye's tips at 1.39–1.46 half heights across the screenshots (main: 2.8 by the 79 %; not measured), no strip. The swirl's sparkles 1.15 times as wide as high (16:9: 1.01; before the noise change: 1.75). With the glow clamp, the far sides at a video luma of 74 (main: 71; before the clamp: 101, burnt out). Before the clamp, a shimmer under DLSS on the side the scene moves toward while turning was seen in two of three sessions; with it, in none of two with the same steps.
  • 16:9 (3840x2160): the eye's tips at 1.413 / 1.397, its top and bottom at 0.902 / 0.899 half heights, against 1.406 / 1.400 and 0.904 / 0.904 without this change at the same spot: the same eye, the same swirl.
  • 16:10 (3840x2400, pillarboxed on the 21:9 monitor): the eye's tips at 1.41 / 1.42 half heights, the reveal's width (main @ a845154d at the same spot: 1.28 / 1.25); the swirl as on 16:9.
  • The Lens taken off and put on again at 21:9, 32:9 and 16:10: the eye opens and closes as on main.
  • The build log, at translation: vk: program d547af983903a518: the Lens of Truth's eye at the picture's shape, its ring with it, its swirl too.
  • Not tried: SDR, upscalers other than DLSS, frame generation.

Checks:

  • tests/test_lens_eye_pass.py passes: synthetic eye programs through the pass, the eye 1.4 half heights wide at 16:9, 2.37, 2.4, 32:9, 16:10 and 4:3; the game's constants at 16:9 and with no sane projection; the ring's hole and the noise's u at 16:9, 21:9, 32:9, 16:10 and 4:3; the clamped x at 16:9, 21:9 and 32:9; programs of other shapes left alone; and the wiring in vk_shader.cpp. With both passes doing nothing (main's behaviour) it fails: shape 2.37037: half width 1.86667.
  • mise run test on Linux (WSL, Ubuntu 26.04), with mise.toml's pinned tools in a clean environment: 848 pass, 12 fail, 9 skipped. The same 12 fail on main @ a845154d alone, run the same way: test_bug_report, test_control_picture, test_crash_record, test_guest_holes (UploadLayoutGuard undeclared in its fixture), test_input_background, test_linux_saves_move, test_log_open_failure, test_perf_send (its sender fixture doesn't compile), test_pipeline_tour, test_screensaver (show_game_window and others undeclared in its fixture), test_switch_table (LONGSHOT_LAUNCHER_STARTUP, read in host/launcher_startup.h, has no row in switches.def) and test_xinput_thread. No existing check was changed. mise run lint passes.
  • Built on Windows from this source by longshot-builder (from-source, then build) and played as above; the Linux build is left to CI's renderer build check.

Still to test:

  • Linux, AMD (Tier 1), Aspect ratio 21:9, Output resolution 2560x1080: the Lens on, expecting the purple eye about 59 % of the picture's width (main: 79 %) and no unrevealed strip inside its tips (@Beanstalk)
  • Steam Deck (Tier 1), its own 16:10: the Lens on, expecting the eye about 88 % of the picture's width (main: 79 %), its tips where the reveal ends (@Beanstalk)

Measurements

Verdict: fixed: at 21:9 the drawn eye is 1.40 half heights wide, the reveal's width (main: 1.86, 0.46 half heights of each tip unrevealed); 16:10 1.41 (main: 1.26, inside the reveal); 16:9 unchanged. No cost measured: GPU time 10.9 ms a frame with the Lens on (main: 10.9–11.0).

Setup: Windows 11 Pro 26300, RTX 5090, NVIDIA 621.40; 5120x2160, HDR, DLSS, G-SYNC with a 158 fps cap (not reached: about 80 fps). The Shadow Temple B4 save at the screenshots' spot, the Lens on, standing still about 90 s a run; runs alternated main, PR, main, PR. Eye widths: from the screenshots, along the picture's middle row, in half heights of the picture. GPU time and fps: the median of each run's GPU time and presents lines (one each 120 presents) once the room was drawn. This PR's column is 8aa47b40, this head's game code (the head adds test shapes only).

Before: main @ a845154d After: this PR @ 8aa47b40
eye half width, 5120x2160 (reveal: 1.40) 1.86 1.40
unrevealed strip inside each tip, 5120x2160 0.46 half heights none
eye half width, 3840x2400 (16:10, reveal: 1.40) 1.28 / 1.25 1.41 / 1.42
GPU time a frame, Lens on (median, run 1 / run 2) 11.0 / 10.9 ms 10.9 / 10.9 ms
fps, Lens on (median, run 1 / run 2) 79.4 / 80.0 79.7 / 79.9
tests/test_lens_eye_pass.py fails with the passes doing nothing (half width 1.87 at 2.37) passes
longshot main-a845154d run 1: vk: 11640 presents, 79.6 fps; a frame: 730 draws; vk: GPU time 11.0 ms a frame
longshot pr-8aa47b40 run 1:   vk: 6120 presents, 79.8 fps; a frame: 727 draws; vk: GPU time 10.9 ms a frame
longshot main-a845154d run 2: vk: 6000 presents, 80.0 fps; a frame: 725 draws; vk: GPU time 10.9 ms a frame
longshot pr-8aa47b40 run 2:   vk: 5280 presents, 80.1 fps; a frame: 729 draws; vk: GPU time 10.9 ms a frame

Screenshots of the same spot with the Lens on, main @ a845154d and this PR @ 8aa47b40, at 5120x2160 (on main the left wall turns light inside the eye's left tip) and at 3840x2400 (16:10): in a comment below.

Risks

Only the Lens of Truth's eye changes: the one fragment program the pass recognises by its exact edge formula, reading the effect's camera bank, and its vertex program. Anything else is left as translated. Every shape other than 16:9 changes, the Steam Deck's 16:10 among them (Tier 1: in Still to test); at 16:9 the eye is the game's. If the game's projection in bank 13 were ever not the picture's (a shape out of 1:2 to 10:1, or not a number), the eye keeps the game's 16:9 constants, as on main. The added work is a reciprocal and a few multiplies at the start of each of the two programs and one clamp; no cost showed in GPU time at the 0.1 ms the log gives. The change is in the shader translator's sources, so its stamp moves: every player's shader caches are dropped and every program is translated again once after updating, as for any translator change. A revert undoes it; there is no switch.

Not changed here: at 32:9 the swirl's sparkles are still slightly wider than high (1.15 against 16:9's 1.01), the cause not traced (the noise's u, the swirl texture's polar place and the sparkle grid are all in half heights now); at 21:9 they look as on 16:9.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • Screenshots of the same spot on main and here, for a change that shows on screen.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary On a picture wider than 16:9, the Lens of Truth's purple eye is drawn stretched to the screen's width, but what the Lens reveals is not: the reveal stays 1.4 half heights wide, as on 16:9. Between the reveal's edge and the drawn eye's tips, a strip inside each side of the eye shows the scene un-revealed: the "white sliver" a player sees inside the eye's tips, most visible where a wall is behind it (the left wall in the screenshots below). To see it on `main`: Graphics, Aspect ratio 21:9 and Output resolution 5120x2160 (or any 21:9 size), the Shadow Temple B4 (the corridor in the screenshots), put the Lens on. The drawn eye's tips are 1.86 half heights from the centre; the reveal stops at 1.40, leaving 0.46 half heights unrevealed inside each tip. On `main` the eye is always 79 % of the picture's width (1.4 half heights at 16:9), so at 32:9 its tips reach 2.8 half heights. On a picture narrower than 16:9 the eye is too narrow instead: at 16:10 (the Steam Deck's shape) its tips are 1.25–1.28 half heights from the centre, and the reveal reaches 0.14 half heights past them, under the swirl, where it is hard to see. Why: the eye is drawn by one program, `d547af983903a518`, over a ring mesh across the picture. Its fragment program works out each pixel's place in the eye with 16:9 baked in: the eye's edge is `0.9 (1 - (1.26984131 x)^2)`, where 1.26984131 is 16:9 over the eye's half width of 1.4 (`GlassTruthControllerParam`'s RadiusX), and it takes x into half heights for the eye's ring, bands and edge distance as `3.55555558 u - 1.77777779` (and `-1.77777779` again on the edge's slope). The reveal is sized in half heights by the game's code at every shape, so on any other shape the two part. Three more 16:9 assumptions show once that is fixed: - the vertex program leaves a hole in the ring mesh at 16:9's x; on a wider picture that is wider than the eye at its own shape, so the eye's sides went undrawn (the sliver stayed); - it gives the swirl's noise texture its place across the picture's width, so on a wider picture the swirl's sparkles stretch sideways (1.75 times as wide as high at 32:9); - outside the eye the swirl glows from the edge value and its square, unclamped, which 16:9 never takes past its own side; at 32:9 the far sides burnt out in green-white streaks that shimmered under DLSS while the camera turned. This adds an IR pass, `lens_eye_pass.h`, run on that program as it is translated: - `LensEyePass` (fragment): finds the eye's edge by its shape (`FPMul` by 1.26984131, squared, `FPFma(sq, -0.9, 0.9)`; exactly one such edge, in a fragment program reading the effect's camera bank 13). It takes the picture's shape from that bank's projection, `P[1][1] / P[0][0]` (+0x94 / +0x80), once at the program's start, and gives the eye's scale that shape over 1.4, and the program's ±16:9 and ±2×16:9 immediates (in its float multiplies, adds and fused multiply-adds) that shape and twice it. The eye's x (x / 1.4 in half heights) is then clamped at 16:9's side, ±1.26984131, for everything that reads it: inside 16:9's side nothing changes; past it, on a wider picture, the swirl keeps the glow of 16:9's side out to the picture's own. - `LensEyeVertexPass` (vertex, only for the program whose fragment program `LensEyePass` changed): narrows the ring's hole with the eye, x times `(1 - w) 16:9/shape + w`, with the same weight the game gives y for the eye's opening (0 on the hole's edge, 1 at the picture's); and gives the swirl noise's u the vertex's place in 16:9's terms, `0.5 + x' (shape / 16:9) / 2`, x' the ring's x after that. A projection with no sane shape (outside 1:2 to 10:1, NaN, an unbound bank) keeps the game's constants. At 16:9 the pass gives back the game's values (in the test: the eye's constant within 2e-7, the place in half heights to the bit, the ring's x and the noise's u within 1e-5; in the game: the same eye, measured below). The camera bank's bound size is raised to cover +0x94 when the game's program read less. Read first: `gpu/vk/eden/shader_recompiler/ir_opt/lens_eye_pass.h`, then its two calls in `gpu/vk/vk_shader.cpp` (`translate()`, and the graphics pair after it), then `tests/lens_eye_ir.cpp` and `tests/test_lens_eye_pass.py`. No issue or pull request covers it (`forge.py search --state all` for lens, truth, GlassTruth, ultrawide, 21:9 and the program's key). Related, not changed here: #1867, the Lens's purple effect distorting under FSR 3.1 frame generation at 16:9. ## Testing **Tested:** Windows 11 Pro (26H2, build 26300), RTX 5090, NVIDIA 621.40, HDR, DLSS, 5120x2160 21:9 monitor. The Shadow Temple B4 save, the Lens on and off, the camera turned both ways. Each part was played in the build that added it, and the whole of it (this head's game code, before its rebase from a3591a98 onto a845154d, which changes neither the eye's instructions nor the IR passes) at 21:9, 32:9 and 16:9; the 21:9 and 16:10 screenshots and the cost are of this head's game code on a845154d: - 21:9 (5120x2160): the eye's tips at 1.40 half heights (`main` @ a845154d at the same spot: 1.86), meeting the reveal: no unrevealed strip (screenshots below). The swirl looks as on 16:9. - 32:9 (5120x1440): the eye's tips at 1.39–1.46 half heights across the screenshots (`main`: 2.8 by the 79 %; not measured), no strip. The swirl's sparkles 1.15 times as wide as high (16:9: 1.01; before the noise change: 1.75). With the glow clamp, the far sides at a video luma of 74 (`main`: 71; before the clamp: 101, burnt out). Before the clamp, a shimmer under DLSS on the side the scene moves toward while turning was seen in two of three sessions; with it, in none of two with the same steps. - 16:9 (3840x2160): the eye's tips at 1.413 / 1.397, its top and bottom at 0.902 / 0.899 half heights, against 1.406 / 1.400 and 0.904 / 0.904 without this change at the same spot: the same eye, the same swirl. - 16:10 (3840x2400, pillarboxed on the 21:9 monitor): the eye's tips at 1.41 / 1.42 half heights, the reveal's width (`main` @ a845154d at the same spot: 1.28 / 1.25); the swirl as on 16:9. - The Lens taken off and put on again at 21:9, 32:9 and 16:10: the eye opens and closes as on `main`. - The build log, at translation: `vk: program d547af983903a518: the Lens of Truth's eye at the picture's shape, its ring with it, its swirl too`. - Not tried: SDR, upscalers other than DLSS, frame generation. Checks: - `tests/test_lens_eye_pass.py` passes: synthetic eye programs through the pass, the eye 1.4 half heights wide at 16:9, 2.37, 2.4, 32:9, 16:10 and 4:3; the game's constants at 16:9 and with no sane projection; the ring's hole and the noise's u at 16:9, 21:9, 32:9, 16:10 and 4:3; the clamped x at 16:9, 21:9 and 32:9; programs of other shapes left alone; and the wiring in `vk_shader.cpp`. With both passes doing nothing (`main`'s behaviour) it fails: `shape 2.37037: half width 1.86667`. - `mise run test` on Linux (WSL, Ubuntu 26.04), with `mise.toml`'s pinned tools in a clean environment: 848 pass, 12 fail, 9 skipped. The same 12 fail on `main` @ a845154d alone, run the same way: `test_bug_report`, `test_control_picture`, `test_crash_record`, `test_guest_holes` (`UploadLayoutGuard` undeclared in its fixture), `test_input_background`, `test_linux_saves_move`, `test_log_open_failure`, `test_perf_send` (its sender fixture doesn't compile), `test_pipeline_tour`, `test_screensaver` (`show_game_window` and others undeclared in its fixture), `test_switch_table` (`LONGSHOT_LAUNCHER_STARTUP`, read in `host/launcher_startup.h`, has no row in `switches.def`) and `test_xinput_thread`. No existing check was changed. `mise run lint` passes. - Built on Windows from this source by longshot-builder (`from-source`, then `build`) and played as above; the Linux build is left to CI's renderer build check. **Still to test:** - Linux, AMD (Tier 1), Aspect ratio 21:9, Output resolution 2560x1080: the Lens on, expecting the purple eye about 59 % of the picture's width (`main`: 79 %) and no unrevealed strip inside its tips (`@Beanstalk`) - Steam Deck (Tier 1), its own 16:10: the Lens on, expecting the eye about 88 % of the picture's width (`main`: 79 %), its tips where the reveal ends (`@Beanstalk`) ## Measurements **Verdict:** fixed: at 21:9 the drawn eye is 1.40 half heights wide, the reveal's width (`main`: 1.86, 0.46 half heights of each tip unrevealed); 16:10 1.41 (`main`: 1.26, inside the reveal); 16:9 unchanged. No cost measured: GPU time 10.9 ms a frame with the Lens on (`main`: 10.9–11.0). Setup: Windows 11 Pro 26300, RTX 5090, NVIDIA 621.40; 5120x2160, HDR, DLSS, G-SYNC with a 158 fps cap (not reached: about 80 fps). The Shadow Temple B4 save at the screenshots' spot, the Lens on, standing still about 90 s a run; runs alternated main, PR, main, PR. Eye widths: from the screenshots, along the picture's middle row, in half heights of the picture. GPU time and fps: the median of each run's `GPU time` and `presents` lines (one each 120 presents) once the room was drawn. This PR's column is 8aa47b40, this head's game code (the head adds test shapes only). | | Before: main @ a845154d | After: this PR @ 8aa47b40 | |---|---|---| | eye half width, 5120x2160 (reveal: 1.40) | 1.86 | 1.40 | | unrevealed strip inside each tip, 5120x2160 | 0.46 half heights | none | | eye half width, 3840x2400 (16:10, reveal: 1.40) | 1.28 / 1.25 | 1.41 / 1.42 | | GPU time a frame, Lens on (median, run 1 / run 2) | 11.0 / 10.9 ms | 10.9 / 10.9 ms | | fps, Lens on (median, run 1 / run 2) | 79.4 / 80.0 | 79.7 / 79.9 | | `tests/test_lens_eye_pass.py` | fails with the passes doing nothing (half width 1.87 at 2.37) | passes | ``` longshot main-a845154d run 1: vk: 11640 presents, 79.6 fps; a frame: 730 draws; vk: GPU time 11.0 ms a frame longshot pr-8aa47b40 run 1: vk: 6120 presents, 79.8 fps; a frame: 727 draws; vk: GPU time 10.9 ms a frame longshot main-a845154d run 2: vk: 6000 presents, 80.0 fps; a frame: 725 draws; vk: GPU time 10.9 ms a frame longshot pr-8aa47b40 run 2: vk: 5280 presents, 80.1 fps; a frame: 729 draws; vk: GPU time 10.9 ms a frame ``` Screenshots of the same spot with the Lens on, `main` @ a845154d and this PR @ 8aa47b40, at 5120x2160 (on `main` the left wall turns light inside the eye's left tip) and at 3840x2400 (16:10): in a comment below. ## Risks Only the Lens of Truth's eye changes: the one fragment program the pass recognises by its exact edge formula, reading the effect's camera bank, and its vertex program. Anything else is left as translated. Every shape other than 16:9 changes, the Steam Deck's 16:10 among them (Tier 1: in Still to test); at 16:9 the eye is the game's. If the game's projection in bank 13 were ever not the picture's (a shape out of 1:2 to 10:1, or not a number), the eye keeps the game's 16:9 constants, as on `main`. The added work is a reciprocal and a few multiplies at the start of each of the two programs and one clamp; no cost showed in GPU time at the 0.1 ms the log gives. The change is in the shader translator's sources, so its stamp moves: every player's shader caches are dropped and every program is translated again once after updating, as for any translator change. A revert undoes it; there is no switch. Not changed here: at 32:9 the swirl's sparkles are still slightly wider than high (1.15 against 16:9's 1.01), the cause not traced (the noise's u, the swirl texture's polar place and the sparkle grid are all in half heights now); at 21:9 they look as on 16:9. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A check under `tests/` that reads changed source is updated, not weakened. - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. - [x] Screenshots of the same spot on `main` and here, for a change that shows on screen. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
The eye's fragment program sizes the eye with 16:9 baked in (1.26984131,
16:9 over RadiusX 1.4), so on a wider picture the drawn eye stretched while
the reveal, sized in half heights, did not. Take the shape from the camera
bank's projection instead: 16:9 gives the game's constant to the bit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The eye program also takes x into half heights as x * 16:9 (3.55555558 u -
1.77777779, and -1.77777779 on the edge's slope) for its ring, bands and
edge distance. Replace those with the picture's shape as well.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The eye is drawn on a ring mesh whose hole kept 16:9's x on a wider picture,
so the narrowed eye's sides were left undrawn. Give the eye's own vertex
program the same weighting its y has for the opening: x times 16:9 over the
picture's shape on the hole's edge, 1 at the picture's edge.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The eye's vertex program hands the fragment program a noise texture's
place from the UV's x (u * 1.995 + drift), across the picture's width, so
the green swirl it moves stretched sideways on wider pictures (sparkles
1.75x as wide as high at 32:9). Give that u the vertex's place on the
picture in 16:9's terms instead: 0.5 + x * (shape / 16:9) / 2.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Outside the eye the swirl glows from the eye's edge value 0.9 (1 - (x/1.4)^2)
and its square, unclamped. 16:9 never takes x past 16:9's side; 32:9 takes it
to twice that, nine times the glow the game ever drew, burnt out white
streaks at the sides that shimmered under DLSS while turning. Hold the eye's
x at 16:9's side for it: unchanged up to there and at 16:9, 16:9's side's
glow past it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
test(vk): the Lens eye's width, ring and noise at 16:10 and 4:3 too
Some checks failed
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Failing after 9s
f7adce52d4
Narrower pictures than 16:9 (the Steam Deck's 16:10) take the same
pass: the eye 1.4 half heights wide, the ring's hole and the swirl
noise's place checked there as on wider ones.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

Tested in game: Windows 11 Pro 26300, RTX 5090, NVIDIA 621.40, HDR, DLSS: the Shadow Temple B4 with the Lens of Truth on and off, the camera turned both ways, at 5120x2160 (21:9), 5120x1440 (32:9), 3840x2160 (16:9) and 3840x2400 (16:10). On 21:9 and 32:9 the drawn eye's tips meet the reveal (1.40 half heights; main 1.86 at 21:9) with no unrevealed strip, the swirl isn't stretched and its far sides don't burn out; at 16:10 the eye is the reveal's width too (main: too narrow); on 16:9 the eye and swirl are as on main.

Tested in game: Windows 11 Pro 26300, RTX 5090, NVIDIA 621.40, HDR, DLSS: the Shadow Temple B4 with the Lens of Truth on and off, the camera turned both ways, at 5120x2160 (21:9), 5120x1440 (32:9), 3840x2160 (16:9) and 3840x2400 (16:10). On 21:9 and 32:9 the drawn eye's tips meet the reveal (1.40 half heights; main 1.86 at 21:9) with no unrevealed strip, the swirl isn't stretched and its far sides don't burn out; at 16:10 the eye is the reveal's width too (main: too narrow); on 16:9 the eye and swirl are as on main.
bulldogsajr22 changed title from WIP: fix(vk): the Lens of Truth's eye at the picture's own shape on ultrawide screens to WIP: fix(vk): the Lens of Truth's eye at the picture's own shape on ultrawide and 16:10 screens 2026-11-28 03:22:26 +00:00
Author
Contributor

The same spot in the Shadow Temple B4, 5120x2160 (21:9), the Lens of Truth on, standing still (scaled to 2575x1086).

main @ a845154d: the drawn eye's tips reach 1.86 half heights, the reveal stops at 1.40; the left wall turns light inside the eye's left tip, the unrevealed strip.

main @ a845154d

This PR @ 8aa47b40: the eye's tips at 1.40 half heights, where the reveal ends; the wall is drawn the same all the way to the tip.

this PR @ 8aa47b40

The same spot at 3840x2400 (16:10, pillarboxed on a 21:9 monitor, scaled to 1739x1086 inside the bars), the Lens on.

main @ a845154d: the eye's tips at 1.28 / 1.25 half heights, narrower than the reveal's 1.40 (the reveal reaches past them under the swirl).

main @ a845154d, 16:10

This PR @ 8aa47b40: the tips at 1.41 / 1.42 half heights, the reveal's width.

this PR @ 8aa47b40, 16:10

The same spot in the Shadow Temple B4, 5120x2160 (21:9), the Lens of Truth on, standing still (scaled to 2575x1086). `main` @ a845154d: the drawn eye's tips reach 1.86 half heights, the reveal stops at 1.40; the left wall turns light inside the eye's left tip, the unrevealed strip. ![main @ a845154d](https://git.magicbean.dev/attachments/7e7b4343-7832-4d9a-8c90-1d4e8c9f62d5) This PR @ 8aa47b40: the eye's tips at 1.40 half heights, where the reveal ends; the wall is drawn the same all the way to the tip. ![this PR @ 8aa47b40](https://git.magicbean.dev/attachments/3ba40470-0332-4035-a9d5-7213b2f3151c) The same spot at 3840x2400 (16:10, pillarboxed on a 21:9 monitor, scaled to 1739x1086 inside the bars), the Lens on. `main` @ a845154d: the eye's tips at 1.28 / 1.25 half heights, narrower than the reveal's 1.40 (the reveal reaches past them under the swirl). ![main @ a845154d, 16:10](https://git.magicbean.dev/attachments/50e1c9ca-c6a6-4fff-91ce-c45ffee04441) This PR @ 8aa47b40: the tips at 1.41 / 1.42 half heights, the reveal's width. ![this PR @ 8aa47b40, 16:10](https://git.magicbean.dev/attachments/1e1ebc0e-a27a-46fe-87b8-96a0f11d1e22)
Owner
@review
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The Windows test shows the eye meeting the reveal, with no measurable GPU-time cost at the reported precision. The renderer change still needs the stated Tier 1 runs and a check of its shader-translation cost. Recommend approval; not approved on the forge.

The change adjusts the Lens eye, ring and swirl to the picture’s aspect ratio. It fixes the reported mismatch on the tested NVIDIA system, at the cost of scanning fragment IR during translation and invalidating shader caches once.

Testing before merging (3) (runs on the systems it can change; it doesn't hold the recommendation)

  • L1 gpu/vk/eden/shader_recompiler/ir_opt/lens_eye_pass.h:64: The changed shader has not been exercised on Linux AMD. (more on the line) Do: Run the stated 21:9 Lens on/off and camera-turn check on Linux AMD and record the result.
  • L2 gpu/vk/eden/shader_recompiler/ir_opt/lens_eye_pass.h:150: The narrower-picture path has not been exercised on Steam Deck. (more on the line) Do: Run the stated Lens on/off and opening/closing check on Steam Deck and record the result.
  • L3 gpu/vk/vk_shader.cpp:804: The reported GPU timing does not cover the added work during shader translation. (more on the line) Do: Compare cold-cache translation and first-run loading time against the base on the same system, and report the results. (@fix does its part first: Avoid constructing the users map for programs that have no candidate eye-scale instruction.)

@fix can do L3.

Checks: Still running: 10 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes on the tested Windows RTX 5090: at 21:9 the eye’s half width fell from 1.86 to 1.40 half heights, matching the reveal; at 16:10 it rose from 1.25–1.28 to 1.41–1.42. Two interleaved runs reported 10.9–11.0 ms before and 10.9 ms after; those figures do not establish a performance gain.

Other systems: The pass affects matching fragment programs on Vulkan systems and their paired vertex program on the ordinary graphics path. Windows NVIDIA was tested; Linux AMD and Steam Deck remain untested. Mesh pipelines also translate fragments through the pass, but the supplied evidence does not show the Lens using that path. Shader-cache invalidation and the added translation scan affect first use after updating.

Switches: None.

Reviewed: f7adce52d4 against a845154d34: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, all four changed files, commit messages, the supplied comments and CI status, and relevant translation and buffer-binding code. Skimmed the test runner and shader IR support. docs/review-checklist.md and the adjacent Tooling checkout were absent; linked screenshots were not available in the closed network.; nothing run (a code review).

Checked and fine:

  • The reported synthetic test exercises the width, ring and noise calculations and rejects several nonmatching program shapes.
  • The commits record AI assistance; no switch, renderer API change or generated shader file is added.
  • The supplied CI status reports no head-only failures, although checks are still running.

Testing: No code or tests were run as requested. The author reports game runs and a game-free test; CI is still running.

Overlaps and merge order: No overlapping pull requests were identified in the supplied material; the network was closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left. The Windows test shows the eye meeting the reveal, with no measurable GPU-time cost at the reported precision. The renderer change still needs the stated Tier 1 runs and a check of its shader-translation cost. Recommend approval; not approved on the forge. The change adjusts the Lens eye, ring and swirl to the picture’s aspect ratio. It fixes the reported mismatch on the tested NVIDIA system, at the cost of scanning fragment IR during translation and invalidating shader caches once. **Testing before merging (3)** (runs on the systems it can change; it doesn't hold the recommendation) - **L1** `gpu/vk/eden/shader_recompiler/ir_opt/lens_eye_pass.h:64`: The changed shader has not been exercised on Linux AMD. (more on the line) **Do:** Run the stated 21:9 Lens on/off and camera-turn check on Linux AMD and record the result. - **L2** `gpu/vk/eden/shader_recompiler/ir_opt/lens_eye_pass.h:150`: The narrower-picture path has not been exercised on Steam Deck. (more on the line) **Do:** Run the stated Lens on/off and opening/closing check on Steam Deck and record the result. - **L3** `gpu/vk/vk_shader.cpp:804`: The reported GPU timing does not cover the added work during shader translation. (more on the line) **Do:** Compare cold-cache translation and first-run loading time against the base on the same system, and report the results. *(`@fix` does its part first: Avoid constructing the users map for programs that have no candidate eye-scale instruction.)* `@fix` can do L3. **Checks:** Still running: 10 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes on the tested Windows RTX 5090: at 21:9 the eye’s half width fell from 1.86 to 1.40 half heights, matching the reveal; at 16:10 it rose from 1.25–1.28 to 1.41–1.42. Two interleaved runs reported 10.9–11.0 ms before and 10.9 ms after; those figures do not establish a performance gain. **Other systems:** The pass affects matching fragment programs on Vulkan systems and their paired vertex program on the ordinary graphics path. Windows NVIDIA was tested; Linux AMD and Steam Deck remain untested. Mesh pipelines also translate fragments through the pass, but the supplied evidence does not show the Lens using that path. Shader-cache invalidation and the added translation scan affect first use after updating. **Switches:** None. **Reviewed:** f7adce52d480 against a845154d3415: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, all four changed files, commit messages, the supplied comments and CI status, and relevant translation and buffer-binding code. Skimmed the test runner and shader IR support. docs/review-checklist.md and the adjacent Tooling checkout were absent; linked screenshots were not available in the closed network.; nothing run (a code review). **Checked and fine:** - The reported synthetic test exercises the width, ring and noise calculations and rejects several nonmatching program shapes. - The commits record AI assistance; no switch, renderer API change or generated shader file is added. - The supplied CI status reports no head-only failures, although checks are still running. **Testing:** No code or tests were run as requested. The author reports game runs and a game-free test; CI is still running. **Overlaps and merge order:** No overlapping pull requests were identified in the supplied material; the network was closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -0,0 +61,4 @@
} // namespace lens_eye_detail
/// The eye's x scale made the picture's shape over 1.4; nullptr when made, else why this program is not the eye's
inline const char* LensEyePass(IR::Program& program) {
Member

L1 (should fix): The changed shader has not been exercised on Linux AMD.

When: A Linux player on a Tier 1 AMD GPU uses the Lens at ultrawide aspect ratio; the Windows NVIDIA result does not show whether that driver renders the changed eye and swirl correctly.

Do: Run the stated 21:9 Lens on/off and camera-turn check on Linux AMD and record the result.

**L1** (should fix): The changed shader has not been exercised on Linux AMD. *When:* A Linux player on a Tier 1 AMD GPU uses the Lens at ultrawide aspect ratio; the Windows NVIDIA result does not show whether that driver renders the changed eye and swirl correctly. **Do:** Run the stated 21:9 Lens on/off and camera-turn check on Linux AMD and record the result.
@ -0,0 +147,4 @@
return nullptr;
}
/// For the eye's vertex program (its fragment program's LensEyePass made): the ring's hole narrowed with the eye, x times
Member

L2 (should fix): The narrower-picture path has not been exercised on Steam Deck.

When: A Deck player uses the Lens at its native 16:10 aspect ratio; the synthetic IR test and a pillarboxed Windows run do not cover the Deck’s Vulkan driver.

Do: Run the stated Lens on/off and opening/closing check on Steam Deck and record the result.

**L2** (should fix): The narrower-picture path has not been exercised on Steam Deck. *When:* A Deck player uses the Lens at its native 16:10 aspect ratio; the synthetic IR test and a pillarboxed Windows run do not cover the Deck’s Vulkan driver. **Do:** Run the stated Lens on/off and opening/closing check on Steam Deck and record the result.
@ -799,2 +801,4 @@
one_exit};
t->program = Shader::Maxwell::TranslateProgram(t->pools->insts, t->pools->blocks, env, cfg, host_info());
// (longshot) the Lens of Truth's eye at the picture's shape (lens_eye_pass.h): its fragment program, whichever pipeline draws it
if (graphics && t->program.stage == Shader::Stage::Fragment && !Shader::Optimization::LensEyePass(t->program)) t->lens_eye = true;
Member

L3 (should fix): The reported GPU timing does not cover the added work during shader translation.

When: After updating, players rebuild their shader cache, and every fragment program with camera bank 13 builds a users map and scans its IR even when it is not the Lens shader; the effect on loading and first-use stutter is unknown.

Do: Compare cold-cache translation and first-run loading time against the base on the same system, and report the results.

**L3** (should fix): The reported GPU timing does not cover the added work during shader translation. *When:* After updating, players rebuild their shader cache, and every fragment program with camera bank 13 builds a users map and scans its IR even when it is not the Lens shader; the effect on loading and first-use stutter is unknown. **Do:** Compare cold-cache translation and first-run loading time against the base on the same system, and report the results.
HumanBean changed title from WIP: fix(vk): the Lens of Truth's eye at the picture's own shape on ultrawide and 16:10 screens to fix(vk): the Lens of Truth's eye at the picture's own shape on ultrawide and 16:10 screens 2026-11-28 04:20:27 +00:00
HumanBean deleted branch fix/lens-eye-ultrawide 2026-11-28 04:20:34 +00:00
Some checks failed
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
PR description / Title and description (pull_request_target) Failing after 9s
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
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
MagicBeanDev/Longshot!2713
No description provided.