feat(vk): add live colour vision correction #1832

Merged
HumanBean merged 3 commits from futondestroyer/Longshot:codex/colour-vision into main 2026-11-20 21:41:07 +00:00
Member

Summary

Adds a live, saved Colour vision correction row under Graphics → Accessibility. Off is the default. Protan and Deutan address red-green distinctions, and Tritan addresses blue-yellow distinctions. The row and help are translated into all supported menu languages.

The correction uses the lost-channel estimates from the linear Rec.709 model by Machado, Oliveira and Fernandes. It shifts colour differences onto an opponent axis while preserving luminance and neutral colours, then compresses chroma at the display gamut boundary.

The earlier Colour filter implementation has Linux RADV measurements and a headless capture path. The current PR adds correction in the final display path, including Native PQ HDR. Its independent Windows measurements and Linux follow-up below are for this implementation. Related PR #139

Start at present_image in gpu/vk/vk_replay.cpp and the shared colour_vision.glsl. SDR correction draws directly into the existing swapchain image in place of the blit. HDR correction runs in the existing HDR10 encoder after grading, in linear Rec.2020 light. Both game-rendered and generated frames use the same final route. The Insert menu's colour palette follows the selected mode. Off retains the existing uncorrected GPU paths.

Testing

Rebase verification (November 20): Candidate 3a237573 is on 89c3d21e. All three commit patches were preserved, including dyst's fixture fixes. The exact Windows pack and runtime built and the runtime module hashes matched the pack. On the RTX 4070, the disposable Kokiri SDR run applied Protan, Deutan and Tritan live with built-in 2× frame generation. The renderer logged correction on both game and generated frames. The saved setting returned to Off and the game exited with code 0.

Eleven focused source checks passed, including capture dimensions and INI key coverage. All seven offscreen Vulkan geometry cases passed. The checked-in present-source crop fixture failed on exact main, the former head and the rebase because its hud_source stub has eight parameters while production passes nine. Both sources passed the crop behavior check with only that stub corrected in a disposable fixture copy. The rebase carries no stub edit. The full-suite comparison, HDR runs and timings below retain their original pins.

Tested: Windows 11, NVIDIA GeForce RTX 4070, NVIDIA 621.01. The production build eea12a98 loaded a disposable Kokiri checkpoint. All three modes updated the live SDR output, saved, and switched back to Off. Built-in 2× frame generation showed both game-rendered and generated frames through the SDR, Expanded HDR10 and Native PQ HDR10 routes. All runs exited normally. The subsequent docs and fixture changes leave the game and renderer source identical.

The live SDR captures matched an independent reference within four sRGB levels on 6,522/6,646 stable coloured samples in Protan, 6,610/6,646 in Deutan, and 6,598/6,646 in Tritan. The colour fixture, both shader builds and regeneration checks, HDR10 grading, locale, settings, scaler, frame routing and overlay-order fixtures passed. Exact-source review used the local Graphify maps for the base and candidate.

The Windows game-free checks were compared with exact main in shards. All changed fixtures passed. The control-client suite passed on rerun with two skips, and the intermittent stop-receipt case passed separately on both trees. The queue self-test exited without a report on both snapshots, with identical test and queue code.

56 fixtures that failed or timed out on both snapshots
  • tests/test_appimage_player_build.py
  • tests/test_auto_handheld.py
  • tests/test_bug_report_defaults.py
  • tests/test_build_long_paths.py
  • tests/test_capture_read_once.py
  • tests/test_crash_dialog.py
  • tests/test_crt_options.py
  • tests/test_damage_debug_menu.py
  • tests/test_dev_ab.py
  • tests/test_dev_build.py
  • tests/test_dev_migrate.py
  • tests/test_dev_packs.py
  • tests/test_discover.py
  • tests/test_display_startup_failure.py
  • tests/test_dlss_feature_size.py
  • tests/test_failed_compile_keeps_objects.py
  • tests/test_fastfp_fma.py
  • tests/test_fma_soft.py
  • tests/test_fpx_sticky.py
  • tests/test_frame_overlap.py
  • tests/test_game_menu_mouse_buttons.py
  • tests/test_guest_imported.py
  • tests/test_high_fps_fixes.py
  • tests/test_host_guest_writes.py
  • tests/test_hud_layout_row.py
  • tests/test_libc_hooks.py
  • tests/test_lift_cache.py
  • tests/test_lift_lookups.py
  • tests/test_linux_preflight.py
  • tests/test_linux_pressure.py
  • tests/test_make_game_cache.py
  • tests/test_make_game_ngx.py
  • tests/test_mise_build.py
  • tests/test_missing_nup.py
  • tests/test_mods_list.py
  • tests/test_ngx_sdk.py
  • tests/test_pads_after_menu.py
  • tests/test_pending_guest_import.py
  • tests/test_pipeline_cache_save.py
  • tests/test_pipeline_play_cache.py
  • tests/test_prepare_cache_save.py
  • tests/test_present_thread.py
  • tests/test_profiling_mode.py
  • tests/test_psychov35_fsr3_fg.py
  • tests/test_readback_timeout_source.py
  • tests/test_sdiv_overflow.py
  • tests/test_seed_reader.py
  • tests/test_slow_frames.py
  • tests/test_song_note_cue.py
  • tests/test_spawn_emit.py
  • tests/test_upscaler_rows.py
  • tests/test_vbytes.py
  • tests/test_vcore_escape.py
  • tests/test_vfpx_elem.py
  • tests/test_walk.py
  • tests/test_walk_key.py

Still to test:

  • Linux with RADV or Steam Deck Vulkan: build with the Linux toolchain and run the disposable Kokiri checkpoint against main. Expect both builds to reach gameplay and exit cleanly. Test Farm's runner uses a headless session. This PC has no Linux build environment.
  • Linux visible Vulkan window: check Off and Deutan in the same Kokiri checkpoint, expecting the picture and HUD to update on the next presents. Keep captures local. By hand.
  • Players with protan, deutan or tritan colour vision deficiency: check whether the corresponding preset makes representative in-game cues easier to distinguish. By hand.
  • A genuinely sRGB source view feeding scaling or frame generation: verify transfer handling on a supported game surface that uses that format. The SDR gameplay tested here used RGBA8 UNORM. By hand.
  • Graphics guide source review. The published guide image itself passed its asset check. The source-review check reported 25 drift entries on main and 27 on this head, adding the menu translations and ImGui interface to the existing review. By hand.

Measurements

Verdict: With Deutan, the candidate ran at 110.0 FPS against 113.9 FPS with correction Off (-3.4%). Game-frame p99 was 10.95 ms against 11.41 ms. The process-level GPU busy values varied between repeats, with overlapping ranges.

Windows 11, RTX 4070 and NVIDIA 621.01. Disposable Kokiri checkpoint with a verified 1920×1080 game frame and 1600×900 window, SDR, V-Sync off and frame generation off. Two interleaved 25-second windows per arm after warm-up, in the order main, Off, Deutan, main, Deutan, Off. Each value is the median of the two run statistics. FPS and frame p99 come from the game trace. GPU busy is the process-level PresentMon measurement. Foreground changes affected the displayed-interval samples.

Metric Before: main @ 068fb8eb After: this PR @ fdda302e (Off) After: this PR @ fdda302e (Deutan)
Game FPS 101.66 113.90 109.99
Game frame p99 (ms) 13.09 11.41 10.95
GPU busy p50 (ms) 5.56 5.99 5.50
GPU busy p99 (ms) 5.92 6.31 5.88

Game-frame p99 across the two repeats: main 11.03–15.14 ms, Off 11.02–11.80 ms, Deutan 10.95–10.95 ms. Recorded pipeline-wait frames across all six windows: 0.

Risks

The correction changes the display palette, and the fixed presets can help different scenes and players by different amounts. Choose Off to restore the uncorrected picture. The bridge's upstream captures retain the source colours. SDR shader initialisation failure leaves the existing presentation route available. There is no extra image allocation or readback in the correction path.

Screenshots

Same view from the disposable Kokiri checkpoint, cropped to the game client. Both runs used SDR with frame generation off.

Before: main at 068fb8eb

After: this PR with Deutan enabled

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 check under tests/ that reads changed source is updated, not weakened.
  • The SPIR-V headers regenerated (a shader changed).
  • Screenshots of the same spot on main and here, for a change that shows on screen.
  • Docs updated.
  • 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.
## Summary Adds a live, saved **Colour vision correction** row under **Graphics → Accessibility**. Off is the default. Protan and Deutan address red-green distinctions, and Tritan addresses blue-yellow distinctions. The row and help are translated into all supported menu languages. The correction uses the lost-channel estimates from the linear Rec.709 model by [Machado, Oliveira and Fernandes](https://pubmed.ncbi.nlm.nih.gov/19834201/). It shifts colour differences onto an opponent axis while preserving luminance and neutral colours, then compresses chroma at the display gamut boundary. The earlier Colour filter implementation has Linux RADV measurements and a headless capture path. The current PR adds correction in the final display path, including Native PQ HDR. Its independent Windows measurements and Linux follow-up below are for this implementation. [Related PR #139](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/139) Start at `present_image` in `gpu/vk/vk_replay.cpp` and the shared `colour_vision.glsl`. SDR correction draws directly into the existing swapchain image in place of the blit. HDR correction runs in the existing HDR10 encoder after grading, in linear Rec.2020 light. Both game-rendered and generated frames use the same final route. The Insert menu's colour palette follows the selected mode. Off retains the existing uncorrected GPU paths. ## Testing **Rebase verification (November 20):** Candidate `3a237573` is on `89c3d21e`. All three commit patches were preserved, including dyst's fixture fixes. The exact Windows pack and runtime built and the runtime module hashes matched the pack. On the RTX 4070, the disposable Kokiri SDR run applied Protan, Deutan and Tritan live with built-in 2× frame generation. The renderer logged correction on both game and generated frames. The saved setting returned to Off and the game exited with code 0. Eleven focused source checks passed, including capture dimensions and INI key coverage. All seven offscreen Vulkan geometry cases passed. The checked-in present-source crop fixture failed on exact main, the former head and the rebase because its `hud_source` stub has eight parameters while production passes nine. Both sources passed the crop behavior check with only that stub corrected in a disposable fixture copy. The rebase carries no stub edit. The full-suite comparison, HDR runs and timings below retain their original pins. **Tested:** Windows 11, NVIDIA GeForce RTX 4070, NVIDIA 621.01. The production build `eea12a98` loaded a disposable Kokiri checkpoint. All three modes updated the live SDR output, saved, and switched back to Off. Built-in 2× frame generation showed both game-rendered and generated frames through the SDR, Expanded HDR10 and Native PQ HDR10 routes. All runs exited normally. The subsequent docs and fixture changes leave the game and renderer source identical. The live SDR captures matched an independent reference within four sRGB levels on 6,522/6,646 stable coloured samples in Protan, 6,610/6,646 in Deutan, and 6,598/6,646 in Tritan. The colour fixture, both shader builds and regeneration checks, HDR10 grading, locale, settings, scaler, frame routing and overlay-order fixtures passed. Exact-source review used the local Graphify maps for the base and candidate. The Windows game-free checks were compared with exact `main` in shards. All changed fixtures passed. The control-client suite passed on rerun with two skips, and the intermittent stop-receipt case passed separately on both trees. The queue self-test exited without a report on both snapshots, with identical test and queue code. <details> <summary>56 fixtures that failed or timed out on both snapshots</summary> - `tests/test_appimage_player_build.py` - `tests/test_auto_handheld.py` - `tests/test_bug_report_defaults.py` - `tests/test_build_long_paths.py` - `tests/test_capture_read_once.py` - `tests/test_crash_dialog.py` - `tests/test_crt_options.py` - `tests/test_damage_debug_menu.py` - `tests/test_dev_ab.py` - `tests/test_dev_build.py` - `tests/test_dev_migrate.py` - `tests/test_dev_packs.py` - `tests/test_discover.py` - `tests/test_display_startup_failure.py` - `tests/test_dlss_feature_size.py` - `tests/test_failed_compile_keeps_objects.py` - `tests/test_fastfp_fma.py` - `tests/test_fma_soft.py` - `tests/test_fpx_sticky.py` - `tests/test_frame_overlap.py` - `tests/test_game_menu_mouse_buttons.py` - `tests/test_guest_imported.py` - `tests/test_high_fps_fixes.py` - `tests/test_host_guest_writes.py` - `tests/test_hud_layout_row.py` - `tests/test_libc_hooks.py` - `tests/test_lift_cache.py` - `tests/test_lift_lookups.py` - `tests/test_linux_preflight.py` - `tests/test_linux_pressure.py` - `tests/test_make_game_cache.py` - `tests/test_make_game_ngx.py` - `tests/test_mise_build.py` - `tests/test_missing_nup.py` - `tests/test_mods_list.py` - `tests/test_ngx_sdk.py` - `tests/test_pads_after_menu.py` - `tests/test_pending_guest_import.py` - `tests/test_pipeline_cache_save.py` - `tests/test_pipeline_play_cache.py` - `tests/test_prepare_cache_save.py` - `tests/test_present_thread.py` - `tests/test_profiling_mode.py` - `tests/test_psychov35_fsr3_fg.py` - `tests/test_readback_timeout_source.py` - `tests/test_sdiv_overflow.py` - `tests/test_seed_reader.py` - `tests/test_slow_frames.py` - `tests/test_song_note_cue.py` - `tests/test_spawn_emit.py` - `tests/test_upscaler_rows.py` - `tests/test_vbytes.py` - `tests/test_vcore_escape.py` - `tests/test_vfpx_elem.py` - `tests/test_walk.py` - `tests/test_walk_key.py` </details> **Still to test:** - Linux with RADV or Steam Deck Vulkan: build with the Linux toolchain and run the disposable Kokiri checkpoint against main. Expect both builds to reach gameplay and exit cleanly. Test Farm's runner uses a headless session. This PC has no Linux build environment. - Linux visible Vulkan window: check Off and Deutan in the same Kokiri checkpoint, expecting the picture and HUD to update on the next presents. Keep captures local. By hand. - Players with protan, deutan or tritan colour vision deficiency: check whether the corresponding preset makes representative in-game cues easier to distinguish. By hand. - A genuinely sRGB source view feeding scaling or frame generation: verify transfer handling on a supported game surface that uses that format. The SDR gameplay tested here used RGBA8 UNORM. By hand. - Graphics guide source review. The published guide image itself passed its asset check. The source-review check reported 25 drift entries on main and 27 on this head, adding the menu translations and ImGui interface to the existing review. By hand. ## Measurements **Verdict:** With Deutan, the candidate ran at 110.0 FPS against 113.9 FPS with correction Off (-3.4%). Game-frame p99 was 10.95 ms against 11.41 ms. The process-level GPU busy values varied between repeats, with overlapping ranges. Windows 11, RTX 4070 and NVIDIA 621.01. Disposable Kokiri checkpoint with a verified 1920×1080 game frame and 1600×900 window, SDR, V-Sync off and frame generation off. Two interleaved 25-second windows per arm after warm-up, in the order main, Off, Deutan, main, Deutan, Off. Each value is the median of the two run statistics. FPS and frame p99 come from the game trace. GPU busy is the process-level PresentMon measurement. Foreground changes affected the displayed-interval samples. | Metric | Before: main @ 068fb8eb | After: this PR @ fdda302e (Off) | After: this PR @ fdda302e (Deutan) | | --- | ---: | ---: | ---: | | Game FPS | 101.66 | 113.90 | 109.99 | | Game frame p99 (ms) | 13.09 | 11.41 | 10.95 | | GPU busy p50 (ms) | 5.56 | 5.99 | 5.50 | | GPU busy p99 (ms) | 5.92 | 6.31 | 5.88 | Game-frame p99 across the two repeats: main 11.03–15.14 ms, Off 11.02–11.80 ms, Deutan 10.95–10.95 ms. Recorded pipeline-wait frames across all six windows: 0. ## Risks The correction changes the display palette, and the fixed presets can help different scenes and players by different amounts. Choose Off to restore the uncorrected picture. The bridge's upstream captures retain the source colours. SDR shader initialisation failure leaves the existing presentation route available. There is no extra image allocation or readback in the correction path. ## Screenshots Same view from the disposable Kokiri checkpoint, cropped to the game client. Both runs used SDR with frame generation off. ![Before: main at 068fb8eb](https://git.magicbean.dev/attachments/edaf94aa-ba2c-4a8e-9309-3d470092ff3c) ![After: this PR with Deutan enabled](https://git.magicbean.dev/attachments/59ceb786-f8dc-472d-ad06-7f2cd15bade8) ## 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 check under `tests/` that reads changed source is updated, not weakened. - [x] The SPIR-V headers regenerated (a shader changed). - [x] Screenshots of the same spot on `main` and here, for a change that shows on screen. - [x] Docs updated. - [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.
Assisted-by: GPT-6.2 Sol
test(vk): cover colour correction in presentation and menu fixtures
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 12s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Workflow lint (actionlint) (pull_request) Successful in 12s
Third-party parts / As their notes say (pull_request) Successful in 14s
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Website build and checks (pull_request) Has been cancelled
fdda302e7b
Assisted-by: GPT-6.2 Sol
Author
Member

Tested in game: Windows 11, RTX 4070, NVIDIA 621.01. The disposable Kokiri checkpoint switched Protan, Deutan and Tritan live, saved the selected settings and returned to Off. Both game and generated frames were verified in SDR, Expanded HDR10 and Native PQ HDR10. All runs exited normally. The two cropped SDR views confirmed the display output.

Tested in game: Windows 11, RTX 4070, NVIDIA 621.01. The disposable Kokiri checkpoint switched Protan, Deutan and Tritan live, saved the selected settings and returned to Off. Both game and generated frames were verified in SDR, Expanded HDR10 and Native PQ HDR10. All runs exited normally. The two cropped SDR views confirmed the display output.
Author
Member

The same view from the disposable Kokiri checkpoint, cropped to the game client. Both runs used SDR with frame generation off.

Before: current main, no colour correction

After: this PR with Deutan enabled

The same view from the disposable Kokiri checkpoint, cropped to the game client. Both runs used SDR with frame generation off. ![Before: current main, no colour correction](https://git.magicbean.dev/attachments/edaf94aa-ba2c-4a8e-9309-3d470092ff3c) ![After: this PR with Deutan enabled](https://git.magicbean.dev/attachments/59ceb786-f8dc-472d-ad06-7f2cd15bade8)
Member

Possibly related, for context:

  • PR #139 feat(vk): a Colour filter row for colour-blind players — Open overlapping colour-vision correction implementation
Possibly related, for context: - PR #139 feat(vk): a Colour filter row for colour-blind players — Open overlapping colour-vision correction implementation
Author
Member

Completed the six matched, warmed SDR windows. On the RTX 4070, candidate Off and Deutan measured 113.9 and 110.0 FPS, with 11.41 and 10.95 ms game-frame p99. The description includes process GPU busy, the same-spot screenshots, the source-check comparison and the Linux and guide follow-up.

Completed the six matched, warmed SDR windows. On the RTX 4070, candidate Off and Deutan measured 113.9 and 110.0 FPS, with 11.41 and 10.95 ms game-frame p99. The description includes process GPU busy, the same-spot screenshots, the source-check comparison and the Linux and guide follow-up.
futondestroyer changed title from WIP: feat(vk): add live colour vision correction to feat(vk): add live colour vision correction 2026-11-20 03:56:41 +00:00
dyst left a comment

Verdict: Request changes. The feature is well built and Off leaves every present path as it is. But the new present_image and framegen_hdr arguments break three tests that pass on main: two in the source suite (test_capture_dimensions.py, test_present_source_crop.py) and the Vulkan fixture test_present_aspect_vulkan.py. The fix is test-only and is below as a patch. Tier 1 AMD, Linux and Steam Deck runs are still owed, and the sRGB-only swapchain branch they would exercise has never run.

For players with red-green or blue-yellow colour vision deficiency, this adds a saved Accessibility row that recolours the final picture and the Insert menu, live, in SDR and both HDR modes, game and generated frames alike. It makes the code better: the correction lives in one shared GLSL function. In SDR it replaces the final blit, so it adds no images and no readback, and in HDR it is part of the existing encoder pass. The row is a menu module, and nothing changes while it is Off.

Reviewed: fdda302e against 068fb8eb (its merge base, still the PR's base): colour_vision.h, colour_vision.glsl, colour_vision.frag, hdr_encode.comp, vk_colour_vision.cpp/.h, menu/colour_vision.cpp, and the changed parts of vk_replay.cpp (all of present_image and the do_present part), vk_framegen.cpp/.h (framegen_scale, framegen_hdr, pass), vk_imgui.cpp/.h, vk_menu.cpp/.h (set_row, menu_setting_set, the options load), vk_main.cpp's swapchain usage, every changed test, and every test that cuts present_image or framegen_hdr out of the source. Only skimmed: the two SPIR-V headers (their provenance lines) and menu_i18n.h (6 strings × 13 languages, spot-read). Nothing run (a code review).
Fixed in this review: nothing pushed. The patch below is committed on my side but couldn't be pushed to codex/colour-vision from here, so it's yours to apply (or say so and I'll push it).
Checked and fine:

  • With correction Off, do_present and present_image take the same branches as on main: allow_scale is direct_scale, which is exactly the old condition for making direct_view. The HDR fast path for Native PQ codes still applies whenever correction is off.
  • Sync: the full barrier at the top of present_image covers the game's writes. framegen_scale's pass ends in a full barrier, and its outputs are SAMPLED and in GENERAL. The swapchain image goes TRANSFER_DST → COLOR_ATTACHMENT → TRANSFER_DST around the draw, and its older content is kept, so the letterbox clear stays outside renderArea (LOAD_OP_DONT_CARE applies only inside it).
  • Formats: the pipeline is built for dev.swap_view_format, the format of dev.swap_views. Both sRGB cases resolve correctly: an sRGB-only chain drawn through sRGB views gets linear output, and a mutable sRGB chain drawn through UNORM views gets encoded output. Every surface allows COLOR_ATTACHMENT, and Vulkan 1.3 dynamic rendering and sync2 are already required at device creation.
  • Maths: dot(axis, Y709) == 0 for all three axes, so luminance holds in SDR. In HDR, shift - dot(shift, Y2020) keeps Rec.2020 luminance. The gamut scale can't divide by zero. The CPU copy in colour_vision.h gives the same result as the GLSL in SDR.
  • State: present_image_mu serialises the pipeline map and the statics. Each row change, including the bridge's menu_setting_set, goes through set_row and on to on_change, and menu_init seeds the mode after the options load, so the atomic can't fall behind opts.colour_vision.
  • The menu row follows the module rule, with preset_exempt, no restart and its key in FROZEN. The docs row and section are there, and the menu-section tests are updated.
  • test_present_geometry_trace fails if allow_scale && or !scaled && is undone. test_colour_vision pins the three reference colours, greys, luminance and gamut.

Blocking (to change before merge)

  1. tests/test_capture_dimensions.py:37 asserts the old text present_image(src, sw, sh, crop, direct_view);, which vk_replay.cpp:5579 no longer has. It stops at that assert on this head and passes on main. Its fixture's present_image stub also needs the two new parameters.
  2. tests/test_present_source_crop.py stitches the definition of framegen_hdr, whose new int colour_vision has no default (the default is only in vk_framegen.h). The template's call at present_source_crop_test.cpp:150 passes 8 arguments, so the fixture no longer compiles.
  3. tests/test_present_aspect_vulkan.py pastes everything in present_image from const PresentAspect aspect{ up to the frame log. That span now uses allow_scale, source_srgb, index, dev.swap_views, menu_colour_vision_mode, colour_vision::enabled, colour_vision_sdr and a 9-argument framegen_hdr, and present_aspect_vulkan.cpp defines none of them. The source suite skips this test (it needs a device), but run_vulkan_fixtures.py and the lavapipe workflow run it.

None of the three is on the Testing section's "fails on both" list, so they probably didn't run on your PC (the first two need --headers). The patch makes each accept both the old and new source, as your other fixture updates do, and runs it with correction Off. It also moves colour_vision to its alphabetical place in FROZEN with the table's comment back on its own line, and makes framegen_hdr's default 0 (it was false) with a doc line. I wrote it by reading and haven't run it, so please run those three tests (and test_menu_ini_keys.py) once it's in.

The patch (on fdda302e)
diff --git a/gpu/vk/vk_framegen.h b/gpu/vk/vk_framegen.h
--- a/gpu/vk/vk_framegen.h
+++ b/gpu/vk/vk_framegen.h
@@ -60,9 +60,9 @@ VkImageView framegen_scaled_view();   // final scale/CRT view for the existing H
 /// (longshot) The HDR10 picture of src's crop at dw x dh (the Insert menu's HDR), GENERAL; null: none (the SDR picture then;
 /// Native's scaled picture, else black: present_image).
 /// pq: src is the game's own HDR10 picture (Native), its PQ codes as they are at 100% contrast, else graded and written again;
-/// else the SDR picture, expanded
+/// else the SDR picture, expanded. colour_vision: the Colour vision correction row's mode (0 Off), applied after grading
 VkImage framegen_hdr(VkCommandBuffer cmd, VkImageView src, uint32_t sw, uint32_t sh, const int crop[4], uint32_t dw, uint32_t dh,
-                     bool pq, int colour_vision = false);
+                     bool pq, int colour_vision = 0);
 /// Each present: ultrawide's menus (the Insert menu's setting to the game's side, the sides blurred or black while a menu shows)
 void wide_sides_tick();
 /// Whether ultrawide's menu sides can show at all: Ultrawide with a margin and the Insert menu's setting on
diff --git a/tests/capture_dimensions_test.cpp b/tests/capture_dimensions_test.cpp
--- a/tests/capture_dimensions_test.cpp
+++ b/tests/capture_dimensions_test.cpp
@@ -42,10 +42,11 @@ void destroy_image(VkImage,VmaAllocation) {}
 void destroy_buffer(VkBuffer,VmaAllocation) {}
 VKAPI_ATTR void VKAPI_CALL vkDestroyImageView(VkDevice,VkImageView,const VkAllocationCallbacks*) {}
 /* SETUP */
-void present_image(VkImage,uint32_t,uint32_t,const int*,VkImageView) { presented++; }
+void present_image(VkImage,uint32_t,uint32_t,const int*,VkImageView,bool=false,bool=true) { presented++; }
 void tick() {
     VkImage src=reinterpret_cast<VkImage>(uintptr_t(0xff)); const char* shots="test";
     uint32_t sw=1720,sh=720; const int* crop=nullptr; VkImageView direct_view{}; bool interpolated=false;
+    [[maybe_unused]] bool source_srgb=false, direct_scale=false;
     /* GATE */ { capture_entries++; }
     /* PRESENT_TAIL */
 }
diff --git a/tests/present_aspect_vulkan.cpp b/tests/present_aspect_vulkan.cpp
--- a/tests/present_aspect_vulkan.cpp
+++ b/tests/present_aspect_vulkan.cpp
@@ -17,7 +17,7 @@ using namespace mkwvk;
 VkDevice device;
 VkPhysicalDevice physical;
 VkPhysicalDeviceMemoryProperties memory_props;
-struct { VkExtent2D swap_extent; bool hdr = false; } dev;
+struct { VkExtent2D swap_extent; bool hdr = false; std::vector<VkImageView> swap_views = std::vector<VkImageView>(1); } dev;
 std::atomic<bool> present_native_pq{false};
 float display_aspect;
 float get_aspect() { return display_aspect; }
@@ -27,14 +27,22 @@ VkImage framegen_scale(VkCommandBuffer,VkImageView,VkImage,uint32_t,uint32_t,con
     return VK_NULL_HANDLE; // This GPU fixture exercises direct blits; filtered routing is covered by L1.
 }
 // (SDR only here: the HDR pass and Native's routing are covered by test_present_aspect.py)
-VkImage framegen_hdr(VkCommandBuffer,VkImageView,uint32_t,uint32_t,const int*,uint32_t,uint32_t,bool) { return VK_NULL_HANDLE; }
+VkImage framegen_hdr(VkCommandBuffer,VkImageView,uint32_t,uint32_t,const int*,uint32_t,uint32_t,bool,int) { return VK_NULL_HANDLE; }
 VkImageView framegen_scaled_view() { return VK_NULL_HANDLE; }
+// (Colour vision correction Off: the uncorrected blits; the corrected route is covered by test_present_geometry_trace.py)
+namespace colour_vision { constexpr bool enabled(int mode) { return mode >= 1 && mode <= 3; } }
+int menu_colour_vision_mode() { return 0; }
+bool colour_vision_sdr(VkCommandBuffer,VkImageView,uint32_t,uint32_t,const int*,VkImage,VkImageView,PresentRect,int,bool) {
+    CHECK(false); return false;
+}
 void full_barrier(VkCommandBuffer) {}
 void logf(const char*,...) {}
 // @PRODUCTION_HELPERS@
 void record_actual(VkCommandBuffer command,VkImage src,uint32_t sw,uint32_t sh,const int* crop,VkImage dst) {
     struct { VkCommandBuffer cmd; } f{command};
     VkImageView view=VK_NULL_HANDLE;
+    const bool allow_scale=true, source_srgb=false;
+    const uint32_t index=0;
 // @PRODUCTION_PRESENT@
 }
 uint32_t memory_type(uint32_t bits,VkMemoryPropertyFlags flags) {
diff --git a/tests/test_capture_dimensions.py b/tests/test_capture_dimensions.py
--- a/tests/test_capture_dimensions.py
+++ b/tests/test_capture_dimensions.py
@@ -34,8 +34,11 @@ def main():
     globals_and_setup = source[start:source.index("void image_barrier(", start)]
     gate = "if (src && (dev.offscreen || shots) && offscreen_init())"
     assert gate in source
-    tail = "if (dev.offscreen || interpolated) return;\n    present_image(src, sw, sh, crop, direct_view);"
-    assert tail in source
+    # (with the Colour vision correction row, #1832, the present also takes the view's encoding and whether to scale)
+    tails = ["if (dev.offscreen || interpolated) return;\n    present_image(src, sw, sh, crop, direct_view" + rest
+             for rest in (", source_srgb, direct_scale);", ");")]
+    tail = next((t for t in tails if t in source), None)
+    assert tail, "do_present's tail, present_image after the offscreen return, is not found"
     png = block(source, "uint32_t crc32(") + "\n" + block(source, "bool write_png(")
     template = (ROOT / "tests/capture_dimensions_test.cpp").read_text(encoding="utf-8")
     fixture = template.replace("/* SETUP */", globals_and_setup).replace("/* GATE */", gate)
diff --git a/tests/test_menu_ini_keys.py b/tests/test_menu_ini_keys.py
--- a/tests/test_menu_ini_keys.py
+++ b/tests/test_menu_ini_keys.py
@@ -19,8 +19,7 @@ from pathlib import Path
 ROOT = Path(__file__).resolve().parents[1]
 
 # (the keys of 2026-11-18, main c507b98c, as players' files hold them: odd ones included, "autosave:" and "amd_anti-lag_2")
-FROZEN = {
-    "colour_vision": "&opts.colour_vision",   # (a key: the value its row saves, as players' files hold them)
+FROZEN = {   # (a key: the value its row saves, as players' files hold them)
     "amd_anti-lag_2": "&opts.antilag",
     "anisotropic_filtering": "&opts.anisotropy",
     "astc_as_rgba8": "&opts.astc_rgba8",
@@ -28,6 +27,7 @@ FROZEN = {
     "autosave:": "&opts.transition_autosave",
     "button_prompts": "&opts.prompts",
     "camera_speed": "&opts.camera_speed",
+    "colour_vision": "&opts.colour_vision",
     "compact_menu_key": "&opts.compact_menu_key",
     "controller_in_background": "&opts.pad_background",
     "controller_menu_button": "&opts.pad_menu",
diff --git a/tests/test_present_source_crop.py b/tests/test_present_source_crop.py
--- a/tests/test_present_source_crop.py
+++ b/tests/test_present_source_crop.py
@@ -33,6 +33,12 @@ def main():
                            block(fg, "bool framegen_record("),
                            block(fg, "VkImage framegen_hdr(")])
     template = (ROOT / "tests/present_source_crop_test.cpp").read_text(encoding="utf-8")
+    hdr = block(fg, "VkImage framegen_hdr(")
+    # (the Colour vision correction row's mode, #1832: its default is in vk_framegen.h, not the definition; Off here)
+    if "int colour_vision" in hdr[:hdr.index("{")]:
+        call = "framegen_hdr(nullptr, 1, sw, sh, crop, 1920, 1080, false)"
+        assert call in template
+        template = template.replace(call, call[:-1] + ", 0)")
     fixture = template.replace("/* ACTUAL_STATE */", structs).replace("/* ACTUAL_FUNCTIONS */", functions)
     with tempfile.TemporaryDirectory(prefix="present-source-crop-") as temp:
         cpp, exe = Path(temp) / "fixture.cpp", Path(temp) / "fixture.exe"

Suggestions (the author may take or leave)

  • vk_replay.cpp:6008: the mode is read twice per frame, once in do_present (to decide whether to make direct_view) and once in present_image. If the row flips between those two reads, present_image finds correction on with no view, logs "unavailable for this presentation route" once and never again, so a real failure later goes unreported. Passing the mode do_present decided on (as source_srgb is passed) would close that gap.
  • test_colour_vision.py pins the CPU copy only. The GLSL has its own copy of the coefficients and axes, and nothing checks that the two agree. A test that reads both sets of constants would catch a one-sided edit, which would leave the menu and the picture corrected differently.
  • The Graphics tab gains a section, so the guide's Graphics screenshot is now stale (the guide check's drift goes from 25 to 27; that check also fails on main, e.g. on #1852).

Questions

  • Measurements: main at 101.66 fps against this PR's Off at 113.90 fps is a 12% gap between two code paths that are the same when Off. Was main built the same way (the same pack over the same base, and the same runtime folder and options file)? It doesn't change the verdict, since Off can't cost anything here by construction. But it means the 3.4% for Deutan sits within the noise of these runs. A Deutan cost of about 0.3 ms per frame for one full-screen pass at 1600×900 is plausible, and it's opt-in.
  • #139 (simonwjackson's Colour filter) is the same feature and is still open and active. It's waiting on a farm run approval, and you reviewed it on 2026-11-18. Have you and Simon agreed which one goes in? See Overlaps.

Testing: Windows 11, RTX 4070, NVIDIA 621.01, by the author: all three modes live in SDR, Expanded HDR10 and Native PQ, game and generated frames, saved and back to Off, with before/after shots. Missing, and it holds the merge (Tier 1, a present path): AMD RX 6000-9000 on Windows and Linux/RADV, and the Steam Deck, with Off and one mode. A Linux surface with no UNORM format takes the target_srgb branch of colour_vision.frag, which NVIDIA on Windows never does. CI on this head: the Python source checks and SPIR-V fixtures were skipped, so they couldn't catch the three tests above. The guide check fails, as on main.
Overlaps and merge order: #139 is the same feature, built into fg_scale.comp. It doesn't merge cleanly with main, and its row is in vk_menu.cpp's table, which the menu-module rule no longer allows. Only one should merge. On the code, I'd take this one: it's on current main, it's a module, it covers Native HDR, and it corrects the menu with the picture. Simon's Linux RADV runs and farm setup could cover this PR's AMD gap. The two authors and a BigBean should settle it on that PR.

**Verdict: Request changes.** The feature is well built and Off leaves every present path as it is. But the new `present_image` and `framegen_hdr` arguments break three tests that pass on `main`: two in the source suite (`test_capture_dimensions.py`, `test_present_source_crop.py`) and the Vulkan fixture `test_present_aspect_vulkan.py`. The fix is test-only and is below as a patch. Tier 1 AMD, Linux and Steam Deck runs are still owed, and the sRGB-only swapchain branch they would exercise has never run. For players with red-green or blue-yellow colour vision deficiency, this adds a saved Accessibility row that recolours the final picture and the Insert menu, live, in SDR and both HDR modes, game and generated frames alike. It makes the code better: the correction lives in one shared GLSL function. In SDR it replaces the final blit, so it adds no images and no readback, and in HDR it is part of the existing encoder pass. The row is a menu module, and nothing changes while it is Off. **Reviewed:** fdda302e against 068fb8eb (its merge base, still the PR's base): `colour_vision.h`, `colour_vision.glsl`, `colour_vision.frag`, `hdr_encode.comp`, `vk_colour_vision.cpp/.h`, `menu/colour_vision.cpp`, and the changed parts of `vk_replay.cpp` (all of `present_image` and the `do_present` part), `vk_framegen.cpp/.h` (`framegen_scale`, `framegen_hdr`, `pass`), `vk_imgui.cpp/.h`, `vk_menu.cpp/.h` (`set_row`, `menu_setting_set`, the options load), `vk_main.cpp`'s swapchain usage, every changed test, and every test that cuts `present_image` or `framegen_hdr` out of the source. Only skimmed: the two SPIR-V headers (their provenance lines) and `menu_i18n.h` (6 strings × 13 languages, spot-read). Nothing run (a code review). **Fixed in this review:** nothing pushed. The patch below is committed on my side but couldn't be pushed to `codex/colour-vision` from here, so it's yours to apply (or say so and I'll push it). **Checked and fine:** - With correction Off, `do_present` and `present_image` take the same branches as on `main`: `allow_scale` is `direct_scale`, which is exactly the old condition for making `direct_view`. The HDR fast path for Native PQ codes still applies whenever correction is off. - Sync: the full barrier at the top of `present_image` covers the game's writes. `framegen_scale`'s `pass` ends in a full barrier, and its outputs are SAMPLED and in GENERAL. The swapchain image goes TRANSFER_DST → COLOR_ATTACHMENT → TRANSFER_DST around the draw, and its older content is kept, so the letterbox clear stays outside `renderArea` (`LOAD_OP_DONT_CARE` applies only inside it). - Formats: the pipeline is built for `dev.swap_view_format`, the format of `dev.swap_views`. Both sRGB cases resolve correctly: an sRGB-only chain drawn through sRGB views gets linear output, and a mutable sRGB chain drawn through UNORM views gets encoded output. Every surface allows COLOR_ATTACHMENT, and Vulkan 1.3 dynamic rendering and sync2 are already required at device creation. - Maths: `dot(axis, Y709) == 0` for all three axes, so luminance holds in SDR. In HDR, `shift - dot(shift, Y2020)` keeps Rec.2020 luminance. The gamut scale can't divide by zero. The CPU copy in `colour_vision.h` gives the same result as the GLSL in SDR. - State: `present_image_mu` serialises the pipeline map and the statics. Each row change, including the bridge's `menu_setting_set`, goes through `set_row` and on to `on_change`, and `menu_init` seeds the mode after the options load, so the atomic can't fall behind `opts.colour_vision`. - The menu row follows the module rule, with `preset_exempt`, no restart and its key in `FROZEN`. The docs row and section are there, and the menu-section tests are updated. - `test_present_geometry_trace` fails if `allow_scale &&` or `!scaled &&` is undone. `test_colour_vision` pins the three reference colours, greys, luminance and gamut. **Blocking** (to change before merge) 1. `tests/test_capture_dimensions.py:37` asserts the old text `present_image(src, sw, sh, crop, direct_view);`, which `vk_replay.cpp:5579` no longer has. It stops at that assert on this head and passes on `main`. Its fixture's `present_image` stub also needs the two new parameters. 2. `tests/test_present_source_crop.py` stitches the definition of `framegen_hdr`, whose new `int colour_vision` has no default (the default is only in `vk_framegen.h`). The template's call at `present_source_crop_test.cpp:150` passes 8 arguments, so the fixture no longer compiles. 3. `tests/test_present_aspect_vulkan.py` pastes everything in `present_image` from `const PresentAspect aspect{` up to the frame log. That span now uses `allow_scale`, `source_srgb`, `index`, `dev.swap_views`, `menu_colour_vision_mode`, `colour_vision::enabled`, `colour_vision_sdr` and a 9-argument `framegen_hdr`, and `present_aspect_vulkan.cpp` defines none of them. The source suite skips this test (it needs a device), but `run_vulkan_fixtures.py` and the lavapipe workflow run it. None of the three is on the Testing section's "fails on both" list, so they probably didn't run on your PC (the first two need `--headers`). The patch makes each accept both the old and new source, as your other fixture updates do, and runs it with correction Off. It also moves `colour_vision` to its alphabetical place in `FROZEN` with the table's comment back on its own line, and makes `framegen_hdr`'s default `0` (it was `false`) with a doc line. I wrote it by reading and haven't run it, so please run those three tests (and `test_menu_ini_keys.py`) once it's in. <details> <summary>The patch (on fdda302e)</summary> ```diff diff --git a/gpu/vk/vk_framegen.h b/gpu/vk/vk_framegen.h --- a/gpu/vk/vk_framegen.h +++ b/gpu/vk/vk_framegen.h @@ -60,9 +60,9 @@ VkImageView framegen_scaled_view(); // final scale/CRT view for the existing H /// (longshot) The HDR10 picture of src's crop at dw x dh (the Insert menu's HDR), GENERAL; null: none (the SDR picture then; /// Native's scaled picture, else black: present_image). /// pq: src is the game's own HDR10 picture (Native), its PQ codes as they are at 100% contrast, else graded and written again; -/// else the SDR picture, expanded +/// else the SDR picture, expanded. colour_vision: the Colour vision correction row's mode (0 Off), applied after grading VkImage framegen_hdr(VkCommandBuffer cmd, VkImageView src, uint32_t sw, uint32_t sh, const int crop[4], uint32_t dw, uint32_t dh, - bool pq, int colour_vision = false); + bool pq, int colour_vision = 0); /// Each present: ultrawide's menus (the Insert menu's setting to the game's side, the sides blurred or black while a menu shows) void wide_sides_tick(); /// Whether ultrawide's menu sides can show at all: Ultrawide with a margin and the Insert menu's setting on diff --git a/tests/capture_dimensions_test.cpp b/tests/capture_dimensions_test.cpp --- a/tests/capture_dimensions_test.cpp +++ b/tests/capture_dimensions_test.cpp @@ -42,10 +42,11 @@ void destroy_image(VkImage,VmaAllocation) {} void destroy_buffer(VkBuffer,VmaAllocation) {} VKAPI_ATTR void VKAPI_CALL vkDestroyImageView(VkDevice,VkImageView,const VkAllocationCallbacks*) {} /* SETUP */ -void present_image(VkImage,uint32_t,uint32_t,const int*,VkImageView) { presented++; } +void present_image(VkImage,uint32_t,uint32_t,const int*,VkImageView,bool=false,bool=true) { presented++; } void tick() { VkImage src=reinterpret_cast<VkImage>(uintptr_t(0xff)); const char* shots="test"; uint32_t sw=1720,sh=720; const int* crop=nullptr; VkImageView direct_view{}; bool interpolated=false; + [[maybe_unused]] bool source_srgb=false, direct_scale=false; /* GATE */ { capture_entries++; } /* PRESENT_TAIL */ } diff --git a/tests/present_aspect_vulkan.cpp b/tests/present_aspect_vulkan.cpp --- a/tests/present_aspect_vulkan.cpp +++ b/tests/present_aspect_vulkan.cpp @@ -17,7 +17,7 @@ using namespace mkwvk; VkDevice device; VkPhysicalDevice physical; VkPhysicalDeviceMemoryProperties memory_props; -struct { VkExtent2D swap_extent; bool hdr = false; } dev; +struct { VkExtent2D swap_extent; bool hdr = false; std::vector<VkImageView> swap_views = std::vector<VkImageView>(1); } dev; std::atomic<bool> present_native_pq{false}; float display_aspect; float get_aspect() { return display_aspect; } @@ -27,14 +27,22 @@ VkImage framegen_scale(VkCommandBuffer,VkImageView,VkImage,uint32_t,uint32_t,con return VK_NULL_HANDLE; // This GPU fixture exercises direct blits; filtered routing is covered by L1. } // (SDR only here: the HDR pass and Native's routing are covered by test_present_aspect.py) -VkImage framegen_hdr(VkCommandBuffer,VkImageView,uint32_t,uint32_t,const int*,uint32_t,uint32_t,bool) { return VK_NULL_HANDLE; } +VkImage framegen_hdr(VkCommandBuffer,VkImageView,uint32_t,uint32_t,const int*,uint32_t,uint32_t,bool,int) { return VK_NULL_HANDLE; } VkImageView framegen_scaled_view() { return VK_NULL_HANDLE; } +// (Colour vision correction Off: the uncorrected blits; the corrected route is covered by test_present_geometry_trace.py) +namespace colour_vision { constexpr bool enabled(int mode) { return mode >= 1 && mode <= 3; } } +int menu_colour_vision_mode() { return 0; } +bool colour_vision_sdr(VkCommandBuffer,VkImageView,uint32_t,uint32_t,const int*,VkImage,VkImageView,PresentRect,int,bool) { + CHECK(false); return false; +} void full_barrier(VkCommandBuffer) {} void logf(const char*,...) {} // @PRODUCTION_HELPERS@ void record_actual(VkCommandBuffer command,VkImage src,uint32_t sw,uint32_t sh,const int* crop,VkImage dst) { struct { VkCommandBuffer cmd; } f{command}; VkImageView view=VK_NULL_HANDLE; + const bool allow_scale=true, source_srgb=false; + const uint32_t index=0; // @PRODUCTION_PRESENT@ } uint32_t memory_type(uint32_t bits,VkMemoryPropertyFlags flags) { diff --git a/tests/test_capture_dimensions.py b/tests/test_capture_dimensions.py --- a/tests/test_capture_dimensions.py +++ b/tests/test_capture_dimensions.py @@ -34,8 +34,11 @@ def main(): globals_and_setup = source[start:source.index("void image_barrier(", start)] gate = "if (src && (dev.offscreen || shots) && offscreen_init())" assert gate in source - tail = "if (dev.offscreen || interpolated) return;\n present_image(src, sw, sh, crop, direct_view);" - assert tail in source + # (with the Colour vision correction row, #1832, the present also takes the view's encoding and whether to scale) + tails = ["if (dev.offscreen || interpolated) return;\n present_image(src, sw, sh, crop, direct_view" + rest + for rest in (", source_srgb, direct_scale);", ");")] + tail = next((t for t in tails if t in source), None) + assert tail, "do_present's tail, present_image after the offscreen return, is not found" png = block(source, "uint32_t crc32(") + "\n" + block(source, "bool write_png(") template = (ROOT / "tests/capture_dimensions_test.cpp").read_text(encoding="utf-8") fixture = template.replace("/* SETUP */", globals_and_setup).replace("/* GATE */", gate) diff --git a/tests/test_menu_ini_keys.py b/tests/test_menu_ini_keys.py --- a/tests/test_menu_ini_keys.py +++ b/tests/test_menu_ini_keys.py @@ -19,8 +19,7 @@ from pathlib import Path ROOT = Path(__file__).resolve().parents[1] # (the keys of 2026-11-18, main c507b98c, as players' files hold them: odd ones included, "autosave:" and "amd_anti-lag_2") -FROZEN = { - "colour_vision": "&opts.colour_vision", # (a key: the value its row saves, as players' files hold them) +FROZEN = { # (a key: the value its row saves, as players' files hold them) "amd_anti-lag_2": "&opts.antilag", "anisotropic_filtering": "&opts.anisotropy", "astc_as_rgba8": "&opts.astc_rgba8", @@ -28,6 +27,7 @@ FROZEN = { "autosave:": "&opts.transition_autosave", "button_prompts": "&opts.prompts", "camera_speed": "&opts.camera_speed", + "colour_vision": "&opts.colour_vision", "compact_menu_key": "&opts.compact_menu_key", "controller_in_background": "&opts.pad_background", "controller_menu_button": "&opts.pad_menu", diff --git a/tests/test_present_source_crop.py b/tests/test_present_source_crop.py --- a/tests/test_present_source_crop.py +++ b/tests/test_present_source_crop.py @@ -33,6 +33,12 @@ def main(): block(fg, "bool framegen_record("), block(fg, "VkImage framegen_hdr(")]) template = (ROOT / "tests/present_source_crop_test.cpp").read_text(encoding="utf-8") + hdr = block(fg, "VkImage framegen_hdr(") + # (the Colour vision correction row's mode, #1832: its default is in vk_framegen.h, not the definition; Off here) + if "int colour_vision" in hdr[:hdr.index("{")]: + call = "framegen_hdr(nullptr, 1, sw, sh, crop, 1920, 1080, false)" + assert call in template + template = template.replace(call, call[:-1] + ", 0)") fixture = template.replace("/* ACTUAL_STATE */", structs).replace("/* ACTUAL_FUNCTIONS */", functions) with tempfile.TemporaryDirectory(prefix="present-source-crop-") as temp: cpp, exe = Path(temp) / "fixture.cpp", Path(temp) / "fixture.exe" ``` </details> **Suggestions** (the author may take or leave) - `vk_replay.cpp:6008`: the mode is read twice per frame, once in `do_present` (to decide whether to make `direct_view`) and once in `present_image`. If the row flips between those two reads, `present_image` finds correction on with no view, logs "unavailable for this presentation route" once and never again, so a real failure later goes unreported. Passing the mode `do_present` decided on (as `source_srgb` is passed) would close that gap. - `test_colour_vision.py` pins the CPU copy only. The GLSL has its own copy of the coefficients and axes, and nothing checks that the two agree. A test that reads both sets of constants would catch a one-sided edit, which would leave the menu and the picture corrected differently. - The Graphics tab gains a section, so the guide's Graphics screenshot is now stale (the guide check's drift goes from 25 to 27; that check also fails on `main`, e.g. on https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1852). **Questions** - Measurements: `main` at 101.66 fps against this PR's Off at 113.90 fps is a 12% gap between two code paths that are the same when Off. Was `main` built the same way (the same pack over the same base, and the same runtime folder and options file)? It doesn't change the verdict, since Off can't cost anything here by construction. But it means the 3.4% for Deutan sits within the noise of these runs. A Deutan cost of about 0.3 ms per frame for one full-screen pass at 1600×900 is plausible, and it's opt-in. - https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/139 (simonwjackson's Colour filter) is the same feature and is still open and active. It's waiting on a farm run approval, and you reviewed it on 2026-11-18. Have you and Simon agreed which one goes in? See Overlaps. **Testing:** Windows 11, RTX 4070, NVIDIA 621.01, by the author: all three modes live in SDR, Expanded HDR10 and Native PQ, game and generated frames, saved and back to Off, with before/after shots. Missing, and it holds the merge (Tier 1, a present path): AMD RX 6000-9000 on Windows and Linux/RADV, and the Steam Deck, with Off and one mode. A Linux surface with no UNORM format takes the `target_srgb` branch of `colour_vision.frag`, which NVIDIA on Windows never does. CI on this head: the Python source checks and SPIR-V fixtures were skipped, so they couldn't catch the three tests above. The guide check fails, as on `main`. **Overlaps and merge order:** https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/139 is the same feature, built into `fg_scale.comp`. It doesn't merge cleanly with `main`, and its row is in `vk_menu.cpp`'s table, which the menu-module rule no longer allows. Only one should merge. On the code, I'd take this one: it's on current `main`, it's a module, it covers Native HDR, and it corrects the menu with the picture. Simon's Linux RADV runs and farm setup could cover this PR's AMD gap. The two authors and a BigBean should settle it on that PR.
@ -63,3 +63,3 @@
/// else the SDR picture, expanded
VkImage framegen_hdr(VkCommandBuffer cmd, VkImageView src, uint32_t sw, uint32_t sh, const int crop[4], uint32_t dw, uint32_t dh,
bool pq = false);
bool pq, int colour_vision = false);
Member

= 0 rather than = false for an int. This default is only here, not on the definition, and test_present_source_crop.py compiles the definition and calls it with 8 arguments (present_source_crop_test.cpp:150), so that fixture no longer compiles (blocking 2; the patch in the summary).

`= 0` rather than `= false` for an int. This default is only here, not on the definition, and `test_present_source_crop.py` compiles the definition and calls it with 8 arguments (`present_source_crop_test.cpp:150`), so that fixture no longer compiles (blocking 2; the patch in the summary).
@ -5568,3 +5577,3 @@
if (dev.offscreen) frame_log_present(); // (no window: the copy into the offscreen image above is its present)
if (dev.offscreen || interpolated) return;
present_image(src, sw, sh, crop, direct_view);
present_image(src, sw, sh, crop, direct_view, source_srgb, direct_scale);
Member

tests/test_capture_dimensions.py:37 asserts the old text of this call (present_image(src, sw, sh, crop, direct_view);), so it stops at that assert on this head, and its fixture's present_image stub has 5 parameters. The patch in the summary takes both forms (blocking 1).

`tests/test_capture_dimensions.py:37` asserts the old text of this call (`present_image(src, sw, sh, crop, direct_view);`), so it stops at that assert on this head, and its fixture's `present_image` stub has 5 parameters. The patch in the summary takes both forms (blocking 1).
@ -5997,2 +6006,3 @@
const VkImage scaled = src && view ? framegen_scale(f.cmd, view, src, sw, sh, crop, rect.w, rect.h, native_pq) : VK_NULL_HANDLE;
const VkImage scaled = allow_scale && src && view ? framegen_scale(f.cmd, view, src, sw, sh, crop, rect.w, rect.h, native_pq) : VK_NULL_HANDLE;
// (longshot) the Insert menu's HDR: the picture (scaled, or the game's own with its crop) to HDR10, copied in as the SDR one is
const int colour = menu_colour_vision_mode();
Member

Suggestion: do_present reads the mode separately to decide on direct_view. A flip between the two reads gives correction with no view, which logs the one-time "unavailable" line here, and a real failure later then goes unreported. Passing the mode along with source_srgb would make the two agree.

Suggestion: `do_present` reads the mode separately to decide on `direct_view`. A flip between the two reads gives correction with no view, which logs the one-time "unavailable" line here, and a real failure later then goes unreported. Passing the mode along with `source_srgb` would make the two agree.
@ -6002,2 +6012,3 @@
: framegen_hdr(f.cmd, view, sw, sh, crop, rect.w, rect.h, native_pq, colour))
: VK_NULL_HANDLE;
if (hdr_image) {
const bool corrected = correct_sdr && index < dev.swap_views.size() && colour_vision_sdr(
Member

test_present_aspect_vulkan.py pastes this span (from const PresentAspect aspect{ to the frame log) into present_aspect_vulkan.cpp, which defines none of allow_scale, source_srgb, index, dev.swap_views, colour_vision_sdr, menu_colour_vision_mode, colour_vision::enabled, or a 9-argument framegen_hdr (blocking 3; the patch in the summary).

`test_present_aspect_vulkan.py` pastes this span (from `const PresentAspect aspect{` to the frame log) into `present_aspect_vulkan.cpp`, which defines none of `allow_scale`, `source_srgb`, `index`, `dev.swap_views`, `colour_vision_sdr`, `menu_colour_vision_mode`, `colour_vision::enabled`, or a 9-argument `framegen_hdr` (blocking 3; the patch in the summary).
@ -21,2 +21,3 @@
# (the keys of 2026-11-18, main c507b98c, as players' files hold them: odd ones included, "autosave:" and "amd_anti-lag_2")
FROZEN = { # (a key: the value its row saves, as players' files hold them)
FROZEN = {
"colour_vision": "&opts.colour_vision", # (a key: the value its row saves, as players' files hold them)
Member

Nit: the table is in key order and this line took the table's own comment. In the patch, colour_vision goes after camera_speed and the comment goes back on FROZEN = {.

Nit: the table is in key order and this line took the table's own comment. In the patch, `colour_vision` goes after `camera_speed` and the comment goes back on `FROZEN = {`.
test(vk): follow the colour correction's present arguments in three fixtures
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
PR description / Description follows the template (pull_request_target) Successful in 10s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 11s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
Third-party parts / As their notes say (pull_request) Successful in 14s
CI / Website build and checks (pull_request) Has been cancelled
1c499df4a7
present_image now takes the sampled view's encoding and whether to scale, and
framegen_hdr the correction mode, whose default is only in vk_framegen.h.
test_capture_dimensions.py looked for the old call's text, and
test_present_source_crop.py and test_present_aspect_vulkan.py compile the
production code against stubs that did not have the new names. Each accepts
both forms, as the PR's other fixtures do, and runs with correction Off.

Also: the colour_vision key in FROZEN in order with the table's comment back
on its line, and framegen_hdr's colour_vision default as 0, documented.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
dyst left a comment

Verdict: Comment. The three broken tests from my review are fixed in 1c499df4 (pushed to codex/colour-vision, on top of fdda302e). What still holds the merge is the Tier 1 hardware run and the choice between this PR and #139, not the code.

Reviewed: 1c499df4 against fdda302e: only my own commit, which is the patch from the review above with nothing added. Nothing run.
Fixed in this review: 1c499df4. test_capture_dimensions.py, test_present_source_crop.py and test_present_aspect_vulkan.py now follow the new present_image and framegen_hdr arguments (each accepts the old source too, and runs with correction Off). colour_vision is in its alphabetical place in FROZEN, and framegen_hdr's default is 0, with a doc line.

To do before merge

  • @futondestroyer: please run test_capture_dimensions.py, test_present_source_crop.py, test_menu_ini_keys.py and, on a GPU, run_vulkan_fixtures.py's test_present_aspect_vulkan.py on this head. I wrote the commit by reading. If any of them fails, it's mine to fix.
  • Tier 1: AMD RX 6000-9000 on Windows and Linux/RADV, and the Steam Deck, with Off and one mode. A Linux surface with no UNORM format takes colour_vision.frag's target_srgb branch, which hasn't run yet.
  • Which of this PR and #139 goes in, settled with simonwjackson. On the code, I'd take this one (see the review above).

The suggestions and the measurement question from the review above still stand. None of them blocks.

**Verdict: Comment.** The three broken tests from my review are fixed in 1c499df4 (pushed to `codex/colour-vision`, on top of fdda302e). What still holds the merge is the Tier 1 hardware run and the choice between this PR and https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/139, not the code. **Reviewed:** 1c499df4 against fdda302e: only my own commit, which is the patch from the review above with nothing added. Nothing run. **Fixed in this review:** 1c499df4. `test_capture_dimensions.py`, `test_present_source_crop.py` and `test_present_aspect_vulkan.py` now follow the new `present_image` and `framegen_hdr` arguments (each accepts the old source too, and runs with correction Off). `colour_vision` is in its alphabetical place in `FROZEN`, and `framegen_hdr`'s default is `0`, with a doc line. **To do before merge** - @futondestroyer: please run `test_capture_dimensions.py`, `test_present_source_crop.py`, `test_menu_ini_keys.py` and, on a GPU, `run_vulkan_fixtures.py`'s `test_present_aspect_vulkan.py` on this head. I wrote the commit by reading. If any of them fails, it's mine to fix. - Tier 1: AMD RX 6000-9000 on Windows and Linux/RADV, and the Steam Deck, with Off and one mode. A Linux surface with no UNORM format takes `colour_vision.frag`'s `target_srgb` branch, which hasn't run yet. - Which of this PR and https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/139 goes in, settled with simonwjackson. On the code, I'd take this one (see the review above). The suggestions and the measurement question from the review above still stand. None of them blocks.
futondestroyer force-pushed codex/colour-vision from 1c499df4a7
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 7s
PR description / Description follows the template (pull_request_target) Successful in 10s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 11s
CI / Workflow lint (actionlint) (pull_request) Successful in 13s
Third-party parts / As their notes say (pull_request) Successful in 14s
CI / Website build and checks (pull_request) Has been cancelled
to 3a2375733f
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 8s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 14s
CI / Workflow lint (actionlint) (pull_request) Successful in 15s
Third-party parts / As their notes say (pull_request) Successful in 17s
PR description / Description follows the template (pull_request_target) Successful in 7s
CI / Website build and checks (pull_request) Failing after 2m35s
2026-11-20 13:25:49 +00:00
Compare
Author
Member

Rebased onto 89c3d21e with all three patches preserved, including the fixture follow-up from dyst. Verified 3a237573 in the Windows pack and in Kokiri SDR with built-in 2x FG. All three modes applied live, both game and generated frames used correction, the saved setting returned to Off, and the game exited cleanly. Eleven focused checks and seven offscreen Vulkan cases passed. The crop fixture stub error reproduces on exact main and the former head. See Testing for the detailed scope and remaining checks.

Rebased onto 89c3d21e with all three patches preserved, including the fixture follow-up from dyst. Verified 3a237573 in the Windows pack and in Kokiri SDR with built-in 2x FG. All three modes applied live, both game and generated frames used correction, the saved setting returned to Off, and the game exited cleanly. Eleven focused checks and seven offscreen Vulkan cases passed. The crop fixture stub error reproduces on exact main and the former head. See Testing for the detailed scope and remaining checks.
HumanBean deleted branch codex/colour-vision 2026-11-20 21:41:07 +00:00
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!1832
No description provided.