Ryujinx/Ryujinx.Memory
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
..
Range Allow textures to have their data partially mapped (#2629) 2022-02-22 13:34:16 -03:00
Tracking Fix various issues with texture sync (#3302) 2022-04-29 18:34:11 -03:00
WindowsShared Array based RangeList that caches Address/EndAddress (#2642) 2021-09-19 14:22:26 +02:00
AddressSpaceManager.cs Replace CacheResourceWrite with more general "precise" write (#2684) 2021-09-29 02:27:03 +02:00
InvalidAccessHandler.cs POWER - Performance Optimizations With Extensive Ramifications (#2286) 2021-05-24 22:52:44 +02:00
InvalidMemoryRegionException.cs Update InvalidMemoryRegionException.cs to abide by English rules. (#1834) 2020-12-25 04:09:02 +01:00
IRefCounted.cs POWER - Performance Optimizations With Extensive Ramifications (#2286) 2021-05-24 22:52:44 +02:00
IVirtualMemoryManager.cs misc: Fix IVirtualMemoryManager.Fill ignoring value (#2775) 2021-10-24 18:16:59 -03:00
IWritableBlock.cs Return mapped buffer pointer directly for flush, WriteableRegion for textures (#2494) 2021-07-19 19:10:54 -03:00
MemoryAllocationFlags.cs POWER - Performance Optimizations With Extensive Ramifications (#2286) 2021-05-24 22:52:44 +02:00
MemoryBlock.cs kernel: Clear pages allocated with SetHeapSize (#2776) 2021-10-24 18:52:59 -03:00
MemoryConstants.cs Implement a new physical memory manager and replace DeviceMemory (#856) 2020-05-04 08:54:50 +10:00
MemoryManagement.cs misc: Migrate usage of RuntimeInformation to OperatingSystem (#2901) 2021-12-04 20:02:30 -03:00
MemoryManagementUnix.cs Remove usage of Mono.Posix.NETStandard accross all projects (#2906) 2021-12-08 18:24:26 -03:00
MemoryManagementWindows.cs misc: Migrate usage of RuntimeInformation to OperatingSystem (#2901) 2021-12-04 20:02:30 -03:00
MemoryManagerUnixHelper.cs Remove usage of Mono.Posix.NETStandard accross all projects (#2906) 2021-12-08 18:24:26 -03:00
MemoryNotContiguousException.cs IPC refactor part 2: Use ReplyAndReceive on HLE services and remove special handling from kernel (#1458) 2020-12-02 00:23:43 +01:00
MemoryPermission.cs POWER - Performance Optimizations With Extensive Ramifications (#2286) 2021-05-24 22:52:44 +02:00
MemoryProtectionException.cs Implement a new physical memory manager and replace DeviceMemory (#856) 2020-05-04 08:54:50 +10:00
NativeMemoryManager.cs POWER - Performance Optimizations With Extensive Ramifications (#2286) 2021-05-24 22:52:44 +02:00
PageTable.cs POWER - Performance Optimizations With Extensive Ramifications (#2286) 2021-05-24 22:52:44 +02:00
Ryujinx.Memory.csproj Remove usage of Mono.Posix.NETStandard accross all projects (#2906) 2021-12-08 18:24:26 -03:00
WritableRegion.cs Return mapped buffer pointer directly for flush, WriteableRegion for textures (#2494) 2021-07-19 19:10:54 -03:00