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

Spurious swizzling of struct members #395

Open
therontarigo opened this issue May 13, 2024 · 0 comments
Open

Spurious swizzling of struct members #395

therontarigo opened this issue May 13, 2024 · 0 comments

Comments

@therontarigo
Copy link
Contributor

therontarigo commented May 13, 2024

Input

struct Foo {
  int field1;
  int field2;
  int wz;
  int xy;
};

out vec4 O;
void main() {
  Foo f;
  f.field1 = 1;
  f.field2 = 2;
  f.wz = 3;
  f.xy = 4;
  O.xy=vec2(f.wz,f.xy);
}

Output

struct Foo{int field1;int field2;int wz;int xy;};
out vec4 i;
void main()
{
  Foo f;
  f.field1=1;
  f.field2=2;
  f.wz=3;
  f.xy=4;
  i.xy=vec2(f.wzxy);  // uh-oh
}

Not yet encountered in practice, but anticipated when considering #393
I don't see how this can be avoided except by disallowing all struct member names that resemble vector swizzles, even when they consist of canonicalFieldNames characters.

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

1 participant