Godot version:
3.0.2 Mono
OS/device including version:
KDE Neon
GTX 1060
Issue description:
in a shader you can use isnan()
to check if a float is NaN. However, if you pass anything that is not a float into it (such as a integer, vector, matrix, etc) it breaks the shader, yet doesn't give an error message in the editor. You do get a lot of error spam when the game runs, though:
drivers/gles3/shader_gles3.h:377 - Condition ' !version ' is true. returned: -1
For instance try this shader:
shader_type spatial;
void fragment()
{
ALBEDO = isnan(vec2(0,0)) ? vec3(1.0) : vec3(0.0);
}
I've assigned it on a sphere here, as you can see, the sphere gets weirdly stretched and is drawn in screen space:
Steps to reproduce:
Minimal reproduction project:
shadernanbug.zip
Thanks for the reproducible bug report. I've created a pull request that should fix this bug.
I just wanted to let you know that your shader code won't compile even with the fix because isnan(vec2) returns a boolean vec2. Your code would compile if you specified which element of the vec2 you want to check. For example:
shader_type spatial;
void fragment()
{
ALBEDO = isnan(vec2(0,0)).x ? vec3(1.0) : vec3(0.0);
}
Most helpful comment
Thanks for the reproducible bug report. I've created a pull request that should fix this bug.
I just wanted to let you know that your shader code won't compile even with the fix because isnan(vec2) returns a boolean vec2. Your code would compile if you specified which element of the vec2 you want to check. For example: