stop retrying removed assets (#12505)

# Objective

assets that don't load before they get removed are retried forever,
causing buffer churn and slowdown.

## Solution

stop trying to prepare dead assets.
This commit is contained in:
robtfm 2024-03-16 04:49:16 +00:00 committed by GitHub
parent 3a83f4e51e
commit 1323de7cd7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 16 additions and 0 deletions

View file

@ -934,6 +934,10 @@ pub fn prepare_materials<M: Material>(
) {
let queued_assets = std::mem::take(&mut prepare_next_frame.assets);
for (id, material) in queued_assets.into_iter() {
if extracted_assets.removed.contains(&id) {
continue;
}
match prepare_material(
&material,
&render_device,

View file

@ -402,6 +402,10 @@ pub fn prepare_assets<A: RenderAsset>(
let mut param = param.into_inner();
let queued_assets = std::mem::take(&mut prepare_next_frame.assets);
for (id, extracted_asset) in queued_assets {
if extracted_assets.removed.contains(&id) {
continue;
}
match extracted_asset.prepare_asset(&mut param) {
Ok(prepared_asset) => {
render_assets.insert(id, prepared_asset);

View file

@ -572,6 +572,10 @@ pub fn prepare_materials_2d<M: Material2d>(
) {
let queued_assets = std::mem::take(&mut prepare_next_frame.assets);
for (id, material) in queued_assets {
if extracted_assets.removed.contains(&id) {
continue;
}
match prepare_material2d(
&material,
&render_device,

View file

@ -691,6 +691,10 @@ pub fn prepare_ui_materials<M: UiMaterial>(
) {
let queued_assets = std::mem::take(&mut prepare_next_frame.assets);
for (id, material) in queued_assets {
if extracted_assets.removed.contains(&id) {
continue;
}
match prepare_ui_material(
&material,
&render_device,