From 4d9b00fbd992166b3efd4df5e2d84f070128d96f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristoffer=20=C3=96dmark?= Date: Fri, 28 Apr 2023 18:42:55 +0200 Subject: [PATCH] Fixes bug where shader crashes on Adreno GPUs using WebGL --- crates/bevy_pbr/src/render/light.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/crates/bevy_pbr/src/render/light.rs b/crates/bevy_pbr/src/render/light.rs index 1e73198a8744d..26b9a9375bf66 100644 --- a/crates/bevy_pbr/src/render/light.rs +++ b/crates/bevy_pbr/src/render/light.rs @@ -216,7 +216,14 @@ pub struct GpuLights { // NOTE: this must be kept in sync with the same constants in pbr.frag pub const MAX_UNIFORM_BUFFER_POINT_LIGHTS: usize = 256; + +//NOTE: When running bevy on Adreno GPU chipsets in WebGL, any value above 1 will result in a crash +// when loading the wgsl "pbr_functions.wgsl" in the function apply_fog. +#[cfg(feature = "webgl")] +pub const MAX_DIRECTIONAL_LIGHTS: usize = 1; +#[cfg(not(feature = "webgl"))] pub const MAX_DIRECTIONAL_LIGHTS: usize = 10; + #[cfg(not(feature = "webgl"))] pub const MAX_CASCADES_PER_LIGHT: usize = 4; #[cfg(feature = "webgl")]