godotengine / godotengine/godot
Crash with SDFGI and very large znear or zfar
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
4.4.dev (893bbdfd)
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](https://github.com/user-attachments/files/17995548/crash_sdfgi.zip)
Open scene "crash_sdfgi".
Godot will crash as soon as you preview the camera.
Contributor guide
Research direction
Start with the crash_sdfgi.zip reproduction project and reproduce the crash using a Camera3D with SDFGI enabled and znear or zfar above 1e20. Inspect drivers/vulkan/rendering_device_driver_vulkan.cpp around lines 2525-2528, where VK_ERROR_DEVICE_LOST is reported. Done means the reproduction no longer crashes with these camera values.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics, game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100