diff options
| author | TSR Berry <20988865+TSRBerry@users.noreply.github.com> | 2023-04-08 01:22:00 +0200 |
|---|---|---|
| committer | Mary <thog@protonmail.com> | 2023-04-27 23:51:14 +0200 |
| commit | cee712105850ac3385cd0091a923438167433f9f (patch) | |
| tree | 4a5274b21d8b7f938c0d0ce18736d3f2993b11b1 /src/Ryujinx.Graphics.Gpu/Image/TextureMsaaMode.cs | |
| parent | cd124bda587ef09668a971fa1cac1c3f0cfc9f21 (diff) | |
Move solution and projects to src
Diffstat (limited to 'src/Ryujinx.Graphics.Gpu/Image/TextureMsaaMode.cs')
| -rw-r--r-- | src/Ryujinx.Graphics.Gpu/Image/TextureMsaaMode.cs | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/src/Ryujinx.Graphics.Gpu/Image/TextureMsaaMode.cs b/src/Ryujinx.Graphics.Gpu/Image/TextureMsaaMode.cs new file mode 100644 index 00000000..0461888f --- /dev/null +++ b/src/Ryujinx.Graphics.Gpu/Image/TextureMsaaMode.cs @@ -0,0 +1,68 @@ +namespace Ryujinx.Graphics.Gpu.Image +{ + /// <summary> + /// Multisampled texture samples count. + /// </summary> + enum TextureMsaaMode + { + Ms1x1 = 0, + Ms2x2 = 2, + Ms4x2 = 4, + Ms2x1 = 5, + Ms4x4 = 6 + } + + static class TextureMsaaModeConverter + { + /// <summary> + /// Returns the total number of samples from the MSAA mode. + /// </summary> + /// <param name="msaaMode">The MSAA mode</param> + /// <returns>The total number of samples</returns> + public static int SamplesCount(this TextureMsaaMode msaaMode) + { + return msaaMode switch + { + TextureMsaaMode.Ms2x1 => 2, + TextureMsaaMode.Ms2x2 => 4, + TextureMsaaMode.Ms4x2 => 8, + TextureMsaaMode.Ms4x4 => 16, + _ => 1 + }; + } + + /// <summary> + /// Returns the number of samples in the X direction from the MSAA mode. + /// </summary> + /// <param name="msaaMode">The MSAA mode</param> + /// <returns>The number of samples in the X direction</returns> + public static int SamplesInX(this TextureMsaaMode msaaMode) + { + return msaaMode switch + { + TextureMsaaMode.Ms2x1 => 2, + TextureMsaaMode.Ms2x2 => 2, + TextureMsaaMode.Ms4x2 => 4, + TextureMsaaMode.Ms4x4 => 4, + _ => 1 + }; + } + + /// <summary> + /// Returns the number of samples in the Y direction from the MSAA mode. + /// </summary> + /// <param name="msaaMode">The MSAA mode</param> + /// <returns>The number of samples in the Y direction</returns> + public static int SamplesInY(this TextureMsaaMode msaaMode) + { + return msaaMode switch + { + TextureMsaaMode.Ms2x1 => 1, + TextureMsaaMode.Ms2x2 => 2, + TextureMsaaMode.Ms4x2 => 2, + TextureMsaaMode.Ms4x4 => 4, + _ => 1 + }; + } + } +}
\ No newline at end of file |
