[PR #6341] [MERGED] Fix OpenGL shader: flatten colored_lights (no ARB_arrays_of_arrays) #6813

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

📋 Pull Request Information

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

Base: main ← Head: fix/6267-gl-nested-arrays


📝 Commits (1)

  • 7affb5b Fix OpenGL shader error: flatten colored_lights to avoid ARB_arrays_of_arrays (#6267)

📊 Changes

5 files changed (+51 additions, -9 deletions)

View changed files

📝 crates/horizon-client-render/Cargo.toml (+1 -1)
📝 crates/horizon-client-render/src/dynamic_light.rs (+2 -1)
📝 crates/horizon-client-render/src/entity.wgsl (+3 -3)
📝 crates/horizon-client-render/src/gfx.rs (+42 -1)
📝 crates/horizon-client-render/src/terrain.wgsl (+3 -3)

📄 Description

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

What

On OpenGL below 4.3 (e.g. GL 4.0 Intel HD) the terrain vertex shader failed to compile: 'ARB_arrays_of_arrays' is not supported. naga's GLSL backend emits that extension for the nested colored_lights: array<array<vec4<f32>, 2>, 16> in Globals (terrain.wgsl, entity.wgsl). It is now a flat array<vec4<f32>, 32>, read at i * 2u (position/radius) and i * 2u + 1u (colour). The Rust side is unchanged: [[[f32;4];2];16] is byte-identical (512 bytes, 16-byte stride). Rendering is unchanged. The only remaining nested arrays are var<workgroup> in the optional frame-gen compute shader (optical_flow.wgsl), which never runs on GL, so I left them.

Vanilla reference

None: rendering backend only.

How tested

The existing shader translation test (now shaders_translate_to_hlsl_for_directx_12_and_glsl_for_opengl) also runs naga's GLSL writer at desktop 330 and 400 for every non-compute entry point and asserts that no ARB_arrays_of_arrays appears. Shaders that GLSL cannot express (depth textureLoad, storage buffers) are skipped, with a floor on how many translations must succeed. The test fails on the old WGSL (oit_clouds.wgsl vs_entity needs ARB_arrays_of_arrays on GLSL 330) and passes with the fix. glsl-out was added to the naga dev-dependency features.

pr_ready --quick: fmt ✅, clippy ✅, Python tests ✅ (594), public tree ✅. tests: horizon-client-render ❌ is an environment failure: gfx:: tests SIGSEGV on this machine's GPU. The named test passes when run on its own.
No specific parity harness covers this. Remaining affected harnesses: run by CI's parity job.

Fixes #6267

Suggested label: none

Review: a separate Sonnet 5.5 agent reviewed the diff and answered SIN DEFECTO (index math, byte-identical uniform layout, no other nested arrays reachable on GL, test signal); CLAUDE.md and CONTRIBUTING.md were followed.

🤖 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/6341 **Author:** [@Joansitoh](https://github.com/Joansitoh) **Created:** 11/1/2026 **Status:** ✅ Merged **Merged:** 11/1/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `fix/6267-gl-nested-arrays` --- ### 📝 Commits (1) - [`7affb5b`](https://github.com/horizon-rust/horizon/commit/7affb5b4782638792a7b9b7700ccb52f733fbe74) Fix OpenGL shader error: flatten colored_lights to avoid ARB_arrays_of_arrays (#6267) ### 📊 Changes **5 files changed** (+51 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/Cargo.toml` (+1 -1) 📝 `crates/horizon-client-render/src/dynamic_light.rs` (+2 -1) 📝 `crates/horizon-client-render/src/entity.wgsl` (+3 -3) 📝 `crates/horizon-client-render/src/gfx.rs` (+42 -1) 📝 `crates/horizon-client-render/src/terrain.wgsl` (+3 -3) </details> ### 📄 Description > 🤖 Opened by Joansitoh's AI agent (Claude Code, Sonnet 5.5), not by Joansitoh personally. ## What On OpenGL below 4.3 (e.g. GL 4.0 Intel HD) the terrain vertex shader failed to compile: `'ARB_arrays_of_arrays' is not supported`. naga's GLSL backend emits that extension for the nested `colored_lights: array<array<vec4<f32>, 2>, 16>` in `Globals` (terrain.wgsl, entity.wgsl). It is now a flat `array<vec4<f32>, 32>`, read at `i * 2u` (position/radius) and `i * 2u + 1u` (colour). The Rust side is unchanged: `[[[f32;4];2];16]` is byte-identical (512 bytes, 16-byte stride). Rendering is unchanged. The only remaining nested arrays are `var<workgroup>` in the optional frame-gen compute shader (`optical_flow.wgsl`), which never runs on GL, so I left them. ## Vanilla reference None: rendering backend only. ## How tested The existing shader translation test (now `shaders_translate_to_hlsl_for_directx_12_and_glsl_for_opengl`) also runs naga's GLSL writer at desktop 330 and 400 for every non-compute entry point and asserts that no `ARB_arrays_of_arrays` appears. Shaders that GLSL cannot express (depth `textureLoad`, storage buffers) are skipped, with a floor on how many translations must succeed. The test fails on the old WGSL (`oit_clouds.wgsl vs_entity needs ARB_arrays_of_arrays on GLSL 330`) and passes with the fix. `glsl-out` was added to the naga dev-dependency features. `pr_ready --quick`: fmt ✅, clippy ✅, Python tests ✅ (594), public tree ✅. `tests: horizon-client-render` ❌ is an environment failure: gfx:: tests SIGSEGV on this machine's GPU. The named test passes when run on its own. No specific parity harness covers this. Remaining affected harnesses: run by CI's parity job. Fixes #6267 Suggested label: none Review: a separate Sonnet 5.5 agent reviewed the diff and answered SIN DEFECTO (index math, byte-identical uniform layout, no other nested arrays reachable on GL, test signal); CLAUDE.md and CONTRIBUTING.md were followed. 🤖 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: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#6813
No description provided.