render_plugin: Autocreate swapchain and update
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 9m45s
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 9m45s
This commit is contained in:
parent
ae0a2be097
commit
62d12f2ab8
5 changed files with 201 additions and 147 deletions
|
@ -6,7 +6,7 @@ use bevy_ecs::{
|
|||
};
|
||||
use engine_vulkan::{
|
||||
VulkanCommandBufferAllocator, VulkanDescriptorSetAllocator, VulkanDevice, VulkanGraphicsQueue,
|
||||
VulkanMemoryAllocator,
|
||||
VulkanInstance, VulkanMemoryAllocator,
|
||||
};
|
||||
use engine_window::raw_handle::WindowWrapper;
|
||||
use window::WindowRenderPlugin;
|
||||
|
@ -31,7 +31,7 @@ impl Render {
|
|||
|
||||
let mut schedule = Schedule::new(Self);
|
||||
|
||||
schedule.configure_sets((Prepare, Queue, Render, Present).chain());
|
||||
schedule.configure_sets((ManageViews, Prepare, Queue, Render, Present).chain());
|
||||
|
||||
schedule
|
||||
}
|
||||
|
@ -49,6 +49,7 @@ impl Plugin for RenderPlugin {
|
|||
let world = app.world();
|
||||
|
||||
world.get_resource::<WindowWrapper>().is_some()
|
||||
&& world.get_resource::<VulkanInstance>().is_some()
|
||||
&& world.get_resource::<VulkanDevice>().is_some()
|
||||
&& world.get_resource::<VulkanGraphicsQueue>().is_some()
|
||||
&& world.get_resource::<VulkanMemoryAllocator>().is_some()
|
||||
|
@ -71,10 +72,6 @@ impl Plugin for RenderPlugin {
|
|||
|
||||
app.add_plugins(WindowRenderPlugin);
|
||||
}
|
||||
|
||||
fn cleanup(&self, app: &mut App) {
|
||||
app.remove_sub_app(RenderApp);
|
||||
}
|
||||
}
|
||||
|
||||
fn extract_app_resources(world: &mut World, render_world: &mut World) {
|
||||
|
@ -82,6 +79,10 @@ fn extract_app_resources(world: &mut World, render_world: &mut World) {
|
|||
.get_resource::<WindowWrapper>()
|
||||
.expect("Failed to get WindowWrapper. Check is WindowPlugin is added before RenderPlugin.");
|
||||
|
||||
let vulkan_instance = world.get_resource::<VulkanInstance>().expect(
|
||||
"Failed to get Vulkan instance. Check is VulkanPlugin is added before RenderPlugin.",
|
||||
);
|
||||
|
||||
let vulkan_device = world
|
||||
.get_resource::<VulkanDevice>()
|
||||
.expect("Failed to get Vulkan device. Check is VulkanPlugin is added before RenderPlugin.");
|
||||
|
@ -102,6 +103,7 @@ fn extract_app_resources(world: &mut World, render_world: &mut World) {
|
|||
.get_resource::<VulkanDescriptorSetAllocator>()
|
||||
.expect("Failed to get Vulkan descriptor set allocator. Check is VulkanPlugin is added before RenderPlugin.");
|
||||
|
||||
render_world.insert_resource(vulkan_instance.clone());
|
||||
render_world.insert_resource(vulkan_device.clone());
|
||||
render_world.insert_resource(vulkan_graphics_queue.clone());
|
||||
render_world.insert_resource(vulkan_memory_allocator.clone());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue