[GH-ISSUE #7811] Shader packs discard authored uniform initializers #4602

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

Originally assigned to: @gigamans442 on GitHub.

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

An ordinary shader uniform's authored initializer is discarded. An original asset-free pack with this final.fsh compiles, but renders the red channel as zero:

#version 120
uniform float fixtureDefault = 0.625;
uniform float noInitializer;
void main() {
    gl_FragColor = vec4(fixtureDefault, noInitializer, 0.25, 1.0);
}

The original fullscreen vertex stage is #version 120 followed by void main(){gl_Position=ftransform();}. Through the public pack loader and PackPost::run, a 16×16 RGBA8 readback expected [159,0,64,255] but observed [0,0,64,255] on all 256 pixels. The uninitialized uniform correctly stays zero. Intel Arc A770, Mesa 26.2.4, Vulkan; public source f7002313847f2999705487ba1f5c360029874ad0, with only a test module appended. A separate cameraPosition=vec3(0.75) control correctly receives the supplied frame value [0.25,0.5,0.75], so a fix must preserve provider precedence.

There is a related scanner failure for uniform vec3 fixtureDefault=vec3(0.125,0.375,0.625);: the constructor's comma is mistaken for a declarator boundary and the program is skipped with Expected identifier, found FloatConstant at 0.375. An original CPU loader regression also demonstrates that uniform float fixtureDefault=undefinedDefault; is incorrectly accepted because its initializer is removed before validation.

The current scanner explicitly drops initializers, the reflected Uniform carries no default data, and draw/compute blocks start at zero. Main f1d6576b338e050908aa630016311129c7161d2d has no change in these shader/frontend or pack_post.rs paths from the tested source.

Expected behavior follows Khronos GLSL 4.60 §4.3.5: declared initial values survive linking, absent initializers begin at zero, and later supplied uniform values supersede defaults. Initializers also need normal type/constant validation. This report concerns authored defaults, independently of adding currently missing game-provider names.

All repro sources are original; no third-party shader-pack or external converter implementation was read or reused. No player data, installed build or game settings were changed.

Originally created by @gigamans442 on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7811 Originally assigned to: @gigamans442 on GitHub. > 🤖 Filed by gigamans442's AI agent (Codex, gpt-6.1-sol), not by gigamans442 personally. An ordinary shader uniform's authored initializer is discarded. An original asset-free pack with this `final.fsh` compiles, but renders the red channel as zero: ```glsl #version 120 uniform float fixtureDefault = 0.625; uniform float noInitializer; void main() { gl_FragColor = vec4(fixtureDefault, noInitializer, 0.25, 1.0); } ``` The original fullscreen vertex stage is `#version 120` followed by `void main(){gl_Position=ftransform();}`. Through the public pack loader and `PackPost::run`, a 16×16 RGBA8 readback expected `[159,0,64,255]` but observed `[0,0,64,255]` on all 256 pixels. The uninitialized uniform correctly stays zero. Intel Arc A770, Mesa 26.2.4, Vulkan; public source `f7002313847f2999705487ba1f5c360029874ad0`, with only a test module appended. A separate `cameraPosition=vec3(0.75)` control correctly receives the supplied frame value `[0.25,0.5,0.75]`, so a fix must preserve provider precedence. There is a related scanner failure for `uniform vec3 fixtureDefault=vec3(0.125,0.375,0.625);`: the constructor's comma is mistaken for a declarator boundary and the program is skipped with `Expected identifier, found FloatConstant` at `0.375`. An original CPU loader regression also demonstrates that `uniform float fixtureDefault=undefinedDefault;` is incorrectly accepted because its initializer is removed before validation. The current scanner explicitly drops initializers, the reflected `Uniform` carries no default data, and draw/compute blocks start at zero. Main `f1d6576b338e050908aa630016311129c7161d2d` has no change in these shader/frontend or `pack_post.rs` paths from the tested source. Expected behavior follows [Khronos GLSL 4.60 §4.3.5](https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.60.pdf): declared initial values survive linking, absent initializers begin at zero, and later supplied uniform values supersede defaults. Initializers also need normal type/constant validation. This report concerns authored defaults, independently of adding currently missing game-provider names. All repro sources are original; no third-party shader-pack or external converter implementation was read or reused. No player data, installed build or game settings were changed.
Author
Owner

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

🤖 Agent: /claim

Claimed by gigamans442's AI agent (Codex, gpt-6.1-sol), not by gigamans442 personally. I will preserve validated constant initializer data through reflection and seed draw/compute uniform blocks before the existing engine/custom suppliers. Original loader, typed-byte, reload and Vulkan controls will cover the change.

<!-- gh-comment-id:6588710589 --> @gigamans442 commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim Claimed by gigamans442's AI agent (Codex, gpt-6.1-sol), not by gigamans442 personally. I will preserve validated constant initializer data through reflection and seed draw/compute uniform blocks before the existing engine/custom suppliers. Original loader, typed-byte, reload and Vulkan controls will cover the change.
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#4602
No description provided.