From c364710d1f94df7e0cb96c5454da0c120d21e01e Mon Sep 17 00:00:00 2001 From: andriyDev Date: Thu, 29 May 2025 04:30:53 -0700 Subject: [PATCH] Fix the game of life example panicking if the pipeline shader isn't ready on the first frame. (#19420) # Objective - Due to recent changes related to #19024, the `compute_shader_game_of_life` example panics on some machines especially on Linux. - This is due to us switching more shaders to embedded shaders - this means the compute shader in this example takes more than one frame to load. - The panic in the example occurs if the shader fails to load by the first frame (since the pipeline considers that an error). ## Solution - Make the example do nothing if the shader isn't loaded yet. This has the effect of waiting for the shader to load. ## Testing - Tested the example on my Linux laptop. --- examples/shader/compute_shader_game_of_life.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/shader/compute_shader_game_of_life.rs b/examples/shader/compute_shader_game_of_life.rs index 48fac29e7b..cb7d283d1e 100644 --- a/examples/shader/compute_shader_game_of_life.rs +++ b/examples/shader/compute_shader_game_of_life.rs @@ -229,6 +229,8 @@ impl render_graph::Node for GameOfLifeNode { CachedPipelineState::Ok(_) => { self.state = GameOfLifeState::Init; } + // If the shader hasn't loaded yet, just wait. + CachedPipelineState::Err(PipelineCacheError::ShaderNotLoaded(_)) => {} CachedPipelineState::Err(err) => { panic!("Initializing assets/{SHADER_ASSET_PATH}:\n{err}") }