Skip to content

Commit

Permalink
asset throttling: don't be exhausted if there is no limit (#13112)
Browse files Browse the repository at this point in the history
# 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
  • Loading branch information
mockersf committed Apr 27, 2024
1 parent 9d59e52 commit 22d605c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/bevy_render/src/render_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

0 comments on commit 22d605c

Please sign in to comment.