Skip to content

Commit

Permalink
Version 0.7.3 Release [Bugfix]
Browse files Browse the repository at this point in the history
Bugfix release
  • Loading branch information
Dreaming381 committed Jun 10, 2023
1 parent ae9aec2 commit 9ea1ce3
Show file tree
Hide file tree
Showing 15 changed files with 538 additions and 446 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@ Versioning](http://semver.org/spec/v2.0.0.html).
You can find changelogs for the individual modules inside the Documentation\~
directory.

## [0.7.3] – 2023-6-10

Officially supports Entities [1.0.10]

### Changed

- Updated Core to v0.7.3
- Updated Psyshock to v0.7.3

## [0.7.2] – 2023-6-4

Officially supports Entities [1.0.10]
Expand Down
3 changes: 2 additions & 1 deletion Core/Authoring/SmartBaker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ public sealed override void Bake(TAuthoring authoring)
}
}

void ICreateSmartBakerSystem.Create(World world, ComponentSystemGroup addToThis)
unsafe void ICreateSmartBakerSystem.Create(World world, ComponentSystemGroup addToThis)
{
TypeManager.GetSystemTypeIndex(typeof(SmartBakerSystem<TAuthoring, TSmartBakeItem>));
var system = world.GetOrCreateSystemManaged<SmartBakerSystem<TAuthoring, TSmartBakeItem> >();
system.runInBurst = RunPostProcessInBurst();
addToThis.AddSystemToUpdateList(system);
Expand Down
1 change: 1 addition & 0 deletions Core/Authoring/SmartBlobberAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ public void Register(World managedWorld)
{
if (managedWorld.GetExistingSystemManaged<Systems.SmartBlobberTypedPostProcessBakingSystem<TBlobType> >() != null)
return;
TypeManager.GetSystemTypeIndex(typeof(Systems.SmartBlobberTypedPostProcessBakingSystem<TBlobType>));
var system = managedWorld.GetOrCreateSystemManaged<Systems.SmartBlobberTypedPostProcessBakingSystem<TBlobType> >();
var group = managedWorld.GetExistingSystemManaged<Systems.SmartBlobberCleanupBakingGroup>();
group.AddSystemToUpdateListSafe(system.SystemHandle);
Expand Down
34 changes: 7 additions & 27 deletions Core/Containers/DestroyCommandBuffer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Diagnostics;
using Unity.Burst;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Entities;
using Unity.Jobs;

Expand Down Expand Up @@ -70,19 +71,7 @@ public void Add(Entity entity, int sortKey = int.MaxValue)
public void Playback(EntityManager entityManager)
{
CheckDidNotPlayback();
bool ran = false;
NativeList<Entity> entities = default;
RunPrepInJob(ref ran, ref entities);
if (ran)
{
entityManager.DestroyEntity(entities.AsArray());
entities.Dispose();
}
else
{
entityManager.DestroyEntity(m_entityOperationCommandBuffer.GetEntities(Allocator.Temp));
}
m_playedBack.Value = true;
Playbacker.Playback((DestroyCommandBuffer*)UnsafeUtility.AddressOf(ref this), (EntityManager*)UnsafeUtility.AddressOf(ref entityManager));
}

/// <summary>
Expand Down Expand Up @@ -112,23 +101,14 @@ void CheckDidNotPlayback()
}

#region PlaybackJobs
[BurstDiscard]
private unsafe void RunPrepInJob(ref bool ran, ref NativeList<Entity> entities)
{
ran = true;
entities = new NativeList<Entity>(0, Allocator.TempJob);
new PrepJob { eocb = m_entityOperationCommandBuffer, entities = entities }.Run();
}

[BurstCompile]
private struct PrepJob : IJob
static class Playbacker
{
[ReadOnly] public EntityOperationCommandBuffer eocb;
public NativeList<Entity> entities;

public void Execute()
[BurstCompile]
public static unsafe void Playback(DestroyCommandBuffer* dcb, EntityManager* em)
{
eocb.GetEntities(ref entities);
em->DestroyEntity(dcb->m_entityOperationCommandBuffer.GetEntities(Allocator.Temp));
dcb->m_playedBack.Value = true;
}
}
#endregion
Expand Down
39 changes: 10 additions & 29 deletions Core/Containers/DisableCommandBuffer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Diagnostics;
using Unity.Burst;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Entities;
using Unity.Jobs;

Expand All @@ -10,6 +11,7 @@ namespace Latios
/// A specialized variant of the EntityCommandBuffer exclusively for disabling entities.
/// Disabled entities automatically account for LinkedEntityGroup at the time of playback.
/// </summary>
[BurstCompile]
public unsafe struct DisableCommandBuffer : INativeDisposable
{
#region Structure
Expand Down Expand Up @@ -67,22 +69,11 @@ public void Add(Entity entity, int sortKey = int.MaxValue)
/// </summary>
/// <param name="entityManager">The EntityManager with which to play back the DisableCommandBuffer</param>
/// <param name="linkedFEReadOnly">A ReadOnly accessor to the entities' LinkedEntityGroup</param>
public void Playback(EntityManager entityManager, BufferLookup<LinkedEntityGroup> linkedFEReadOnly)
public unsafe void Playback(EntityManager entityManager, BufferLookup<LinkedEntityGroup> linkedFEReadOnly)
{
CheckDidNotPlayback();
bool ran = false;
NativeList<Entity> entities = default;
RunPrepInJob(linkedFEReadOnly, ref ran, ref entities);
if (ran)
{
entityManager.RemoveComponent<Disabled>(entities.AsArray());
entities.Dispose();
}
else
{
entityManager.RemoveComponent<Disabled>(m_entityOperationCommandBuffer.GetLinkedEntities(linkedFEReadOnly, Allocator.Temp));
}
m_playedBack.Value = true;
Playbacker.Playback((DisableCommandBuffer*)UnsafeUtility.AddressOf(ref this), (EntityManager*)UnsafeUtility.AddressOf(ref entityManager),
(BufferLookup<LinkedEntityGroup>*)UnsafeUtility.AddressOf(ref linkedFEReadOnly));
}

/// <summary>
Expand Down Expand Up @@ -112,24 +103,14 @@ void CheckDidNotPlayback()
}

#region PlaybackJobs
[BurstDiscard]
private void RunPrepInJob(BufferLookup<LinkedEntityGroup> linkedFE, ref bool ran, ref NativeList<Entity> entities)
{
ran = true;
entities = new NativeList<Entity>(0, Allocator.TempJob);
new PrepJob { linkedFE = linkedFE, eocb = m_entityOperationCommandBuffer, entities = entities }.Run();
}

[BurstCompile]
private struct PrepJob : IJob
static class Playbacker
{
[ReadOnly] public BufferLookup<LinkedEntityGroup> linkedFE;
[ReadOnly] public EntityOperationCommandBuffer eocb;
public NativeList<Entity> entities;

public void Execute()
[BurstCompile]
public static unsafe void Playback(DisableCommandBuffer* dcb, EntityManager* em, BufferLookup<LinkedEntityGroup>* lookup)
{
eocb.GetLinkedEntities(linkedFE, ref entities);
em->AddComponent<Disabled>(dcb->m_entityOperationCommandBuffer.GetLinkedEntities(*lookup, Allocator.Temp));
dcb->m_playedBack.Value = true;
}
}
#endregion
Expand Down
40 changes: 10 additions & 30 deletions Core/Containers/EnableCommandBuffer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Diagnostics;
using Unity.Burst;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Entities;
using Unity.Jobs;

Expand All @@ -10,6 +11,7 @@ namespace Latios
/// A specialized variant of the EntityCommandBuffer exclusively for enabling entities.
/// Enabled entities automatically account for LinkedEntityGroup at the time of playback.
/// </summary>
[BurstCompile]
public unsafe struct EnableCommandBuffer : INativeDisposable
{
#region Structure
Expand Down Expand Up @@ -67,22 +69,11 @@ public void Add(Entity entity, int sortKey = int.MaxValue)
/// </summary>
/// <param name="entityManager">The EntityManager with which to play back the EnableCommandBuffer</param>
/// <param name="linkedFEReadOnly">A ReadOnly accessor to the entities' LinkedEntityGroup</param>
public void Playback(EntityManager entityManager, BufferLookup<LinkedEntityGroup> linkedFEReadOnly)
public unsafe void Playback(EntityManager entityManager, BufferLookup<LinkedEntityGroup> linkedFEReadOnly)
{
CheckDidNotPlayback();
bool ran = false;
NativeList<Entity> entities = default;
RunPrepInJob(linkedFEReadOnly, ref ran, ref entities);
if (ran)
{
entityManager.RemoveComponent<Disabled>(entities.AsArray());
entities.Dispose();
}
else
{
entityManager.RemoveComponent<Disabled>(m_entityOperationCommandBuffer.GetLinkedEntities(linkedFEReadOnly, Allocator.Temp));
}
m_playedBack.Value = true;
Playbacker.Playback((EnableCommandBuffer*)UnsafeUtility.AddressOf(ref this), (EntityManager*)UnsafeUtility.AddressOf(ref entityManager),
(BufferLookup<LinkedEntityGroup>*)UnsafeUtility.AddressOf(ref linkedFEReadOnly));
}

/// <summary>
Expand Down Expand Up @@ -112,25 +103,14 @@ void CheckDidNotPlayback()
}

#region PlaybackJobs
[BurstDiscard]
private void RunPrepInJob(BufferLookup<LinkedEntityGroup> linkedFE, ref bool ran, ref NativeList<Entity> entities)
{
ran = true;
entities = new NativeList<Entity>(0, Allocator.TempJob);
new PrepJob { linkedFE = linkedFE, eocb = m_entityOperationCommandBuffer, entities = entities }.Run();
entities.Dispose();
}

[BurstCompile]
private struct PrepJob : IJob
static class Playbacker
{
[ReadOnly] public BufferLookup<LinkedEntityGroup> linkedFE;
[ReadOnly] public EntityOperationCommandBuffer eocb;
public NativeList<Entity> entities;

public void Execute()
[BurstCompile]
public static unsafe void Playback(EnableCommandBuffer* ecb, EntityManager* em, BufferLookup<LinkedEntityGroup>* lookup)
{
eocb.GetLinkedEntities(linkedFE, ref entities);
em->RemoveComponent<Disabled>(ecb->m_entityOperationCommandBuffer.GetLinkedEntities(*lookup, Allocator.Temp));
ecb->m_playedBack.Value = true;
}
}
#endregion
Expand Down
37 changes: 10 additions & 27 deletions Core/Containers/InstantiateCommandBuffer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Diagnostics;
using Unity.Burst;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Entities;
using Unity.Jobs;

Expand All @@ -10,6 +11,7 @@ namespace Latios
/// A specialized variant of the EntityCommandBuffer exclusively for instantiating entities.
/// This variant does not perform any additional initialization after instantiation.
/// </summary>
[BurstCompile]
public struct InstantiateCommandBuffer : INativeDisposable
{
#region Structure
Expand Down Expand Up @@ -66,13 +68,10 @@ public void Add(Entity entity, int sortKey = int.MaxValue)
/// Plays back the InstantiateCommandBuffer.
/// </summary>
/// <param name="entityManager">The EntityManager with which to play back the InstantiateCommandBuffer</param>
public void Playback(EntityManager entityManager)
public unsafe void Playback(EntityManager entityManager)
{
CheckDidNotPlayback();
var eet = entityManager.BeginExclusiveEntityTransaction();
new PlaybackJob { eocb = m_entityOperationCommandBuffer, eet = eet }.Run();
eet.EntityManager.EndExclusiveEntityTransaction();
m_playedBack.Value = true;
Playbacker.Playback((InstantiateCommandBuffer*)UnsafeUtility.AddressOf(ref this), (EntityManager*)UnsafeUtility.AddressOf(ref entityManager));
}

/// <summary>
Expand Down Expand Up @@ -103,14 +102,12 @@ void CheckDidNotPlayback()

#region PlaybackJobs
[BurstCompile]
private struct PlaybackJob : IJob
static class Playbacker
{
[ReadOnly] public EntityOperationCommandBuffer eocb;
public ExclusiveEntityTransaction eet;

public void Execute()
[BurstCompile]
public static unsafe void Playback(InstantiateCommandBuffer* icb, EntityManager* em)
{
var prefabs = eocb.GetEntitiesSortedByEntity(Allocator.Temp);
var prefabs = icb->m_entityOperationCommandBuffer.GetEntitiesSortedByEntity(Allocator.Temp);
int i = 0;
while (i < prefabs.Length)
{
Expand All @@ -122,23 +119,9 @@ public void Execute()
i++;
count++;
}
eet.EntityManager.Instantiate(prefab, count, Allocator.Temp);
em->Instantiate(prefab, count, Allocator.Temp);
}
}

public void RunOrExecute()
{
bool ran = false;
TryRun(ref ran);
if (!ran)
Execute();
}

[BurstDiscard]
void TryRun(ref bool ran)
{
this.Run();
ran = true;
icb->m_playedBack.Value = true;
}
}
#endregion
Expand Down
3 changes: 1 addition & 2 deletions Core/Framework/BlackboardEntity.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Unity.Burst;
using Unity.Entities;
using Unity.Entities;
using Unity.Jobs;

namespace Latios
Expand Down
Loading

0 comments on commit 9ea1ce3

Please sign in to comment.