Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tracker] Vulkan error unable to create swapchain (device lost) happening randomly #71929

Open
5 of 15 tasks
clayjohn opened this issue Jan 23, 2023 · 161 comments
Open
5 of 15 tasks

Comments

@clayjohn
Copy link
Member

clayjohn commented Jan 23, 2023

Godot version

4.0 beta14 and earlier and likely later

System information

Most users are on Windows, some on Linux, variety of GPUs (intel, nVidia and AMD)

Issue description

I am opening this tracker issue as a central place to track a bug that seems to be plaguing a variety of users. The bug occurs quite randomly, but appears to be most often connecting with complex shaders and/or updating uniforms.

The bug leads to a freeze or crash when updating swap buffers along with the following errors:

E 0:00:01:0015   VulkanContext::swap_buffers: Condition "err" is true. Returning: ERR_CANT_CREATE
  <C++ Source>   drivers\vulkan\vulkan_context.cpp:2299 @ VulkanContext::swap_buffers()
E 0:00:01:0016   VulkanContext::prepare_buffers: Vulkan: Did not create swapchain successfully.
  <C++ Error>    Condition "err != VK_SUCCESS" is true. Breaking.
  <C++ Source>   drivers\vulkan\vulkan_context.cpp:2222 @ VulkanContext::prepare_buffers()

For some users these errors spam the console while the engine itself is frozen.

This issue is very difficult to debug as it is near impossible to reproduce reliably for people other than the affected users.

Tasks

Preview Give feedback
  1. archived bug topic:rendering
  2. archived bug crash topic:rendering
  3. bug topic:editor topic:shaders
  4. bug crash topic:rendering
  5. archived bug platform:windows topic:rendering
  6. bug confirmed regression topic:3d topic:rendering topic:thirdparty
  7. bug crash topic:rendering
  8. bug crash platform:linuxbsd regression topic:rendering topic:thirdparty
  9. bug crash needs testing topic:rendering
  10. bug crash topic:rendering
  11. bug topic:rendering
  12. bug platform:windows topic:physics topic:rendering
  13. archived bug topic:rendering
  14. bug confirmed crash topic:rendering

Steps to reproduce

Steps to reproduce can be found in individual reports

Minimal reproduction project

See individual reports

@Calinou
Copy link
Member

Calinou commented Jan 23, 2023

Should we force the engine to close in this situation, rather than trying to recreate the swapchain endlessly? As far as I know, there is no way to recover from this situation (not until the renderer can be restarted at run-time).

Also, the error message should be tweaked to indicate most likely causes (bugs in graphics drivers).

@clayjohn
Copy link
Member Author

Should we force the engine to close in this situation, rather than trying to recreate the swapchain endlessly? As far as I know, there is no way to recover from this situation (not until the renderer can be restarted at run-time).

Also, the error message should be tweaked to indicate most likely causes (bugs in graphics drivers).

I'm not sure. First we need to investigate what is causing the error in the first place. Most of the impacted users report driver updates not resolving the issue for them. So it is more likely an issue on our end.

@Frontrider
Copy link

Frontrider commented Feb 3, 2023

Popped up with beta 17. As long as you can't fix it/find what it is, I'd be happier if it tried to save my last open edits and crashed instead of an error spam.

My error lines are:

ERROR: Vulkan: Did not create swapchain successfully.
   at: prepare_buffers (drivers/vulkan/vulkan_context.cpp:2267)
ERROR: Condition "err" is true. Returning: ERR_CANT_CREATE
   at: swap_buffers (drivers/vulkan/vulkan_context.cpp:2344)

And the info message from the start of the editor:

Godot Engine v4.0.beta17.official.c40020513 - https://godotengine.org
Vulkan API 1.3.224 - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce RTX 2060

@InfiniteProductions
Copy link

As mentioned in #60755, I can help as I have 100% reproducible case (summary: launch editor, put computer to sleep, wake it up later, try to use any UI component => I got a "winner")

Feel free to give me some debug code to run, patched version of Godot with additional debug code, anything which could help. I'm still not convinced it could solve all cases users have encountered with all OSes & hardware involved but it could narrow it down at least.

For the record I have some older version of Visual Studio Community (latest is 2019) installed and never tried yet to compiled Godot from source, but I may give it a try if it could help.

@Frontrider
Copy link

Frontrider commented Feb 8, 2023

As mentioned in #60755, I can help as I have 100% reproducible case (summary: launch editor, put computer to sleep, wake it up later, try to use any UI component => I got a "winner")

Yap, that is a good way to get it to happen. With beta 17 it sometimes happens, sometimes does not. (I can get the computer to go to sleep without it happening)

@clayjohn
Copy link
Member Author

clayjohn commented Feb 8, 2023

@InfiniteProductions @Frontrider That is great to hear!

We just merged a change that made it into RC1 that will provide more debug information on crash.

So could one of you test RC1 running from the command line, reproduce the crash and then tell me what it says? It should have error messages like in the original post here, except there should be an error code reported as well

@InfiniteProductions
Copy link

@InfiniteProductions @Frontrider That is great to hear!

We just merged a change that made it into RC1 that will provide more debug information on crash.

So could one of you test RC1 running from the command line, reproduce the crash and then tell me what it says? It should have error messages like in the original post here, except there should be an error code reported as well

I start using this release, but (un)fortunately, the issue no longer occurred in the same scenario !
I'll try to test again with beta17 and post update here.

@Frontrider
Copy link

Could not reproduce so far, I can give more details in a few days.

@frtp2612
Copy link

frtp2612 commented Feb 10, 2023

@InfiniteProductions @Frontrider That is great to hear!

We just merged a change that made it into RC1 that will provide more debug information on crash.

So could one of you test RC1 running from the command line, reproduce the crash and then tell me what it says? It should have error messages like in the original post here, except there should be an error code reported as well

I just reproduced the issue on rc-1 after 48 minutes of engine usage. The message is different from the ones so far though.

Here is the error:
crash

@InfiniteProductions
Copy link

aarrgghh I just got one but console goes away with the editor when closing it ! It could be great to have a log file somewhere instead of this console OR keep it open. I'll try again later.

@ComputerGiraffics
Copy link

Getting this error in Godot 4 RC1 when trying to load the DM1-2 map in Liblast, https://libla.st/:

Godot Engine v4.0.rc1.official.8843d9ad3 - https://godotengine.org
Vulkan API 1.3.224 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1050 Ti
E 0:00:33:0319   swap_buffers: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
  <C++ Error>    Condition "err" is true. Returning: ERR_CANT_CREATE
  <C++ Source>   drivers/vulkan/vulkan_context.cpp:2351 @ swap_buffers()
E 0:00:33:0324   prepare_buffers: Vulkan: Did not create swapchain successfully. Error code: VK_NOT_READY
  <C++ Error>    Condition "err != VK_SUCCESS" is true. Breaking.
  <C++ Source>   drivers/vulkan/vulkan_context.cpp:2274 @ prepare_buffers()

@InfiniteProductions
Copy link

Using the same release:

$ Godot Engine v4.0.rc1.official.8843d9ad3 - https://godotengine.org
OpenGL API 3.3.0 NVIDIA 425.31 - Compatibility - Using Device: NVIDIA Corporation - GeForce GTX 780M

I've got only these lines:

ERROR: Resources still in use at exit (run with --verbose for details).
at: clear (core/io/resource.cpp:489)
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
at: (drivers/vulkan/vulkan_context.cpp:2351)
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
at: (drivers/vulkan/vulkan_context.cpp:2351)
ERROR: Vulkan: Did not create swapchain successfully. Error code: VK_ERROR_VALIDATION_FAILED_EXT
at: (drivers/vulkan/vulkan_context.cpp:2274)
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
...
(infinite ? number of messages until Godot is closed)
...
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
at: (drivers/vulkan/vulkan_context.cpp:2351)
WARNING: Scan thread aborted...
at: _notification (editor/editor_file_system.cpp:1224)

It doesn't looks like to be a "crash" as @clayjohn wrote. So no luck to get more debug info.

@Frontrider
Copy link

Frontrider commented Feb 15, 2023

Same. I just got it. Editor was left open in the background, it was still rc1. I'll try to replicate on rc2.

ERROR: Vulkan: Did not create swapchain successfully. Error code: VK_NOT_READY
   at: prepare_buffers (drivers/vulkan/vulkan_context.cpp:2274)
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
   at: swap_buffers (drivers/vulkan/vulkan_context.cpp:2351)
ERROR: Vulkan: Did not create swapchain successfully. Error code: VK_NOT_READY
   at: prepare_buffers (drivers/vulkan/vulkan_context.cpp:2274)
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
   at: swap_buffers (drivers/vulkan/vulkan_context.cpp:2351)
ERROR: Vulkan: Did not create swapchain successfully. Error code: VK_NOT_READY
   at: prepare_buffers (drivers/vulkan/vulkan_context.cpp:2274)
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
   at: swap_buffers (drivers/vulkan/vulkan_context.cpp:2351)
ERROR: Vulkan: Did not create swapchain successfully. Error code: VK_NOT_READY
   at: prepare_buffers (drivers/vulkan/vulkan_context.cpp:2274)
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
   at: swap_buffers (drivers/vulkan/vulkan_context.cpp:2351)
ERROR: Vulkan: Did not create swapchain successfully. Error code: VK_NOT_READY
   at: prepare_buffers (drivers/vulkan/vulkan_context.cpp:2274)
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
   at: swap_buffers (drivers/vulkan/vulkan_context.cpp:2351)

Try launching other full screen applications/games while godot is in the background. That might yield usable results.

@Squatnet
Copy link

I'm having this on RC2, interspersed with random gibberish

ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
   at: (drivers/vulkan/vulkan_context.cpp:2351)
ERROR: Vulkan: Did not create swapchain successfully. Error code: VK_NOT_READY
   at: (drivers/vulkan/vulkan_context.cpp:2274)
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
   at: (drivers/vulkan/vulkan_context.cpp:2351)
ERROR: Vulkan: Did not create swapchain successfully. Error code: VK_NOT_READY
   at: (drivers/vulkan/vulkan_context.cpp:2274)
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
   at: (drivers/vulkan/vulkan_context.cpp:2351)
ERROR: Vulkan: Did not create swapchaEiRnR OsRu:c cVeuslskfaunl:l yD.i dE rnrootr  ccroedaet:e  VsKw_aNpOcTh_aiRnEA DsYu
cc e s saftu:l l(yd.r iEvrerrosr/ vcuoldkea:n /VvKu_lNkOaTn__RcEoAnDtYe
x t . captp:: 2(2d7r4i)v
ers/vulkan/vulkan_context.cpp:2274)
ERROR: Vulkan: Did not cErReRaOtRe: s wVauplckhaani:n  Csauncncoets ssufbumlilty .g rEarprhoirc sc oqduee:u eV.K _ENrOre
:   V Ka_tE:R R(OdRr_iDvEeVrIsC/Ev_uLlOkSaTn
/ v u lakta:n _(cdornitveexrts./cvpupl:k2a2n7/4v)u
lkan_context.cpp:2351)
ERROR: Vulkan: Did not create swapchain successfully. Error code: VK_NOT_READY
   at: (drivers/vulkan/vulkan_context.cpp:2274)
ERROR: Vulkan: Cannot submit gErRaRpOhRi:c sV uqlukeaun:e.  CEarnrnoort  csoudbem:i tV Kg_rEaRpRhOiRc_sD EqVuIeCuEe_.L r
o r   caotd:e :( dVrKi_vEeRrRsO/Rv_uDlEkVaInC/Ev_uLlOkSaTn
_ c o natte:x t(.dcrpipv:e2r3s5/1v)u
lkan/vulkan_context.cpp:2351)
ERROR: Vulkan: Did not create swapchain successfully. Error code: VK_NOT_READY
   at: (drivers/vulkan/vulkan_context.cpp:2274)

I'm not sure if it makes any difference but i did switch from compatability to forward renderer, my project also makes heavy use of shaders, but runs absolutely fine in compatibility.

Windows 11, RTX 3060

@Frontrider
Copy link

Just got the error on rc5. Same game, left the editor open for a while in the background, then the screen was turned off. No sleep mode, no nothing.

Godot Engine v4.0.rc5.official.6296b4600 - https://godotengine.org
Vulkan API 1.3.224 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce RTX 2060

....

ERROR: Vulkan: Did not create swapchain successfully. Error code: VK_NOT_READY
   at: prepare_buffers (drivers/vulkan/vulkan_context.cpp:2280)
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
   at: swap_buffers (drivers/vulkan/vulkan_context.cpp:2357)
ERROR: Vulkan: Did not create swapchain successfully. Error code: VK_NOT_READY
   at: prepare_buffers (drivers/vulkan/vulkan_context.cpp:2280)
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
   at: swap_buffers (drivers/vulkan/vulkan_context.cpp:2357)

@hammerandtongs
Copy link

hammerandtongs commented Mar 7, 2023

I'm getting this error suddenly with godot 4 final

Godot Engine v4.0.stable.official.92bee43ad - https://godotengine.org
LOG in xrCreateInstance: Instance created
        createInfo->applicationInfo.applicationName: Godot XR Tools Demo
        createInfo->applicationInfo.applicationVersion: 1
        createInfo->applicationInfo.engineName: Godot Game Engine
        createInfo->applicationInfo.engineVersion: 40000
        appinfo.detected.engine.name: (null)
        appinfo.detected.engine.version: 0.0.0
        quirks.disable_vulkan_format_depth_stencil: false
LOG in xrCreateInstance: Selected devices
        Head: 'Valve Index (libsurvive)'
        Left: '<none>'
        Right: '<none>'
        Hand-Tracking Left: '<none>'
        Hand-Tracking Right: '<none>'
OpenXR: Running on OpenXR runtime:  Monado(XRT) by Collabora et al 'v21.0.0-2877-g5380b6c1'   21.0.0
OpenXR: XrGraphicsRequirementsVulkan2KHR:

Godot Engine v4.0.stable.official.92bee43ad - https://godotengine.org
LOG in xrCreateInstance: Instance created
        createInfo->applicationInfo.applicationName: Godot XR Tools Demo
        createInfo->applicationInfo.applicationVersion: 1
        createInfo->applicationInfo.engineName: Godot Game Engine
        createInfo->applicationInfo.engineVersion: 40000
        appinfo.detected.engine.name: (null)
        appinfo.detected.engine.version: 0.0.0
        quirks.disable_vulkan_format_depth_stencil: false
LOG in xrCreateInstance: Selected devices
        Head: 'Valve Index (libsurvive)'
        Left: '<none>'
        Right: '<none>'
        Hand-Tracking Left: '<none>'
        Hand-Tracking Right: '<none>'
OpenXR: Running on OpenXR runtime:  Monado(XRT) by Collabora et al 'v21.0.0-2877-g5380b6c1'   21.0.0
OpenXR: XrGraphicsRequirementsVulkan2KHR:
 - minApiVersionSupported:  1.0.0
 - maxApiVersionSupported:  1023.1023.1023
LOG in xrCreateVulkanInstanceKHR: Creation of VkInstance:
        result: VK_SUCCESS
        vulkanInstance: 0x65d84c0
        extensions:
                VK_KHR_external_fence_capabilities
                VK_KHR_external_memory_capabilities
                VK_KHR_external_semaphore_capabilities
                VK_KHR_get_physical_device_properties2
                VK_KHR_surface
                VK_KHR_xlib_surface
Vulkan API 1.3.230 - Forward+ - Using Vulkan Device #0: AMD - AMD Radeon RX 6900 XT (RADV NAVI21)
LOG in xrGetVulkanGraphicsDeviceKHR: Creation of VkDevice:
        result: VK_SUCCESS
        vulkanDevice: 0x66658f0
        vulkanInstance: 0x65d84c0
        external_fence_fd: true
        external_semaphore_fd: true
        timelineSemaphore: true
        extensions:
                VK_KHR_dedicated_allocation
                VK_KHR_external_fence
                VK_KHR_external_memory
                VK_KHR_external_semaphore
                VK_KHR_get_memory_requirements2
                VK_KHR_external_memory_fd
                VK_KHR_16bit_storage
                VK_KHR_create_renderpass2
                VK_KHR_fragment_shading_rate
                VK_KHR_image_format_list
                VK_KHR_incremental_present
                VK_KHR_maintenance2
                VK_KHR_multiview
                VK_KHR_shader_float16_int8
                VK_KHR_storage_buffer_storage_class
                VK_KHR_swapchain
                VK_KHR_external_semaphore_fd
                VK_KHR_external_fence_fd
                VK_KHR_timeline_semaphore

ERROR: Interface not found.
   at: find_interface (servers/xr_server.cpp:224)
OpenXR: Configuring interface
ERROR: Condition "swapchainImageCount != sp_image_count" is true. Returning: ERR_BUG
   at: _update_swap_chain (drivers/vulkan/vulkan_context.cpp:1980)
free(): double free detected in tcache 2
Aborted (core dumped)

@speakk
Copy link

speakk commented Mar 9, 2023

For me this reproduces 100% reliably when I leave Godot on when I put my laptop to sleep.
I get in an endless loop:

ERROR: Vulkan: Did not create swapchain successfully. Error code: VK_NOT_READY
   at: prepare_buffers (drivers/vulkan/vulkan_context.cpp:2280)
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
   at: swap_buffers (drivers/vulkan/vulkan_context.cpp:2357)

OS: Linux (Arch Linux, up to date)
GPU: NVidia (NVIDIA Corporation GA104GLM [RTX A3000 Mobile])

@Frontrider
Copy link

@speakk what distro? That might be another useful but of info.

@speakk
Copy link

speakk commented Mar 9, 2023

Edited my post to add the distro.

@Jigglyy
Copy link

Jigglyy commented Mar 9, 2023

Occurs to me also, on Windows 10, 1070 Ti, 2700X, latest drivers

@lorenuars19
Copy link

The question is how could we debug this further, or is it coming from the driver rather then godot itself ?

@clayjohn
Copy link
Member Author

clayjohn commented Mar 14, 2023

The question is how could we debug this further, or is it coming from the driver rather then godot itself ?

Well, its difficult to say. We don't have clear reproducible cases yet. When this error occurs varies wildly between person to person. Some users get it consistently, others get it randomnly. For some it is fixed with a driver update, for others not.

My guess is that somewhere in the core Vulkan code we are doing something outside of the Vulkan specification which results in the device getting lost. The trouble is very few contributors have the deep knowledge about Vulkan required to debug this, further very few people are able to reproduce it, which makes it even harder to debug.

Edit: To add to this, if you can reliably reproduce the issue, please try running your application from the command line and using the --gpu-validation and --verbose command line arguments. Run the project directly, do not go through the project manager.

@speakk
Copy link

speakk commented May 3, 2024

I also got this problem when I turned on shadows for a bunch of OmniLight3D's. This with 4.3dev6.

@speakk I think you may actually be running into #89312 Which is a similar issue

Ah you're right, that is the issue I hit, thanks.

@TheFlugeler
Copy link

TheFlugeler commented May 7, 2024

I'm using godot for the first time and every time I boot it up and try to start using it, this error comes up. Ive run it in the command line and it spits out this error

Haven't even been able to do anything in godot yet because when I try to click anything it just crashes

image

Edit: I made a new project using compatibility in stead of Forward+ and it seems to work now

@FeralPug
Copy link

FeralPug commented May 9, 2024

If this helps,

Turning Single Window Mode on, seemed to have resolved the issue. I haven't had it crash at all for over 8 hours now.

To turn it on: Editor Settings -> Interface -> Editor -> Single Window Mode. If this works for others, the bug can be narrowed down by a lot.

I have been having it crash every time I open the advanced import settings window. Changing the editor to single window mode seems to be fixing the problem. Had the problem in 4.2.1 and 4.2.2 c# version, windows 11

@codeph0enix
Copy link

I have also been getting the same:

at: _editor_init (modules/gltf/register_types.cpp:63)
ERROR: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST
   at: (drivers/vulkan/vulkan_context.cpp:2536)

For me it is very replicate-able/consistent, specifically on my Surface Pro and happens anytime I resize the Godot UI elements (i.e. everytime I resize the TileSets pane Godot crashes). Single Window Mode did not fix for me BUT changing to Compatibility mode immediately fixed the issue. Have not been able to get it to crash since, but changing back to Forward+ immediately brings back the issue.

Hope that helps anyone else still having this issue for now. Let me know if any further info from someone who can consistently replicate it is helpful at this point.

@SbNanduri
Copy link

SbNanduri commented May 14, 2024

I started having the same issue while I was in the middle of making a fragment shader. This happens every time I use this shader after about 5-10 seconds.

I am using Godot v4.2.2 stable, running on Windows with an RTX 3070, Intel(R) Core(TM) i7-10700K CPU @ 3.80GHz, 16.0 GB RAM

Update: I just tried the same thing in v4.3-dev5 and v4.3-dev6 and I am running into the exact same issue. So it wasn't fixed for me

To replicate this, make a MeshInstance3D with a quad mesh and attach this shader to it. If the mesh is visible, Godot should crash in a few seconds.

Note: I had to convert the shader into a txt file to be able to attach it here. Convert it back to a gdshader to use it
Crashing Godot Shader.txt

@clayjohn
Copy link
Member Author

@SbNanduri your case is a bit different. You have an infinite loop in your shader which is causing your GPU to crash. When UV.y is 1.0 your margin is 0 resulting in an infinite loop. Modern GPUs respond to infinite loops by crashing the GPU driver instead of freezing your computer and burning out the GPU.

@SbNanduri
Copy link

@clayjohn Oh my bad for missing that, and thanks so much! There aren't too many mentions of this error, and I hadn't seen any mentions of infinite loops in them, so I assumed it probably wasn't trivial

@KoltPenny
Copy link

KoltPenny commented Jun 22, 2024

And I thought this was an issue specific to either Linux, or Gnome, or using the proprietary drivers for Nvidia. Good to know this is still an issue.

I can confirm this is an issue in the following specs:

  • Godot 4.2.2-stable.
  • Fedora Linux 40 x86_64.
  • Gnome 46.2 on both Wayland and Xorg
  • 11th Gen Intel Core i5-11260H @ 12x 4.4GHz
  • NVIDIA GeForce RTX 3050 Mobile.

@clayjohn
Copy link
Member Author

And I thought this was an issue specific to either Linux, or Gnome, or using the proprietary drivers for Nvidia. Good to know this is still an issue.

I can confirm this is an issue in the following specs:

  • Fedora Linux 40 x86_64.
  • Gnome 46.2 on both Wayland and Xorg
  • 11th Gen Intel Core i5-11260H @ 12x 4.4GHz
  • NVIDIA GeForce RTX 3050 Mobile.

What version of Godot?

@KoltPenny
Copy link

And I thought this was an issue specific to either Linux, or Gnome, or using the proprietary drivers for Nvidia. Good to know this is still an issue.
I can confirm this is an issue in the following specs:

  • Fedora Linux 40 x86_64.
  • Gnome 46.2 on both Wayland and Xorg
  • 11th Gen Intel Core i5-11260H @ 12x 4.4GHz
  • NVIDIA GeForce RTX 3050 Mobile.

What version of Godot?

4.2.2-stable. I edited my comment, sorry.

@clayjohn
Copy link
Member Author

@KoltPenny do you mind testing with 4.3 beta 2 (make a backup of your project first). We fixed a number of bugs that could possibly cause this error

You can download it here https://godotengine.org/download/archive/4.3-beta2/

@KoltPenny
Copy link

@clayjohn At least the error is different 😅 . Still crashes and dies on Vulkan. Going to fallback to OpenGL for now.
image

@Gui-Tora
Copy link

I found this thread after having the same device lost issue, and I'm not sure if I can contribute, but this is what happened to me:

I was fixing an error in a .gd file when the device lost problem occurred, and I couldn't start the editor again. The error continued when I switched tabs while the editor was loading (Godot_v4.2.1-stable and Godot_v4.2.2-stable).

When I didn't switch tabs, the editor didn't crash, and I corrected the error in the .gd file. When I tried again, I couldn't reproduce the bug.

I am on an IdeaPad 3 15IIL05
CPU: i5-1035G1
GPU: integrated
20GB of RAM

@byromaniac
Copy link

I can't even open the editor. I started a new project and got this immediately

@KoltPenny
Copy link

@byromaniac as a temporary solution, launch it through a terminal with the --rendering-method gl_compatibility option.

@byromaniac
Copy link

byromaniac commented Jul 29, 2024 via email

@FeralPug
Copy link

Pretty sure compatable mode uses OpenGL for graphics so no Vulkan device to lose. So I guess that works if you are ok with that. I would be curious to know if people who had this issue are still seeing it in 4.3 as I know a lot of work was done towards this in that update.

@jetsup
Copy link

jetsup commented Aug 12, 2024

OS: Ubuntu Jammy 20.04
Graphics: Intel(R) HD Graphics 4400 (HSW GT2)

I was getting the same swap_buffers: Vulkan: Cannot submit graphics queue. Error code: VK_ERROR_DEVICE_LOST error after I introduced ray-casting to my game. Here is the snippet:

var results = space_state.intersect_ray(query)
if results:
    var bullet_mark = bullet_hole_dark.instantiate()
    get_tree().root.add_child(bullet_mark)
    bullet_mark.global_position = results.get("position") # bullet_mark -> decal

For a moment I thought maybe it was because of memory allocation, I went online to search. After modifying my code to this it works.

var results = space_state.intersect_ray(query)
if results:
    var bullet_mark = bullet_hole_dark.instantiate()
    get_tree().root.add_child(bullet_mark)
    bullet_mark.global_position = results.get("position")
    await get_tree().create_timer(2).timeout
    bullet_mark.queue_free()

Partially solved my problem.

@Calinou
Copy link
Member

Calinou commented Aug 12, 2024

Graphics: Intel(R) HD Graphics 4400 (HSW GT2)

Intel Haswell IGPs only have partial Vulkan support due to hardware limitations, so please switch to the Compatibility rendering method which uses OpenGL instead. I'm surprised Forward+/Mobile even starts on your PC, but I guess Mesa drivers are built different…

The Compatibility rendering method does not support decals, but for small decals like bullet holes, you can use a MeshInstance3D with a QuadMesh and rotate it according to the raycast normal.

@WOLVEN95
Copy link

I still get this error on 4.3 stable. I'm running on Intel UHD Graphics with a i5-1035g1 processor which supports Vulkan according to the intel website. I can open the editor in forward and mobile and I can also tinker around with all the different properties in the WorldEnvironment node that are Vulkan exclusive. I can only do this for a short while until too much load is put on my computer and Godot crashes with this error message:
ERROR: Condition "err != VK_SUCCESS" is true. Returning: FAILED at: command_queue_execute_and_present (drivers/vulkan/rendering_device_driver_vulkan.cpp:2266)

@AlexKLWS
Copy link

Getting similar issue on 4.3 stable and 4.4 dev2. The device is 2019 Macbook Pro 13" 2.4 GHz Quad-Core Intel Core i5, Intel Iris Plus Graphics 655 1536 MB. For whatever reason, Forward+ seems to be fine, however Mobile causes crash on 4.4 and makes editor UI black on 4.3. Here're the crash logs:

Godot Engine v4.4.dev2.official.97ef3c837 - https://godotengine.org
Vulkan 1.2.283 - Forward Mobile - Using Device #0: Intel - Intel(R) Iris(TM) Plus Graphics 655

ERROR: Condition "err != VK_SUCCESS" is true. Returning: FAILED
   at: fence_wait (drivers/vulkan/rendering_device_driver_vulkan.cpp:2251)
ERROR: Last known breadcrumb: BLIT_PASS
   at: print_lost_device_info (drivers/vulkan/rendering_device_driver_vulkan.cpp:5123)
ERROR: VK_EXT_device_fault not available.
   at: on_device_lost (drivers/vulkan/rendering_device_driver_vulkan.cpp:4989)
ERROR: Vulkan device was lost.
   at: command_queue_execute_and_present (drivers/vulkan/rendering_device_driver_vulkan.cpp:2455)

================================================================
handle_crash: Program crashed with signal 4
Engine version: Godot Engine v4.4.dev2.official (97ef3c837263099faf02d8ebafd6c77c94d2aaba)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] 1   libsystem_platform.dylib            0x00007ff804797fdd _sigtramp + 29
[2] 2   ???                                 0x0000000000000301 0x0 + 769
[3] RenderingDeviceDriverVulkan::command_queue_execute_and_present(RenderingDeviceDriver::CommandQueueID, VectorView<RenderingDeviceDriver::SemaphoreID>, VectorView<RenderingDeviceDriver::CommandBufferID>, VectorView<RenderingDeviceDriver::SemaphoreID>, RenderingDeviceDriver::FenceID, VectorView<RenderingDeviceDriver::SwapChainID>) (in Godot) + 1747
[4] RenderingDevice::_execute_frame(bool) (in Godot) + 298
[5] RenderingDevice::swap_buffers() (in Godot) + 46
[6] RenderingServerDefault::_draw(bool, double) (in Godot) + 353
[7] Main::iteration() (in Godot) + 1387
[8] OS_MacOS::run() (in Godot) + 154
[9] main (in Godot) + 387
[10] 10  dyld                                0x00007ff8043dd345 start + 1909
-- END OF BACKTRACE --
================================================================

@darksylinc
Copy link
Contributor

darksylinc commented Sep 21, 2024

@AlexKLWS :

  1. What macOS version is this?
  2. Could you install the Vulkan Validation Layers for Mac, ensure the layers are in the active environment variables and launch Godot with --gpu-validation ?).
  3. If possible, could you launch Godot from within XCode and force-enable Metal validation?

As for the relevant Validation Layers environment variables:

export VK_LAYER_PATH=/path/to/vulkan/1.2.148.1/x86_64/etc/vulkan/explicit_layer.d
export VULKAN_SDK=/path/to/vulkan/1.2.148.1/x86_64
export LD_LIBRARY_PATH=/path/to/vulkan/1.2.148.1/x86_64/lib
export PATH=/path/to/vulkan/1.2.148.1/x86_64/bin:$PATH

Note: SIP on macOS will probably block LD_LIBRARY_PATH. Hopefully it still works if the SDK is installed. I have little experience with Vulkan validation on macOS.

@Dhighruler
Copy link

I found a similar error doing https://docs.godotengine.org/en/stable/getting_started/first_3d_game/08.score_and_replay.html

The error:
E 0:01:16:0315 swap_chain_resize: Condition "err != VK_SUCCESS" is true. Returning: ERR_CANT_CREATE
<C++ Source> drivers/vulkan/rendering_device_driver_vulkan.cpp:2606 @ swap_chain_resize()

Steps to reproduce:

  1. follow the tutorial until you finish "Score and Replay"

  2. This is the code that produces the error. You can use anything to replace "$UserInterface" since it is what help creates the error loop. I already replaced it with "$UI" to make it simple.

func _unhandled_input(event):
	if event.is_action_pressed("ui_accept") and $UI/Retry.visible:
		# This restarts the current scene.
		get_tree().reload_current_scene()
  1. Press "Run Current Scene"/F6 in the Main scene

  2. Die, so you can get the retry screen

  3. Press "ENTER" this will produce the error:
    E 0:00:04:0613 main.gd:31 @ _unhandled_input(): Node not found: "UseInterface/Retry" (relative to "/root/Main").
    <C++ Error> Method/function failed. Returning: nullptr
    <C++ Source> scene/main/node.cpp:1792 @ get_node()
    main.gd:31 @ _unhandled_input()

  4. Now close the (DEBUG) game window by hitting the X in the corner, instead of stopping it in Godot.

  5. You should still hear the music, and the "Pause Running Project"/F7 will be blue. Press it.

You should now be getting tons of errors. You can hit "Stop Running Project"/F8 to stop it. Otherwise it will keep going, which will cause you to slow down and crash.

@darksylinc
Copy link
Contributor

@Dhighruler please open a new ticket for that problem. It looks very specific. This is a generic tracker.

@TokisanGames
Copy link
Contributor

#98465 could be added to this list. It's not device lost, just general errors in fence_wait and command_queue_execute_and_present, and an engine hang.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests