Add memory profiler category for Cloth

This commit is contained in:
Wojtek Figat
2026-03-24 23:01:09 +01:00
parent 13f5222ec7
commit 7b3cfd989f
4 changed files with 13 additions and 8 deletions

View File

@@ -133,7 +133,7 @@ Array<Float3> Cloth::GetParticles() const
if (_cloth)
{
PROFILE_CPU();
PROFILE_MEM(Physics);
PROFILE_MEM(PhysicsCloth);
PhysicsBackend::LockClothParticles(_cloth);
const Span<const Float4> particles = PhysicsBackend::GetClothParticles(_cloth);
result.Resize(particles.Length());
@@ -150,7 +150,7 @@ Array<Float3> Cloth::GetParticles() const
void Cloth::SetParticles(Span<const Float3> value)
{
PROFILE_CPU();
PROFILE_MEM(Physics);
PROFILE_MEM(PhysicsCloth);
#if USE_CLOTH_SANITY_CHECKS
{
// Sanity check
@@ -180,7 +180,7 @@ Span<float> Cloth::GetPaint() const
void Cloth::SetPaint(Span<const float> value)
{
PROFILE_CPU();
PROFILE_MEM(Physics);
PROFILE_MEM(PhysicsCloth);
#if USE_CLOTH_SANITY_CHECKS
{
// Sanity check
@@ -312,7 +312,7 @@ void Cloth::Deserialize(DeserializeStream& stream, ISerializeModifier* modifier)
{
Actor::Deserialize(stream, modifier);
PROFILE_MEM(Physics);
PROFILE_MEM(PhysicsCloth);
DESERIALIZE_MEMBER(Mesh, _mesh);
_mesh.Actor = nullptr; // Don't store this reference
DESERIALIZE_MEMBER(Force, _forceSettings);
@@ -552,7 +552,7 @@ bool Cloth::CreateCloth()
{
#if WITH_CLOTH
PROFILE_CPU();
PROFILE_MEM(Physics);
PROFILE_MEM(PhysicsCloth);
// Skip if all vertices are fixed so cloth sim doesn't make sense
if (_paint.HasItems())
@@ -658,7 +658,7 @@ void Cloth::CalculateInvMasses(MeshAccessor& accessor, Array<float>& invMasses)
if (_paint.IsEmpty())
return;
PROFILE_CPU();
PROFILE_MEM(Physics);
PROFILE_MEM(PhysicsCloth);
// Get mesh data
auto positions = accessor.Position();
@@ -929,7 +929,7 @@ void Cloth::RunClothDeformer(const MeshBase* mesh, MeshDeformationData& deformat
return;
#if WITH_CLOTH
PROFILE_CPU_NAMED("Cloth");
PROFILE_MEM(Physics);
PROFILE_MEM(PhysicsCloth);
PhysicsBackend::LockClothParticles(_cloth);
const Span<const Float4> particles = PhysicsBackend::GetClothParticles(_cloth);
auto vbCount = (uint32)mesh->GetVertexCount();

View File

@@ -1177,6 +1177,7 @@ void ScenePhysX::UpdateVehicles(float dt)
void ScenePhysX::PreSimulateCloth(int32 i)
{
PROFILE_CPU();
PROFILE_MEM(PhysicsCloth);
auto clothPhysX = ClothsList[i];
auto& clothSettings = Cloths[clothPhysX];
@@ -1379,6 +1380,7 @@ void ScenePhysX::UpdateCloths(float dt)
if (!clothSolver || ClothsList.IsEmpty())
return;
PROFILE_CPU_NAMED("Physics.Cloth");
PROFILE_MEM(PhysicsCloth);
{
PROFILE_CPU_NAMED("Pre");
@@ -3994,7 +3996,7 @@ void PhysicsBackend::RemoveVehicle(void* scene, WheeledVehicle* actor)
void* PhysicsBackend::CreateCloth(const PhysicsClothDesc& desc)
{
PROFILE_CPU();
PROFILE_MEM(Physics);
PROFILE_MEM(PhysicsCloth);
#if USE_CLOTH_SANITY_CHECKS
{
// Sanity check

View File

@@ -263,6 +263,7 @@ void InitProfilerMemory(const Char* cmdLine, int32 stage)
INIT_PARENT(Level, LevelTerrain);
INIT_PARENT(Navigation, NavigationMesh);
INIT_PARENT(Navigation, NavigationBuilding);
INIT_PARENT(Physics, PhysicsCloth);
INIT_PARENT(Scripting, ScriptingVisual);
INIT_PARENT(Scripting, ScriptingCSharp);
INIT_PARENT(ScriptingCSharp, ScriptingCSharpGCCommitted);

View File

@@ -120,6 +120,8 @@ public:
// Total physics memory.
Physics,
// Cloth simulation and particles data.
PhysicsCloth,
// Total scripting memory allocated by game.
Scripting,