[GH-ISSUE #6810] Shader packs: a function prototype declared twice fails to translate ("Prototype already defined") #2226

Closed
opened 2026-11-02 15:53:09 +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/6810

Originally assigned to: @arslanarm on GitHub.

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

What happens: a program that declares the same function prototype twice fails to translate with Prototype already defined.

GLSL allows a function to be declared any number of times before its single definition (GLSL 4.60, 6.1 only requires a declaration or definition before the call, and at global scope). glslangValidator (1.4.363) compiles the example below without an error. Packs get there easily: two included files each declare a helper they use.

An example (written for this issue, composite.fsh):

#version 330
in vec2 uv;
float f(float x);
float f(float x);
float f(float x) { return x; }
/* DRAWBUFFERS:0 */
layout(location = 0) out vec4 c;
void main() { c = vec4(f(uv.x)); }

Expected: it translates and calls f.

Pack it shows in (run as a black box with real_packs on main 3a264943c): Bloop 1.8.0-Alpha-3, 3 programs report Prototype already defined.

Originally created by @arslanarm on GitHub (Nov 2, 2026). Original GitHub issue: https://github.com/horizon-rust/horizon/issues/6810 Originally assigned to: @arslanarm on GitHub. > 🤖 Filed by arslanarm's AI agent (Claude Code, Claude Opus 5.5), not by arslanarm personally. **What happens:** a program that declares the same function prototype twice fails to translate with `Prototype already defined`. GLSL allows a function to be declared any number of times before its single definition (GLSL 4.60, 6.1 only requires a declaration or definition before the call, and at global scope). `glslangValidator` (1.4.363) compiles the example below without an error. Packs get there easily: two included files each declare a helper they use. **An example** (written for this issue, `composite.fsh`): ```glsl #version 330 in vec2 uv; float f(float x); float f(float x); float f(float x) { return x; } /* DRAWBUFFERS:0 */ layout(location = 0) out vec4 c; void main() { c = vec4(f(uv.x)); } ``` Expected: it translates and calls `f`. **Pack it shows in** (run as a black box with `real_packs` on main 3a264943c): Bloop 1.8.0-Alpha-3, 3 programs report `Prototype already defined`.
Author
Owner

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

🤖 Agent: /claim

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

<!-- gh-comment-id:6570407119 --> @arslanarm commented on GitHub (Nov 2, 2026): 🤖 Agent: /claim Claimed by arslanarm's AI agent (Claude Code, Claude Opus 5.5), not by arslanarm personally.
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#2226
No description provided.