TextureMsaaMode.cs
1 namespace Ryujinx.Graphics.Gpu.Image 2 { 3 /// <summary> 4 /// Multisampled texture samples count. 5 /// </summary> 6 enum TextureMsaaMode 7 { 8 Ms1x1 = 0, 9 Ms2x2 = 2, 10 Ms4x2 = 4, 11 Ms2x1 = 5, 12 Ms4x4 = 6, 13 } 14 15 static class TextureMsaaModeConverter 16 { 17 /// <summary> 18 /// Returns the total number of samples from the MSAA mode. 19 /// </summary> 20 /// <param name="msaaMode">The MSAA mode</param> 21 /// <returns>The total number of samples</returns> 22 public static int SamplesCount(this TextureMsaaMode msaaMode) 23 { 24 return msaaMode switch 25 { 26 TextureMsaaMode.Ms2x1 => 2, 27 TextureMsaaMode.Ms2x2 => 4, 28 TextureMsaaMode.Ms4x2 => 8, 29 TextureMsaaMode.Ms4x4 => 16, 30 _ => 1, 31 }; 32 } 33 34 /// <summary> 35 /// Returns the number of samples in the X direction from the MSAA mode. 36 /// </summary> 37 /// <param name="msaaMode">The MSAA mode</param> 38 /// <returns>The number of samples in the X direction</returns> 39 public static int SamplesInX(this TextureMsaaMode msaaMode) 40 { 41 return msaaMode switch 42 { 43 TextureMsaaMode.Ms2x1 => 2, 44 TextureMsaaMode.Ms2x2 => 2, 45 TextureMsaaMode.Ms4x2 => 4, 46 TextureMsaaMode.Ms4x4 => 4, 47 _ => 1, 48 }; 49 } 50 51 /// <summary> 52 /// Returns the number of samples in the Y direction from the MSAA mode. 53 /// </summary> 54 /// <param name="msaaMode">The MSAA mode</param> 55 /// <returns>The number of samples in the Y direction</returns> 56 public static int SamplesInY(this TextureMsaaMode msaaMode) 57 { 58 return msaaMode switch 59 { 60 TextureMsaaMode.Ms2x1 => 1, 61 TextureMsaaMode.Ms2x2 => 2, 62 TextureMsaaMode.Ms4x2 => 2, 63 TextureMsaaMode.Ms4x4 => 4, 64 _ => 1, 65 }; 66 } 67 } 68 }