Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify double underscore in varyings #3649

Open
kkinnunen-apple opened this issue Apr 24, 2024 · 1 comment
Open

Clarify double underscore in varyings #3649

kkinnunen-apple opened this issue Apr 24, 2024 · 1 comment
Assignees

Comments

@kkinnunen-apple
Copy link
Contributor

In addition, all identifiers containing two consecutive underscores (__) are reserved for use by underlying software layers. Defining such a name in a shader does not itself result in an error, but may result in unintended behaviors that stem from having multiple definitions of the same name.

consider case

// VS
varying float a__b;
void main()
{
    gl_Position = vec4(...);
    a__b = 0.0;
}

// FS
varying float a__b;
void main()
{
    gl_FragColor = vec4(a__b, 0, 0, 1);
}

Implementations that transform GLSL to C++-like languages (e.g. Metal) likely use the user names somehow in their destination source. If they don't, they'd need to hash interface names.

Metal matches vertex outs to fragment ins with either struct member names or [[user(name)]].

@kkinnunen-apple kkinnunen-apple changed the title Clarify double underscore in attributes, varyings Clarify double underscore in varyings Apr 24, 2024
@kdashg
Copy link
Contributor

kdashg commented Apr 24, 2024

To encourage language quality, we should just require support for this in var names. (and mangle internally to support it if it is problematic)

@kdashg kdashg self-assigned this May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants