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

[glsl-in] naga rejects shader that uses lone vec4 expression. #1554

Closed
afd opened this issue Nov 26, 2021 · 1 comment · Fixed by #1758
Closed

[glsl-in] naga rejects shader that uses lone vec4 expression. #1554

afd opened this issue Nov 26, 2021 · 1 comment · Fixed by #1758
Labels
area: front-end Input formats for conversion lang: GLSL OpenGL Shading Language

Comments

@afd
Copy link

afd commented Nov 26, 2021

naga 74132ba rejects this valid shader:

#version 450

precision highp float;

precision highp int;

void main()
{
 vec4(1.0);
}

with:

error: Expected identifier or Semicolon, found LeftParen
  ┌─ 0013_reduced_final.frag:9:6
  │
9 │  vec4(1.0);
  │      ^
@kvark kvark added area: front-end Input formats for conversion lang: GLSL OpenGL Shading Language labels Nov 26, 2021
@NoelTautges
Copy link
Contributor

This is due to a decision/TODO item in the parser to interpret statements starting with a type name or qualifier as declarations:

// TODO: This prevents snippets like the following from working
// ```glsl
// vec4(1.0);
// ```
// But this would require us to add lookahead to also support
// declarations and since this statement is very unlikely and most
// likely an error, for now we don't support it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: front-end Input formats for conversion lang: GLSL OpenGL Shading Language
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants