refactor IRenderer

This commit is contained in:
2025-12-22 15:59:02 +09:00
parent 2881fda112
commit d23e701f0a
11 changed files with 112 additions and 255 deletions

View File

@@ -3,6 +3,8 @@ using Ghost.Graphics.Core;
namespace Ghost.Graphics.RHI;
// TODO: Add ICommandAllocator support for thread local command buffers. We often use one allocator for multiple command buffers in a single frame.
/// <summary>
/// D3D12-style command buffer interface for recording rendering commands
/// </summary>

View File

@@ -51,5 +51,5 @@ public interface IGraphicsEngine : IDisposable
/// <summary>
/// Renders the current frame.
/// </summary>
void RenderFrame();
void RenderFrame(ICommandBuffer commandBuffer);
}

View File

@@ -1,5 +1,4 @@
using Ghost.Core;
using Misaki.HighPerformance.Mathematics;
using Ghost.Graphics.Core;
namespace Ghost.Graphics.RHI;
@@ -9,7 +8,7 @@ namespace Ghost.Graphics.RHI;
/// </summary>
public interface IRenderer : IDisposable
{
public uint2 Size
Handle<Texture> RenderTarget
{
get;
}
@@ -20,30 +19,10 @@ public interface IRenderer : IDisposable
/// <param name="renderTarget">Render Target to render into</param>
public void SetRenderTarget(Handle<Texture> renderTarget);
/// <summary>
/// Sets the swap chain for this renderer
/// </summary>
/// <param name="swapChain">Swap chain for presentation</param>
public void SetSwapChain(ISwapChain? swapChain);
/// <summary>
/// Executes any pending resize operations
/// </summary>
public void ExecutePendingResize();
/// <summary>
/// Renders a frame
/// </summary>
public void Render();
/// <summary>
/// Requests a resize operation
/// </summary>
/// <param name="newSize">New size</param>
public void RequestResize(uint2 newSize);
/// <summary>
/// Waits for the GPU to complete all work
/// </summary>
public void WaitIdle();
/// <param name="commandBuffer">Command buffer to record rendering commands into</param>
/// <returns>Result of the rendering operation</returns>
public Result Render(ICommandBuffer commandBuffer);
}