Added IShaderCompiler

This commit is contained in:
2025-11-16 19:50:24 +09:00
parent d91d6f6e57
commit 5c4e1a3350
15 changed files with 595 additions and 372 deletions

View File

@@ -1,35 +0,0 @@
namespace Ghost.Core.Graphics;
/// <summary>
/// The layout of the root signature is:
/// <list type="bullet">
/// <item>
/// Global buffer (b0)
/// </item>
/// <item>
/// Per-view buffer (b1)
/// </item>
/// <item>
/// Per-object buffer (b2)
/// </item>
/// <item>
/// Per-material buffer (b3)
/// </item>
/// <item>
/// Descriptor table for bindless textures (t0)
/// </item>
/// <item>
/// Descriptor table for bindless samplers (s0)
/// </item>
/// </list>
/// </summary>
public static class RootSignatureLayout
{
public const int GLOBAL_BUFFER_SLOT = 0;
public const int PER_VIEW_BUFFER_SLOT = 1;
public const int PER_OBJECT_BUFFER_SLOT = 2;
public const int PER_MATERIAL_BUFFER_SLOT = 3;
public const int TEXTURE_HEAP_SLOT = 0;
public const int SAMPLER_HEAP_SLOT = 0;
}

View File

@@ -22,6 +22,11 @@ public readonly struct Result
return new Result(false, message);
}
public static Result<T> Success<T>(T value)
{
return Result<T>.Success(value);
}
public override string ToString() => success ? "OK" : $"Error: {message}";
public static implicit operator bool(Result result) => result.success;
@@ -34,16 +39,16 @@ public readonly struct Result<T>
public readonly string? message;
public Result(bool success, T data, string? message = null)
public Result(bool success, T value, string? message = null)
{
this.success = success;
this.value = data;
this.value = value;
this.message = message;
}
public static Result<T> Success(T data)
public static Result<T> Success(T value)
{
return new Result<T>(true, data);
return new Result<T>(true, value);
}
public static Result<T> Fail(string? message)
@@ -95,4 +100,4 @@ public static class ResultExtensions
return result.value;
}
}
}

View File

@@ -1,3 +1,4 @@
using Misaki.HighPerformance.LowLevel;
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.CompilerServices;
@@ -97,4 +98,18 @@ internal static unsafe partial class Win32Utility
{
return (flags & Unsafe.As<T, uint>(ref flag)) != 0;
}
extension(MemoryLeakException)
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[Conditional("DEBUG")]
[Conditional("GHOST_EDITOR")]
public static void ThrowIfRefCountNonZero(uint count)
{
if (count != 0)
{
throw new MemoryLeakException($"Reference count is not zero: {count}");
}
}
}
}