From 1a9c5294313612045f1b0caeb6cac572b476c603 Mon Sep 17 00:00:00 2001 From: David Lenaerts Date: Thu, 2 Oct 2025 14:27:48 +0200 Subject: [PATCH 1/3] fix(gles): Cause shader recompilation when changing push constants in gles by including them into cache key. --- wgpu-hal/src/gles/device.rs | 3 ++- wgpu-hal/src/gles/mod.rs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/wgpu-hal/src/gles/device.rs b/wgpu-hal/src/gles/device.rs index b45d53cc23e..534501d6dcc 100644 --- a/wgpu-hal/src/gles/device.rs +++ b/wgpu-hal/src/gles/device.rs @@ -2,7 +2,7 @@ use alloc::{ borrow::ToOwned, format, string::String, string::ToString as _, sync::Arc, vec, vec::Vec, }; use core::{cmp::max, convert::TryInto, num::NonZeroU32, ptr, sync::atomic::Ordering}; - +use std::hash::Hash; use arrayvec::ArrayVec; use glow::HasContext; use naga::FastHashMap; @@ -319,6 +319,7 @@ impl super::Device { shader_id: stage.module.id, entry_point: stage.entry_point.to_owned(), zero_initialize_workgroup_memory: stage.zero_initialize_workgroup_memory, + constant_hash: stage.constants.iter().map(|(key, value)| format!("{}:{}", key, value)).collect(), }); } let mut guard = self diff --git a/wgpu-hal/src/gles/mod.rs b/wgpu-hal/src/gles/mod.rs index b56a851e395..0a9b41980f5 100644 --- a/wgpu-hal/src/gles/mod.rs +++ b/wgpu-hal/src/gles/mod.rs @@ -705,6 +705,7 @@ struct ProgramStage { shader_id: ShaderId, entry_point: String, zero_initialize_workgroup_memory: bool, + constant_hash: String, } #[derive(PartialEq, Eq, Hash)] From 9d0821c16d9e50a2b8bd08c30f13ad34deff1dd3 Mon Sep 17 00:00:00 2001 From: David Lenaerts Date: Thu, 2 Oct 2025 14:46:23 +0200 Subject: [PATCH 2/3] fix(gles): Clean up import --- wgpu-hal/src/gles/device.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wgpu-hal/src/gles/device.rs b/wgpu-hal/src/gles/device.rs index 534501d6dcc..64ebc2c0666 100644 --- a/wgpu-hal/src/gles/device.rs +++ b/wgpu-hal/src/gles/device.rs @@ -1,9 +1,8 @@ use alloc::{ borrow::ToOwned, format, string::String, string::ToString as _, sync::Arc, vec, vec::Vec, }; -use core::{cmp::max, convert::TryInto, num::NonZeroU32, ptr, sync::atomic::Ordering}; -use std::hash::Hash; use arrayvec::ArrayVec; +use core::{cmp::max, convert::TryInto, num::NonZeroU32, ptr, sync::atomic::Ordering}; use glow::HasContext; use naga::FastHashMap; @@ -319,7 +318,11 @@ impl super::Device { shader_id: stage.module.id, entry_point: stage.entry_point.to_owned(), zero_initialize_workgroup_memory: stage.zero_initialize_workgroup_memory, - constant_hash: stage.constants.iter().map(|(key, value)| format!("{}:{}", key, value)).collect(), + constant_hash: stage + .constants + .iter() + .map(|(key, value)| format!("{}:{}", key, value)) + .collect(), }); } let mut guard = self From bc566346f513e2fb174e896cce33d0cad193bc77 Mon Sep 17 00:00:00 2001 From: David Lenaerts Date: Thu, 2 Oct 2025 14:52:30 +0200 Subject: [PATCH 3/3] fix(gles): Clean up format! --- wgpu-hal/src/gles/device.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wgpu-hal/src/gles/device.rs b/wgpu-hal/src/gles/device.rs index 64ebc2c0666..457bc20028c 100644 --- a/wgpu-hal/src/gles/device.rs +++ b/wgpu-hal/src/gles/device.rs @@ -321,7 +321,7 @@ impl super::Device { constant_hash: stage .constants .iter() - .map(|(key, value)| format!("{}:{}", key, value)) + .map(|(key, value)| format!("{key}:{value}")) .collect(), }); }