Godot 3.1 Beta1
Windows 10
OpenGL ES 2.0 Renderer: GeForce GTX 1050/PCIe/SSE2
Compiling a shader using round() fails shader compilation, produces:
0(478) : error C7532: global function round requires "#version 130" or later
0(478) : error C0000: ... or #extension GL_EXT_gpu_shader4 : enable
To reproduce, create a basic scene with a mesh using this ShaderMaterial:
shader_type spatial;
render_mode unshaded;
void fragment()
{
ALBEDO = round( vec3(0.5, 0.0, 0.0) );
}
guess the compiler should replace it by floor( value + type(0.5) ) ?
Is this not making it to 3.1?
The docs has said that some functions are not avaliable in gles2 here: https://docs.godotengine.org/en/3.1/tutorials/misc/gles2_gles3_differences.html
most of those functions can be implemented by "replacing", maybe it's a good idea to implement most of those functions, not just this one.
Here's the issue illustrated if round is not available:
abc()
round()
If a function is not implemented, I would expect the compiler to complain, as it does with other unknown functions, instead of the engine crashing when trying to run.
Just write #version 130 at the top of your shader.
Most helpful comment
guess the compiler should replace it by floor( value + type(0.5) ) ?