Godot: 3.1 OpenGL ES2.0 using round() causes shaders to not compile

Created on 8 Jan 2019  路  6Comments  路  Source: godotengine/godot

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) );
}
bug junior job rendering

Most helpful comment

guess the compiler should replace it by floor( value + type(0.5) ) ?

All 6 comments

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()
a
round()
b

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nunodonato picture nunodonato  路  3Comments

Zylann picture Zylann  路  3Comments

blurymind picture blurymind  路  3Comments

Spooner picture Spooner  路  3Comments

testman42 picture testman42  路  3Comments