Skip to content

Commit 2073132

Browse files
committed
Fixes bug where shader crashes on Adreno GPUs using WebGL
1 parent 670f3f0 commit 2073132

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

crates/bevy_pbr/src/render/light.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,14 @@ pub struct GpuLights {
216216

217217
// NOTE: this must be kept in sync with the same constants in pbr.frag
218218
pub const MAX_UNIFORM_BUFFER_POINT_LIGHTS: usize = 256;
219+
220+
//NOTE: When running bevy on Adreno GPU chipsets in WebGL, any value above 1 will result in a crash
221+
// when loading the wgsl "pbr_functions.wgsl" in the function apply_fog.
222+
#[cfg(feature = "webgl")]
223+
pub const MAX_DIRECTIONAL_LIGHTS: usize = 1;
224+
#[cfg(not(feature = "webgl"))]
219225
pub const MAX_DIRECTIONAL_LIGHTS: usize = 10;
226+
220227
#[cfg(not(feature = "webgl"))]
221228
pub const MAX_CASCADES_PER_LIGHT: usize = 4;
222229
#[cfg(feature = "webgl")]

0 commit comments

Comments
 (0)