Vulkan failing to initialize

Do you need help? Ask here!

Bug reporting belongs here: http://developer.wz2100.net/newticket
Post Reply
Rabidchaos
New user
Posts: 5
Joined: 28 May 2009, 19:28

Vulkan failing to initialize

Post by Rabidchaos »

I have Warzone2100 installed from the snap store (https://snapcraft.io/warzone2100) and compiled from master on Github. When I try to launch either, I get an error window with the following message:

Code: Select all

Failed to draw graphics for backend: Vulkan.

Error Details:
"Failed with error: ErrorInitializationFailed"

Do you want to reset the graphics backend to: OpenGL?
with the following text in the console:

Code: Select all

$ warzone2100
info    |20:26:48: [rebuildSearchPath:825] Failed to load expected terrain quality overrides: terrain_overrides/high
last message repeated 2 times
info    |20:26:48: [wzChangeFullscreenDisplayMode:2061] Changing fullscreen mode to [0] 1920x1200
error   |20:26:48: [createSwapchain:4010] vk::Device::createSwapchainKHR: InitializationFailedError: vk::Device::createSwapchainKHR: ErrorInitializationFailed
/usr/bin/gdb: warning: Couldn't determine a path for the index cache directory.
No frame at level 0x7f95d3634d50.
Saved dump file to '/home/penn/.local/share/warzone2100-master//logs/warzone2100.gdmp-GIHzf5'
If you create a bugreport regarding this crash, please include this file.
Aborted (core dumped)
(I renamed warzone2100.gdmp-GIHzf5 to warzone2100.gdmp-GIHzf5.txt to make the forum software happy.)

As they're a little long to include here in the text, I've attached the output for both the snap and built versions when run with the --debug=all argument as wz2100_snap_debug.txt and wz2100_build_debug.txt respectively.

To verify that Vulkan sometimes works, I've run vkcube and also started working through the official tutorial. When looking in Warzone2100's source for where it calls createSwapchainKHR(), I found a comment at the top of the respective file (lib/ivis_opengl/gfx_api_vk.cpp) with the flagg to enable validation layers (--gfxdebug). Accordingly, I ran both versions with that flag and saved them as wz2100_snap_gfxdebug.txt and wz2100_build_gfxdebug.txt respectively.

Both gfxdebug outputs pinpoint the error on the compositeAlpha field of the createInfo struct passed to vkCreateSwapchainKHR(). If I'm reading the messages correctly, Warzone2100 tried to create the swap chain with VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR, while the physical device only supports VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR. On its own, that seems almost reasonable. But in the Vulkan tutorial page on setting up the swap chain, they specify

Code: Select all

createInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
and that code (both the version I typed and the copy they link at the bottom of the page) compiles and runs with validation layers enabled without any complaints.

In conclusion, I am thoroughly out of my depth and very confused. I thought I narrowed in on the root problem, but I have other code showing that evidently that is not the case. I am still learning the ins and outs of Vulkan and I haven't read through the Warzone2100 code properly yet. At this point, I am assuming it is more likely that something is wrong with my setup (it certainly won't be the first time) than a bug in Warzone2100 that needs fixing - hence writing this here rather than making an issue on Github. If it would be more helpful, I can rewrite it over there instead/in addition to here.

I'm running Fedora 36 on a desktop with a GTX 1080, running NVidia drivers version 530.41. Warzone2100 does run fine on Windows on the same hardware.
Attachments
warzone2100.gdmp-GIHzf5.txt
(84.59 KiB) Downloaded 89 times
wz2100_build_debug.txt
(60.58 KiB) Downloaded 73 times
wz2100_build_gfxdebug.txt
(1.5 KiB) Downloaded 51 times
wz2100_snap_debug.txt
(58.15 KiB) Downloaded 47 times
wz2100_snap_gfxdebug.txt
(1.29 KiB) Downloaded 75 times
pastdue
Warzone 2100 Team Member
Warzone 2100 Team Member
Posts: 339
Joined: 13 Aug 2017, 17:44

Re: Vulkan failing to initialize

Post by pastdue »

Thank you for the very detailed report.

I've opened a PR with a small patch that will (hopefully) resolve this: https://github.com/Warzone2100/warzone2100/pull/3351

(The patch is based on the current master branch, but you should be able to relatively easily apply it to 4.3.5.)
Rabidchaos
New user
Posts: 5
Joined: 28 May 2009, 19:28

Re: Vulkan failing to initialize

Post by Rabidchaos »

With the patch applied, it fails with the same error message. I haven't gone through the debug messages yet, so I don't know yet how much has changed.
Attachments
warzone2100.gdmp-eFFhxc.txt
(56.95 KiB) Downloaded 53 times
wz2100_patch0_gfxdebug.txt
(1.5 KiB) Downloaded 48 times
wz2100_patch0_debug.txt
(60.58 KiB) Downloaded 53 times
Rabidchaos
New user
Posts: 5
Joined: 28 May 2009, 19:28

Re: Vulkan failing to initialize

Post by Rabidchaos »

Turns out I hadn't properly gotten the patch applied before compiling. With the patch actually in place, after compiling and installing the game runs!
Post Reply