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.
84 lines
1.1 KiB
C#
84 lines
1.1 KiB
C#
namespace Ghost.Core.Graphics;
|
|
|
|
public enum ZTest : byte
|
|
{
|
|
Disabled,
|
|
Less,
|
|
LessEqual,
|
|
Equal,
|
|
GreaterEqual,
|
|
Greater,
|
|
NotEqual,
|
|
Always
|
|
}
|
|
|
|
public enum ZWrite : byte
|
|
{
|
|
Off,
|
|
On
|
|
}
|
|
|
|
public enum Cull : byte
|
|
{
|
|
Off,
|
|
Front,
|
|
Back
|
|
}
|
|
|
|
public enum Blend : byte
|
|
{
|
|
Opaque,
|
|
Alpha,
|
|
Additive,
|
|
Multiply,
|
|
PremultipliedAlpha
|
|
}
|
|
|
|
[Flags]
|
|
public enum ColorWriteMask : byte
|
|
{
|
|
None = 0,
|
|
Red = 1 << 0,
|
|
Green = 1 << 1,
|
|
Blue = 1 << 2,
|
|
Alpha = 1 << 3,
|
|
All = Red | Green | Blue | Alpha
|
|
}
|
|
|
|
public struct PipelineState
|
|
{
|
|
public ZTest ZTest
|
|
{
|
|
get; set;
|
|
}
|
|
|
|
public ZWrite ZWrite
|
|
{
|
|
get; set;
|
|
}
|
|
|
|
public Cull Cull
|
|
{
|
|
get; set;
|
|
}
|
|
|
|
public Blend Blend
|
|
{
|
|
get; set;
|
|
}
|
|
|
|
public ColorWriteMask ColorMask
|
|
{
|
|
get; set;
|
|
}
|
|
|
|
|
|
public static PipelineState Default => new PipelineState
|
|
{
|
|
ZTest = ZTest.LessEqual,
|
|
ZWrite = ZWrite.On,
|
|
Cull = Cull.Back,
|
|
Blend = Blend.Opaque,
|
|
ColorMask = ColorWriteMask.All
|
|
};
|
|
} |