Skip to content

Commit

Permalink
comments on why the flags are split up
Browse files Browse the repository at this point in the history
  • Loading branch information
oscrim committed Jan 25, 2024
1 parent a029cbd commit 4525f3e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions crates/bevy_pbr/src/pbr_material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`]
Expand Down
4 changes: 3 additions & 1 deletion crates/bevy_pbr/src/render/pbr_types.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ struct StandardMaterial {
ior: f32,
attenuation_distance: f32,
attenuation_color: vec4<f32>,
// '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,
Expand Down

0 comments on commit 4525f3e

Please sign in to comment.