rjx-mirror/Ryujinx.Memory/Tracking
riperiperi d64594ec74
Fix various issues with texture sync (#3302)
* 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
2022-04-29 18:34:11 -03:00
..
AbstractRegion.cs Replace CacheResourceWrite with more general "precise" write (#2684) 2021-09-29 02:27:03 +02:00
IMultiRegionHandle.cs POWER - Performance Optimizations With Extensive Ramifications (#2286) 2021-05-24 22:52:44 +02:00
IRegionHandle.cs Replace CacheResourceWrite with more general "precise" write (#2684) 2021-09-29 02:27:03 +02:00
MemoryTracking.cs Replace CacheResourceWrite with more general "precise" write (#2684) 2021-09-29 02:27:03 +02:00
MultiRegionHandle.cs Replace CacheResourceWrite with more general "precise" write (#2684) 2021-09-29 02:27:03 +02:00
PreciseRegionSignal.cs Replace CacheResourceWrite with more general "precise" write (#2684) 2021-09-29 02:27:03 +02:00
RegionHandle.cs Fix various issues with texture sync (#3302) 2022-04-29 18:34:11 -03:00
RegionSignal.cs Memory Read/Write Tracking using Region Handles (#1272) 2020-10-16 17:18:35 -03:00
SmartMultiRegionHandle.cs Replace CacheResourceWrite with more general "precise" write (#2684) 2021-09-29 02:27:03 +02:00
VirtualRegion.cs Replace CacheResourceWrite with more general "precise" write (#2684) 2021-09-29 02:27:03 +02:00