[PR #1936] [MERGED] OpenGL 3.3: no indirect buffer without indirect draws #3876

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

📋 Pull Request Information

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

Base: main ← Head: fix/opengl-gl33


📝 Commits (1)

  • 2761349 Renderer: no indirect buffer usage without indirect draws (OpenGL before 4.3)

📊 Changes

1 file changed (+15 additions, -4 deletions)

View changed files

📝 crates/horizon-client/src/gfx.rs (+15 -4)

📄 Description

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

Follow-up to #1920. With this, Horizon renders on an OpenGL 3.3 core driver that has none of the 4.x extensions.

What

wgpu refuses to create a buffer with INDIRECT usage on a device without DownlevelFlags::INDIRECT_EXECUTION. That flag needs GL 4.3, or ARB_draw_indirect together with compute shaders. On such a driver the game panicked in Renderer::new while creating the Section draws buffer. Multi-draw now also requires indirect execution, and without it the buffer has no INDIRECT usage. Sections then take the direct path they already used without INDIRECT_FIRST_INSTANCE: one draw_indexed per section. Vulkan, Metal and DirectX 12 all have indirect execution, so nothing changes there.

Why the earlier 3.3 runs lost terrain (no code change needed)

MESA_GL_VERSION_OVERRIDE=3.3 lowers the version but keeps advertising GL_ARB_compute_shader. wgpu-hal then assumes the shaders carry layout(binding=…) (its SHADER_BINDING_LAYOUT follows compute support), but naga writes no bindings below GLSL 420. Every uniform block and sampler was left at slot 0. Bisect on the ThinkPad: 4.2, 4.4, 4.5 and 4.6 render, 4.1 and 3.3 don't. A real old driver doesn't list those extensions. To approximate one, hide them too:
MESA_GL_VERSION_OVERRIDE=3.3 MESA_GLSL_VERSION_OVERRIDE=330 MESA_EXTENSION_OVERRIDE="-GL_ARB_compute_shader -GL_ARB_shader_storage_buffer_object -GL_ARB_shader_image_load_store -GL_ARB_shader_draw_parameters -GL_ARB_draw_indirect -GL_ARB_multi_draw_indirect -GL_ARB_base_instance -GL_ARB_clip_control -GL_ARB_shading_language_420pack -GL_ARB_explicit_uniform_location -GL_ARB_timer_query". Before this PR that run panicked on Section draws; with it, it renders the world.

Tested (ThinkPad, Intel HD 620, Mesa 26.1.8 iris, Xvfb, offscreen, creative world, 25 s, 0 errors in the log)

Run Path FPS Sections drawn
Vulkan (reference) server thread 114.5 418
GL 4.6 server thread 119.1 418
GL 3.3, extensions hidden server thread 119.3 418
GL 3.3, extensions hidden --in-frame 102.7 418

The screenshots match Vulkan apart from the clouds, which move between runs: mean channel difference 2.9 (GL 4.6) and 4.8 (GL 3.3). The title screen at GL 3.3 matches Vulkan's. Animated sprites take the CPU path at 3.3 (#1920). Mac mini (Metal): cargo clippy -p horizon-client --lib --tests --bins -- -D warnings clean, gfx:: tests 82 passed.

Needs Ludovic

Nothing. Label: none (a fix).

🤖 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/1936 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/25/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/opengl-gl33` --- ### 📝 Commits (1) - [`2761349`](https://github.com/horizon-rust/horizon/commit/2761349d98199a2695e629bf2f911c2d0db7a6c8) Renderer: no indirect buffer usage without indirect draws (OpenGL before 4.3) ### 📊 Changes **1 file changed** (+15 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/gfx.rs` (+15 -4) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Follow-up to #1920. With this, Horizon renders on an OpenGL 3.3 core driver that has none of the 4.x extensions. ## What wgpu refuses to create a buffer with `INDIRECT` usage on a device without `DownlevelFlags::INDIRECT_EXECUTION`. That flag needs GL 4.3, or `ARB_draw_indirect` together with compute shaders. On such a driver the game panicked in `Renderer::new` while creating the `Section draws` buffer. Multi-draw now also requires indirect execution, and without it the buffer has no `INDIRECT` usage. Sections then take the direct path they already used without `INDIRECT_FIRST_INSTANCE`: one `draw_indexed` per section. Vulkan, Metal and DirectX 12 all have indirect execution, so nothing changes there. ## Why the earlier 3.3 runs lost terrain (no code change needed) `MESA_GL_VERSION_OVERRIDE=3.3` lowers the version but keeps advertising `GL_ARB_compute_shader`. wgpu-hal then assumes the shaders carry `layout(binding=…)` (its `SHADER_BINDING_LAYOUT` follows compute support), but naga writes no bindings below GLSL 420. Every uniform block and sampler was left at slot 0. Bisect on the ThinkPad: 4.2, 4.4, 4.5 and 4.6 render, 4.1 and 3.3 don't. A real old driver doesn't list those extensions. To approximate one, hide them too: `MESA_GL_VERSION_OVERRIDE=3.3 MESA_GLSL_VERSION_OVERRIDE=330 MESA_EXTENSION_OVERRIDE="-GL_ARB_compute_shader -GL_ARB_shader_storage_buffer_object -GL_ARB_shader_image_load_store -GL_ARB_shader_draw_parameters -GL_ARB_draw_indirect -GL_ARB_multi_draw_indirect -GL_ARB_base_instance -GL_ARB_clip_control -GL_ARB_shading_language_420pack -GL_ARB_explicit_uniform_location -GL_ARB_timer_query"`. Before this PR that run panicked on `Section draws`; with it, it renders the world. ## Tested (ThinkPad, Intel HD 620, Mesa 26.1.8 iris, Xvfb, offscreen, creative world, 25 s, 0 errors in the log) | Run | Path | FPS | Sections drawn | |---|---|---|---| | Vulkan (reference) | server thread | 114.5 | 418 | | GL 4.6 | server thread | 119.1 | 418 | | GL 3.3, extensions hidden | server thread | 119.3 | 418 | | GL 3.3, extensions hidden | `--in-frame` | 102.7 | 418 | The screenshots match Vulkan apart from the clouds, which move between runs: mean channel difference 2.9 (GL 4.6) and 4.8 (GL 3.3). The title screen at GL 3.3 matches Vulkan's. Animated sprites take the CPU path at 3.3 (#1920). Mac mini (Metal): `cargo clippy -p horizon-client --lib --tests --bins -- -D warnings` clean, `gfx::` tests 82 passed. ## Needs Ludovic Nothing. Label: none (a fix). 🤖 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 04:12:57 +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#3876
No description provided.