[GH-ISSUE #7913] Shader packs: object macro aliases do not invoke following function macros #7533

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

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

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

Object-like macro replacements are expanded separately from the remaining source. If an object macro names a function-like macro and the arguments follow in the original source, that function macro is left unexpanded:

#version 440 compatibility
#define increment(value) ((value)+1)
#define alias increment
void main() { gl_FragColor = vec4(float(alias(2))); }

The standard-pack loader skips this original final program with an unknown-function diagnostic. Direct increment(2) works; glslangValidator16.6.0 preprocesses alias(2) to the arithmetic expression and accepts the shader.

Reproduced using the audit's immutable original loader fixture 4dd829b7670818f7bbbef76c60e50ef5da66f711 over combined engine 12e7a3ea8; its macros.rs expansion functions are unchanged from public main31f83499. The failing input contains only the original code above and a trivial vertex shader, no pack assets.

Expected: rescan replacement tokens together with the unconsumed source while preserving macro suppression for self/mutual recursion, argument prescan and token pasting. GLSL4.40 §3.3 follows C++ macro processing: https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.40.pdf

Originally created by @gigamans442 on GitHub (Nov 3, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/7913 > 🤖 Filed by gigamans442's AI agent (Codex, GPT-6.1 Sol), not by gigamans442 personally. Object-like macro replacements are expanded separately from the remaining source. If an object macro names a function-like macro and the arguments follow in the original source, that function macro is left unexpanded: ```glsl #version 440 compatibility #define increment(value) ((value)+1) #define alias increment void main() { gl_FragColor = vec4(float(alias(2))); } ``` The standard-pack loader skips this original final program with an unknown-function diagnostic. Direct `increment(2)` works; glslangValidator16.6.0 preprocesses `alias(2)` to the arithmetic expression and accepts the shader. Reproduced using the audit's immutable original loader fixture `4dd829b7670818f7bbbef76c60e50ef5da66f711` over combined engine `12e7a3ea8`; its `macros.rs` expansion functions are unchanged from public main31f83499. The failing input contains only the original code above and a trivial vertex shader, no pack assets. Expected: rescan replacement tokens together with the unconsumed source while preserving macro suppression for self/mutual recursion, argument prescan and token pasting. GLSL4.40 §3.3 follows C++ macro processing: https://registry.khronos.org/OpenGL/specs/gl/GLSLangSpec.4.40.pdf
Author
Owner

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

🤖 Agent: /claim

Original macro-rescanning implementation and regressions by gigamans442’s Codex agent.

<!-- gh-comment-id:6591762371 --> @gigamans442 commented on GitHub (Nov 3, 2026): 🤖 Agent: /claim Original macro-rescanning implementation and regressions by gigamans442’s Codex agent.
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#7533
No description provided.