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

Crash with SDFGI and very large znear or zfar #99967

Open
Tracked by #55327
Flarkk opened this issue Dec 3, 2024 · 2 comments · May be fixed by #104120
Open
Tracked by #55327

Crash with SDFGI and very large znear or zfar #99967

Flarkk opened this issue Dec 3, 2024 · 2 comments · May be fixed by #104120

Comments

@Flarkk
Copy link
Contributor

Flarkk commented Dec 3, 2024

Tested versions

4.4.dev (893bbdf)
4.4-dev5

System information

Godot v4.4.dev (b09b8ef1a) - Ubuntu 24.04.1 LTS 24.04 on X11 - X11 display driver, Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3050 (nvidia; 535.183.01) - Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz (8 threads)

Issue description

Crash when SDFGI is active and the camera's znear or zfar is set to a very high value (above 1E20 or so).
A VK_ERROR_DEVICE_LOST is raised here :
https://github.com/godotengine/godot/blob/5f7dab636a2dfcf054412fa028474773e5ea61b9/drivers/vulkan/rendering_device_driver_vulkan.cpp#L2525-L2528

Steps to reproduce

In Editor : New scene > Add Camera3D > Add Environment > Enable SDFGI.
Set the camera's znear or zfar to anything above 1e20.

I'm aware such large far / near values can't be used in practice right now, but I'm currently working on making this possible.

Minimal reproduction project (MRP)

crash_sdfgi.zip
Open scene "crash_sdfgi".
Godot will crash as soon as you preview the camera.

@Flarkk Flarkk changed the title Crash with SDFGI with very large znear or zfar Crash with SDFGI and very large znear or zfar Dec 3, 2024
@Calinou Calinou mentioned this issue Dec 3, 2024
37 tasks
@Flarkk
Copy link
Contributor Author

Flarkk commented Mar 1, 2025

For reference, here is the console output.
Any help digging further into this would be appreciated.
I'm not familiar with VK_ERROR_DEVICE_LOST errors (and I guess they could be covering up a lot).

warning: (x86_64) /lib/x86_64-linux-gnu/libbrotlidec.so.1 unsupported DW_FORM values: 0x1f20 0x1f21
warning: (x86_64) /lib/x86_64-linux-gnu/libbrotlicommon.so.1 unsupported DW_FORM values: 0x1f20 0x1f21
Godot Engine v4.4.rc.custom_build.5eb25f064 (2025-02-27 14:21:06 UTC) - https://godotengine.org
WARNING: GENERAL - Message Id Number: 0 | Message Id Name: Loader Message
	terminator_CreateInstance: Received return code -3 from call to vkCreateInstance in ICD /usr/lib/x86_64-linux-gnu/libvulkan_virtio.so. Skipping this driver.
	Objects - 1
		Object[0] - VK_OBJECT_TYPE_INSTANCE, Handle 93825213436784
     at: _debug_messenger_callback (drivers/vulkan/rendering_context_driver_vulkan.cpp:639)
Vulkan 1.3.277 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 3050

ERROR: Condition "err != VK_SUCCESS" is true. Returning: FAILED
   at: fence_wait (drivers/vulkan/rendering_device_driver_vulkan.cpp:2416)
ERROR: Printing last known breadcrumbs in reverse order (last executed first).
   at: print_lost_device_info (drivers/vulkan/rendering_device_driver_vulkan.cpp:5590)
ERROR: Searching last breadcrumb. We've sent up to ID: 7
ERROR: Last breadcrumb ID found: 6
ERROR: Last known breadcrumb: SKY_PASS | User data: 5
ERROR: Last known breadcrumb: SKY_PASS | User data: 4
ERROR: Last known breadcrumb: SKY_PASS | User data: 3
ERROR: Last known breadcrumb: SKY_PASS | User data: 2
ERROR: Last known breadcrumb: SKY_PASS | User data: 1
ERROR: Last known breadcrumb: SKY_PASS
ERROR: Last known breadcrumb: BLIT_PASS
ERROR: Last known breadcrumb: UNKNOWN_BREADCRUMB(0)
ERROR: VK_EXT_device_fault not available.
   at: on_device_lost (drivers/vulkan/rendering_device_driver_vulkan.cpp:5508)
ERROR: Vulkan device was lost.
   at: command_queue_execute_and_present (drivers/vulkan/rendering_device_driver_vulkan.cpp:2630)

@Calinou
Copy link
Member

Calinou commented Mar 1, 2025

I'm not familiar with VK_ERROR_DEVICE_LOST errors (and I guess they could be covering up a lot).

This is likely the consequence of an invalid projection (division by zero) in the graphics driver. See #84454 where I could reliably trigger those by modifying the Camera3D projection matrix in unintended ways.

@Flarkk Flarkk linked a pull request Mar 14, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants