forked from Misaki/GhostEngine
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:
@@ -58,7 +58,7 @@ public readonly struct ShaderPassKey : IEquatable<ShaderPassKey>
|
||||
|
||||
public readonly struct GraphicsPipelineKey
|
||||
{
|
||||
public const int KEY_STRING_LENGTH = 17; // 16 chars + null terminator
|
||||
public const int KEY_STRING_LENGTH = 33; // 32 chars + null terminator
|
||||
|
||||
public readonly UInt128 value;
|
||||
|
||||
@@ -98,12 +98,13 @@ public readonly struct GraphicsPipelineKey
|
||||
|
||||
public Result GetString(Span<char> destination)
|
||||
{
|
||||
if (!value.TryFormat(destination, out _, "X16"))
|
||||
if (!value.TryFormat(destination, out var num, "X16"))
|
||||
{
|
||||
return Result.Failure("Failed to format GraphicsPipelineKey to string.");
|
||||
}
|
||||
|
||||
destination[16] = '\0';
|
||||
// Just in case.
|
||||
destination[num] = '\0';
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
@@ -733,7 +734,7 @@ public struct BufferDesc
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Memory type for the buffer
|
||||
/// Memory space for the buffer
|
||||
/// </summary>
|
||||
public ResourceMemoryType MemoryType
|
||||
{
|
||||
@@ -814,7 +815,7 @@ public struct SwapChainDesc
|
||||
public struct SwapChainTarget
|
||||
{
|
||||
/// <summary>
|
||||
/// Target type
|
||||
/// Target space
|
||||
/// </summary>
|
||||
public SwapChainTargetType Type
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user