Skip to content

Commit 5f82b24

Browse files
committed
Version 0.12.2 Release [Bugfix]
Bugfix release
1 parent b893404 commit 5f82b24

File tree

11 files changed

+104
-56
lines changed

11 files changed

+104
-56
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ You can find changelogs for the individual modules in the [official Latios
1010
Framework Documentation
1111
repository](https://github.com/Dreaming381/Latios-Framework-Documentation).
1212

13+
## [0.12.2] – 2025-3-22
14+
15+
Officially supports Entities [1.3.9]
16+
17+
### Changed
18+
19+
- Updated Core to v0.12.2
20+
- Updated Psyshock to v0.12.2
21+
- Updated Kinemation to v0.12.2
22+
1323
## [0.12.1] – 2025-3-8
1424

1525
Officially supports Entities [1.3.9]

Core/GameplayToolkit/TempQuery.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ public TempQuery(NativeArray<EntityArchetype> archetypes,
8686
/// The list of entities matching the query, which can be used in a foreach expression
8787
/// </summary>
8888
public TempEntityEnumerator<TempMaskedChunkEnumerator<TempChunkEnumerator<TempArchetypeEnumerator> > > entities => chunks.masked.entities;
89+
/// <summary>
90+
/// The EntityStorageInfoLookup the TempQuery was created with
91+
/// </summary>
92+
public EntityStorageInfoLookup entityStorageInfoLookup => esil;
8993

9094
/// <summary>
9195
/// Returns true if the archetype is included in this query
@@ -199,6 +203,11 @@ public bool MatchesArchetype(EntityArchetype archetype)
199203

200204
return true;
201205
}
206+
207+
/// <summary>
208+
/// Replaces the TempQuery's archetype array with the one specified.
209+
/// </summary>
210+
public void SetArchetypes(NativeArray<EntityArchetype> archetypes) => archetypesArray = archetypes;
202211
#endregion
203212

204213
#region Fields

Kinemation/Authoring/BakingSystems/SkeletonPathsSmartBlobberSystem.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public static void CreateBoneNamesForExposedSkeleton(this IBaker baker, UnityEng
8888
{
8989
var child = baker.GetChild(bone, i);
9090
if (baker.GetComponent<UnityEngine.SkinnedMeshRenderer>(child) == null && baker.GetComponent<ExcludeFromSkeletonAuthoring>(child) == null &&
91+
baker.GetComponent<Unity.Entities.Hybrid.Baking.BakingOnlyEntityAuthoring>(child) == null &&
9192
baker.GetComponentInParent<UnityEngine.Animator>(child) == rootAnimator)
9293
s_breadthQueue.Enqueue((child, currentIndex));
9394
}

Kinemation/Authoring/ShadowHierarchyBuilder.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using Unity.Entities.Hybrid.Baking;
34
using UnityEngine;
45

56
namespace Latios.Kinemation.Authoring
@@ -63,7 +64,7 @@ static void RecurseExposedChildren(Transform source, Transform shadow)
6364

6465
// If the child has an Animator or SkinnedMeshRenderer, it shouldn't be animated, so delete it.
6566
if (shadowChild.GetComponent<SkinnedMeshRenderer>() != null || shadowChild.GetComponent<Animator>() != null ||
66-
shadowChild.GetComponent<ExcludeFromSkeletonAuthoring>() != null)
67+
shadowChild.GetComponent<BakingOnlyEntityAuthoring>() != null || shadowChild.GetComponent<ExcludeFromSkeletonAuthoring>() != null)
6768
{
6869
s_immediateChildrenToDestroy.Add(shadowChild);
6970
continue;
@@ -92,7 +93,8 @@ static void TagAndPruneOptimizedChildren(Transform sourceRoot, Transform shadowR
9293

9394
// If the child has an Animator or SkinnedMeshRenderer, it shouldn't be animated, so delete it.
9495
if (shadowChild.GetComponent<SkinnedMeshRenderer>() != null || shadowChild.GetComponent<Animator>() != null ||
95-
shadowChild.GetComponent<SocketAuthoring>() != null || shadowChild.GetComponent<ExcludeFromSkeletonAuthoring>() != null)
96+
shadowChild.GetComponent<BakingOnlyEntityAuthoring>() != null || shadowChild.GetComponent<SocketAuthoring>() != null ||
97+
shadowChild.GetComponent<ExcludeFromSkeletonAuthoring>() != null)
9698
{
9799
RecurseTagSkinnedOrDelete(sourceChild, shadowChild);
98100
continue;

Kinemation/Authoring/SkeletonBaker.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Latios.Transforms.Authoring;
33
using Unity.Collections;
44
using Unity.Entities;
5+
using Unity.Entities.Hybrid.Baking;
56
using UnityEngine;
67

78
namespace Latios.Kinemation.Authoring
@@ -82,7 +83,7 @@ public override void Bake(Animator authoring)
8283
{
8384
var child = GetChild(bone, i);
8485
if (GetComponent<SkinnedMeshRenderer>(child) == null && GetComponent<ExcludeFromSkeletonAuthoring>(child) == null &&
85-
GetComponentInParent<Animator>(child) == authoring)
86+
GetComponent<BakingOnlyEntityAuthoring>() == null && GetComponentInParent<Animator>(child) == authoring)
8687
m_breadthQueue.Enqueue((child, currentIndex));
8788
}
8889
}
@@ -114,11 +115,12 @@ public override void Bake(Animator authoring)
114115
for (int i = 0; i < GetChildCount(); i++)
115116
{
116117
var child = GetChild(i);
117-
if (GetComponent<SkinnedMeshRenderer>(child) != null || GetComponent<ExcludeFromSkeletonAuthoring>(child) != null || GetComponent<Animator>(child) != null)
118+
if (GetComponent<SkinnedMeshRenderer>(child) != null || GetComponent<ExcludeFromSkeletonAuthoring>(child) != null ||
119+
GetComponent<BakingOnlyEntityAuthoring>(child) != null || GetComponent<Animator>(child) != null)
118120
continue;
119121

120122
boneGoBuffer.Add(new ImportedSocketGameObjectRef { authoringGameObjectForBone = child });
121-
boneEntityBuffer.Add(new ImportedSocket { boneEntity = GetEntity(child, TransformUsageFlags.Dynamic) });
123+
boneEntityBuffer.Add(new ImportedSocket { boneEntity = GetEntity(child, TransformUsageFlags.Dynamic) });
122124
}
123125

124126
AddBuffer<OptimizedBoneInertialBlendState>(entity);

Kinemation/Systems/PostBatching/PrepareLODsSystem.cs

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
using Unity.Entities;
55
using Unity.Entities.Exposed;
66
using Unity.Jobs;
7-
using Unity.Mathematics;
87
using Unity.Rendering;
98

109
using static Unity.Entities.SystemAPI;
1110

11+
// Even though this job only iterates chunks, it still ends up being expensive single-threaded.
12+
// We capture the relevant data per chunk into an array in parallel, and then use that to populate the hashmap.
13+
1214
namespace Latios.Kinemation.Systems
1315
{
1416
[DisableAutoCreation]
@@ -28,11 +30,6 @@ public void OnCreate(ref SystemState state)
2830
latiosWorld.worldBlackboardEntity.AddOrSetCollectionComponentAndDisposeOld<LODCrossfadePtrMap>(default);
2931
}
3032

31-
[BurstCompile]
32-
public void OnDestroy(ref SystemState state)
33-
{
34-
}
35-
3633
[BurstCompile]
3734
public void OnUpdate(ref SystemState state)
3835
{
@@ -43,35 +40,68 @@ public void OnUpdate(ref SystemState state)
4340

4441
if (!m_lodCrossfadeQuery.IsEmptyIgnoreFilter)
4542
{
43+
int chunkCountWithoutFiltering = m_lodCrossfadeQuery.CalculateChunkCountWithoutFiltering();
44+
45+
var chunkPtrsArray = CollectionHelper.CreateNativeArray<ChunkIdAndPointer>(chunkCountWithoutFiltering,
46+
state.WorldUpdateAllocator,
47+
NativeArrayOptions.UninitializedMemory);
48+
4649
state.Dependency = new CaptureLodCrossfadePtrsJob
4750
{
4851
lodCrossfadeHandle = GetComponentTypeHandle<LodCrossfade>(true),
4952
entitiesGraphicsChunkInfoHandle = GetComponentTypeHandle<EntitiesGraphicsChunkInfo>(true),
50-
map = crossfadePtrMap,
51-
chunkCount = m_lodCrossfadeQuery.CalculateChunkCountWithoutFiltering()
52-
}.Schedule(m_lodCrossfadeQuery, state.Dependency);
53+
array = chunkPtrsArray,
54+
}.ScheduleParallel(m_lodCrossfadeQuery, state.Dependency);
55+
56+
state.Dependency = new IndexLodCrossfadePtrsJob
57+
{
58+
map = crossfadePtrMap,
59+
array = chunkPtrsArray,
60+
}.Schedule(state.Dependency);
5361
}
5462
}
5563

56-
// Schedule single-threaded
64+
struct ChunkIdAndPointer
65+
{
66+
public LODCrossfadePtrMap.ChunkIdentifier id;
67+
public LODCrossfadePtrMap.CrossfadePtr ptr;
68+
}
69+
5770
[BurstCompile]
5871
struct CaptureLodCrossfadePtrsJob : IJobChunk
5972
{
6073
[ReadOnly] public ComponentTypeHandle<LodCrossfade> lodCrossfadeHandle;
6174
[ReadOnly] public ComponentTypeHandle<EntitiesGraphicsChunkInfo> entitiesGraphicsChunkInfoHandle;
6275

63-
public NativeHashMap<LODCrossfadePtrMap.ChunkIdentifier, LODCrossfadePtrMap.CrossfadePtr> map;
64-
public int chunkCount;
76+
public NativeArray<ChunkIdAndPointer> array;
6577

6678
public unsafe void Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
6779
{
68-
if (map.IsEmpty)
69-
map.Capacity = chunkCount;
70-
7180
var info = chunk.GetChunkComponentRefRO(ref entitiesGraphicsChunkInfoHandle);
72-
var identifier = new LODCrossfadePtrMap.ChunkIdentifier { batchID = (uint)info.ValueRO.BatchIndex, batchStartIndex = info.ValueRO.CullingData.ChunkOffsetInBatch };
73-
var ptr = new LODCrossfadePtrMap.CrossfadePtr { ptr = (LodCrossfade*)chunk.GetRequiredComponentDataPtrRO(ref lodCrossfadeHandle) };
74-
map.Add(identifier, ptr);
81+
var identifier = new LODCrossfadePtrMap.ChunkIdentifier
82+
{
83+
batchID = (uint)info.ValueRO.BatchIndex,
84+
batchStartIndex = info.ValueRO.CullingData.ChunkOffsetInBatch
85+
};
86+
var ptr = new LODCrossfadePtrMap.CrossfadePtr { ptr = (LodCrossfade*)chunk.GetRequiredComponentDataPtrRO(ref lodCrossfadeHandle) };
87+
array[unfilteredChunkIndex] = new ChunkIdAndPointer { id = identifier, ptr = ptr };
88+
}
89+
}
90+
91+
[BurstCompile]
92+
struct IndexLodCrossfadePtrsJob : IJob
93+
{
94+
[ReadOnly] public NativeArray<ChunkIdAndPointer> array;
95+
public NativeHashMap<LODCrossfadePtrMap.ChunkIdentifier, LODCrossfadePtrMap.CrossfadePtr> map;
96+
97+
public unsafe void Execute()
98+
{
99+
map.Capacity = array.Length;
100+
101+
foreach (var chunkIdAndPointer in array)
102+
{
103+
map.Add(chunkIdAndPointer.id, chunkIdAndPointer.ptr);
104+
}
75105
}
76106
}
77107
}

Kinemation/Systems/UnityReplacements/LatiosUpdateEntitiesGraphicsChunkStructureSystem.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@ public partial struct LatiosUpdateEntitiesGraphicsChunkStructureSystem : ISystem
2626
public void OnCreate(ref SystemState state)
2727
{
2828
m_MissingHybridChunkInfo = state.Fluent().With<ChunkWorldRenderBounds>(true, true).With<WorldRenderBounds>(true).WithWorldTransformReadOnly()
29-
.With<MaterialMeshInfo>(true).Without<EntitiesGraphicsChunkInfo>(true).Without<DisableRendering>().IncludePrefabs().
30-
IncludeDisabledEntities().Build();
29+
.With<MaterialMeshInfo>(true).Without<EntitiesGraphicsChunkInfo>(true).Without<DisableRendering>().IncludePrefabs().Build();
3130

3231
m_DisabledRenderingQuery = state.Fluent().With<EntitiesGraphicsChunkInfo>(true, true)
33-
.WithAnyEnabled<Disabled, Prefab, DisableRendering>(true).IncludeDisabledEntities().IncludePrefabs().Build();
32+
.WithAnyEnabled<Disabled, DisableRendering>(true).IncludeDisabledEntities().IncludePrefabs().Build();
3433

3534
m_destroyedChunkInfoQuery = state.Fluent().With<EntitiesGraphicsChunkInfo>(true, true).Without<MaterialMeshInfo>().Build();
3635

@@ -45,11 +44,6 @@ public void OnCreate(ref SystemState state)
4544
#endif
4645
}
4746

48-
[BurstCompile]
49-
public void OnDestroy(ref SystemState state)
50-
{
51-
}
52-
5347
//[BurstCompile]
5448
public void OnUpdate(ref SystemState state)
5549
{
@@ -61,9 +55,15 @@ public void OnUpdate(ref SystemState state)
6155
}
6256
#endif
6357

64-
state.EntityManager.AddComponent(m_MissingHybridChunkInfo, ComponentType.ChunkComponent<EntitiesGraphicsChunkInfo>());
65-
state.EntityManager.RemoveChunkComponentData<EntitiesGraphicsChunkInfo>(m_DisabledRenderingQuery);
66-
state.EntityManager.RemoveChunkComponentData<EntitiesGraphicsChunkInfo>(m_destroyedChunkInfoQuery);
58+
DoChanges(ref state, ref this);
59+
}
60+
61+
[BurstCompile]
62+
static void DoChanges(ref SystemState state, ref LatiosUpdateEntitiesGraphicsChunkStructureSystem system)
63+
{
64+
state.EntityManager.AddComponent(system.m_MissingHybridChunkInfo, ComponentType.ChunkComponent<EntitiesGraphicsChunkInfo>());
65+
state.EntityManager.RemoveChunkComponentData<EntitiesGraphicsChunkInfo>(system.m_DisabledRenderingQuery);
66+
state.EntityManager.RemoveChunkComponentData<EntitiesGraphicsChunkInfo>(system.m_destroyedChunkInfoQuery);
6767
}
6868
}
6969
}

PsyshockPhysics/Physics/Internal/Builders/BuildCollisionLayerInternal.cs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using Unity.Burst.Intrinsics;
66
using Unity.Collections;
77
using Unity.Entities;
8-
using Unity.Entities.UniversalDelegates;
98
using Unity.Jobs;
109
using Unity.Mathematics;
1110

@@ -810,7 +809,7 @@ public void Build()
810809
{
811810
BuildEytzingerIntervalTreeRecurse(0, 0);
812811

813-
PatchSubtreeMaxResurse(0);
812+
PatchSubtreeMax();
814813
}
815814

816815
private int BuildEytzingerIntervalTreeRecurse(int bucketRelativeIndex, uint treeIndex)
@@ -838,20 +837,16 @@ private int BuildEytzingerIntervalTreeRecurse(int bucketRelativeIndex, uint tree
838837
}
839838

840839
// This function is unique to Latios Framework
841-
// Todo: There is likely a more cache-friendly way to iterate this tree and do this work
842-
private float PatchSubtreeMaxResurse(uint treeIndex)
840+
private void PatchSubtreeMax()
843841
{
844-
if (treeIndex >= nodesToPopulate.Length)
845-
return 0f;
846-
847-
float leftTreeMax = PatchSubtreeMaxResurse(2 * treeIndex + 1);
848-
float rightTreeMax = PatchSubtreeMaxResurse(2 * treeIndex + 2);
849-
850-
var node = nodesToPopulate[(int)treeIndex];
851-
node.subtreeXmax = math.max(math.max(leftTreeMax, rightTreeMax), node.subtreeXmax);
852-
nodesToPopulate[(int)treeIndex] = node;
853-
854-
return node.subtreeXmax;
842+
for (int i = nodesToPopulate.Length - 1; i > 0; i--)
843+
{
844+
var node = nodesToPopulate[i];
845+
var parentIndex = (i - 1) / 2;
846+
var parent = nodesToPopulate[parentIndex];
847+
parent.subtreeXmax = math.max(parent.subtreeXmax, node.subtreeXmax);
848+
nodesToPopulate[parentIndex] = parent;
849+
}
855850
}
856851
}
857852

PsyshockPhysics/Physics/Types/CollisionLayer.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public CollisionLayer(in CollisionLayer sourceLayer, AllocatorManager.AllocatorH
171171
/// </summary>
172172
/// <param name="settings">The settings to use for the layer. You typically want to match this with other layers when using FindPairs.</param>
173173
/// <param name="allocator">The Allocator to use for this layer. Despite being empty, this layer is still allocated and may require disposal.</param>
174-
/// <returns>A CollisionLayer with zero bodiesArray, but with the bucket distribution matching the specified settings</returns>
174+
/// <returns>A CollisionLayer with zero bodies, but with the bucket distribution matching the specified settings</returns>
175175
public static CollisionLayer CreateEmptyCollisionLayer(CollisionLayerSettings settings, AllocatorManager.AllocatorHandle allocator)
176176
{
177177
var layer = new CollisionLayer(settings, allocator);
@@ -200,10 +200,10 @@ public void Dispose()
200200
/// </summary>
201201
/// <param name="inputDeps">A JobHandle to wait upon before disposing</param>
202202
/// <returns>The final jobHandle of the disposed layers</returns>
203-
public unsafe JobHandle Dispose(JobHandle inputDeps)
203+
public JobHandle Dispose(JobHandle inputDeps)
204204
{
205205
worldSubdivisionsPerAxis = 0;
206-
JobHandle* deps = stackalloc JobHandle[7]
206+
return CollectionsExtensions.CombineDependencies(stackalloc JobHandle[]
207207
{
208208
bucketStartsAndCounts.Dispose(inputDeps),
209209
xmins.Dispose(inputDeps),
@@ -212,8 +212,7 @@ public unsafe JobHandle Dispose(JobHandle inputDeps)
212212
intervalTrees.Dispose(inputDeps),
213213
bodies.Dispose(inputDeps),
214214
srcIndices.Dispose(inputDeps)
215-
};
216-
return Unity.Jobs.LowLevel.Unsafe.JobHandleUnsafeUtility.CombineDependencies(deps, 7);
215+
});
217216
}
218217

219218
/// <summary>

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![](https://github.com/Dreaming381/Latios-Framework-Documentation/blob/554a583e217bfe5bf38ece0ed65b22c33711afc6/media/bf2cb606139bb3ca01fe1c4c9f92cdf7.png)
22

3-
# Latios Framework for Unity ECS – [0.12.1]
3+
# Latios Framework for Unity ECS – [0.12.2]
44

55
The Latios Framework is a powerful suite of high-performance low-level APIs and
66
feature-sets for Unity’s ECS which aims to give you back control over your

0 commit comments

Comments
 (0)