ryujinx-mirror/Ryujinx.Graphics.Gpu/Engine/Twod
riperiperi b0e410a828
Lift textures in the AutoDeleteCache for all modifications. (#2615)
* Lift textures in the AutoDeleteCache for all modifications.

Before, this would only apply to render targets and texture blit. Now it applies to image stores, the fast dma copy path and any other type of modification.

Image store always at least has one reference in the texture pool, so the function of the AutoDeleteCache keeping textures _alive_ is not useful, but a very important function for a while has been its use to flush textures in order of modification when they are dereferenced, so that their data is not lost.

Before, textures populated using image stores were being dereferenced and reloaded as garbage. Now, when these textures are dereferenced, their data will be put back into memory, and everything stays intact.

Fixes lighting breaking when switching levels in THPS1+2, and potentially some more UE4 games. I've tested a bunch more games for regressions and performance impact, but they all seem fine.

* Lift copy srcTexture so that it doesn't remain referenceless

* Perform lift before reference count change on unbind.

It's important to lift on unbind as that is the moment the texture was truly last modified, but definitely not after releasing every single reference.
2021-09-11 21:52:54 +02:00
..
TwodClass.cs Lift textures in the AutoDeleteCache for all modifications. (#2615) 2021-09-11 21:52:54 +02:00
TwodClassState.cs Separate GPU engines (part 2/2) (#2440) 2021-07-11 17:20:40 -03:00
TwodTexture.cs Separate GPU engines (part 2/2) (#2440) 2021-07-11 17:20:40 -03:00