using Ryujinx.Graphics.GAL;
namespace Ryujinx.Graphics.Gpu.Image
{
///
/// Represents texture format information.
///
struct FormatInfo
{
///
/// A default, generic RGBA8 texture format.
///
public static FormatInfo Default { get; } = new FormatInfo(Format.R8G8B8A8Unorm, 1, 1, 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 int BlockWidth { get; }
///
/// The block height for compressed formats. Must be 1 for non-compressed formats.
///
public int BlockHeight { get; }
///
/// The number of bytes occupied by a single pixel in memory of the texture data.
///
public int BytesPerPixel { 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,
int blockWidth,
int blockHeight,
int bytesPerPixel)
{
Format = format;
BlockWidth = blockWidth;
BlockHeight = blockHeight;
BytesPerPixel = bytesPerPixel;
}
}
}