[PR #5696] [MERGED] Frame Generation setting: FSR 3.1, surface errors on the normal path #6444

Closed
opened 2026-11-03 06:20:42 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/5696
Author: @spidercraft
Created: 11/1/2026
Status: ✅ Merged
Merged: 11/1/2026
Merged by: @ludovic111

Base: main ← Head: fsr-frame-generation-setting


📝 Commits (8)

  • a9c0d90 Frame Generation setting: FSR 3.1, its present thread and the hand
  • a94150a Merge main into #5696: frameGeneration beside main's texture budget and dithered mips
  • 03c7c60 Merge main into #5696: draw_overlay keeps #5887's pass timings (the real frame's only)
  • 4ea4cd5 Frame generation: its post draws pass no pass timing (main's finish_with takes one)
  • 1ed2aa4 Merge main into #5696: frameGeneration in main's serialize format beside translucentBatching
  • b847580 Merge main into #5696: Frame Generation beside main's Leaf Culling setting
  • 3073eed Merge main into #5696: frame generation beside the submit thread
  • 39737da Merge main into #5696 (entity culling modes)

📊 Changes

8 files changed (+1028 additions, -201 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+376 -188)
📝 crates/horizon-client-render/src/gfx/frame_gen.rs (+568 -7)
📝 crates/horizon-client-render/src/gfx/world_post.rs (+16 -1)
📝 crates/horizon-client-render/src/graphics.rs (+37 -1)
📝 crates/horizon-client-render/src/graphics_ui.rs (+13 -2)
📝 crates/horizon-client/src/game/debug_keys.rs (+12 -1)
📝 crates/horizon-client/src/game/options.rs (+3 -0)
📝 docs/graphics.md (+3 -1)

📄 Description

🤖 Opened by spidercraft's AI agent (Claude Code, Opus 5.5), not by spidercraft personally.

Frame Generation setting: FSR 3.1, with the present thread's surface errors handled as gfx.rs's normal path does. This replaces #3764, which was closed for that. It is stacked on #5694 (mobs' and dropped items' own motion vectors): merge that first. This branch contains it, so review this PR's own commit (a9c0d90d2). Parts 1 and 2 (#3762, #3763) are on main. Toward #2922.

What players get

In Options → Video Settings → Display: Frame Generation: Off / FSR 3.1 (frameGeneration in horizon-graphics.txt, off or fsr3.1). It is off by default, so the vanilla look doesn't change. With it on, a frame made by FSR 3.1's frame interpolation is shown between each two real ones: twice the frames on screen, for about half a real frame more latency. It runs on every GPU Horizon runs on. While it runs, the F3 screen's first line adds the frames reaching the screen: 120 fps (239 fps FSR 3.1) T: ….

How it works (gfx/frame_gen.rs, gfx.rs)

  • While it's on, the world's post pass draws into a texture of its own at the screen's size (the world without the hand and HUD), which is then copied onto the real frame. The optical flow and the interpolation run on it, with the depth, TAA's jitter, this frame's clip space to the last one (world_post::reprojection), and #5694's entity motion vectors (track_entities).
  • What draws over the world goes into draw_overlay, moved out of draw_frame from main's current code: the hand, entity outlines, post effects, screen effects, the debug crosshair and the HUD. It is drawn over the made frame as over the real one. The world icon grab stays on the real frame only. The made frame shows the hand at its halfway pose.
  • Presenting: the renderer draws into frames of its own, and a present thread copies each pair to the swapchain: the made frame first, then the real one half a real frame later. A bounded channel makes the renderer wait as it would for a swapchain image. The thread is stopped before every reconfigure, resize, present mode change or surface hand-over, so only one side ever acquires.
  • Off under a shader pack's post passes, with HDR output, on the title screen, over menus that blur the frame, and where the surface can't be copied into.

What changed since #3764

  • Surface errors (both reviews): when the present thread gets anything but a frame from get_current_texture() (outdated, lost, occluded, timeout, validation, suboptimal), it raises a flag and stops acquiring. The renderer then stops the thread and pauses frame generation, and that frame acquires the surface itself. So the existing match in draw_frame handles it: Outdated reconfigures, Lost recreates the surface, Validation retries, Occluded/Timeout skip the frame. Frame generation resumes once the normal path has a frame again. Nothing is duplicated: a single path handles surface errors.
  • A dead present thread: frames() checks the flag and JoinHandle::is_finished, and treats a closed channel the same way. The thread is dropped, the renderer falls back to the normal path, and nothing is allocated per frame (the frame(device, config) fallback is gone).
  • Doc comments moved back where they belong (camera_motion, set_world_post); rebased onto main (the overlay now includes main's post effects, HDR hand mark and world icon grab); the PR body follows CLAUDE.md's form.

Checked

  • the_made_frame_s_hand_is_halfway_on_screen; the settings round-trip and the options screen tests cover the new key and row.
  • cargo test -p horizon-client-render --lib: 827 passed. cargo test -p horizon-client --lib --bins: all passed. cargo clippy -p horizon-client-render -p horizon-client --all-targets -- -D warnings and rustfmt are clean.
  • In a real window (RTX 5090, Vulkan, Wayland/Hyprland, VSync): 119 real fps at 240 Hz with it on. Resizing the window (1868×2118 → 1200×800 → 900×600) keeps frames coming. Moved to a workspace no monitor shows, the game stops drawing, and it picks up again when shown.
  • The failure paths, with a temporary fault not in this PR: making every 300th acquire in the present thread fail logged, each time, presenter failed → renderer takes the surface → resumed, with no freeze. Making the thread panic instead gave the same: the renderer took over and frame generation resumed, at a steady 119 fps.
  • Testing in a window on current main needed clouds off: with the default settings, main crashes on joining a world (#5678), with this branch or without it.
  • tools/pr_ready.py wasn't run; CI's checks cover it.

Size: about 980 added and 175 removed for this commit. About 280 of those lines are the overlay draws moved into draw_overlay mostly as they are. frame_gen.rs (the present thread, the hand and the glue) is about 575. I can split the draw_overlay move into its own refactor PR first if you'd rather.

Label: feature, for the maintainer to add.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/5696 **Author:** [@spidercraft](https://github.com/spidercraft) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fsr-frame-generation-setting` --- ### 📝 Commits (8) - [`a9c0d90`](https://github.com/horizon-rust/horizon/commit/a9c0d90d2dcf55f7ae28c6e92d92eb773ae24838) Frame Generation setting: FSR 3.1, its present thread and the hand - [`a94150a`](https://github.com/horizon-rust/horizon/commit/a94150a97c9e43ab8144254464f658645a9c8c9f) Merge main into #5696: frameGeneration beside main's texture budget and dithered mips - [`03c7c60`](https://github.com/horizon-rust/horizon/commit/03c7c608086287a9475872bfb5f4c5d4c471bb6f) Merge main into #5696: draw_overlay keeps #5887's pass timings (the real frame's only) - [`4ea4cd5`](https://github.com/horizon-rust/horizon/commit/4ea4cd559bebbccd7a5d7b580aec5969c0cf9907) Frame generation: its post draws pass no pass timing (main's finish_with takes one) - [`1ed2aa4`](https://github.com/horizon-rust/horizon/commit/1ed2aa47d4179f79b6ce91c8bd62997d9ea4edbe) Merge main into #5696: frameGeneration in main's serialize format beside translucentBatching - [`b847580`](https://github.com/horizon-rust/horizon/commit/b84758065fb22c46584e6f1db395146f5b62b9f9) Merge main into #5696: Frame Generation beside main's Leaf Culling setting - [`3073eed`](https://github.com/horizon-rust/horizon/commit/3073eed9858a7447e1b11f3cfc18d3b0042eed22) Merge main into #5696: frame generation beside the submit thread - [`39737da`](https://github.com/horizon-rust/horizon/commit/39737da855b2083c49b0f1c9daa7b0984955015d) Merge main into #5696 (entity culling modes) ### 📊 Changes **8 files changed** (+1028 additions, -201 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+376 -188) 📝 `crates/horizon-client-render/src/gfx/frame_gen.rs` (+568 -7) 📝 `crates/horizon-client-render/src/gfx/world_post.rs` (+16 -1) 📝 `crates/horizon-client-render/src/graphics.rs` (+37 -1) 📝 `crates/horizon-client-render/src/graphics_ui.rs` (+13 -2) 📝 `crates/horizon-client/src/game/debug_keys.rs` (+12 -1) 📝 `crates/horizon-client/src/game/options.rs` (+3 -0) 📝 `docs/graphics.md` (+3 -1) </details> ### 📄 Description > 🤖 Opened by spidercraft's AI agent (Claude Code, Opus 5.5), not by spidercraft personally. **Frame Generation setting: FSR 3.1**, with the present thread's surface errors handled as `gfx.rs`'s normal path does. This replaces #3764, which was closed for that. It is stacked on #5694 (mobs' and dropped items' own motion vectors): merge that first. This branch contains it, so review this PR's own commit (`a9c0d90d2`). Parts 1 and 2 (#3762, #3763) are on main. Toward #2922. ## What players get In Options → Video Settings → Display: **Frame Generation: Off / FSR 3.1** (`frameGeneration` in `horizon-graphics.txt`, `off` or `fsr3.1`). It is off by default, so the vanilla look doesn't change. With it on, a frame made by FSR 3.1's frame interpolation is shown between each two real ones: twice the frames on screen, for about half a real frame more latency. It runs on every GPU Horizon runs on. While it runs, the F3 screen's first line adds the frames reaching the screen: `120 fps (239 fps FSR 3.1) T: …`. ## How it works (`gfx/frame_gen.rs`, `gfx.rs`) - While it's on, the world's post pass draws into a texture of its own at the screen's size (the world without the hand and HUD), which is then copied onto the real frame. The optical flow and the interpolation run on it, with the depth, TAA's jitter, this frame's clip space to the last one (`world_post::reprojection`), and #5694's entity motion vectors (`track_entities`). - What draws over the world goes into `draw_overlay`, moved out of `draw_frame` from main's current code: the hand, entity outlines, post effects, screen effects, the debug crosshair and the HUD. It is drawn over the made frame as over the real one. The world icon grab stays on the real frame only. The made frame shows the hand at its **halfway pose**. - **Presenting:** the renderer draws into frames of its own, and a present thread copies each pair to the swapchain: the made frame first, then the real one half a real frame later. A bounded channel makes the renderer wait as it would for a swapchain image. The thread is stopped before every reconfigure, resize, present mode change or surface hand-over, so only one side ever acquires. - Off under a shader pack's post passes, with HDR output, on the title screen, over menus that blur the frame, and where the surface can't be copied into. ## What changed since #3764 - **Surface errors** (both reviews): when the present thread gets anything but a frame from `get_current_texture()` (outdated, lost, occluded, timeout, validation, suboptimal), it raises a flag and stops acquiring. The renderer then stops the thread and pauses frame generation, and that frame acquires the surface itself. So the existing match in `draw_frame` handles it: Outdated reconfigures, Lost recreates the surface, Validation retries, Occluded/Timeout skip the frame. Frame generation resumes once the normal path has a frame again. Nothing is duplicated: a single path handles surface errors. - **A dead present thread:** `frames()` checks the flag and `JoinHandle::is_finished`, and treats a closed channel the same way. The thread is dropped, the renderer falls back to the normal path, and nothing is allocated per frame (the `frame(device, config)` fallback is gone). - Doc comments moved back where they belong (`camera_motion`, `set_world_post`); rebased onto main (the overlay now includes main's post effects, HDR hand mark and world icon grab); the PR body follows CLAUDE.md's form. ## Checked - `the_made_frame_s_hand_is_halfway_on_screen`; the settings round-trip and the options screen tests cover the new key and row. - `cargo test -p horizon-client-render --lib`: 827 passed. `cargo test -p horizon-client --lib --bins`: all passed. `cargo clippy -p horizon-client-render -p horizon-client --all-targets -- -D warnings` and rustfmt are clean. - **In a real window** (RTX 5090, Vulkan, Wayland/Hyprland, VSync): 119 real fps at 240 Hz with it on. Resizing the window (1868×2118 → 1200×800 → 900×600) keeps frames coming. Moved to a workspace no monitor shows, the game stops drawing, and it picks up again when shown. - **The failure paths, with a temporary fault not in this PR:** making every 300th acquire in the present thread fail logged, each time, *presenter failed → renderer takes the surface → resumed*, with no freeze. Making the thread panic instead gave the same: the renderer took over and frame generation resumed, at a steady 119 fps. - Testing in a window on current main needed clouds off: with the default settings, main crashes on joining a world (#5678), with this branch or without it. - `tools/pr_ready.py` wasn't run; CI's checks cover it. **Size:** about 980 added and 175 removed for this commit. About 280 of those lines are the overlay draws moved into `draw_overlay` mostly as they are. `frame_gen.rs` (the present thread, the hand and the glue) is about 575. I can split the `draw_overlay` move into its own refactor PR first if you'd rather. Label: `feature`, for the maintainer to add. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:20:42 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
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
horizon-rust/horizon#6444
No description provided.