Ryujinx/src
riperiperi 95c06de4c1
GPU: Remove swizzle undefined matching and rework depth aliasing (#4896)
* GPU: Remove swizzle undefined matching and rework depth aliasing

@gdkchan pointed out that UI textures in TOTK seemed to be setting their texture swizzle incorrectly (texture was RGB but was sampling A, swizzle for A was wrong), so I determined that SwizzleComponentMatches was the problem and set on eliminating it. This PR combines existing work to select the most recently modified texture (now used when selecting which aliased texture to use) with some additional changes to remove the swizzle check and support aliased view creation.

The original observation (#1538) was that we wanted to match depth textures for the purposes of aliasing with color textures, but they often had different swizzle from what was sampled (as it's generally the identity swizzle once rendered). At the time, I decided to allow swizzles to match if only the defined components matched, which fixed the issue in all known cases but could easily be broken by a game _expecting_ a given swizzle, such as a 1/0 value on a component.

This error case could also occur in textures that don't even depth alias, such as R11G11B10, as the rule was created to generally apply to all cases.

The solution is now to fail this exact match test, and allow the search for an R32 texture to create a swizzled view of a D32 texture (and other such cases). This allows the creation of a view that mismatches the requested format, which wasn't present before and was the reason for the swizzle matching approach.

The exact match and view creation rules now follow the same rules over what textures to select when there are multiple options (such as a "perfect" match and an "aliased" match at the same time). It now selects the most recently modified texture, which is done with a new sequence number in the GpuContext (because we don't have enough of these).

Reportedly fixes UI having weird coloured backgrounds in TOTK. This also fixes an issue in MK8D where returning from a race resulted in the character selection cubemaps being broken. May work around issues introduced by the "short texture cache" PR due to modification ordering, though they won't be truly fixed.

Should allow (#4365) to avoid copies in more cases. Need to test that.

I tested a bunch of games #1538 originally affected and they seem to be fine. This change affects all games so it would be good to get some wide testing on it.

* Address feedback 1, fix an issue

* Workaround: Do not allow copies for format alias.

These should be removed when D32<->R32 copy dependencies become legal
2023-05-11 21:30:47 -03:00
..
ARMeilleure Ensure background translation threads exited before disposing JIT (#4874) 2023-05-10 21:46:38 -03:00
Ryujinx Fix the restart after an update. (#4869) 2023-05-12 02:14:29 +02:00
Ryujinx.Audio amadeus: Allow 5.1 sink output (#4894) 2023-05-12 00:19:19 +02:00
Ryujinx.Audio.Backends.OpenAL Move solution and projects to src 2023-04-27 23:51:14 +02:00
Ryujinx.Audio.Backends.SDL2 Move solution and projects to src 2023-04-27 23:51:14 +02:00
Ryujinx.Audio.Backends.SoundIo Move solution and projects to src 2023-04-27 23:51:14 +02:00
Ryujinx.Ava Fix the restart after an update. (#4869) 2023-05-12 02:14:29 +02:00
Ryujinx.Common Add hide-cursor command line argument & always hide cursor option (#4613) 2023-05-02 03:29:47 +02:00
Ryujinx.Cpu GPU: Remove CPU region handle containers (#4817) 2023-05-05 23:40:46 +02:00
Ryujinx.Graphics.Device Move solution and projects to src 2023-04-27 23:51:14 +02:00
Ryujinx.Graphics.GAL GPU: Pre-emptively flush textures that are flushed often (to imported memory when available) (#4711) 2023-05-01 16:05:12 -03:00
Ryujinx.Graphics.Gpu GPU: Remove swizzle undefined matching and rework depth aliasing (#4896) 2023-05-11 21:30:47 -03:00
Ryujinx.Graphics.Host1x Move solution and projects to src 2023-04-27 23:51:14 +02:00
Ryujinx.Graphics.Nvdec Move solution and projects to src 2023-04-27 23:51:14 +02:00
Ryujinx.Graphics.Nvdec.FFmpeg Move solution and projects to src 2023-04-27 23:51:14 +02:00
Ryujinx.Graphics.Nvdec.Vp9 Move solution and projects to src 2023-04-27 23:51:14 +02:00
Ryujinx.Graphics.OpenGL Use ToLowerInvariant when detecting GPU vendor. (#4815) 2023-05-05 16:35:59 +00:00
Ryujinx.Graphics.Shader Enable explicit LOD for array textures with depth compare on SPIR-V (#4892) 2023-05-11 21:35:36 +02:00
Ryujinx.Graphics.Texture Fix incorrect ASTC endpoint color when using LuminanceDelta mode (#4890) 2023-05-11 20:47:55 +02:00
Ryujinx.Graphics.Vic Move solution and projects to src 2023-04-27 23:51:14 +02:00
Ryujinx.Graphics.Video Move solution and projects to src 2023-04-27 23:51:14 +02:00
Ryujinx.Graphics.Vulkan fix(mvk): resumeLostDevice (#4800) 2023-05-10 03:31:52 +02:00
Ryujinx.Headless.SDL2 vulkan: Pass Vk instance to VulkanRenderer (#4859) 2023-05-08 13:05:37 +02:00
Ryujinx.HLE IPC - Refactor Bcat service to use new ipc - Revisit (#4803) 2023-05-09 21:46:23 +00:00
Ryujinx.Horizon Fix missing domain service object dispose (#4879) 2023-05-11 00:29:17 +00:00
Ryujinx.Horizon.Common Move solution and projects to src 2023-04-27 23:51:14 +02:00
Ryujinx.Horizon.Generators IPC - Refactor Bcat service to use new ipc - Revisit (#4803) 2023-05-09 21:46:23 +00:00
Ryujinx.Horizon.Kernel.Generators Move solution and projects to src 2023-04-27 23:51:14 +02:00
Ryujinx.Input Move solution and projects to src 2023-04-27 23:51:14 +02:00
Ryujinx.Input.SDL2 Move solution and projects to src 2023-04-27 23:51:14 +02:00
Ryujinx.Memory GPU: Remove CPU region handle containers (#4817) 2023-05-05 23:40:46 +02:00
Ryujinx.SDL2.Common Stop SDL from inhibiting sleep. (#4842) 2023-05-11 20:13:01 +02:00
Ryujinx.ShaderTools Move solution and projects to src 2023-04-27 23:51:14 +02:00
Ryujinx.Tests Adjust Ryujinx.Tests.Memory namespace 2023-04-27 23:51:14 +02:00
Ryujinx.Tests.Memory Adjust Ryujinx.Tests.Memory namespace 2023-04-27 23:51:14 +02:00
Ryujinx.Tests.Unicorn Move solution and projects to src 2023-04-27 23:51:14 +02:00
Ryujinx.Ui.Common Changed LastPlayed field from string to nullable DateTime (#4861) 2023-05-12 01:56:37 +02:00
Ryujinx.Ui.LocaleGenerator Move solution and projects to src 2023-04-27 23:51:14 +02:00
Spv.Generator Move solution and projects to src 2023-04-27 23:51:14 +02:00