ryujinx-mirror/Ryujinx.Graphics.Gpu/Image
riperiperi da073fce61
GPU: Fast path for adding one texture view to a group (#4528)
* GPU: Fast path for adding one texture view to a group

Texture group handles must store a list of their overlapping views, so they can be properly notified when a write is detected, and a few other things relating to texture readback. This is generally created when the group is established, with each handle looping over all views to find its overlaps. This whole process was also done when only a single view was added (and no handles were changed), however...

Sonic Frontiers had a huge cubemap array with 7350 faces (175 cubemaps * 6 faces * 7 levels), so iterating over both handles and existing views added up very fast. Since we are only adding a single view, we only need to _add_ that view to the existing overlaps, rather than recalculate them all.

This greatly improves performance during loading screens and a few seconds into gameplay on the "open zone" sections of Sonic Frontiers. May improve loading times or stutters on some other games.

Note that the current texture cache rules will cause these views to fall out of the cache, as there are more than the hard cap, so the cost will be repaid when reloading the open zone.

I also added some code to properly remove overlaps when texture views are removed, since it seems that was missing.

This can be improved further by only iterating handles that overlap the view (filter by range), but so can a few places in TextureGroup, so better to do all at once. The full generation of overlaps could probably be improved in a similar way.

I recommend testing a few games to make sure nothing breaks.

* Address feedback
2023-03-14 17:33:44 -03:00
..
AutoDeleteCache.cs Limit texture cache based on total texture size (#4350) 2023-02-08 14:19:43 +01:00
FormatInfo.cs Make structs readonly when applicable (#4002) 2022-12-05 14:47:39 +01:00
FormatTable.cs Implement a software ETC2 texture decoder (#4121) 2022-12-21 20:39:58 -03:00
ITextureDescriptor.cs shader cache: Fix invalid virtual address clean up (#1717) 2020-11-17 22:20:17 +01:00
Pool.cs Clear CPU side data on GPU buffer clears (#4125) 2023-02-16 18:28:49 -03:00
PoolCache.cs Add a sampler pool cache and improve texture pool cache (#3487) 2022-07-27 21:07:48 -03:00
ReductionFilter.cs Address PR feedback 2020-01-09 02:13:00 +01:00
Sampler.cs Optimize Texture Binding and Shader Specialization Checks (#3399) 2022-06-17 13:09:14 -03:00
SamplerDescriptor.cs Use a descriptor cache for faster pool invalidation. (#1977) 2021-01-29 14:19:06 +11:00
SamplerMinFilter.cs Add XML documentation to Ryujinx.Graphics.Gpu.Image 2020-01-09 02:13:00 +01:00
SamplerMipFilter.cs Add XML documentation to Ryujinx.Graphics.Gpu.Image 2020-01-09 02:13:00 +01:00
SamplerPool.cs Add a sampler pool cache and improve texture pool cache (#3487) 2022-07-27 21:07:48 -03:00
SamplerPoolCache.cs Add a sampler pool cache and improve texture pool cache (#3487) 2022-07-27 21:07:48 -03:00
Texture.cs GPU: Fast path for adding one texture view to a group (#4528) 2023-03-14 17:33:44 -03:00
TextureBindingInfo.cs Make structs readonly when applicable (#4002) 2022-12-05 14:47:39 +01:00
TextureBindingsManager.cs GPU: Force rebind when pool changes (#4129) 2022-12-21 17:35:28 -03:00
TextureCache.cs Update range for remapped sparse textures instead of recreating them (#4442) 2023-03-14 17:08:44 -03:00
TextureCompatibility.cs Add copy dependency for some incompatible texture formats (#4380) 2023-02-21 19:21:57 -03:00
TextureComponent.cs Add XML documentation to Ryujinx.Graphics.Gpu.Image 2020-01-09 02:13:00 +01:00
TextureDependency.cs Texture Cache: "Texture Groups" and "Texture Dependencies" (#2001) 2021-03-02 19:30:54 -03:00
TextureDescriptor.cs Add short duration texture cache (#3754) 2023-01-17 04:39:46 +01:00
TextureDescriptorType.cs Add XML documentation to Ryujinx.Graphics.Gpu.Image 2020-01-09 02:13:00 +01:00
TextureGroup.cs GPU: Fast path for adding one texture view to a group (#4528) 2023-03-14 17:33:44 -03:00
TextureGroupHandle.cs GPU: Fast path for adding one texture view to a group (#4528) 2023-03-14 17:33:44 -03:00
TextureInfo.cs Handle mismatching texture size with copy dependencies (#4364) 2023-02-08 08:48:09 +01:00
TextureManager.cs Handle mismatching texture size with copy dependencies (#4364) 2023-02-08 08:48:09 +01:00
TextureMatchQuality.cs Prefer truly perfect texture matches over fomat aliased ones (#1754) 2020-11-27 19:46:23 +01:00
TextureMsaaMode.cs Add XML documentation to Ryujinx.Graphics.Gpu.Image 2020-01-09 02:13:00 +01:00
TexturePool.cs Update range for remapped sparse textures instead of recreating them (#4442) 2023-03-14 17:08:44 -03:00
TexturePoolCache.cs Add a sampler pool cache and improve texture pool cache (#3487) 2022-07-27 21:07:48 -03:00
TextureScaleMode.cs Use "Undesired" scale mode for certain textures rather than blacklisting (#2537) 2021-08-11 22:44:51 +02:00
TextureSearchFlags.cs Handle mismatching texture size with copy dependencies (#4364) 2023-02-08 08:48:09 +01:00
TextureTarget.cs Fix TXQ for 3D textures. (#2613) 2021-09-02 00:17:43 -03:00
TextureViewCompatibility.cs Texture Sync, incompatible overlap handling, data flush improvements. (#2971) 2022-01-09 13:28:48 -03:00