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,47 @@
# Architecture Design Document
<!--toc:start-->
- [Architecture Design Document](#architecture-design-document)
- [Ghost Shader Concept - Technical Deep Dive](#ghost-shader-concept-technical-deep-dive)
- [Overview](#overview)
- [Memory Layout & Cache Efficiency](#memory-layout-cache-efficiency)
- [KeywordSet (64 bytes, cache-line friendly)](#keywordset-64-bytes-cache-line-friendly)
- [MaterialPropertyBlock (Variable Size, GPU-aligned)](#materialpropertyblock-variable-size-gpu-aligned)
- [Variant Compilation & Caching](#variant-compilation-caching)
- [Two-Level Caching Strategy](#two-level-caching-strategy)
- [Batching Algorithm](#batching-algorithm)
- [Phase 1: Grouping (O(N))](#phase-1-grouping-on)
- [Phase 2: Sorting (O(K log K))](#phase-2-sorting-ok-log-k)
- [Thread Safety Model](#thread-safety-model)
- [Lock-Free Operations](#lock-free-operations)
- [Fine-Grained Locks](#fine-grained-locks)
- [Pass System Design](#pass-system-design)
- [Why Multi-Pass?](#why-multi-pass)
- [Per-Pass Overrides](#per-pass-overrides)
- [Keyword System Philosophy](#keyword-system-philosophy)
- [Global vs Local](#global-vs-local)
- [Performance Targets](#performance-targets)
- [Microbenchmarks](#microbenchmarks)
- [Real-World Expected](#real-world-expected)
- [Unsafe Code Justification](#unsafe-code-justification)
- [Where & Why](#where-why)
- [Safety Measures](#safety-measures)
- [Extension & Customization Points](#extension-customization-points)
- [1. Custom Property Types](#1-custom-property-types)
- [2. Custom Batching Logic](#2-custom-batching-logic)
- [3. Material Inheritance](#3-material-inheritance)
- [Comparison to Production Engines](#comparison-to-production-engines)
- [Unity URP (Scriptable Render Pipeline)](#unity-urp-scriptable-render-pipeline)
- [Unreal Engine 5](#unreal-engine-5)
- [Godot 4](#godot-4)
- [Future Optimizations](#future-optimizations)
- [1. GPU-Driven Rendering](#1-gpu-driven-rendering)
- [2. Parallel Compilation](#2-parallel-compilation)
- [3. Material LOD](#3-material-lod)
- [4. Texture Streaming](#4-texture-streaming)
- [Conclusion](#conclusion)
<!--toc:end-->
## Ghost Shader Concept - Technical Deep Dive
### Overview