Skip to content

Commit

Permalink
exit early if not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
mockersf committed Feb 27, 2024
1 parent 347b58b commit 6480255
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion examples/shader/compute_shader_game_of_life.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
//! is rendered to the screen.
use bevy::{
app::AppExit,
prelude::*,
render::{
extract_resource::{ExtractResource, ExtractResourcePlugin},
render_asset::RenderAssetUsages,
render_asset::RenderAssets,
render_graph::{self, RenderGraph, RenderLabel},
render_resource::*,
renderer::{RenderContext, RenderDevice},
renderer::{RenderAdapter, RenderContext, RenderDevice},
Render, RenderApp, RenderSet,
},
window::WindowPlugin,
Expand Down Expand Up @@ -92,6 +93,17 @@ impl Plugin for GameOfLifeComputePlugin {
fn finish(&self, app: &mut App) {
let render_app = app.sub_app_mut(RenderApp);
render_app.init_resource::<GameOfLifePipeline>();

if !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 Down

0 comments on commit 6480255

Please sign in to comment.