Skip to content

Clear view attachments before resizing window surfaces #15087

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion crates/bevy_render/src/view/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,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)
Expand Down Expand Up @@ -817,7 +821,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;
Expand All @@ -842,6 +845,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>,
Expand Down