1
0
Fork 0
mirror of https://github.com/Ryujinx/Ryujinx.git synced 2024-11-30 16:12:03 +00:00
Ryujinx/Ryujinx.Graphics/Gal/GalImage.cs
gdkchan d4187aaa9d
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
2018-09-18 01:30:35 -03:00

63 lines
No EOL
1.9 KiB
C#

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 GalMemoryLayout Layout;
public GalTextureSource XSource;
public GalTextureSource YSource;
public GalTextureSource ZSource;
public GalTextureSource WSource;
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.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;
}
}
}