forked from Misaki/GhostEngine
Added IShaderCompiler
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user