google / filament

Filament is a real-time physically based rendering engine for Android, iOS, Windows, Linux, macOS, and WebGL2
https://google.github.io/filament/
Apache License 2.0
17.84k stars 1.9k forks source link

`gltf_viewer` segfault on Linux w/ Intel and Vulkan. #6192

Closed will-ca closed 1 year ago

will-ca commented 2 years ago

Describe the bug bin/gltf_viewer from the official releases page segfaults on launch for me on Linux, and also with a fresh build.

https://github.com/google/filament/releases

To Reproduce Steps to reproduce the behavior:

  1. Download and extract filament-v1.28.0-linux.tgz OR build from source according to the instructions.
  2. Try to run bin/gltf_viewer (./out/cmake-release/samples/gltf_viewer).
  3. Observe window pop up, followed by segfault before any draw calls.

Expected behavior The application gltf_viewer should run and not crash.

Logs

Terminal:

$ ./bin/gltf_viewer 
FEngine (64 bits) created at 0x36ff8f0 (threading is enabled)
FEngine resolved backend: Vulkan
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0
Vulkan device driver: Intel open-source Mesa driver Mesa 22.1.7
Selected physical device 'Intel(R) UHD Graphics 620 (KBL GT2)' from 1 physical devices. (vendor 0x8086, device 0x5917, driver 0x5801007, api 1.3)
FEngine feature level: 1
The specified IBL path does not exist: /home/User/filament/bin/assets/ibl/lightroom_14b
vkCreateSwapchain: 1024x640, 50, 0, 4, 1

Segmentation fault (core dumped)

GDB output and backtrace, if that helps?

$ gdb -ex=r --args ./bin/gltf_viewer 
GNU gdb (GDB) 12.1
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./bin/gltf_viewer...
(No debugging symbols found in ./bin/gltf_viewer)
Starting program: /home/User/filament/bin/gltf_viewer 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7fffec1256c0 (LWP 253203)]
[New Thread 0x7fffeb9246c0 (LWP 253204)]
[New Thread 0x7fffeb1236c0 (LWP 253205)]
[New Thread 0x7fffea9226c0 (LWP 253206)]
[New Thread 0x7fffea1216c0 (LWP 253207)]
[New Thread 0x7fffe99206c0 (LWP 253208)]
[New Thread 0x7fffe911f6c0 (LWP 253209)]
[New Thread 0x7fffe88de6c0 (LWP 253210)]
[Thread 0x7fffe88de6c0 (LWP 253210) exited]
[New Thread 0x7fffe88de6c0 (LWP 253211)]
[Thread 0x7fffe88de6c0 (LWP 253211) exited]
[New Thread 0x7fffe88de6c0 (LWP 253212)]
[New Thread 0x7fffca9fb6c0 (LWP 253213)]
[New Thread 0x7fffca1fa6c0 (LWP 253214)]
[New Thread 0x7fffc99f96c0 (LWP 253215)]
[New Thread 0x7fffc91f86c0 (LWP 253216)]
[New Thread 0x7fffc89f76c0 (LWP 253217)]
FEngine (64 bits) created at 0x1f15960 (threading is enabled)
[New Thread 0x7fffc3fff6c0 (LWP 253218)]
FEngine resolved backend: Vulkan
[New Thread 0x7fffc37fe6c0 (LWP 253219)]
[New Thread 0x7fffc18d76c0 (LWP 253221)]
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0
Vulkan device driver: Intel open-source Mesa driver Mesa 22.1.7
Selected physical device 'Intel(R) UHD Graphics 620 (KBL GT2)' from 1 physical devices. (vendor 0x8086, device 0x5917, driver 0x5801007, api 1.3)
FEngine feature level: 1
The specified IBL path does not exist: /home/User/filament/bin/assets/ibl/lightroom_14b
[New Thread 0x7fff9d9f26c0 (LWP 253222)]
vkCreateSwapchain: 1024x640, 50, 0, 4, 1

Thread 17 "FEngine::loop" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffc3fff6c0 (LWP 253218)]
0x00007fffc2173d5b in ?? () from /usr/lib/libvulkan_intel.so
(gdb) 
(gdb) bt
#0  0x00007fffc2173d5b in ?? () from /usr/lib/libvulkan_intel.so
#1  0x0000000000aefb3a in filament::backend::ConcreteDispatcher<filament::backend::VulkanDriver>::pushGroupMarker(filament::backend::Driver&, filament::backend::CommandBase*, long*) ()
#2  0x0000000000adb33b in std::__1::__function::__func<filament::backend::CommandStream::execute(void*)::$_0, std::__1::allocator<filament::backend::CommandStream::execute(void*)::$_0>, void ()>::operator()() ()
#3  0x0000000000adbb90 in filament::backend::Driver::execute(std::__1::function<void ()> const&) ()
#4  0x0000000000adb0a0 in filament::backend::CommandStream::execute(void*) ()
#5  0x0000000000a92b10 in filament::FEngine::execute() ()
#6  0x0000000000a906f0 in filament::FEngine::loop() ()
#7  0x0000000000a93d09 in void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, int (filament::FEngine::*)(), filament::FEngine*> >(void*) ()
#8  0x00007ffff7d1c74d in ?? () from /usr/lib/libc.so.6
#9  0x00007ffff7d9e700 in ?? () from /usr/lib/libc.so.6
(gdb) 

Desktop (please complete the following information):

Additional context

Tested: Releases for 1.28, 1.27.2, 1.27.1, 1.26.0, and 1.28 sources.

will-ca commented 2 years ago

Huh. Happens even with fresh build... Same backtrace, looks like.

prideout commented 2 years ago

Thanks for the report! This is a crash in the Intel driver and will be difficult to diagnose on my end since I cannot repro. If you build Filament yourself in a debug configuration, it will try to find the Vulkan validation layers which might give us more info.

Another interesting thing try is ./gltf_viewer -a opengl, which selects our OpenGL driver, which might be a bit more robust with Intel drivers. Since you seem to be only vaguely aware that the Vulkan backend is what's being used by default, I'm guessing you'd be okay with OpenGL. :)

will-ca commented 2 years ago

Cool. OpenGL should work for me for now. Thanks.

As for the debug build:

$ ./gltf_viewer 
FEngine (64 bits) created at 0x55a243ffbdb0 (threading is enabled)
FEngine resolved backend: Vulkan
MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0
Vulkan device driver: Intel open-source Mesa driver Mesa 22.1.7
Selected physical device 'Intel(R) UHD Graphics 620 (KBL GT2)' from 1 physical devices. (vendor 0x8086, device 0x5917, driver 0x5801007, api 1.3)
FEngine feature level: 1
Requested linear format but KTX contains a sRGB format. 
Requested linear format but KTX contains a sRGB format. 
Texture Decoder has 6 background threads.
vkCreateSwapchain: 1024x640, VK_FORMAT_B8G8R8A8_SRGB, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, 4, 1

VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-ClearValueWithoutLoadOpClear) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-ClearValueWithoutLoadOpClear ] Object 0: handle = 0x7f505c8fb5e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6beca064 | This render pass does not have VkRenderPassCreateInfo.pAttachments->loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR but VkRenderPassBeginInfo.clearValueCount > 0. VkRenderPassBeginInfo.pClearValues will be ignored and no attachments will be cleared.

VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-ClearValueWithoutLoadOpClear) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-ClearValueWithoutLoadOpClear ] Object 0: handle = 0x7f505c8fb5e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6beca064 | This render pass does not have VkRenderPassCreateInfo.pAttachments->loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR but VkRenderPassBeginInfo.clearValueCount > 0. VkRenderPassBeginInfo.pClearValues will be ignored and no attachments will be cleared.

VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-ClearValueWithoutLoadOpClear) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-ClearValueWithoutLoadOpClear ] Object 0: handle = 0x7f505c8fb5e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6beca064 | This render pass does not have VkRenderPassCreateInfo.pAttachments->loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR but VkRenderPassBeginInfo.clearValueCount > 0. VkRenderPassBeginInfo.pClearValues will be ignored and no attachments will be cleared.

VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-ClearValueWithoutLoadOpClear) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-ClearValueWithoutLoadOpClear ] Object 0: handle = 0x7f505c8fb5e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6beca064 | This render pass does not have VkRenderPassCreateInfo.pAttachments->loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR but VkRenderPassBeginInfo.clearValueCount > 0. VkRenderPassBeginInfo.pClearValues will be ignored and no attachments will be cleared.

Uninitialized texture bound to 'materialParams_baseColorMap' in material 'Material_MR' at binding point 9
Uninitialized texture bound to 'materialParams_metallicRoughnessMap' in material 'Material_MR' at binding point 10
Uninitialized texture bound to 'materialParams_normalMap' in material 'Material_MR' at binding point 11
Uninitialized texture bound to 'materialParams_occlusionMap' in material 'Material_MR' at binding point 12
Uninitialized texture bound to 'materialParams_emissiveMap' in material 'Material_MR' at binding point 13
VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad ] Object 0: handle = 0x7f505c8fb5e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x62f84330 | Trying to load an attachment with LOAD_OP_LOAD that was previously stored with STORE_OP_DONT_CARE. This may result in undefined behaviour.

VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad ] Object 0: handle = 0x7f505c8fb5e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x62f84330 | Trying to load an attachment with LOAD_OP_LOAD that was previously stored with STORE_OP_DONT_CARE. This may result in undefined behaviour.

VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad ] Object 0: handle = 0x7f505c8fb5e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x62f84330 | Trying to load an attachment with LOAD_OP_LOAD that was previously stored with STORE_OP_DONT_CARE. This may result in undefined behaviour.

VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad ] Object 0: handle = 0x7f505c8fb5e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x62f84330 | Trying to load an attachment with LOAD_OP_LOAD that was previously stored with STORE_OP_DONT_CARE. This may result in undefined behaviour.

VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad ] Object 0: handle = 0x7f505c8fb5e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x62f84330 | Trying to load an attachment with LOAD_OP_LOAD that was previously stored with STORE_OP_DONT_CARE. This may result in undefined behaviour.

VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad ] Object 0: handle = 0x7f505c8fb5e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x62f84330 | Trying to load an attachment with LOAD_OP_LOAD that was previously stored with STORE_OP_DONT_CARE. This may result in undefined behaviour.

VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad ] Object 0: handle = 0x7f505c8fb5e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x62f84330 | Trying to load an attachment with LOAD_OP_LOAD that was previously stored with STORE_OP_DONT_CARE. This may result in undefined behaviour.

VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad ] Object 0: handle = 0x7f505c8fb5e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x62f84330 | Trying to load an attachment with LOAD_OP_LOAD that was previously stored with STORE_OP_DONT_CARE. This may result in undefined behaviour.

VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad ] Object 0: handle = 0x7f505c8fb5e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x62f84330 | Trying to load an attachment with LOAD_OP_LOAD that was previously stored with STORE_OP_DONT_CARE. This may result in undefined behaviour.

VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad ] Object 0: handle = 0x7f505c8fb5e0, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x62f84330 | Trying to load an attachment with LOAD_OP_LOAD that was previously stored with STORE_OP_DONT_CARE. This may result in undefined behaviour.

Segmentation fault (core dumped)

(Note: I did not install the Vulkan validation layers until after the build. Seems fine?)

GDB for good measure, as I may not leave the multiple-gigabytes debug build around: ```Gdb $ gdb -ex=r --args ./gltf_viewer GNU gdb (GDB) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from ./gltf_viewer... Starting program: /tmp/transient/filament-1.28.0/out/cmake-debug/samples/gltf_viewer [Thread debugging using libthread_db enabled] Using host libthread_db library "/usr/lib/libthread_db.so.1". [New Thread 0x7fffec1326c0 (LWP 429928)] [New Thread 0x7fffeb9316c0 (LWP 429929)] [New Thread 0x7fffeb1306c0 (LWP 429930)] [New Thread 0x7fffea92f6c0 (LWP 429931)] [New Thread 0x7fffea12e6c0 (LWP 429932)] [New Thread 0x7fffe992d6c0 (LWP 429933)] [New Thread 0x7fffe912c6c0 (LWP 429934)] [New Thread 0x7fffe88eb6c0 (LWP 429935)] [Thread 0x7fffe88eb6c0 (LWP 429935) exited] [New Thread 0x7fffe88eb6c0 (LWP 429936)] [Thread 0x7fffe88eb6c0 (LWP 429936) exited] [New Thread 0x7fffe88eb6c0 (LWP 429937)] [New Thread 0x7fffca9fb6c0 (LWP 429938)] [New Thread 0x7fffca1fa6c0 (LWP 429939)] [New Thread 0x7fffc99f96c0 (LWP 429940)] [New Thread 0x7fffc91f86c0 (LWP 429941)] [New Thread 0x7fffc89f76c0 (LWP 429942)] FEngine (64 bits) created at 0x555559309ee0 (threading is enabled) [New Thread 0x7fffc3fff6c0 (LWP 429943)] FEngine resolved backend: Vulkan [New Thread 0x7fffc37fe6c0 (LWP 429944)] [New Thread 0x7fffc0ace6c0 (LWP 429951)] MESA-INTEL: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0 Vulkan device driver: Intel open-source Mesa driver Mesa 22.1.7 Selected physical device 'Intel(R) UHD Graphics 620 (KBL GT2)' from 1 physical devices. (vendor 0x8086, device 0x5917, driver 0x5801007, api 1.3) FEngine feature level: 1 Requested linear format but KTX contains a sRGB format. Requested linear format but KTX contains a sRGB format. Texture Decoder has 6 background threads. [New Thread 0x7fffb17fd6c0 (LWP 429957)] vkCreateSwapchain: 1024x640, VK_FORMAT_B8G8R8A8_SRGB, VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, 4, 1 VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-ClearValueWithoutLoadOpClear) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-ClearValueWithoutLoadOpClear ] Object 0: handle = 0x7fffc48fb290, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6beca064 | This render pass does not have VkRenderPassCreateInfo.pAttachments->loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR but VkRenderPassBeginInfo.clearValueCount > 0. VkRenderPassBeginInfo.pClearValues will be ignored and no attachments will be cleared. VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-ClearValueWithoutLoadOpClear) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-ClearValueWithoutLoadOpClear ] Object 0: handle = 0x7fffc48fb290, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6beca064 | This render pass does not have VkRenderPassCreateInfo.pAttachments->loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR but VkRenderPassBeginInfo.clearValueCount > 0. VkRenderPassBeginInfo.pClearValues will be ignored and no attachments will be cleared. VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-ClearValueWithoutLoadOpClear) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-ClearValueWithoutLoadOpClear ] Object 0: handle = 0x7fffc48fb290, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6beca064 | This render pass does not have VkRenderPassCreateInfo.pAttachments->loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR but VkRenderPassBeginInfo.clearValueCount > 0. VkRenderPassBeginInfo.pClearValues will be ignored and no attachments will be cleared. VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-ClearValueWithoutLoadOpClear) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-ClearValueWithoutLoadOpClear ] Object 0: handle = 0x7fffc48fb290, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x6beca064 | This render pass does not have VkRenderPassCreateInfo.pAttachments->loadOp == VK_ATTACHMENT_LOAD_OP_CLEAR but VkRenderPassBeginInfo.clearValueCount > 0. VkRenderPassBeginInfo.pClearValues will be ignored and no attachments will be cleared. Uninitialized texture bound to 'materialParams_baseColorMap' in material 'Material_MR' at binding point 9 Uninitialized texture bound to 'materialParams_metallicRoughnessMap' in material 'Material_MR' at binding point 10 Uninitialized texture bound to 'materialParams_normalMap' in material 'Material_MR' at binding point 11 Uninitialized texture bound to 'materialParams_occlusionMap' in material 'Material_MR' at binding point 12 Uninitialized texture bound to 'materialParams_emissiveMap' in material 'Material_MR' at binding point 13 VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad ] Object 0: handle = 0x7fffc48fb290, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x62f84330 | Trying to load an attachment with LOAD_OP_LOAD that was previously stored with STORE_OP_DONT_CARE. This may result in undefined behaviour. VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad ] Object 0: handle = 0x7fffc48fb290, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x62f84330 | Trying to load an attachment with LOAD_OP_LOAD that was previously stored with STORE_OP_DONT_CARE. This may result in undefined behaviour. VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad ] Object 0: handle = 0x7fffc48fb290, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x62f84330 | Trying to load an attachment with LOAD_OP_LOAD that was previously stored with STORE_OP_DONT_CARE. This may result in undefined behaviour. VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad ] Object 0: handle = 0x7fffc48fb290, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x62f84330 | Trying to load an attachment with LOAD_OP_LOAD that was previously stored with STORE_OP_DONT_CARE. This may result in undefined behaviour. VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad ] Object 0: handle = 0x7fffc48fb290, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x62f84330 | Trying to load an attachment with LOAD_OP_LOAD that was previously stored with STORE_OP_DONT_CARE. This may result in undefined behaviour. VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad ] Object 0: handle = 0x7fffc48fb290, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x62f84330 | Trying to load an attachment with LOAD_OP_LOAD that was previously stored with STORE_OP_DONT_CARE. This may result in undefined behaviour. VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad ] Object 0: handle = 0x7fffc48fb290, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x62f84330 | Trying to load an attachment with LOAD_OP_LOAD that was previously stored with STORE_OP_DONT_CARE. This may result in undefined behaviour. VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad ] Object 0: handle = 0x7fffc48fb290, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x62f84330 | Trying to load an attachment with LOAD_OP_LOAD that was previously stored with STORE_OP_DONT_CARE. This may result in undefined behaviour. VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad ] Object 0: handle = 0x7fffc48fb290, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x62f84330 | Trying to load an attachment with LOAD_OP_LOAD that was previously stored with STORE_OP_DONT_CARE. This may result in undefined behaviour. VULKAN WARNING: (UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad) Validation Warning: [ UNASSIGNED-BestPractices-vkCmdBeginRenderPass-StoreOpDontCareThenLoadOpLoad ] Object 0: handle = 0x7fffc48fb290, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0x62f84330 | Trying to load an attachment with LOAD_OP_LOAD that was previously stored with STORE_OP_DONT_CARE. This may result in undefined behaviour. Thread 17 "FEngine::loop" received signal SIGSEGV, Segmentation fault. [Switching to Thread 0x7fffc3fff6c0 (LWP 429943)] 0x00007fffc2173d5b in ?? () from /usr/lib/libvulkan_intel.so (gdb) (gdb) (gdb) (gdb) bt #0 0x00007fffc2173d5b in ?? () from /usr/lib/libvulkan_intel.so #1 0x00007fffc0ec58c5 in DispatchCmdBeginDebugUtilsLabelEXT (pLabelInfo=0x7fffc3ffe898, commandBuffer=0x7fffc501cf20) at /build/vulkan-validation-layers/src/Vulkan-ValidationLayers-sdk-1.3.224.1/layers/generated/layer_chassis_dispatch.cpp:8084 #2 vulkan_layer_chassis::CmdBeginDebugUtilsLabelEXT (commandBuffer=0x7fffc501cf20, pLabelInfo=0x7fffc3ffe898) at /build/vulkan-validation-layers/src/Vulkan-ValidationLayers-sdk-1.3.224.1/layers/generated/chassis.cpp:10036 #3 0x00005555568b287c in filament::backend::VulkanDriver::pushGroupMarker (this=0x7fffc4000b90, string=0x55555806b76e "Finish Color Passes", len=0) at /tmp/transient/filament-1.28.0/filament/backend/src/vulkan/VulkanDriver.cpp:1523 #4 0x00005555568db2d1 in filament::backend::invoke(void (filament::backend::VulkanDriver::*)(char const*, unsigned int), filament::backend::VulkanDriver&, char const*&&, unsigned int&&) ( m=(void (filament::backend::VulkanDriver::*)(filament::backend::VulkanDriver * const, const char *, unsigned int)) 0x5555568b27b0 , d=..., args=@0x7fffcae050c0: 0, args=@0x7fffcae050c0: 0) at /tmp/transient/filament-1.28.0/filament/backend/include/private/backend/CommandStream.h:91 #5 0x00005555568db217 in filament::backend::trampoline, 0ul, 1ul> ( m=@0x7fffc3ffea78: (void (filament::backend::VulkanDriver::*)(filament::backend::VulkanDriver * const, const char *, unsigned int)) 0x5555568b27b0 , d=..., t=...) at /tmp/transient/filament-1.28.0/filament/backend/include/private/backend/CommandStream.h:96 #6 0x00005555568db177 in filament::backend::apply > ( m=@0x7fffc3ffea78: (void (filament::backend::VulkanDriver::*)(filament::backend::VulkanDriver * const, const char *, unsigned int)) 0x5555568b27b0 , d=..., t=...) at /tmp/transient/filament-1.28.0/filament/backend/include/private/backend/CommandStream.h:101 #7 0x00005555568b279b in filament::backend::CommandType::Command<&filament::backend::Driver::pushGroupMarker>::execute ( method=@0x7fffc3ffea78: (void (filament::backend::VulkanDriver::*)(filament::backend::VulkanDriver * const, const char *, unsigned int)) 0x5555568b27b0 , driver=..., base=0x7fffcae050b0, next=0x7fffc3ffeac0) at /tmp/transient/filament-1.28.0/filament/backend/include/private/backend/CommandStream.h:141 #8 0x00005555568ac631 in filament::backend::ConcreteDispatcher::pushGroupMarker (driver=..., base=0x7fffcae050b0, next=0x7fffc3ffeac0) at /tmp/transient/filament-1.28.0/filament/backend/include/private/backend/DriverAPI.inc:428 #9 0x0000555556855852 in filament::backend::CommandBase::execute (this=0x7fffcae050b0, driver=...) at /tmp/transient/filament-1.28.0/filament/backend/include/private/backend/CommandStream.h:75 #10 0x0000555556855718 in filament::backend::CommandStream::execute(void*)::$_0::operator()() const ( this=0x7fffc3ffecd8) at /tmp/transient/filament-1.28.0/filament/backend/src/CommandStream.cpp:90 #11 0x00005555568556b5 in std::__1::__invoke(filament::backend::CommandStream::execute(void*)::$_0&) (__f=...) at /usr/bin/../include/c++/v1/type_traits:3640 #12 0x000055555685566d in std::__1::__invoke_void_return_wrapper::__call(filament::backend::CommandStream::execute(void*)::$_0&) (__args=...) at /usr/bin/../include/c++/v1/__functional/invoke.h:61 #13 0x000055555685563d in std::__1::__function::__alloc_func, void ()>::operator()() ( this=0x7fffc3ffecd8) at /usr/bin/../include/c++/v1/__functional/function.h:180 #14 0x0000555556854599 in std::__1::__function::__func for more, q to quit, c to continue without paging--c ::__1::allocator, void ()>::operator()() (this=0x7fffc3ffecd0) at /usr/bin/../include/c++/v1/__functional/function.h:354 #15 0x00005555556d6002 in std::__1::__function::__value_func::operator()() const (this=0x7fffc3ffecd0) at /usr/bin/../include/c++/v1/__functional/function.h:507 #16 0x00005555556d2205 in std::__1::function::operator()() const (this=0x7fffc3ffecd0) at /usr/bin/../include/c++/v1/__functional/function.h:1184 #17 0x0000555556856449 in filament::backend::Driver::execute(std::__1::function const&) (this=0x7fffc4000b90, fn=...) at /tmp/transient/filament-1.28.0/filament/backend/src/Driver.cpp:204 #18 0x0000555556853dc5 in filament::backend::CommandStream::execute (this=0x55555930a968, buffer=0x7fffcae04f10) at /tmp/transient/filament-1.28.0/filament/backend/src/CommandStream.cpp:86 #19 0x00005555567664eb in filament::FEngine::execute (this=0x555559309ee0) at /tmp/transient/filament-1.28.0/filament/src/details/Engine.cpp:1049 #20 0x0000555556762f14 in filament::FEngine::loop (this=0x555559309ee0) at /tmp/transient/filament-1.28.0/filament/src/details/Engine.cpp:645 #21 0x000055555676de79 in std::__1::__invoke(int (filament::FEngine::*&&)(), filament::FEngine*&&) (__f=@0x5555593097e8: (int (filament::FEngine::*)(filament::FEngine * const)) 0x555556762da0 , __a0=@0x5555593097f8: 0x555559309ee0) at /usr/bin/../include/c++/v1/type_traits:3565 #22 0x000055555676ddbe in std::__1::__thread_execute >, int (filament::FEngine::*)(), filament::FEngine*, 2ul> (__t=...) at /usr/bin/../include/c++/v1/thread:282 #23 0x000055555676d72f in std::__1::__thread_proxy >, int (filament::FEngine::*)(), filament::FEngine*> > (__vp=0x5555593097e0) at /usr/bin/../include/c++/v1/thread:293 #24 0x00007ffff7d2a8fd in ?? () from /usr/lib/libc.so.6 #25 0x00007ffff7daca60 in ?? () from /usr/lib/libc.so.6 (gdb) ```

Vulkan Intel Mesa driver: 22.1.7-1.

prideout commented 2 years ago

I think the warnings are probably a separate issue from the segfault.

IMO, both the warnings and the segfault should be investigated. However the segfault will be hard to diagnose without a repro, which likely requires a Linux machine with a Mesa setup.

poweifeng commented 1 year ago

I was able to repro and noticed the same warnings. In setting mContext.debugUtilsSupported = false, both the segfault and warnings go away. Makes me think that they might be the same issue.

poweifeng commented 1 year ago

I was able to make the validation warnings go away, but did not solve the segfault.

I end up building RADV (mesa's radeon vulkan driver) and got the following more detailed stack

0x00007fffbc589369 in vk_common_CmdBeginDebugUtilsLabelEXT (_commandBuffer=0x7fffb05fcd50, pLabelInfo=<optimized out>) at ../src/util/u_dynarray.h:163
163        return p;
(gdb) bt
#0  0x00007fffbc589369 in vk_common_CmdBeginDebugUtilsLabelEXT (_commandBuffer=0x7fffb05fcd50, pLabelInfo=<optimized out>) at ../src/util/u_dynarray.h:163
#1  0x000055555676523b in filament::backend::VulkanDriver::pushGroupMarker (this=0x7fffb0000b90, string=0x555557f560fe "Finish Color Passes", len=0) at /home/powei/work2/filament/filament/backend/src/vulkan/VulkanDriver.cpp:1577
#2  0x000055555678a661 in filament::backend::invoke<filament::backend::VulkanDriver, void (char const*, unsigned int), filament::backend::VulkanDriver&, char const*, unsigned int>(void (filament::backend::VulkanDriver::*)(char const*, unsigned int), filament::backend::VulkanDriver&, char const*&&, unsigned int&&) (
    m=(void (filament::backend::VulkanDriver::*)(filament::backend::VulkanDriver * const, const char *, unsigned int)) 0x555556765100 <filament::backend::VulkanDriver::pushGroupMarker(char const*, unsigned int)>, d=..., args=@0x7fffd3409130: 0, args=@0x7fffd3409130: 0) at /home/powei/work2/filament/filament/backend/include/private/backend/CommandStream.h:91
#3  0x000055555678a5a7 in filament::backend::trampoline<void (filament::backend::VulkanDriver::*)(char const*, unsigned int), filament::backend::VulkanDriver&, std::__1::tuple<char const*, unsigned int>, 0ul, 1ul> (m=@0x7fffbf7f5a10: (void (filament::backend::VulkanDriver::*)(filament::backend::VulkanDriver * const, const char *, unsigned int)) 0x555556765100 <filament::backend::VulkanDriver::pushGroupMarker(char const*, unsigned int)>, 
    d=..., t=...) at /home/powei/work2/filament/filament/backend/include/private/backend/CommandStream.h:96
#4  0x000055555678a507 in filament::backend::apply<void (filament::backend::VulkanDriver::*)(char const*, unsigned int), filament::backend::VulkanDriver&, std::__1::tuple<char const*, unsigned int> > (m=@0x7fffbf7f5a10: (void (filament::backend::VulkanDriver::*)(filament::backend::VulkanDriver * const, const char *, unsigned int)) 0x555556765100 <filament::backend::VulkanDriver::pushGroupMarker(char const*, unsigned int)>, d=..., t=...)
    at /home/powei/work2/filament/filament/backend/include/private/backend/CommandStream.h:101
#5  0x00005555567650eb in filament::backend::CommandType<void (filament::backend::Driver::*)(char const*, unsigned int)>::Command<&filament::backend::Driver::pushGroupMarker>::execute<void (filament::backend::VulkanDriver::*)(char const*, unsigned int), filament::backend::VulkanDriver&> (
    method=@0x7fffbf7f5a10: (void (filament::backend::VulkanDriver::*)(filament::backend::VulkanDriver * const, const char *, unsigned int)) 0x555556765100 <filament::backend::VulkanDriver::pushGroupMarker(char const*, unsigned int)>, driver=..., base=0x7fffd3409120, next=0x7fffbf7f5a58) at /home/powei/work2/filament/filament/backend/include/private/backend/CommandStream.h:141
#6  0x000055555675f784 in filament::backend::ConcreteDispatcher<filament::backend::VulkanDriver>::pushGroupMarker (driver=..., base=0x7fffd3409120, next=0x7fffbf7f5a58) at /home/powei/work2/filament/filament/backend/include/private/backend/DriverAPI.inc:431
#7  0x0000555556710535 in filament::backend::CommandBase::execute (this=0x7fffd3409120, driver=...) at /home/powei/work2/filament/filament/backend/include/private/backend/CommandStream.h:75
#8  0x0000555556710408 in filament::backend::CommandStream::execute(void*)::$_0::operator()() const (this=0x7fffbf7f5c78) at /home/powei/work2/filament/filament/backend/src/CommandStream.cpp:90
#9  0x00005555567103a5 in std::__1::__invoke<filament::backend::CommandStream::execute(void*)::$_0&>(filament::backend::CommandStream::execute(void*)::$_0&) (__f=...) at /usr/lib/llvm-14/bin/../include/c++/v1/type_traits:3640
#10 0x000055555671035d in std::__1::__invoke_void_return_wrapper<void, true>::__call<filament::backend::CommandStream::execute(void*)::$_0&>(filament::backend::CommandStream::execute(void*)::$_0&) (__args=...) at /usr/lib/llvm-14/bin/../include/c++/v1/__functional/invoke.h:61
#11 0x000055555671032d in std::__1::__function::__alloc_func<filament::backend::CommandStream::execute(void*)::$_0, std::__1::allocator<filament::backend::CommandStream::execute(void*)::$_0>, void ()>::operator()() (this=0x7fffbf7f5c78) at /usr/lib/llvm-14/bin/../include/c++/v1/__functional/function.h:180
#12 0x000055555670f449 in std::__1::__function::__func<filament::backend::CommandStream::execute(void*)::$_0, std::__1::allocator<filament::backend::CommandStream::execute(void*)::$_0>, void ()>::operator()() (this=0x7fffbf7f5c70) at /usr/lib/llvm-14/bin/../include/c++/v1/__functional/function.h:354
#13 0x00005555556c99b2 in std::__1::__function::__value_func<void ()>::operator()() const (this=0x7fffbf7f5c70) at /usr/lib/llvm-14/bin/../include/c++/v1/__functional/function.h:507
#14 0x00005555556c6065 in std::__1::function<void ()>::operator()() const (this=0x7fffbf7f5c70) at /usr/lib/llvm-14/bin/../include/c++/v1/__functional/function.h:1184
#15 0x0000555556710fc9 in filament::backend::Driver::execute(std::__1::function<void ()> const&) (this=0x7fffb0000b90, fn=...) at /home/powei/work2/filament/filament/backend/src/Driver.cpp:204
#16 0x000055555670ed69 in filament::backend::CommandStream::execute (this=0x555559164528, buffer=0x7fffd3408f80) at /home/powei/work2/filament/filament/backend/src/CommandStream.cpp:86
#17 0x00005555566327bb in filament::FEngine::execute (this=0x555559163aa0) at /home/powei/work2/filament/filament/src/details/Engine.cpp:1049
#18 0x000055555662f687 in filament::FEngine::loop (this=0x555559163aa0) at /home/powei/work2/filament/filament/src/details/Engine.cpp:645
#19 0x0000555556639509 in std::__1::__invoke<int (filament::FEngine::*)(), filament::FEngine*, , void>(int (filament::FEngine::*&&)(), filament::FEngine*&&) (__f=@0x5555592e7468: (int (filament::FEngine::*)(filament::FEngine * const)) 0x55555662f520 <filament::FEngine::loop()>, __a0=@0x5555592e7478: 0x555559163aa0) at /usr/lib/llvm-14/bin/../include/c++/v1/type_traits:3565
#20 0x000055555663944e in std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, int (filament::FEngine::*)(), filament::FEngine*, 2ul> (__t=...) at /usr/lib/llvm-14/bin/../include/c++/v1/thread:282
#21 0x0000555556638e02 in std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, int (filament::FEngine::*)(), filament::FEngine*> > (__vp=0x5555592e7460) at /usr/lib/llvm-14/bin/../include/c++/v1/thread:293
#22 0x00007ffff7c8784a in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#23 0x00007ffff7d0b2cc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

where src/util/u_dynarray.h is in mesa.

poweifeng commented 1 year ago

Still seeing this issue across multiple platforms (macOs and Android).

The issue here is that vkCmdEndDebugUtilsLabelEXT expects that a label was "pushed" onto the command queue (as described in the spec). It is possible to push labels across command buffers, but the pushed label must still be in the queue (unexecuted) when End is called. This implies that we need to make sure the labels are in a good state (all popped) when vkQueueSubmit is called.

poweifeng commented 1 year ago

Validation error looks like:

VULKAN ERROR: (VUID-vkCmdEndDebugUtilsLabelEXT-commandBuffer-01912) Validation Error: [ VUID-vkCmdEndDebugUtilsLabelEXT-commandBuffer-01912 ] Object 0: handle = 0x7fca9f4e2328, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x56146426 | vkCmdEndDebugUtilsLabelEXT() called without a corresponding vkCmdBeginDebugUtilsLabelEXT first The Vulkan spec states: There must be an outstanding vkCmdBeginDebugUtilsLabelEXT command prior to the vkCmdEndDebugUtilsLabelEXT on the queue that commandBuffer is submitted to (https://vulkan.lunarg.com/doc/view/1.3.243.0/mac/1.3-extensions/vkspec.html#VUID-vkCmdEndDebugUtilsLabelEXT-commandBuffer-01912)
poweifeng commented 1 year ago

Fixed in https://github.com/google/filament/pull/6904