ViewportTransform.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. #pragma warning disable CS0649
  10. public float ScaleX;
  11. public float ScaleY;
  12. public float ScaleZ;
  13. public float TranslateX;
  14. public float TranslateY;
  15. public float TranslateZ;
  16. public uint Swizzle;
  17. public uint SubpixelPrecisionBias;
  18. #pragma warning restore CS0649
  19. /// <summary>
  20. /// Unpacks viewport swizzle of the position X component.
  21. /// </summary>
  22. /// <returns>Swizzle enum value</returns>
  23. public ViewportSwizzle UnpackSwizzleX()
  24. {
  25. return (ViewportSwizzle)(Swizzle & 7);
  26. }
  27. /// <summary>
  28. /// Unpacks viewport swizzle of the position Y component.
  29. /// </summary>
  30. /// <returns>Swizzle enum value</returns>
  31. public ViewportSwizzle UnpackSwizzleY()
  32. {
  33. return (ViewportSwizzle)((Swizzle >> 4) & 7);
  34. }
  35. /// <summary>
  36. /// Unpacks viewport swizzle of the position Z component.
  37. /// </summary>
  38. /// <returns>Swizzle enum value</returns>
  39. public ViewportSwizzle UnpackSwizzleZ()
  40. {
  41. return (ViewportSwizzle)((Swizzle >> 8) & 7);
  42. }
  43. /// <summary>
  44. /// Unpacks viewport swizzle of the position W component.
  45. /// </summary>
  46. /// <returns>Swizzle enum value</returns>
  47. public ViewportSwizzle UnpackSwizzleW()
  48. {
  49. return (ViewportSwizzle)((Swizzle >> 12) & 7);
  50. }
  51. }
  52. }