2018-09-18 04:30:35 +00:00
|
|
|
using Ryujinx.Graphics.Texture;
|
|
|
|
|
2018-04-08 19:17:35 +00:00
|
|
|
namespace Ryujinx.Graphics.Gal
|
|
|
|
{
|
2018-08-20 01:25:26 +00:00
|
|
|
public struct GalImage
|
2018-04-08 19:17:35 +00:00
|
|
|
{
|
|
|
|
public int Width;
|
|
|
|
public int Height;
|
2019-02-28 01:12:24 +00:00
|
|
|
|
|
|
|
// FIXME: separate layer and depth
|
|
|
|
public int Depth;
|
|
|
|
public int LayerCount;
|
2018-09-18 04:30:35 +00:00
|
|
|
public int TileWidth;
|
|
|
|
public int GobBlockHeight;
|
2019-02-28 01:12:24 +00:00
|
|
|
public int GobBlockDepth;
|
2018-09-18 04:30:35 +00:00
|
|
|
public int Pitch;
|
2019-02-28 01:12:24 +00:00
|
|
|
public int MaxMipmapLevel;
|
2018-04-08 19:17:35 +00:00
|
|
|
|
2018-09-18 04:30:35 +00:00
|
|
|
public GalImageFormat Format;
|
|
|
|
public GalMemoryLayout Layout;
|
2018-05-17 18:25:42 +00:00
|
|
|
public GalTextureSource XSource;
|
|
|
|
public GalTextureSource YSource;
|
|
|
|
public GalTextureSource ZSource;
|
|
|
|
public GalTextureSource WSource;
|
2019-02-28 01:12:24 +00:00
|
|
|
public GalTextureTarget TextureTarget;
|
2018-05-17 18:25:42 +00:00
|
|
|
|
2018-08-20 01:25:26 +00:00
|
|
|
public GalImage(
|
2018-05-17 18:25:42 +00:00
|
|
|
int Width,
|
|
|
|
int Height,
|
2019-02-28 01:12:24 +00:00
|
|
|
int Depth,
|
|
|
|
int LayerCount,
|
2018-09-18 04:30:35 +00:00
|
|
|
int TileWidth,
|
|
|
|
int GobBlockHeight,
|
2019-02-28 01:12:24 +00:00
|
|
|
int GobBlockDepth,
|
2018-09-18 04:30:35 +00:00
|
|
|
GalMemoryLayout Layout,
|
2018-08-20 01:25:26 +00:00
|
|
|
GalImageFormat Format,
|
2019-02-28 01:12:24 +00:00
|
|
|
GalTextureTarget TextureTarget,
|
|
|
|
int MaxMipmapLevel = 1,
|
|
|
|
GalTextureSource XSource = GalTextureSource.Red,
|
|
|
|
GalTextureSource YSource = GalTextureSource.Green,
|
|
|
|
GalTextureSource ZSource = GalTextureSource.Blue,
|
|
|
|
GalTextureSource WSource = GalTextureSource.Alpha)
|
2018-04-08 19:17:35 +00:00
|
|
|
{
|
2018-09-18 04:30:35 +00:00
|
|
|
this.Width = Width;
|
|
|
|
this.Height = Height;
|
2019-02-28 01:12:24 +00:00
|
|
|
this.LayerCount = LayerCount;
|
|
|
|
this.Depth = Depth;
|
2018-09-18 04:30:35 +00:00
|
|
|
this.TileWidth = TileWidth;
|
|
|
|
this.GobBlockHeight = GobBlockHeight;
|
2019-02-28 01:12:24 +00:00
|
|
|
this.GobBlockDepth = GobBlockDepth;
|
2018-09-18 04:30:35 +00:00
|
|
|
this.Layout = Layout;
|
|
|
|
this.Format = Format;
|
2019-02-28 01:12:24 +00:00
|
|
|
this.MaxMipmapLevel = MaxMipmapLevel;
|
2018-09-18 04:30:35 +00:00
|
|
|
this.XSource = XSource;
|
|
|
|
this.YSource = YSource;
|
|
|
|
this.ZSource = ZSource;
|
|
|
|
this.WSource = WSource;
|
2019-02-28 01:12:24 +00:00
|
|
|
this.TextureTarget = TextureTarget;
|
2018-09-18 04:30:35 +00:00
|
|
|
|
|
|
|
Pitch = ImageUtils.GetPitch(Format, Width);
|
|
|
|
}
|
|
|
|
|
2019-02-28 01:12:24 +00:00
|
|
|
public bool SizeMatches(GalImage Image, bool IgnoreLayer = false)
|
2018-09-18 04:30:35 +00:00
|
|
|
{
|
|
|
|
if (ImageUtils.GetBytesPerPixel(Format) !=
|
|
|
|
ImageUtils.GetBytesPerPixel(Image.Format))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ImageUtils.GetAlignedWidth(this) !=
|
|
|
|
ImageUtils.GetAlignedWidth(Image))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-02-28 01:12:24 +00:00
|
|
|
bool Result = Height == Image.Height && Depth == Image.Depth;
|
|
|
|
|
|
|
|
if (!IgnoreLayer)
|
|
|
|
{
|
|
|
|
Result = Result && LayerCount == Image.LayerCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Result;
|
2018-04-08 19:17:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|