From f6c3f1cdfdb9145634be3bfc54400f0d408f36dd Mon Sep 17 00:00:00 2001 From: riperiperi Date: Mon, 25 Sep 2023 22:07:03 +0100 Subject: GPU: Discard data when getting texture before full clear (#5719) * GPU: Discard data when getting texture before full clear * Fix rules and order of clear checks * Fix formatting --- src/Ryujinx.Graphics.GAL/Format.cs | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src/Ryujinx.Graphics.GAL/Format.cs') 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 @@ -335,6 +335,45 @@ namespace Ryujinx.Graphics.GAL return 1; } + /// + /// Checks if the texture format is a depth or depth-stencil format. + /// + /// Texture format + /// True if the format is a depth or depth-stencil format, false otherwise + 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; + } + + /// + /// Checks if the texture format is a stencil or depth-stencil format. + /// + /// Texture format + /// True if the format is a stencil or depth-stencil format, false otherwise + 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; + } + /// /// Checks if the texture format is valid to use as image format. /// -- cgit v1.2.3