using Ghost.Core;
using Ghost.Graphics.Contracts;
namespace Ghost.Graphics.RHI;
public interface IGraphicsEngine : IDisposable
{
IRenderDevice Device
{
get;
}
IShaderCompiler ShaderCompiler
{
get;
}
IPipelineLibrary PipelineLibrary
{
get;
}
IResourceDatabase ResourceDatabase
{
get;
}
IResourceAllocator ResourceAllocator
{
get;
}
///
/// Creates a new instance of an object that implements the IRenderer interface.
///
/// An object that provides rendering functionality through the IRenderer interface.
IRenderer CreateRenderer();
///
/// Removes the specified renderer from the collection of active renderers.
///
/// The renderer instance to remove. Cannot be null.
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);
///
/// Renders the current frame.
///
/// Command allocator to use for rendering
/// Result of the rendering operation
Result RenderFrame(ICommandAllocator commandAllocator);
}