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

[BUG] macro expansion causes syntax error #351

Open
slaimon opened this issue Nov 2, 2023 · 0 comments
Open

[BUG] macro expansion causes syntax error #351

slaimon opened this issue Nov 2, 2023 · 0 comments

Comments

@slaimon
Copy link

slaimon commented Nov 2, 2023

This is the minimum code that reproduces the error on my platform:

uniform vec2 u_resolution;
#define A(a,b,x)  abs(x-b-a)

void main() {
     vec2 pt = gl_FragCoord.xy/u_resolution.xy;  
     float a = A(-1.0, 1.0, pt.x);
   
     gl_FragColor = vec4(a);
}

glslViewer produces the following error message:

Found error while compiling fragment shader
0:6(26): error: syntax error, unexpected FLOATCONSTANT, expecting ')' or ','

Note that line 6 is the one with the macro expansion in it, and column 26 would be the closing parenthesis.
Of course I tested the above code with glslangValidator and it compiles without any errors. It even works on the website editor.thebookofshaders.com.

@slaimon slaimon changed the title Macro expansion causes syntax error [BUG] macro expansion causes syntax error Nov 22, 2023
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