namespace Ghost.Graphics.RHI;
///
/// Base interface for all graphics resources
///
public interface IResource : IDisposable
{
///
/// Current resource state
///
ResourceState CurrentState { get; }
///
/// Resource name for debugging
///
string Name { get; set; }
///
/// Size of the resource in bytes
///
ulong Size { get; }
}
///
/// Texture resource interface
///
public interface ITexture : IResource
{
///
/// Width of the texture in pixels
///
uint Width { get; }
///
/// Height of the texture in pixels
///
uint Height { get; }
///
/// Texture format
///
TextureFormat Format { get; }
///
/// Number of mip levels
///
uint MipLevels { get; }
}
///
/// Buffer resource interface
///
public interface IBuffer : IResource
{
///
/// Buffer usage type
///
BufferUsage Usage { get; }
///
/// Maps the buffer for CPU access
///
/// Pointer to mapped memory
unsafe void* Map();
///
/// Unmaps the buffer from CPU access
///
void Unmap();
}
///
/// Render target interface for rendering operations
/// Supports either color OR depth rendering, not both
///
public interface IRenderTarget : ITexture
{
///
/// Type of render target (color or depth)
///
RenderTargetType Type { get; }
}
///
/// Type of render target
///
public enum RenderTargetType
{
Color,
Depth
}
///
/// Texture format enumeration
///
public enum TextureFormat
{
Unknown,
R8G8B8A8_UNorm,
B8G8R8A8_UNorm,
R16G16B16A16_Float,
R32G32B32A32_Float,
D24_UNorm_S8_UInt,
D32_Float
}
///
/// Buffer usage flags
///
[Flags]
public enum BufferUsage
{
None = 0,
Vertex = 1 << 0,
Index = 1 << 1,
Constant = 1 << 2,
Structured = 1 << 3,
Raw = 1 << 4,
Upload = 1 << 5,
Readback = 1 << 6
}