forked from Misaki/GhostEngine
Major refactor of graphics infrastructure: - Introduce ICommandAllocator and D3D12CommandAllocator for explicit command buffer management. - Change ICommandBuffer.Begin to require an allocator. - Add IRenderTargetStrategy abstraction with swap chain and texture implementations. - Update IRenderer to use RenderTargetStrategy instead of direct handle. - Add DPI scaling support to swap chains (ScaleX/ScaleY, SetScale). - RenderSystem now supports thread-safe swap chain resize requests. - Remove persistent copy command buffer; use per-frame allocators. - Make Logger public/static and clean up API visibility. - Update .editorconfig and debug layer enablement. These changes improve modularity, DPI-awareness, and future extensibility.
55 lines
966 B
C#
55 lines
966 B
C#
using Ghost.Graphics.Contracts;
|
|
|
|
namespace Ghost.Graphics.Core;
|
|
|
|
internal readonly struct SwapChainPresenter
|
|
{
|
|
public enum TargetType
|
|
{
|
|
Composition,
|
|
Hwnd
|
|
}
|
|
|
|
public readonly TargetType Type
|
|
{
|
|
get;
|
|
}
|
|
|
|
public readonly ISwapChainPanelNative SwapChainPanelNative
|
|
{
|
|
get;
|
|
}
|
|
|
|
public readonly nint Hwnd
|
|
{
|
|
get;
|
|
}
|
|
|
|
public readonly uint Width
|
|
{
|
|
get;
|
|
}
|
|
|
|
public readonly uint Height
|
|
{
|
|
get;
|
|
}
|
|
|
|
public SwapChainPresenter(ISwapChainPanelNative swapChainPanelNative, uint width, uint height)
|
|
{
|
|
Type = TargetType.Composition;
|
|
SwapChainPanelNative = swapChainPanelNative;
|
|
Hwnd = nint.Zero;
|
|
Width = width;
|
|
Height = height;
|
|
}
|
|
|
|
public SwapChainPresenter(nint hwnd, uint width, uint height)
|
|
{
|
|
Type = TargetType.Hwnd;
|
|
Hwnd = hwnd;
|
|
Width = width;
|
|
Height = height;
|
|
}
|
|
}
|