feat: implement material palette management and core mesh asset handling infrastructure
This commit is contained in:
@@ -1,2 +1,9 @@
|
||||
namespace Ghost.Core;
|
||||
|
||||
public class Wrapper<T>
|
||||
{
|
||||
public T? Value
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
@@ -21,8 +21,8 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Misaki.HighPerformance" Version="1.0.8" />
|
||||
<PackageReference Include="Misaki.HighPerformance.Jobs" Version="3.1.0" />
|
||||
<PackageReference Include="Misaki.HighPerformance.LowLevel" Version="1.6.15">
|
||||
<PackageReference Include="Misaki.HighPerformance.Jobs" Version="3.1.2" />
|
||||
<PackageReference Include="Misaki.HighPerformance.LowLevel" Version="1.6.16">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Ghost.Core;
|
||||
using Ghost.Entities;
|
||||
using Ghost.Graphics.Core;
|
||||
using Ghost.Graphics.Services;
|
||||
|
||||
namespace Ghost.Engine.Components;
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ internal static class ComponentRegistry
|
||||
size = sizeof(T),
|
||||
alignment = (int)MemoryUtility.AlignOf<T>(),
|
||||
isEnableable = typeof(IEnableableComponent).IsAssignableFrom(type),
|
||||
isSharedWarper = typeof(ISharedWarper).IsAssignableFrom(type),
|
||||
isSharedWarper = typeof(ISharedWrapper).IsAssignableFrom(type),
|
||||
isCleanup = typeof(ICleanupComponent).IsAssignableFrom(type),
|
||||
};
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ using System.Diagnostics;
|
||||
namespace Ghost.Entities;
|
||||
|
||||
public interface ISharedComponent;
|
||||
public interface ISharedWarper
|
||||
public interface ISharedWrapper
|
||||
{
|
||||
int Index
|
||||
{
|
||||
@@ -15,7 +15,7 @@ public interface ISharedWarper
|
||||
}
|
||||
}
|
||||
|
||||
public struct Shared<T> : IComponent, ISharedWarper
|
||||
public struct Shared<T> : IComponent, ISharedWrapper
|
||||
where T : unmanaged, ISharedComponent
|
||||
{
|
||||
public int Index
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Ghost.Core;
|
||||
using Ghost.Graphics.Services;
|
||||
using Misaki.HighPerformance.LowLevel.Buffer;
|
||||
using Misaki.HighPerformance.LowLevel.Collections;
|
||||
using Misaki.HighPerformance.Mathematics;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
using Ghost.Core;
|
||||
using Ghost.Graphics.Core;
|
||||
using Misaki.HighPerformance.LowLevel.Buffer;
|
||||
using Misaki.HighPerformance.LowLevel.Collections;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Ghost.Graphics.Core;
|
||||
namespace Ghost.Graphics.Services;
|
||||
|
||||
public readonly struct MaterialPalette
|
||||
{
|
||||
@@ -33,8 +33,8 @@ public sealed partial class ResourceManager : IDisposable
|
||||
private readonly MaterialPaletteStore _materialPalettes;
|
||||
|
||||
// TODO: Any better way? System.Threading.Lock is very fast though, it use spin lock before entering kernel.
|
||||
// rw lock slim is an option but it has more overhead on read, and for more than 90% of the time we are reading, it may not be a good option.
|
||||
// Plus UnsafeSlotMap use jagged array internally, which means we can have concurrent read and write on different slots without any issue, so we only need to lock when writing to those slots.
|
||||
// rw lock slim is an option but it has more overhead on read. Because more than 90% of the time we are reading, it may not be a good option.
|
||||
// Plus UnsafeSlotMap use jagged array internally, which means we can have concurrent read and write, but not add and remove, on different slots without any issue, so we only need to lock when writing to those slots.
|
||||
private readonly Lock _meshWriteLock;
|
||||
private readonly Lock _materialWriteLock;
|
||||
private readonly Lock _shaderWriteLock;
|
||||
|
||||
Reference in New Issue
Block a user