2019-10-13 00:02:07 -06:00
|
|
|
using Ryujinx.Graphics.GAL;
|
|
|
|
|
|
|
|
namespace Ryujinx.Graphics.Gpu.State
|
|
|
|
{
|
2019-12-31 09:32:06 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Viewport transform parameters, for viewport transformation.
|
|
|
|
/// </summary>
|
2019-10-13 00:02:07 -06:00
|
|
|
struct ViewportTransform
|
|
|
|
{
|
2020-04-20 15:59:59 -06:00
|
|
|
#pragma warning disable CS0649
|
2019-10-13 00:02:07 -06:00
|
|
|
public float ScaleX;
|
|
|
|
public float ScaleY;
|
|
|
|
public float ScaleZ;
|
|
|
|
public float TranslateX;
|
|
|
|
public float TranslateY;
|
|
|
|
public float TranslateZ;
|
|
|
|
public uint Swizzle;
|
|
|
|
public uint SubpixelPrecisionBias;
|
2020-04-20 15:59:59 -06:00
|
|
|
#pragma warning restore CS0649
|
2019-10-13 00:02:07 -06:00
|
|
|
|
2019-12-31 09:32:06 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Unpacks viewport swizzle of the position X component.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>Swizzle enum value</returns>
|
2019-10-13 00:02:07 -06:00
|
|
|
public ViewportSwizzle UnpackSwizzleX()
|
|
|
|
{
|
|
|
|
return (ViewportSwizzle)(Swizzle & 7);
|
|
|
|
}
|
|
|
|
|
2019-12-31 09:32:06 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Unpacks viewport swizzle of the position Y component.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>Swizzle enum value</returns>
|
2019-10-13 00:02:07 -06:00
|
|
|
public ViewportSwizzle UnpackSwizzleY()
|
|
|
|
{
|
|
|
|
return (ViewportSwizzle)((Swizzle >> 4) & 7);
|
|
|
|
}
|
|
|
|
|
2019-12-31 09:32:06 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Unpacks viewport swizzle of the position Z component.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>Swizzle enum value</returns>
|
2019-10-13 00:02:07 -06:00
|
|
|
public ViewportSwizzle UnpackSwizzleZ()
|
|
|
|
{
|
|
|
|
return (ViewportSwizzle)((Swizzle >> 8) & 7);
|
|
|
|
}
|
|
|
|
|
2019-12-31 09:32:06 -07:00
|
|
|
/// <summary>
|
|
|
|
/// Unpacks viewport swizzle of the position W component.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>Swizzle enum value</returns>
|
2019-10-13 00:02:07 -06:00
|
|
|
public ViewportSwizzle UnpackSwizzleW()
|
|
|
|
{
|
|
|
|
return (ViewportSwizzle)((Swizzle >> 12) & 7);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|