Repository: godot
Issue: Projects exported with the Compatibility renderer fail to run when using Vulkan
Labels: bug,topic:core,topic:rendering,crash

### Godot version

4.2-dev3, 4.1, pretty much every 4.x version I've tried has this issue

### System information

openSUSE Tumbleweed, KDE Plasma, X11, NVIDIA GeForce GTX 1060 6GB

### Issue description

Projects exported with the OpenGL 3 compatibility renderer immediately crash when I attempt to run them using Vulkan, by specifying the rendering driver from the terminal. I have only tried this on Linux, I am unsure if this happens on other platforms. Here's what the terminal prints out when I do this:

 `./OpenGL-To-Vulkan.x86_64 --rendering-driver vulkan --verbose`
 
 ```
 Godot Engine v4.2.dev3.official.013e8e3af - https://godotengine.org
TextServer: Added interface "Dummy"
TextServer: Added interface "ICU / HarfBuzz / Graphite (Built-in)"
Xshape 1.1 detected.
Xinerama 1.1 detected.
Xrandr 1.6 detected.
Xrender 0.11 detected.
Xinput 2.2 detected.
XInput: Refreshing devices.
XInput: No touch devices found.
Vulkan devices:
  #0: NVIDIA NVIDIA GeForce GTX 1060 6GB - Supported, Discrete
Vulkan API 1.3.242 - Forward+ - Using Vulkan Device #0: NVIDIA - NVIDIA GeForce GTX 1060 6GB
Optional extension VK_KHR_fragment_shading_rate not found
Optional extension VK_KHR_incremental_present not found
Optional extension VK_GOOGLE_display_timing not found
- Vulkan Variable Rate Shading not supported
- Vulkan multiview supported:
  max view count: 32
  max instances: 134217727
- Vulkan subgroup:
  size: 32
  stages: STAGE_VERTEX, STAGE_TESSELLATION_CONTROL, STAGE_TESSELLATION_EVALUATION, STAGE_GEOMETRY, STAGE_FRAGMENT, STAGE_COMPUTE, STAGE_RAYGEN_KHR, STAGE_ANY_HIT_KHR, STAGE_CLOSEST_HIT_KHR, STAGE_MISS_KHR, STAGE_INTERSECTION_KHR, STAGE_CALLABLE_KHR
  supported ops: FEATURE_BASIC, FEATURE_VOTE, FEATURE_ARITHMETIC, FEATURE_BALLOT, FEATURE_SHUFFLE, FEATURE_SHUFFLE_RELATIVE, FEATURE_CLUSTERED, FEATURE_QUAD, FEATURE_PARTITIONED_NV
  quad operations in all stages
Startup PSO cache (2.7 MiB)
ScreenSaver: DBus 1.14.8 detected.
FreeDesktopScreenSaver: Acquired screensaver inhibition cookie: 18512
PortalDesktop: DBus 1.14.8 detected.
Using "default" pen tablet driver...
Creating VMA small objects pool for memory type index 7
Shader 'CanvasSdfShaderRD' (group 0) SHA256: afdd8cf93c96ed1ff171e68563598310e7c8379318d4aae63564aaf2b786093c
Shader 'SkeletonShaderRD' (group 0) SHA256: ac9b52f7b53ddccfba6ab797ca9678298ea34cb5fb481f1ae05a876731ceaa44
Shader 'SortShaderRD' (group 0) SHA256: 4c52fc7f37b2ae862c7c9756747634d1a6392e7168c9eb2d2a46478644dd22e8
Shader 'ParticlesShaderRD' (group 0) SHA256: afdb51e3d1bee1838393ec4f932ff04a572021cf54bb999fbedf124e2f554d28
Shader 'ParticlesCopyShaderRD' (group 0) SHA256: 7d2c8a4bac4e91b2050b5a95572c62238ffea856ba436964419f9f15bea71606
Shader 'CanvasShaderRD' (group 0) SHA256: 3f35f4695fb2e7c86096be27875cc47e80c0a3ed710ad94d4fd35cbdb430d3e3
Shader 'CanvasOcclusionShaderRD' (group 0) SHA256: 5dfa64f0e914c287a90f9e423851e554254fc33f8806a8320b4072231d0d9ec5
ERROR: Cannot instantiate RenderingDevice-based renderer with renderer type gl_compatibility
   at: RendererCompositorRD (servers/rendering/renderer_rd/renderer_compositor_rd.cpp:320)
ERROR: Parameter "scene" is null.
   at: get_gi (servers/rendering/renderer_rd/renderer_compositor_rd.h:112)
Segmentation fault (core dumped)
 ```
 
 Exporting this project with the Forward+ renderer runs just fine, even when I specify the rendering driver to be opengl3 from the terminal. So this is an OpenGL-to-Vulkan issue, which doesn't seem to happen with Vulkan-to-OpenGL.

### Steps to reproduce

Export any Godot 4.x project with the compatibility renderer, and then run it from the terminal using `--rendering-driver vulkan`. The below MRP is just an empty Godot project with a single scene, I could not upload an exported binary due to GitHub's size limitations.

### Minimal reproduction project

[OpenGL-To-Vulkan Project.zip](https://github.com/godotengine/godot/files/12328368/OpenGL-To-Vulkan.Project.zip)