using Ryujinx.Graphics.GAL; namespace Ryujinx.Graphics.Gpu.Image { /// /// Represents texture format information. /// readonly struct FormatInfo { /// /// An invalid texture format. /// public static FormatInfo Invalid { get; } = new(0, 0, 0, 0, 0); /// /// A default, generic RGBA8 texture format. /// public static FormatInfo Default { get; } = new(Format.R8G8B8A8Unorm, 1, 1, 4, 4); /// /// The format of the texture data. /// public Format Format { get; } /// /// The block width for compressed formats. /// /// /// Must be 1 for non-compressed formats. /// public byte BlockWidth { get; } /// /// The block height for compressed formats. /// /// /// Must be 1 for non-compressed formats. /// public byte BlockHeight { get; } /// /// The number of bytes occupied by a single pixel in memory of the texture data. /// public byte BytesPerPixel { get; } /// /// The maximum number of components this format has defined (in RGBA order). /// public byte Components { get; } /// /// Whenever or not the texture format is a compressed format. Determined from block size. /// public bool IsCompressed => (BlockWidth | BlockHeight) != 1; /// /// Constructs the texture format info structure. /// /// The format of the texture data /// The block width for compressed formats. Must be 1 for non-compressed formats /// The block height for compressed formats. Must be 1 for non-compressed formats /// The number of bytes occupied by a single pixel in memory of the texture data public FormatInfo( Format format, byte blockWidth, byte blockHeight, byte bytesPerPixel, byte components) { Format = format; BlockWidth = blockWidth; BlockHeight = blockHeight; BytesPerPixel = bytesPerPixel; Components = components; } } }