2019-10-13 06:02:07 +00:00
|
|
|
namespace Ryujinx.Graphics.Gpu.State
|
|
|
|
{
|
2019-12-31 16:32:06 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Vertex buffer attribute state.
|
|
|
|
/// </summary>
|
2019-10-13 06:02:07 +00:00
|
|
|
struct VertexAttribState
|
|
|
|
{
|
2020-04-20 21:59:59 +00:00
|
|
|
#pragma warning disable CS0649
|
2019-10-13 06:02:07 +00:00
|
|
|
public uint Attribute;
|
2020-04-20 21:59:59 +00:00
|
|
|
#pragma warning restore CS0649
|
2019-10-13 06:02:07 +00:00
|
|
|
|
2019-12-31 16:32:06 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Unpacks the index of the vertex buffer this attribute belongs to.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>Vertex buffer index</returns>
|
2019-10-13 06:02:07 +00:00
|
|
|
public int UnpackBufferIndex()
|
|
|
|
{
|
|
|
|
return (int)(Attribute & 0x1f);
|
|
|
|
}
|
|
|
|
|
2020-03-30 02:11:24 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Unpacks the attribute constant flag.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>True if the attribute is constant, false otherwise</returns>
|
|
|
|
public bool UnpackIsConstant()
|
|
|
|
{
|
|
|
|
return (Attribute & 0x40) != 0;
|
|
|
|
}
|
|
|
|
|
2019-12-31 16:32:06 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Unpacks the offset, in bytes, of the attribute on the vertex buffer.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>Attribute offset in bytes</returns>
|
2019-10-13 06:02:07 +00:00
|
|
|
public int UnpackOffset()
|
|
|
|
{
|
|
|
|
return (int)((Attribute >> 7) & 0x3fff);
|
|
|
|
}
|
|
|
|
|
2019-12-31 16:32:06 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Unpacks the Maxwell attribute format integer.
|
|
|
|
/// </summary>
|
|
|
|
/// <returns>Attribute format integer</returns>
|
2019-10-13 06:02:07 +00:00
|
|
|
public uint UnpackFormat()
|
|
|
|
{
|
|
|
|
return Attribute & 0x3fe00000;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|