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