From 4525f3e9b834bf1094d2aed23e8dacad5f8b3e7a Mon Sep 17 00:00:00 2001 From: Oscar R Date: Thu, 25 Jan 2024 15:03:24 +0100 Subject: [PATCH] comments on why the flags are split up --- crates/bevy_pbr/src/pbr_material.rs | 2 ++ crates/bevy_pbr/src/render/pbr_types.wgsl | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/bevy_pbr/src/pbr_material.rs b/crates/bevy_pbr/src/pbr_material.rs index a74580ea8df573..b1b7d2dcee003e 100644 --- a/crates/bevy_pbr/src/pbr_material.rs +++ b/crates/bevy_pbr/src/pbr_material.rs @@ -572,6 +572,8 @@ bitflags::bitflags! { } } +// NOTE: These bitflags are separate from StandardMaterialFlags due to a bug on some older GPUs +// that are unable to use the last 16 bits of a u32 bitflags::bitflags! { /// Bitflags info about the alpha mode of the material a shader is currently rendering. /// This is accessible in the shader in the [`StandardMaterialUniform`] diff --git a/crates/bevy_pbr/src/render/pbr_types.wgsl b/crates/bevy_pbr/src/render/pbr_types.wgsl index ad7dc5e2fb95a2..194ee85237b585 100644 --- a/crates/bevy_pbr/src/render/pbr_types.wgsl +++ b/crates/bevy_pbr/src/render/pbr_types.wgsl @@ -12,7 +12,9 @@ struct StandardMaterial { ior: f32, attenuation_distance: f32, attenuation_color: vec4, - // 'flags' is a bit field indicating various options. u32 is 32 bits so we have up to 32 options. + // 'flags' is a bit field indicating various options. + // u32 is 32 bits so we would have up to 32 options. Some lower-end mobile GPUs only support 16-bits + // so we can only use half of the u32 flags: u32, alpha_mode_flags: u32, alpha_cutoff: f32,