Add new interfaces and refactor rendering logic

Added a new `ConstPtr<T>` struct for type-safe pointers.
Added a new `ICommandBuffer` interface for resource copying.
Added a new `IRenderPass` interface to define render passes.
Added a new `IResource` interface for GPU resources.
Added a new `IResourceAllocator` interface for resource management.
Added a new `ISwapChainPanelNative` struct for native interactions.
Added a new `D3D12Utility` class for Direct3D 12 utilities.
Added a new package reference for `Vortice.Win32.Graphics.D3D12MemoryAllocator`.

Changed project file to allow unsafe code blocks.
Changed `Result` struct methods to improve clarity.
Changed error handling in `ProjectService` and `AssetDatabase` to use `Result.Failure()`.
Changed `launchSettings.json` to enable native debugging.
Changed rendering logic in `ScenePage.xaml.cs` to use `IRenderer`.
Changed `IGraphicsDevice` interface to include renderer properties.
Changed `IRenderView` to `IRenderer` and updated its methods.
Changed `Mesh` class to use the new `IResource` interface for buffers.
Changed `GraphicsAPI` enum to include a `None` value.
Changed various aspects of the `GraphicsPipeline` class for new architecture.

Removed the old `DX12RenderView` class and replaced it with `DX12Renderer`.
Removed unnecessary code in the `ResourceView` class.
This commit is contained in:
2025-06-30 13:50:06 +09:00
parent 8fd1222780
commit 300ae7251b
27 changed files with 765 additions and 486 deletions

View File

@@ -0,0 +1,38 @@
namespace Ghost.Graphics.Contracts;
/// <summary>
/// Defines the contract for a render view in the graphics pipeline.
/// </summary>
internal interface IRenderer : IDisposable
{
public ReadOnlySpan<IRenderPass> RenderPasses
{
get;
}
/// <summary>
/// Requests a resize of the render view.
/// </summary>
/// <param name="width">The new width of the render view.</param>
/// <param name="height">The new height of the render view.</param>
/// <remarks>This only submits a resize request without executing it. May overwrite last request if next request issued before next frame.</remarks>
public void RequestResize(uint width, uint height);
/// <summary>
/// Executes any pending resize operations for the current context.
/// </summary>
public void ExecutePendingResize();
/// <summary>
/// Renders the current content to the output target.
/// </summary>
public void Render();
/// <summary>
/// Waits for the next frame to be ready for rendering.
/// </summary>
public void WaitNextFrame();
/// <summary>
/// Waits for the render view to become idle, ensuring all previous commands have been executed and resources are ready for the next frame.
/// </summary>
public void WaitIdle();
}