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.Gpu/Image/TextureGroupHandle.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/Ryujinx.Graphics.Gpu/Image/TextureGroupHandle.cs') diff --git a/src/Ryujinx.Graphics.Gpu/Image/TextureGroupHandle.cs b/src/Ryujinx.Graphics.Gpu/Image/TextureGroupHandle.cs index ef7198e8..84171c7a 100644 --- a/src/Ryujinx.Graphics.Gpu/Image/TextureGroupHandle.cs +++ b/src/Ryujinx.Graphics.Gpu/Image/TextureGroupHandle.cs @@ -2,7 +2,6 @@ using Ryujinx.Memory.Tracking; using System; using System.Collections.Generic; -using System.Linq; using System.Threading; namespace Ryujinx.Graphics.Gpu.Image @@ -155,6 +154,24 @@ namespace Ryujinx.Graphics.Gpu.Image } } + /// + /// Discards all data for this handle. + /// This clears all dirty flags, modified flags, and pending copies from other handles. + /// + public void DiscardData() + { + Modified = false; + DeferredCopy = null; + + foreach (RegionHandle handle in Handles) + { + if (handle.Dirty) + { + handle.Reprotect(); + } + } + } + /// /// Calculate a list of which views overlap this handle. /// -- cgit v1.2.3