From 9e6db1a1715bfdb6848e5bfdb4cfeecafc0c6aea Mon Sep 17 00:00:00 2001 From: johannes Date: Tue, 13 Feb 2024 20:23:55 +0100 Subject: [PATCH] Some reordering of struct/class members to pack items tighter or with better alignment --- code/foundation/core/refcounted.h | 3 +-- code/foundation/core/rtti.h | 2 +- code/foundation/io/binaryreader.h | 4 ++-- code/foundation/util/string.h | 2 +- code/physics/physics/physxstate.h | 20 ++++++++++---------- code/physics/physics/streamactorpool.h | 3 ++- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/code/foundation/core/refcounted.h b/code/foundation/core/refcounted.h index 79ab92edd2..6bbb9aff0f 100644 --- a/code/foundation/core/refcounted.h +++ b/code/foundation/core/refcounted.h @@ -90,10 +90,9 @@ class RefCounted static ThreadLocal bool isInCreate; static Threading::CriticalSection criticalSection; private: + bool destroyed; static RefCountedList list; RefCountedList::Iterator listIterator; - bool destroyed; - public: /// register debug name void SetDebugName(const Util::String& name); diff --git a/code/foundation/core/rtti.h b/code/foundation/core/rtti.h index 9d202bc2a6..74dc38ed2c 100644 --- a/code/foundation/core/rtti.h +++ b/code/foundation/core/rtti.h @@ -70,9 +70,9 @@ class Rtti Util::String name; const Core::Rtti* parent; Util::FourCC fourCC; + SizeT instanceSize; Creator creator; ArrayCreator arrayCreator; - SizeT instanceSize; }; //------------------------------------------------------------------------------ diff --git a/code/foundation/io/binaryreader.h b/code/foundation/io/binaryreader.h index 4097910457..c891ffe032 100644 --- a/code/foundation/io/binaryreader.h +++ b/code/foundation/io/binaryreader.h @@ -101,11 +101,11 @@ class BinaryReader : public StreamReader void ReadRawData(void* ptr, SizeT numBytes); public: - bool enableMapping; - bool isMapped; System::ByteOrder byteOrder; unsigned char* mapCursor; unsigned char* mapEnd; + bool enableMapping; + bool isMapped; }; //------------------------------------------------------------------------------ diff --git a/code/foundation/util/string.h b/code/foundation/util/string.h index b33ad120b4..4c3112cc4f 100644 --- a/code/foundation/util/string.h +++ b/code/foundation/util/string.h @@ -405,7 +405,7 @@ class String enum { - LocalStringSize = 20, + LocalStringSize = 16, }; char* heapBuffer; char localBuffer[LocalStringSize]; diff --git a/code/physics/physics/physxstate.h b/code/physics/physics/physxstate.h index 702433b61e..81e64765c4 100644 --- a/code/physics/physics/physxstate.h +++ b/code/physics/physics/physxstate.h @@ -28,23 +28,23 @@ class PhysxState : public physx::PxSimulationEventCallback physx::PxPhysics * physics; physx::PxPvd *pvd; physx::PxPvdTransport *transport; + Util::Delegate onSleepCallback; + Util::Delegate onWakeCallback; + Physics::Allocator allocator; + Physics::ErrorCallback errorCallback; + Physics::Material FallbackMaterial; + Util::Set awakeActors; + + Util::Dictionary materialNameTable; + Util::StackArray activeScenes; Util::StackArray materials; - Util::Dictionary materialNameTable; + Util::StackArray activeSceneIds; Util::StackArray deadSceneIds; - Physics::Material FallbackMaterial; - - Util::Set awakeActors; - - Physics::Allocator allocator; - Physics::ErrorCallback errorCallback; physx::PxOverlapHit overlapBuffer[MAX_SHAPE_OVERLAPS]; - Util::Delegate onSleepCallback; - Util::Delegate onWakeCallback; - /// PhysxState(); /// Setup Px subsystems diff --git a/code/physics/physics/streamactorpool.h b/code/physics/physics/streamactorpool.h index af453fcdb0..c4d133c922 100644 --- a/code/physics/physics/streamactorpool.h +++ b/code/physics/physics/streamactorpool.h @@ -30,8 +30,9 @@ struct ActorInfo Util::Array densities; Util::Array colliders; SizeT instanceCount; - CollisionFeedback feedbackFlag; uint16_t collisionGroup; + CollisionFeedback feedbackFlag; + #ifdef NEBULA_DEBUG Util::Array shapeDebugNames; #endif