using Dashboard.Pal; namespace Dashboard.Drawing { public interface IShader : IDisposable { } /// /// Base interface for creating shader pipelines. /// public interface IShaderCreateInfo { } public enum BufferAccessPattern { /// /// No hint given. Not recommended. /// DontCare, /// /// For buffers which have a long lifetime, but the contents are initialized once. /// Static, /// /// For buffers which have a long lifetime, but the contents can be updated every frame. /// Stream, /// /// For buffers which have a short lifetime, used for streaming resources to the graphics hardware. /// Upload, /// /// For buffers which have a short lifetime, used for streaming resources from the graphics hardware. /// Download, } public interface IBuffer : IDisposable { public BufferAccessPattern AccessPattern { get; } public long Size { get; } void Reallocate(long newSize); Span Map(long offset, int count = -1) where T : unmanaged; void Unmap(); void Read(long offset, Span span) where T : unmanaged; void Write(long offset, ReadOnlySpan span) where T : unmanaged; } /// /// This extension provides direct access to the backend rendering pipeline without writing with a higher level /// abstraction than the rendering backend. /// public interface IDirectRendering : IDeviceContextExtension { public IShader CreatePipeline(T createInfo) where T : IShaderCreateInfo; public IBuffer CreateBuffer(BufferAccessPattern pattern, long size); void Draw(DrawCall drawCall); } }