[GH-ISSUE #7171] Shader packs: RenderPearl's declarations Horizon can't read (shared struct, layout on block members, gl_PerVertex, a local_size_x expression) #3160

Closed
opened 2026-11-03 04:06:19 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @arslanarm on GitHub (Nov 2, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7171

Originally assigned to: @arslanarm on GitHub.

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

What happens: besides its iris.features.required (tracked separately) and textureQueryLod, RenderPearl v2.7.2 has four kinds of declarations, all valid GLSL 4.60, that Horizon fails to translate (real_packs with SHOW_ERRORS=1 on main 0ac35dac7):

  1. A shared variable of an anonymous struct type in compute programs (deferred1, composite, composite3): Expected end of file, found Identifier("hz_kw_shared"). shared is renamed as if the stage were GLSL 1.x; RenderPearl's #version 460 core sits in an included file (/prelude/core.glsl).
  2. layout(location = N, component = M) on interface-block members (prog/unlit.vsh:15, prog/unlit.fsh:29, prog/solid.vsh:68, lib/tbn/fsh.glsl:4, used by most gbuffers programs): Expected Void, Struct or a type, found Layout. GLSL 4.60, 4.4.1 and 4.4.2 allow location and component qualifiers on block members.
  3. A redeclared gl_PerVertex output block (out gl_PerVertex { vec4 gl_Position; };, GLSL 4.60, 7.5) in gbuffers_skybasic and gbuffers_skytextured: Entry point main at Vertex is invalid: Vertex shaders must return a `@builtin(position)` output value.
  4. local_size_x given as a constant expression (min(gl_MaxComputeWorkGroupSize.x, N), GLSL 4.60, 4.4.1) in deferred: `local_size_x` is not a number gl_WorkGroupSize can take.

RenderPearl is MIT (the licence ships in the Modrinth v2.7.2 zip; github.com/Luracasmus/renderpearl@86de79c4fa, tag v2.7.2). The lines named in Horizon's errors were read to name the constructs above. The fixes will be built from the spec and examples written for this issue, such as:

#version 460
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;
layout(std430, binding = 0) buffer Out { uint total; };
shared struct {
    uint sum;
    uint tile[gl_WorkGroupSize.x][gl_WorkGroupSize.y];
} lds;
void main() {
    lds.tile[gl_LocalInvocationID.x][gl_LocalInvocationID.y] = gl_LocalInvocationIndex;
    barrier();
    if (gl_LocalInvocationIndex == 0u) atomicAdd(total, lds.tile[1][1]);
}

(glslangValidator compiles it, and the examples for items 2 to 4.) This may be split into one pull request per item.

Expected: each translates.

Originally created by @arslanarm on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7171 Originally assigned to: @arslanarm on GitHub. > 🤖 Filed by arslanarm's AI agent (Claude Code, Claude Opus 5.5), not by arslanarm personally. **What happens:** besides its `iris.features.required` (tracked separately) and `textureQueryLod`, RenderPearl v2.7.2 has four kinds of declarations, all valid GLSL 4.60, that Horizon fails to translate (`real_packs` with `SHOW_ERRORS=1` on main 0ac35dac7): 1. **A `shared` variable of an anonymous struct type** in compute programs (`deferred1`, `composite`, `composite3`): `Expected end of file, found Identifier("hz_kw_shared")`. `shared` is renamed as if the stage were GLSL 1.x; RenderPearl's `#version 460 core` sits in an included file (`/prelude/core.glsl`). 2. **`layout(location = N, component = M)` on interface-block members** (`prog/unlit.vsh:15`, `prog/unlit.fsh:29`, `prog/solid.vsh:68`, `lib/tbn/fsh.glsl:4`, used by most gbuffers programs): `Expected Void, Struct or a type, found Layout`. GLSL 4.60, 4.4.1 and 4.4.2 allow location and component qualifiers on block members. 3. **A redeclared `gl_PerVertex` output block** (`out gl_PerVertex { vec4 gl_Position; };`, GLSL 4.60, 7.5) in `gbuffers_skybasic` and `gbuffers_skytextured`: ``Entry point main at Vertex is invalid: Vertex shaders must return a `@builtin(position)` output value``. 4. **`local_size_x` given as a constant expression** (`min(gl_MaxComputeWorkGroupSize.x, N)`, GLSL 4.60, 4.4.1) in `deferred`: `` `local_size_x` is not a number gl_WorkGroupSize can take ``. RenderPearl is MIT (the licence ships in the Modrinth v2.7.2 zip; https://github.com/Luracasmus/renderpearl/tree/86de79c4fa7d07fb47628dd9620efb10fb4be9d9, tag v2.7.2). The lines named in Horizon's errors were read to name the constructs above. The fixes will be built from the spec and examples written for this issue, such as: ```glsl #version 460 layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in; layout(std430, binding = 0) buffer Out { uint total; }; shared struct { uint sum; uint tile[gl_WorkGroupSize.x][gl_WorkGroupSize.y]; } lds; void main() { lds.tile[gl_LocalInvocationID.x][gl_LocalInvocationID.y] = gl_LocalInvocationIndex; barrier(); if (gl_LocalInvocationIndex == 0u) atomicAdd(total, lds.tile[1][1]); } ``` (`glslangValidator` compiles it, and the examples for items 2 to 4.) This may be split into one pull request per item. Expected: each translates.
Author
Owner

@arslanarm commented on GitHub (Nov 2, 2026):

🤖 Agent: /claim

<!-- gh-comment-id:6576584662 --> @arslanarm commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim
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#3160
No description provided.