2018-09-18 00:30:35 -04:00
|
|
|
using Ryujinx.Graphics.Texture;
|
|
|
|
|
2018-04-08 15:17:35 -04:00
|
|
|
namespace Ryujinx.Graphics.Gal
|
|
|
|
{
|
2018-08-19 21:25:26 -04:00
|
|
|
public struct GalImage
|
2018-04-08 15:17:35 -04:00
|
|
|
{
|
|
|
|
public int Width;
|
|
|
|
public int Height;
|
2019-02-27 20:12:24 -05:00
|
|
|
|
|
|
|
// FIXME: separate layer and depth
|
|
|
|
public int Depth;
|
|
|
|
public int LayerCount;
|
2018-09-18 00:30:35 -04:00
|
|
|
public int TileWidth;
|
|
|
|
public int GobBlockHeight;
|
2019-02-27 20:12:24 -05:00
|
|
|
public int GobBlockDepth;
|
2018-09-18 00:30:35 -04:00
|
|
|
public int Pitch;
|
2019-02-27 20:12:24 -05:00
|
|
|
public int MaxMipmapLevel;
|
2018-04-08 15:17:35 -04:00
|
|
|
|
2018-09-18 00:30:35 -04:00
|
|
|
public GalImageFormat Format;
|
|
|
|
public GalMemoryLayout Layout;
|
2018-05-17 14:25:42 -04:00
|
|
|
public GalTextureSource XSource;
|
|
|
|
public GalTextureSource YSource;
|
|
|
|
public GalTextureSource ZSource;
|
|
|
|
public GalTextureSource WSource;
|
2019-02-27 20:12:24 -05:00
|
|
|
public GalTextureTarget TextureTarget;
|
2018-05-17 14:25:42 -04:00
|
|
|
|
2018-08-19 21:25:26 -04:00
|
|
|
public GalImage(
|
2019-03-03 20:45:25 -05:00
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
int depth,
|
|
|
|
int layerCount,
|
|
|
|
int tileWidth,
|
|
|
|
int gobBlockHeight,
|
|
|
|
int gobBlockDepth,
|
|
|
|
GalMemoryLayout layout,
|
|
|
|
GalImageFormat format,
|
|
|
|
GalTextureTarget textureTarget,
|
|
|
|
int maxMipmapLevel = 1,
|
|
|
|
GalTextureSource xSource = GalTextureSource.Red,
|
|
|
|
GalTextureSource ySource = GalTextureSource.Green,
|
|
|
|
GalTextureSource zSource = GalTextureSource.Blue,
|
|
|
|
GalTextureSource wSource = GalTextureSource.Alpha)
|
2018-04-08 15:17:35 -04:00
|
|
|
{
|
2019-03-03 20:45:25 -05:00
|
|
|
Width = width;
|
|
|
|
Height = height;
|
|
|
|
LayerCount = layerCount;
|
|
|
|
Depth = depth;
|
|
|
|
TileWidth = tileWidth;
|
|
|
|
GobBlockHeight = gobBlockHeight;
|
|
|
|
GobBlockDepth = gobBlockDepth;
|
|
|
|
Layout = layout;
|
|
|
|
Format = format;
|
|
|
|
MaxMipmapLevel = maxMipmapLevel;
|
|
|
|
XSource = xSource;
|
|
|
|
YSource = ySource;
|
|
|
|
ZSource = zSource;
|
|
|
|
WSource = wSource;
|
|
|
|
TextureTarget = textureTarget;
|
2018-09-18 00:30:35 -04:00
|
|
|
|
2019-03-03 20:45:25 -05:00
|
|
|
Pitch = ImageUtils.GetPitch(format, width);
|
2018-09-18 00:30:35 -04:00
|
|
|
}
|
|
|
|
|
2019-03-03 20:45:25 -05:00
|
|
|
public bool SizeMatches(GalImage image, bool ignoreLayer = false)
|
2018-09-18 00:30:35 -04:00
|
|
|
{
|
|
|
|
if (ImageUtils.GetBytesPerPixel(Format) !=
|
2019-03-03 20:45:25 -05:00
|
|
|
ImageUtils.GetBytesPerPixel(image.Format))
|
2018-09-18 00:30:35 -04:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ImageUtils.GetAlignedWidth(this) !=
|
2019-03-03 20:45:25 -05:00
|
|
|
ImageUtils.GetAlignedWidth(image))
|
2018-09-18 00:30:35 -04:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-03-03 20:45:25 -05:00
|
|
|
bool result = Height == image.Height && Depth == image.Depth;
|
2019-02-27 20:12:24 -05:00
|
|
|
|
2019-03-03 20:45:25 -05:00
|
|
|
if (!ignoreLayer)
|
2019-02-27 20:12:24 -05:00
|
|
|
{
|
2019-03-03 20:45:25 -05:00
|
|
|
result = result && LayerCount == image.LayerCount;
|
2019-02-27 20:12:24 -05:00
|
|
|
}
|
|
|
|
|
2019-03-03 20:45:25 -05:00
|
|
|
return result;
|
2018-04-08 15:17:35 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|