using Ghost.Graphics.Data; namespace Ghost.Graphics.RHI; public interface IResourceAllocator { /// /// Creates a render target for off-screen rendering /// /// Render target description /// A new render target instance public IRenderTarget CreateRenderTarget(ref readonly RenderTargetDesc desc, bool tempResource = false); /// /// Creates a texture resource /// /// Texture description /// A new texture handle point to the resource public TextureHandle CreateTextureHandle(ref readonly TextureDesc desc, bool tempResource = false); /// /// Creates a texture resource /// /// Texture description /// A new texture instance public ITexture CreateTexture(ref readonly TextureDesc desc, bool tempResource = false); /// /// Creates a buffer resource /// /// Buffer description /// A new buffer handle point to the resource public BufferHandle CreateBufferHandle(ref readonly BufferDesc desc, bool tempResource = false); /// /// Creates a buffer resource /// /// Buffer description /// A new buffer instance public IBuffer CreateBuffer(ref readonly BufferDesc desc, bool tempResource = false); /// /// Release a resource given its handle /// /// Resource handle public void ReleaseResource(ResourceHandle handle); } internal interface IResourceAllocator : IResourceAllocator where T : unmanaged { /// /// Get the raw gpu resource pointer from a resource handle /// /// The type of the resource. /// Resource handle /// Pointer to the resource public unsafe T* GetResource(ResourceHandle handle); }