aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs
diff options
context:
space:
mode:
authorriperiperi <rhy3756547@hotmail.com>2022-04-29 22:34:11 +0100
committerGitHub <noreply@github.com>2022-04-29 18:34:11 -0300
commitd64594ec7476782a4254502dd0e36b8f1f49e381 (patch)
tree582a4e029aadd42fd8946b3d1939f077780a499e /Ryujinx.Graphics.Gpu/Image/TextureGroup.cs
parent6a1a03566aa04d6e3e32547821aae0bc587d1128 (diff)
Fix various issues with texture sync (#3302)1.1.107
* Fix various issues with texture sync A variable called _actionRegistered is used to keep track of whether a tracking action has been registered for a given texture group handle. This variable is set when the action is registered, and should be unset when it is consumed. This is used to skip registering the tracking action if it's already registered, saving some time for render targets that are modified very often. There were two issues with this. The worst issue was that the tracking action handler exits early if the handle's modified flag is false... which means that it never reset _actionRegistered, as that was done within the Sync() method called later. The second issue was that this variable was set true after the sync action was registered, so it was technically possible for the action to run immediately, set the flag to false, then set it to true. Both situations would lead to the action never being registered again, as the texture group handle would be sure the action is already registered. This breaks the texture for the remaining runtime, or until it is disposed. It was also possible for a texture to register sync once, then on future frames the last modified sync number did not update. This may have caused some more minor issues. Seems to fix the Xenoblade flashing bug. Obviously this needs a lot of testing, since it was random chance. I typically had the most luck getting it to happen by switching time of day on the event theatre screen for a while, then entering the equipment screen by pressing X on an event. May also fix weird things like random chance air swimming in BOTW, maybe a few texture streaming bugs. * Exchange rather than CompareExchange
Diffstat (limited to 'Ryujinx.Graphics.Gpu/Image/TextureGroup.cs')
-rw-r--r--Ryujinx.Graphics.Gpu/Image/TextureGroup.cs6
1 files changed, 6 insertions, 0 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs b/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs
index be0abea2..4bdc5078 100644
--- a/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs
+++ b/Ryujinx.Graphics.Gpu/Image/TextureGroup.cs
@@ -1393,6 +1393,12 @@ namespace Ryujinx.Graphics.Gpu.Image
/// <param name="size">The size of the flushing memory access</param>
public void FlushAction(TextureGroupHandle handle, ulong address, ulong size)
{
+ // There is a small gap here where the action is removed but _actionRegistered is still 1.
+ // In this case it will skip registering the action, but here we are already handling it,
+ // so there shouldn't be any issue as it's the same handler for all actions.
+
+ handle.ClearActionRegistered();
+
if (!handle.Modified)
{
return;