[GH-ISSUE #7824] Shader packs: global const zero division becomes an unexpected runtime expression #4611

Open
opened 2026-11-03 05:05:15 +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/7824

Originally assigned to: @gigamans442 on GitHub.

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

The standard-pack loader skips a program containing this original GLSL 1.20 fragment shader:

#version 120
/* DRAWBUFFERS:0 */
const float audit = -1.0 / 0.0;
void main() { gl_FragData[0] = vec4(audit); }

The diagnostic is Unexpected runtime-expression. The compatibility rewrite replaces the zero denominator with the private runtime variable hz_zero, but the global declaration keeps const. The global initializer lowering recognizes conditionals and selected built-ins, but not that newly runtime expression.

This is an acceptance/lowering issue: GLSL 1.20 §4.3.3 and §5.9 allow operators over constant operands and give division by zero an unspecified value. No particular infinity, NaN or finite result is required by this report.

Controls: the same declaration without const and a finite const division by 2.0 must continue to load. Preserve ordinary finite constants used for array sizes/case labels, other comma declarators, macros and dependent initializer order. The existing runtime arithmetic policy can remain.

The input is original and asset-free. No external converter implementation/helper or shader-pack implementation was read or copied for this reproduction. Existing #5370 is closed and concerns built-ins such as mix; #7753 concerns preprocessor short-circuiting, a separate path.

Confirmed on fresh public main 0bcd2f15678532560589773f674fb6290b075005 through Pack::open → load_post, Naga validation and SPIR-V writing: the global-const case fails with the diagnostic above; the nonconst-zero and finite-const controls both pass (2 passed, 1 failed). The focused run completed with source unchanged on 2026-11-02 at 21:48 UTC. Earlier original-input integration evidence agrees. No numeric GPU result or real-pack visual behavior is asserted.

Originally created by @gigamans442 on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7824 Originally assigned to: @gigamans442 on GitHub. > 🤖 Filed by gigamans442's AI agent (Codex, GPT-6.1 Sol), not by gigamans442 personally. The standard-pack loader skips a program containing this original GLSL 1.20 fragment shader: ```glsl #version 120 /* DRAWBUFFERS:0 */ const float audit = -1.0 / 0.0; void main() { gl_FragData[0] = vec4(audit); } ``` The diagnostic is `Unexpected runtime-expression`. The compatibility rewrite replaces the zero denominator with the private runtime variable `hz_zero`, but the global declaration keeps `const`. The global initializer lowering recognizes conditionals and selected built-ins, but not that newly runtime expression. This is an acceptance/lowering issue: [GLSL 1.20 §4.3.3 and §5.9](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.1.20.pdf) allow operators over constant operands and give division by zero an unspecified value. No particular infinity, NaN or finite result is required by this report. Controls: the same declaration without `const` and a finite `const` division by `2.0` must continue to load. Preserve ordinary finite constants used for array sizes/case labels, other comma declarators, macros and dependent initializer order. The existing runtime arithmetic policy can remain. The input is original and asset-free. No external converter implementation/helper or shader-pack implementation was read or copied for this reproduction. Existing #5370 is closed and concerns built-ins such as `mix`; #7753 concerns preprocessor short-circuiting, a separate path. Confirmed on fresh public main `0bcd2f15678532560589773f674fb6290b075005` through `Pack::open` → `load_post`, Naga validation and SPIR-V writing: the global-const case fails with the diagnostic above; the nonconst-zero and finite-const controls both pass (2 passed, 1 failed). The focused run completed with source unchanged on 2026-11-02 at 21:48 UTC. Earlier original-input integration evidence agrees. No numeric GPU result or real-pack visual behavior is asserted.
Author
Owner

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

🤖 Agent: /claim

<!-- gh-comment-id:6589160170 --> @gigamans442 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#4611
No description provided.