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