[PR #980] [MERGED] Launcher: switch to DirectX 12 after a Vulkan crash at the renderer's start #2960

Closed
opened 2026-11-02 16:00:25 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/980
Author: @ludovic111
Created: 10/19/2026
Status: ✅ Merged
Merged: 10/19/2026
Merged by: @ludovic111

Base: main ← Head: feat/launcher-dx12-after-renderer-crash


📝 Commits (1)

  • c2665ee Launcher: switch the game to DirectX 12 after a Vulkan crash at its start (#746)

📊 Changes

3 files changed (+141 additions, -3 deletions)

View changed files

📝 launcher/src/backend.rs (+106 -0)
📝 launcher/src/main.rs (+34 -1)
📝 launcher/src/perf.rs (+1 -2)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

What

When the game crashes with no crash report after logging its Vulkan adapter (Horizon renderer: <GPU> (Vulkan, <type>)) and before its first frame, the launcher switches it to DirectX 12. This only happens on Windows. The crash notice is replaced by:

Horizon's Vulkan renderer crashed while starting on this graphics card, so the game now uses DirectX 12. Press Play to start it again. Video Settings > Graphics API switches back.

The switch sets graphicsApi:dx12 in horizon-graphics.txt, keeping every other line. It does that in the game home and, for a modpack run, in the pack's home too, since the GPU is the same for both. It only changes auto or an unset value: a player who picked Vulkan or DirectX 12 keeps their choice. Since the setting is then dx12, a second crash on DirectX 12 shows the normal crash notice, so there is no loop. Every other crash shows the normal notice, as before.

Why

#746: a native access violation inside a graphics driver can't be caught in the game, and it leaves no report, only the log's last lines. #976 fixes the crash we know about (Intel's Gen9 Vulkan driver). This catches the next one, whatever the cause, and gets the player in through DirectX 12 (#979) instead of a crash loop. The launcher doesn't relaunch on its own: a modpack run or a friend's join code would have to be rebuilt for that. Pressing Play again starts the same run.

Notes

  • Needs a game with the graphicsApi setting (#979). An older game ignores the line, crashes again on Vulkan, and gets the normal notice. Nothing worse.
  • GAME_FIRST_FRAME moved from the binary's perf.rs into backend.rs, which the library shares; perf re-exports it.

How tested

  • cargo fmt --check, cargo clippy --all-targets --features gpui/runtime_shaders -- -D warnings and cargo test --features gpui/runtime_shaders in launcher/: clean. The new tests:
    • a_crash_after_the_vulkan_adapter_line_and_before_the_first_frame_is_a_start_crash: the HD 530 log from #746, a step line after the adapter line, a crash after the first frame, an adapter already on Dx12, a Vulkan → DirectX 12 fallback within one run, and no renderer line at all.
    • a_renderer_start_crash_switches_auto_to_dx12_once: no file, auto, the player's own vulkan, an existing dx12, other lines kept.
  • The Windows path (cfg!(windows)) can't run here. It's the same code the tests cover, behind that check.

Part of #746.

🤖 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/980 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/19/2026 **Status:** ✅ Merged **Merged:** 10/19/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/launcher-dx12-after-renderer-crash` --- ### 📝 Commits (1) - [`c2665ee`](https://github.com/horizon-rust/horizon/commit/c2665ee7bd58cc7641d0ca0e4aa012dc9dc61a93) Launcher: switch the game to DirectX 12 after a Vulkan crash at its start (#746) ### 📊 Changes **3 files changed** (+141 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `launcher/src/backend.rs` (+106 -0) 📝 `launcher/src/main.rs` (+34 -1) 📝 `launcher/src/perf.rs` (+1 -2) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What When the game crashes with **no crash report** after logging its Vulkan adapter (`Horizon renderer: <GPU> (Vulkan, <type>)`) and **before its first frame**, the launcher switches it to DirectX 12. This only happens on Windows. The crash notice is replaced by: > Horizon's Vulkan renderer crashed while starting on this graphics card, so the game now uses DirectX 12. Press Play to start it again. Video Settings > Graphics API switches back. The switch sets `graphicsApi:dx12` in `horizon-graphics.txt`, keeping every other line. It does that in the game home and, for a modpack run, in the pack's home too, since the GPU is the same for both. It only changes `auto` or an unset value: a player who picked Vulkan or DirectX 12 keeps their choice. Since the setting is then `dx12`, a second crash on DirectX 12 shows the normal crash notice, so there is no loop. Every other crash shows the normal notice, as before. ## Why #746: a native access violation inside a graphics driver can't be caught in the game, and it leaves no report, only the log's last lines. #976 fixes the crash we know about (Intel's Gen9 Vulkan driver). This catches the next one, whatever the cause, and gets the player in through DirectX 12 (#979) instead of a crash loop. The launcher doesn't relaunch on its own: a modpack run or a friend's join code would have to be rebuilt for that. Pressing Play again starts the same run. ## Notes - Needs a game with the `graphicsApi` setting (#979). An older game ignores the line, crashes again on Vulkan, and gets the normal notice. Nothing worse. - `GAME_FIRST_FRAME` moved from the binary's `perf.rs` into `backend.rs`, which the library shares; `perf` re-exports it. ## How tested - `cargo fmt --check`, `cargo clippy --all-targets --features gpui/runtime_shaders -- -D warnings` and `cargo test --features gpui/runtime_shaders` in `launcher/`: clean. The new tests: - `a_crash_after_the_vulkan_adapter_line_and_before_the_first_frame_is_a_start_crash`: the HD 530 log from #746, a step line after the adapter line, a crash after the first frame, an adapter already on Dx12, a Vulkan → DirectX 12 fallback within one run, and no renderer line at all. - `a_renderer_start_crash_switches_auto_to_dx12_once`: no file, `auto`, the player's own `vulkan`, an existing `dx12`, other lines kept. - The Windows path (`cfg!(windows)`) can't run here. It's the same code the tests cover, behind that check. Part of #746. 🤖 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-02 16:00:25 +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#2960
No description provided.