diff options
Diffstat (limited to 'src/Ryujinx.Graphics.GAL/Format.cs')
-rw-r--r-- | src/Ryujinx.Graphics.GAL/Format.cs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/Ryujinx.Graphics.GAL/Format.cs b/src/Ryujinx.Graphics.GAL/Format.cs index f6feec1c..99c89dce 100644 --- a/src/Ryujinx.Graphics.GAL/Format.cs +++ b/src/Ryujinx.Graphics.GAL/Format.cs @@ -336,6 +336,45 @@ namespace Ryujinx.Graphics.GAL } /// <summary> + /// Checks if the texture format is a depth or depth-stencil format. + /// </summary> + /// <param name="format">Texture format</param> + /// <returns>True if the format is a depth or depth-stencil format, false otherwise</returns> + public static bool HasDepth(this Format format) + { + switch (format) + { + case Format.D16Unorm: + case Format.D24UnormS8Uint: + case Format.S8UintD24Unorm: + case Format.D32Float: + case Format.D32FloatS8Uint: + return true; + } + + return false; + } + + /// <summary> + /// Checks if the texture format is a stencil or depth-stencil format. + /// </summary> + /// <param name="format">Texture format</param> + /// <returns>True if the format is a stencil or depth-stencil format, false otherwise</returns> + public static bool HasStencil(this Format format) + { + switch (format) + { + case Format.D24UnormS8Uint: + case Format.S8UintD24Unorm: + case Format.D32FloatS8Uint: + case Format.S8Uint: + return true; + } + + return false; + } + + /// <summary> /// Checks if the texture format is valid to use as image format. /// </summary> /// <param name="format">Texture format</param> |