Document why MAX_JOINTS and MAX_MORPH_WEIGHTS are set (#16324)

# Objective

Fixes #15974

## Solution

Add the comment from @mockersf, adapted to fix in-context.
This commit is contained in:
Benjamin Brienen 2024-12-10 03:03:51 +01:00 committed by GitHub
parent fcaa271693
commit b744fb486b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 0 deletions

View file

@ -8,6 +8,12 @@ use bevy_render::{
use crate::render::skin::MAX_JOINTS;
const MORPH_WEIGHT_SIZE: usize = size_of::<f32>();
/// 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.
pub const MORPH_BUFFER_SIZE: usize = MAX_MORPH_WEIGHTS * MORPH_WEIGHT_SIZE;
const JOINT_SIZE: usize = size_of::<Mat4>();

View file

@ -15,6 +15,12 @@ use bevy_render::{
use bevy_transform::prelude::GlobalTransform;
/// Maximum number of joints supported for skinned meshes.
///
/// It 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.
pub const MAX_JOINTS: usize = 256;
#[derive(Component)]