Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash (segfault) when opening/creating project due to Vulkan debug utils [Mesa Haswell] #51955

Closed
follower opened this issue Aug 21, 2021 · 20 comments · Fixed by #73057
Closed

Comments

@follower
Copy link
Contributor

follower commented Aug 21, 2021

Godot version

4.0.dev.20210820.official.75697c0df

(via https://twitter.com/Akien/status/1428808742989148168 / https://downloads.tuxfamily.org/godotengine/testing/4.0/4.0-dev.20210820/)

System information

Linux, Elementary OS 5.1, Intel(R) HD Graphics 4400 (HSW GT2), Vulkan API 1.1.0 [0]

Issue description

Crash (segfault) when opening/creating any project.

Steps to reproduce

$ /<path>/Godot_v4.0-dev.20210820_linux.64 --verbose --editor /<path>/project.godot 
Godot Engine v4.0.dev.20210820.official.75697c0df - https://godotengine.org
Using "ICU / HarfBuzz / Graphite" text server...
XInput: Refreshing devices.
XInput: Using touch device: Virtual core pointer
WARNING: XOpenIM failed
     at: DisplayServerX11 (platform/linuxbsd/display_server_x11.cpp:3925)
Vulkan API 1.1.0
INTEL-MESA: warning: Haswell Vulkan support is incomplete
Using Vulkan Device #0: Intel - Intel(R) HD Graphics 4400 (HSW GT2)
- Vulkan multiview supported:
  max view count: 16
  max instances: 268435455
- Vulkan subgroup:
  size: 32
  stages: STAGE_FRAGMENT, STAGE_COMPUTE
  supported ops: FEATURE_BASIC, FEATURE_VOTE, FEATURE_BALLOT, FEATURE_SHUFFLE, FEATURE_SHUFFLE_RELATIVE, FEATURE_QUAD
WARNING: XCreateIC couldn't create wd.xic
     at: _create_window (platform/linuxbsd/display_server_x11.cpp:3751)
Using present mode: VK_PRESENT_MODE_FIFO_KHR
FreeDesktopScreenSaver: Acquired screensaver inhibition cookie: 4099
Using "default" pen tablet driver...
Shader 'ParticlesShaderRD' SHA256: b1c13742d6c7dc398cf01338d0e4a4947d10ce9f81c08416520adc0d946e6896
Shader 'ParticlesCopyShaderRD' SHA256: 70843017352c938ab16d3d6842d71c8f756708323386170ebdd95741236f561b
Shader 'CanvasSdfShaderRD' SHA256: 816c231df07a2f1b5f640e2ca29fdc7fc37acbefad545c953a8dfd00d38db03a
Shader 'SkeletonShaderRD' SHA256: ff686ba34b4393c77ce295a3c5b24ceef9e7d6fdc159df8657dc6a81feda212e
Shader 'CanvasShaderRD' SHA256: c36e476ac4ce51e50dd1290ccaf7f64cd6bb029a61589c429b3a060054902228
Shader 'CanvasOcclusionShaderRD' SHA256: 4a8854b5b957f77150c3d80fb5ad16e3ac5421b9e9a310cb4aaea49ccb3f807e
Shader 'ClusterRenderShaderRD' SHA256: c4390f1ed2f365a226dccf3cb11f09e2813040319ef8f0dfada7a9a25fed89c1
Shader 'ClusterStoreShaderRD' SHA256: 9068c995b77d702ec04d40d69d31d5eebe3226a6ce9f36ebad47caf51869d760
Shader 'ClusterDebugShaderRD' SHA256: a231523c33193a35a7b7e1560fbb0457fa4b1ea7b05032be928aad31d3b0f37d
Shader 'SceneForwardMobileShaderRD' SHA256: a7e3ba939b48858524011eb5b9534f14972b49fec9c6447d642f2651285ca2f2
Shader 'SkyShaderRD' SHA256: e6902ca3c52d65d0655f0b9a56946ae5f937009f86375d4820e4ee24fe350688
Shader 'BlurRasterShaderRD' SHA256: 205c05013e63df37f8c15e1f9fa9a5eaff3c2707f66d767dfaed80465f69a094
Shader 'CopyToFbShaderRD' SHA256: 4443801df53215f08e48cf8bdf295ba88cf324adb044ff49952c1953e683ecec
Shader 'CubemapRoughnessRasterShaderRD' SHA256: 3ef71f33e04fc7bc1c6944a811d946548bcb786ac41109c08d897a7ebc67c135
Shader 'TonemapShaderRD' SHA256: df56d0131824081b100eb73e73c0f8d52f5561dfb1c82518ba4e313419ca2c0a
Shader 'LuminanceReduceRasterShaderRD' SHA256: 42f711e2f15d9eb18ac503c29a8d606da4649db3e4ebd01e66ff455e074d5a06
Shader 'CubeToDpShaderRD' SHA256: 57a7145fd3034af34bd11d25a6167d3a9981c4f59eb0cf5d12d7e2078715b6b8
Shader 'BokehDofRasterShaderRD' SHA256: 6a496a8fe361fb770d4bf0cf6c9bd9156ece09a182e5843201ec1335fba1bf3b
Shader 'CubemapDownsamplerRasterShaderRD' SHA256: 8e7f681440ae08f45ad6389d97094e2884abcba49baa188383ff1dfa337b8db8
Shader 'CubemapFilterRasterShaderRD' SHA256: b3c9682934992fa90e0c00f44936067e0edd3dd49e4f99b6e9eac8c8287361e9
Shader 'SortShaderRD' SHA256: 91d8bf452e4f62ffc1a926c54c1328ce691943177b729957365e52f63dc5b8a4
Shader 'BlitShaderRD' SHA256: 82225c2d18349e339d96edb103d998c127637a4604be9d119d4793b67df14185
JoypadLinux: udev enabled and loaded successfully.
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_dlpath
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_config_topdir
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_config_add_before
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_config_add_after
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_config_is_array
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_pcm_areas_copy_wrap
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_mixer_selem_id_parse
/usr/lib/x86_64-linux-gnu/libpulse.so.0: undefined symbol: pa_threaded_mainloop_once_unlocked
/usr/lib/x86_64-linux-gnu/libpulse.so.0: undefined symbol: pa_thread_make_realtime
PulseAudio: context other
PulseAudio: context other
PulseAudio: context other
PulseAudio: context ready
PulseAudio: Detecting channels for device: alsa_output.pci-0000_00_1b.0.analog-stereo
PulseAudio: detected 2 channels
PulseAudio: audio buffer frames: 512 calculated latency: 11ms
 
CORE API HASH: 8305278628240260042
EDITOR API HASH: 3825680112465765238
Class 'GDScriptEditorTranslationParserPlugin' is not exposed, skipping.
Class 'GDScriptNativeClass' is not exposed, skipping.
Class 'IPUnix' is not exposed, skipping.
Class 'PhysicsDirectBodyState2DSW' is not exposed, skipping.
Class 'PhysicsDirectBodyState3DSW' is not exposed, skipping.
Class 'PhysicsDirectSpaceState2DSW' is not exposed, skipping.
Class 'PhysicsDirectSpaceState3DSW' is not exposed, skipping.
Class 'PhysicsServer2DSW' is not exposed, skipping.
Class 'PhysicsServer3DSW' is not exposed, skipping.
Class 'ResourceImporterMP3' is not exposed, skipping.
Class 'ResourceImporterOGGVorbis' is not exposed, skipping.
Class 'TextServerAdvanced' is not exposed, skipping.
Construct gdnative interface

Destruct gdnative interface

EditorSettings: Load OK!
Loaded builtin certs
Failed to bind socket. Error: 3
EditorSettings: Save OK!
Using present mode: VK_PRESENT_MODE_FIFO_KHR
Using present mode: VK_PRESENT_MODE_FIFO_KHR
handle_crash: Program crashed with signal 11
Dumping the backtrace. Please include this when reporting the bug on https://github.com/godotengine/godot/issues
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x3f040) [0x7f8df2085040] (??:0)
-- END OF BACKTRACE --
Aborted

Opening just the project manager works okay:

$ /<path>/Godot_v4.0-dev.20210820_linux.64 
Godot Engine v4.0.dev.20210820.official.75697c0df - https://godotengine.org
WARNING: XOpenIM failed
     at: DisplayServerX11 (platform/linuxbsd/display_server_x11.cpp:3925)
Vulkan API 1.1.0
INTEL-MESA: warning: Haswell Vulkan support is incomplete
Using Vulkan Device #0: Intel - Intel(R) HD Graphics 4400 (HSW GT2)
WARNING: XCreateIC couldn't create wd.xic
     at: _create_window (platform/linuxbsd/display_server_x11.cpp:3751)
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_dlpath
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_config_topdir
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_config_add_before
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_config_add_after
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_config_is_array
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_pcm_areas_copy_wrap
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_mixer_selem_id_parse
/usr/lib/x86_64-linux-gnu/libpulse.so.0: undefined symbol: pa_threaded_mainloop_once_unlocked
/usr/lib/x86_64-linux-gnu/libpulse.so.0: undefined symbol: pa_thread_make_realtime
 
WARNING: XCreateIC couldn't create wd.xic
     at: _create_window (platform/linuxbsd/display_server_x11.cpp:3751)

Previous pre-built binary version that worked (via https://downloads.tuxfamily.org/godotengine/testing/4.0/4.0-dev.20210811/):

$ ~/Downloads/Godot_v4.0-dev.20210811_linux.64 
Godot Engine v4.0.dev.20210811.official.7188cb601 - https://godotengine.org
WARNING: XOpenIM failed
     at: DisplayServerX11 (platform/linuxbsd/display_server_x11.cpp:3925)
Vulkan API 1.2.162
INTEL-MESA: warning: Haswell Vulkan support is incomplete
Using Vulkan Device #0: Intel - Intel(R) HD Graphics 4400 (HSW GT2)
WARNING: XCreateIC couldn't create wd.xic
     at: _create_window (platform/linuxbsd/display_server_x11.cpp:3751)
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_dlpath
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_config_topdir
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_config_add_before
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_config_add_after
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_config_is_array
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_pcm_areas_copy_wrap
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_mixer_selem_id_parse
/usr/lib/x86_64-linux-gnu/libpulse.so.0: undefined symbol: pa_threaded_mainloop_once_unlocked
/usr/lib/x86_64-linux-gnu/libpulse.so.0: undefined symbol: pa_thread_make_realtime

[0] Note: Previous working version reports Vulkan API 1.2.162 but latest version reports Vulkan API 1.1.0.

Minimal reproduction project

N/A

@follower
Copy link
Contributor Author

follower commented Aug 21, 2021

I only noticed the difference in the Vulkan API version returned when I started writing up this issue but I had previously noticed the following recent commits that I thought could be connected due to the area of the code affected:

More debug info

I attempted to get some more useful Vulkan debug information but mostly just got annoyed with Vulkan debugging. :D :/

However, running under gdb produced this:

(gdb) run --verbose --disable-crash-handler --editor /<path>/project.godot 
Starting program: /<path>/Godot_v4.0-dev.20210820_linux.64 --verbose --disable-crash-handler --editor /<path>/project.godot
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff24b5700 (LWP 17230)]
Godot Engine v4.0.dev.20210820.official.75697c0df - https://godotengine.org
Using "ICU / HarfBuzz / Graphite" text server...
XInput: Refreshing devices.
XInput: Using touch device: Virtual core pointer
WARNING: XOpenIM failed
     at: DisplayServerX11 (platform/linuxbsd/display_server_x11.cpp:3925)
Vulkan API 1.1.0
INTEL-MESA: warning: Haswell Vulkan support is incomplete
[New Thread 0x7fffe8bbf700 (LWP 17231)]
[New Thread 0x7fffe3fff700 (LWP 17232)]
[New Thread 0x7fffe37fe700 (LWP 17233)]
[New Thread 0x7fffe2ffd700 (LWP 17234)]
Using Vulkan Device #0: Intel - Intel(R) HD Graphics 4400 (HSW GT2)
- Vulkan multiview supported:
  max view count: 16
  max instances: 268435455
- Vulkan subgroup:
  size: 32
  stages: STAGE_FRAGMENT, STAGE_COMPUTE
  supported ops: FEATURE_BASIC, FEATURE_VOTE, FEATURE_BALLOT, FEATURE_SHUFFLE, FEATURE_SHUFFLE_RELATIVE, FEATURE_QUAD
WARNING: XCreateIC couldn't create wd.xic
     at: _create_window (platform/linuxbsd/display_server_x11.cpp:3751)
Using present mode: VK_PRESENT_MODE_FIFO_KHR
[New Thread 0x7fffe27fc700 (LWP 17235)]
[New Thread 0x7fffe1ffb700 (LWP 17236)]
FreeDesktopScreenSaver: Acquired screensaver inhibition cookie: 4100
Using "default" pen tablet driver...
[New Thread 0x7fffe17fa700 (LWP 17237)]
[New Thread 0x7fffe0ff9700 (LWP 17238)]
[New Thread 0x7fffd3fff700 (LWP 17239)]
[New Thread 0x7fffd37fe700 (LWP 17240)]
Shader 'ParticlesShaderRD' SHA256: b1c13742d6c7dc398cf01338d0e4a4947d10ce9f81c08416520adc0d946e6896
Shader 'ParticlesCopyShaderRD' SHA256: 70843017352c938ab16d3d6842d71c8f756708323386170ebdd95741236f561b
Shader 'CanvasSdfShaderRD' SHA256: 816c231df07a2f1b5f640e2ca29fdc7fc37acbefad545c953a8dfd00d38db03a
Shader 'SkeletonShaderRD' SHA256: ff686ba34b4393c77ce295a3c5b24ceef9e7d6fdc159df8657dc6a81feda212e
Shader 'CanvasShaderRD' SHA256: c36e476ac4ce51e50dd1290ccaf7f64cd6bb029a61589c429b3a060054902228
Shader 'CanvasOcclusionShaderRD' SHA256: 4a8854b5b957f77150c3d80fb5ad16e3ac5421b9e9a310cb4aaea49ccb3f807e
Shader 'ClusterRenderShaderRD' SHA256: c4390f1ed2f365a226dccf3cb11f09e2813040319ef8f0dfada7a9a25fed89c1
Shader 'ClusterStoreShaderRD' SHA256: 9068c995b77d702ec04d40d69d31d5eebe3226a6ce9f36ebad47caf51869d760
Shader 'ClusterDebugShaderRD' SHA256: a231523c33193a35a7b7e1560fbb0457fa4b1ea7b05032be928aad31d3b0f37d
Shader 'SceneForwardMobileShaderRD' SHA256: a7e3ba939b48858524011eb5b9534f14972b49fec9c6447d642f2651285ca2f2
Shader 'SkyShaderRD' SHA256: e6902ca3c52d65d0655f0b9a56946ae5f937009f86375d4820e4ee24fe350688
Shader 'BlurRasterShaderRD' SHA256: 205c05013e63df37f8c15e1f9fa9a5eaff3c2707f66d767dfaed80465f69a094
Shader 'CopyToFbShaderRD' SHA256: 4443801df53215f08e48cf8bdf295ba88cf324adb044ff49952c1953e683ecec
Shader 'CubemapRoughnessRasterShaderRD' SHA256: 3ef71f33e04fc7bc1c6944a811d946548bcb786ac41109c08d897a7ebc67c135
Shader 'TonemapShaderRD' SHA256: df56d0131824081b100eb73e73c0f8d52f5561dfb1c82518ba4e313419ca2c0a
Shader 'LuminanceReduceRasterShaderRD' SHA256: 42f711e2f15d9eb18ac503c29a8d606da4649db3e4ebd01e66ff455e074d5a06
Shader 'CubeToDpShaderRD' SHA256: 57a7145fd3034af34bd11d25a6167d3a9981c4f59eb0cf5d12d7e2078715b6b8
Shader 'BokehDofRasterShaderRD' SHA256: 6a496a8fe361fb770d4bf0cf6c9bd9156ece09a182e5843201ec1335fba1bf3b
Shader 'CubemapDownsamplerRasterShaderRD' SHA256: 8e7f681440ae08f45ad6389d97094e2884abcba49baa188383ff1dfa337b8db8
Shader 'CubemapFilterRasterShaderRD' SHA256: b3c9682934992fa90e0c00f44936067e0edd3dd49e4f99b6e9eac8c8287361e9
Shader 'SortShaderRD' SHA256: 91d8bf452e4f62ffc1a926c54c1328ce691943177b729957365e52f63dc5b8a4
Shader 'BlitShaderRD' SHA256: 82225c2d18349e339d96edb103d998c127637a4604be9d119d4793b67df14185
JoypadLinux: udev enabled and loaded successfully.
[New Thread 0x7fffd2ffd700 (LWP 17242)]
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_dlpath
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_config_topdir
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_config_add_before
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_config_add_after
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_config_is_array
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_pcm_areas_copy_wrap
/usr/lib/x86_64-linux-gnu/libasound.so.2: undefined symbol: snd_mixer_selem_id_parse
/usr/lib/x86_64-linux-gnu/libpulse.so.0: undefined symbol: pa_threaded_mainloop_once_unlocked
/usr/lib/x86_64-linux-gnu/libpulse.so.0: undefined symbol: pa_thread_make_realtime
PulseAudio: context other
PulseAudio: context other
PulseAudio: context other
PulseAudio: context ready
PulseAudio: Detecting channels for device: alsa_output.pci-0000_00_1b.0.analog-stereo
PulseAudio: detected 2 channels
PulseAudio: audio buffer frames: 512 calculated latency: 11ms
[New Thread 0x7fffd1176700 (LWP 17243)]
 
[Thread 0x7fffe27fc700 (LWP 17235) exited]
[New Thread 0x7fffd0975700 (LWP 17244)]
[New Thread 0x7fffb3fff700 (LWP 17245)]
[New Thread 0x7fffb37fe700 (LWP 17246)]
[New Thread 0x7fffb2ffd700 (LWP 17247)]
[New Thread 0x7fffb27fc700 (LWP 17248)]
[New Thread 0x7fffb1ffb700 (LWP 17249)]
[New Thread 0x7fffb17fa700 (LWP 17250)]
[New Thread 0x7fffb0ff9700 (LWP 17251)]
CORE API HASH: 8305278628240260042
EDITOR API HASH: 3825680112465765238
Class 'GDScriptEditorTranslationParserPlugin' is not exposed, skipping.
Class 'GDScriptNativeClass' is not exposed, skipping.
Class 'IPUnix' is not exposed, skipping.
Class 'PhysicsDirectBodyState2DSW' is not exposed, skipping.
Class 'PhysicsDirectBodyState3DSW' is not exposed, skipping.
Class 'PhysicsDirectSpaceState2DSW' is not exposed, skipping.
Class 'PhysicsDirectSpaceState3DSW' is not exposed, skipping.
Class 'PhysicsServer2DSW' is not exposed, skipping.
Class 'PhysicsServer3DSW' is not exposed, skipping.
Class 'ResourceImporterMP3' is not exposed, skipping.
Class 'ResourceImporterOGGVorbis' is not exposed, skipping.
Class 'TextServerAdvanced' is not exposed, skipping.
Construct gdnative interface

Destruct gdnative interface

EditorSettings: Load OK!
[New Thread 0x7fffabfff700 (LWP 17252)]
[New Thread 0x7fffab7fe700 (LWP 17253)]
[New Thread 0x7fffaaffd700 (LWP 17254)]
[New Thread 0x7fffaa7fc700 (LWP 17255)]
[New Thread 0x7fffa9ffb700 (LWP 17256)]
[New Thread 0x7fffa97fa700 (LWP 17257)]
[New Thread 0x7fffa8ff9700 (LWP 17258)]
[New Thread 0x7fffa87f8700 (LWP 17259)]
Loaded builtin certs
Failed to bind socket. Error: 3
EditorSettings: Save OK!
Using present mode: VK_PRESENT_MODE_FIFO_KHR
[New Thread 0x7fffe27fc700 (LWP 17263)]
[Thread 0x7fffe27fc700 (LWP 17263) exited]
Using present mode: VK_PRESENT_MODE_FIFO_KHR
[New Thread 0x7fffe27fc700 (LWP 17264)]
[New Thread 0x7fffa7df7700 (LWP 17265)]
[Thread 0x7fffa7df7700 (LWP 17265) exited]
[New Thread 0x7fffa7df7700 (LWP 17266)]
[New Thread 0x7fffa75f6700 (LWP 17267)]
[Thread 0x7fffa75f6700 (LWP 17267) exited]

Thread 1 "Godot_v4.0-dev." received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()

Then:

(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x000000000179942b in ?? ()
#2  0x00000000033f4145 in ?? ()
#3  0x000000000338e31a in ?? ()
#4  0x00000000034fc6aa in ?? ()
#5  0x00000000035018ea in ?? ()
#6  0x00000000034d238a in ?? ()
#7  0x00000000034f4cfd in ?? ()
#8  0x0000000003514cde in ?? ()
#9  0x0000000003333984 in ?? ()
#10 0x0000000000cc2703 in ?? ()
#11 0x0000000000c5ecc1 in ?? ()
#12 0x00007ffff5dedbf7 in __libc_start_main (main=0xc5e130, argc=5, argv=0x7fffffffdd68, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdd58)
    at ../csu/libc-start.c:310
#13 0x0000000000c76fae in ?? ()

Note: While there is a message that says INTEL-MESA: warning: Haswell Vulkan support is incomplete my understanding is that it may be a warning message that was never updated when the support was completed. (Either way Godot still worked okay with the previous test binary.)

@follower follower changed the title [wip] Crash (segfault) when opening/creating project Crash (segfault) when opening/creating project Aug 21, 2021
@Calinou Calinou added this to the 4.0 milestone Aug 21, 2021
@follower
Copy link
Contributor Author

follower commented Aug 24, 2021

Notes:

#0  0x0000000000000000 in ?? ()
#1  0x0000000001b2f171 in VulkanContext::command_begin_label(VkCommandBuffer_T*, String, Color) ()
#2  0x0000000001acc6ab in RenderingDeviceVulkan::draw_command_begin_label(String, Color) ()
#3  0x0000000003d0242f in RendererSceneRenderImplementation::RenderForwardClustered::_render_scene(RenderDataRD*, Color const&) ()
#4  0x0000000003c30ae0 in RendererSceneRenderRD::render_scene(RID, RendererSceneRender::CameraData const*, PagedArray<RendererSceneRender::GeometryInstance*> const&, PagedArray<RID> const&, PagedArray<RID> const&, PagedArray<RID> const&, PagedArray<RID> const&, PagedArray<RID> const&, RID, RID, RID, RID, RID, RID, int, float, RendererSceneRender::RenderShadowData const*, int, RendererSceneRender::RenderSDFGIData const*, int, RendererSceneRender::RenderSDFGIUpdateData const*, RendererScene::RenderInfo*) ()
#5  0x0000000003e227da in RendererSceneCull::_render_scene(RendererSceneRender::CameraData const*, RID, RID, RID, unsigned int, RID, RID, RID, RID, int, float, bool, RendererScene::RenderInfo*) ()
#6  0x0000000003e280cc in RendererSceneCull::render_camera(RID, RID, RID, RID, Vector2, float, RID, Ref<XRInterface>&, RendererScene::RenderInfo*) ()
#7  0x0000000003e3fadd in RendererViewport::_draw_3d(RendererViewport::Viewport*) ()
#8  0x0000000003e41daa in RendererViewport::_draw_viewport(RendererViewport::Viewport*, unsigned int) ()
#9  0x0000000003e449af in RendererViewport::draw_viewports() ()
#10 0x0000000003b7eef4 in RenderingServerDefault::_draw(bool, double) ()
#11 0x0000000000a8571d in Main::iteration() ()
#12 0x0000000000a5d6d9 in OS_LinuxBSD::run() ()
#13 0x0000000000a46616 in main ()
#0  0x0000000003b22af0 in RenderingDevice::get_singleton() ()
   0x0000000001b11c16 <+150>:	callq  0x1b0de70 <_ZN7CowDataIcE6_unrefEPv.isra.0>
   0x0000000001b11c1b <+155>:	mov    %r15,%rdi
   0x0000000001b11c1e <+158>:	movl   $0x3b9cbe02,0x10(%rsp)
   0x0000000001b11c26 <+166>:	movq   $0x0,0x18(%rsp)
   0x0000000001b11c2f <+175>:	callq  0x45fd860 <CharString::get_data() const>
   0x0000000001b11c34 <+180>:	mov    %rax,0x20(%rsp)
   0x0000000001b11c39 <+185>:	lea    0x10(%rsp),%rsi
   0x0000000001b11c3e <+190>:	mov    %rbp,%rdi
   0x0000000001b11c41 <+193>:	mov    %r13,0x28(%rsp)
   0x0000000001b11c46 <+198>:	mov    %r12,0x30(%rsp)
   0x0000000001b11c4b <+203>:	callq  *0xb98(%rbx)
   0x0000000001b11c51 <+209>:	mov    (%rsp),%rsi
   0x0000000001b11c55 <+213>:	mov    %r15,%rdi
   0x0000000001b11c58 <+216>:	callq  0x1b0de70 <_ZN7CowDataIcE6_unrefEPv.isra.0>
   0x0000000001b11c5d <+221>:	jmpq   0x1b11bab <VulkanContext::command_begin_label(VkCommandBuffer_T*, String, Color)+43>
   0x0000000001b11c62 <+226>:	callq  0x4083a0 <__stack_chk_fail@plt>
   0x0000000001b11c67 <+231>:	endbr64 
   0x0000000001b11c4b <+203>:	callq  *0xb98(%rbx)
(gdb) x/ag 0x7fffffffc118
0x7fffffffc118:	0x1b11c51 <VulkanContext::command_begin_label(VkCommandBuffer_T*, String, Color)+209>
(gdb) x/ag 0x7fffffffc118+0x08
0x7fffffffc120:	0x7ffffcf6e550
(gdb) x/ag 0x7fffffffc118-0x08
0x7fffffffc110:	0x7fffffffc120
(gdb) x/ag 0x7ffffcf6e550
0x7ffffcf6e550:	0x53207265646e6552
(gdb) x/cb 0x7ffffcf6e550
0x7ffffcf6e550:	82 'R'
(gdb) x/s 0x7ffffcf6e550
0x7ffffcf6e550:	"Render Setup"
(gdb) x/ag $rbx
0x7ffff8299380:	0x7426ae0 <vtable for VulkanContextX11+16>
(gdb) x/ag $rbx+0xb98
0x7ffff8299f18:	0x7ffff29f1aa0
(gdb) x/ag 0x7ffff29f1aa0
0x7ffff29f1aa0:	0x640a0ff078b48

Broken:

  • godot-v4--pr-build-22501--godot.linuxbsd.opt.tools.64
  • godot-v4--pr-build-21886--godot.linuxbsd.opt.tools.64

Works:

  • godot-v4--pr-build-21869--godot.linuxbsd.opt.tools.64

Related:

  • print_verbose("Using present mode: " + String(string_VkPresentModeKHR(window->presentMode)));

  • Error VulkanContext::initialize() {
    #ifdef USE_VOLK
    if (volkInitialize() != VK_SUCCESS) {
    return FAILED;
    }
    #endif
    Error err = _create_physical_device();
    if (err) {
    return err;
    }
    device_initialized = true;
    return OK;
    }

  • void VulkanContext::command_begin_label(VkCommandBuffer p_command_buffer, String p_label_name, const Color p_color) {
    if (!enabled_debug_utils) {
    return;
    }
    CharString cs = p_label_name.utf8().get_data();
    VkDebugUtilsLabelEXT label;
    label.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT;
    label.pNext = nullptr;
    label.pLabelName = cs.get_data();
    label.color[0] = p_color[0];
    label.color[1] = p_color[1];
    label.color[2] = p_color[2];
    label.color[3] = p_color[3];
    CmdBeginDebugUtilsLabelEXT(p_command_buffer, &label);
    }

@akien-mga
Copy link
Member

Note: While there is a message that says INTEL-MESA: warning: Haswell Vulkan support is incomplete my understanding is that it may be a warning message that was never updated when the support was completed. (Either way Godot still worked okay with the previous test binary.)

AFAIK Haswell Vulkan support in MESA has never been completed, so I think the warning is still accurate. It's unlikely that Godot's Vulkan renderer would be usable in production on Haswell, though it's still worth investigating what change triggered this issue.

@akien-mga akien-mga changed the title Crash (segfault) when opening/creating project Crash (segfault) when opening/creating project [Mesa Haswell] Sep 13, 2021
@follower
Copy link
Contributor Author

follower commented Oct 5, 2021

As mentioned on twitter I was able to get the editor to run (Godot Engine v4.0.dev.calinou.770a1d00a with debug symbols) by inserting a breakpoint with gdb at VulkanContext::command_begin_label:

break VulkanContext::command_begin_label

Then when it was hit first time, ran this:

set this->enabled_debug_utils = 0
disable 1
continue

The editor then ran without issue.

I was able to add a mesh, light & camera & then play the scene[0] (after the repeating the same steps for the new process).

From a quick look at the source history it seems this code was introduced in 7323cba ("Add named resources and debug labels in RenderDoc").

Will investigate further...

[0]
godot-v4-with-debug-disabled-Screenshot from 2021-10-06 01 30 14
godot-v4-pre-alpha-cylinder-editor-Screenshot from 2021-10-06 01 37 21
godot-v4-prealpha-cylinder-debug-disabled-Screenshot from 2021-10-06 01 52 51

@akien-mga akien-mga changed the title Crash (segfault) when opening/creating project [Mesa Haswell] Crash (segfault) when opening/creating project due to Vulkan debug utils [Mesa Haswell] Oct 5, 2021
@follower
Copy link
Contributor Author

follower commented Oct 5, 2021

My curiousity is piqued by this change:

7323cba#diff-3c95ffea6d81c05adea361b3206db7c6f12ff45f6876e25395eab944afcef2f9L254

@@ -251,9 +252,8 @@ Error VulkanContext::_initialize_extensions() {
 				}
 			}
 			if (!strcmp(VK_EXT_DEBUG_UTILS_EXTENSION_NAME, instance_extensions[i].extensionName)) {
-				if (use_validation_layers) {
-					extension_names[enabled_extension_count++] = VK_EXT_DEBUG_UTILS_EXTENSION_NAME;
-				}
+				extension_names[enabled_extension_count++] = VK_EXT_DEBUG_UTILS_EXTENSION_NAME;
+				enabled_debug_utils = true;
 			}
 			if (enabled_extension_count >= MAX_EXTENSIONS) {
 				free(instance_extensions);
@@ -436,7 +436,7 @@ Error VulkanContext::_create_physical_device() {
 			" extension.\n\nDo you have a compatible Vulkan installable client driver (ICD) installed?\n"
 			"vkCreateInstance Failure");
 
-	if (use_validation_layers) {
+	if (enabled_debug_utils) {
 		// Setup VK_EXT_debug_utils function pointers always (we use them for
 		// debug labels and names).
 		CreateDebugUtilsMessengerEXT =

I think this is the specific commit (770a1d00a) of the build I'm using: https://github.com/godotengine/godot/blame/770a1d00a3b14c4abd1cd57c9621de93b24478aa/drivers/vulkan/vulkan_context.cpp

https://github.com/godotengine/godot/tree/770a1d00a3b14c4abd1cd57c9621de93b24478aa

Potentially related: #45656

Unfortunately I've never been able to enable --vk-layers because it spews too much output, even if I send it to /dev/null...

@follower
Copy link
Contributor Author

follower commented Oct 5, 2021

Additional notes...

Backtrace from immediately before crash:

gef>  bt
#0  0x00007ffff2c2aaa3 in ?? () from /usr/lib/x86_64-linux-gnu/libvulkan.so.1
#1  0x00000000035e7439 in VulkanContext::command_begin_label (this=0xa1be640, p_command_buffer=0xa52c140, p_label_name=..., p_color=...) at drivers/vulkan/vulkan_context.cpp:2144

Which is within CmdBeginDebugUtilsLabelEXT:

gef> print (this->CmdBeginDebugUtilsLabelEXT)
$27 = (PFN_vkCmdBeginDebugUtilsLabelEXT) 0x7ffff2c2aaa0
gef> print *(this->CmdBeginDebugUtilsLabelEXT)
$26 = {void (VkCommandBuffer, const VkDebugUtilsLabelEXT *)} 0x7ffff2c2aaa0
gef>  xinfo 0x00007ffff2c2aaa0
───────────────────────────────────────────────────────────────── xinfo: 0x7ffff2c2aaa0 ─────────────────────────────────────────────────────────────────
Page: 0x00007ffff2c1c0000x00007ffff2c6a000 (size=0x4e000)
Permissions: r-x
Pathname: /usr/lib/x86_64-linux-gnu/libvulkan.so.1.1.70
Offset (from page): 0xeaa0
Inode: 10095548
Segment: .text (0x00007ffff2c29fd0-0x00007ffff2c596f9)
Offset (from segment): 0xad0

Crash occurs after retrieving value at [rax+0x640] (which is 0) jmp QWORD PTR [rax+0x640]:

gef>  disassemble 0x7ffff2c2aaa0,+32
Dump of assembler code from 0x7ffff2c2aaa0 to 0x7ffff2c2aac0:
   0x00007ffff2c2aaa0:  mov    rax,QWORD PTR [rdi]
   0x00007ffff2c2aaa3:  jmp    QWORD PTR [rax+0x640]
   0x00007ffff2c2aaa9:  nop    DWORD PTR [rax+0x0]
   0x00007ffff2c2aab0:  mov    rax,QWORD PTR [rdi]
   0x00007ffff2c2aab3:  jmp    QWORD PTR [rax+0x648]
   0x00007ffff2c2aab9:  nop    DWORD PTR [rax+0x0]
End of assembler dump.

Which, if I remember the ABI correctly, is derived from the command buffer argument:

[...]
gef> frame 1
[...]
gef>  print p_command_buffer
$28 = (VkCommandBuffer) 0xa52c140

[TODO]

[...]
gef>  frame 0
#0  0x00007ffff2c2aaa3 in ?? () from /usr/lib/x86_64-linux-gnu/libvulkan.so.1
gef>  print $rdi
$33 = 0xa52c140
gef>  disassemble $rip,+4
Dump of assembler code from 0x7ffff2c2aaa3 to 0x7ffff2c2aaa7:
=> 0x00007ffff2c2aaa3:  jmp    QWORD PTR [rax+0x640]
End of assembler dump.
gef>  print $rax+0x640
$37 = 0xa415d60
gef>  x/xg $rax+0x640
0xa415d60:      0x0000000000000000

@clayjohn
Copy link
Member

clayjohn commented Oct 5, 2021

Looks like it may be a combination of 7323cba and our recent move to the Volk loader. My guess is the way we initialize the EXT_debug_utils extension conflicts with Volk on some drivers resulting in the function pointers not being appropriately loaded.

Relevant issue in Volk can probably help us find a solution: zeux/volk#59

@follower
Copy link
Contributor Author

follower commented Oct 5, 2021

Full backtrace from the binary with debug symbols...

gef>  bt
#0  0x00007ffff2c2aaa3 in ?? () from /usr/lib/x86_64-linux-gnu/libvulkan.so.1
#1  0x00000000035e7439 in VulkanContext::command_begin_label (this=0xa1be640, p_command_buffer=0xa52c140, p_label_name=..., p_color=...) at drivers/vulkan/vulkan_context.cpp:2144
#2  0x000000000358e39b in RenderingDeviceVulkan::draw_command_begin_label (this=0xa413d00, p_label_name=..., p_color=...) at drivers/vulkan/rendering_device_vulkan.cpp:8493
#3  0x00000000057ef60e in RendererSceneRenderImplementation::RenderForwardClustered::_render_scene (this=0xa8e9fd0, p_render_data=0x7fffffffc4e0, p_default_bg_color=...) at servers/rendering/renderer_rd/forward_clustered/render_forward_clustered.cpp:1266
#4  0x0000000005741539 in RendererSceneRenderRD::render_scene (this=0xa8e9fd0, p_render_buffers=..., p_camera_data=0x7fffffffcc60, p_instances=..., p_lights=..., p_reflection_probes=..., p_voxel_gi_instances=..., p_decals=..., p_lightmaps=..., p_environment=..., p_camera_effects=..., p_shadow_atlas=..., p_occluder_debug_tex=..., p_reflection_atlas=..., p_reflection_probe=..., p_reflection_probe_pass=0xffffffff, p_screen_lod_threshold=0.0009765625, p_render_shadows=0xa5a0b08, p_render_shadow_count=0x0, p_render_sdfgi_regions=0xa5a8b10, p_render_sdfgi_region_count=0x0, p_sdfgi_update_data=0xa5a9050, r_render_info=0xbc6e090) at servers/rendering/renderer_rd/renderer_scene_render_rd.cpp:4172
#5  0x00000000058f5184 in RendererSceneCull::_render_scene (this=0xa59faf0, p_camera_data=0x7fffffffcc60, p_render_buffers=..., p_environment=..., p_force_camera_effects=..., p_visible_layers=0xfffff, p_scenario=..., p_viewport=..., p_shadow_atlas=..., p_reflection_probe=..., p_reflection_probe_pass=0xffffffff, p_screen_lod_threshold=0.0009765625, p_using_shadows=0x1, r_render_info=0xbc6e090) at servers/rendering/renderer_scene_cull.cpp:3091
#6  0x00000000058f0c52 in RendererSceneCull::render_camera (this=0xa59faf0, p_render_buffers=..., p_camera=..., p_scenario=..., p_viewport=..., p_viewport_size=..., p_screen_lod_threshold=0.0009765625, p_shadow_atlas=..., p_xr_interface=..., r_render_info=0xbc6e090) at servers/rendering/renderer_scene_cull.cpp:2436
#7  0x0000000005918d7b in RendererViewport::_draw_3d (this=0xa59fa50, p_viewport=0xbc6df90) at servers/rendering/renderer_viewport.cpp:98
#8  0x0000000005919359 in RendererViewport::_draw_viewport (this=0xa59fa50, p_viewport=0xbc6df90, p_view_count=0x1) at servers/rendering/renderer_viewport.cpp:151
#9  0x000000000591bc54 in RendererViewport::draw_viewports (this=0xa59fa50) at servers/rendering/renderer_viewport.cpp:583
#10 0x0000000005681ece in RenderingServerDefault::_draw (this=0xa56eca0, p_swap_buffers=0x1, frame_step=0.86606300000000003) at servers/rendering/rendering_server_default.cpp:94
#11 0x0000000005683b38 in RenderingServerDefault::draw (this=0xa56eca0, p_swap_buffers=0x1, frame_step=0.86606300000000003) at servers/rendering/rendering_server_default.cpp:376
#12 0x0000000002172a29 in Main::iteration () at main/main.cpp:2559
#13 0x0000000002132d30 in OS_LinuxBSD::run (this=0x7fffffffd770) at platform/linuxbsd/os_linuxbsd.cpp:342
#14 0x000000000212f434 in main (argc=0x5, argv=0x7fffffffdc58) at platform/linuxbsd/godot_linuxbsd.cpp:58

The command buffer appears to be via:

void RenderingDeviceVulkan::draw_command_begin_label(String p_label_name, const Color p_color) {
context->command_begin_label(frames[frame].draw_command_buffer, p_label_name, p_color);
}

Where frame relates to [Edited: Fix link.]:

Frame *frames = nullptr; //frames available, for main device they are cycled (usually 3), for local devices only 1
int frame = 0; //current frame
int frame_count = 0; //total amount of frames
uint64_t frames_drawn = 0;
RID local_device;
bool local_device_processing = false;

(Side note, I noticed this PR also changed f20999f code around the area: f20999f#diff-3c95ffea6d81c05adea361b3206db7c6f12ff45f6876e25395eab944afcef2f9R1628 / #45672)

(Unfortunately all the PR test builds from around this time have expired...)

@follower
Copy link
Contributor Author

follower commented Oct 5, 2021

@clayjohn Thanks for taking a look.

That timing seems consistent with the PR builds that work/don't work.

[Edit: Add below...]

Works:

Doesn't work:

@follower
Copy link
Contributor Author

follower commented Oct 7, 2021

Additional observations (based on 4.0.dev.calinou.2e8cba0bd which has debug symbols included):

  • If I break in VulkanContext::_create_physical_device() at drivers/vulkan/vulkan_context.cpp:631:

    629             if (_use_validation_layers()) {
    630                     _get_preferred_validation_layers(&inst_info.enabledLayerCount, &inst_info.ppEnabledLayerNames);
    631             }

    And then manually call __get_preferred_validation_layers:

    gef>  print _get_preferred_validation_layers(&inst_info.enabledLayerCount, &inst_info.ppEnabledLayerNames)
    WARNING: Can't find layer: VK_LAYER_KHRONOS_validation
         at: _check_layers (drivers/vulkan/vulkan_context.cpp:207)
    $1 = OK

    And then continue then the project will eventually load & run after spewing out a bunch of validation warnings.

  • I eventually discovered/was reminded why redirecting stderr/stdout to /dev/null didn't seem to make any difference...Godot was still creating a log in the user data folder due to project settings set to always log to file on desktop!

    So, I turned off that option.

    The most recent log that had been created was half a gigabyte in size!

  • With no logs being generated on disk this command (redirecting error & output to /dev/null) would eventually load & play the project:

    $ ./godot-v4-linux-nightly-debug-symbols-2021-10-06 --vk-layers --path /<path>/vulk-play-gg/ > /dev/null 2>&1
  • However, the same approach for the editor didn't work because even with stdout/stderr redirection & after leaving it start for a non-trivial amount of time the editor didn't start before occupying enough (~2GB?) of virtual memory to make this 8GB laptop start to struggle.

@follower
Copy link
Contributor Author

follower commented Oct 7, 2021

So, based on what I've observed, it seems that the issue does arise (at least in part) from not calling _get_preferred_validation_layers() which seems to do whatever initialisation is required:

Error VulkanContext::_get_preferred_validation_layers(uint32_t *count, const char *const **names) {
static const std::vector<std::vector<const char *>> instance_validation_layers_alt{
// Preferred set of validation layers
{ "VK_LAYER_KHRONOS_validation" },
// Alternative (deprecated, removed in SDK 1.1.126.0) set of validation layers
{ "VK_LAYER_LUNARG_standard_validation" },
// Alternative (deprecated, removed in SDK 1.1.121.1) set of validation layers
{ "VK_LAYER_GOOGLE_threading", "VK_LAYER_LUNARG_parameter_validation", "VK_LAYER_LUNARG_object_tracker", "VK_LAYER_LUNARG_core_validation", "VK_LAYER_GOOGLE_unique_objects" }
};
// Clear out-arguments
*count = 0;
if (names != nullptr) {
*names = nullptr;
}
VkResult err;
uint32_t instance_layer_count;
err = vkEnumerateInstanceLayerProperties(&instance_layer_count, nullptr);
if (err) {
ERR_FAIL_V(ERR_CANT_CREATE);
}
if (instance_layer_count < 1) {
return OK;
}
VkLayerProperties *instance_layers = (VkLayerProperties *)malloc(sizeof(VkLayerProperties) * instance_layer_count);
err = vkEnumerateInstanceLayerProperties(&instance_layer_count, instance_layers);
if (err) {
free(instance_layers);
ERR_FAIL_V(ERR_CANT_CREATE);
}
for (uint32_t i = 0; i < instance_validation_layers_alt.size(); i++) {
if (_check_layers(instance_validation_layers_alt[i].size(), instance_validation_layers_alt[i].data(), instance_layer_count, instance_layers)) {
*count = instance_validation_layers_alt[i].size();
if (names != nullptr) {
*names = instance_validation_layers_alt[i].data();
}
break;
}
}
free(instance_layers);
return OK;
}

It would be good to know why the equivalent of --vk-layers needs to be supplied in my case but not on other systems.

(Stab in the dark here, but could it be related to configuration of implicit layers: https://vulkan.lunarg.com/doc/view/1.2.189.0/linux/layer_configuration.html? Also, looking at that page suggests some possibilities for reducing the log spam which I might look into.)

Where to from here?

Potential future actions to take from here:

  • At a minimum it does seem like the functionality that's causing the issue would be best to be behind debug-related command line switch because it's not essential to game functionality. (Enhancement?)

  • Additionally, it would seem that the current code flow doesn't ensure that whatever layer initialization is required is performed before use. (Bug?)

  • Finally, due to the amount of output from validation layers if the debug label functionality can be enabled separately from validation it seems like that may be a better default approach. (Enhancement?)

@follower
Copy link
Contributor Author

follower commented Oct 7, 2021

In terms of the content of the half gigabyte godot.log file, it seems that of the 1,257,186 VALIDATION messages it contains, there are 1,256,776 that mention is aliased with linear buffer 0x0. An example full message is:

WARNING: VALIDATION - Message Id Number: 3 | Message Id Name: MEM
        Non-linear image 0x21 is aliased with linear buffer 0x0 which may indicate a bug. For further info refer to the Buffer-Image Granularity section of the Vulkan specification. (https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#resources-bufferimagegranularity)

[Edit: The link (with a (semi-)working id fragment without a closing parenthesis is: https://www.khronos.org/registry/vulkan/specs/1.0-extensions/xhtml/vkspec.html#resources-bufferimagegranularity]

@follower
Copy link
Contributor Author

follower commented Oct 7, 2021

FWIW, after setting a breakpoint on VulkanContext::_debug_messenger_callback() I found the first occurrence of the "aliased with linear buffer 0x0" error has the backtrace:

#0  0x00007fffea0bc2cb in ?? () from /usr/lib/x86_64-linux-gnu/libVkLayer_core_validation.so
#1  0x00007fffea0bce51 in ?? () from /usr/lib/x86_64-linux-gnu/libVkLayer_core_validation.so
#2  0x00007fffea0eb084 in ?? () from /usr/lib/x86_64-linux-gnu/libVkLayer_core_validation.so
#3  0x00007fffe98ddf87 in ?? () from /usr/lib/x86_64-linux-gnu/libVkLayer_parameter_validation.so
#4  0x00007fffe964809f in ?? () from /usr/lib/x86_64-linux-gnu/libVkLayer_threading.so
#5  0x00000000033b96c4 in VmaDeviceMemoryBlock::Map (this=0xa72a870, hAllocator=0xa760410, count=0x1, ppData=0x7fffffffc588) at thirdparty/vulkan/vk_mem_alloc.h:12767
#6  0x00000000033c6111 in VmaAllocator_T::Map (this=0xa760410, hAllocation=0xa77d240, ppData=0x7fffffffc6f8) at thirdparty/vulkan/vk_mem_alloc.h:17734
#7  0x00000000033c91c4 in vmaMapMemory (allocator=0xa760410, allocation=0xa77d240, ppData=0x7fffffffc6f8) at thirdparty/vulkan/vk_mem_alloc.h:19105
#8  0x00000000032f720b in RenderingDeviceVulkan::_texture_update (this=0xa646740, p_texture=..., p_layer=0x0, p_data=..., p_post_barrier=0x7, p_use_setup_queue=0x1) at drivers/vulkan/rendering_device_vulkan.cpp:2401
#9  0x00000000032f4f47 in RenderingDeviceVulkan::texture_create (this=0xa646740, p_format=..., p_view=..., p_data=...) at drivers/vulkan/rendering_device_vulkan.cpp:2042
#10 0x00000000055be4d2 in RendererStorageRD::RendererStorageRD (this=0xa7f3930) at servers/rendering/renderer_rd/renderer_storage_rd.cpp:9328
#11 0x000000000553f47e in RendererCompositorRD::RendererCompositorRD (this=0xa1361c0) at servers/rendering/renderer_rd/renderer_compositor_rd.cpp:281
#12 0x000000000215da30 in RendererCompositorRD::_create_current () at ./servers/rendering/renderer_rd/renderer_compositor_rd.h:112
#13 0x00000000054384b9 in RendererCompositor::create () at servers/rendering/renderer_compositor.cpp:40
#14 0x000000000549b2a5 in RenderingServerDefault::RenderingServerDefault (this=0xa7afc90, p_create_thread=0x0) at servers/rendering/rendering_server_default.cpp:398
#15 0x00000000021749e9 in Main::setup2 (p_main_tid_override=0x0) at main/main.cpp:1556
#16 0x00000000021728ee in Main::setup (execpath=0x7fffffffdf69 "/<path>/godot-v4-linux-nightly-debug-symbols-2021-10-06", argc=0x4, argv=0x7fffffffdbc0, p_second_phase=0x1) at main/main.cpp:1410
#17 0x000000000213ad3c in main (argc=0x5, argv=0x7fffffffdbb8) at platform/linuxbsd/godot_linuxbsd.cpp:51

Also, at one point I noticed the following warning:

Warning: Unrecognized CreateInstance->pCreateInfo->pApplicationInfo.apiVersion number -- (0x  402083) assuming VK_API_VERSION_1_1.

@follower
Copy link
Contributor Author

follower commented Oct 7, 2021

Device vs driver Vulkan version support

Okay, this is interesting, it turns out the warning message is via the parameter validation layer and 0x402083 corresponds to Vulkan version 1.2.131.

On this laptop the output of vulkaninfo includes the following:

===========
VULKAN INFO
===========

Vulkan Instance Version: 1.1.70

[...]

Layers: count = 6
=======
VK_LAYER_LUNARG_parameter_validation (LunarG Validation Layer) Vulkan version 1.1.70, layer version 1
        Layer Extensions        count = 1
                VK_EXT_debug_report                 : extension revision  6
        Devices         count = 1
                GPU id       : 0 (Intel(R) HD Graphics 4400 (HSW GT2))
                Layer-Device Extensions count = 1
                        VK_EXT_debug_marker                 : extension revision  4

[...]

Device Properties and Extensions :
==================================
GPU0
VkPhysicalDeviceProperties:
===========================
        apiVersion     = 0x402083  (1.2.131)
        driverVersion  = 83886088 (0x5000008)
        vendorID       = 0x8086
        deviceID       = 0x0a16
        deviceType     = INTEGRATED_GPU
        deviceName     = Intel(R) HD Graphics 4400 (HSW GT2)

[...]

And apt list '*vulkan*' outputs:

Listing... Done
libvulkan-dev/bionic-updates,now 1.1.70+dfsg1-1ubuntu0.18.04.1 amd64 [installed]
libvulkan1/bionic-updates,now 1.1.70+dfsg1-1ubuntu0.18.04.1 amd64 [installed,automatic]
mesa-vulkan-drivers/bionic-updates,now 20.0.8-0ubuntu1~18.04.1 amd64 [installed]
vulkan-utils/bionic-updates,now 1.1.70+dfsg1-1ubuntu0.18.04.1 amd64 [installed]

So, as I understand it, the GPU is capable of supporting 1.2.131 but the validation layers are only from 1.1.70 so don't recognize the higher version number.

Results with Vulkan SDK version 1.2.182.0

At this point I remembered I had a relatively recent Vulkan SDK lying around from some other rabbit hole I got stuck in... :D

So I setup the SDK environment with:

$ source /<path>/vulkan-sdk-1.2.182.0/setup-env.sh

Then ran Godot with:

$ ./godot-v4-linux-nightly-debug-symbols-2021-10-06 --path /<path>/vulk-play-gg

And it ran without a crash!

Partial output:

Godot Engine v4.0.dev.calinou.2e8cba0bd - https://godotengine.org
[...]
INTEL-MESA: warning: Haswell Vulkan support is incomplete
Vulkan API 1.2.182 - Using Vulkan Device #0: Intel - Intel(R) HD Graphics 4400 (HSW GT2)
[...]

It also didn't output any validation warnings...so, that suggests the validation layers still weren't enabled/active? Although I did notice that are in the explicit_layers.d directory referenced by the setup:

$ ls /<path>/vulkan-sdk-1.2.182.0/x86_64/etc/vulkan/explicit_layer.d/
VkLayer_api_dump.json           VkLayer_gfxreconstruct.json            VkLayer_khronos_validation.json  VkLayer_screenshot.json
VkLayer_device_simulation.json  VkLayer_khronos_synchronization2.json  VkLayer_monitor.json

What is the impact of this?

So... this suggests the crash is dependent on the Vulkan version installed and at some point something changed to deal with issue silently? Which is probably why other people haven't run into this yet?

This seems positive in terms of being able to work around the issue at least...

But this probably means the code would still benefit from initialization related robustness improvements.

@follower
Copy link
Contributor Author

follower commented Oct 7, 2021

In the interest of "completeness" I note that the output with --vk-layers enabled with the more recent SDK version is also different, running this:

$ ./godot-v4-linux-nightly-debug-symbols-2021-10-06 --vk-layers --path /<path>/vulk-play-gg

Results in output that includes:

Godot Engine v4.0.dev.calinou.2e8cba0bd - https://godotengine.org

[...]

INTEL-MESA: warning: Haswell Vulkan support is incomplete
Vulkan API 1.2.182 - Using Vulkan Device #0: Intel - Intel(R) HD Graphics 4400 (HSW GT2)

[...]

ERROR: VALIDATION - Message Id Number: 188609398 | Message Id Name: VUID-vkCmdDispatch-magFilter-04553
        Validation Error: [ VUID-vkCmdDispatch-magFilter-04553 ] Object 0: handle = 0xe6ba7d0000000b3a, type = VK_OBJECT_TYPE_DESCRIPTOR_SET; Object 1: handle = 0x6f994100000004b5, name = Default Linear Sampler, type = VK_OBJECT_TYPE_SAMPLER; Object 2: handle = 0x422856000000085f, type = VK_OBJECT_TYPE_IMAGE_VIEW; | MessageID = 0xb3df376 | Descriptor set VkDescriptorSet 0xe6ba7d0000000b3a[] encountered the following validation error at vkCmdDispatch() time:Sampler (VkSampler 0x6f994100000004b5[Default Linear Sampler]) is set to use VK_FILTER_LINEAR with compareEnable is set to VK_TRUE, but image view's (VkImageView 0x422856000000085f[]) format (VK_FORMAT_D24_UNORM_S8_UINT) does not contain VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT in its format features. The Vulkan spec states: If a VkSampler created with magFilter or minFilter equal to VK_FILTER_LINEAR and compareEnable equal to VK_FALSE is used to sample a VkImageView as a result of this command, then the image view's format features must contain VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT (https://vulkan.lunarg.com/doc/view/1.2.182.0/linux/1.2-extensions/vkspec.html#VUID-vkCmdDispatch-magFilter-04553)
        Objects - 3
                Object[0] - VK_OBJECT_TYPE_DESCRIPTOR_SET, Handle -1821005660364469446
                Object[1] - VK_OBJECT_TYPE_SAMPLER, Handle 8041530077902537909, Name "Default Linear Sampler"
                Object[2] - VK_OBJECT_TYPE_IMAGE_VIEW, Handle 4767154763571660895
   at: _debug_messenger_callback (drivers/vulkan/vulkan_context.cpp:157)

With the error message repeated multiple times but AFAICT no other errors mentioned.

@follower
Copy link
Contributor Author

follower commented Oct 7, 2021

After testing that the project ran okay, I then tested the more recent SDK setup with the editor (as there seems a difference between those two scenarios in general).

Running the editor via this command:

$ ./godot-v4-linux-nightly-debug-symbols-2021-10-06 --path /<path>/vulk-play-gg --editor

Resulted in quite a long pause but then the editor eventually opened.

Partial output included:

Godot Engine v4.0.dev.calinou.2e8cba0bd - https://godotengine.org

[...]

INTEL-MESA: warning: Haswell Vulkan support is incomplete
Vulkan API 1.2.182 - Using Vulkan Device #0: Intel - Intel(R) HD Graphics 4400 (HSW GT2)

[...]

Editor as it appears after opening:

godot-editor-running-with-vulkan-sdk-1_2_182-Screenshot from 2021-10-08 04 08 11

@follower
Copy link
Contributor Author

follower commented Oct 7, 2021

Subsequent testing suggests that the VUID-vkCmdDispatch-magFilter-04553 errors on startup are specifically connected to the 3D scene--if I specify a different scene (UI with only a couple of Control nodes) to open, then the validation errors do not get generated.

@follower
Copy link
Contributor Author

follower commented Oct 7, 2021

And, as a final data point (for now :) ) if I rerun these tests (using the more recent 1.2.182 SDK driver) with the most pre-alpha release this all started with (Godot Engine v4.0.dev.20211004.official.2e8cba0bd), the startup times are significantly reduced, so it seems the debug symbols are responsible for some non-trivial portion of the long startup times observed previously.

(Lol, oh dear, but when I hovered over the "Scene" menu title & it gets highlighted the pre-alpha version outputs a bunch of validation errors which the nightly version with debug symbols doesn't--so hopefully it was just a temporary issue which has already been fixed, right..? :D )

@follower
Copy link
Contributor Author

follower commented Oct 7, 2021

It turns out that the 1.2.182 SDK driver also enables the win64 Godot v4 pre-alpha to (~somewhat/mostly[0]) run (both play & editor) under Wine again now too:

godot-v4-prealpha-via-wine--Screenshot from 2021-10-08 09 20 21

So, that's handy...

[0] The original 3D test scene I was using did crash but a simplified 3D scene worked okay.

$ wine --version
wine-6.0.1
$ wine /<path>/Godot_v4.0-dev.20211004_win64.exe --path "/<path>/.wine/dosdevices/z:/<path>/vulk-play-gg" --editor --verbose Node3DTest_recovered.tscn
INTEL-MESA: warning: Haswell Vulkan support is incomplete
TextServer: Added interface "ICU / HarfBuzz / Graphite"
Godot Engine v4.0.dev.20211004.official.2e8cba0bd - https://godotengine.org
INTEL-MESA: warning: Haswell Vulkan support is incomplete
Vulkan API 1.2.0 - Using Vulkan Device #0: Intel - Intel(R) HD Graphics 4400 (HSW GT2)
[...]

@Calinou
Copy link
Member

Calinou commented Nov 19, 2022

@follower Can you (or anyone else) still reproduce this bug in Godot 4.0.beta5 or any later release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants