Update version support
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Ghost.Core;
|
||||
using Misaki.HighPerformance.LowLevel;
|
||||
using Misaki.HighPerformance.LowLevel.Buffer;
|
||||
using Misaki.HighPerformance.LowLevel.Collections;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
@@ -30,7 +31,7 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
|
||||
public ref struct Enumerator
|
||||
public ref struct Enumerator : IDisposable
|
||||
{
|
||||
private fixed int _compTypeIDs[1];
|
||||
private fixed int _offsets[1];
|
||||
@@ -40,6 +41,9 @@ public unsafe partial struct EntityQuery
|
||||
private readonly EntityQueryMask _mask;
|
||||
private readonly World _world;
|
||||
|
||||
private readonly Stack.Scope _scope;
|
||||
private UnsafeList<int> _changedComponentIDs;
|
||||
|
||||
private ref Archetype _currentArchetype;
|
||||
private ref Chunk _currentChunk;
|
||||
private byte* _chunkBasePtr;
|
||||
@@ -59,6 +63,22 @@ public unsafe partial struct EntityQuery
|
||||
_mask = mask;
|
||||
_world = world;
|
||||
|
||||
_scope = AllocationManager.CreateStackScope();
|
||||
_changedComponentIDs = new UnsafeList<int>(1, _scope.AllocationHandle);
|
||||
|
||||
var it = _mask.writeAccess.GetIterator();
|
||||
while (it.Next(out var id))
|
||||
{
|
||||
for (var i = 0; i < 1; i++)
|
||||
{
|
||||
if (id == _compTypeIDs[i])
|
||||
{
|
||||
_changedComponentIDs.Add(id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
@@ -81,6 +101,11 @@ public unsafe partial struct EntityQuery
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < _changedComponentIDs.Count; i++)
|
||||
{
|
||||
_currentArchetype.MarkChanged(_currentChunkIndex, _changedComponentIDs[i], _world.Version);
|
||||
}
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
@@ -147,6 +172,11 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public readonly void Dispose()
|
||||
{
|
||||
_scope.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private readonly ReadOnlyUnsafeCollection<Identifier<Archetype>> _matchingArchetypes;
|
||||
@@ -199,7 +229,7 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
|
||||
public ref struct Enumerator
|
||||
public ref struct Enumerator : IDisposable
|
||||
{
|
||||
private fixed int _compTypeIDs[2];
|
||||
private fixed int _offsets[2];
|
||||
@@ -209,6 +239,9 @@ public unsafe partial struct EntityQuery
|
||||
private readonly EntityQueryMask _mask;
|
||||
private readonly World _world;
|
||||
|
||||
private readonly Stack.Scope _scope;
|
||||
private UnsafeList<int> _changedComponentIDs;
|
||||
|
||||
private ref Archetype _currentArchetype;
|
||||
private ref Chunk _currentChunk;
|
||||
private byte* _chunkBasePtr;
|
||||
@@ -232,6 +265,22 @@ public unsafe partial struct EntityQuery
|
||||
_mask = mask;
|
||||
_world = world;
|
||||
|
||||
_scope = AllocationManager.CreateStackScope();
|
||||
_changedComponentIDs = new UnsafeList<int>(2, _scope.AllocationHandle);
|
||||
|
||||
var it = _mask.writeAccess.GetIterator();
|
||||
while (it.Next(out var id))
|
||||
{
|
||||
for (var i = 0; i < 2; i++)
|
||||
{
|
||||
if (id == _compTypeIDs[i])
|
||||
{
|
||||
_changedComponentIDs.Add(id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
@@ -255,6 +304,11 @@ public unsafe partial struct EntityQuery
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < _changedComponentIDs.Count; i++)
|
||||
{
|
||||
_currentArchetype.MarkChanged(_currentChunkIndex, _changedComponentIDs[i], _world.Version);
|
||||
}
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
@@ -321,6 +375,11 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public readonly void Dispose()
|
||||
{
|
||||
_scope.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private readonly ReadOnlyUnsafeCollection<Identifier<Archetype>> _matchingArchetypes;
|
||||
@@ -378,7 +437,7 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
|
||||
public ref struct Enumerator
|
||||
public ref struct Enumerator : IDisposable
|
||||
{
|
||||
private fixed int _compTypeIDs[3];
|
||||
private fixed int _offsets[3];
|
||||
@@ -388,6 +447,9 @@ public unsafe partial struct EntityQuery
|
||||
private readonly EntityQueryMask _mask;
|
||||
private readonly World _world;
|
||||
|
||||
private readonly Stack.Scope _scope;
|
||||
private UnsafeList<int> _changedComponentIDs;
|
||||
|
||||
private ref Archetype _currentArchetype;
|
||||
private ref Chunk _currentChunk;
|
||||
private byte* _chunkBasePtr;
|
||||
@@ -415,6 +477,22 @@ public unsafe partial struct EntityQuery
|
||||
_mask = mask;
|
||||
_world = world;
|
||||
|
||||
_scope = AllocationManager.CreateStackScope();
|
||||
_changedComponentIDs = new UnsafeList<int>(3, _scope.AllocationHandle);
|
||||
|
||||
var it = _mask.writeAccess.GetIterator();
|
||||
while (it.Next(out var id))
|
||||
{
|
||||
for (var i = 0; i < 3; i++)
|
||||
{
|
||||
if (id == _compTypeIDs[i])
|
||||
{
|
||||
_changedComponentIDs.Add(id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
@@ -439,6 +517,11 @@ public unsafe partial struct EntityQuery
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < _changedComponentIDs.Count; i++)
|
||||
{
|
||||
_currentArchetype.MarkChanged(_currentChunkIndex, _changedComponentIDs[i], _world.Version);
|
||||
}
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
@@ -505,6 +588,11 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public readonly void Dispose()
|
||||
{
|
||||
_scope.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private readonly ReadOnlyUnsafeCollection<Identifier<Archetype>> _matchingArchetypes;
|
||||
@@ -567,7 +655,7 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
|
||||
public ref struct Enumerator
|
||||
public ref struct Enumerator : IDisposable
|
||||
{
|
||||
private fixed int _compTypeIDs[4];
|
||||
private fixed int _offsets[4];
|
||||
@@ -577,6 +665,9 @@ public unsafe partial struct EntityQuery
|
||||
private readonly EntityQueryMask _mask;
|
||||
private readonly World _world;
|
||||
|
||||
private readonly Stack.Scope _scope;
|
||||
private UnsafeList<int> _changedComponentIDs;
|
||||
|
||||
private ref Archetype _currentArchetype;
|
||||
private ref Chunk _currentChunk;
|
||||
private byte* _chunkBasePtr;
|
||||
@@ -608,6 +699,22 @@ public unsafe partial struct EntityQuery
|
||||
_mask = mask;
|
||||
_world = world;
|
||||
|
||||
_scope = AllocationManager.CreateStackScope();
|
||||
_changedComponentIDs = new UnsafeList<int>(4, _scope.AllocationHandle);
|
||||
|
||||
var it = _mask.writeAccess.GetIterator();
|
||||
while (it.Next(out var id))
|
||||
{
|
||||
for (var i = 0; i < 4; i++)
|
||||
{
|
||||
if (id == _compTypeIDs[i])
|
||||
{
|
||||
_changedComponentIDs.Add(id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
@@ -633,6 +740,11 @@ public unsafe partial struct EntityQuery
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < _changedComponentIDs.Count; i++)
|
||||
{
|
||||
_currentArchetype.MarkChanged(_currentChunkIndex, _changedComponentIDs[i], _world.Version);
|
||||
}
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
@@ -699,6 +811,11 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public readonly void Dispose()
|
||||
{
|
||||
_scope.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private readonly ReadOnlyUnsafeCollection<Identifier<Archetype>> _matchingArchetypes;
|
||||
@@ -766,7 +883,7 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
|
||||
public ref struct Enumerator
|
||||
public ref struct Enumerator : IDisposable
|
||||
{
|
||||
private fixed int _compTypeIDs[5];
|
||||
private fixed int _offsets[5];
|
||||
@@ -776,6 +893,9 @@ public unsafe partial struct EntityQuery
|
||||
private readonly EntityQueryMask _mask;
|
||||
private readonly World _world;
|
||||
|
||||
private readonly Stack.Scope _scope;
|
||||
private UnsafeList<int> _changedComponentIDs;
|
||||
|
||||
private ref Archetype _currentArchetype;
|
||||
private ref Chunk _currentChunk;
|
||||
private byte* _chunkBasePtr;
|
||||
@@ -811,6 +931,22 @@ public unsafe partial struct EntityQuery
|
||||
_mask = mask;
|
||||
_world = world;
|
||||
|
||||
_scope = AllocationManager.CreateStackScope();
|
||||
_changedComponentIDs = new UnsafeList<int>(5, _scope.AllocationHandle);
|
||||
|
||||
var it = _mask.writeAccess.GetIterator();
|
||||
while (it.Next(out var id))
|
||||
{
|
||||
for (var i = 0; i < 5; i++)
|
||||
{
|
||||
if (id == _compTypeIDs[i])
|
||||
{
|
||||
_changedComponentIDs.Add(id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
@@ -837,6 +973,11 @@ public unsafe partial struct EntityQuery
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < _changedComponentIDs.Count; i++)
|
||||
{
|
||||
_currentArchetype.MarkChanged(_currentChunkIndex, _changedComponentIDs[i], _world.Version);
|
||||
}
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
@@ -903,6 +1044,11 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public readonly void Dispose()
|
||||
{
|
||||
_scope.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private readonly ReadOnlyUnsafeCollection<Identifier<Archetype>> _matchingArchetypes;
|
||||
@@ -975,7 +1121,7 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
|
||||
public ref struct Enumerator
|
||||
public ref struct Enumerator : IDisposable
|
||||
{
|
||||
private fixed int _compTypeIDs[6];
|
||||
private fixed int _offsets[6];
|
||||
@@ -985,6 +1131,9 @@ public unsafe partial struct EntityQuery
|
||||
private readonly EntityQueryMask _mask;
|
||||
private readonly World _world;
|
||||
|
||||
private readonly Stack.Scope _scope;
|
||||
private UnsafeList<int> _changedComponentIDs;
|
||||
|
||||
private ref Archetype _currentArchetype;
|
||||
private ref Chunk _currentChunk;
|
||||
private byte* _chunkBasePtr;
|
||||
@@ -1024,6 +1173,22 @@ public unsafe partial struct EntityQuery
|
||||
_mask = mask;
|
||||
_world = world;
|
||||
|
||||
_scope = AllocationManager.CreateStackScope();
|
||||
_changedComponentIDs = new UnsafeList<int>(6, _scope.AllocationHandle);
|
||||
|
||||
var it = _mask.writeAccess.GetIterator();
|
||||
while (it.Next(out var id))
|
||||
{
|
||||
for (var i = 0; i < 6; i++)
|
||||
{
|
||||
if (id == _compTypeIDs[i])
|
||||
{
|
||||
_changedComponentIDs.Add(id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
@@ -1051,6 +1216,11 @@ public unsafe partial struct EntityQuery
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < _changedComponentIDs.Count; i++)
|
||||
{
|
||||
_currentArchetype.MarkChanged(_currentChunkIndex, _changedComponentIDs[i], _world.Version);
|
||||
}
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
@@ -1117,6 +1287,11 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public readonly void Dispose()
|
||||
{
|
||||
_scope.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private readonly ReadOnlyUnsafeCollection<Identifier<Archetype>> _matchingArchetypes;
|
||||
@@ -1194,7 +1369,7 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
|
||||
public ref struct Enumerator
|
||||
public ref struct Enumerator : IDisposable
|
||||
{
|
||||
private fixed int _compTypeIDs[7];
|
||||
private fixed int _offsets[7];
|
||||
@@ -1204,6 +1379,9 @@ public unsafe partial struct EntityQuery
|
||||
private readonly EntityQueryMask _mask;
|
||||
private readonly World _world;
|
||||
|
||||
private readonly Stack.Scope _scope;
|
||||
private UnsafeList<int> _changedComponentIDs;
|
||||
|
||||
private ref Archetype _currentArchetype;
|
||||
private ref Chunk _currentChunk;
|
||||
private byte* _chunkBasePtr;
|
||||
@@ -1247,6 +1425,22 @@ public unsafe partial struct EntityQuery
|
||||
_mask = mask;
|
||||
_world = world;
|
||||
|
||||
_scope = AllocationManager.CreateStackScope();
|
||||
_changedComponentIDs = new UnsafeList<int>(7, _scope.AllocationHandle);
|
||||
|
||||
var it = _mask.writeAccess.GetIterator();
|
||||
while (it.Next(out var id))
|
||||
{
|
||||
for (var i = 0; i < 7; i++)
|
||||
{
|
||||
if (id == _compTypeIDs[i])
|
||||
{
|
||||
_changedComponentIDs.Add(id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
@@ -1275,6 +1469,11 @@ public unsafe partial struct EntityQuery
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < _changedComponentIDs.Count; i++)
|
||||
{
|
||||
_currentArchetype.MarkChanged(_currentChunkIndex, _changedComponentIDs[i], _world.Version);
|
||||
}
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
@@ -1341,6 +1540,11 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public readonly void Dispose()
|
||||
{
|
||||
_scope.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private readonly ReadOnlyUnsafeCollection<Identifier<Archetype>> _matchingArchetypes;
|
||||
@@ -1423,7 +1627,7 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
|
||||
public ref struct Enumerator
|
||||
public ref struct Enumerator : IDisposable
|
||||
{
|
||||
private fixed int _compTypeIDs[8];
|
||||
private fixed int _offsets[8];
|
||||
@@ -1433,6 +1637,9 @@ public unsafe partial struct EntityQuery
|
||||
private readonly EntityQueryMask _mask;
|
||||
private readonly World _world;
|
||||
|
||||
private readonly Stack.Scope _scope;
|
||||
private UnsafeList<int> _changedComponentIDs;
|
||||
|
||||
private ref Archetype _currentArchetype;
|
||||
private ref Chunk _currentChunk;
|
||||
private byte* _chunkBasePtr;
|
||||
@@ -1480,6 +1687,22 @@ public unsafe partial struct EntityQuery
|
||||
_mask = mask;
|
||||
_world = world;
|
||||
|
||||
_scope = AllocationManager.CreateStackScope();
|
||||
_changedComponentIDs = new UnsafeList<int>(8, _scope.AllocationHandle);
|
||||
|
||||
var it = _mask.writeAccess.GetIterator();
|
||||
while (it.Next(out var id))
|
||||
{
|
||||
for (var i = 0; i < 8; i++)
|
||||
{
|
||||
if (id == _compTypeIDs[i])
|
||||
{
|
||||
_changedComponentIDs.Add(id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reset();
|
||||
}
|
||||
|
||||
@@ -1509,6 +1732,11 @@ public unsafe partial struct EntityQuery
|
||||
_offsets[index] = layout.offset;
|
||||
_compBasePtrs[index] = (long)(_chunkBasePtr + _offsets[index]);
|
||||
}
|
||||
|
||||
for (var i = 0; i < _changedComponentIDs.Count; i++)
|
||||
{
|
||||
_currentArchetype.MarkChanged(_currentChunkIndex, _changedComponentIDs[i], _world.Version);
|
||||
}
|
||||
}
|
||||
|
||||
public bool MoveNext()
|
||||
@@ -1575,6 +1803,11 @@ public unsafe partial struct EntityQuery
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public readonly void Dispose()
|
||||
{
|
||||
_scope.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private readonly ReadOnlyUnsafeCollection<Identifier<Archetype>> _matchingArchetypes;
|
||||
|
||||
Reference in New Issue
Block a user