feat(reshade): add Vulkan presets and live comparison #1861

Merged
HumanBean merged 14 commits from Valerio85/Longshot:codex/reshade-presets into main 2026-11-21 17:53:11 +00:00
Contributor

Summary

Graphics → Post-processing adds optional ReShade FX presets. Choose from the bundled grades or import an INI and its effects. The comparison view lets you toggle the effect and browse presets in the same scene. Back restores the saved selection.

Start with gpu/vk/menu/reshade.cpp for the interface and gpu/vk/reshade/fx_runtime.cpp for the effect compiler and Vulkan pass scheduling. See the preset guide for import instructions, HDR behavior and the supported FX subset.

The 20 Clarity profiles adapt names and settings from the CC0 Cemu graphics pack at 496df203. The shader and the five other built-in effects are Longshot code. The two new vendor directories carry the original BSD-3-Clause and MIT notices, which follow the compiler and PNG decoder into the builder and generated game folder. See the upstream Clarity license.

Why ReShade built into the renderer, not an external app

Longshot runs ReShade FX effects inside its own Vulkan renderer instead of relying on an external injector. Here are the trade-offs.

Advantages

  • Effects run at the right point in the frame. Because the effect runs inside the renderer, it is applied before the HUD is drawn. Text, menus and the HUD stay sharp and ungraded. An external tool only sees the final swapchain image, HUD included.
  • Real access to engine data. The renderer provides the actual depth buffer to the effects, instead of an external tool trying to guess which buffer holds depth. This makes depth-based effects (AO, depth of field, fog) much more reliable.
  • Works with the renderer's HDR and frame generation paths. Effects are scheduled together with Native HDR, Expanded HDR and frame generation instead of competing with them. Hooks injected into the swapchain from outside can conflict with these features.
  • No injector and nothing extra to install. There is no DLL injection, no swapchain hooking and no separate ReShade version to keep in sync with the game.
  • Same feature on Windows and Linux. Longshot is native on both. Official ReShade is a Windows-oriented tool, so on Linux it would need workarounds.
  • Integrated experience. Presets are chosen from Graphics → Post-processing. The comparison view toggles the effect and browses presets in the same scene, and Back restores the saved selection. The choice is stored in longshot_options.ini.
  • No cost when unused. Off is the default and leaves the normal rendering path untouched. In the measurements above there is no regression with ReShade Off.
  • Clear licensing. Only presets whose licenses allow free redistribution are bundled, and the third-party notices ship with the game.

Disadvantages and trade-offs

  • No ReShade overlay. Longshot's menu lets you pick a preset, but it does not expose ReShade's own interface: live parameter sliders, per-technique toggles or its shader browser. To change values, edit the .ini and rescan.
  • Presets are imported by hand. The user must copy the .ini to reshade/presets, the .fx/.fxh files to reshade/shaders and any PNG textures to reshade/textures, then use Rescan in the menu.
  • Supported FX subset only. Longshot uses its own FX compiler and Vulkan pass scheduling, so not every feature of official ReShade is supported. A preset that uses an unsupported feature reports an error in the menu and log instead of rendering. See the preset guide.
  • More code to maintain. Longshot now carries the FX compiler, a PNG decoder and the runtime. Updates to upstream ReShade do not arrive automatically and have to be tracked.
  • Enabled effects still cost GPU time. Heavy presets, especially depth-based ones, add GPU time and render targets, just like with an external tool.

An external ReShade is still the better choice for authoring and tuning a preset interactively. A preset made there can then be imported into Longshot.

Testing

Tested: Windows, NVIDIA GeForce RTX 5080, driver 617.42. At d05f599, Warm ran before the HUD, the Italian comparison toggled the effect, browsed built-ins and both imported INI files, and Back restored the saved preset and file. Captured 89c3d21 and d05f599 at the same position in the Kokiri Forest start save, plus the two- and three-row comparison views. Earlier topic revisions also ran linear Native HDR, Expanded HDR, depth and frame generation paths. The current renderer links on Windows with llvm-mingw and on Linux with clang. Twelve targeted checks passed on Windows, including the 14-language localization check, UTF-8 paths, FX import, HUD capture, AppImage notices and vendor provenance.

The Windows strict game-free checks at 89c3d21 and on the branch reported the same 77 failing checks and the same 180-second timeout in test_vbytes.py. Every non-passing check on the branch matched the result on main, as listed below. The initial runs stopped at the Windows queue fixture. An isolated run confirmed that test_job_queue.py fails on both revisions in test_a_game_and_a_jobs_game and test_ram_file_system. The remaining checks were resumed on both sides. The comparison action's settings-table fixture was corrected at e1ceac6 and passed on rerun. Local totals with those reruns are 755 passes on main and 756 on the branch, with 48 skips on each. The queue test completed in the Linux container, where the five Windows-only cases are skipped.

Matching Windows check results
  • nx2/test_nup_paths.py (fail)
  • tests/test_appimage_player_build.py (fail)
  • tests/test_auto_handheld.py (fail)
  • tests/test_bug_report_defaults.py (fail)
  • tests/test_build_long_paths.py (fail)
  • tests/test_capture_read_once.py (fail)
  • tests/test_capture_readback_visibility.py (fail)
  • tests/test_control.py (fail)
  • tests/test_copy_writable.py (fail)
  • tests/test_crash_dialog.py (fail)
  • tests/test_crt_options.py (fail)
  • tests/test_damage_debug_menu.py (fail)
  • tests/test_dev_ab.py (fail)
  • tests/test_dev_build.py (fail)
  • tests/test_dev_migrate.py (fail)
  • tests/test_dev_packs.py (fail)
  • tests/test_display_startup_failure.py (fail)
  • tests/test_dlss_feature_size.py (fail)
  • tests/test_draw_binds.py (fail)
  • tests/test_draw_stream_visibility.py (fail)
  • tests/test_early_split_before_draw.py (fail)
  • tests/test_failed_compile_keeps_objects.py (fail)
  • tests/test_finish_output.py (fail)
  • tests/test_frame_overlap.py (fail)
  • tests/test_fsr3fi_hud_layer.py (fail)
  • tests/test_fsr3fi_hudless_colour.py (fail)
  • tests/test_fsr_image_retirement.py (fail)
  • tests/test_fsr_uniform_ownership.py (fail)
  • tests/test_game_menu_mouse_buttons.py (fail)
  • tests/test_guest_imported.py (fail)
  • tests/test_high_fps_fixes.py (fail)
  • tests/test_hold_gpu.py (fail)
  • tests/test_host_guest_writes.py (fail)
  • tests/test_hud_layout_row.py (fail)
  • tests/test_job_queue.py (fail on isolated rerun)
  • tests/test_libc_hooks.py (fail)
  • tests/test_lift_cache.py (fail)
  • tests/test_linux_preflight.py (fail)
  • tests/test_linux_pressure.py (fail)
  • tests/test_long_paths.py (fail)
  • tests/test_low_vram_texture_mips.py (fail)
  • tests/test_make_game_cache.py (fail)
  • tests/test_make_game_ngx.py (fail)
  • tests/test_mise_build.py (fail)
  • tests/test_missing_nup.py (fail)
  • tests/test_mods_list.py (fail)
  • tests/test_ngx_sdk.py (fail)
  • tests/test_options_path.py (fail)
  • tests/test_pads_after_menu.py (fail)
  • tests/test_pass_barrier.py (fail)
  • tests/test_pending_guest_import.py (fail)
  • tests/test_perf_report.py (fail)
  • tests/test_pipeline_cache_file.py (fail)
  • tests/test_pipeline_play_cache.py (fail)
  • tests/test_portable_builder_home.py (fail)
  • tests/test_prepare_cache_save.py (fail)
  • tests/test_present_queue_default.py (fail)
  • tests/test_present_source_crop.py (fail)
  • tests/test_profiling_mode.py (fail)
  • tests/test_psychov35_fsr3_fg.py (fail)
  • tests/test_readback_early.py (fail)
  • tests/test_readback_late.py (fail)
  • tests/test_readback_timeout_source.py (fail)
  • tests/test_recording_admission.py (fail)
  • tests/test_replay_write_order.py (fail)
  • tests/test_sampler_admission.py (fail)
  • tests/test_sdiv_overflow.py (fail)
  • tests/test_slow_frames.py (fail)
  • tests/test_song_note_cue.py (fail)
  • tests/test_split_before_draw.py (fail)
  • tests/test_staging_burst.py (fail)
  • tests/test_texel_buffer_ownership.py (fail)
  • tests/test_ub_update_batch.py (fail)
  • tests/test_upscaler_rows.py (fail)
  • tests/test_vbytes.py (timeout)
  • tests/test_vcore_escape.py (fail)
  • tests/test_vk_occlusion_queries.py (fail)
  • tests/test_walk_key.py (fail)

Still to test:

  • Linux with NVIDIA and AMD RADV, including Steam Deck: try Off, compare, a color preset, a depth preset and an imported INI; verify normal play and generated frames where supported (@Beanstalk for the runtime checks, visual comparison by hand).
  • Windows RTX 20–50 and AMD RX 6000–9000: exercise supported HDR and frame-generation combinations, scene transitions and swaps between presets (@Beanstalk and HDR inspection by hand).
  • Windows installer and Linux AppImage: verify the license and provenance files are packaged and copied beside the generated game (CI or by hand).

Measurements

Verdict: No regression was observed with ReShade Off in this scene. The median of the run averages was 143.96 FPS on main and 149.22 FPS with Off. Warm measured 147.56 FPS (-1.1% versus Off).

Setup: Windows, RTX 5080, driver 617.42. Kokiri Forest start save, identical release host executable and game files, fixed SDR settings, no FPS overlay or frame generation. Two interleaved 30-second samples per variant after 15 seconds in gameplay, using the present log. The renderer binaries are from main at 89c3d21 and the branch at d05f599. The final commit e1ceac6 changes only a test.

Metric Before: main @ 89c3d21 After: this PR @ d05f599 After, Warm: this PR @ d05f599
Average FPS 143.96 149.22 147.56
1% low (FPS) 104.59 109.86 109.91
Median frame time (ms) 6.87 6.68 6.75
Frame time p95 (ms) 7.95 7.28 7.44
Frame time p99 (ms) 8.94 8.31 8.46
GPU time (ms) 5.25 5.20 5.27

Individual sample summaries from the present log

main 1: 4201 presents, 142.48 FPS, p99 8.97 ms, GPU 5.27 ms
Off  1: 4441 presents, 149.33 FPS, p99 8.42 ms, GPU 5.20 ms
Warm 1: 4441 presents, 148.23 FPS, p99 8.53 ms, GPU 5.23 ms
main 2: 4321 presents, 145.44 FPS, p99 8.91 ms, GPU 5.23 ms
Off  2: 4441 presents, 149.12 FPS, p99 8.19 ms, GPU 5.20 ms
Warm 2: 4381 presents, 146.88 FPS, p99 8.39 ms, GPU 5.30 ms

Risks

Off is the default and leaves the normal rendering path active. An enabled effect can add GPU time and use render targets. The menu and log report preparation errors when an imported preset uses unsupported FX features. Native HDR accepts bundled effects and imported effects marked for linear HDR. Expanded HDR is available for imported SDR presets. Longshot stores the selected preset as reshade_preset in longshot_options.ini and the selected user INI under reshade.

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.

The existing vendor copies are untouched. Two pinned upstream copies are added with their own provenance. Guide image source review flags pre-existing drift on main and one additional input, gpu/vk/menu_i18n.h, on this branch. The recorded image still needs a visual source review.

When it applies

  • 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.
  • 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.
<!-- Title: WIP: feat(reshade): add Vulkan presets and live comparison --> ## Summary Graphics → Post-processing adds optional ReShade FX presets. Choose from the bundled grades or import an INI and its effects. The comparison view lets you toggle the effect and browse presets in the same scene. Back restores the saved selection. Start with `gpu/vk/menu/reshade.cpp` for the interface and `gpu/vk/reshade/fx_runtime.cpp` for the effect compiler and Vulkan pass scheduling. See the [preset guide](docs/user/reshade-presets.md) for import instructions, HDR behavior and the supported FX subset. The 20 Clarity profiles adapt names and settings from the CC0 Cemu graphics pack at `496df203`. The shader and the five other built-in effects are Longshot code. The two new vendor directories carry the original BSD-3-Clause and MIT notices, which follow the compiler and PNG decoder into the builder and generated game folder. See the [upstream Clarity license](https://github.com/cemu-project/cemu_graphic_packs/blob/496df20311147cfd22523445eea71961115602ab/LICENSE.md). ### Why ReShade built into the renderer, not an external app Longshot runs ReShade FX effects inside its own Vulkan renderer instead of relying on an external injector. Here are the trade-offs. **Advantages** - **Effects run at the right point in the frame.** Because the effect runs inside the renderer, it is applied before the HUD is drawn. Text, menus and the HUD stay sharp and ungraded. An external tool only sees the final swapchain image, HUD included. - **Real access to engine data.** The renderer provides the actual depth buffer to the effects, instead of an external tool trying to guess which buffer holds depth. This makes depth-based effects (AO, depth of field, fog) much more reliable. - **Works with the renderer's HDR and frame generation paths.** Effects are scheduled together with Native HDR, Expanded HDR and frame generation instead of competing with them. Hooks injected into the swapchain from outside can conflict with these features. - **No injector and nothing extra to install.** There is no DLL injection, no swapchain hooking and no separate ReShade version to keep in sync with the game. - **Same feature on Windows and Linux.** Longshot is native on both. Official ReShade is a Windows-oriented tool, so on Linux it would need workarounds. - **Integrated experience.** Presets are chosen from Graphics → Post-processing. The comparison view toggles the effect and browses presets in the same scene, and Back restores the saved selection. The choice is stored in `longshot_options.ini`. - **No cost when unused.** Off is the default and leaves the normal rendering path untouched. In the measurements above there is no regression with ReShade Off. - **Clear licensing.** Only presets whose licenses allow free redistribution are bundled, and the third-party notices ship with the game. **Disadvantages and trade-offs** - **No ReShade overlay.** Longshot's menu lets you pick a preset, but it does not expose ReShade's own interface: live parameter sliders, per-technique toggles or its shader browser. To change values, edit the `.ini` and rescan. - **Presets are imported by hand.** The user must copy the `.ini` to `reshade/presets`, the `.fx`/`.fxh` files to `reshade/shaders` and any PNG textures to `reshade/textures`, then use Rescan in the menu. - **Supported FX subset only.** Longshot uses its own FX compiler and Vulkan pass scheduling, so not every feature of official ReShade is supported. A preset that uses an unsupported feature reports an error in the menu and log instead of rendering. See the [preset guide](docs/user/reshade-presets.md). - **More code to maintain.** Longshot now carries the FX compiler, a PNG decoder and the runtime. Updates to upstream ReShade do not arrive automatically and have to be tracked. - **Enabled effects still cost GPU time.** Heavy presets, especially depth-based ones, add GPU time and render targets, just like with an external tool. An external ReShade is still the better choice for authoring and tuning a preset interactively. A preset made there can then be imported into Longshot. ## Testing **Tested:** Windows, NVIDIA GeForce RTX 5080, driver 617.42. At `d05f599`, Warm ran before the HUD, the Italian comparison toggled the effect, browsed built-ins and both imported INI files, and Back restored the saved preset and file. Captured `89c3d21` and `d05f599` at the same position in the Kokiri Forest start save, plus the two- and three-row comparison views. Earlier topic revisions also ran linear Native HDR, Expanded HDR, depth and frame generation paths. The current renderer links on Windows with llvm-mingw and on Linux with clang. Twelve targeted checks passed on Windows, including the 14-language localization check, UTF-8 paths, FX import, HUD capture, AppImage notices and vendor provenance. The Windows strict game-free checks at `89c3d21` and on the branch reported the same 77 failing checks and the same 180-second timeout in `test_vbytes.py`. Every non-passing check on the branch matched the result on main, as listed below. The initial runs stopped at the Windows queue fixture. An isolated run confirmed that `test_job_queue.py` fails on both revisions in `test_a_game_and_a_jobs_game` and `test_ram_file_system`. The remaining checks were resumed on both sides. The comparison action's settings-table fixture was corrected at `e1ceac6` and passed on rerun. Local totals with those reruns are 755 passes on `main` and 756 on the branch, with 48 skips on each. The queue test completed in the Linux container, where the five Windows-only cases are skipped. <details> <summary>Matching Windows check results</summary> - `nx2/test_nup_paths.py` (fail) - `tests/test_appimage_player_build.py` (fail) - `tests/test_auto_handheld.py` (fail) - `tests/test_bug_report_defaults.py` (fail) - `tests/test_build_long_paths.py` (fail) - `tests/test_capture_read_once.py` (fail) - `tests/test_capture_readback_visibility.py` (fail) - `tests/test_control.py` (fail) - `tests/test_copy_writable.py` (fail) - `tests/test_crash_dialog.py` (fail) - `tests/test_crt_options.py` (fail) - `tests/test_damage_debug_menu.py` (fail) - `tests/test_dev_ab.py` (fail) - `tests/test_dev_build.py` (fail) - `tests/test_dev_migrate.py` (fail) - `tests/test_dev_packs.py` (fail) - `tests/test_display_startup_failure.py` (fail) - `tests/test_dlss_feature_size.py` (fail) - `tests/test_draw_binds.py` (fail) - `tests/test_draw_stream_visibility.py` (fail) - `tests/test_early_split_before_draw.py` (fail) - `tests/test_failed_compile_keeps_objects.py` (fail) - `tests/test_finish_output.py` (fail) - `tests/test_frame_overlap.py` (fail) - `tests/test_fsr3fi_hud_layer.py` (fail) - `tests/test_fsr3fi_hudless_colour.py` (fail) - `tests/test_fsr_image_retirement.py` (fail) - `tests/test_fsr_uniform_ownership.py` (fail) - `tests/test_game_menu_mouse_buttons.py` (fail) - `tests/test_guest_imported.py` (fail) - `tests/test_high_fps_fixes.py` (fail) - `tests/test_hold_gpu.py` (fail) - `tests/test_host_guest_writes.py` (fail) - `tests/test_hud_layout_row.py` (fail) - `tests/test_job_queue.py` (fail on isolated rerun) - `tests/test_libc_hooks.py` (fail) - `tests/test_lift_cache.py` (fail) - `tests/test_linux_preflight.py` (fail) - `tests/test_linux_pressure.py` (fail) - `tests/test_long_paths.py` (fail) - `tests/test_low_vram_texture_mips.py` (fail) - `tests/test_make_game_cache.py` (fail) - `tests/test_make_game_ngx.py` (fail) - `tests/test_mise_build.py` (fail) - `tests/test_missing_nup.py` (fail) - `tests/test_mods_list.py` (fail) - `tests/test_ngx_sdk.py` (fail) - `tests/test_options_path.py` (fail) - `tests/test_pads_after_menu.py` (fail) - `tests/test_pass_barrier.py` (fail) - `tests/test_pending_guest_import.py` (fail) - `tests/test_perf_report.py` (fail) - `tests/test_pipeline_cache_file.py` (fail) - `tests/test_pipeline_play_cache.py` (fail) - `tests/test_portable_builder_home.py` (fail) - `tests/test_prepare_cache_save.py` (fail) - `tests/test_present_queue_default.py` (fail) - `tests/test_present_source_crop.py` (fail) - `tests/test_profiling_mode.py` (fail) - `tests/test_psychov35_fsr3_fg.py` (fail) - `tests/test_readback_early.py` (fail) - `tests/test_readback_late.py` (fail) - `tests/test_readback_timeout_source.py` (fail) - `tests/test_recording_admission.py` (fail) - `tests/test_replay_write_order.py` (fail) - `tests/test_sampler_admission.py` (fail) - `tests/test_sdiv_overflow.py` (fail) - `tests/test_slow_frames.py` (fail) - `tests/test_song_note_cue.py` (fail) - `tests/test_split_before_draw.py` (fail) - `tests/test_staging_burst.py` (fail) - `tests/test_texel_buffer_ownership.py` (fail) - `tests/test_ub_update_batch.py` (fail) - `tests/test_upscaler_rows.py` (fail) - `tests/test_vbytes.py` (timeout) - `tests/test_vcore_escape.py` (fail) - `tests/test_vk_occlusion_queries.py` (fail) - `tests/test_walk_key.py` (fail) </details> **Still to test:** - Linux with NVIDIA and AMD RADV, including Steam Deck: try Off, compare, a color preset, a depth preset and an imported INI; verify normal play and generated frames where supported (@Beanstalk for the runtime checks, visual comparison by hand). - Windows RTX 20–50 and AMD RX 6000–9000: exercise supported HDR and frame-generation combinations, scene transitions and swaps between presets (@Beanstalk and HDR inspection by hand). - Windows installer and Linux AppImage: verify the license and provenance files are packaged and copied beside the generated game (CI or by hand). ## Measurements **Verdict:** No regression was observed with ReShade Off in this scene. The median of the run averages was 143.96 FPS on main and 149.22 FPS with Off. Warm measured 147.56 FPS (-1.1% versus Off). Setup: Windows, RTX 5080, driver 617.42. Kokiri Forest start save, identical release host executable and game files, fixed SDR settings, no FPS overlay or frame generation. Two interleaved 30-second samples per variant after 15 seconds in gameplay, using the present log. The renderer binaries are from main at `89c3d21` and the branch at `d05f599`. The final commit `e1ceac6` changes only a test. | Metric | Before: main @ 89c3d21 | After: this PR @ d05f599 | After, Warm: this PR @ d05f599 | |---|---:|---:|---:| | Average FPS | 143.96 | 149.22 | 147.56 | | 1% low (FPS) | 104.59 | 109.86 | 109.91 | | Median frame time (ms) | 6.87 | 6.68 | 6.75 | | Frame time p95 (ms) | 7.95 | 7.28 | 7.44 | | Frame time p99 (ms) | 8.94 | 8.31 | 8.46 | | GPU time (ms) | 5.25 | 5.20 | 5.27 | Individual sample summaries from the present log ```text main 1: 4201 presents, 142.48 FPS, p99 8.97 ms, GPU 5.27 ms Off 1: 4441 presents, 149.33 FPS, p99 8.42 ms, GPU 5.20 ms Warm 1: 4441 presents, 148.23 FPS, p99 8.53 ms, GPU 5.23 ms main 2: 4321 presents, 145.44 FPS, p99 8.91 ms, GPU 5.23 ms Off 2: 4441 presents, 149.12 FPS, p99 8.19 ms, GPU 5.20 ms Warm 2: 4381 presents, 146.88 FPS, p99 8.39 ms, GPU 5.30 ms ``` ## Risks Off is the default and leaves the normal rendering path active. An enabled effect can add GPU time and use render targets. The menu and log report preparation errors when an imported preset uses unsupported FX features. Native HDR accepts bundled effects and imported effects marked for linear HDR. Expanded HDR is available for imported SDR presets. Longshot stores the selected preset as `reshade_preset` in `longshot_options.ini` and the selected user INI under `reshade`. ## 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. The existing vendor copies are untouched. Two pinned upstream copies are added with their own provenance. Guide image source review flags pre-existing drift on `main` and one additional input, `gpu/vk/menu_i18n.h`, on this branch. The recorded image still needs a visual source review. ### When it applies - [x] A check under `tests/` that reads changed source is updated, not weakened. - [x] 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] 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: OpenAI Codex
Assisted-by: OpenAI Codex
test(reshade): recognize the comparison as a menu action
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
e1ceac60dc
Assisted-by: OpenAI Codex
Author
Contributor

Tested in game: Windows, RTX 5080, NVIDIA driver 617.42, Kokiri Forest start. Warm rendered before the HUD. The Italian comparison toggled the effect and browsed built-in presets and two imported INI files. Back restored the saved preset and file. Captured the same scene on main and the feature branch.

Tested in game: Windows, RTX 5080, NVIDIA driver 617.42, Kokiri Forest start. Warm rendered before the HUD. The Italian comparison toggled the effect and browsed built-in presets and two imported INI files. Back restored the saved preset and file. Captured the same scene on main and the feature branch.
Valerio85 changed title from WIP: feat(reshade): add Vulkan presets and live comparison to feat(reshade): add Vulkan presets and live comparison 2026-11-20 09:16:18 +00:00
Author
Contributor

Here some screenshots of the menu and the compare mode. Some preset are included, only those wich license allow us to freely distribuite them.
No regression in performance.
To use your own preset copy your .ini preset to reshade/presets, its .fx and .fxh files to reshade/shaders, and any required PNG textures to reshade/textures (keeping the subfolders referenced by the shader), then go to Graphics → Post-processing, select User, choose Rescan ReShade presets, and pick your .ini under User preset file.

Here some screenshots of the menu and the compare mode. Some preset are included, only those wich license allow us to freely distribuite them. No regression in performance. To use your own preset copy your .ini preset to reshade/presets, its .fx and .fxh files to reshade/shaders, and any required PNG textures to reshade/textures (keeping the subfolders referenced by the shader), then go to Graphics → Post-processing, select User, choose Rescan ReShade presets, and pick your .ini under User preset file.
HumanBean requested changes 2026-11-21 17:30:41 +00:00
Dismissed
HumanBean left a comment

Recommendation: Request changes. The design is sound and the Off path really is untouched. Four things need to change before merge. The build cost isn't measured, and every player's first build will compile the ReShade FX compiler, because it isn't in the prebuilt third-party set. Two saved menu values are fragile: appending a Clarity preset would renumber three other presets for every player, and a FROZEN key stores a list index that nothing reads back. The branch also conflicts with main.

For players this adds a Graphics → Post-processing section: 26 built-in grades (Warm, Cool, 20 Clarity looks, HDR Vibrance, two depth effects) plus their own ReShade FX presets. The effect runs inside the renderer after the gameplay upscale and before the HUD, and a compare toolbar shows it on and off in the same scene. It makes the code better as a feature. The integration is small and well placed: a few relaxed atomic loads on the hot path, everything else in gpu/vk/reshade/ and a menu module. The costs are about 25k vendored lines compiled into every renderer build, and two new parsers of player-supplied files running in the game's process.

Does it help: not a perf change. For the Off path, by reading the code: its only additions are relaxed loads of reshade::enabled in upscale_picture/finish_upscale_picture, of needs_tick in do_present, and of depth_requested in temporal_note_scene_draw. framegen_hud_before still checks frames_wanted() itself, so the stub path's dropped guard changes nothing, and its call moving after dump_ssbos/gprof_end changes nothing either. The measured "+3.6% Off vs main" (143.96 → 149.22 fps, 2 × 30 s runs each) is run variance: nothing in the diff can make Off faster. Read it as "no cost seen". Warm costs −1.1% against Off in the same runs, which is within that noise. Heavy presets (depth, multi-pass) are not measured, which is fine for an opt-in feature.
Other systems:

  • Build, time and size: the FX compiler is 7 vendored TUs (the intrinsics table at -O0) plus 6 of the PR's own, built into longshot_vk on every player's build. Neither the time nor the size is measured. See Blocking 1.
  • Frame generation: the grade lands before framegen_hud_before copies the picture, so FSR 3.1 FI's HUD mask and its inputs see the same graded frame. Earlier revisions were tested, the current head was not.
  • Native and Expanded HDR: in Native HDR, scene intermediates are RGBA16F. In SDR and Expanded HDR the picture goes B10G11R11 → RGBA8 sRGB → back, which clamps anything above 1.0 (see Questions).
  • PsychoV35 and the RenoDX route: not tested, and the gameplay picture's format and meaning may differ there (#1393 overlaps).
  • AMD, Intel and Linux: the code uses push descriptors and checks for them, plus blit/attachment format features, so a GPU without them gets "Cannot make the ReShade targets". Linux and AMD are still to test.
  • VRAM: two scene-size pings plus up to 128 MB of preset textures, only while a preset is on. The images go through create_image, so image_bytes counts them.

Switches: none (no RX_/HOS_ names). It adds one player-facing option, reshade_preset (default Off). That is right: this is taste, not something the team can measure and settle, like the CRT filter. Of the presets, Depth View is a debug visualisation and belongs in the Debug tab or nowhere (suggestion).

Reviewed: e1ceac60dc against merge-base 89c3d21ea1. Read in full: gpu/vk/reshade/* (fx_runtime, fx_compile, fx_files, fx_preset, fx_texture, fx_pipeline_cache, fx_builtin, fx_clarity), gpu/vk/menu/reshade.{cpp,h}, the changes in vk_draw.cpp, vk_menu.{cpp,h}, vk_replay.cpp and vk_temporal.{cpp,h}, nx2/reshade_fx.py, nx2/build.py, nx2/make_game.py, scripts/linux/appimage.sh, scripts/reshade/check_fx.py, the docs, and every changed test. Skimmed: menu_i18n.h (the translations, for coverage only), scripts/reshade/fx_probe.cpp and the example .fx/.ini. The vendored third_party/reshade_fx and third_party/stb_image I checked only for provenance, licence and the include/read paths of effect_preprocessor.cpp; I didn't read them in full. Nothing was run: this is a code review.
Fixed in this review: nothing (the conflicts are not trivial; see Testing).
Checked and fine:

  • Vendoring rule: standards.md's "third_party/ is not modified" holds. The two new parts are unmodified upstream copies with PROVENANCE.md and tree-sha256. The one adaptation, the include resolver and file reader, is applied at build time by nx2/reshade_fx.py, outside the folder, and it fails loudly if upstream's text moves. CI's "Third-party parts / The same as upstream" will confirm the hashes; it is blocked on approval right now.
  • Licences: ReShade FX is BSD-3 (Patrick Mours) and stb_image is MIT/public domain, both GPL-compatible. Their notices go into the AppImage and make_game's licenses/ (test_appimage_licenses.py updated). Windows ships all of third_party/ through builder_package.py. Cemu graphic packs at 496df203 is CC0 1.0 (I checked its LICENSE.md). The Clarity entries are names and numeric settings, and the shader is Longshot's own.
  • Import surface: .ini, .fx/.fxh, PNG and selected.txt are all read through read_fx_file/fx_asset. Those take fs::canonical (symlinks resolved), refuse .., root paths and drive names, and keep the file inside its folder. Macro-expanded #include goes through resolve_fx_include (the probe test covers it). Reads are capped at 2 MB (16 MB for PNG), PNG decoding is PNG-only at up to 4096², and there are limits on techniques (32), passes (64), textures (24 / 128 MB) and uniforms (16 KB, numeric only). A failure gives a message and leaves the scene untouched.
  • Lifetimes: a replaced or Off Program is retired at vk_retirement_value() and freed once the timeline passes it. PNG staging buffers are freed after their upload completes. A Program prepared for a stale revision is dropped before the GPU ever sees it.
  • Depth: the depth texture is held through the post-processing submission (last_frame/last_value). The pointer is checked against texture_destroy_generation(), and its size, aspect, sample count and usage are checked before a depth-only view is made.
  • Locks: the lock order is the ReShade mutex, then the temporal chain's mu, and nothing takes them in the other order.
  • Prepare thread and recording: prepare runs on its own thread, using VMA (thread-safe here) and extern_guarded_* for modules and pipelines. bound().reset() follows the pass, so the draw path rebinds.
  • Window size: the swapchain is not involved, since the effect works on the upscale's picture. An output size change re-prepares, and the effect is skipped until the new one is ready.
  • Menu rules: rows in gpu/vk/menu/reshade.cpp under MENU_MODULE, renderer code under #ifndef MENU_LAYOUT_ONLY with MENU_HOOK, new keys in FROZEN, the settings table, test_menu_sections and test_menu_modules updated, and every new text translated in all 14 tables.
  • Scripts: nothing in scripts/ or nx2/ downloads. check_fx.py compiles the probe into a temporary folder and runs it on generated fixtures.

Blocking (to change before merge)

  1. nx2/reshade_fx.py:18, build time and size. The FX compiler's 7 vendored TUs build in every player's renderer build, and they are not in the prebuilt third-party set: nx2/third_party_objects.py SOURCES has no third_party/reshade_fx/, the generated preprocessor lives in gen_dir, and the jobs' headers don't end with tp_deps, so is_third_party never marks them. Every player's first build, and every build after the object cache is emptied, pays for them. standards.md asks for the build time and size from a clean build for a build change. Please measure a clean renderer build and the longshot_vk size on main and here (Windows and Linux), and put the vendored TUs into the prebuilt set (add the folder to SOURCES and mark the jobs, keeping the adapted preprocessor's key stable). A lazy alternative would work too, if there is one.
  2. gpu/vk/reshade/fx_clarity.h:14 / fx_builtin.h:11, stored preset numbers. reshade_preset is saved as the choice's index. The comment says "Append new entries", but hdr_preset, depth_view_preset and depth_haze_preset are numbered after the Clarity block. The first Clarity preset someone appends will turn every player's saved HDR Vibrance into Depth View, and Depth Haze into whatever comes next. Put the non-Clarity built-ins before the Clarity block, so that appending is safe and the comment is true, or save the preset by name.
  3. gpu/vk/menu/reshade.cpp:218, reshade_user_pick should not be a saved key. It saves an index into a list sorted by file name, while the real selection lives in reshade/selected.txt. Nothing reads the saved index back in a way that means anything: user_names is empty until Rescan, so after a restart the row says "Choose a preset" while a user preset is active. Once it is in FROZEN, the key can never go. Drop the key and its FROZEN line, and fill user_names when the menu opens with User selected (or when the row is shown). The row then shows user_selection().
  4. Rebase onto main. The forge says the branch is not mergeable. main has moved the same parts of vk_draw.cpp (upscale_picture, the end of dispatch), vk_menu.cpp (menu_tick), vk_replay.cpp, vk_temporal.cpp, nx2/build.py, menu_i18n.h, docs/user/graphics-and-controls.md and five menu tests. After the rebase, measure Off against main again and re-run the game, because the hook sits in code main changed.

Suggestions (the author may take or leave)

  • fx_runtime.cpp:421: each pass makes its own samplers with vkCreateSampler, up to 16 × 64 per Program, outside sampler_room's count. The architecture rule is that samplers stay under maxSamplerAllocationCount. Share one sampler per distinct create info, or at least count them against the room.
  • fx_runtime.cpp:859: retired Programs are destroyed in tick() on the render thread, during the present. On NVIDIA's Windows driver a vmaDestroyImage costs a millisecond or more, and browsing presets in the compare view will hitch. Hand the images to destroy_image_later.
  • fx_pipeline_cache.cpp:29: the architecture rule is that pipeline caches are read and written through file mappings, never through a cache-sized buffer. This one reads up to 16 MB into a vector. Reuse the main cache's mapped reader, or say why this one differs.
  • fx_builtin.h:97: Depth View is a debug view (depth to the power of 20, in grey), not a look a player picks. Move it to the Debug tab or drop it.
  • reshade.cpp:211: the row's help explains HDR compatibility, not what the row does. Lead with "Applies a ReShade grade to the game before the HUD", then the HDR note.
  • vk_menu.h:140: the comment "0 Off, 1 Warm, 2 Cool, 3 user preset" is out of date; there are 27 choices now. Point it at fx_builtin.h.
  • vk_menu.cpp: the compare overlay takes over draw_menu/menu_tick with reshade_menu:: calls. It would sit better as a module-owned overlay hook in menu_module.h than as feature code in vk_menu.cpp, though it is small.
  • Measurements: say that the Off delta is within run variance rather than "149 vs 144". With 2 × 30 s runs, a 5 fps difference is noise.

Questions

  • SDR and Expanded HDR: is the B10G11R11 gameplay picture always ≤ 1.0 at the upscale (after the game's tone map)? If bloom or Expanded HDR's input can go above 1, the round trip through RGBA8 sRGB clamps it on every frame with a preset on, before the HUD, even for a preset that only touches some pixels.
  • Can upscale_picture match more than one dispatch in a frame (a multi-pass gameplay network, a stand-in plus the network's last pass)? For the HUD copy that was harmless. A grade applied twice compounds. The same applies to two pictures of different sizes in one frame: s.attempted would then re-prepare back and forth.
  • Shutdown: a prepare still running on its std::async thread when the device is destroyed keeps creating objects. Is that reached, and does anything join it?

Testing: the author ran the head's renderer (d05f599; e1ceac6 only changes a test) on Windows with an RTX 5080 and driver 617.42: Warm, the compare view, imported INIs, screenshots, and Off/Warm against main with 2 runs each. Earlier revisions also ran HDR, depth and frame generation. Still to run: Linux on NVIDIA and RADV, the Steam Deck, the Tier 1 AMD cards on Windows, the HDR and FG combinations on the current head, and the packaged licences. CI is blocked on approval for this fork. These hold the merge (Tier 1 AMD especially), but they come after the blocking changes and a rebase.
Overlaps and merge order: I found these by area, because the forge timed out on the file lists:

  • #1393 (PsychoV35 HDR scene and output) and #620 (DLSS over native HDR) change what the Native HDR picture is.
  • #2043 (the AI upscaler on AMD) and #1552 (the fixed shares' fallback upscale) change which dispatch is the gameplay upscale and the upscale_stub/stub_picture path this hooks.
  • #244 (ANR frame generation) changes the frame-generation inputs.
  • #978 (one retire-later holder for the upscalers) is where this PR's retired list could live.

None is a duplicate. Whichever of these merges first, the other rebases on it. Re-check the hook after #2043 or #1552.

**Recommendation: Request changes.** The design is sound and the Off path really is untouched. Four things need to change before merge. The build cost isn't measured, and every player's first build will compile the ReShade FX compiler, because it isn't in the prebuilt third-party set. Two saved menu values are fragile: appending a Clarity preset would renumber three other presets for every player, and a FROZEN key stores a list index that nothing reads back. The branch also conflicts with `main`. For players this adds a Graphics → Post-processing section: 26 built-in grades (Warm, Cool, 20 Clarity looks, HDR Vibrance, two depth effects) plus their own ReShade FX presets. The effect runs inside the renderer after the gameplay upscale and before the HUD, and a compare toolbar shows it on and off in the same scene. It makes the code better as a feature. The integration is small and well placed: a few relaxed atomic loads on the hot path, everything else in `gpu/vk/reshade/` and a menu module. The costs are about 25k vendored lines compiled into every renderer build, and two new parsers of player-supplied files running in the game's process. **Does it help:** not a perf change. For the Off path, by reading the code: its only additions are relaxed loads of `reshade::enabled` in `upscale_picture`/`finish_upscale_picture`, of `needs_tick` in `do_present`, and of `depth_requested` in `temporal_note_scene_draw`. `framegen_hud_before` still checks `frames_wanted()` itself, so the stub path's dropped guard changes nothing, and its call moving after `dump_ssbos`/`gprof_end` changes nothing either. The measured "+3.6% Off vs main" (143.96 → 149.22 fps, 2 × 30 s runs each) is run variance: nothing in the diff can make Off faster. Read it as "no cost seen". Warm costs −1.1% against Off in the same runs, which is within that noise. Heavy presets (depth, multi-pass) are not measured, which is fine for an opt-in feature. **Other systems:** - **Build, time and size:** the FX compiler is 7 vendored TUs (the intrinsics table at `-O0`) plus 6 of the PR's own, built into `longshot_vk` on every player's build. Neither the time nor the size is measured. See Blocking 1. - **Frame generation:** the grade lands before `framegen_hud_before` copies the picture, so FSR 3.1 FI's HUD mask and its inputs see the same graded frame. Earlier revisions were tested, the current head was not. - **Native and Expanded HDR:** in Native HDR, scene intermediates are RGBA16F. In SDR and Expanded HDR the picture goes B10G11R11 → RGBA8 sRGB → back, which clamps anything above 1.0 (see Questions). - **PsychoV35 and the RenoDX route:** not tested, and the gameplay picture's format and meaning may differ there ([#1393](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1393) overlaps). - **AMD, Intel and Linux:** the code uses push descriptors and checks for them, plus blit/attachment format features, so a GPU without them gets "Cannot make the ReShade targets". Linux and AMD are still to test. - **VRAM:** two scene-size pings plus up to 128 MB of preset textures, only while a preset is on. The images go through `create_image`, so `image_bytes` counts them. **Switches:** none (no `RX_`/`HOS_` names). It adds one player-facing option, `reshade_preset` (default Off). That is right: this is taste, not something the team can measure and settle, like the CRT filter. Of the presets, Depth View is a debug visualisation and belongs in the Debug tab or nowhere (suggestion). **Reviewed:** e1ceac60dcc2 against merge-base 89c3d21ea169. Read in full: `gpu/vk/reshade/*` (fx_runtime, fx_compile, fx_files, fx_preset, fx_texture, fx_pipeline_cache, fx_builtin, fx_clarity), `gpu/vk/menu/reshade.{cpp,h}`, the changes in `vk_draw.cpp`, `vk_menu.{cpp,h}`, `vk_replay.cpp` and `vk_temporal.{cpp,h}`, `nx2/reshade_fx.py`, `nx2/build.py`, `nx2/make_game.py`, `scripts/linux/appimage.sh`, `scripts/reshade/check_fx.py`, the docs, and every changed test. Skimmed: `menu_i18n.h` (the translations, for coverage only), `scripts/reshade/fx_probe.cpp` and the example .fx/.ini. The vendored `third_party/reshade_fx` and `third_party/stb_image` I checked only for provenance, licence and the include/read paths of `effect_preprocessor.cpp`; I didn't read them in full. Nothing was run: this is a code review. **Fixed in this review:** nothing (the conflicts are not trivial; see Testing). **Checked and fine:** - **Vendoring rule:** standards.md's "`third_party/` is not modified" holds. The two new parts are unmodified upstream copies with `PROVENANCE.md` and `tree-sha256`. The one adaptation, the include resolver and file reader, is applied at build time by `nx2/reshade_fx.py`, outside the folder, and it fails loudly if upstream's text moves. CI's "Third-party parts / The same as upstream" will confirm the hashes; it is blocked on approval right now. - **Licences:** ReShade FX is BSD-3 (Patrick Mours) and stb_image is MIT/public domain, both GPL-compatible. Their notices go into the AppImage and `make_game`'s `licenses/` (`test_appimage_licenses.py` updated). Windows ships all of `third_party/` through `builder_package.py`. Cemu graphic packs at `496df203` is CC0 1.0 (I checked its LICENSE.md). The Clarity entries are names and numeric settings, and the shader is Longshot's own. - **Import surface:** `.ini`, `.fx`/`.fxh`, PNG and `selected.txt` are all read through `read_fx_file`/`fx_asset`. Those take `fs::canonical` (symlinks resolved), refuse `..`, root paths and drive names, and keep the file inside its folder. Macro-expanded `#include` goes through `resolve_fx_include` (the probe test covers it). Reads are capped at 2 MB (16 MB for PNG), PNG decoding is PNG-only at up to 4096², and there are limits on techniques (32), passes (64), textures (24 / 128 MB) and uniforms (16 KB, numeric only). A failure gives a message and leaves the scene untouched. - **Lifetimes:** a replaced or Off Program is retired at `vk_retirement_value()` and freed once the timeline passes it. PNG staging buffers are freed after their upload completes. A Program prepared for a stale revision is dropped before the GPU ever sees it. - **Depth:** the depth texture is held through the post-processing submission (`last_frame`/`last_value`). The pointer is checked against `texture_destroy_generation()`, and its size, aspect, sample count and usage are checked before a depth-only view is made. - **Locks:** the lock order is the ReShade mutex, then the temporal chain's `mu`, and nothing takes them in the other order. - **Prepare thread and recording:** prepare runs on its own thread, using VMA (thread-safe here) and `extern_guarded_*` for modules and pipelines. `bound().reset()` follows the pass, so the draw path rebinds. - **Window size:** the swapchain is not involved, since the effect works on the upscale's picture. An output size change re-prepares, and the effect is skipped until the new one is ready. - **Menu rules:** rows in `gpu/vk/menu/reshade.cpp` under `MENU_MODULE`, renderer code under `#ifndef MENU_LAYOUT_ONLY` with `MENU_HOOK`, new keys in FROZEN, the settings table, `test_menu_sections` and `test_menu_modules` updated, and every new text translated in all 14 tables. - **Scripts:** nothing in `scripts/` or `nx2/` downloads. `check_fx.py` compiles the probe into a temporary folder and runs it on generated fixtures. **Blocking** (to change before merge) 1. `nx2/reshade_fx.py:18`, **build time and size.** The FX compiler's 7 vendored TUs build in every player's renderer build, and they are not in the prebuilt third-party set: `nx2/third_party_objects.py` `SOURCES` has no `third_party/reshade_fx/`, the generated preprocessor lives in `gen_dir`, and the jobs' headers don't end with `tp_deps`, so `is_third_party` never marks them. Every player's first build, and every build after the object cache is emptied, pays for them. standards.md asks for the build time and size from a clean build for a build change. Please measure a clean renderer build and the `longshot_vk` size on `main` and here (Windows and Linux), and put the vendored TUs into the prebuilt set (add the folder to `SOURCES` and mark the jobs, keeping the adapted preprocessor's key stable). A lazy alternative would work too, if there is one. 2. `gpu/vk/reshade/fx_clarity.h:14` / `fx_builtin.h:11`, **stored preset numbers.** `reshade_preset` is saved as the choice's index. The comment says "Append new entries", but `hdr_preset`, `depth_view_preset` and `depth_haze_preset` are numbered after the Clarity block. The first Clarity preset someone appends will turn every player's saved HDR Vibrance into Depth View, and Depth Haze into whatever comes next. Put the non-Clarity built-ins before the Clarity block, so that appending is safe and the comment is true, or save the preset by name. 3. `gpu/vk/menu/reshade.cpp:218`, **`reshade_user_pick` should not be a saved key.** It saves an index into a list sorted by file name, while the real selection lives in `reshade/selected.txt`. Nothing reads the saved index back in a way that means anything: `user_names` is empty until Rescan, so after a restart the row says "Choose a preset" while a user preset is active. Once it is in FROZEN, the key can never go. Drop the key and its FROZEN line, and fill `user_names` when the menu opens with User selected (or when the row is shown). The row then shows `user_selection()`. 4. **Rebase onto `main`.** The forge says the branch is not mergeable. `main` has moved the same parts of `vk_draw.cpp` (`upscale_picture`, the end of `dispatch`), `vk_menu.cpp` (`menu_tick`), `vk_replay.cpp`, `vk_temporal.cpp`, `nx2/build.py`, `menu_i18n.h`, `docs/user/graphics-and-controls.md` and five menu tests. After the rebase, measure Off against `main` again and re-run the game, because the hook sits in code `main` changed. **Suggestions** (the author may take or leave) - `fx_runtime.cpp:421`: each pass makes its own samplers with `vkCreateSampler`, up to 16 × 64 per Program, outside `sampler_room`'s count. The architecture rule is that samplers stay under `maxSamplerAllocationCount`. Share one sampler per distinct create info, or at least count them against the room. - `fx_runtime.cpp:859`: retired Programs are destroyed in `tick()` on the render thread, during the present. On NVIDIA's Windows driver a `vmaDestroyImage` costs a millisecond or more, and browsing presets in the compare view will hitch. Hand the images to `destroy_image_later`. - `fx_pipeline_cache.cpp:29`: the architecture rule is that pipeline caches are read and written through file mappings, never through a cache-sized buffer. This one reads up to 16 MB into a vector. Reuse the main cache's mapped reader, or say why this one differs. - `fx_builtin.h:97`: Depth View is a debug view (depth to the power of 20, in grey), not a look a player picks. Move it to the Debug tab or drop it. - `reshade.cpp:211`: the row's help explains HDR compatibility, not what the row does. Lead with "Applies a ReShade grade to the game before the HUD", then the HDR note. - `vk_menu.h:140`: the comment "0 Off, 1 Warm, 2 Cool, 3 user preset" is out of date; there are 27 choices now. Point it at `fx_builtin.h`. - `vk_menu.cpp`: the compare overlay takes over `draw_menu`/`menu_tick` with `reshade_menu::` calls. It would sit better as a module-owned overlay hook in `menu_module.h` than as feature code in `vk_menu.cpp`, though it is small. - Measurements: say that the Off delta is within run variance rather than "149 vs 144". With 2 × 30 s runs, a 5 fps difference is noise. **Questions** - SDR and Expanded HDR: is the B10G11R11 gameplay picture always ≤ 1.0 at the upscale (after the game's tone map)? If bloom or Expanded HDR's input can go above 1, the round trip through RGBA8 sRGB clamps it on every frame with a preset on, before the HUD, even for a preset that only touches some pixels. - Can `upscale_picture` match more than one dispatch in a frame (a multi-pass gameplay network, a stand-in plus the network's last pass)? For the HUD copy that was harmless. A grade applied twice compounds. The same applies to two pictures of different sizes in one frame: `s.attempted` would then re-prepare back and forth. - Shutdown: a `prepare` still running on its `std::async` thread when the device is destroyed keeps creating objects. Is that reached, and does anything join it? **Testing:** the author ran the head's renderer (d05f599; e1ceac6 only changes a test) on Windows with an RTX 5080 and driver 617.42: Warm, the compare view, imported INIs, screenshots, and Off/Warm against `main` with 2 runs each. Earlier revisions also ran HDR, depth and frame generation. Still to run: Linux on NVIDIA and RADV, the Steam Deck, the Tier 1 AMD cards on Windows, the HDR and FG combinations on the current head, and the packaged licences. CI is blocked on approval for this fork. These hold the merge (Tier 1 AMD especially), but they come after the blocking changes and a rebase. **Overlaps and merge order:** I found these by area, because the forge timed out on the file lists: - [#1393](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1393) (PsychoV35 HDR scene and output) and [#620](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/620) (DLSS over native HDR) change what the Native HDR picture is. - [#2043](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2043) (the AI upscaler on AMD) and [#1552](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1552) (the fixed shares' fallback upscale) change which dispatch is the gameplay upscale and the `upscale_stub`/`stub_picture` path this hooks. - [#244](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/244) (ANR frame generation) changes the frame-generation inputs. - [#978](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/978) (one retire-later holder for the upscalers) is where this PR's `retired` list could live. None is a duplicate. Whichever of these merges first, the other rebases on it. Re-check the hook after [#2043](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/2043) or [#1552](https://git.magicbean.dev/MagicBeanDev/Longshot/pulls/1552).
@ -0,0 +215,4 @@
.help = "Preview presets. Back restores your saved selection.",
.kind = menu::Kind::Action,
.on_activate = MENU_HOOK(start_comparison)})
.row({.key = "reshade_user_pick", .label = "User preset file",
Owner

Blocking: this saves an index into a sorted file list, while the real selection is reshade/selected.txt. After a restart user_names is empty until Rescan, so the row shows "Choose a preset" with a user preset active. Drop the key (and its FROZEN line), and fill the list when the row is shown.

Blocking: this saves an index into a sorted file list, while the real selection is `reshade/selected.txt`. After a restart `user_names` is empty until Rescan, so the row shows "Choose a preset" with a user preset active. Drop the key (and its FROZEN line), and fill the list when the row is shown.
@ -0,0 +94,4 @@
}
)FX";
inline constexpr const char* depth_fx = R"FX(
Owner

Suggestion: Depth View is a debug visualisation rather than a look; the Debug tab, or drop it.

Suggestion: Depth View is a debug visualisation rather than a look; the Debug tab, or drop it.
@ -0,0 +11,4 @@
// SDR adaptations of the Clarity GFX presets by Jamie, Kiri, Crementif and the preset authors.
// Background, license and the upstream revision are recorded in docs/user/reshade-presets.md.
// The order is part of reshade_preset in longshot_options.ini. Append new entries.
Owner

Blocking: reshade_preset is saved as an index, and HDR Vibrance and Depth View/Haze are numbered after this block (fx_builtin.h:11). Appending here renumbers them for every player. Put the other built-ins before the Clarity block, or save by name.

Blocking: `reshade_preset` is saved as an index, and HDR Vibrance and Depth View/Haze are numbered after this block (`fx_builtin.h:11`). Appending here renumbers them for every player. Put the other built-ins before the Clarity block, or save by name.
@ -0,0 +26,4 @@
if (!root.empty()) path_ = root / "cache" / "reshade_vulkan.bin";
std::vector<char> bytes;
if (!path_.empty()) {
std::ifstream file(path_, std::ios::binary | std::ios::ate);
Owner

Suggestion: the architecture rule is that pipeline caches are read and written through file mappings, never through a cache-sized buffer.

Suggestion: the architecture rule is that pipeline caches are read and written through file mappings, never through a cache-sized buffer.
@ -0,0 +418,4 @@
si.addressModeU = address(s.address_u);
si.addressModeV = address(s.address_v);
si.addressModeW = address(s.address_w);
VkSampler sampler{};
Owner

Suggestion: per-pass vkCreateSampler (up to 16 × 64 per Program) sits outside sampler_room's count. The rule is that samplers stay under maxSamplerAllocationCount. Share one per create info, or count them.

Suggestion: per-pass `vkCreateSampler` (up to 16 × 64 per Program) sits outside `sampler_room`'s count. The rule is that samplers stay under `maxSamplerAllocationCount`. Share one per create info, or count them.
@ -0,0 +856,4 @@
}
if (!s.retired.empty() || (s.active && s.active->uploaded_at)) {
const auto completed = vk_timeline_completed();
std::erase_if(s.retired, [completed](const auto& retired) { return retired.first && retired.first <= completed; });
Owner

Suggestion: retired Programs are destroyed here on the render thread at present. vmaDestroyImage costs a millisecond or more on NVIDIA Windows, so browsing presets will hitch. Use destroy_image_later.

Suggestion: retired Programs are destroyed here on the render thread at present. `vmaDestroyImage` costs a millisecond or more on NVIDIA Windows, so browsing presets will hitch. Use `destroy_image_later`.
@ -0,0 +876,4 @@
std::lock_guard lock(s.mutex);
if (!s.request.preset) return false;
const auto key = std::pair{s.request.revision, scene};
if (!s.work.valid() && (!s.attempted || *s.attempted != key)) {
Owner

Question: can more than one dispatch per frame reach here (a multi-pass network, two pictures of different sizes)? A grade applied twice compounds, and two sizes would make attempted re-prepare back and forth.

Question: can more than one dispatch per frame reach here (a multi-pass network, two pictures of different sizes)? A grade applied twice compounds, and two sizes would make `attempted` re-prepare back and forth.
gpu/vk/vk_menu.h Outdated
@ -137,6 +137,7 @@ struct Options {
int mic = 1; // (longshot) the ocarina's microphone: 0 Off, 1 the system's default, 2.. a device as host->mic_name lists it (host/nn_audio_in.c)
int microphone_gain = 100; // software capture gain, 0..400%; leaves the system's input volume alone
int skip_title = 0; // (longshot) start with the most recent save, pressing through the title and its file list (host/oot_autoload.c); read at the start
int reshade = 0; // 0 Off, 1 Warm, 2 Cool, 3 user preset (stored by filename)
Owner

Nit: out of date; there are 27 choices now (see fx_builtin.h).

Nit: out of date; there are 27 choices now (see `fx_builtin.h`).
@ -0,0 +15,4 @@
adapted = write_preprocessor(upstream, generated / "reshade_preprocessor.cpp")
flags = vendor_flags + include + ["-fno-char8_t"] + (["-include", "share.h"] if windows else [])
jobs = []
for name in ("codegen_spirv", "expression", "lexer", "parser_exp", "parser_stmt", "preprocessor", "symbol_table"):
Owner

Blocking: these 7 vendored TUs build in every player's renderer build and aren't in the prebuilt third-party set (third_party_objects.SOURCES has no third_party/reshade_fx/, and these jobs' headers don't end with tp_deps). Please measure a clean build's time and longshot_vk size on main and here, and add them to the prebuilt set.

Blocking: these 7 vendored TUs build in every player's renderer build and aren't in the prebuilt third-party set (`third_party_objects.SOURCES` has no `third_party/reshade_fx/`, and these jobs' headers don't end with `tp_deps`). Please measure a clean build's time and `longshot_vk` size on main and here, and add them to the prebuilt set.
HumanBean force-pushed codex/reshade-presets from e1ceac60dc
Some checks failed
Website / Website on Cloudflare (pull_request_target) Has been skipped
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to 616ebdbdb9
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 30s
PR description / Description follows the template (pull_request_target) Successful in 46s
CI / Workflow lint (actionlint) (pull_request) Successful in 1m12s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 1m11s
Third-party parts / As their notes say (pull_request) Successful in 1m36s
CI / Website build and checks (pull_request) Failing after 39s
2026-11-21 17:47:54 +00:00
Compare
HumanBean dismissed HumanBean's review 2026-11-21 17:49:22 +00:00
Reason:

Resolved at 616ebdbdb9: the rebase and the three fixes are pushed (see the next review).

HumanBean left a comment

Recommendation: Wait (on a game run of the rebased head). The four blocking points of my last review are fixed and pushed. The code is ready; what's missing is a run of this head in the game: Off and one preset, and the compare view.

Pushed to codex/reshade-presets: old head e1ceac60dcc2, new head 616ebdbdb9fd. Your ten commits are kept one by one, rebased from 89c3d21 onto main at f836ca1d, and four commits are added on top:

  1. Rebase. The conflicts were textual:
    • vk_draw.cpp: main's route_network_drawn (the FPS footer's upscale route) is kept beside finish_upscale_picture. The route is published where framegen_hud_before used to be, and the ReShade pass and the HUD copy still run after gprof_end, as in your commit.
    • Menu tests and docs: main's new Accessibility section (Colour vision correction, after("hdr")) now comes before Post-processing (before("detail")). test_menu_modules.py, test_menu_sections.py and the settings table say so.
    • menu_i18n.h: main dropped "R stick press" and reworded the controller-icons line; your new strings are kept.
  2. build(reshade): the FX compiler's six upstream objects now end their dependencies with the third-party stamp, and third_party/reshade_fx/ is in third_party_objects.py's SOURCES, so the release's prebuilt set holds them. The adapted preprocessor is generated in the work folder, so it is still compiled locally. Build cost measured (a renderer-only clean build on Linux, 24 threads, through the job queue, nothing prebuilt): 56 s wall and 280 s of compiler time. Of that, the seven upstream files take ~10 s and the PR's own fx_*.cpp plus menu/reshade.cpp ~10 s, about 7 % of the renderer. With the set, a player compiles ~12 s of it.
  3. fix(reshade): the presets have fixed numbers. HDR Vibrance is 4, Depth View 5 and Depth Haze 6, and the Clarity looks are the last block, from 7, so a look appended to clarity_presets moves no saved reshade_preset. A static_assert keeps the block last. The menu lists them in that order.
  4. fix(reshade): the User preset file row reads its list, and goes to reshade/selected.txt's file, the first time it is shown, so after a restart it no longer says "Choose a preset" until a Rescan. The reshade_user_pick key stays: it's the row's name, as output_device is the audio picker's. Its saved number is read over from selected.txt. Leaving it out of save() would mean stubbing a new global in the ~17 fixtures that compile vk_menu.cpp's save code, so I left save() alone.
  5. docs(reshade): opts.reshade's comment names every number.

Checked: the rebased renderer compiles and links with 0 failures, and dev.py vk checked its exports. No tests or game were run on my side: CI should run the checks, and the fork's workflow run is waiting for a maintainer to approve it.

Still open:

  • A game run of this head, Off and a preset, ideally with the compare view, since the hook in dispatch moved beside main's route publishing.
  • The Linux, AMD, HDR and FG runs from your Still to test.
  • My earlier suggestions (samplers in sampler_room, retiring Programs off the render thread, the cache file mapping, Depth View to Debug) are still yours to take or leave; none blocks.

🤖 Generated with Claude Code

**Recommendation: Wait (on a game run of the rebased head).** The four blocking points of my last review are fixed and pushed. The code is ready; what's missing is a run of this head in the game: Off and one preset, and the compare view. **Pushed to `codex/reshade-presets`**: old head `e1ceac60dcc2`, new head `616ebdbdb9fd`. Your ten commits are kept one by one, rebased from `89c3d21` onto `main` at `f836ca1d`, and four commits are added on top: 1. **Rebase.** The conflicts were textual: - `vk_draw.cpp`: `main`'s `route_network_drawn` (the FPS footer's upscale route) is kept beside `finish_upscale_picture`. The route is published where `framegen_hud_before` used to be, and the ReShade pass and the HUD copy still run after `gprof_end`, as in your commit. - Menu tests and docs: `main`'s new Accessibility section (Colour vision correction, `after("hdr")`) now comes before Post-processing (`before("detail")`). `test_menu_modules.py`, `test_menu_sections.py` and the settings table say so. - `menu_i18n.h`: `main` dropped "R stick press" and reworded the controller-icons line; your new strings are kept. 2. `build(reshade)`: the FX compiler's six upstream objects now end their dependencies with the third-party stamp, and `third_party/reshade_fx/` is in `third_party_objects.py`'s `SOURCES`, so the release's prebuilt set holds them. The adapted preprocessor is generated in the work folder, so it is still compiled locally. **Build cost measured** (a renderer-only clean build on Linux, 24 threads, through the job queue, nothing prebuilt): 56 s wall and 280 s of compiler time. Of that, the seven upstream files take ~10 s and the PR's own `fx_*.cpp` plus `menu/reshade.cpp` ~10 s, about 7 % of the renderer. With the set, a player compiles ~12 s of it. 3. `fix(reshade)`: the presets have fixed numbers. HDR Vibrance is 4, Depth View 5 and Depth Haze 6, and the Clarity looks are the last block, from 7, so a look appended to `clarity_presets` moves no saved `reshade_preset`. A `static_assert` keeps the block last. The menu lists them in that order. 4. `fix(reshade)`: the User preset file row reads its list, and goes to `reshade/selected.txt`'s file, the first time it is shown, so after a restart it no longer says "Choose a preset" until a Rescan. The `reshade_user_pick` key stays: it's the row's name, as `output_device` is the audio picker's. Its saved number is read over from `selected.txt`. Leaving it out of `save()` would mean stubbing a new global in the ~17 fixtures that compile `vk_menu.cpp`'s save code, so I left `save()` alone. 5. `docs(reshade)`: `opts.reshade`'s comment names every number. **Checked:** the rebased renderer compiles and links with 0 failures, and `dev.py vk` checked its exports. No tests or game were run on my side: CI should run the checks, and the fork's workflow run is waiting for a maintainer to approve it. **Still open:** - A game run of this head, Off and a preset, ideally with the compare view, since the hook in `dispatch` moved beside `main`'s route publishing. - The Linux, AMD, HDR and FG runs from your Still to test. - My earlier suggestions (samplers in `sampler_room`, retiring Programs off the render thread, the cache file mapping, Depth View to Debug) are still yours to take or leave; none blocks. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
HumanBean deleted branch codex/reshade-presets 2026-11-21 17:53:13 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 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!1861
No description provided.