VertexAttribState.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. namespace Ryujinx.Graphics.Gpu.State
  2. {
  3. /// <summary>
  4. /// Vertex buffer attribute state.
  5. /// </summary>
  6. struct VertexAttribState
  7. {
  8. #pragma warning disable CS0649
  9. public uint Attribute;
  10. #pragma warning restore CS0649
  11. /// <summary>
  12. /// Unpacks the index of the vertex buffer this attribute belongs to.
  13. /// </summary>
  14. /// <returns>Vertex buffer index</returns>
  15. public int UnpackBufferIndex()
  16. {
  17. return (int)(Attribute & 0x1f);
  18. }
  19. /// <summary>
  20. /// Unpacks the attribute constant flag.
  21. /// </summary>
  22. /// <returns>True if the attribute is constant, false otherwise</returns>
  23. public bool UnpackIsConstant()
  24. {
  25. return (Attribute & 0x40) != 0;
  26. }
  27. /// <summary>
  28. /// Unpacks the offset, in bytes, of the attribute on the vertex buffer.
  29. /// </summary>
  30. /// <returns>Attribute offset in bytes</returns>
  31. public int UnpackOffset()
  32. {
  33. return (int)((Attribute >> 7) & 0x3fff);
  34. }
  35. /// <summary>
  36. /// Unpacks the Maxwell attribute format integer.
  37. /// </summary>
  38. /// <returns>Attribute format integer</returns>
  39. public uint UnpackFormat()
  40. {
  41. return Attribute & 0x3fe00000;
  42. }
  43. }
  44. }