2019-10-13 07:02:07 +01:00
|
|
|
namespace Ryujinx.Graphics.Gpu.State
|
|
|
|
{
|
2019-12-31 16:32:06 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Buffer to buffer copy vector swizzle parameters.
|
|
|
|
/// </summary>
|
2019-10-13 07:02:07 +01:00
|
|
|
struct CopyBufferSwizzle
|
|
|
|
{
|
2020-04-20 22:59:59 +01:00
|
|
|
#pragma warning disable CS0649
|
2019-10-13 07:02:07 +01:00
|
|
|
public uint Swizzle;
|
2020-04-20 22:59:59 +01:00
|
|
|
#pragma warning restore CS0649
|
2019-10-13 07:02:07 +01:00
|
|
|
|
2021-01-12 21:50:54 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Unpacks the source for the buffer destination vector X component.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>Destination component</returns>
|
|
|
|
public BufferSwizzleComponent UnpackDstX()
|
|
|
|
{
|
|
|
|
return (BufferSwizzleComponent)(Swizzle & 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Unpacks the source for the buffer destination vector Y component.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>Destination component</returns>
|
|
|
|
public BufferSwizzleComponent UnpackDstY()
|
|
|
|
{
|
|
|
|
return (BufferSwizzleComponent)((Swizzle >> 4) & 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Unpacks the source for the buffer destination vector Z component.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>Destination component</returns>
|
|
|
|
public BufferSwizzleComponent UnpackDstZ()
|
|
|
|
{
|
|
|
|
return (BufferSwizzleComponent)((Swizzle >> 8) & 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Unpacks the source for the buffer destination vector W component.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>Destination component</returns>
|
|
|
|
public BufferSwizzleComponent UnpackDstW()
|
|
|
|
{
|
|
|
|
return (BufferSwizzleComponent)((Swizzle >> 12) & 7);
|
|
|
|
}
|
|
|
|
|
2019-12-31 16:32:06 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Unpacks the size of each vector component of the copy.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>Vector component size</returns>
|
2019-10-13 07:02:07 +01:00
|
|
|
public int UnpackComponentSize()
|
|
|
|
{
|
|
|
|
return (int)((Swizzle >> 16) & 3) + 1;
|
|
|
|
}
|
|
|
|
|
2019-12-31 16:32:06 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Unpacks the number of components of the source vector of the copy.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>Number of vector components</returns>
|
2019-10-13 07:02:07 +01:00
|
|
|
public int UnpackSrcComponentsCount()
|
|
|
|
{
|
|
|
|
return (int)((Swizzle >> 20) & 7) + 1;
|
|
|
|
}
|
|
|
|
|
2019-12-31 16:32:06 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Unpacks the number of components of the destination vector of the copy.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>Number of vector components</returns>
|
2019-10-13 07:02:07 +01:00
|
|
|
public int UnpackDstComponentsCount()
|
|
|
|
{
|
|
|
|
return (int)((Swizzle >> 24) & 7) + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|