Refactor: variant-aware shader/material pipeline overhaul

Major architectural update to graphics/material/shader system:
- Introduced strongly-typed key structs (Key64/Key128) for passes, variants, and pipelines; removed legacy key types.
- Implemented robust hashing and key generation utilities for efficient variant and pipeline lookup/caching.
- Shader compiler now compiles/caches all keyword variants using new key system; includes handled as lists.
- Switched to push constant root signature for per-draw data; updated HLSL and C# codegen accordingly.
- Refactored Material, Shader, and Pass data structures for cache efficiency and variant support.
- Pipeline library and PSO management now use 128-bit keys and variant-specific caching.
- Replaced WorldNode with SceneNode in editor/scene graph; introduced ComponentManager for archetype/query management.
- Migrated math utilities to Misaki.HighPerformance.Mathematics; updated editor controls.
- Updated all HLSL and codegen for new buffer/push constant layouts and macros.
- Misc: project reference cleanup, D3D12 Work Graph support, doc updates, and code modernization.
This commit is contained in:
2026-01-09 22:25:37 +09:00
parent c9be05fc60
commit 6a041f75ba
93 changed files with 1926 additions and 1390 deletions

View File

@@ -1,5 +1,4 @@
using Ghost.Editor.Core.SceneGraph;
using Ghost.Engine;
using Ghost.Engine.IO;
using Ghost.Engine.Utilities;
using Ghost.Entities;
@@ -7,7 +6,7 @@ using System.Text.Json;
namespace Ghost.Editor.Core.Serializer;
internal class WorldNodeSerializer : CustomSerializer<WorldNode>
internal class SceneNodeSerializer : CustomSerializer<SceneNode>
{
private static class Property
{
@@ -22,19 +21,19 @@ internal class WorldNodeSerializer : CustomSerializer<WorldNode>
public override bool CanConvert(Type typeToConvert)
{
return typeToConvert == typeof(WorldNode) || typeToConvert.IsSubclassOf(typeof(WorldNode));
return typeToConvert == typeof(SceneNode) || typeToConvert.IsSubclassOf(typeof(SceneNode));
}
public unsafe override void SerializeJson(Utf8JsonWriter writer, WorldNode value, JsonSerializerOptions options)
public unsafe override void SerializeJson(Utf8JsonWriter writer, SceneNode value, JsonSerializerOptions options)
{
writer.WriteObject(() =>
{
writer.WriteString(Property.NAME, value.Name);
writer.WriteStartArray(Property.ENTITIES);
for (var i = 0; i < value.World.ArchetypeCount; i++)
for (var i = 0; i < value.Scene.World.ComponentManager.ArchetypeCount; i++)
{
ref var archetype = ref value.World.GetArchetypeReference(i);
ref var archetype = ref value.Scene.World.ComponentManager.GetArchetypeReference(i);
for (var j = 0; j < archetype.ChunkCount; j++)
{
@@ -64,7 +63,7 @@ internal class WorldNodeSerializer : CustomSerializer<WorldNode>
writer.WriteEndArray();
writer.WriteArray(Property.SYSTEMS, value.World.SystemManager.Systems, system =>
writer.WriteArray(Property.SYSTEMS, value.Scene.World.SystemManager.Systems, system =>
{
var name = system.GetType().AssemblyQualifiedName;
if (name == null)
@@ -77,7 +76,7 @@ internal class WorldNodeSerializer : CustomSerializer<WorldNode>
});
}
public override WorldNode? DeserializeJson(ref Utf8JsonReader reader, JsonSerializerOptions options)
public override SceneNode? DeserializeJson(ref Utf8JsonReader reader, JsonSerializerOptions options)
{
throw new NotImplementedException();
@@ -137,12 +136,12 @@ internal class WorldNodeSerializer : CustomSerializer<WorldNode>
//return result;
}
public override void SerializeBinary(BinaryWriter writer, WorldNode value)
public override void SerializeBinary(BinaryWriter writer, SceneNode value)
{
throw new NotImplementedException();
}
public override WorldNode? DeserializeBinary(BinaryReader reader)
public override SceneNode? DeserializeBinary(BinaryReader reader)
{
throw new NotImplementedException();
}