You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Opt-in raw vulkan initialization with hooks (#20565)
# Objective
Currently registering additional required Vulkan features requires
either hard-coding them into `bevy_render` (see the current [DLSS
proposal](#19864)), or forcing
the plugin to take full manual control over wgpu initialization. Neither
is an acceptable or scalable option for a modular engine like Bevy.
## Solution
* Add a new `raw_vulkan_init` Cargo feature, that when enabled switches
to wgpu's raw Vulkan init path, which accepts callbacks that allow
checking and requiring additional Vulkan features.
* Add a new `WgpuRawVulkanInitSettings` resource, which provides wgpu
Vulkan Instance and Device init callbacks, which can be used to detect
and register vulkan features.
* These callbacks can register arbitrary features in the new
`AdditionalVulkanFeatures` resource, which is inserted into the
RenderApp at the same time that the RenderDevice is.
This enables plugins to register initialization callbacks, which must
happen _before_ RenderPlugin. They can then feed off of
`AdditionalVulkanFeatures`, after the renderer is initialized, to detect
if a given feature is supported.
Due to the current lifecycles, this is best accomplished with either:
* A separate "init plugin" that is registered before RenderPlugin, and a
"logic plugin" that does everything else. This should be used if the
plugin logic needs `Plugin::build()` access to render device state,
which needs to be registered _after_ RenderPlugin to have access. The
proposed DLSS feature needs this pattern.
* A single "init plugin" that is registered before RenderPlugin and does
everything. Use this pattern if you can as it is simpler.
With deferred plugin init, we could remove the need for this split.
---------
Co-authored-by: JMS55 <[email protected]>
0 commit comments