ViewportTransform.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using Ryujinx.Graphics.GAL;
  2. namespace Ryujinx.Graphics.Gpu.State
  3. {
  4. /// <summary>
  5. /// Viewport transform parameters, for viewport transformation.
  6. /// </summary>
  7. struct ViewportTransform
  8. {
  9. public float ScaleX;
  10. public float ScaleY;
  11. public float ScaleZ;
  12. public float TranslateX;
  13. public float TranslateY;
  14. public float TranslateZ;
  15. public uint Swizzle;
  16. public uint SubpixelPrecisionBias;
  17. /// <summary>
  18. /// Unpacks viewport swizzle of the position X component.
  19. /// </summary>
  20. /// <returns>Swizzle enum value</returns>
  21. public ViewportSwizzle UnpackSwizzleX()
  22. {
  23. return (ViewportSwizzle)(Swizzle & 7);
  24. }
  25. /// <summary>
  26. /// Unpacks viewport swizzle of the position Y component.
  27. /// </summary>
  28. /// <returns>Swizzle enum value</returns>
  29. public ViewportSwizzle UnpackSwizzleY()
  30. {
  31. return (ViewportSwizzle)((Swizzle >> 4) & 7);
  32. }
  33. /// <summary>
  34. /// Unpacks viewport swizzle of the position Z component.
  35. /// </summary>
  36. /// <returns>Swizzle enum value</returns>
  37. public ViewportSwizzle UnpackSwizzleZ()
  38. {
  39. return (ViewportSwizzle)((Swizzle >> 8) & 7);
  40. }
  41. /// <summary>
  42. /// Unpacks viewport swizzle of the position W component.
  43. /// </summary>
  44. /// <returns>Swizzle enum value</returns>
  45. public ViewportSwizzle UnpackSwizzleW()
  46. {
  47. return (ViewportSwizzle)((Swizzle >> 12) & 7);
  48. }
  49. }
  50. }