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
@ -118,6 +118,10 @@ impl Plugin for ViewPlugin {
|
|||||||
render_app.add_systems(
|
render_app.add_systems(
|
||||||
Render,
|
Render,
|
||||||
(
|
(
|
||||||
|
// `TextureView`s need to be dropped before reconfiguring window surfaces.
|
||||||
|
clear_view_attachments
|
||||||
|
.in_set(RenderSet::ManageViews)
|
||||||
|
.before(create_surfaces),
|
||||||
prepare_view_attachments
|
prepare_view_attachments
|
||||||
.in_set(RenderSet::ManageViews)
|
.in_set(RenderSet::ManageViews)
|
||||||
.before(prepare_view_targets)
|
.before(prepare_view_targets)
|
||||||
@ -814,7 +818,6 @@ pub fn prepare_view_attachments(
|
|||||||
cameras: Query<&ExtractedCamera>,
|
cameras: Query<&ExtractedCamera>,
|
||||||
mut view_target_attachments: ResMut<ViewTargetAttachments>,
|
mut view_target_attachments: ResMut<ViewTargetAttachments>,
|
||||||
) {
|
) {
|
||||||
view_target_attachments.clear();
|
|
||||||
for camera in cameras.iter() {
|
for camera in cameras.iter() {
|
||||||
let Some(target) = &camera.target else {
|
let Some(target) = &camera.target else {
|
||||||
continue;
|
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(
|
pub fn prepare_view_targets(
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
clear_color_global: Res<ClearColor>,
|
clear_color_global: Res<ClearColor>,
|
||||||
|
Loading…
Reference in New Issue
Block a user