aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Gpu/Image/FormatInfo.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2024-09-17 15:52:30 -0300
committerGitHub <noreply@github.com>2024-09-17 15:52:30 -0300
commiteb8132b627d3c0285dd199f4e40c6f3800bdb22d (patch)
tree970a119909a0dd901bbd8cb5454b725a08e329b3 /src/Ryujinx.Graphics.Gpu/Image/FormatInfo.cs
parentccf96bf5e673456ec80f72725e4c9afa4e4c5a85 (diff)
Change image format view handling to allow view incompatible formats (#7311)
* Allow creating texture aliases on texture pool * Delete old image format override code * New format incompatible alias * Missing bounds check * GetForBinding now takes FormatInfo * Make FormatInfo struct more compact
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu/Image/FormatInfo.cs')
-rw-r--r--src/Ryujinx.Graphics.Gpu/Image/FormatInfo.cs21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Image/FormatInfo.cs b/src/Ryujinx.Graphics.Gpu/Image/FormatInfo.cs
index 8a9f37bb..b95c684e 100644
--- a/src/Ryujinx.Graphics.Gpu/Image/FormatInfo.cs
+++ b/src/Ryujinx.Graphics.Gpu/Image/FormatInfo.cs
@@ -8,6 +8,11 @@ namespace Ryujinx.Graphics.Gpu.Image
readonly struct FormatInfo
{
/// <summary>
+ /// An invalid texture format.
+ /// </summary>
+ public static FormatInfo Invalid { get; } = new(0, 0, 0, 0, 0);
+
+ /// <summary>
/// A default, generic RGBA8 texture format.
/// </summary>
public static FormatInfo Default { get; } = new(Format.R8G8B8A8Unorm, 1, 1, 4, 4);
@@ -23,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.
@@ -31,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.
@@ -57,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;