Repository: godot
Issue: SDFGI causes shader errors when XR shaders are enabled.
Labels: bug,topic:rendering,topic:xr,topic:3d

### Godot version

4.2 Dev 5

### System information

Godot v4.2.dev5 - SteamOS holo (3.5 Preview) - X11 - Vulkan (Forward+) - integrated AMD Custom GPU 0405 (RADV VANGOGH) () - AMD Custom APU 0405 (8 Threads)

### Issue description

When using XR Shaders in Godot v4.2.dev5, SDFGI causes errors when turned on and off, and in some cases, causes crashing and project corruption. Below is a video and an excerpt of some of the issues mentioned. 

```
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
ERROR: Desired set (1) not used by shader.
   at: uniform_set_create (drivers/vulkan/rendering_device_vulkan.cpp:5434)
ERROR: Condition "rid.is_null()" is true. Returning: rid
   at: _allocate_from_uniforms (./servers/rendering/renderer_rd/uniform_set_cache_rd.h:129)
ERROR: Parameter "uniform_set" is null.
   at: draw_list_bind_uniform_set (drivers/vulkan/rendering_device_vulkan.cpp:7336)
Godot Engine v4.2.dev5.official.e3e2528ba - https://godotengine.org
Vulkan API 1.3.261 - Forward+ - Using Vulkan Device #0: AMD - AMD Custom GPU 0405 (RADV VANGOGH)
ERROR: Condition "binsize < sizeof(uint32_t) * 3 + sizeof(RenderingDeviceVulkanShaderBinaryData)" is true. Returning: RID()
   at: shader_create_from_bytecode (drivers/vulkan/rendering_device_vulkan.cpp:4870)
ERROR: Attempted to free invalid ID: 0
   at: _free_internal (drivers/vulkan/rendering_device_vulkan.cpp:8562)
ERROR: Attempted to free invalid ID: 0
   at: _free_internal (drivers/vulkan/rendering_device_vulkan.cpp:8562)
ERROR: Condition "shader.is_null()" is true. Returning: false
   at: _load_from_cache (servers/rendering/renderer_rd/shader_rd.cpp:452)

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.2.dev5.official (e3e2528ba7f6e85ac167d687dd6312b35f558591)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /usr/lib/libc.so.6(+0x39ab0) [0x7fc7bc180ab0] (??:0)
[2] /run/media/deck/25eaaa63-450f-4400-bf57-a1dee344c0f1/Godot/Godot.x86_64() [0x113d794] (??:0)
[3] /run/media/deck/25eaaa63-450f-4400-bf57-a1dee344c0f1/Godot/Godot.x86_64() [0x31dc1cd] (??:0)
[4] /run/media/deck/25eaaa63-450f-4400-bf57-a1dee344c0f1/Godot/Godot.x86_64() [0x3c20301] (??:0)
[5] /run/media/deck/25eaaa63-450f-4400-bf57-a1dee344c0f1/Godot/Godot.x86_64() [0x3c21ee6] (??:0)
[6] /run/media/deck/25eaaa63-450f-4400-bf57-a1dee344c0f1/Godot/Godot.x86_64() [0x37bdc95] (??:0)
[7] /run/media/deck/25eaaa63-450f-4400-bf57-a1dee344c0f1/Godot/Godot.x86_64() [0x435fce0] (??:0)
[8] /usr/lib/libc.so.6(+0x8744b) [0x7fc7bc1ce44b] (??:0)
[9] /usr/lib/libc.so.6(+0x10ae40) [0x7fc7bc251e40] (??:0)
-- END OF BACKTRACE --
================================================================
^C
deck @ steamdeck in .../mmcblk0p1/Godot |18:07:16  
$ ./Godot.x86_64 
Godot Engine v4.2.dev5.official.e3e2528ba - https://godotengine.org
OpenGL API 4.6 (Core Profile) Mesa 23.1.3 (git-58f7632462) - Compatibility - Using Device: AMD - AMD Custom GPU 0405 (vangogh, LLVM 15.0.7, DRM 3.54, 6.1.52-valve2-1-neptune-61)
 
Editing project: /run/media/mmcblk0p1/Godot/Projects/VRMT
Godot Engine v4.2.dev5.official.e3e2528ba - https://godotengine.org
Vulkan API 1.3.261 - Forward+ - Using Vulkan Device #0: AMD - AMD Custom GPU 0405 (RADV VANGOGH)
ERROR: Condition "binsize < sizeof(uint32_t) * 3 + sizeof(RenderingDeviceVulkanShaderBinaryData)" is true. Returning: RID()
   at: shader_create_from_bytecode (drivers/vulkan/rendering_device_vulkan.cpp:4870)
ERROR: Attempted to free invalid ID: 0
   at: _free_internal (drivers/vulkan/rendering_device_vulkan.cpp:8562)
ERROR: Attempted to free invalid ID: 0
   at: _free_internal (drivers/vulkan/rendering_device_vulkan.cpp:8562)
ERROR: Condition "shader.is_null()" is true. Returning: false
   at: _load_from_cache (servers/rendering/renderer_rd/shader_rd.cpp:452)
deck @ steamdeck in .../mmcblk0p1/Godot |18:07:22  
$ 
================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.2.dev5.official (e3e2528ba7f6e85ac167d687dd6312b35f558591)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] /usr/lib/libc.so.6(+0x39ab0) [0x7f3e1ab93ab0] (??:0)
[2] /run/media/deck/25eaaa63-450f-4400-bf57-a1dee344c0f1/Godot/Godot.x86_64() [0x113d794] (??:0)
[3] /run/media/deck/25eaaa63-450f-4400-bf57-a1dee344c0f1/Godot/Godot.x86_64() [0x31dc1cd] (??:0)
[4] /run/media/deck/25eaaa63-450f-4400-bf57-a1dee344c0f1/Godot/Godot.x86_64() [0x3c20301] (??:0)
[5] /run/media/deck/25eaaa63-450f-4400-bf57-a1dee344c0f1/Godot/Godot.x86_64() [0x3c21ee6] (??:0)
[6] /run/media/deck/25eaaa63-450f-4400-bf57-a1dee344c0f1/Godot/Godot.x86_64() [0x37bdc95] (??:0)
[7] /run/media/deck/25eaaa63-450f-4400-bf57-a1dee344c0f1/Godot/Godot.x86_64() [0x435fce0] (??:0)
[8] /usr/lib/libc.so.6(+0x8744b) [0x7f3e1abe144b] (??:0)
[9] /usr/lib/libc.so.6(+0x10ae40) [0x7f3e1ac64e40] (??:0)
-- END OF BACKTRACE --
================================================================
```


https://github.com/godotengine/godot/assets/72290220/81c39ba0-a8bc-43df-9916-ba2c133903df






### Steps to reproduce

Download 4.2 dev 5

Make a new project

Enable OpenXR + Shaders

Enable SDFGI

### Minimal reproduction project

N/A