-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Open
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useS-Needs-DesignThis issue requires design work to think about how it would best be accomplishedThis issue requires design work to think about how it would best be accomplished
Description
We added support for custom Vulkan instance/device intiailization in #20565. However, it struggles to express some common Vulkan patterns.
Consider the following:
pub struct VulkanPlugin;
impl Plugin for VulkanPlugin {
fn build(&self, app: &mut App) {
let mut raw_vulkan_settings = app
.world_mut()
.get_resource_or_init::<RawVulkanInitSettings>();
unsafe {
raw_vulkan_settings.add_create_device_callback(
move |mut args, adapter, additional_vulkan_features| {
let mut vk_sync_2_feature =
vk::PhysicalDeviceSynchronization2Features::default().synchronization2(true);
*args.create_info = args.create_info
.push_next(&mut vk_sync_2_feature);
});
}
}
}
We want to push vk_sync_2_feature
onto the pNext chain of create_info
. However, because we are adding a callback, this requires that vk_sync_2_feature
lives longer than callback.
In the regular open_with_callback
flow used by wgpu
, this is trivially avoided as the callback is immediately invoked in the course of returning the device.
Metadata
Metadata
Assignees
Labels
A-RenderingDrawing game state to the screenDrawing game state to the screenC-UsabilityA targeted quality-of-life change that makes Bevy easier to useA targeted quality-of-life change that makes Bevy easier to useS-Needs-DesignThis issue requires design work to think about how it would best be accomplishedThis issue requires design work to think about how it would best be accomplished