namespace Ghost.Graphics.RHI; /// /// Pipeline state object interface /// public interface IPipelineState : IDisposable { /// /// Pipeline type (graphics or compute) /// PipelineType Type { get; } /// /// Pipeline name for debugging /// string Name { get; set; } } /// /// Root signature interface /// public interface IRootSignature : IDisposable { /// /// Root signature name for debugging /// string Name { get; set; } } /// /// Pipeline types /// public enum PipelineType { Graphics, Compute } /// /// Render target description /// Supports either color OR depth rendering, not both /// public struct RenderTargetDesc { /// /// Width of the render target /// public uint Width; /// /// Height of the render target /// public uint Height; /// /// Type of render target (color or depth) /// public RenderTargetType Type; /// /// Target texture format /// public TextureFormat Format; /// /// Number of samples for MSAA /// public uint SampleCount; /// /// Creates a color render target /// public static RenderTargetDesc Color(uint width, uint height, TextureFormat format, uint sampleCount = 1) { return new RenderTargetDesc { Width = width, Height = height, Type = RenderTargetType.Color, Format = format, SampleCount = sampleCount }; } /// /// Creates a depth render target /// public static RenderTargetDesc Depth(uint width, uint height, TextureFormat format = TextureFormat.D24_UNorm_S8_UInt, uint sampleCount = 1) { return new RenderTargetDesc { Width = width, Height = height, Type = RenderTargetType.Depth, Format = format, SampleCount = sampleCount }; } } /// /// Texture description /// public struct TextureDesc { /// /// Width of the texture /// public uint Width; /// /// Height of the texture /// public uint Height; /// /// Texture format /// public TextureFormat Format; /// /// Number of mip levels /// public uint MipLevels; /// /// Texture usage flags /// public TextureUsage Usage; public TextureDesc(uint width, uint height, TextureFormat format, uint mipLevels = 1, TextureUsage usage = TextureUsage.ShaderResource) { Width = width; Height = height; Format = format; MipLevels = mipLevels; Usage = usage; } } /// /// Buffer description /// public struct BufferDesc { /// /// Size of the buffer in bytes /// public ulong Size; /// /// Buffer usage flags /// public BufferUsage Usage; /// /// Memory type for the buffer /// public MemoryType MemoryType; public BufferDesc(ulong size, BufferUsage usage, MemoryType memoryType = MemoryType.Default) { Size = size; Usage = usage; MemoryType = memoryType; } } /// /// Texture usage flags /// [Flags] public enum TextureUsage { None = 0, ShaderResource = 1 << 0, RenderTarget = 1 << 1, DepthStencil = 1 << 2, UnorderedAccess = 1 << 3 } /// /// Memory types for resources /// public enum MemoryType { Default, // GPU memory Upload, // CPU-to-GPU memory Readback // GPU-to-CPU memory }