diff options
author | riperiperi <rhy3756547@hotmail.com> | 2023-09-25 22:07:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-25 23:07:03 +0200 |
commit | f6c3f1cdfdb9145634be3bfc54400f0d408f36dd (patch) | |
tree | aa3de1c788717cd76f5990550dad0f3ab3d397bf /src/Ryujinx.Graphics.GAL/Format.cs | |
parent | 8026e1c804fae39561087f9e04bd5c4eefa640fa (diff) |
GPU: Discard data when getting texture before full clear (#5719)1.1.1024
* GPU: Discard data when getting texture before full clear
* Fix rules and order of clear checks
* Fix formatting
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> |