OpenGothic icon indicating copy to clipboard operation
OpenGothic copied to clipboard

Game totally freeze on startup

Open Viradie opened this issue 3 years ago • 8 comments
trafficstars

GDB output :

Using host libthread_db library "/usr/lib/libthread_db.so.1".
OpenGothic v1.0 dev
[New Thread 0x7ffff29ff640 (LWP 2547)]
[New Thread 0x7ffff21fe640 (LWP 2548)]
[New Thread 0x7ffff1366640 (LWP 2549)]
[New Thread 0x7ffff0b65640 (LWP 2551)]
[New Thread 0x7ffff02f7640 (LWP 2552)]
no *.ini file in path - using default settings
[New Thread 0x7fffda7da640 (LWP 2553)]
GPU = NVIDIA GeForce GTX 1060
Depth format = 14 Shadow format = 14
Info: ZEN: Reading presets...
swapchain is outdated - reset renderer

Thread 1 "Gothic2Notr" received signal SIGTERM, Terminated.

Thanks in advance for your help

Viradie avatar Aug 01 '22 13:08 Viradie

I get the same error since commit https://github.com/Try/Tempest/commit/dc73701d99dc220c518efe9c3ba4c1683c5474bb

It looks like there is a deadlock in https://github.com/Try/Tempest/blob/6de802ee1b1c9bbd7b0d4d4b403070c2438fc296/Engine/gapi/vulkan/vswapchain.cpp#L293

matthiakl avatar Aug 01 '22 18:08 matthiakl

Hi, @Viradie and thanks for report! That looks like a driver bug, since chunked commands are rarely used.. Can you try following patch:

diff --git a/Engine/gapi/vulkan/vcommandbuffer.cpp b/Engine/gapi/vulkan/vcommandbuffer.cpp
index d8dc743..a66cda3 100644
--- a/Engine/gapi/vulkan/vcommandbuffer.cpp
+++ b/Engine/gapi/vulkan/vcommandbuffer.cpp
@@ -236,8 +236,8 @@ void VCommandBuffer::beginRendering(const AttachmentDesc* desc, size_t descSize,
     }

   if(state!=Idle) {
-    vkAssert(vkEndCommandBuffer(impl));
-    newChunk();
+    //vkAssert(vkEndCommandBuffer(impl));
+    //newChunk();
     }

   resState.joinCompute(PipelineStage::S_Graphics);

And thanks @matthiakl for bisecting.

It looks like there is a deadlock

This wait is there to wait for next available frame-buffer-image from the system. Normally this should return in finite time.

Try avatar Aug 01 '22 21:08 Try

I have a GTX 1060 too and it runs fine here on a freshly compiled build. Driver 515.57

thokkat avatar Aug 01 '22 23:08 thokkat

Can you try following patch:

For me the fix does not work. (GTX 760, driver 470.129.06)

matthiakl avatar Aug 02 '22 16:08 matthiakl

I've been to reproduce issue locally - so far no luck.

Meanwhile got to say - bisected commit is a bit suspicious: for the most part it's code removal for unused stuff + chunk. and we tested that commenting-out chunks has no positive effect.

Try avatar Aug 03 '22 18:08 Try

The root cause seems to be the change in vulkanapi.cpp. If I revert this to the old submit function, I can successfully load a game (recognizable by sound), but I only get a black screen (don't now how to match the old function with the new chunks…). Old:

void VulkanApi::submit(Device *d, CommandBuffer* cmd, Fence *sync) {
  Detail::VDevice&        dx    = *reinterpret_cast<Detail::VDevice*>(d);
  Detail::VCommandBuffer& cx    = *reinterpret_cast<Detail::VCommandBuffer*>(cmd);
  auto*                   fence =  reinterpret_cast<Detail::VFence*>(sync);

  impl->submit(dx,&cx,1,rc);

New:

  dx.dataMgr().wait();
  dx.submit(cx,fence);

matthiakl avatar Aug 03 '22 23:08 matthiakl

While still I have no great ideas of exact root cause of this issue: on Ubuntu VM with lavapipe manage to hit a clean synchronization issue, hopefully #421889e will help with your issue as well

Try avatar Aug 07 '22 20:08 Try

Yep, for me it works again now, thanks.

matthiakl avatar Aug 08 '22 18:08 matthiakl