Vulkan crash on linux after update


#1

I updated bsf from 26aa072676b2f1664db4017c5337b1680181b99d to c1325dfd242f1e9e71cafca3b4fc010c36af16e3

Now I get a crash like this when running with vulkan (opengl works fine):

Thread 50 "LeviathanEditor" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffef9999700 (LWP 21144)]
0x00007ffefb4e6642 in ?? () from /lib64/libnvidia-glcore.so.430.40
0  in ?? of /lib64/libnvidia-glcore.so.430.40
1  in ?? of /lib64/libnvidia-glcore.so.430.40
2  in ?? of /lib64/libnvidia-glcore.so.430.40
3  in bs::ct::VulkanGraphicsPipelineState::createPipeline of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Plugins/bsfVulkanRenderAPI/BsVulkanGpuPipelineState.cpp:482
4  in bs::ct::VulkanGraphicsPipelineState::getPipeline of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Plugins/bsfVulkanRenderAPI/BsVulkanGpuPipelineState.cpp:338
5  in bs::ct::VulkanCmdBuffer::bindGraphicsPipeline of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Plugins/bsfVulkanRenderAPI/BsVulkanDevice.h:40
6  in bs::ct::VulkanCmdBuffer::drawIndexed of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Plugins/bsfVulkanRenderAPI/BsVulkanCommandBuffer.cpp:1703
7  in bs::ct::VulkanRenderAPI::drawIndexed of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Plugins/bsfVulkanRenderAPI/BsVulkanRenderAPI.cpp:490
8  in bs::ct::RendererUtility::drawScreenQuad of /usr/include/c++/8/bits/shared_ptr_base.h:614
9  in bs::ct::BlitMat::execute of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Foundation/bsfUtility/Math/BsVector2I.h:22
10 in bs::ct::RendererUtility::blit of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Foundation/bsfEngine/Renderer/BsRendererUtility.cpp:297
11 in bs::ct::RCNodeSSAO::render of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Plugins/bsfRenderBeast/BsRenderCompositor.cpp:2311
12 in bs::ct::RenderCompositor::execute of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Plugins/bsfRenderBeast/BsRenderCompositor.cpp:175
13 in bs::ct::RenderBeast::renderView of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Plugins/bsfRenderBeast/BsRenderBeast.cpp:526
14 in bs::ct::RenderBeast::renderViews of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Plugins/bsfRenderBeast/BsRenderBeast.cpp:476
15 in bs::ct::RenderBeast::renderAllCore of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Plugins/bsfRenderBeast/BsRenderBeast.cpp:435
16 in std::function<void ()>::operator()() const of /usr/include/c++/8/bits/std_function.h:682
17 in bs::CommandQueueBase::playbackWithNotify(std::queue<bs::QueuedCommand, std::deque<bs::QueuedCommand, bs::StdAlloc<bs::QueuedCommand, bs::GenAlloc> > >*, std::function<void (unsigned int)>) of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Foundation/bsfCore/CoreThread/BsCommandQueue.cpp:126
18 in bs::CommandQueueBase::playback of /usr/include/c++/8/bits/std_function.h:395
19 in std::function<void ()>::operator()() const of /usr/include/c++/8/bits/std_function.h:682
20 in bs::CommandQueueBase::playbackWithNotify(std::queue<bs::QueuedCommand, std::deque<bs::QueuedCommand, bs::StdAlloc<bs::QueuedCommand, bs::GenAlloc> > >*, std::function<void (unsigned int)>) of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Foundation/bsfCore/CoreThread/BsCommandQueue.cpp:126
21 in bs::CoreThread::runCoreThread of /usr/include/c++/8/bits/std_function.h:87
22 in std::function<void ()>::operator()() const of /usr/include/c++/8/bits/std_function.h:682
23 in bs::PooledThread::run of /home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Foundation/bsfUtility/Threading/BsThreadPool.cpp:122
24 in ?? of /lib64/libstdc++.so.6
25 in start_thread of /lib64/libpthread.so.0
26 in clone of /lib64/libc.so.6

I have nvidia driver 430.40

Down grading the assets from version 27 to 26 makes it work again.

This is what bsf prints with the assets version 27 (the crash):

[WARNING] Cannot find texture parameter with the name: 'gSource'
		 in void bs::TGpuParams<Core>::getTextureParam(bs::GpuProgramType, const String&, bs::TGpuParamTexture<Core>&) const [with bool Core = true; bs::String = std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> >] [/home/hhyyrylainen/Projects/Leviathan/ThirdParty/bsf/Source/Foundation/bsfCore/RenderAPI/BsGpuParams.cpp:330]

[FATAL] A fatal error occurred and the program has to terminate!
  - Error: Segmentation fault
  - Description: Received fatal signal
  - In function: 
  - In file: :0

Stack trace: 
0) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsf.so.1: bs::CrashHandler::getStackTrace[abi:cxx11]()+0x1b9 [0x7fe9eadd19d9]
1) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsf.so.1: bs::CrashHandler::logErrorAndStackTrace(std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, unsigned int) const+0x323 [0x7fe9eadb4483]
2) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsf.so.1: bs::CrashHandler::reportCrash(std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, unsigned int) const+0x9 [0x7fe9eadd1479]
3) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsf.so.1: bs::signalHandler(int, siginfo_t*, void*)+0x10c [0x7fe9eadd159c]
4) /lib64/libpthread.so.0: +0x13070 [0x7fe9ea706070]
5) /lib64/libnvidia-glcore.so.430.40: +0x11bb642 [0x7fe92548d642]
6) /lib64/libnvidia-glcore.so.430.40: +0x11cbea2 [0x7fe92549dea2]
7) /lib64/libnvidia-glcore.so.430.40: +0x11d7dd0 [0x7fe9254a9dd0]
8) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsfVulkanRenderAPI.so: bs::ct::VulkanGraphicsPipelineState::createPipeline(unsigned int, bs::ct::VulkanRenderPass*, unsigned int, bs::DrawOperationType, std::shared_ptr<bs::ct::VulkanVertexInput> const&)+0x2c6 [0x7fe960471376]
9) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsfVulkanRenderAPI.so: bs::ct::VulkanGraphicsPipelineState::getPipeline(unsigned int, bs::ct::VulkanRenderPass*, unsigned int, bs::DrawOperationType, std::shared_ptr<bs::ct::VulkanVertexInput> const&)+0x101 [0x7fe960471d21]
10) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsfVulkanRenderAPI.so: bs::ct::VulkanCmdBuffer::bindGraphicsPipeline()+0xca [0x7fe96045128a]
11) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsfVulkanRenderAPI.so: bs::ct::VulkanCmdBuffer::drawIndexed(unsigned int, unsigned int, unsigned int, unsigned int)+0x61 [0x7fe960454601]
12) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsfVulkanRenderAPI.so: bs::ct::VulkanRenderAPI::drawIndexed(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, std::shared_ptr<bs::ct::CommandBuffer> const&)+0x34 [0x7fe960441944]
13) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsf.so.1: bs::ct::RendererUtility::drawScreenQuad(bs::Rect2 const&, bs::Vector2I const&, unsigned int, bool)+0x40b [0x7fe9eb39c10b]
14) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsf.so.1: bs::ct::BlitMat::execute(std::shared_ptr<bs::ct::Texture> const&, bs::Rect2 const&, bool)+0x27d [0x7fe9eb39f84d]
15) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsf.so.1: bs::ct::RendererUtility::blit(std::shared_ptr<bs::ct::Texture> const&, bs::Rect2I const&, bool, bool, bool)+0xac [0x7fe9eb3a076c]
16) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsfRenderBeast.so: bs::ct::RCNodeSSAO::render(bs::ct::RenderCompositorNodeInputs const&)+0x991 [0x7fe8e7bc1721]
17) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsfRenderBeast.so: bs::ct::RenderCompositor::execute(bs::ct::RenderCompositorNodeInputs&) const+0x25f [0x7fe8e7bc682f]
18) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsfRenderBeast.so: bs::ct::RenderBeast::renderView(bs::ct::RendererViewGroup const&, bs::ct::RendererView&, bs::ct::FrameInfo const&)+0x207 [0x7fe8e7b4e4e7]
19) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsfRenderBeast.so: bs::ct::RenderBeast::renderViews(bs::ct::RendererViewGroup&, bs::ct::FrameInfo const&)+0xea [0x7fe8e7b4f89a]
20) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsfRenderBeast.so: bs::ct::RenderBeast::renderAllCore(bs::ct::FrameTimings, bs::PerFrameData)+0x599 [0x7fe8e7b535e9]
21) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsf.so.1: bs::CommandQueueBase::playbackWithNotify(std::queue<bs::QueuedCommand, std::deque<bs::QueuedCommand, bs::StdAlloc<bs::QueuedCommand, bs::GenAlloc> > >*, std::function<void (unsigned int)>)+0x161 [0x7fe9eade4f81]
22) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsf.so.1: bs::CommandQueueBase::playback(std::queue<bs::QueuedCommand, std::deque<bs::QueuedCommand, bs::StdAlloc<bs::QueuedCommand, bs::GenAlloc> > >*)+0x1a [0x7fe9eade5c7a]
23) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsf.so.1: bs::CommandQueueBase::playbackWithNotify(std::queue<bs::QueuedCommand, std::deque<bs::QueuedCommand, bs::StdAlloc<bs::QueuedCommand, bs::GenAlloc> > >*, std::function<void (unsigned int)>)+0x161 [0x7fe9eade4f81]
24) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsf.so.1: bs::CoreThread::runCoreThread()+0x2bd [0x7fe9eadf155d]
25) /home/hhyyrylainen/Projects/Leviathan/build/bin/lib/libbsf.so.1: bs::PooledThread::run()+0x14c [0x7fe9ead6349c]
26) /lib64/libstdc++.so.6: +0xc39a3 [0x7fe9ea61e9a3]
27) /lib64/libpthread.so.0: +0x858e [0x7fe9ea6fb58e]
28) /lib64/libc.so.6: clone+0x43 [0x7fe9ea2f1713]

#2

Looks like when I try to run my game (instead of a basic test app, that renders one quad), I get this crash:

[FATAL] A fatal error occurred and the program has to terminate!
  - Error: Segmentation fault
  - Description: Received fatal signal
  - In function: 
  - In file: :0

Stack trace: 
0) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsf.so.1: bs::CrashHandler::getStackTrace[abi:cxx11]()+0x1b9 [0x7fd314a709d9]
1) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsf.so.1: bs::CrashHandler::logErrorAndStackTrace(std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, unsigned int) const+0x323 [0x7fd314a53483]
2) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsf.so.1: bs::CrashHandler::reportCrash(std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, std::__cxx11::basic_string<char, std::char_traits<char>, bs::StdAlloc<char, bs::GenAlloc> > const&, unsigned int) const+0x9 [0x7fd314a70479]
3) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsf.so.1: bs::signalHandler(int, siginfo_t*, void*)+0x10c [0x7fd314a7059c]
4) /lib64/libpthread.so.0: +0x13070 [0x7fd3143a5070]
5) /lib64/libnvidia-glcore.so.430.40: +0x11bb642 [0x7fd22a48f642]
6) /lib64/libnvidia-glcore.so.430.40: +0x11cbea2 [0x7fd22a49fea2]
7) /lib64/libnvidia-glcore.so.430.40: +0x11d7dd0 [0x7fd22a4abdd0]
8) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsfVulkanRenderAPI.so: bs::ct::VulkanGraphicsPipelineState::createPipeline(unsigned int, bs::ct::VulkanRenderPass*, unsigned int, bs::DrawOperationType, std::shared_ptr<bs::ct::VulkanVertexInput> const&)+0x2c6 [0x7fd2a0471376]
9) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsfVulkanRenderAPI.so: bs::ct::VulkanGraphicsPipelineState::getPipeline(unsigned int, bs::ct::VulkanRenderPass*, unsigned int, bs::DrawOperationType, std::shared_ptr<bs::ct::VulkanVertexInput> const&)+0x101 [0x7fd2a0471d21]
10) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsfVulkanRenderAPI.so: bs::ct::VulkanCmdBuffer::bindGraphicsPipeline()+0xca [0x7fd2a045128a]
11) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsfVulkanRenderAPI.so: bs::ct::VulkanCmdBuffer::drawIndexed(unsigned int, unsigned int, unsigned int, unsigned int)+0x61 [0x7fd2a0454601]
12) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsfVulkanRenderAPI.so: bs::ct::VulkanRenderAPI::drawIndexed(unsigned int, unsigned int, unsigned int, unsigned int, unsigned int, std::shared_ptr<bs::ct::CommandBuffer> const&)+0x34 [0x7fd2a0441944]
13) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsf.so.1: bs::ct::RendererUtility::draw(std::shared_ptr<bs::ct::MeshBase> const&, bs::SubMesh const&, unsigned int)+0x2ac [0x7fd31503a3bc]
14) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsfRenderBeast.so: bs::ct::RenderableElement::draw() const+0x10d [0x7fd20d01a96d]
15) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsfRenderBeast.so: bs::ct::renderQueueElements(std::vector<bs::ct::RenderQueueElement, bs::StdAlloc<bs::ct::RenderQueueElement, bs::GenAlloc> > const&)+0x3c [0x7fd20d058dcc]
16) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsfRenderBeast.so: bs::ct::RCNodeClusteredForward::render(bs::ct::RenderCompositorNodeInputs const&)+0x1490 [0x7fd20d0626a0]
17) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsfRenderBeast.so: bs::ct::RenderCompositor::execute(bs::ct::RenderCompositorNodeInputs&) const+0x25f [0x7fd20d06482f]
18) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsfRenderBeast.so: bs::ct::RenderBeast::renderView(bs::ct::RendererViewGroup const&, bs::ct::RendererView&, bs::ct::FrameInfo const&)+0x207 [0x7fd20cfec4e7]
19) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsfRenderBeast.so: bs::ct::RenderBeast::renderViews(bs::ct::RendererViewGroup&, bs::ct::FrameInfo const&)+0xea [0x7fd20cfed89a]
20) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsfRenderBeast.so: bs::ct::RenderBeast::renderAllCore(bs::ct::FrameTimings, bs::PerFrameData)+0x599 [0x7fd20cff15e9]
21) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsf.so.1: bs::CommandQueueBase::playbackWithNotify(std::queue<bs::QueuedCommand, std::deque<bs::QueuedCommand, bs::StdAlloc<bs::QueuedCommand, bs::GenAlloc> > >*, std::function<void (unsigned int)>)+0x161 [0x7fd314a83f81]
22) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsf.so.1: bs::CommandQueueBase::playback(std::queue<bs::QueuedCommand, std::deque<bs::QueuedCommand, bs::StdAlloc<bs::QueuedCommand, bs::GenAlloc> > >*)+0x1a [0x7fd314a84c7a]
23) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsf.so.1: bs::CommandQueueBase::playbackWithNotify(std::queue<bs::QueuedCommand, std::deque<bs::QueuedCommand, bs::StdAlloc<bs::QueuedCommand, bs::GenAlloc> > >*, std::function<void (unsigned int)>)+0x161 [0x7fd314a83f81]
24) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsf.so.1: bs::CoreThread::runCoreThread()+0x2bd [0x7fd314a9055d]
25) /home/hhyyrylainen/Projects/thrive/build/bin/lib/libbsf.so.1: bs::PooledThread::run()+0x14c [0x7fd314a0249c]
26) /lib64/libstdc++.so.6: +0xc39a3 [0x7fd3142bd9a3]
27) /lib64/libpthread.so.0: +0x858e [0x7fd31439a58e]
28) /lib64/libc.so.6: clone+0x43 [0x7fd313f90713]

Even with the older bsf version. So I guess vulkan on Linux has been broken even before that version (for non-basic stuff)?
I guess I’ll update my bsf version for now (as I need the windows compile fix), and just tell people to not use vulkan on Linux. I’ll try later if everything works on windows or not.

Edit: my shaders (that are derived from Transparent) are broken after updating as well…


#3

I haven’t checked Vulkan on Linux in a while, it’s possible some drivers are not playing well with it - it’s the sort of stuff I only test before releases. I can’t tell what exactly is the issue from the error log, perhaps running with debug mode or getting a debugger backtrace would yield more information.


#4

I’m also getting a crash with vulkan on windows as well:


#5

I fixed a crash with Vulkan today, if you’re not already on latest try that. Your custom shaders might need to be reimported with a rebuilt import tool as well.


#6

That fixed the crashing on Linux (didn’t have time to test on windows yet).
Though I get some weird lighting artifacts (that I don’t get with opengl):

This is what it looks like with opengl:

Btw, the performance is absolutely amazing with Vulkan compared to opengl! My frame times went down from a little over 10 milliseconds to less than 1 millisecond. That performance is comparable to directx on windows, very nice.

Edit: I forgot to add that my renderer extension, is not working with vulkan also. It’s basically rendering a full screen quad with a texture on it.


#7

How are you rendering the full-screen quad? If you’re doing it custom, then you should account to flipped NDC Y on Vulkan, otherwise your triangles might be getting culled.

It would be interesting to investigate what’s causing such a slowdown in OpenGL compared to Vulkan, there shouldn’t be /that/ much of a difference.

Finally, not sure about that visual artifact on Vulkan. I think that’s something you’ll need to RenderDoc to narrow down where it’s happening.


#8

I’m rendering it like this:

void GUIOverlayRenderer::render(const bs::ct::Camera& camera)
{
    auto& rapi = bs::ct::RenderAPI::instance();

    bs::ct::gRendererUtility().setPass(QuadMaterial);

    bs::ct::gRendererUtility().setPassParams(QuadParamsSet);

    for(const auto& texture : FullScreenOverlays) {

        QuadMaterial->setTexture("image", texture);
        QuadParamsSet->update(QuadMaterial->_getInternalParams());

        bs::ct::gRendererUtility().draw(ScreenQuad);
    }
}

I have this in my shader:

    raster
    {
        cull = none;
    };

If that works then it shouldn’t cull it?

Unfortunately whenever I try to run my game in render doc with vulkan, I get a segmentation fault inside the render doc injected code.

Edit:

Testing with higher resolutions the performance of vulkan is much closer to what I get with opengl. But still vulkan gets something like 20-30% lower render time.


#9

Just updated from master and the rendering artifacts are now a bit different:


It now almosts looks the same as with opengl.