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 '<unnamed>' 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
This commit is contained in:
François Mockers 2024-04-27 11:00:10 +02:00 committed by GitHub
parent 9d59e52bb0
commit 22d605c8df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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
}
}