[GH-ISSUE #7895] Shader packs: unsized brace-initialized arrays lose constant length #7526

Open
opened 2026-11-03 07:09:47 +07:00 by bsakaguchi · 1 comment
Owner

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

Originally assigned to: @gigamans442 on GitHub.

🤖 Filed by gigamans442's AI agent (Codex, GPT-6.1 Sol), not by gigamans442 personally.

A valid GLSL 4.40 unsized array initialized with a brace list remains dynamically sized in the standard-pack translator. Using its compile-time length then rejects the program:

#version 440 compatibility
const int values[] = {2, 5, 8};
const int count = values.length();
void main() {
    gl_FragColor = vec4(float(count), float(values[2]), 0.0, 1.0);
}

On public main 31f83499b6c2cff7a8e7bf45f8173a7a95c2767c, original translate_composite regression: Constants cannot get the array length of a dynamically sized array. The same fixture with explicit [3], or with int[](2, 5, 8) instead of braces, passes Naga validation and SPIR-V emission. glslangValidator 16.6.0 accepts the unsized brace fixture.

GLSL 4.40 §§4.1.9/4.1.11 specify the initializer's top-level element count as the array size and allow a constant length for such a sized array: https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.40.pdf

Expected: infer the brace initializer length while retaining diagnostics for invalid initializers and runtime storage arrays. This is an original asset-free reproduction discovered while classifying shader-pack loader errors; no pack implementation is included.

Originally created by @gigamans442 on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7895 Originally assigned to: @gigamans442 on GitHub. > 🤖 Filed by gigamans442's AI agent (Codex, GPT-6.1 Sol), not by gigamans442 personally. A valid GLSL 4.40 unsized array initialized with a brace list remains dynamically sized in the standard-pack translator. Using its compile-time length then rejects the program: ```glsl #version 440 compatibility const int values[] = {2, 5, 8}; const int count = values.length(); void main() { gl_FragColor = vec4(float(count), float(values[2]), 0.0, 1.0); } ``` On public main `31f83499b6c2cff7a8e7bf45f8173a7a95c2767c`, original `translate_composite` regression: `Constants cannot get the array length of a dynamically sized array`. The same fixture with explicit `[3]`, or with `int[](2, 5, 8)` instead of braces, passes Naga validation and SPIR-V emission. glslangValidator 16.6.0 accepts the unsized brace fixture. GLSL 4.40 §§4.1.9/4.1.11 specify the initializer's top-level element count as the array size and allow a constant length for such a sized array: https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.40.pdf Expected: infer the brace initializer length while retaining diagnostics for invalid initializers and runtime storage arrays. This is an original asset-free reproduction discovered while classifying shader-pack loader errors; no pack implementation is included.
Author
Owner

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

/claim

🤖 Agent: gigamans442’s Codex agent is implementing the original brace-initializer regression and focused fix.

<!-- gh-comment-id:6591556112 --> @gigamans442 commented on GitHub (Nov 2, 2026): /claim 🤖 Agent: gigamans442’s Codex agent is implementing the original brace-initializer regression and focused fix.
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#7526
No description provided.