From ee3b85928e99f44194d0d4abedd88bf65a3a2614 Mon Sep 17 00:00:00 2001 From: Adam Gausmann Date: Mon, 16 Aug 2021 13:50:08 -0500 Subject: [PATCH] Fix panic in GLES shader processing The backend panics while trying to process uniform global variables when the variable's name is not found in the emitted ReflectionInfo. This patch converts the panicking line into an explicit check, and ignores the corresponding global variable if the name iis not found. Resolves #1803 --- wgpu-hal/src/gles/device.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wgpu-hal/src/gles/device.rs b/wgpu-hal/src/gles/device.rs index ec858bf0d6..6a503a0f7b 100644 --- a/wgpu-hal/src/gles/device.rs +++ b/wgpu-hal/src/gles/device.rs @@ -35,7 +35,10 @@ impl CompilationContext<'_> { let br = var.binding.as_ref().unwrap(); let slot = self.layout.get_slot(br); - let name = reflection_info.uniforms[&handle].clone(); + let name = match reflection_info.uniforms.get(&handle) { + Some(name) => name.clone(), + None => continue, + }; log::debug!( "Rebind buffer: {:?} -> {}, register={:?}, slot={}", var.name.as_ref(),