Qt-5.14.0: Vulkan under QML causes std::system_error:: mutex lock failed
Qt-5.14.0: Vulkan under QML causes std::system_error:: mutex lock failed
Vulkan under QML 示例 运行s 最多几秒钟后崩溃并出现以下错误:
libc++abi.dylib: terminating with uncaught exception of type std::__1::system_error: mutex lock failed: Invalid argument
虽然动画在运行过程中看起来是正确的,但 QML 标签显示不正确:
我正在 运行使用 MoltenVK 1.1.130 (LunarG Vulkan SDK) 和 Qt 5.14.0 安装 macOS Catalina。我也试过 MoltenVK 1.2.131,结果相同。在启用 MVK_LOG_LEVEL_INFO
的情况下使用 MoltenVK 时,以下消息每帧 打印两次 :
[mvk-info] vkCreateMacOSSurfaceMVK(): You are not calling this function from the main thread. NSView should only be accessed from the main thread. When using this function outside the main thread, consider passing the CAMetalLayer itself in VkMacOSSurfaceCreateInfoMVK::pView, instead of the NSView.
问题
有人知道是什么原因造成的吗?这是一个错误吗?有人运行这个例子成功了吗?
尽管 Qt 的 Vulkan 集成被破坏,但 MVK 错误消息使它看起来像:vkCreateMacOSSurfaceMVK
不仅每帧 调用两次 ,而且似乎还从渲染线程调用(不是 GUI thread/main 线程)。
详情
为了将 Qt 与 Vulkan 一起使用,您必须从源代码编译 Qt 并提供 Vulkan 头文件。我用来编译Qt的配置调用是:
../qt5/configure -developer-build -skip qtquick3d -skip qtwebengine -opensource -nomake examples -nomake tests -confirm-license -vulkan -I $VULKAN_SDK/../MoltenVK/include -L $VULKAN_SDK/lib
我的环境变量是根据 LunarG 文档设置的:
export VULKAN_SDK="$HOME/SDK/vulkansdk-macos-1.1.130.0/macOS"
export PATH="$VULKAN_SDK/bin:$PATH"
export DYLD_LIBRARY_PATH="$VULKAN_SDK/lib:$DYLD_LIBRARY_PATH"
export VK_ICD_FILENAMES="$VULKAN_SDK/etc/vulkan/icd.d/MoltenVK_icd.json"
export VK_LAYER_PATH="$VULKAN_SDK/etc/vulkan/explicit_layer.d"
export VK_INSTANCE_LAYERS="VK_LAYER_KHRONOS_validation"
export QT_VULKAN_LIB="$VULKAN_SDK/lib/libMoltenVK.dylib"
(Qt 需要 QT_VULKAN_LIB
到 dlopen
库。)
lldb 回溯:
[mvk-info] vkCreateMacOSSurfaceMVK(): You are not calling this function from the main thread. NSView should only be accessed from the main thread. When using this function outside the main thread, consider passing the CAMetalLayer itself in VkMacOSSurfaceCreateInfoMVK::pView, instead of the NSView.
[mvk-info] vkCreateMacOSSurfaceMVK(): You are not calling this function from the main thread. NSView should only be accessed from the main thread. When using this function outside the main thread, consider passing the CAMetalLayer itself in VkMacOSSurfaceCreateInfoMVK::pView, instead of the NSView.
libc++abi.dylib: terminating with uncaught exception of type std::__1::system_error: mutex lock failed: Invalid argument
Process 83453 stopped
* thread #10, name = 'QSGRenderThread', stop reason = signal SIGABRT
frame #0: 0x00007fff648c57fa libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
-> 0x7fff648c57fa <+10>: jae 0x7fff648c5804 ; <+20>
0x7fff648c57fc <+12>: movq %rax, %rdi
0x7fff648c57ff <+15>: jmp 0x7fff648bfa89 ; cerror_nocancel
0x7fff648c5804 <+20>: retq
Target 0: (main) stopped.
(lldb) frame info
frame #0: 0x00007fff648c57fa libsystem_kernel.dylib`__pthread_kill + 10
(lldb) frame variable
(lldb) bt
* thread #10, name = 'QSGRenderThread', stop reason = signal SIGABRT
* frame #0: 0x00007fff648c57fa libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x00007fff64982bc1 libsystem_pthread.dylib`pthread_kill + 432
frame #2: 0x00007fff6484ca1c libsystem_c.dylib`abort + 120
frame #3: 0x00007fff618e6be8 libc++abi.dylib`abort_message + 231
frame #4: 0x00007fff618e6d84 libc++abi.dylib`demangling_terminate_handler() + 238
frame #5: 0x00007fff63412792 libobjc.A.dylib`_objc_terminate() + 104
frame #6: 0x00007fff618f3dc7 libc++abi.dylib`std::__terminate(void (*)()) + 8
frame #7: 0x00007fff618f3d79 libc++abi.dylib`std::terminate() + 41
frame #8: 0x0000000103942439 libQt5Core_debug.5.dylib`qTerminate() at qglobal.cpp:3333:5
frame #9: 0x000000010341f5f8 libQt5Core_debug.5.dylib`QThreadPrivate::start(arg=0x000000011721cfb0) at qthread_unix.cpp:354:9
frame #10: 0x00007fff64982e65 libsystem_pthread.dylib`_pthread_start + 148
frame #11: 0x00007fff6497e83b libsystem_pthread.dylib`thread_start + 15
我已报告问题:QTBUG-82600
该修复已合并到 Qt 5.15.0 beta2 中。虽然不再发生崩溃,但文本仍然被损坏。该问题的修复推迟到 Qt6:QTBUG-83072
Vulkan under QML 示例 运行s 最多几秒钟后崩溃并出现以下错误:
libc++abi.dylib: terminating with uncaught exception of type std::__1::system_error: mutex lock failed: Invalid argument
虽然动画在运行过程中看起来是正确的,但 QML 标签显示不正确:
我正在 运行使用 MoltenVK 1.1.130 (LunarG Vulkan SDK) 和 Qt 5.14.0 安装 macOS Catalina。我也试过 MoltenVK 1.2.131,结果相同。在启用 MVK_LOG_LEVEL_INFO
的情况下使用 MoltenVK 时,以下消息每帧 打印两次 :
[mvk-info] vkCreateMacOSSurfaceMVK(): You are not calling this function from the main thread. NSView should only be accessed from the main thread. When using this function outside the main thread, consider passing the CAMetalLayer itself in VkMacOSSurfaceCreateInfoMVK::pView, instead of the NSView.
问题
有人知道是什么原因造成的吗?这是一个错误吗?有人运行这个例子成功了吗?
尽管 Qt 的 Vulkan 集成被破坏,但 MVK 错误消息使它看起来像:vkCreateMacOSSurfaceMVK
不仅每帧 调用两次 ,而且似乎还从渲染线程调用(不是 GUI thread/main 线程)。
详情
为了将 Qt 与 Vulkan 一起使用,您必须从源代码编译 Qt 并提供 Vulkan 头文件。我用来编译Qt的配置调用是:
../qt5/configure -developer-build -skip qtquick3d -skip qtwebengine -opensource -nomake examples -nomake tests -confirm-license -vulkan -I $VULKAN_SDK/../MoltenVK/include -L $VULKAN_SDK/lib
我的环境变量是根据 LunarG 文档设置的:
export VULKAN_SDK="$HOME/SDK/vulkansdk-macos-1.1.130.0/macOS"
export PATH="$VULKAN_SDK/bin:$PATH"
export DYLD_LIBRARY_PATH="$VULKAN_SDK/lib:$DYLD_LIBRARY_PATH"
export VK_ICD_FILENAMES="$VULKAN_SDK/etc/vulkan/icd.d/MoltenVK_icd.json"
export VK_LAYER_PATH="$VULKAN_SDK/etc/vulkan/explicit_layer.d"
export VK_INSTANCE_LAYERS="VK_LAYER_KHRONOS_validation"
export QT_VULKAN_LIB="$VULKAN_SDK/lib/libMoltenVK.dylib"
(Qt 需要 QT_VULKAN_LIB
到 dlopen
库。)
lldb 回溯:
[mvk-info] vkCreateMacOSSurfaceMVK(): You are not calling this function from the main thread. NSView should only be accessed from the main thread. When using this function outside the main thread, consider passing the CAMetalLayer itself in VkMacOSSurfaceCreateInfoMVK::pView, instead of the NSView.
[mvk-info] vkCreateMacOSSurfaceMVK(): You are not calling this function from the main thread. NSView should only be accessed from the main thread. When using this function outside the main thread, consider passing the CAMetalLayer itself in VkMacOSSurfaceCreateInfoMVK::pView, instead of the NSView.
libc++abi.dylib: terminating with uncaught exception of type std::__1::system_error: mutex lock failed: Invalid argument
Process 83453 stopped
* thread #10, name = 'QSGRenderThread', stop reason = signal SIGABRT
frame #0: 0x00007fff648c57fa libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
-> 0x7fff648c57fa <+10>: jae 0x7fff648c5804 ; <+20>
0x7fff648c57fc <+12>: movq %rax, %rdi
0x7fff648c57ff <+15>: jmp 0x7fff648bfa89 ; cerror_nocancel
0x7fff648c5804 <+20>: retq
Target 0: (main) stopped.
(lldb) frame info
frame #0: 0x00007fff648c57fa libsystem_kernel.dylib`__pthread_kill + 10
(lldb) frame variable
(lldb) bt
* thread #10, name = 'QSGRenderThread', stop reason = signal SIGABRT
* frame #0: 0x00007fff648c57fa libsystem_kernel.dylib`__pthread_kill + 10
frame #1: 0x00007fff64982bc1 libsystem_pthread.dylib`pthread_kill + 432
frame #2: 0x00007fff6484ca1c libsystem_c.dylib`abort + 120
frame #3: 0x00007fff618e6be8 libc++abi.dylib`abort_message + 231
frame #4: 0x00007fff618e6d84 libc++abi.dylib`demangling_terminate_handler() + 238
frame #5: 0x00007fff63412792 libobjc.A.dylib`_objc_terminate() + 104
frame #6: 0x00007fff618f3dc7 libc++abi.dylib`std::__terminate(void (*)()) + 8
frame #7: 0x00007fff618f3d79 libc++abi.dylib`std::terminate() + 41
frame #8: 0x0000000103942439 libQt5Core_debug.5.dylib`qTerminate() at qglobal.cpp:3333:5
frame #9: 0x000000010341f5f8 libQt5Core_debug.5.dylib`QThreadPrivate::start(arg=0x000000011721cfb0) at qthread_unix.cpp:354:9
frame #10: 0x00007fff64982e65 libsystem_pthread.dylib`_pthread_start + 148
frame #11: 0x00007fff6497e83b libsystem_pthread.dylib`thread_start + 15
我已报告问题:QTBUG-82600
该修复已合并到 Qt 5.15.0 beta2 中。虽然不再发生崩溃,但文本仍然被损坏。该问题的修复推迟到 Qt6:QTBUG-83072