aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics/Gal/GalImage.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-09-18 01:30:35 -0300
committerGitHub <noreply@github.com>2018-09-18 01:30:35 -0300
commitd4187aaa9d7194aa26d04aee838edbc3a38f1862 (patch)
tree06fe725c1067b4aeca21749799b835d85e7d2787 /Ryujinx.Graphics/Gal/GalImage.cs
parentbec95cacc1061f91373a1e3a1411981af7fe2e4e (diff)
Allow "reinterpretation" of framebuffer/zeta formats (#418)
* (Re)Implement format reinterpretation, other changes * Implement writeback to guest memory, some refactoring * More refactoring, implement reinterpretation the old way again * Clean up * Some fixes on M2MF (old Dma engine), added partial support for P2MF, fix conditional ssy, add Z24S8 zeta format, other fixes * nit: Formatting * Address PR feedback
Diffstat (limited to 'Ryujinx.Graphics/Gal/GalImage.cs')
-rw-r--r--Ryujinx.Graphics/Gal/GalImage.cs48
1 files changed, 39 insertions, 9 deletions
diff --git a/Ryujinx.Graphics/Gal/GalImage.cs b/Ryujinx.Graphics/Gal/GalImage.cs
index dc6f02e0..92f43cc9 100644
--- a/Ryujinx.Graphics/Gal/GalImage.cs
+++ b/Ryujinx.Graphics/Gal/GalImage.cs
@@ -1,12 +1,17 @@
+using Ryujinx.Graphics.Texture;
+
namespace Ryujinx.Graphics.Gal
{
public struct GalImage
{
public int Width;
public int Height;
+ public int TileWidth;
+ public int GobBlockHeight;
+ public int Pitch;
- public GalImageFormat Format;
-
+ public GalImageFormat Format;
+ public GalMemoryLayout Layout;
public GalTextureSource XSource;
public GalTextureSource YSource;
public GalTextureSource ZSource;
@@ -15,19 +20,44 @@ namespace Ryujinx.Graphics.Gal
public GalImage(
int Width,
int Height,
+ int TileWidth,
+ int GobBlockHeight,
+ GalMemoryLayout Layout,
GalImageFormat Format,
GalTextureSource XSource = GalTextureSource.Red,
GalTextureSource YSource = GalTextureSource.Green,
GalTextureSource ZSource = GalTextureSource.Blue,
GalTextureSource WSource = GalTextureSource.Alpha)
{
- this.Width = Width;
- this.Height = Height;
- this.Format = Format;
- this.XSource = XSource;
- this.YSource = YSource;
- this.ZSource = ZSource;
- this.WSource = WSource;
+ this.Width = Width;
+ this.Height = Height;
+ this.TileWidth = TileWidth;
+ this.GobBlockHeight = GobBlockHeight;
+ this.Layout = Layout;
+ this.Format = Format;
+ this.XSource = XSource;
+ this.YSource = YSource;
+ this.ZSource = ZSource;
+ this.WSource = WSource;
+
+ Pitch = ImageUtils.GetPitch(Format, Width);
+ }
+
+ public bool SizeMatches(GalImage Image)
+ {
+ if (ImageUtils.GetBytesPerPixel(Format) !=
+ ImageUtils.GetBytesPerPixel(Image.Format))
+ {
+ return false;
+ }
+
+ if (ImageUtils.GetAlignedWidth(this) !=
+ ImageUtils.GetAlignedWidth(Image))
+ {
+ return false;
+ }
+
+ return Height == Image.Height;
}
}
} \ No newline at end of file