ZetaFormat.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Ryujinx.Graphics.GAL;
  2. using Ryujinx.Graphics.Gpu.Image;
  3. namespace Ryujinx.Graphics.Gpu.State
  4. {
  5. /// <summary>
  6. /// Depth-stencil texture format.
  7. /// </summary>
  8. enum ZetaFormat
  9. {
  10. D32Float = 0xa,
  11. D16Unorm = 0x13,
  12. D24UnormS8Uint = 0x14,
  13. D24Unorm = 0x15,
  14. S8UintD24Unorm = 0x16,
  15. S8Uint = 0x17,
  16. D32FloatS8Uint = 0x19
  17. }
  18. static class ZetaFormatConverter
  19. {
  20. /// <summary>
  21. /// Converts the depth-stencil texture format to a host compatible format.
  22. /// </summary>
  23. /// <param name="format">Depth-stencil format</param>
  24. /// <returns>Host compatible format enum value</returns>
  25. public static FormatInfo Convert(this ZetaFormat format)
  26. {
  27. return format switch
  28. {
  29. ZetaFormat.D32Float => new FormatInfo(Format.D32Float, 1, 1, 4, 1),
  30. ZetaFormat.D16Unorm => new FormatInfo(Format.D16Unorm, 1, 1, 2, 1),
  31. ZetaFormat.D24UnormS8Uint => new FormatInfo(Format.D24UnormS8Uint, 1, 1, 4, 2),
  32. ZetaFormat.D24Unorm => new FormatInfo(Format.D24UnormS8Uint, 1, 1, 4, 1),
  33. ZetaFormat.S8UintD24Unorm => new FormatInfo(Format.D24UnormS8Uint, 1, 1, 4, 2),
  34. ZetaFormat.S8Uint => new FormatInfo(Format.S8Uint, 1, 1, 1, 1),
  35. ZetaFormat.D32FloatS8Uint => new FormatInfo(Format.D32FloatS8Uint, 1, 1, 8, 2),
  36. _ => FormatInfo.Default
  37. };
  38. }
  39. }
  40. }