VertexAttribState.cs 1016 B

12345678910111213141516171819202122232425262728293031323334353637
  1. namespace Ryujinx.Graphics.Gpu.State
  2. {
  3. /// <summary>
  4. /// Vertex buffer attribute state.
  5. /// </summary>
  6. struct VertexAttribState
  7. {
  8. public uint Attribute;
  9. /// <summary>
  10. /// Unpacks the index of the vertex buffer this attribute belongs to.
  11. /// </summary>
  12. /// <returns>Vertex buffer index</returns>
  13. public int UnpackBufferIndex()
  14. {
  15. return (int)(Attribute & 0x1f);
  16. }
  17. /// <summary>
  18. /// Unpacks the offset, in bytes, of the attribute on the vertex buffer.
  19. /// </summary>
  20. /// <returns>Attribute offset in bytes</returns>
  21. public int UnpackOffset()
  22. {
  23. return (int)((Attribute >> 7) & 0x3fff);
  24. }
  25. /// <summary>
  26. /// Unpacks the Maxwell attribute format integer.
  27. /// </summary>
  28. /// <returns>Attribute format integer</returns>
  29. public uint UnpackFormat()
  30. {
  31. return Attribute & 0x3fe00000;
  32. }
  33. }
  34. }