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

Inlining of global floats in vec3 #315

Open
heyjuvi opened this issue Sep 27, 2023 · 2 comments
Open

Inlining of global floats in vec3 #315

heyjuvi opened this issue Sep 27, 2023 · 2 comments

Comments

@heyjuvi
Copy link

heyjuvi commented Sep 27, 2023

When using (global) variables like

float a = 4;
vec3 b = vec3(a / 8, a / 8, 0);

the variable a gets inlined, but the information that it was a float seems to be lost, it appears as if an integer division is performed and the result is

vec3 b = vec3(0);
@heyjuvi heyjuvi changed the title Inclining of global floats in vec3 Inlining of global floats in vec3 Sep 27, 2023
@laurentlb
Copy link
Owner

Thanks for the report! Using 4. should fix it.

Can you check if your GLSL compiler throws a type error when you write float a = 4; (without running Shader Minifier)?

@heyjuvi
Copy link
Author

heyjuvi commented Sep 27, 2023

Yes. I checked it with using 8., but I’m sure 4. fixes this as well.

During development I'm using a non-minified version and it compiles fine (Nvidia driver for Linux). I think I also checked it with glslangValidator at some point as well and it didn't complain.

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