Make FormatInfo struct more compact

This commit is contained in:
gdkchan 2024-09-15 15:53:10 -03:00
parent 4ccada3fb5
commit 6b9f530ba9
3 changed files with 11 additions and 11 deletions

View File

@ -28,7 +28,7 @@ namespace Ryujinx.Graphics.Gpu.Image
/// <remarks>
/// Must be 1 for non-compressed formats.
/// </remarks>
public int BlockWidth { get; }
public byte BlockWidth { get; }
/// <summary>
/// The block height for compressed formats.
@ -36,17 +36,17 @@ namespace Ryujinx.Graphics.Gpu.Image
/// <remarks>
/// Must be 1 for non-compressed formats.
/// </remarks>
public int BlockHeight { get; }
public byte BlockHeight { get; }
/// <summary>
/// The number of bytes occupied by a single pixel in memory of the texture data.
/// </summary>
public int BytesPerPixel { get; }
public byte BytesPerPixel { get; }
/// <summary>
/// The maximum number of components this format has defined (in RGBA order).
/// </summary>
public int Components { get; }
public byte Components { get; }
/// <summary>
/// Whenever or not the texture format is a compressed format. Determined from block size.
@ -62,10 +62,10 @@ namespace Ryujinx.Graphics.Gpu.Image
/// <param name="bytesPerPixel">The number of bytes occupied by a single pixel in memory of the texture data</param>
public FormatInfo(
Format format,
int blockWidth,
int blockHeight,
int bytesPerPixel,
int components)
byte blockWidth,
byte blockHeight,
byte bytesPerPixel,
byte components)
{
Format = format;
BlockWidth = blockWidth;

View File

@ -131,7 +131,7 @@ namespace Ryujinx.Graphics.Gpu
bool isLinear,
int gobBlocksInY,
Format format,
int bytesPerPixel,
byte bytesPerPixel,
ImageCrop crop,
Action<GpuContext, object> acquireCallback,
Action<object> releaseCallback,

View File

@ -412,9 +412,9 @@ namespace Ryujinx.HLE.HOS.Services.SurfaceFlinger
Format format = ConvertColorFormat(item.GraphicBuffer.Object.Buffer.Surfaces[0].ColorFormat);
int bytesPerPixel =
byte bytesPerPixel =
format == Format.B5G6R5Unorm ||
format == Format.R4G4B4A4Unorm ? 2 : 4;
format == Format.R4G4B4A4Unorm ? (byte)2 : (byte)4;
int gobBlocksInY = 1 << item.GraphicBuffer.Object.Buffer.Surfaces[0].BlockHeightLog2;