CopyBufferSwizzle.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. namespace Ryujinx.Graphics.Gpu.State
  2. {
  3. /// <summary>
  4. /// Buffer to buffer copy vector swizzle parameters.
  5. /// </summary>
  6. struct CopyBufferSwizzle
  7. {
  8. #pragma warning disable CS0649
  9. public uint Swizzle;
  10. #pragma warning restore CS0649
  11. /// <summary>
  12. /// Unpacks the source for the buffer destination vector X component.
  13. /// </summary>
  14. /// <returns>Destination component</returns>
  15. public BufferSwizzleComponent UnpackDstX()
  16. {
  17. return (BufferSwizzleComponent)(Swizzle & 7);
  18. }
  19. /// <summary>
  20. /// Unpacks the source for the buffer destination vector Y component.
  21. /// </summary>
  22. /// <returns>Destination component</returns>
  23. public BufferSwizzleComponent UnpackDstY()
  24. {
  25. return (BufferSwizzleComponent)((Swizzle >> 4) & 7);
  26. }
  27. /// <summary>
  28. /// Unpacks the source for the buffer destination vector Z component.
  29. /// </summary>
  30. /// <returns>Destination component</returns>
  31. public BufferSwizzleComponent UnpackDstZ()
  32. {
  33. return (BufferSwizzleComponent)((Swizzle >> 8) & 7);
  34. }
  35. /// <summary>
  36. /// Unpacks the source for the buffer destination vector W component.
  37. /// </summary>
  38. /// <returns>Destination component</returns>
  39. public BufferSwizzleComponent UnpackDstW()
  40. {
  41. return (BufferSwizzleComponent)((Swizzle >> 12) & 7);
  42. }
  43. /// <summary>
  44. /// Unpacks the size of each vector component of the copy.
  45. /// </summary>
  46. /// <returns>Vector component size</returns>
  47. public int UnpackComponentSize()
  48. {
  49. return (int)((Swizzle >> 16) & 3) + 1;
  50. }
  51. /// <summary>
  52. /// Unpacks the number of components of the source vector of the copy.
  53. /// </summary>
  54. /// <returns>Number of vector components</returns>
  55. public int UnpackSrcComponentsCount()
  56. {
  57. return (int)((Swizzle >> 20) & 7) + 1;
  58. }
  59. /// <summary>
  60. /// Unpacks the number of components of the destination vector of the copy.
  61. /// </summary>
  62. /// <returns>Number of vector components</returns>
  63. public int UnpackDstComponentsCount()
  64. {
  65. return (int)((Swizzle >> 24) & 7) + 1;
  66. }
  67. }
  68. }