diff --git a/crates/bevy_mesh/src/morph.rs b/crates/bevy_mesh/src/morph.rs index ce5767b90f56d..9509433216947 100644 --- a/crates/bevy_mesh/src/morph.rs +++ b/crates/bevy_mesh/src/morph.rs @@ -12,6 +12,11 @@ use thiserror::Error; pub const MAX_TEXTURE_WIDTH: u32 = 2048; /// Max target count available for [morph targets](MorphWeights). +/// +/// This value is used to allocate morph target weight buffers. The current +/// value is chosen because it is guaranteed to work everywhere. To allow for +/// larger values, the limit would need to be checked against the GPU at runtime, +/// which would mean not using a compile-time constant anymore. pub const MAX_MORPH_WEIGHTS: usize = 256; /// The maximum number of morph target components, if morph target textures are diff --git a/crates/bevy_pbr/src/render/mesh_bindings.rs b/crates/bevy_pbr/src/render/mesh_bindings.rs index 0e72ad666b885..529202fdf32a0 100644 --- a/crates/bevy_pbr/src/render/mesh_bindings.rs +++ b/crates/bevy_pbr/src/render/mesh_bindings.rs @@ -13,11 +13,7 @@ use crate::{binding_arrays_are_usable, render::skin::MAX_JOINTS, skin, LightmapS const MORPH_WEIGHT_SIZE: usize = size_of::(); -/// This is used to allocate buffers. -/// The correctness of the value depends on the GPU/platform. -/// The current value is chosen because it is guaranteed to work everywhere. -/// To allow for bigger values, a check must be made for the limits -/// of the GPU at runtime, which would mean not using consts anymore. +/// Buffer size used to store the maximum supported number of morph weights. pub const MORPH_BUFFER_SIZE: usize = MAX_MORPH_WEIGHTS * MORPH_WEIGHT_SIZE; const JOINT_SIZE: usize = size_of::();