Skip to content

Commit

Permalink
duh
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Feb 27, 2024
1 parent 859f4b8 commit d48584e
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions examples/shader/compute_shader_game_of_life.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,19 @@ struct GameOfLifeComputePlugin;
struct GameOfLifeLabel;

impl Plugin for GameOfLifeComputePlugin {
fn build(&self, app: &mut App) {
// Extract the game of life image resource from the main world into the render world
// for operation on by the compute shader and display on the sprite.
app.add_plugins(ExtractResourcePlugin::<GameOfLifeImage>::default());
}
fn build(&self, _app: &mut App) {}

fn finish(&self, app: &mut App) {
let render_app = app.sub_app_mut(RenderApp);

if !render_app
.world
.resource::<RenderAdapter>()
.get_texture_format_features(TextureFormat::Rgba8Unorm)
.allowed_usages
.contains(TextureUsages::STORAGE_BINDING)
if !dbg!(
render_app
.world
.resource::<RenderAdapter>()
.get_texture_format_features(TextureFormat::Rgba8Unorm)
.allowed_usages
)
.contains(TextureUsages::STORAGE_BINDING)
{
error!("Rgba8Unorm texture format does not support STORAGE_BINDING usage, exiting.");
app.world.send_event(AppExit);
Expand All @@ -104,6 +102,10 @@ impl Plugin for GameOfLifeComputePlugin {
let mut render_graph = render_app.world.resource_mut::<RenderGraph>();
render_graph.add_node(GameOfLifeLabel, GameOfLifeNode::default());
render_graph.add_node_edge(GameOfLifeLabel, bevy::render::graph::CameraDriverLabel);

// Extract the game of life image resource from the main world into the render world
// for operation on by the compute shader and display on the sprite.
app.add_plugins(ExtractResourcePlugin::<GameOfLifeImage>::default());
}
}

Expand Down

0 comments on commit d48584e

Please sign in to comment.