laurentlb / shader-minifier

Minify and obfuscate GLSL or HLSL code

Home Page:https://ctrl-alt-test.fr/minifier/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inlining of global floats in vec3

heyjuvi opened this issue · comments

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);

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)?

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.