Ryujinx/Ryujinx.Graphics.Gpu
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
..
Engine New shader cache implementation (#3194) 2022-04-10 10:49:44 -03:00
Image Fix various issues with texture sync (#3302) 2022-04-29 18:34:11 -03:00
Memory New shader cache implementation (#3194) 2022-04-10 10:49:44 -03:00
Shader New shader cache implementation (#3194) 2022-04-10 10:49:44 -03:00
Synchronization When waiting on CPU, do not return a time out error from EventWait (#2780) 2021-11-01 19:10:02 -03:00
ClassId.cs Separate GPU engines (part 2/2) (#2440) 2021-07-11 17:20:40 -03:00
Constants.cs Improve linear texture compatibility rules (#2099) 2021-03-19 02:17:38 +01:00
GpuChannel.cs Separate GPU engines (part 2/2) (#2440) 2021-07-11 17:20:40 -03:00
GpuContext.cs New shader cache implementation (#3194) 2022-04-10 10:49:44 -03:00
GraphicsConfig.cs Perform unscaled 2d engine copy on CPU if source texture isn't in cache. (#3112) 2022-02-22 11:21:29 -03:00
Ryujinx.Graphics.Gpu.csproj infra: Migrate to .NET 6 (#2829) 2021-11-28 21:24:17 +01:00
Window.cs misc: Make PID unsigned long instead of long (#3043) 2022-02-09 17:18:07 -03:00