From 22d605c8df4ad13b773f73fd6eae42ca3ac56fc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Mockers?= Date: Sat, 27 Apr 2024 11:00:10 +0200 Subject: [PATCH] asset throttling: don't be exhausted if there is no limit (#13112) # Objective - Since #12622 example `compute_shader_game_of_life` crashes ``` thread 'Compute Task Pool (2)' panicked at examples/shader/compute_shader_game_of_life.rs:137:65: called `Option::unwrap()` on a `None` value note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace Encountered a panic in system `compute_shader_game_of_life::prepare_bind_group`! thread '' panicked at examples/shader/compute_shader_game_of_life.rs:254:34: Requested resource compute_shader_game_of_life::GameOfLifeImageBindGroups does not exist in the `World`. Did you forget to add it using `app.insert_resource` / `app.init_resource`? Resources are also implicitly added via `app.add_event`, and can be added by plugins. Encountered a panic in system `bevy_render::renderer::render_system`! ``` ## Solution - `exhausted()` now checks that there is a limit --- crates/bevy_render/src/render_asset.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/bevy_render/src/render_asset.rs b/crates/bevy_render/src/render_asset.rs index f2d78bdfc9..e3a6aab5fb 100644 --- a/crates/bevy_render/src/render_asset.rs +++ b/crates/bevy_render/src/render_asset.rs @@ -442,6 +442,6 @@ impl RenderAssetBytesPerFrame { // check if any bytes remain available for writing this frame fn exhausted(&self) -> bool { - self.available == 0 + self.max_bytes.is_some() && self.available == 0 } }