Files
Dashboard/Dashboard.Common/Drawing/IDirectRendering.cs
T

68 lines
1.9 KiB
C#

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