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:
2025-11-11 21:30:47 +09:00
parent fb003da26a
commit 6f786a0698
35 changed files with 334 additions and 401 deletions

View File

@@ -1,5 +1,5 @@
using Ghost.Core;
using Ghost.Engine.Models;
using Ghost.Engine.Services;
namespace Ghost.Engine;
@@ -9,20 +9,20 @@ internal class EngineCore
{
ActivationHandler.Handle(args);
GraphicsPipeline.Initialize();
GraphicsPipeline.Start();
//GraphicsPipeline.Initialize();
//GraphicsPipeline.Start();
Logger.LogInfo("Engine started successfully.");
}
public void IncrementCPUFenceValue()
{
GraphicsPipeline.SignalCPUReady();
//GraphicsPipeline.SignalCPUReady();
}
public void ShutDown()
{
GraphicsPipeline.SignalCPUReady();
GraphicsPipeline.Shutdown();
//GraphicsPipeline.SignalCPUReady();
//GraphicsPipeline.Shutdown();
}
}

View File

@@ -21,10 +21,4 @@
<!--<ProjectReference Include="..\Ghost.Generator\Ghost.Generator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />-->
</ItemGroup>
<ItemGroup>
<Reference Include="Misaki.HighPerformance.Unsafe">
<HintPath>..\..\Class\Misaki.HighPerformance\Misaki.HighPerformance.LowLevel\bin\Release\net9.0\Misaki.HighPerformance.LowLevel.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@@ -1,106 +0,0 @@
using Ghost.Engine.Models;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
namespace Ghost.Engine.Services;
internal enum LogChangeType
{
LogAdded,
LogRemoved,
LogsCleared
}
internal readonly struct LogChangeContext(LogChangeType type, int index)
{
public readonly LogChangeType changeType = type;
public readonly int index = index;
}
public static class Logger
{
private const int _MAX_LOGS = 4096;
private static readonly List<LogMessage> _logs = new();
internal static IReadOnlyList<LogMessage> Logs => _logs;
internal static event Action<LogChangeContext>? OnLogsUpdate;
internal static bool HasStackTrace
{
get; set;
}
private static StackTrace? CaptureStackTrace()
{
return HasStackTrace ? new StackTrace(1, true) : null;
}
private static void LogInternal(LogLevel level, object? message, StackTrace? stackTrace)
{
if (_logs.Count >= _MAX_LOGS)
{
_logs.RemoveAt(0);
OnLogsUpdate?.Invoke(new(LogChangeType.LogRemoved, 0));
}
var logMessage = new LogMessage(level, message?.ToString(), stackTrace?.ToString());
_logs.Add(logMessage);
OnLogsUpdate?.Invoke(new(LogChangeType.LogAdded, _logs.Count - 1));
}
private static void LogExceptionInternal(Exception ex)
{
if (_logs.Count >= _MAX_LOGS)
{
_logs.RemoveAt(0);
OnLogsUpdate?.Invoke(new(LogChangeType.LogRemoved, 0));
}
var logMessage = new LogMessage(LogLevel.Error, ex.Message, ex.StackTrace);
_logs.Add(logMessage);
OnLogsUpdate?.Invoke(new(LogChangeType.LogAdded, _logs.Count - 1));
}
public static void Log(LogLevel level, object? message)
{
LogInternal(level, message, CaptureStackTrace());
}
public static void LogInfo(object? message)
{
LogInternal(LogLevel.Info, message, CaptureStackTrace());
}
public static void LogWarning(object? message)
{
LogInternal(LogLevel.Warning, message, CaptureStackTrace());
}
public static void LogError(object? message)
{
LogInternal(LogLevel.Error, message, CaptureStackTrace());
}
public static void LogError(Exception ex)
{
LogExceptionInternal(ex);
}
public static void Assert([DoesNotReturnIf(false)] bool condition, object? message = null)
{
if (!condition)
{
LogInternal(LogLevel.Error, message ?? "Assertion failed", CaptureStackTrace());
}
}
internal static void Clear()
{
_logs.Clear();
OnLogsUpdate?.Invoke(new(LogChangeType.LogsCleared, -1));
}
}