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,11 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<Window
x:Class="Ghost.UnitTest.Windows.DebugOutputWindow"
x:Class="Ghost.Graphics.Test.Windows.DebugOutputWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Ghost.UnitTest.Controls"
xmlns:controls="using:Ghost.Graphics.Test.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Ghost.UnitTest.Windows"
xmlns:local="using:Ghost.Graphics.Test.Windows"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="DebugOutputWindow"
mc:Ignorable="d">

View File

@@ -1,6 +1,6 @@
using Microsoft.UI.Xaml;
namespace Ghost.UnitTest.Windows;
namespace Ghost.Graphics.Test.Windows;
internal sealed partial class DebugOutputWindow : Window
{

View File

@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<Window
x:Class="Ghost.UnitTest.Windows.GraphicsTestWindow"
x:Class="Ghost.Graphics.Test.Windows.GraphicsTestWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="using:Ghost.UnitTest.Controls"
xmlns:controls="using:Ghost.Graphics.Test.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Ghost.UnitTest.Windows"
xmlns:local="using:Ghost.Graphics.Test.Windows"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="GraphicsTestWindow"
mc:Ignorable="d">

View File

@@ -4,11 +4,11 @@ using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Media;
using Misaki.HighPerformance.LowLevel.Buffer;
namespace Ghost.UnitTest.Windows;
namespace Ghost.Graphics.Test.Windows;
public sealed partial class GraphicsTestWindow : Window
{
private RenderSystem? _renderSystem;
private IRenderSystem? _renderSystem;
private IRenderer? _renderer;
private ISwapChain? _swapChain;
@@ -28,21 +28,27 @@ public sealed partial class GraphicsTestWindow : Window
AllocationManager.EnableDebugLayer();
#endif
_renderSystem = new(GraphicsAPI.Direct3D12);
_renderer = _renderSystem.CreateRenderer();
_renderSystem = new RenderSystem(new()
{
FrameBufferCount = 2,
GraphicsAPI = GraphicsAPI.Direct3D12
});
_renderer = _renderSystem.GraphicsEngine.CreateRenderer();
_swapChain = _renderSystem.GraphicsEngine.CreateSwapChain(new SwapChainDesc((uint)AppWindow.Size.Width, (uint)AppWindow.Size.Height, SwapChainTarget.FromCompositionSurface(Panel)));
_renderer.SetSwapChain(_swapChain);
_renderSystem.Start();
CompositionTarget.Rendering += OnRendering;
}
private void SwapChainPanel_Unloaded(object sender, RoutedEventArgs e)
{
CompositionTarget.Rendering -= OnRendering;
_renderSystem?.Stop();
_swapChain?.Dispose();
_renderer?.Dispose();
_swapChain?.Dispose();
_renderSystem?.Dispose();
}
@@ -50,18 +56,23 @@ public sealed partial class GraphicsTestWindow : Window
{
if (e.NewSize.Width > 8.0 && e.NewSize.Height > 8.0)
{
_renderer?.RequestResize((uint)e.NewSize.Width, (uint)e.NewSize.Height);
_renderer?.RequestResize(new((uint)e.NewSize.Width, (uint)e.NewSize.Height));
}
}
private void OnRendering(object? sender, object e)
{
//if (GraphicsPipeline.CPUFenceValue < GraphicsPipeline.GPUFenceValue + GraphicsPipeline._FRAME_COUNT)
//{
// DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.High, () =>
// {
// GraphicsPipeline.SignalCPUReady();
// });
//}
if (_renderSystem == null)
{
return;
}
if (_renderSystem.CPUFenceValue < _renderSystem.GPUFenceValue + _renderSystem.Config.FrameBufferCount)
{
DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.High, () =>
{
_renderSystem.SignalCPUReady();
});
}
}
}