From a95c9059aa09501503ea7e6f32b8b94bbf2663d9 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Fri, 27 Oct 2023 10:08:04 +0200 Subject: [PATCH 1/9] Update build number --- Flax.flaxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flax.flaxproj b/Flax.flaxproj index 78d9714f5..a3157a032 100644 --- a/Flax.flaxproj +++ b/Flax.flaxproj @@ -4,7 +4,7 @@ "Major": 1, "Minor": 7, "Revision": 0, - "Build": 6403 + "Build": 6404 }, "Company": "Flax", "Copyright": "Copyright (c) 2012-2023 Wojciech Figat. All rights reserved.", From b028faf0ccdc35df62ce9d9f98e388eec9cf71b7 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 28 Oct 2023 13:52:23 +0200 Subject: [PATCH 2/9] Update assets --- Content/Editor/Particles/Smoke.flax | 4 ++-- Content/Editor/Particles/Sparks.flax | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Content/Editor/Particles/Smoke.flax b/Content/Editor/Particles/Smoke.flax index 1335a84f4..b42c2f325 100644 --- a/Content/Editor/Particles/Smoke.flax +++ b/Content/Editor/Particles/Smoke.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c3dc51e7805056006ca6cbb481ba202583a9b2287c152fc04e28e1d07747d6ce -size 14706 +oid sha256:334ac0d00495fc88b10839061ff0c3f45323d4f75ab6176b19005199a7324a19 +size 14569 diff --git a/Content/Editor/Particles/Sparks.flax b/Content/Editor/Particles/Sparks.flax index 7977e231b..7ee0ed6e9 100644 --- a/Content/Editor/Particles/Sparks.flax +++ b/Content/Editor/Particles/Sparks.flax @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:77d902ab5f79426cc66dc5f19a3b8280136a58aa3c6fd317554d1a032357c65a -size 15275 +oid sha256:87046a9bfe275cac290b4764de8a512c222ccc386d01af9026d57c3e4b7773b6 +size 13625 From 468c93949ece14505fcd643350112290198da936 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 28 Oct 2023 14:01:44 +0200 Subject: [PATCH 3/9] Fix crash when creating empty particle emitter --- Source/Engine/Particles/Particles.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/Engine/Particles/Particles.cpp b/Source/Engine/Particles/Particles.cpp index 52845a0f8..784f28c98 100644 --- a/Source/Engine/Particles/Particles.cpp +++ b/Source/Engine/Particles/Particles.cpp @@ -1334,7 +1334,8 @@ void ParticlesSystem::Job(int32 index) auto emitter = particleSystem->Emitters[track.AsEmitter.Index].Get(); auto& data = instance.Emitters[track.AsEmitter.Index]; ASSERT(emitter && emitter->IsLoaded()); - ASSERT(emitter->Capacity != 0 && emitter->Graph.Layout.Size != 0); + if (emitter->Capacity == 0 || emitter->Graph.Layout.Size == 0) + continue; PROFILE_CPU_ASSET(emitter); // Calculate new time position From 9f3221c533cd75716b2fbe4b0ce9ab20f6f1e959 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 28 Oct 2023 14:02:25 +0200 Subject: [PATCH 4/9] Remove unused include --- Source/Engine/Physics/Actors/PhysicsColliderActor.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/Source/Engine/Physics/Actors/PhysicsColliderActor.cpp b/Source/Engine/Physics/Actors/PhysicsColliderActor.cpp index 02645943c..f2ab5d8a2 100644 --- a/Source/Engine/Physics/Actors/PhysicsColliderActor.cpp +++ b/Source/Engine/Physics/Actors/PhysicsColliderActor.cpp @@ -1,7 +1,6 @@ // Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. #include "PhysicsColliderActor.h" -#include "Engine/Scripting/Script.h" #include "RigidBody.h" PhysicsColliderActor::PhysicsColliderActor(const SpawnParams& params) From d9c2decff50f8c5e2658a151624160505cb43d2c Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 28 Oct 2023 20:09:27 +0200 Subject: [PATCH 5/9] Fix crash when contact was not read properly --- Source/Engine/Physics/PhysX/SimulationEventCallbackPhysX.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Source/Engine/Physics/PhysX/SimulationEventCallbackPhysX.cpp b/Source/Engine/Physics/PhysX/SimulationEventCallbackPhysX.cpp index 684aeca19..5968bdd78 100644 --- a/Source/Engine/Physics/PhysX/SimulationEventCallbackPhysX.cpp +++ b/Source/Engine/Physics/PhysX/SimulationEventCallbackPhysX.cpp @@ -117,9 +117,7 @@ void SimulationEventCallback::onContact(const PxContactPairHeader& pairHeader, c { // Skip sending events to removed actors if (pairHeader.flags & (PxContactPairHeaderFlag::eREMOVED_ACTOR_0 | PxContactPairHeaderFlag::eREMOVED_ACTOR_1)) - { return; - } Collision c; PxContactPairExtraDataIterator j(pairHeader.extraDataStream, pairHeader.extraDataStreamSize); @@ -193,7 +191,7 @@ void SimulationEventCallback::onContact(const PxContactPairHeader& pairHeader, c RemovedCollisions.Add(c); } } - ASSERT(!j.nextItemSet()); + //ASSERT(!j.nextItemSet()); } void SimulationEventCallback::onTrigger(PxTriggerPair* pairs, PxU32 count) From 9c1a7a20d490ee3cf561dd4f9b6dab919595e045 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sat, 28 Oct 2023 22:10:41 +0200 Subject: [PATCH 6/9] Add `volk.h` header to distributed build files --- Source/ThirdParty/volk/volk.Build.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/ThirdParty/volk/volk.Build.cs b/Source/ThirdParty/volk/volk.Build.cs index 2f4cfa0d6..67f7593d9 100644 --- a/Source/ThirdParty/volk/volk.Build.cs +++ b/Source/ThirdParty/volk/volk.Build.cs @@ -1,5 +1,6 @@ // Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. +using System.Collections.Generic; using System.IO; using Flax.Build; using Flax.Build.NativeCpp; @@ -62,4 +63,12 @@ public class volk : ThirdPartyModule Log.ErrorOnce("Missing VulkanSDK.", ref _missingSDKError); } } + + /// + public override void GetFilesToDeploy(List files) + { + base.GetFilesToDeploy(files); + + files.Add(Path.Combine(FolderPath, "volk.h")); + } } From 83a931de7e21f1dfdc79461f3fc5214b225019da Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sun, 29 Oct 2023 01:57:48 +0200 Subject: [PATCH 7/9] Fix typo bug in DOF --- Source/Engine/Renderer/DepthOfFieldPass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Engine/Renderer/DepthOfFieldPass.cpp b/Source/Engine/Renderer/DepthOfFieldPass.cpp index cd7930f5c..707a441e6 100644 --- a/Source/Engine/Renderer/DepthOfFieldPass.cpp +++ b/Source/Engine/Renderer/DepthOfFieldPass.cpp @@ -204,7 +204,7 @@ void DepthOfFieldPass::Render(RenderContext& renderContext, GPUTexture*& frame, { DepthOfFieldSettings& dofSettings = renderContext.List->Settings.DepthOfField; const bool useDoF = EnumHasAnyFlags(renderContext.View.Flags, ViewFlags::DepthOfField) && dofSettings.Enabled; - if (!useDoF || _platformSupportsDoF || checkIfSkipPass()) + if (!useDoF || !_platformSupportsDoF || checkIfSkipPass()) return; auto device = GPUDevice::Instance; auto context = device->GetMainContext(); From 56c9429e253960e2dbb16b80462877d812dc1662 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sun, 29 Oct 2023 02:57:59 +0200 Subject: [PATCH 8/9] Fix spawning prefab without transform provided #1831 --- Source/Engine/Level/Prefabs/PrefabManager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Source/Engine/Level/Prefabs/PrefabManager.cpp b/Source/Engine/Level/Prefabs/PrefabManager.cpp index cd9d893ec..de164343b 100644 --- a/Source/Engine/Level/Prefabs/PrefabManager.cpp +++ b/Source/Engine/Level/Prefabs/PrefabManager.cpp @@ -39,7 +39,7 @@ PrefabManagerService PrefabManagerServiceInstance; Actor* PrefabManager::SpawnPrefab(Prefab* prefab) { Actor* parent = Level::Scenes.Count() != 0 ? Level::Scenes.Get()[0] : nullptr; - return SpawnPrefab(prefab, Transform::Identity, parent, nullptr); + return SpawnPrefab(prefab, Transform(Vector3::Minimum), parent, nullptr); } Actor* PrefabManager::SpawnPrefab(Prefab* prefab, const Vector3& position) @@ -73,12 +73,12 @@ Actor* PrefabManager::SpawnPrefab(Prefab* prefab, Actor* parent, const Transform Actor* PrefabManager::SpawnPrefab(Prefab* prefab, Actor* parent) { - return SpawnPrefab(prefab, Transform::Identity, parent, nullptr); + return SpawnPrefab(prefab, Transform(Vector3::Minimum), parent, nullptr); } Actor* PrefabManager::SpawnPrefab(Prefab* prefab, Actor* parent, Dictionary* objectsCache, bool withSynchronization) { - return SpawnPrefab(prefab, Transform::Identity, parent, objectsCache, withSynchronization); + return SpawnPrefab(prefab, Transform(Vector3::Minimum), parent, objectsCache, withSynchronization); } Actor* PrefabManager::SpawnPrefab(Prefab* prefab, const Transform& transform, Actor* parent, Dictionary* objectsCache, bool withSynchronization) @@ -191,7 +191,7 @@ Actor* PrefabManager::SpawnPrefab(Prefab* prefab, const Transform& transform, Ac parent->Children.Add(root); // Move root to the right location - if (transform != Transform::Identity) + if (transform.Translation != Vector3::Minimum) root->SetTransform(transform); // Link actors hierarchy From f434ff2efe76ecaadbbbb7c075dd561febf2fd2a Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sun, 29 Oct 2023 13:37:05 +0100 Subject: [PATCH 9/9] Fix memory overcommitment by `HashSet` when adding and removing the same item in a loop #1829 --- Source/Engine/Core/Collections/HashSet.h | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/Source/Engine/Core/Collections/HashSet.h b/Source/Engine/Core/Collections/HashSet.h index 107e42e65..fba8ca823 100644 --- a/Source/Engine/Core/Collections/HashSet.h +++ b/Source/Engine/Core/Collections/HashSet.h @@ -82,7 +82,6 @@ public: private: int32 _elementsCount = 0; - int32 _deletedCount = 0; int32 _size = 0; AllocationData _allocation; @@ -109,14 +108,11 @@ public: /// The other collection to move. HashSet(HashSet&& other) noexcept : _elementsCount(other._elementsCount) - , _deletedCount(other._deletedCount) , _size(other._size) { _elementsCount = other._elementsCount; - _deletedCount = other._deletedCount; _size = other._size; other._elementsCount = 0; - other._deletedCount = 0; other._size = 0; _allocation.Swap(other._allocation); } @@ -154,10 +150,8 @@ public: Clear(); _allocation.Free(); _elementsCount = other._elementsCount; - _deletedCount = other._deletedCount; _size = other._size; other._elementsCount = 0; - other._deletedCount = 0; other._size = 0; _allocation.Swap(other._allocation); } @@ -337,12 +331,12 @@ public: /// void Clear() { - if (_elementsCount + _deletedCount != 0) + if (_elementsCount != 0) { Bucket* data = _allocation.Get(); for (int32 i = 0; i < _size; i++) data[i].Free(); - _elementsCount = _deletedCount = 0; + _elementsCount = 0; } } @@ -377,7 +371,7 @@ public: oldAllocation.Swap(_allocation); const int32 oldSize = _size; const int32 oldElementsCount = _elementsCount; - _deletedCount = _elementsCount = 0; + _elementsCount = 0; if (capacity != 0 && (capacity & (capacity - 1)) != 0) { // Align capacity value to the next power of two (http://graphics.stanford.edu/~seander/bithacks.html#RoundUpPowerOf2) @@ -439,7 +433,7 @@ public: bool Add(const ItemType& item) { // Ensure to have enough memory for the next item (in case of new element insertion) - EnsureCapacity(_elementsCount + _deletedCount + 1); + EnsureCapacity(_elementsCount + 1); // Find location of the item or place to insert it FindPositionResult pos; @@ -485,7 +479,6 @@ public: { _allocation.Get()[pos.ObjectIndex].Delete(); _elementsCount--; - _deletedCount++; return true; } return false; @@ -504,7 +497,6 @@ public: ASSERT(_allocation.Get()[i._index].IsOccupied()); _allocation.Get()[i._index].Delete(); _elementsCount--; - _deletedCount++; return true; } return false;