Files
GhostEngine/Ghost.Engine/EngineCore.cs
Misaki 2881fda112 Refactor component registration, update deps, improve JSON
- Updated Misaki.HighPerformance package versions in Core and Graphics projects.
- Added IsTrimmable to Ghost.Engine.csproj for trimming support.
- Renamed GetOrRegisterComponent to GetOrRegisterComponentID and updated all usages.
- Component registration codegen now uses a static class with [ModuleInitializer], no longer requires [EngineEntry].
- Improved JSON serialization: added string support, introduced Utf8JsonObjectScope/ArrayScope, and new extension methods for cleaner JSON writing.
- Removed [SkipLocalsInit] from Hierarchy and LocalToWorld.
- Fixed Entity.Invalid to use INVALID_ID for both fields.
- Minor cleanup: clarified comments, reorganized Ghost.Generator in solution, and disabled component serialization generator.
2025-12-21 22:18:25 +09:00

54 lines
1.1 KiB
C#

using Ghost.Entities;
using Misaki.HighPerformance.Jobs;
namespace Ghost.Engine;
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
internal class EngineEntryAttribute : Attribute
{
}
internal partial class EngineCoreImpl : IDisposable
{
internal readonly JobScheduler _jobScheduler;
internal EngineCoreImpl()
{
_jobScheduler = new JobScheduler(Environment.ProcessorCount - 2); // We -2 here, one for main thread, one for render thread
}
internal void IncrementCPUFenceValue()
{
//GraphicsPipeline.SignalCPUReady();
}
public void Dispose()
{
_jobScheduler.Dispose();
JobScheduler.ReleaseTempAllocator();
}
}
[EngineEntry]
public static partial class EngineCore
{
internal static readonly EngineCoreImpl s_impl;
public static JobScheduler JobScheduler => s_impl._jobScheduler;
static EngineCore()
{
s_impl = new EngineCoreImpl();
ComponentRegistry.GetOrRegisterComponentID<ManagedEntityRef>();
}
internal static void Init()
{
}
internal static void Dispose()
{
s_impl.Dispose();
}
}