Refactor namespaces and improve resource handling
- Updated namespaces from `Ghost.UnitTest` to `Ghost.Graphics.Test` across multiple files. - Refactored `GraphicsTestWindow` to use a new `RenderSystem` configuration. - Removed deprecated `Logger` and `SerializationTest` classes. - Improved memory management in D3D12 components, including resource allocation and cleanup. - Added `[SupportedOSPlatform]` attributes to specify Windows version compatibility. - Updated `.editorconfig` settings and project references for consistency. - Enabled `nativeDebugging` in `launchSettings.json`.
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Misaki.HighPerformance" Version="1.0.0" />
|
||||
<PackageReference Include="Misaki.HighPerformance.Jobs" Version="1.1.0" />
|
||||
<PackageReference Include="Misaki.HighPerformance.LowLevel" Version="1.0.0" />
|
||||
<PackageReference Include="Misaki.HighPerformance.LowLevel" Version="1.1.2" />
|
||||
<PackageReference Include="Misaki.HighPerformance.Mathematics" Version="1.2.6" />
|
||||
<PackageReference Include="System.IO.Hashing" Version="9.0.10" />
|
||||
<PackageReference Include="TerraFX.Interop.Windows" Version="10.0.26100.2" />
|
||||
|
||||
@@ -31,6 +31,11 @@ public readonly struct Handle<T>
|
||||
return obj is Handle<T> id && Equals(id);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Handle<{typeof(T).Name}>({id}, {generation})";
|
||||
}
|
||||
|
||||
public readonly bool Equals(Handle<T> other)
|
||||
{
|
||||
return id == other.id;
|
||||
@@ -77,6 +82,11 @@ public readonly struct Identifier<T>
|
||||
return obj is Identifier<T> id && Equals(id);
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"Identifier<{typeof(T).Name}>({value})";
|
||||
}
|
||||
|
||||
public readonly bool Equals(Identifier<T> other)
|
||||
{
|
||||
return value == other.value;
|
||||
|
||||
@@ -57,6 +57,25 @@ public readonly struct Result<T>
|
||||
public static implicit operator Result<T>(Result result) => result.success ? Success(default!) : Fail(result.message);
|
||||
}
|
||||
|
||||
public readonly struct Result<T, S>
|
||||
{
|
||||
public readonly T value;
|
||||
public readonly S status;
|
||||
|
||||
public Result(T value, S status)
|
||||
{
|
||||
this.value = value;
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public static Result<T, S> Create(T value, S status)
|
||||
{
|
||||
return new Result<T, S>(value, status);
|
||||
}
|
||||
|
||||
public override string ToString() => $"Value: {value}, Status: {status}";
|
||||
}
|
||||
|
||||
public static class ResultExtensions
|
||||
{
|
||||
public static void ThrowIfFailed(this Result result)
|
||||
|
||||
@@ -6,9 +6,13 @@ using TerraFX.Interop.Windows;
|
||||
|
||||
namespace Ghost.Core.Utilities;
|
||||
|
||||
#if PLATEFORME_WIN64
|
||||
[SupportedOSPlatform("windows10.0.19041.0")]
|
||||
internal static unsafe class Win32Utility
|
||||
internal static partial class Win32Utility
|
||||
{
|
||||
public const string OS_SUPPORTED_VERSION = "windows10.0.19041.0";
|
||||
}
|
||||
|
||||
[SupportedOSPlatform(OS_SUPPORTED_VERSION)]
|
||||
internal static unsafe partial class Win32Utility
|
||||
{
|
||||
[EditorBrowsable(EditorBrowsableState.Never)]
|
||||
public readonly ref struct IID_PPV
|
||||
@@ -70,14 +74,21 @@ internal static unsafe class Win32Utility
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void** PPV<T>(this ComPtr<T> comPtr)
|
||||
public static Guid* IID<T>(this T ptr)
|
||||
where T : unmanaged, IUnknown.Interface
|
||||
{
|
||||
return Windows.__uuidof<T>();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void** PPV<T>(ref this ComPtr<T> comPtr)
|
||||
where T : unmanaged, IUnknown.Interface
|
||||
{
|
||||
return (void**)comPtr.GetAddressOf();
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void** ReleaseAndGetVoidAddressOf<T>(this ComPtr<T> comPtr)
|
||||
public static void** ReleaseAndGetVoidAddressOf<T>(ref this ComPtr<T> comPtr)
|
||||
where T : unmanaged, IUnknown.Interface
|
||||
{
|
||||
return (void**)comPtr.ReleaseAndGetAddressOf();
|
||||
@@ -98,5 +109,4 @@ internal static unsafe class Win32Utility
|
||||
{
|
||||
return (flags & Unsafe.As<T, uint>(ref flag)) != 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user