Add high-performance material/shader system (Ghost.Shader.Concept)

Introduces a new Ghost.Shader.Concept project implementing a modern, data-oriented material and shader system with:
- Global/local keyword bitsets (fast O(1) ops, 64 bytes)
- Multi-pass shader program and per-pass render state overrides
- Thread-safe, 16-byte aligned material property blocks
- Material pooling to reduce GC pressure
- Batch renderer for efficient PSO grouping and async variant warmup
- Full demo (Program.cs) and extensive documentation (ARCHITECTURE.md, README.md, PROJECT_SUMMARY.md)
- Minor integration: new enums, doc updates, and keyword handling in existing code

No breaking changes to the existing engine; all new code is isolated. This serves as a reference implementation for high-performance, extensible material/shader architectures.
This commit is contained in:
2025-12-26 19:19:30 +09:00
parent a89719bfc9
commit f988c34b3d
48 changed files with 3067 additions and 201 deletions

View File

@@ -0,0 +1,11 @@
namespace Ghost.Core.Contracts;
public interface ICloneable
{
object Clone();
}
public interface ICloneable<T>
{
T Clone();
}

View File

@@ -1,6 +1,6 @@
namespace Ghost.Core.Graphics;
public enum ZTest
public enum ZTest : byte
{
Disabled,
Less,
@@ -12,20 +12,20 @@ public enum ZTest
Always
}
public enum ZWrite
public enum ZWrite : byte
{
Off,
On
}
public enum Cull
public enum Cull : byte
{
Off,
Front,
Back
}
public enum Blend
public enum Blend : byte
{
Opaque,
Alpha,
@@ -35,7 +35,7 @@ public enum Blend
}
[Flags]
public enum ColorWriteMask
public enum ColorWriteMask : byte
{
None = 0,
Red = 1 << 0,

View File

@@ -1,9 +1,9 @@
namespace Ghost.Core.Graphics;
public enum KeywordType
public enum KeywordSpace
{
Static,
Dynamic,
Local,
Global,
}
public enum ShaderPropertyType
@@ -29,7 +29,7 @@ public struct ShaderEntryPoint
public struct KeywordsGroup
{
public KeywordType type;
public KeywordSpace space;
public List<string>? keywords;
}

View File

@@ -15,18 +15,18 @@ public readonly struct TypeHandle
}
/// <summary>
/// Gets the type handle for the specified type.
/// Gets the space handle for the specified space.
/// </summary>
/// <param name="type">The type to get the handle for.</param>
/// <returns>The type handle as a nint.</returns>
/// <param name="type">The space to get the handle for.</param>
/// <returns>The space handle as a nint.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TypeHandle Get(Type type) => new TypeHandle(type.TypeHandle.Value);
/// <summary>
/// Gets the type handle for the specified type.
/// Gets the space handle for the specified space.
/// </summary>
/// <typeparam name="T">The type to get the handle for.</typeparam>
/// <returns>The type handle as a nint.</returns>
/// <typeparam name="T">The space to get the handle for.</typeparam>
/// <returns>The space handle as a nint.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static TypeHandle Get<T>() => Get(typeof(T));