0
0
Fork 0
This repository has been archived on 2024-10-12. You can view files and clone it, but cannot push or open issues or pull requests.
ryujinx-final/Ryujinx.Graphics.Gpu/Image/TextureInfo.cs
2020-01-09 02:13:00 +01:00

101 lines
No EOL
3.4 KiB
C#

using Ryujinx.Graphics.GAL.Texture;
namespace Ryujinx.Graphics.Gpu.Image
{
struct TextureInfo
{
public ulong Address { get; }
public int Width { get; }
public int Height { get; }
public int DepthOrLayers { get; }
public int Levels { get; }
public int SamplesInX { get; }
public int SamplesInY { get; }
public int Stride { get; }
public bool IsLinear { get; }
public int GobBlocksInY { get; }
public int GobBlocksInZ { get; }
public int GobBlocksInTileX { get; }
public int Samples => SamplesInX * SamplesInY;
public Target Target { get; }
public FormatInfo FormatInfo { get; }
public DepthStencilMode DepthStencilMode { get; }
public SwizzleComponent SwizzleR { get; }
public SwizzleComponent SwizzleG { get; }
public SwizzleComponent SwizzleB { get; }
public SwizzleComponent SwizzleA { get; }
public TextureInfo(
ulong address,
int width,
int height,
int depthOrLayers,
int levels,
int samplesInX,
int samplesInY,
int stride,
bool isLinear,
int gobBlocksInY,
int gobBlocksInZ,
int gobBlocksInTileX,
Target target,
FormatInfo formatInfo,
DepthStencilMode depthStencilMode = DepthStencilMode.Depth,
SwizzleComponent swizzleR = SwizzleComponent.Red,
SwizzleComponent swizzleG = SwizzleComponent.Green,
SwizzleComponent swizzleB = SwizzleComponent.Blue,
SwizzleComponent swizzleA = SwizzleComponent.Alpha)
{
Address = address;
Width = width;
Height = height;
DepthOrLayers = depthOrLayers;
Levels = levels;
SamplesInX = samplesInX;
SamplesInY = samplesInY;
Stride = stride;
IsLinear = isLinear;
GobBlocksInY = gobBlocksInY;
GobBlocksInZ = gobBlocksInZ;
GobBlocksInTileX = gobBlocksInTileX;
Target = target;
FormatInfo = formatInfo;
DepthStencilMode = depthStencilMode;
SwizzleR = swizzleR;
SwizzleG = swizzleG;
SwizzleB = swizzleB;
SwizzleA = swizzleA;
}
public int GetDepth()
{
return Target == Target.Texture3D ? DepthOrLayers : 1;
}
public int GetLayers()
{
if (Target == Target.Texture2DArray || Target == Target.Texture2DMultisampleArray)
{
return DepthOrLayers;
}
else if (Target == Target.CubemapArray)
{
return DepthOrLayers * 6;
}
else if (Target == Target.Cubemap)
{
return 6;
}
else
{
return 1;
}
}
}
}