Просмотр исходного кода

Further improved compile speed (#1873)

* Added forward declaration of UnorderedMap/Set so that we need to include these in less places
* Created seperate header ObjectToIDMap.h to reduce the number of files we need to include
* Removed the use of chrono in Profiler.h
* Split off CameraState to a separate file which avoids including Renderer.h for every Test
* Removed Keyboard.h include for every Test and added them for the tests that actually needed it
* Also removed using namespace std from TestFramework and moved this to Samples
Jorrit Rouwe 2 недель назад
Родитель
Сommit
fe0b87a2ab
55 измененных файлов с 154 добавлено и 79 удалено
  1. 21 0
      Jolt/Core/ObjectToIDMap.h
  2. 5 3
      Jolt/Core/Profiler.cpp
  3. 2 3
      Jolt/Core/Profiler.h
  4. 1 6
      Jolt/Core/StreamUtils.h
  5. 2 1
      Jolt/Core/UnorderedMap.h
  6. 14 0
      Jolt/Core/UnorderedMapFwd.h
  7. 2 1
      Jolt/Core/UnorderedSet.h
  8. 14 0
      Jolt/Core/UnorderedSetFwd.h
  9. 3 0
      Jolt/Jolt.cmake
  10. 1 0
      Jolt/Physics/Body/BodyCreationSettings.cpp
  11. 1 1
      Jolt/Physics/Body/BodyCreationSettings.h
  12. 1 0
      Jolt/Physics/Character/CharacterVirtual.h
  13. 1 0
      Jolt/Physics/Collision/Shape/MeshShape.cpp
  14. 2 3
      Jolt/Physics/Collision/Shape/Shape.cpp
  15. 2 3
      Jolt/Physics/Collision/Shape/Shape.h
  16. 2 0
      Jolt/Physics/Hair/HairSettings.cpp
  17. 3 1
      Jolt/Physics/Hair/HairSettings.h
  18. 1 0
      Jolt/Physics/PhysicsScene.cpp
  19. 1 2
      Jolt/Physics/Ragdoll/Ragdoll.cpp
  20. 1 2
      Jolt/Physics/SoftBody/SoftBodyCreationSettings.cpp
  21. 1 1
      Jolt/Physics/SoftBody/SoftBodyCreationSettings.h
  22. 1 3
      Jolt/Physics/SoftBody/SoftBodySharedSettings.cpp
  23. 1 1
      Jolt/Physics/SoftBody/SoftBodySharedSettings.h
  24. 2 1
      Jolt/Skeleton/SkeletalAnimation.h
  25. 2 0
      Samples/Samples.h
  26. 1 0
      Samples/Tests/Character/CharacterBaseTest.cpp
  27. 1 0
      Samples/Tests/Character/CharacterPlanetTest.cpp
  28. 1 0
      Samples/Tests/Character/CharacterSpaceShipTest.cpp
  29. 4 0
      Samples/Tests/General/MultithreadedTest.cpp
  30. 3 2
      Samples/Tests/Test.h
  31. 1 0
      Samples/Tests/Vehicle/MotorcycleTest.cpp
  32. 1 0
      Samples/Tests/Vehicle/TankTest.cpp
  33. 1 0
      Samples/Tests/Vehicle/VehicleConstraintTest.cpp
  34. 1 0
      Samples/Tests/Vehicle/VehicleSixDOFTest.cpp
  35. 1 0
      Samples/Tests/Vehicle/VehicleStressTest.cpp
  36. 1 0
      Samples/Tests/Water/BoatTest.cpp
  37. 3 3
      TestFramework/Application/Application.cpp
  38. 1 1
      TestFramework/Application/Application.h
  39. 16 0
      TestFramework/Renderer/CameraState.h
  40. 1 1
      TestFramework/Renderer/DX12/FatalErrorIfFailedDX12.cpp
  41. 2 2
      TestFramework/Renderer/DX12/RendererDX12.cpp
  42. 1 1
      TestFramework/Renderer/DX12/RendererDX12.h
  43. 7 7
      TestFramework/Renderer/DebugRendererImp.h
  44. 1 1
      TestFramework/Renderer/Font.h
  45. 1 1
      TestFramework/Renderer/MTL/RendererMTL.h
  46. 2 2
      TestFramework/Renderer/MTL/RendererMTL.mm
  47. 2 12
      TestFramework/Renderer/Renderer.h
  48. 2 2
      TestFramework/Renderer/VK/RendererVK.cpp
  49. 1 1
      TestFramework/Renderer/VK/RendererVK.h
  50. 1 0
      TestFramework/TestFramework.cmake
  51. 0 1
      TestFramework/TestFramework.h
  52. 2 2
      TestFramework/UI/UIManager.h
  53. 2 2
      TestFramework/UI/UISlider.cpp
  54. 3 3
      TestFramework/Utils/AssetStream.cpp
  55. 3 3
      TestFramework/Utils/ReadData.cpp

+ 21 - 0
Jolt/Core/ObjectToIDMap.h

@@ -0,0 +1,21 @@
+// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
+// SPDX-FileCopyrightText: 2026 Jorrit Rouwe
+// SPDX-License-Identifier: MIT
+
+#pragma once
+
+#include <Jolt/Core/UnorderedMapFwd.h>
+
+JPH_NAMESPACE_BEGIN
+
+namespace StreamUtils {
+
+template <class Type>
+using ObjectToIDMap = UnorderedMap<const Type *, uint32>;
+
+template <class Type>
+using IDToObjectMap = Array<Ref<Type>>;
+
+} // StreamUtils
+
+JPH_NAMESPACE_END

+ 5 - 3
Jolt/Core/Profiler.cpp

@@ -8,9 +8,11 @@
 #include <Jolt/Core/Color.h>
 #include <Jolt/Core/StringTools.h>
 #include <Jolt/Core/QuickSort.h>
+#include <Jolt/Core/UnorderedMap.h>
 
 JPH_SUPPRESS_WARNINGS_STD_BEGIN
 #include <fstream>
+#include <chrono>
 JPH_SUPPRESS_WARNINGS_STD_END
 
 JPH_NAMESPACE_BEGIN
@@ -49,15 +51,15 @@ bool ProfileMeasurement::sOutOfSamplesReported = false;
 void Profiler::UpdateReferenceTime()
 {
 	mReferenceTick = GetProcessorTickCount();
-	mReferenceTime = std::chrono::high_resolution_clock::now();
+	mReferenceTime = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count();
 }
 
 uint64 Profiler::GetProcessorTicksPerSecond() const
 {
 	uint64 ticks = GetProcessorTickCount();
-	std::chrono::high_resolution_clock::time_point time = std::chrono::high_resolution_clock::now();
+	uint64 micros = std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now().time_since_epoch()).count();
 
-	return (ticks - mReferenceTick) * 1000000000ULL / std::chrono::duration_cast<std::chrono::nanoseconds>(time - mReferenceTime).count();
+	return (ticks - mReferenceTick) * 1000000ULL / (micros - mReferenceTime);
 }
 
 // This function assumes that none of the threads are active while we're dumping the profile,

+ 2 - 3
Jolt/Core/Profiler.h

@@ -6,12 +6,11 @@
 
 JPH_SUPPRESS_WARNINGS_STD_BEGIN
 #include <mutex>
-#include <chrono>
 JPH_SUPPRESS_WARNINGS_STD_END
 
 #include <Jolt/Core/NonCopyable.h>
 #include <Jolt/Core/TickCounter.h>
-#include <Jolt/Core/UnorderedMap.h>
+#include <Jolt/Core/UnorderedMapFwd.h>
 
 #if defined(JPH_EXTERNAL_PROFILE)
 
@@ -176,7 +175,7 @@ private:
 
 	std::mutex					mLock;																///< Lock that protects mThreads
 	uint64						mReferenceTick;														///< Tick count at the start of the frame
-	std::chrono::high_resolution_clock::time_point mReferenceTime;									///< Time at the start of the frame
+	uint64						mReferenceTime;														///< Time at the start of the frame in microseconds
 	Array<ProfileThread *>		mThreads;															///< List of all active threads
 	bool						mDump = false;														///< When true, the samples are dumped next frame
 	String						mDumpTag;															///< When not empty, this overrides the auto incrementing number of the dump filename

+ 1 - 6
Jolt/Core/StreamUtils.h

@@ -7,6 +7,7 @@
 #include <Jolt/Core/Result.h>
 #include <Jolt/Core/StreamIn.h>
 #include <Jolt/Core/StreamOut.h>
+#include <Jolt/Core/ObjectToIDMap.h>
 #include <Jolt/Core/UnorderedMap.h>
 #include <Jolt/Core/Factory.h>
 
@@ -14,12 +15,6 @@ JPH_NAMESPACE_BEGIN
 
 namespace StreamUtils {
 
-template <class Type>
-using ObjectToIDMap = UnorderedMap<const Type *, uint32>;
-
-template <class Type>
-using IDToObjectMap = Array<Ref<Type>>;
-
 // Restore a single object by reading the hash of the type, constructing it and then calling the restore function
 template <class Type>
 Result<Ref<Type>>	RestoreObject(StreamIn &inStream, void (Type::*inRestoreBinaryStateFunction)(StreamIn &))

+ 2 - 1
Jolt/Core/UnorderedMap.h

@@ -5,6 +5,7 @@
 #pragma once
 
 #include <Jolt/Core/HashTable.h>
+#include <Jolt/Core/UnorderedMapFwd.h>
 
 JPH_NAMESPACE_BEGIN
 
@@ -25,7 +26,7 @@ public:
 /// @tparam Value Value type
 /// @tparam Hash Hash function (note should be 64-bits)
 /// @tparam KeyEqual Equality comparison function
-template <class Key, class Value, class Hash = JPH::Hash<Key>, class KeyEqual = std::equal_to<Key>>
+template <class Key, class Value, class Hash, class KeyEqual>
 class UnorderedMap : public HashTable<Key, std::pair<Key, Value>, UnorderedMapDetail<Key, Value>, Hash, KeyEqual>
 {
 	using Base = HashTable<Key, std::pair<Key, Value>, UnorderedMapDetail<Key, Value>, Hash, KeyEqual>;

+ 14 - 0
Jolt/Core/UnorderedMapFwd.h

@@ -0,0 +1,14 @@
+// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
+// SPDX-FileCopyrightText: 2026 Jorrit Rouwe
+// SPDX-License-Identifier: MIT
+
+#pragma once
+
+JPH_NAMESPACE_BEGIN
+
+// Forward declaration of UnorderedMap (defined in UnorderedMap.h).
+// This is provided because compiling UnorderedMap.h can be expensive due to its use of templates.
+template <class Key, class Value, class Hash = JPH::Hash<Key>, class KeyEqual = std::equal_to<Key>>
+class UnorderedMap;
+
+JPH_NAMESPACE_END

+ 2 - 1
Jolt/Core/UnorderedSet.h

@@ -5,6 +5,7 @@
 #pragma once
 
 #include <Jolt/Core/HashTable.h>
+#include <Jolt/Core/UnorderedSetFwd.h>
 
 JPH_NAMESPACE_BEGIN
 
@@ -24,7 +25,7 @@ public:
 /// @tparam Key Key type
 /// @tparam Hash Hash function (note should be 64-bits)
 /// @tparam KeyEqual Equality comparison function
-template <class Key, class Hash = JPH::Hash<Key>, class KeyEqual = std::equal_to<Key>>
+template <class Key, class Hash, class KeyEqual>
 class UnorderedSet : public HashTable<Key, Key, UnorderedSetDetail<Key>, Hash, KeyEqual>
 {
 };

+ 14 - 0
Jolt/Core/UnorderedSetFwd.h

@@ -0,0 +1,14 @@
+// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
+// SPDX-FileCopyrightText: 2026 Jorrit Rouwe
+// SPDX-License-Identifier: MIT
+
+#pragma once
+
+JPH_NAMESPACE_BEGIN
+
+// Forward declaration of UnorderedSet (defined in UnorderedSet.h).
+// This is provided because compiling UnorderedSet.h can be expensive due to its use of templates.
+template <class Key, class Hash = JPH::Hash<Key>, class KeyEqual = std::equal_to<Key>>
+class UnorderedSet;
+
+JPH_NAMESPACE_END

+ 3 - 0
Jolt/Jolt.cmake

@@ -68,6 +68,7 @@ set(JOLT_PHYSICS_SRC_FILES
 	${JOLT_PHYSICS_ROOT}/Core/Mutex.h
 	${JOLT_PHYSICS_ROOT}/Core/MutexArray.h
 	${JOLT_PHYSICS_ROOT}/Core/NonCopyable.h
+	${JOLT_PHYSICS_ROOT}/Core/ObjectToIDMap.h
 	${JOLT_PHYSICS_ROOT}/Core/Profiler.cpp
 	${JOLT_PHYSICS_ROOT}/Core/Profiler.h
 	${JOLT_PHYSICS_ROOT}/Core/Profiler.inl
@@ -95,7 +96,9 @@ set(JOLT_PHYSICS_SRC_FILES
 	${JOLT_PHYSICS_ROOT}/Core/TickCounter.cpp
 	${JOLT_PHYSICS_ROOT}/Core/TickCounter.h
 	${JOLT_PHYSICS_ROOT}/Core/UnorderedMap.h
+	${JOLT_PHYSICS_ROOT}/Core/UnorderedMapFwd.h
 	${JOLT_PHYSICS_ROOT}/Core/UnorderedSet.h
+	${JOLT_PHYSICS_ROOT}/Core/UnorderedSetFwd.h
 	${JOLT_PHYSICS_ROOT}/Geometry/AABox.h
 	${JOLT_PHYSICS_ROOT}/Geometry/AABox4.h
 	${JOLT_PHYSICS_ROOT}/Geometry/ClipPoly.h

+ 1 - 0
Jolt/Physics/Body/BodyCreationSettings.cpp

@@ -8,6 +8,7 @@
 #include <Jolt/ObjectStream/TypeDeclarations.h>
 #include <Jolt/Core/StreamIn.h>
 #include <Jolt/Core/StreamOut.h>
+#include <Jolt/Core/StreamUtils.h>
 
 JPH_NAMESPACE_BEGIN
 

+ 1 - 1
Jolt/Physics/Body/BodyCreationSettings.h

@@ -11,7 +11,7 @@
 #include <Jolt/Physics/Body/MotionQuality.h>
 #include <Jolt/Physics/Body/AllowedDOFs.h>
 #include <Jolt/ObjectStream/SerializableObject.h>
-#include <Jolt/Core/StreamUtils.h>
+#include <Jolt/Core/ObjectToIDMap.h>
 
 JPH_NAMESPACE_BEGIN
 

+ 1 - 0
Jolt/Physics/Character/CharacterVirtual.h

@@ -12,6 +12,7 @@
 #include <Jolt/Physics/Collision/ObjectLayer.h>
 #include <Jolt/Physics/Collision/TransformedShape.h>
 #include <Jolt/Core/STLTempAllocator.h>
+#include <Jolt/Core/UnorderedMap.h>
 
 JPH_NAMESPACE_BEGIN
 

+ 1 - 0
Jolt/Physics/Collision/Shape/MeshShape.cpp

@@ -26,6 +26,7 @@
 #include <Jolt/Core/StreamOut.h>
 #include <Jolt/Core/Profiler.h>
 #include <Jolt/Core/UnorderedMap.h>
+#include <Jolt/Core/UnorderedSet.h>
 #include <Jolt/Geometry/AABox4.h>
 #include <Jolt/Geometry/RayAABox.h>
 #include <Jolt/Geometry/Indexify.h>

+ 2 - 3
Jolt/Physics/Collision/Shape/Shape.cpp

@@ -12,9 +12,8 @@
 #include <Jolt/Physics/Collision/RayCast.h>
 #include <Jolt/Physics/Collision/CastResult.h>
 #include <Jolt/Physics/Collision/CollidePointResult.h>
-#include <Jolt/Core/StreamIn.h>
-#include <Jolt/Core/StreamOut.h>
-#include <Jolt/Core/Factory.h>
+#include <Jolt/Core/StreamUtils.h>
+#include <Jolt/Core/UnorderedSet.h>
 #include <Jolt/ObjectStream/TypeDeclarations.h>
 
 JPH_NAMESPACE_BEGIN

+ 2 - 3
Jolt/Physics/Collision/Shape/Shape.h

@@ -13,9 +13,8 @@
 #include <Jolt/Core/Color.h>
 #include <Jolt/Core/Result.h>
 #include <Jolt/Core/NonCopyable.h>
-#include <Jolt/Core/UnorderedMap.h>
-#include <Jolt/Core/UnorderedSet.h>
-#include <Jolt/Core/StreamUtils.h>
+#include <Jolt/Core/UnorderedSetFwd.h>
+#include <Jolt/Core/ObjectToIDMap.h>
 #include <Jolt/ObjectStream/SerializableObject.h>
 
 JPH_NAMESPACE_BEGIN

+ 2 - 0
Jolt/Physics/Hair/HairSettings.cpp

@@ -10,6 +10,8 @@
 #include <Jolt/TriangleSplitter/TriangleSplitterBinning.h>
 #include <Jolt/AABBTree/AABBTreeBuilder.h>
 #include <Jolt/Core/QuickSort.h>
+#include <Jolt/Core/StreamIn.h>
+#include <Jolt/Core/StreamOut.h>
 
 JPH_NAMESPACE_BEGIN
 

+ 3 - 1
Jolt/Physics/Hair/HairSettings.h

@@ -5,7 +5,6 @@
 #pragma once
 
 #include <Jolt/Core/Reference.h>
-#include <Jolt/Core/StreamUtils.h>
 #include <Jolt/Geometry/AABox.h>
 #include <Jolt/Geometry/IndexedTriangle.h>
 #include <Jolt/ObjectStream/SerializableObject.h>
@@ -15,6 +14,9 @@
 
 JPH_NAMESPACE_BEGIN
 
+class StreamOut;
+class StreamIn;
+
 /// This class defines the setup of a hair groom, it can be shared between multiple hair instances
 class JPH_EXPORT HairSettings : public RefTarget<HairSettings>
 {

+ 1 - 0
Jolt/Physics/PhysicsScene.cpp

@@ -8,6 +8,7 @@
 #include <Jolt/Physics/PhysicsSystem.h>
 #include <Jolt/Physics/Body/BodyLockMulti.h>
 #include <Jolt/ObjectStream/TypeDeclarations.h>
+#include <Jolt/Core/UnorderedMap.h>
 
 JPH_NAMESPACE_BEGIN
 

+ 1 - 2
Jolt/Physics/Ragdoll/Ragdoll.cpp

@@ -14,8 +14,7 @@
 #include <Jolt/Physics/Collision/CollideShape.h>
 #include <Jolt/Physics/Collision/CollisionDispatch.h>
 #include <Jolt/ObjectStream/TypeDeclarations.h>
-#include <Jolt/Core/StreamIn.h>
-#include <Jolt/Core/StreamOut.h>
+#include <Jolt/Core/StreamUtils.h>
 
 JPH_NAMESPACE_BEGIN
 

+ 1 - 2
Jolt/Physics/SoftBody/SoftBodyCreationSettings.cpp

@@ -6,8 +6,7 @@
 
 #include <Jolt/Physics/SoftBody/SoftBodyCreationSettings.h>
 #include <Jolt/ObjectStream/TypeDeclarations.h>
-#include <Jolt/Core/StreamIn.h>
-#include <Jolt/Core/StreamOut.h>
+#include <Jolt/Core/StreamUtils.h>
 
 JPH_NAMESPACE_BEGIN
 

+ 1 - 1
Jolt/Physics/SoftBody/SoftBodyCreationSettings.h

@@ -8,7 +8,7 @@
 #include <Jolt/Physics/Collision/ObjectLayer.h>
 #include <Jolt/Physics/Collision/CollisionGroup.h>
 #include <Jolt/ObjectStream/SerializableObject.h>
-#include <Jolt/Core/StreamUtils.h>
+#include <Jolt/Core/ObjectToIDMap.h>
 
 JPH_NAMESPACE_BEGIN
 

+ 1 - 3
Jolt/Physics/SoftBody/SoftBodySharedSettings.cpp

@@ -7,10 +7,8 @@
 #include <Jolt/Physics/SoftBody/SoftBodySharedSettings.h>
 #include <Jolt/Physics/SoftBody/SoftBodyUpdateContext.h>
 #include <Jolt/ObjectStream/TypeDeclarations.h>
-#include <Jolt/Core/StreamIn.h>
-#include <Jolt/Core/StreamOut.h>
+#include <Jolt/Core/StreamUtils.h>
 #include <Jolt/Core/QuickSort.h>
-#include <Jolt/Core/UnorderedMap.h>
 #include <Jolt/Core/UnorderedSet.h>
 #include <Jolt/Core/BinaryHeap.h>
 

+ 1 - 1
Jolt/Physics/SoftBody/SoftBodySharedSettings.h

@@ -6,7 +6,7 @@
 
 #include <Jolt/Core/Reference.h>
 #include <Jolt/Physics/Collision/PhysicsMaterial.h>
-#include <Jolt/Core/StreamUtils.h>
+#include <Jolt/Core/ObjectToIDMap.h>
 
 JPH_NAMESPACE_BEGIN
 

+ 2 - 1
Jolt/Skeleton/SkeletalAnimation.h

@@ -6,12 +6,13 @@
 
 #include <Jolt/Core/Reference.h>
 #include <Jolt/Core/Result.h>
-#include <Jolt/Core/StreamUtils.h>
 #include <Jolt/ObjectStream/SerializableObject.h>
 
 JPH_NAMESPACE_BEGIN
 
 class SkeletonPose;
+class StreamIn;
+class StreamOut;
 
 /// Resource for a skinned animation
 class JPH_EXPORT SkeletalAnimation : public RefTarget<SkeletalAnimation>

+ 2 - 0
Samples/Samples.h

@@ -7,3 +7,5 @@
 #include <TestFramework.h>
 
 #include <Jolt/Physics/PhysicsSystem.h>
+
+using namespace std;

+ 1 - 0
Samples/Tests/Character/CharacterBaseTest.cpp

@@ -21,6 +21,7 @@
 #include <Utils/Log.h>
 #include <Utils/AssetStream.h>
 #include <Renderer/DebugRendererImp.h>
+#include <Input/Keyboard.h>
 
 JPH_IMPLEMENT_RTTI_ABSTRACT(CharacterBaseTest)
 {

+ 1 - 0
Samples/Tests/Character/CharacterPlanetTest.cpp

@@ -10,6 +10,7 @@
 #include <Jolt/Physics/Collision/Shape/SphereShape.h>
 #include <Jolt/Physics/Body/BodyCreationSettings.h>
 #include <Layers.h>
+#include <Input/Keyboard.h>
 
 JPH_IMPLEMENT_RTTI_VIRTUAL(CharacterPlanetTest)
 {

+ 1 - 0
Samples/Tests/Character/CharacterSpaceShipTest.cpp

@@ -11,6 +11,7 @@
 #include <Jolt/Physics/Collision/Shape/CylinderShape.h>
 #include <Jolt/Physics/Body/BodyCreationSettings.h>
 #include <Layers.h>
+#include <Input/Keyboard.h>
 
 JPH_IMPLEMENT_RTTI_VIRTUAL(CharacterSpaceShipTest)
 {

+ 4 - 0
Samples/Tests/General/MultithreadedTest.cpp

@@ -20,6 +20,10 @@
 #include <Utils/AssetStream.h>
 #include <Renderer/DebugRendererImp.h>
 
+JPH_SUPPRESS_WARNINGS_STD_BEGIN
+#include <chrono>
+JPH_SUPPRESS_WARNINGS_STD_END
+
 JPH_IMPLEMENT_RTTI_VIRTUAL(MultithreadedTest)
 {
 	JPH_ADD_BASE_CLASS(MultithreadedTest, Test)

+ 3 - 2
Samples/Tests/Test.h

@@ -5,13 +5,14 @@
 #pragma once
 
 #include <Jolt/Physics/PhysicsSystem.h>
-#include <Renderer/Renderer.h>
-#include <Input/Keyboard.h>
 #include <Jolt/Skeleton/SkeletonPose.h>
 #include <Jolt/Core/RTTI.h>
+#include <Jolt/Core/UnorderedMap.h>
+#include <Renderer/CameraState.h>
 
 class DebugUI;
 class UIElement;
+class Keyboard;
 namespace JPH {
 	class StateRecorder;
 	class JobSystem;

+ 1 - 0
Samples/Tests/Vehicle/MotorcycleTest.cpp

@@ -15,6 +15,7 @@
 #include <Application/DebugUI.h>
 #include <Layers.h>
 #include <Renderer/DebugRendererImp.h>
+#include <Input/Keyboard.h>
 
 JPH_IMPLEMENT_RTTI_VIRTUAL(MotorcycleTest)
 {

+ 1 - 0
Samples/Tests/Vehicle/TankTest.cpp

@@ -18,6 +18,7 @@
 #include <Application/DebugUI.h>
 #include <Layers.h>
 #include <Renderer/DebugRendererImp.h>
+#include <Input/Keyboard.h>
 
 JPH_IMPLEMENT_RTTI_VIRTUAL(TankTest)
 {

+ 1 - 0
Samples/Tests/Vehicle/VehicleConstraintTest.cpp

@@ -15,6 +15,7 @@
 #include <Application/DebugUI.h>
 #include <Layers.h>
 #include <Renderer/DebugRendererImp.h>
+#include <Input/Keyboard.h>
 
 JPH_IMPLEMENT_RTTI_VIRTUAL(VehicleConstraintTest)
 {

+ 1 - 0
Samples/Tests/Vehicle/VehicleSixDOFTest.cpp

@@ -11,6 +11,7 @@
 #include <Jolt/Physics/Body/BodyCreationSettings.h>
 #include <Application/DebugUI.h>
 #include <Layers.h>
+#include <Input/Keyboard.h>
 
 JPH_IMPLEMENT_RTTI_VIRTUAL(VehicleSixDOFTest)
 {

+ 1 - 0
Samples/Tests/Vehicle/VehicleStressTest.cpp

@@ -10,6 +10,7 @@
 #include <Jolt/Physics/Body/BodyCreationSettings.h>
 #include <Layers.h>
 #include <Renderer/DebugRendererImp.h>
+#include <Input/Keyboard.h>
 
 JPH_IMPLEMENT_RTTI_VIRTUAL(VehicleStressTest)
 {

+ 1 - 0
Samples/Tests/Water/BoatTest.cpp

@@ -13,6 +13,7 @@
 #include <Jolt/Physics/Body/BodyCreationSettings.h>
 #include <Layers.h>
 #include <Renderer/DebugRendererImp.h>
+#include <Input/Keyboard.h>
 
 JPH_IMPLEMENT_RTTI_VIRTUAL(BoatTest)
 {

+ 3 - 3
TestFramework/Application/Application.cpp

@@ -135,7 +135,7 @@ Application::Application(const char *inApplicationName, [[maybe_unused]] const S
 	}
 
 	// Get initial time
-	mLastUpdateTime = chrono::high_resolution_clock::now();
+	mLastUpdateTime = std::chrono::high_resolution_clock::now();
 }
 
 // Destructor
@@ -223,8 +223,8 @@ bool Application::RenderFrame()
 		}
 
 	// Calculate delta time
-	chrono::high_resolution_clock::time_point time = chrono::high_resolution_clock::now();
-	chrono::microseconds delta = chrono::duration_cast<chrono::microseconds>(time - mLastUpdateTime);
+	std::chrono::high_resolution_clock::time_point time = std::chrono::high_resolution_clock::now();
+	std::chrono::microseconds delta = std::chrono::duration_cast<std::chrono::microseconds>(time - mLastUpdateTime);
 	mLastUpdateTime = time;
 	float clock_delta_time = 1.0e-6f * delta.count();
 	float world_delta_time = 0.0f;

+ 1 - 1
TestFramework/Application/Application.h

@@ -108,7 +108,7 @@ private:
 	/// Draw the frame rate counter
 	void						DrawFPS(float inDeltaTime);
 
-	chrono::high_resolution_clock::time_point mLastUpdateTime;
+	std::chrono::high_resolution_clock::time_point mLastUpdateTime;
 	bool						mIsPaused = false;
 	bool						mSingleStep = false;
 	bool						mDebugRendererCleared = true;

+ 16 - 0
TestFramework/Renderer/CameraState.h

@@ -0,0 +1,16 @@
+// Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
+// SPDX-FileCopyrightText: 2026 Jorrit Rouwe
+// SPDX-License-Identifier: MIT
+
+#pragma once
+
+/// Camera position and orientation
+struct CameraState
+{
+									CameraState() : mPos(RVec3::sZero()), mForward(0, 0, -1), mUp(0, 1, 0), mFOVY(DegreesToRadians(70.0f)) { }
+
+	RVec3							mPos;								///< Camera position
+	Vec3							mForward;							///< Camera forward vector
+	Vec3							mUp;								///< Camera up vector
+	float							mFOVY;								///< Field of view in radians in up direction
+};

+ 1 - 1
TestFramework/Renderer/DX12/FatalErrorIfFailedDX12.cpp

@@ -14,7 +14,7 @@ void FatalErrorIfFailed(HRESULT inHResult)
 {
 	if (FAILED(inHResult))
 	{
-		string message = system_category().message(inHResult);
+		std::string message = std::system_category().message(inHResult);
 		FatalError("DirectX error returned: %s (%s)", ConvertToString(inHResult).c_str(), message.c_str());
 	}
 }

+ 2 - 2
TestFramework/Renderer/DX12/RendererDX12.cpp

@@ -542,9 +542,9 @@ Ref<PixelShader> RendererDX12::CreatePixelShader(const char *inName)
 	return new PixelShaderDX12(shader_blob);
 }
 
-unique_ptr<PipelineState> RendererDX12::CreatePipelineState(const VertexShader *inVertexShader, const PipelineState::EInputDescription *inInputDescription, uint inInputDescriptionCount, const PixelShader *inPixelShader, PipelineState::EDrawPass inDrawPass, PipelineState::EFillMode inFillMode, PipelineState::ETopology inTopology, PipelineState::EDepthTest inDepthTest, PipelineState::EBlendMode inBlendMode, PipelineState::ECullMode inCullMode)
+std::unique_ptr<PipelineState> RendererDX12::CreatePipelineState(const VertexShader *inVertexShader, const PipelineState::EInputDescription *inInputDescription, uint inInputDescriptionCount, const PixelShader *inPixelShader, PipelineState::EDrawPass inDrawPass, PipelineState::EFillMode inFillMode, PipelineState::ETopology inTopology, PipelineState::EDepthTest inDepthTest, PipelineState::EBlendMode inBlendMode, PipelineState::ECullMode inCullMode)
 {
-	return make_unique<PipelineStateDX12>(this, static_cast<const VertexShaderDX12 *>(inVertexShader), inInputDescription, inInputDescriptionCount, static_cast<const PixelShaderDX12 *>(inPixelShader), inDrawPass, inFillMode, inTopology, inDepthTest, inBlendMode, inCullMode);
+	return std::make_unique<PipelineStateDX12>(this, static_cast<const VertexShaderDX12 *>(inVertexShader), inInputDescription, inInputDescriptionCount, static_cast<const PixelShaderDX12 *>(inPixelShader), inDrawPass, inFillMode, inTopology, inDepthTest, inBlendMode, inCullMode);
 }
 
 RenderPrimitive *RendererDX12::CreateRenderPrimitive(PipelineState::ETopology inType)

+ 1 - 1
TestFramework/Renderer/DX12/RendererDX12.h

@@ -29,7 +29,7 @@ public:
 	virtual Ref<Texture>			CreateTexture(const Surface *inSurface) override;
 	virtual Ref<VertexShader>		CreateVertexShader(const char *inName) override;
 	virtual Ref<PixelShader>		CreatePixelShader(const char *inName) override;
-	virtual unique_ptr<PipelineState> CreatePipelineState(const VertexShader *inVertexShader, const PipelineState::EInputDescription *inInputDescription, uint inInputDescriptionCount, const PixelShader *inPixelShader, PipelineState::EDrawPass inDrawPass, PipelineState::EFillMode inFillMode, PipelineState::ETopology inTopology, PipelineState::EDepthTest inDepthTest, PipelineState::EBlendMode inBlendMode, PipelineState::ECullMode inCullMode) override;
+	virtual std::unique_ptr<PipelineState> CreatePipelineState(const VertexShader *inVertexShader, const PipelineState::EInputDescription *inInputDescription, uint inInputDescriptionCount, const PixelShader *inPixelShader, PipelineState::EDrawPass inDrawPass, PipelineState::EFillMode inFillMode, PipelineState::ETopology inTopology, PipelineState::EDepthTest inDepthTest, PipelineState::EBlendMode inBlendMode, PipelineState::ECullMode inCullMode) override;
 	virtual RenderPrimitive *		CreateRenderPrimitive(PipelineState::ETopology inType) override;
 	virtual RenderInstances *		CreateRenderInstances() override;
 	virtual Texture *				GetShadowMap() const override		{ return mShadowMap.GetPtr(); }

+ 7 - 7
TestFramework/Renderer/DebugRendererImp.h

@@ -69,14 +69,14 @@ private:
 	Renderer *							mRenderer;
 
 	/// Shaders for triangles
-	unique_ptr<PipelineState>			mTriangleStateBF;
-	unique_ptr<PipelineState>			mTriangleStateFF;
-	unique_ptr<PipelineState>			mTriangleStateWire;
+	std::unique_ptr<PipelineState>		mTriangleStateBF;
+	std::unique_ptr<PipelineState>		mTriangleStateFF;
+	std::unique_ptr<PipelineState>		mTriangleStateWire;
 
 	/// Shaders for shadow pass for triangles
-	unique_ptr<PipelineState>			mShadowStateBF;
-	unique_ptr<PipelineState>			mShadowStateFF;
-	unique_ptr<PipelineState>			mShadowStateWire;
+	std::unique_ptr<PipelineState>		mShadowStateBF;
+	std::unique_ptr<PipelineState>		mShadowStateFF;
+	std::unique_ptr<PipelineState>		mShadowStateWire;
 
 	/// Lock that protects the triangle batches from being accessed from multiple threads
 	Mutex								mPrimitivesLock;
@@ -174,5 +174,5 @@ private:
 	Mutex								mLinesLock;
 
 	/// The shaders for the line segments
-	unique_ptr<PipelineState>			mLineState;
+	std::unique_ptr<PipelineState>		mLineState;
 };

+ 1 - 1
TestFramework/Renderer/Font.h

@@ -66,5 +66,5 @@ private:
 	/// Structures used for drawing
 	Renderer *					mRenderer;											///< Our renderer
 	Ref<Texture>				mTexture;											///< The texture containing all characters
-	unique_ptr<PipelineState>	mPipelineState;										///< The state used to render characters
+	std::unique_ptr<PipelineState> mPipelineState;									///< The state used to render characters
 };

+ 1 - 1
TestFramework/Renderer/MTL/RendererMTL.h

@@ -27,7 +27,7 @@ public:
 	virtual Ref<Texture>			CreateTexture(const Surface *inSurface) override;
 	virtual Ref<VertexShader>		CreateVertexShader(const char *inName) override;
 	virtual Ref<PixelShader>		CreatePixelShader(const char *inName) override;
-	virtual unique_ptr<PipelineState> CreatePipelineState(const VertexShader *inVertexShader, const PipelineState::EInputDescription *inInputDescription, uint inInputDescriptionCount, const PixelShader *inPixelShader, PipelineState::EDrawPass inDrawPass, PipelineState::EFillMode inFillMode, PipelineState::ETopology inTopology, PipelineState::EDepthTest inDepthTest, PipelineState::EBlendMode inBlendMode, PipelineState::ECullMode inCullMode) override;
+	virtual std::unique_ptr<PipelineState> CreatePipelineState(const VertexShader *inVertexShader, const PipelineState::EInputDescription *inInputDescription, uint inInputDescriptionCount, const PixelShader *inPixelShader, PipelineState::EDrawPass inDrawPass, PipelineState::EFillMode inFillMode, PipelineState::ETopology inTopology, PipelineState::EDepthTest inDepthTest, PipelineState::EBlendMode inBlendMode, PipelineState::ECullMode inCullMode) override;
 	virtual RenderPrimitive *		CreateRenderPrimitive(PipelineState::ETopology inType) override;
 	virtual RenderInstances *		CreateRenderInstances() override;
 	virtual Texture *				GetShadowMap() const override									{ return mShadowMap; }

+ 2 - 2
TestFramework/Renderer/MTL/RendererMTL.mm

@@ -171,9 +171,9 @@ Ref<PixelShader> RendererMTL::CreatePixelShader(const char *inName)
 	return new PixelShaderMTL(function);
 }
 
-unique_ptr<PipelineState> RendererMTL::CreatePipelineState(const VertexShader *inVertexShader, const PipelineState::EInputDescription *inInputDescription, uint inInputDescriptionCount, const PixelShader *inPixelShader, PipelineState::EDrawPass inDrawPass, PipelineState::EFillMode inFillMode, PipelineState::ETopology inTopology, PipelineState::EDepthTest inDepthTest, PipelineState::EBlendMode inBlendMode, PipelineState::ECullMode inCullMode)
+std::unique_ptr<PipelineState> RendererMTL::CreatePipelineState(const VertexShader *inVertexShader, const PipelineState::EInputDescription *inInputDescription, uint inInputDescriptionCount, const PixelShader *inPixelShader, PipelineState::EDrawPass inDrawPass, PipelineState::EFillMode inFillMode, PipelineState::ETopology inTopology, PipelineState::EDepthTest inDepthTest, PipelineState::EBlendMode inBlendMode, PipelineState::ECullMode inCullMode)
 {
-	return make_unique<PipelineStateMTL>(this, static_cast<const VertexShaderMTL *>(inVertexShader), inInputDescription, inInputDescriptionCount, static_cast<const PixelShaderMTL *>(inPixelShader), inDrawPass, inFillMode, inTopology, inDepthTest, inBlendMode, inCullMode);
+	return std::make_unique<PipelineStateMTL>(this, static_cast<const VertexShaderMTL *>(inVertexShader), inInputDescription, inInputDescriptionCount, static_cast<const PixelShaderMTL *>(inPixelShader), inDrawPass, inFillMode, inTopology, inDepthTest, inBlendMode, inCullMode);
 }
 
 RenderPrimitive *RendererMTL::CreateRenderPrimitive(PipelineState::ETopology inType)

+ 2 - 12
TestFramework/Renderer/Renderer.h

@@ -12,23 +12,13 @@
 #include <Renderer/PixelShader.h>
 #include <Renderer/RenderPrimitive.h>
 #include <Renderer/RenderInstances.h>
+#include <Renderer/CameraState.h>
 #include <Jolt/Compute/ComputeSystem.h>
 #include <memory>
 
 // Forward declares
 class Texture;
 
-/// Camera setup
-struct CameraState
-{
-									CameraState() : mPos(RVec3::sZero()), mForward(0, 0, -1), mUp(0, 1, 0), mFOVY(DegreesToRadians(70.0f)) { }
-
-	RVec3							mPos;								///< Camera position
-	Vec3							mForward;							///< Camera forward vector
-	Vec3							mUp;								///< Camera up vector
-	float							mFOVY;								///< Field of view in radians in up direction
-};
-
 /// Responsible for rendering primitives to the screen
 class Renderer
 {
@@ -61,7 +51,7 @@ public:
 	virtual Ref<PixelShader>		CreatePixelShader(const char *inName) = 0;
 
 	/// Create pipeline state object that defines the complete state of how primitives should be rendered
-	virtual unique_ptr<PipelineState> CreatePipelineState(const VertexShader *inVertexShader, const PipelineState::EInputDescription *inInputDescription, uint inInputDescriptionCount, const PixelShader *inPixelShader, PipelineState::EDrawPass inDrawPass, PipelineState::EFillMode inFillMode, PipelineState::ETopology inTopology, PipelineState::EDepthTest inDepthTest, PipelineState::EBlendMode inBlendMode, PipelineState::ECullMode inCullMode) = 0;
+	virtual std::unique_ptr<PipelineState> CreatePipelineState(const VertexShader *inVertexShader, const PipelineState::EInputDescription *inInputDescription, uint inInputDescriptionCount, const PixelShader *inPixelShader, PipelineState::EDrawPass inDrawPass, PipelineState::EFillMode inFillMode, PipelineState::ETopology inTopology, PipelineState::EDepthTest inDepthTest, PipelineState::EBlendMode inBlendMode, PipelineState::ECullMode inCullMode) = 0;
 
 	/// Create a render primitive
 	virtual RenderPrimitive *		CreateRenderPrimitive(PipelineState::ETopology inType) = 0;

+ 2 - 2
TestFramework/Renderer/VK/RendererVK.cpp

@@ -848,9 +848,9 @@ Ref<PixelShader> RendererVK::CreatePixelShader(const char *inName)
 	return new PixelShaderVK(mDevice, shader_module);
 }
 
-unique_ptr<PipelineState> RendererVK::CreatePipelineState(const VertexShader *inVertexShader, const PipelineState::EInputDescription *inInputDescription, uint inInputDescriptionCount, const PixelShader *inPixelShader, PipelineState::EDrawPass inDrawPass, PipelineState::EFillMode inFillMode, PipelineState::ETopology inTopology, PipelineState::EDepthTest inDepthTest, PipelineState::EBlendMode inBlendMode, PipelineState::ECullMode inCullMode)
+std::unique_ptr<PipelineState> RendererVK::CreatePipelineState(const VertexShader *inVertexShader, const PipelineState::EInputDescription *inInputDescription, uint inInputDescriptionCount, const PixelShader *inPixelShader, PipelineState::EDrawPass inDrawPass, PipelineState::EFillMode inFillMode, PipelineState::ETopology inTopology, PipelineState::EDepthTest inDepthTest, PipelineState::EBlendMode inBlendMode, PipelineState::ECullMode inCullMode)
 {
-	return make_unique<PipelineStateVK>(this, static_cast<const VertexShaderVK *>(inVertexShader), inInputDescription, inInputDescriptionCount, static_cast<const PixelShaderVK *>(inPixelShader), inDrawPass, inFillMode, inTopology, inDepthTest, inBlendMode, inCullMode);
+	return std::make_unique<PipelineStateVK>(this, static_cast<const VertexShaderVK *>(inVertexShader), inInputDescription, inInputDescriptionCount, static_cast<const PixelShaderVK *>(inPixelShader), inDrawPass, inFillMode, inTopology, inDepthTest, inBlendMode, inCullMode);
 }
 
 RenderPrimitive *RendererVK::CreateRenderPrimitive(PipelineState::ETopology inType)

+ 1 - 1
TestFramework/Renderer/VK/RendererVK.h

@@ -27,7 +27,7 @@ public:
 	virtual Ref<Texture>			CreateTexture(const Surface *inSurface) override;
 	virtual Ref<VertexShader>		CreateVertexShader(const char *inName) override;
 	virtual Ref<PixelShader>		CreatePixelShader(const char *inName) override;
-	virtual unique_ptr<PipelineState> CreatePipelineState(const VertexShader *inVertexShader, const PipelineState::EInputDescription *inInputDescription, uint inInputDescriptionCount, const PixelShader *inPixelShader, PipelineState::EDrawPass inDrawPass, PipelineState::EFillMode inFillMode, PipelineState::ETopology inTopology, PipelineState::EDepthTest inDepthTest, PipelineState::EBlendMode inBlendMode, PipelineState::ECullMode inCullMode) override;
+	virtual std::unique_ptr<PipelineState> CreatePipelineState(const VertexShader *inVertexShader, const PipelineState::EInputDescription *inInputDescription, uint inInputDescriptionCount, const PixelShader *inPixelShader, PipelineState::EDrawPass inDrawPass, PipelineState::EFillMode inFillMode, PipelineState::ETopology inTopology, PipelineState::EDepthTest inDepthTest, PipelineState::EBlendMode inBlendMode, PipelineState::ECullMode inCullMode) override;
 	virtual RenderPrimitive *		CreateRenderPrimitive(PipelineState::ETopology inType) override;
 	virtual RenderInstances *		CreateRenderInstances() override;
 	virtual Texture *				GetShadowMap() const override									{ return mShadowMap.GetPtr(); }

+ 1 - 0
TestFramework/TestFramework.cmake

@@ -27,6 +27,7 @@ if (NOT CROSS_COMPILE_ARM AND (JPH_USE_VK OR JPH_USE_DX12 OR JPH_USE_MTL))
 		${TEST_FRAMEWORK_ROOT}/Image/ZoomImage.h
 		${TEST_FRAMEWORK_ROOT}/Input/Keyboard.h
 		${TEST_FRAMEWORK_ROOT}/Input/Mouse.h
+		${TEST_FRAMEWORK_ROOT}/Renderer/CameraState.h
 		${TEST_FRAMEWORK_ROOT}/Renderer/DebugRendererImp.cpp
 		${TEST_FRAMEWORK_ROOT}/Renderer/DebugRendererImp.h
 		${TEST_FRAMEWORK_ROOT}/Renderer/Font.cpp

+ 0 - 1
TestFramework/TestFramework.h

@@ -42,4 +42,3 @@ JPH_MSVC_SUPPRESS_WARNING(4062) // enumerator 'X' in switch of enum 'X' is not h
 
 using namespace JPH;
 using namespace JPH::literals;
-using namespace std;

+ 2 - 2
TestFramework/UI/UIManager.h

@@ -77,8 +77,8 @@ private:
 	UIEventListener *			mListener;
 	Array<UIElementVector>		mInactiveElements;
 	bool						mDrawInactiveElements = true;
-	unique_ptr<PipelineState>	mTextured;
-	unique_ptr<PipelineState>	mUntextured;
+	std::unique_ptr<PipelineState> mTextured;
+	std::unique_ptr<PipelineState> mUntextured;
 	function<void()>			mDeactivatedAction;
 
 	EState						mState;

+ 2 - 2
TestFramework/UI/UISlider.cpp

@@ -177,9 +177,9 @@ void UISlider::UpdateStaticText()
 		else
 		{
 			int num_digits = -int(floor(log10(smallest)));
-			stringstream ss;
+			std::stringstream ss;
 			ss.precision(num_digits);
-			ss << fixed << mCurrentValue;
+			ss << std::fixed << mCurrentValue;
 			mStaticText->SetText(ss.str());
 		}
 	}

+ 3 - 3
TestFramework/Utils/AssetStream.cpp

@@ -30,14 +30,14 @@ String AssetStream::sGetAssetsBasePath()
 	#endif
 
 		// Find the asset path
-		filesystem::path asset_path(application_path);
+		std::filesystem::path asset_path(application_path);
 		while (!asset_path.empty())
 		{
-			filesystem::path parent_path = asset_path.parent_path();
+			std::filesystem::path parent_path = asset_path.parent_path();
 			if (parent_path == asset_path)
 				break;
 			asset_path = parent_path;
-			if (filesystem::exists(asset_path / "Assets"))
+			if (std::filesystem::exists(asset_path / "Assets"))
 				break;
 		}
 		asset_path /= "Assets";

+ 3 - 3
TestFramework/Utils/ReadData.cpp

@@ -17,9 +17,9 @@ Array<uint8> ReadData(const char *inFileName)
 	Array<uint8> data;
 	AssetStream asset_stream(inFileName, std::ios::in | std::ios::binary);
 	std::istream &input = asset_stream.Get();
-	input.seekg(0, ios_base::end);
-	ifstream::pos_type length = input.tellg();
-	input.seekg(0, ios_base::beg);
+	input.seekg(0, std::ios_base::end);
+	std::ifstream::pos_type length = input.tellg();
+	input.seekg(0, std::ios_base::beg);
 	data.resize(size_t(length));
 	input.read((char *)&data[0], length);
 	if (!input)