mirror of
https://github.com/bevyengine/bevy
synced 2024-11-13 00:17:27 +00:00
Clear view attachments before resizing window surfaces (#15087)
# Objective - Fixes #15077 ## Solution - Clears `ViewTargetAttachments` resource every frame before `create_surfaces` system instead, which was previously done after `extract_windows`. ## Testing - Confirmed that examples no longer panic on window resizing with DX12 backend. - `screenshot` example keeps working after this change.
This commit is contained in:
parent
ff308488fe
commit
2ec164d279
1 changed files with 9 additions and 1 deletions
|
@ -118,6 +118,10 @@ impl Plugin for ViewPlugin {
|
|||
render_app.add_systems(
|
||||
Render,
|
||||
(
|
||||
// `TextureView`s need to be dropped before reconfiguring window surfaces.
|
||||
clear_view_attachments
|
||||
.in_set(RenderSet::ManageViews)
|
||||
.before(create_surfaces),
|
||||
prepare_view_attachments
|
||||
.in_set(RenderSet::ManageViews)
|
||||
.before(prepare_view_targets)
|
||||
|
@ -814,7 +818,6 @@ pub fn prepare_view_attachments(
|
|||
cameras: Query<&ExtractedCamera>,
|
||||
mut view_target_attachments: ResMut<ViewTargetAttachments>,
|
||||
) {
|
||||
view_target_attachments.clear();
|
||||
for camera in cameras.iter() {
|
||||
let Some(target) = &camera.target else {
|
||||
continue;
|
||||
|
@ -839,6 +842,11 @@ pub fn prepare_view_attachments(
|
|||
}
|
||||
}
|
||||
|
||||
/// Clears the view target [`OutputColorAttachment`]s.
|
||||
pub fn clear_view_attachments(mut view_target_attachments: ResMut<ViewTargetAttachments>) {
|
||||
view_target_attachments.clear();
|
||||
}
|
||||
|
||||
pub fn prepare_view_targets(
|
||||
mut commands: Commands,
|
||||
clear_color_global: Res<ClearColor>,
|
||||
|
|
Loading…
Reference in a new issue