using Ghost.Core;
namespace Ghost.Graphics.RHI;
public readonly struct GraphicsEngineDesc
{
public uint FrameBufferCount
{
get; init;
}
}
public interface IGraphicsEngine : IDisposable
{
IRenderDevice Device
{
get;
}
IShaderCompiler ShaderCompiler
{
get;
}
IPipelineLibrary PipelineLibrary
{
get;
}
IResourceDatabase ResourceDatabase
{
get;
}
IResourceAllocator ResourceAllocator
{
get;
}
///
/// Creates a new instance of a renderer for drawing graphical content.
///
/// An object that implements the IRenderer interface, which can be used to render graphics.
IRenderer CreateRenderer();
///
/// Removes the specified renderer from the collection of active renderers.
///
/// The renderer instance to remove.
void RemoveRenderer(IRenderer renderer);
///
/// Removes all registered renderers from the collection.
///
/// Call this method to reset the renderer collection to an empty state. After calling this
/// method, no renderers will be available until new ones are added.
void ClearRenderers();
///
/// Creates a new command allocator for the specified command buffer space.
///
/// The space of command buffer for which to create the allocator. The default is CommandBufferType.Graphics.
/// An instance configured for the specified command buffer space.
ICommandAllocator CreateCommandAllocator(CommandBufferType type = CommandBufferType.Graphics);
///
/// Creates a command buffer for recording rendering commands
///
/// Type of command buffer to create
/// A new command buffer instance
ICommandBuffer CreateCommandBuffer(CommandBufferType type = CommandBufferType.Graphics);
///
/// Creates a swap chain for presentation
///
/// Swap chain description
/// A new swap chain instance
ISwapChain CreateSwapChain(SwapChainDesc desc);
///
/// Begin the current frame.
///
/// CPU fence value for synchronization
/// GPU fence value for synchronization
/// Result of the begin frame operation
Result BeginFrame(uint cpuFenceValue, uint gpuFenceValue);
///
/// End the current frame.
///
/// CPU fence value for synchronization
/// GPU fence value for synchronization
/// Result of the end frame operation
Result EndFrame(uint cpuFenceValue, uint gpuFenceValue);
}