[PR #6338] [MERGED] Render tests: no OpenGL instance on Windows, where WGL hung them #6807

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

📋 Pull Request Information

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

Base: main ← Head: fix/render-tests-gpu-hang


📝 Commits (1)

  • 2ca08a9 Render tests: no OpenGL instance on Windows

📊 Changes

19 files changed (+35 additions, -20 deletions)

View changed files

📝 crates/horizon-client-render/src/gfx.rs (+2 -0)
📝 crates/horizon-client-render/src/gfx/animate.rs (+1 -1)
📝 crates/horizon-client-render/src/gfx/arena.rs (+2 -2)
📝 crates/horizon-client-render/src/gfx/crumbling_tests.rs (+1 -1)
📝 crates/horizon-client-render/src/gfx/end_sky/tests.rs (+1 -1)
📝 crates/horizon-client-render/src/gfx/flat.rs (+1 -1)
📝 crates/horizon-client-render/src/gfx/frame_gen/optical_flow.rs (+1 -1)
📝 crates/horizon-client-render/src/gfx/lightning/tests/mod.rs (+2 -2)
📝 crates/horizon-client-render/src/gfx/native_post.rs (+1 -1)
📝 crates/horizon-client-render/src/gfx/native_sky.rs (+1 -1)
📝 crates/horizon-client-render/src/gfx/pack_atlas.rs (+1 -1)
📝 crates/horizon-client-render/src/gfx/pack_post.rs (+1 -1)
📝 crates/horizon-client-render/src/gfx/readback.rs (+1 -1)
📝 crates/horizon-client-render/src/gfx/submit.rs (+1 -1)
➕ crates/horizon-client-render/src/gfx/test_gpu.rs (+14 -0)
📝 crates/horizon-client-render/src/gfx/upload.rs (+1 -1)
📝 crates/horizon-client-render/src/gfx/weather.rs (+1 -1)
📝 crates/horizon-client-render/src/gfx/world_post.rs (+1 -2)
📝 crates/horizon-client-render/src/post_chain.rs (+1 -1)

📄 Description

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

What and why

On Windows with an NVIDIA GPU, cargo test -p horizon-client-render --lib hangs in most runs (#5238). Each GPU test made its own wgpu::Instance with the default backends, so up to one thread per core opened Vulkan, DirectX 12 and OpenGL (WGL) at once; the stacks in #5238 point into WGL's init inside nvoglv64.dll. The tests now take their instance from a new gfx::test_gpu::instance(), which on Windows opens Vulkan and DirectX 12 only, the backends the game prefers there (open_device tries Vulkan, DX12, then GL). WGPU_BACKEND and the other WGPU_* variables still apply. Linux and macOS are unchanged: with no WGPU_* set, with_env() keeps the same backends and flags.

Measured on Windows 11, RTX 4070 (driver 616.64), cargo test -q -p horizon-client-render --lib, 10 runs each, 120 s timeout:

Variant Passed Hung Failed
main 2 8 0
one shared instance, OpenGL kept 0 7 3 (gles/adapter.rs:200 "Could not lock adapter context", access violations)
one shared instance, no OpenGL on Windows 10 0 0
this PR: an instance per test, no OpenGL on Windows 10 0 0

So OpenGL is the trigger and sharing doesn't help; it hurts with GL kept, so the instances stay per test (Linux keeps GL). Every run: 907 passed; 0 failed; 32 ignored, on the RTX 4070 through Vulkan, with no no GPU adapter: skipped. No changed test checks the GL backend. On a Windows machine with neither Vulkan nor DX12 hardware, the tests now run on DX12's WARP software adapter instead of a GL one.

tests/sunrise_shader.rs is left as is: its binary has one test, so nothing runs beside it.

Fixes #5238

Kind

  • parity: Horizon now does what vanilla 26.3 does
  • bug: a crash or a breakage
  • perf: faster, or less memory
  • feature: something new for players (listed under New in the release notes)
  • extra: Horizon-only, off by default
  • tooling: tools, CI, tests, harnesses
  • docs

Vanilla reference

none (test setup)

Other projects' code

none

Self-check

The Python failure below is test_world_input_capture on Windows, unrelated: #6214, fixed by #6234.

pr_ready (tools/pr_ready.py --base upstream/main on Evrim-PC, against upstream/main at 1bd24e404, 5 min 52 s)

Check Result
Scope ✅ 19 files, +35 −20
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ❌ 586 run, FAILED (errors=1, skipped=2) (2 min 5 s)
rustfmt ✅ (14 s)
clippy ✅ (2 min 20 s)
tests: horizon-client-render ✅ 914 passed (1 min 9 s)
doc tests ✅ 0 passed (1 s)
content root tests ➖ content root untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ not run (no vanilla data here): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 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/6338 **Author:** [@Ragbie](https://github.com/Ragbie) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/render-tests-gpu-hang` --- ### 📝 Commits (1) - [`2ca08a9`](https://github.com/horizon-rust/horizon/commit/2ca08a955f675eaa9d1495dfedae5832c4d735da) Render tests: no OpenGL instance on Windows ### 📊 Changes **19 files changed** (+35 additions, -20 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/gfx.rs` (+2 -0) 📝 `crates/horizon-client-render/src/gfx/animate.rs` (+1 -1) 📝 `crates/horizon-client-render/src/gfx/arena.rs` (+2 -2) 📝 `crates/horizon-client-render/src/gfx/crumbling_tests.rs` (+1 -1) 📝 `crates/horizon-client-render/src/gfx/end_sky/tests.rs` (+1 -1) 📝 `crates/horizon-client-render/src/gfx/flat.rs` (+1 -1) 📝 `crates/horizon-client-render/src/gfx/frame_gen/optical_flow.rs` (+1 -1) 📝 `crates/horizon-client-render/src/gfx/lightning/tests/mod.rs` (+2 -2) 📝 `crates/horizon-client-render/src/gfx/native_post.rs` (+1 -1) 📝 `crates/horizon-client-render/src/gfx/native_sky.rs` (+1 -1) 📝 `crates/horizon-client-render/src/gfx/pack_atlas.rs` (+1 -1) 📝 `crates/horizon-client-render/src/gfx/pack_post.rs` (+1 -1) 📝 `crates/horizon-client-render/src/gfx/readback.rs` (+1 -1) 📝 `crates/horizon-client-render/src/gfx/submit.rs` (+1 -1) ➕ `crates/horizon-client-render/src/gfx/test_gpu.rs` (+14 -0) 📝 `crates/horizon-client-render/src/gfx/upload.rs` (+1 -1) 📝 `crates/horizon-client-render/src/gfx/weather.rs` (+1 -1) 📝 `crates/horizon-client-render/src/gfx/world_post.rs` (+1 -2) 📝 `crates/horizon-client-render/src/post_chain.rs` (+1 -1) </details> ### 📄 Description > 🤖 Opened by Ragbie's AI agent (Claude Code, Opus 5.5), not by Ragbie personally. ## What and why On Windows with an NVIDIA GPU, `cargo test -p horizon-client-render --lib` hangs in most runs (#5238). Each GPU test made its own `wgpu::Instance` with the default backends, so up to one thread per core opened Vulkan, DirectX 12 and **OpenGL (WGL)** at once; the stacks in #5238 point into WGL's init inside `nvoglv64.dll`. The tests now take their instance from a new `gfx::test_gpu::instance()`, which on Windows opens Vulkan and DirectX 12 only, the backends the game prefers there (`open_device` tries Vulkan, DX12, then GL). `WGPU_BACKEND` and the other `WGPU_*` variables still apply. Linux and macOS are unchanged: with no `WGPU_*` set, `with_env()` keeps the same backends and flags. Measured on Windows 11, RTX 4070 (driver 616.64), `cargo test -q -p horizon-client-render --lib`, 10 runs each, 120 s timeout: | Variant | Passed | Hung | Failed | | --- | --- | --- | --- | | main | 2 | 8 | 0 | | one shared instance, OpenGL kept | 0 | 7 | 3 (`gles/adapter.rs:200` "Could not lock adapter context", access violations) | | one shared instance, no OpenGL on Windows | 10 | 0 | 0 | | **this PR**: an instance per test, no OpenGL on Windows | 10 | 0 | 0 | So OpenGL is the trigger and sharing doesn't help; it hurts with GL kept, so the instances stay per test (Linux keeps GL). Every run: `907 passed; 0 failed; 32 ignored`, on the RTX 4070 through Vulkan, with no `no GPU adapter: skipped`. No changed test checks the GL backend. On a Windows machine with neither Vulkan nor DX12 hardware, the tests now run on DX12's WARP software adapter instead of a GL one. `tests/sunrise_shader.rs` is left as is: its binary has one test, so nothing runs beside it. Fixes #5238 ## Kind - [ ] parity: Horizon now does what vanilla 26.3 does - [ ] bug: a crash or a breakage - [ ] perf: faster, or less memory - [ ] feature: something new for players (listed under New in the release notes) - [ ] extra: Horizon-only, off by default - [x] tooling: tools, CI, tests, harnesses - [ ] docs ## Vanilla reference none (test setup) ## Other projects' code none ## Self-check The Python failure below is `test_world_input_capture` on Windows, unrelated: #6214, fixed by #6234. **pr_ready** (`tools/pr_ready.py --base upstream/main` on Evrim-PC, against upstream/main at 1bd24e404, 5 min 52 s) | Check | Result | | --- | --- | | Scope | ✅ 19 files, +35 −20 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ❌ 586 run, FAILED (errors=1, skipped=2) (2 min 5 s) | | rustfmt | ✅ (14 s) | | clippy | ✅ (2 min 20 s) | | tests: horizon-client-render | ✅ 914 passed (1 min 9 s) | | doc tests | ✅ 0 passed (1 s) | | content root tests | ➖ content root untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ not run (no vanilla data here): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 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:27:19 +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#6807
No description provided.