Godot: Uncaught shader compilation problem on Intel

Created on 31 Oct 2018  路  20Comments  路  Source: godotengine/godot

Godot version: 4c863da4d5ad86f4c392d72dd9dbe24801884a71

OS/device including version: Arch Linux as of 2018-10-31, Intel GPU

OpenGL renderer string: Mesa DRI Intel(R) UHD Graphics 620 (Kabylake GT2)

full glxinfo output

Issue description:

On my Intel GPU, having a texture(foo, bar, lod) access with LOD specified will not generate a syntax error within Godot, but shader compilation will fail. Godot outputs the following. (full output)

ERROR: _display_error_with_code: ParticlesShaderGLES3: Vertex Program Compilation Failed:
0:185(13): error: no matching function for call to `texture(sampler2D, vec2, int)'; candidates are:
0:185(13): error:    vec4 texture(sampler1D, float)
0:185(13): error:    ivec4 texture(isampler1D, float)
[...] (only signatures without LOD)
0:185(13): error: type mismatch
0:187(16): warning: `m_pos' used uninitialized

   At: drivers/gles3/shader_gles3.cpp:173.
ERROR: get_current_version: Method/Function Failed, returning: __null
   At: drivers/gles3/shader_gles3.cpp:357.
ERROR: bind: Condition ' !version ' is true. returned: false
   At: drivers/gles3/shader_gles3.cpp:123.
ERROR: _get_uniform: Condition ' !version ' is true. returned: -1
   At: drivers/gles3/shader_gles3.h:380.
ERROR: _get_uniform: Condition ' !version ' is true. returned: -1
   At: drivers/gles3/shader_gles3.h:380.

Using texture(foo,bar, lod) within a fragment shader works, and using textureLod(foo,bar,lod) in the vertex shader will also work (as well as using texture(foo,bar) without the LOD).

On my other machine with Linux and a NVidia GPU (OpenGL renderer string: GeForce GTX 1080 Ti/PCIe/SSE2), this error does not occur.

I am not sure whether this is a driver or a godot bug; but if the workaround is to jave godot just replace the three-argument version of texture() with textureLod(), then that would be an appropriate fix.

Steps to reproduce:

  1. Use Linux, use an Intel GPU (Kaby Lake preferably)
  2. Create a MeshInstance, assign a ShaderMaterial to it
  3. In the vertex shader, use texture(foo,bar, lod).

Minimal reproduction project:

glslbug.zip

Just open it, godot will immediately fail to compile the shader.

bug rendering

Most helpful comment

Fixed by https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914267
All fine with mesa 18.2.5-3 in debian unstable

All 20 comments

This is a really interesting problem. I can confirm your results on an intel integrated GPU. I found this thread discussing the difference between between texture and textureLod. The first response says that textureLod is meant to be used in the vertex shader while texture is meant only for the fragment shader. They mentioned that there are no derivatives in the vertex shader, I think the lack of derivatives nullifies the benefits of the bias argument.

Given that, in my opinion we should document this behavior. Ideally we should also disallow the bias parameter in vertex shaders.

With GLES2 on older Intel IGP the 3D viewport turns white. Last lines of the backtrace (is much long):

ERROR: _display_error_with_code: SceneShaderGLES2: Vertex shader compilation failed:
0:465(17): error: no matching function for call to `texture2D(sampler2D, vec2, int)'; candidates are:
0:465(17): error: vec4 texture2D(sampler2D, vec2)
0:465(17): error: type mismatch

At: drivers/gles2/shader_gles2.cpp:196.
ERROR: get_current_version: Method/Function Failed, returning: __null
At: drivers/gles2/shader_gles2.cpp:344.
ERROR: bind: Condition ' !version ' is true. returned: false
At: drivers/gles2/shader_gles2.cpp:133.
ERROR: _get_uniform: Condition ' !version ' is true. returned: -1
At: drivers/gles2/shader_gles2.h:524.
ERROR: get_uniform_location: Condition ' !version ' is true. returned: -1
At: drivers/gles2/shader_gles2.cpp:516.
ERROR: _get_uniform: Condition ' !version ' is true. returned: -1
At: drivers/gles2/shader_gles2.h:524.
ERROR: _get_uniform: Condition ' !version ' is true. returned: -1
At: drivers/gles2/shader_gles2.h:524.
ERROR: _get_uniform: Condition ' !version ' is true. returned: -1
At: drivers/gles2/shader_gles2.h:524.
ERROR: _get_uniform: Condition ' !version ' is true. returned: -1
At: drivers/gles2/shader_gles2.h:524.
ERROR: free_custom_shader: Condition ' !custom_code_map.has(p_code_id) ' is true.
At: drivers/gles2/shader_gles2.cpp:673.

Tested Godot Versions: 3.1 alpha 2, 3.0.6
System: Fedora 29, Intel HD 5500, Mesa 18.2.3
full glxinfo output

The same issue happens on application start. The project manager shows a blank screen.
It only occurs after upgrading from Mesa 18.2.2 to 18.2.3
full programm output

At: drivers/gles3/shader_gles3.cpp:168.
ERROR: get_current_version: CanvasShaderGLES3: Fragment Program Compilation Failed:
0:89(2): error: invalid input layout qualifier used
0:90(2): error: invalid input layout qualifier used
0:91(2): error: invalid input layout qualifier used
0:92(2): error: invalid input layout qualifier used
0:94(2): error: invalid input layout qualifier used

At: drivers/gles3/shader_gles3.cpp:441.
ERROR: get_current_version: Method/Function Failed, returning: __null
At: drivers/gles3/shader_gles3.cpp:449.
ERROR: bind: Condition ' !version ' is true. returned: false
At: drivers/gles3/shader_gles3.cpp:123.
ERROR: _get_uniform: Condition ' !version ' is true. returned: -1
At: drivers/gles3/shader_gles3.h:377.
ERROR: _get_uniform: Condition ' !version ' is true. returned: -1
At: drivers/gles3/shader_gles3.h:377.
ERROR: _get_uniform: Condition ' !version ' is true. returned: -1
At: drivers/gles3/shader_gles3.h:377.
ERROR: _get_uniform: Condition ' !version ' is true. returned: -1
At: drivers/gles3/shader_gles3.h:377.
ERROR: _get_uniform: Condition ' !version ' is true. returned: -1
At: drivers/gles3/shader_gles3.h:377.
ERROR: _get_uniform: Condition ' !version ' is true. returned: -1
At: drivers/gles3/shader_gles3.h:377.
ERROR: _get_uniform: Condition ' !version ' is true. returned: -1
At: drivers/gles3/shader_gles3.h:377.
ERROR: _get_uniform: Condition ' !version ' is true. returned: -1
At: drivers/gles3/shader_gles3.h:377.
ERROR: _get_uniform: Condition ' !version ' is true. returned: -1
At: drivers/gles3/shader_gles3.h:377.

The same issue happens on application start. The project manager shows a blank screen.
It only occurs after upgrading from Mesa 13.2.2 to 13.2.3

Is there a specific reason why you're on Mesa 13.2.x? Fedora 29 shipped with 18.2.2.

sorry i wrote 13 instead of 18. it should be 18

Oh ok. And you didn't have the issue with 18.2.2? @Windfisch seems to have 18.2.0 (according to glxinfo output) and experiences it.

Yes I noticed that too. It just happens on this specific version. If I downgrade it I have no problem.

It seems like the Mesa 18.2.3 update in Fedora 29 didn't pass QA but was still pushed to stable by mistake. Judging by linked bug reports it seems pretty broken: https://bodhi.fedoraproject.org/updates/FEDORA-2018-bcdb732491

There's an update candidate for 18.2.4 in testing, though it doesn't say if it's addressing the reported regressions: https://bodhi.fedoraproject.org/updates/FEDORA-2018-170fedcbc1

Ah ok. Thank you very much.
I will take a look at that.

I have same issue on Windows 10 with Intel HD 4600 so it seems not to be Mesa bug but Godot(but maybe windows and linux intel drivers have same bug)

TT.txt

With Fedora 29 , downgrade mesa package will be ok

I have the same issue after (from my apt log) upgrade mesa 18.1.9-1 to 18.2.5-1, with both godot 3.0.6 and 3.1 alpha2.
I run debian SID,
OpenGL renderer string: Mesa DRI Intel(R) Ivybridge Mobile
OpenGL core profile version string: 4.2 (Core Profile) Mesa 18.2.5

I have the same issue after (from my apt log) upgrade mesa 18.1.9-1 to 18.2.5-1, with both godot 3.0.6 and 3.1 alpha2.
I run debian SID,
OpenGL renderer string: Mesa DRI Intel(R) Ivybridge Mobile
OpenGL core profile version string: 4.2 (Core Profile) Mesa 18.2.5

Same issue on Debian SID using Godot stable 3.0.6, it was working up until the latest update.

OpenGL renderer string: OpenGL renderer string: Radeon RX Vega (VEGA10, DRM 3.26.0, 4.18.0-2-amd64, LLVM 7.0.1)
OpenGL core profile version string: 4.5 (Core Profile) Mesa 18.2.5

Godot_terminal_output.txt

@wargreen @rszibele Could you open an issue with the Debian mesa maintainers? They might be hit by a similar regression that Fedora had: https://bugzilla.redhat.com/show_bug.cgi?id=1646150
(Caused by a GCC bug: https://bugzilla.redhat.com/show_bug.cgi?id=1645400)

What can be the package to downgrade, as a temporary workaround ?

What can be the package to downgrade, as a temporary workaround ?

That would be mesa-18.2.5-1, and any other packages at the same version which were updated alongside it (I'm not sure how mesa is packaged on Debian but I assume it might be spread over several packages).

For now i've downgraded :

libegl-mesa0
libglapi-mesa
libgles2-mesa
libglx-mesa0
libosmesa6
mesa-vulkan-drivers

But no changes...

EDIT :
All fine after sudo apt install libegl1-mesa=18.1.9-1 libgl1-mesa-dri=18.1.9-1 libgl1-mesa-glx=18.1.9-1 libwayland-egl1-mesa=18.1.9-1

Fixed by https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=914267
All fine with mesa 18.2.5-3 in debian unstable

That issue has been fixed indeed, it was a GCC bug that impacted Mesa updates.

If you've come here due to issues with Mesa 18.3+ on Linux, see #24783.

Was this page helpful?
0 / 5 - 0 ratings