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(
|
2019-03-04 02:45:25 +01: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 21:17:35 +02:00
|
|
|
{
|
2019-03-04 02:45:25 +01: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 06:30:35 +02:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
Pitch = ImageUtils.GetPitch(format, width);
|
2018-09-18 06:30:35 +02:00
|
|
|
}
|
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
public bool SizeMatches(GalImage image, bool ignoreLayer = false)
|
2018-09-18 06:30:35 +02:00
|
|
|
{
|
|
|
|
if (ImageUtils.GetBytesPerPixel(Format) !=
|
2019-03-04 02:45:25 +01:00
|
|
|
ImageUtils.GetBytesPerPixel(image.Format))
|
2018-09-18 06:30:35 +02:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ImageUtils.GetAlignedWidth(this) !=
|
2019-03-04 02:45:25 +01:00
|
|
|
ImageUtils.GetAlignedWidth(image))
|
2018-09-18 06:30:35 +02:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
bool result = Height == image.Height && Depth == image.Depth;
|
2019-02-28 02:12:24 +01:00
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
if (!ignoreLayer)
|
2019-02-28 02:12:24 +01:00
|
|
|
{
|
2019-03-04 02:45:25 +01:00
|
|
|
result = result && LayerCount == image.LayerCount;
|
2019-02-28 02:12:24 +01:00
|
|
|
}
|
|
|
|
|
2019-03-04 02:45:25 +01:00
|
|
|
return result;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|