[PR #1238] [MERGED] perf(client): retain seeded lightning bolt geometry #3444

Closed
opened 2026-11-03 04:09:34 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

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

Base: main ← Head: t3/cache-lightning-bolt-geometry


📝 Commits (1)

  • fa14833 perf(client): retain seeded lightning bolt geometry

📊 Changes

6 files changed (+790 additions, -86 deletions)

View changed files

📝 crates/horizon-client/src/entity.wgsl (+7 -0)
📝 crates/horizon-client/src/game.rs (+18 -8)
📝 crates/horizon-client/src/game/lightning.rs (+11 -74)
📝 crates/horizon-client/src/gfx.rs (+48 -4)
➕ crates/horizon-client/src/gfx/lightning.rs (+211 -0)
➕ crates/horizon-client/src/gfx/lightning/tests/mod.rs (+495 -0)

📄 Description

What and why

Lightning rebuilt all four seeded layers (896 vertices per bolt) and uploaded camera-relative geometry every frame. Retain a bolt-local GPU vertex buffer for each active seed and translate it in the entity shader using a small per-bolt camera-relative offset. Seed changes on flashes and white-texel UV changes rebuild the mesh; removal, dimension changes, title/loading frames and disconnects retire unused meshes. Duplicate seeds share geometry, and draws follow the original bolt order ahead of dragon rays.

The cache and offset-buffer capacities shrink after activity drops. Bolt simulation continues to supply positions and seeds through the existing lifecycle. This change is scoped to lightning rendering.

Tradeoff: retained geometry uses one draw per bolt instead of combining every bolt into the transient additive draw. No FPS or frame-time improvement is claimed.

Vanilla reference

Pinned 26.3 LightningBoltRenderer.submit, lambda$submit$0 and quad (inspected using REA/javap). A temporary Java oracle invoked vanilla's geometry callback with an identity PoseStack and a recording VertexConsumer. Its digest of 234,752 ordered vertex positions across 262 seeds is pinned by a regression test.

Additional tests compare every Vertex byte with the previous generator for 262 seeds at three camera/position pairs, including world-border coordinates; exercise seed changes, repeated frames, position updates, shared seeds, expiry/reset and atlas UV invalidation; and verify bounded storage over 10,000 seed changes. An offscreen GPU differential compares the retained and transient paths byte-for-byte across four frames with camera motion, overlapping/shared-seed bolts, a new seed, removal and atlas invalidation (NVIDIA GeForce RTX 4060).

Self-check

pr_ready (tools/pr_ready.py --quick on archlinux, against origin/main at 34c3c1cff, 2 min 57 s)

Check Result
Scope ✅ 6 files, +790 −86
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ➖ no Python change
rustfmt ✅ (8 s)
clippy ✅ (17 s)
tests: horizon-client ✅ 1112 passed (2 min 27 s)
doc tests ✅ 0 passed (2 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 279 affected, to run in CI (--quick): ambient_sound, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo, basic_feature, biome_chunk, biome_generation and 267 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Additional validation: all-target Clippy with --no-default-features -- -D warnings; four automatic lightning tests and the explicitly invoked GPU differential with --no-default-features. The renderer tests also validate WGSL and translation to DirectX 12 HLSL.

Validation limits

One parallel all-tests run exited with a native SIGSEGV after the GPU comparison had passed. The new hardware comparison is marked for explicit, isolated execution; its isolated rerun passed.

The GPU comparison uses a white atlas and an offscreen scene. Interactive gameplay screenshots and Metal/DirectX runtime rendering were not exercised. The broad vanilla parity suite is listed by pr_ready --quick; the lightning oracle and differential checks above were run locally.


🔄 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/1238 **Author:** [@rdbtCVS](https://github.com/rdbtCVS) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `t3/cache-lightning-bolt-geometry` --- ### 📝 Commits (1) - [`fa14833`](https://github.com/horizon-rust/horizon/commit/fa14833b41782f59ef6087cce092081e813620e5) perf(client): retain seeded lightning bolt geometry ### 📊 Changes **6 files changed** (+790 additions, -86 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/entity.wgsl` (+7 -0) 📝 `crates/horizon-client/src/game.rs` (+18 -8) 📝 `crates/horizon-client/src/game/lightning.rs` (+11 -74) 📝 `crates/horizon-client/src/gfx.rs` (+48 -4) ➕ `crates/horizon-client/src/gfx/lightning.rs` (+211 -0) ➕ `crates/horizon-client/src/gfx/lightning/tests/mod.rs` (+495 -0) </details> ### 📄 Description ## What and why Lightning rebuilt all four seeded layers (896 vertices per bolt) and uploaded camera-relative geometry every frame. Retain a bolt-local GPU vertex buffer for each active seed and translate it in the entity shader using a small per-bolt camera-relative offset. Seed changes on flashes and white-texel UV changes rebuild the mesh; removal, dimension changes, title/loading frames and disconnects retire unused meshes. Duplicate seeds share geometry, and draws follow the original bolt order ahead of dragon rays. The cache and offset-buffer capacities shrink after activity drops. Bolt simulation continues to supply positions and seeds through the existing lifecycle. This change is scoped to lightning rendering. Tradeoff: retained geometry uses one draw per bolt instead of combining every bolt into the transient additive draw. No FPS or frame-time improvement is claimed. ## Vanilla reference Pinned 26.3 `LightningBoltRenderer.submit`, `lambda$submit$0` and `quad` (inspected using REA/javap). A temporary Java oracle invoked vanilla's geometry callback with an identity PoseStack and a recording VertexConsumer. Its digest of 234,752 ordered vertex positions across 262 seeds is pinned by a regression test. Additional tests compare every Vertex byte with the previous generator for 262 seeds at three camera/position pairs, including world-border coordinates; exercise seed changes, repeated frames, position updates, shared seeds, expiry/reset and atlas UV invalidation; and verify bounded storage over 10,000 seed changes. An offscreen GPU differential compares the retained and transient paths byte-for-byte across four frames with camera motion, overlapping/shared-seed bolts, a new seed, removal and atlas invalidation (NVIDIA GeForce RTX 4060). ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on archlinux, against origin/main at 34c3c1cff, 2 min 57 s) | Check | Result | | --- | --- | | Scope | ✅ 6 files, +790 −86 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ➖ no Python change | | rustfmt | ✅ (8 s) | | clippy | ✅ (17 s) | | tests: horizon-client | ✅ 1112 passed (2 min 27 s) | | doc tests | ✅ 0 passed (2 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 279 affected, to run in CI (--quick): ambient_sound, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo, basic_feature, biome_chunk, biome_generation and 267 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Additional validation: all-target Clippy with `--no-default-features -- -D warnings`; four automatic lightning tests and the explicitly invoked GPU differential with `--no-default-features`. The renderer tests also validate WGSL and translation to DirectX 12 HLSL. ## Validation limits One parallel all-tests run exited with a native SIGSEGV after the GPU comparison had passed. The new hardware comparison is marked for explicit, isolated execution; its isolated rerun passed. The GPU comparison uses a white atlas and an offscreen scene. Interactive gameplay screenshots and Metal/DirectX runtime rendering were not exercised. The broad vanilla parity suite is listed by `pr_ready --quick`; the lightning oracle and differential checks above were run locally. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:09:34 +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#3444
No description provided.