[GH-ISSUE #3529] Render is broken #1006

Closed
opened 2026-11-02 15:43:34 +07:00 by bsakaguchi · 3 comments
Owner

Originally created by @kira-horizon[bot] on GitHub (Oct 29, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/3529

Version: 0.2.92 · OS: Gentoo Linux x86_64 (2.18) (copied from the report)

What I did: nothing, it is from the start
What happened: my rendering is not working properly
What I expected: gameplay without artifacts
Horizon version: 0.2.92 (no launcher, from github directly)
Also on the Nightly? didn't try
OS: Gentoo Linux x86_64 (2.18)
CPU: Intel(R) Core(TM) i3-1005G1 (4) @ 3.40 GHz
GPU: Intel Iris Plus Graphics G1 (Ice Lake) @ 0.90 GHz [Integrated]

Reported on Discord by Se1d228 in #horizon-bugs · Discord thread
Tags: rendering

Attachments (Discord links expire after a while; the thread keeps them)

Opened by Kira from Discord. Replies from the reporter in the thread are added here as comments.

Originally created by @kira-horizon[bot] on GitHub (Oct 29, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/3529 **Version:** 0.2.92 · **OS:** Gentoo Linux x86_64 (2.18) <sub>(copied from the report)</sub> > What I did: nothing, it is from the start > What happened: my rendering is not working properly > What I expected: gameplay without artifacts > Horizon version: 0.2.92 (no launcher, from github directly) > Also on the Nightly? didn't try > OS: Gentoo Linux x86_64 (2.18) > CPU: Intel(R) Core(TM) i3-1005G1 (4) @ 3.40 GHz > GPU: Intel Iris Plus Graphics G1 (Ice Lake) @ 0.90 GHz [Integrated] Reported on Discord by **Se1d228** in #horizon-bugs · [Discord thread](https://discord.com/channels/1559227979002028052/1565240797362655273) Tags: rendering **Attachments** (Discord links expire after a while; the thread keeps them) - [2026-10-29_10-40-13.mp4](https://cdn.discordapp.com/attachments/1565240797362655273/1565240798641922170/2026-10-29_10-40-13.mp4?ex=6ae42f97&is=6ae2de17&hm=07303cd837e04ef68e3ada1bfe8a56ae3b0d7f67acc2b8c40421930cd7c6a8b7&) <sub>Opened by Kira from Discord. Replies from the reporter in the thread are added here as comments.</sub><!-- kira -->
bsakaguchi 2026-11-02 15:43:34 +07:00
Author
Owner

@kira-horizon[bot] commented on GitHub (Oct 29, 2026):

Se1d228 added on Discord:

I searched, didnt find anything like that

<!-- gh-comment-id:6489135715 --> @kira-horizon[bot] commented on GitHub (Oct 29, 2026): **Se1d228** added on Discord: > I searched, didnt find anything like that <!-- kira -->
Author
Owner

@E-Viktor2003 commented on GitHub (Oct 29, 2026):

Same hardware here (i3-1005G1, Intel UHD/Iris Plus G1, Ice Lake GT1), and I narrowed it down to the section indirect multi-draw path — not culling, not geometry, not frame pacing.

Environment (differs from the report only in distro and driver version):

  • Arch Linux, Wayland (KWin), Mesa 26.2.2-1, intel_icd (ANV)
  • Horizon 0.2.97 — same artifacts as 0.2.92 above
  • Renderer log: Intel(R) UHD Graphics (ICL GT1) (Vulkan, IntegratedGpu), driver Intel open-source Mesa driver Mesa 26.2.2-arch1.1, features include INDIRECT_FIRST_INSTANCE | SHADER_EARLY_DEPTH_TEST
  • Config: graphicsApi:auto, presentMode:mailbox, renderDistance:8, lodDistance:0, caveCulling:false, batteryMode:true, no shader pack

What it looks like: sections are not missing, they are drawn at the wrong origin — terrain slabs floating in mid-air at unrelated heights, water sheets detached from the ground, holes where the displaced sections should be, while nearby structures stay intact. That reads as correct vertices with a wrong origin, not as broken meshes or a broken cull.

A/B results (same world and spot, camera rotating 360°; settings switched live):

Variant Artifacts
Section draws: indirect multi-draw (default) broken
— occlusion culling off (section-cull off, and HORIZON_GPU_CULL=0) broken
— section sides off (section-sides off) broken
— WGPU_VALIDATION_INDIRECT_CALL=1 (re-enables the indirect validation that release builds strip) broken
Section draws: flat (HORIZON_FLAT_DRAWS=1) clean, repeated twice

HORIZON_FLAT_DRAWS=1 is an existing A/B knob (normally Metal-only). It draws the frame's sections as one index list with origins read from a storage buffer (slot_origins[block_slots[vertex >> 8u]]) instead of an instance vertex attribute indexed by first_instance. So the only things that change between clean and broken are where a section's origin comes from and whether ~500–1100 draws go out as one multi_draw_indexed_indirect batch.

Not the culling: occlusion culling's phase 2 also issues indirect draws, but one per call with first_instance = 0, and it runs in the clean flat configuration too — draw_indexed_indirect itself is fine on this driver.

Not invalid indirect arguments: WGPU_VALIDATION_INDIRECT_CALL=1 still shows the artifacts. On Vulkan that pass only validates and clamps entries, so it does not exercise first_instance, but out-of-range arguments are ruled out.

Not a timing/frame-rate effect: with maxFps capped to 10, corruption is still present in roughly a quarter of sampled frames.

Same code path, different Vulkan driver, clean: forcing lavapipe (VK_ICD_FILENAMES=.../lvp_icd.json, llvmpipe (LLVM 22.1.8, 256 bits), device_type: cpu, 11 fps) with multi-draw on, section_draw_calls: 3 and the same world gives a clean picture across all sampled frames. That is the same renderer, same draw list construction and same batch, only the driver differs — so it points at ANV on Gen11 rather than at Horizon's logic.

Cost of the workaround: none measurable. Switching between the two paths live on the same scene: 35.7 vs 35.8 fps, GPU p50 8.1 ms in both. A HORIZON_FLAT_DRAWS=1 session runs at 60 fps in mailbox at render distance 8.

Also: the OpenGL backend cannot be compared on this machine — wgpu reports gl not compatible with provided surface on both Wayland and X11, so Vulkan is the only backend available.

Next thing I can try, if useful: a build where the section batch is replaced by one draw_indexed per section with an explicit first_instance, everything else unchanged. If that is clean, the trigger is the single large indirect batch (one vkCmdDrawIndexedIndirect with ~1k entries, per-entry firstInstance); if it is still broken, the trigger is the first_instance-based instance vertex fetch itself, independent of batching. I am happy to run such a build and report back.

<!-- gh-comment-id:6498405246 --> @E-Viktor2003 commented on GitHub (Oct 29, 2026): Same hardware here (i3-1005G1, Intel UHD/Iris Plus G1, Ice Lake GT1), and I narrowed it down to the **section indirect multi-draw path** — not culling, not geometry, not frame pacing. **Environment** (differs from the report only in distro and driver version): - Arch Linux, Wayland (KWin), Mesa 26.2.2-1, `intel_icd` (ANV) - Horizon 0.2.97 — same artifacts as 0.2.92 above - Renderer log: `Intel(R) UHD Graphics (ICL GT1) (Vulkan, IntegratedGpu)`, `driver Intel open-source Mesa driver Mesa 26.2.2-arch1.1`, features include `INDIRECT_FIRST_INSTANCE | SHADER_EARLY_DEPTH_TEST` - Config: `graphicsApi:auto`, `presentMode:mailbox`, `renderDistance:8`, `lodDistance:0`, `caveCulling:false`, `batteryMode:true`, no shader pack **What it looks like:** sections are not missing, they are drawn **at the wrong origin** — terrain slabs floating in mid-air at unrelated heights, water sheets detached from the ground, holes where the displaced sections should be, while nearby structures stay intact. That reads as correct vertices with a wrong origin, not as broken meshes or a broken cull. **A/B results** (same world and spot, camera rotating 360°; settings switched live): | Variant | Artifacts | |---|---| | Section draws: indirect multi-draw (default) | **broken** | | — occlusion culling off (`section-cull off`, and `HORIZON_GPU_CULL=0`) | broken | | — section sides off (`section-sides off`) | broken | | — `WGPU_VALIDATION_INDIRECT_CALL=1` (re-enables the indirect validation that release builds strip) | broken | | **Section draws: flat (`HORIZON_FLAT_DRAWS=1`)** | **clean, repeated twice** | `HORIZON_FLAT_DRAWS=1` is an existing A/B knob (normally Metal-only). It draws the frame's sections as one index list with origins read from a storage buffer (`slot_origins[block_slots[vertex >> 8u]]`) instead of an instance vertex attribute indexed by `first_instance`. So the only things that change between clean and broken are where a section's origin comes from and whether ~500–1100 draws go out as one `multi_draw_indexed_indirect` batch. **Not the culling:** occlusion culling's phase 2 also issues indirect draws, but one per call with `first_instance = 0`, and it runs in the clean flat configuration too — `draw_indexed_indirect` itself is fine on this driver. **Not invalid indirect arguments:** `WGPU_VALIDATION_INDIRECT_CALL=1` still shows the artifacts. On Vulkan that pass only validates and clamps entries, so it does not exercise `first_instance`, but out-of-range arguments are ruled out. **Not a timing/frame-rate effect:** with `maxFps` capped to 10, corruption is still present in roughly a quarter of sampled frames. **Same code path, different Vulkan driver, clean:** forcing lavapipe (`VK_ICD_FILENAMES=.../lvp_icd.json`, `llvmpipe (LLVM 22.1.8, 256 bits)`, `device_type: cpu`, 11 fps) with `multi-draw on`, `section_draw_calls: 3` and the same world gives a clean picture across all sampled frames. That is the same renderer, same draw list construction and same batch, only the driver differs — so it points at ANV on Gen11 rather than at Horizon's logic. **Cost of the workaround:** none measurable. Switching between the two paths live on the same scene: 35.7 vs 35.8 fps, GPU p50 8.1 ms in both. A `HORIZON_FLAT_DRAWS=1` session runs at 60 fps in mailbox at render distance 8. **Also:** the OpenGL backend cannot be compared on this machine — wgpu reports `gl not compatible with provided surface` on both Wayland and X11, so Vulkan is the only backend available. Next thing I can try, if useful: a build where the section batch is replaced by one `draw_indexed` per section with an explicit `first_instance`, everything else unchanged. If that is clean, the trigger is the single large indirect batch (one `vkCmdDrawIndexedIndirect` with ~1k entries, per-entry `firstInstance`); if it is still broken, the trigger is the `first_instance`-based instance vertex fetch itself, independent of batching. I am happy to run such a build and report back.
Author
Owner

@E-Viktor2003 commented on GitHub (Oct 29, 2026):

Follow-up after building this from source at 2e01c336 with two env-gated probes. Short version: it is not the multi-draw batch, and not the origins upload — the trigger is the instance vertex-attribute origin fetch with a non-zero base instance (first_instance). Flat draws avoid it because they always draw with first_instance = 0.

Setup: built horizon-client from source (release, default features off), running on the resources of the 0.2.97 install, same world, maxFps capped to 10 so single frames can be sampled while the camera rotates 360° — 24 frames per variant, corrupt frames counted by inspecting every frame.

Variant Corrupted frames
default: one indirect multi-draw, origins uploaded through the staging belt 2 / 24
HORIZON_ONE_DRAW=1: one draw_indexed per section, same origins, same instance buffer 5 / 24
HORIZON_ORIGINS_WRITE=1: multi-draw, origins uploaded with Queue::write_buffer instead of the belt 2 / 24
HORIZON_FLAT_DRAWS=1: origins from a storage buffer, first_instance = 0 0 / 24

(HORIZON_ONE_DRAW and HORIZON_ORIGINS_WRITE are two-line probes I added locally: the first forces the existing per-section fallback draw_sections path, the second swaps the origins upload; nothing else changes.)

So:

  • Batching is not the trigger. One direct draw_indexed per section is equally broken, so it is not vkCmdDrawIndexedIndirect/vkCmdDrawIndexedIndirect with ~1k entries.
  • The upload path is not the trigger. Queue::write_buffer (no staging belt, no buffer reuse) is equally broken.
  • The only difference in the clean variant is that the origin comes from a storage buffer indexed by the section's arena block instead of from an instance-step vertex attribute, which also makes it the only variant that draws with first_instance = 0. The broken frames look exactly like a section drawn with another section's origin.

That points at base-instance handling for instance-step vertex attributes on this driver: ANV, Gen11, Mesa 26.2.2-arch1.1. llvmpipe on the same code path, the same draw lists and the same ~10 fps is clean.

If it helps, I can keep going: a single-section case with a fixed known first_instance, or a minimal wgpu reproducer outside Horizon. And I am happy to test patches.

<!-- gh-comment-id:6500435487 --> @E-Viktor2003 commented on GitHub (Oct 29, 2026): Follow-up after building this from source at `2e01c336` with two env-gated probes. Short version: **it is not the multi-draw batch, and not the origins upload — the trigger is the instance vertex-attribute origin fetch with a non-zero base instance (`first_instance`)**. Flat draws avoid it because they always draw with `first_instance = 0`. **Setup:** built `horizon-client` from source (release, default features off), running on the resources of the 0.2.97 install, same world, `maxFps` capped to 10 so single frames can be sampled while the camera rotates 360° — 24 frames per variant, corrupt frames counted by inspecting every frame. | Variant | Corrupted frames | |---|---| | default: one indirect multi-draw, origins uploaded through the staging belt | **2 / 24** | | `HORIZON_ONE_DRAW=1`: one `draw_indexed` per section, same origins, same instance buffer | **5 / 24** | | `HORIZON_ORIGINS_WRITE=1`: multi-draw, origins uploaded with `Queue::write_buffer` instead of the belt | **2 / 24** | | `HORIZON_FLAT_DRAWS=1`: origins from a storage buffer, `first_instance = 0` | **0 / 24** | (`HORIZON_ONE_DRAW` and `HORIZON_ORIGINS_WRITE` are two-line probes I added locally: the first forces the existing per-section fallback `draw_sections` path, the second swaps the origins upload; nothing else changes.) So: - **Batching is not the trigger.** One direct `draw_indexed` per section is equally broken, so it is not `vkCmdDrawIndexedIndirect`/`vkCmdDrawIndexedIndirect` with ~1k entries. - **The upload path is not the trigger.** `Queue::write_buffer` (no staging belt, no buffer reuse) is equally broken. - **The only difference in the clean variant** is that the origin comes from a storage buffer indexed by the section's arena block instead of from an instance-step vertex attribute, which also makes it the only variant that draws with `first_instance = 0`. The broken frames look exactly like a section drawn with another section's origin. That points at base-instance handling for instance-step vertex attributes on this driver: ANV, Gen11, Mesa 26.2.2-arch1.1. llvmpipe on the same code path, the same draw lists and the same ~10 fps is clean. If it helps, I can keep going: a single-section case with a fixed known `first_instance`, or a minimal wgpu reproducer outside Horizon. And I am happy to test patches.
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#1006
No description provided.