From 5bf5d48759cf8bd300de2aaefaaaccec3b2dc4c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Fri, 23 Feb 2024 08:14:09 +0100 Subject: [PATCH] set pipeline to queued when shader is not yet available (#12051) # Objective - Fixes #11977 - user defined shaders don't work in wasm - After investigation, it won't work if the shader is not yet available when compiling the pipeline on all platforms, for example if you load many assets ## Solution - Set the pipeline state to queued when it errs waiting for the shader so that it's retried --- crates/bevy_render/src/render_resource/pipeline_cache.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/bevy_render/src/render_resource/pipeline_cache.rs b/crates/bevy_render/src/render_resource/pipeline_cache.rs index fe014e7c34372..ab921024129a5 100644 --- a/crates/bevy_render/src/render_resource/pipeline_cache.rs +++ b/crates/bevy_render/src/render_resource/pipeline_cache.rs @@ -895,7 +895,9 @@ impl PipelineCache { CachedPipelineState::Err(err) => match err { // Retry PipelineCacheError::ShaderNotLoaded(_) - | PipelineCacheError::ShaderImportNotYetAvailable => {} + | PipelineCacheError::ShaderImportNotYetAvailable => { + cached_pipeline.state = CachedPipelineState::Queued; + } // Shader could not be processed ... retrying won't help PipelineCacheError::ProcessShaderError(err) => {