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
This commit is contained in:
gdkchan 2018-09-18 01:30:35 -03:00 committed by GitHub
parent bec95cacc1
commit d4187aaa9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
52 changed files with 1594 additions and 1979 deletions

View file

@ -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;
}
}
}