rjx-mirror/src/Ryujinx.Graphics.Gpu/Image
riperiperi d2f3adbf69
Texture: Fix layout conversion when gobs in z is used with depth = 1 (#5220)
* Texture: Fix layout conversion when gobs in z is used with depth = 1

The size calculator methods deliberately reduce the gob size of textures if they are deemed too small for it. This is required to get correct sizes when iterating mip levels of a texture.

Rendering to a slice of a 3D texture can produce a 3D texture with depth 1, but a gob size matching a much larger texture. We _can't_ "correct" this gob size, as it is intended as a slice of a larger 3D texture. Ignoring it causes layout conversion to break on read and flush.

This caused an issue in Tears of the Kingdom where the compressed 3D texture used for the gloom would always break on OpenGL, and seemingly randomly break on Vulkan. In the first case, the data is forcibly flushed to decompress the BC4 texture on the CPU to upload it as 3D, which was broken due to the incorrect layout. In the second, the data may be randomly flushed if it falls out of the cache, but it will appear correct if it's able to form copy dependencies.

This change only allows gob sizes to be reduced once per mip level. For the purpose of aligned size, it can still be reduced infinitely as our texture cache isn't properly able to handle a view being _misaligned_.

The SizeCalculator has also been changed to reduce the size of rendered depth slices to only include the exact range a single depth slice will cover. (before, the size was way too small with gobs in z reduced to 1, and too large when using the correct value)

Gobs in Y logic remains untouched, we don't support Y slices of textures so it's fine as is.

This is probably worth testing in a few games as it also affects texture size and view logic.

* Improve wording

* Maybe a bit better
2023-06-04 20:25:57 +00:00
..
AutoDeleteCache.cs GPU: Keep rendered textures without any pool references alive (#4662) 2023-05-01 16:27:51 -03:00
FormatInfo.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
FormatTable.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
ITextureDescriptor.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
Pool.cs GPU: Remove CPU region handle containers (#4817) 2023-05-05 23:40:46 +02:00
PoolCache.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
ReductionFilter.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
Sampler.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
SamplerDescriptor.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
SamplerMinFilter.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
SamplerMipFilter.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
SamplerPool.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
SamplerPoolCache.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
Texture.cs GPU: Remove swizzle undefined matching and rework depth aliasing (#4896) 2023-05-11 21:30:47 -03:00
TextureBindingInfo.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
TextureBindingsManager.cs Fix typo in TextureBindingsManager.cs (#4798) 2023-05-05 22:17:36 +02:00
TextureCache.cs GPU: Remove swizzle undefined matching and rework depth aliasing (#4896) 2023-05-11 21:30:47 -03:00
TextureCompatibility.cs Texture: Fix layout conversion when gobs in z is used with depth = 1 (#5220) 2023-06-04 20:25:57 +00:00
TextureComponent.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
TextureDependency.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
TextureDescriptor.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
TextureDescriptorType.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
TextureGroup.cs GPU: Remove swizzle undefined matching and rework depth aliasing (#4896) 2023-05-11 21:30:47 -03:00
TextureGroupHandle.cs GPU: Remove CPU region handle containers (#4817) 2023-05-05 23:40:46 +02:00
TextureInfo.cs GPU: Remove swizzle undefined matching and rework depth aliasing (#4896) 2023-05-11 21:30:47 -03:00
TextureManager.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
TextureMatchQuality.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
TextureMsaaMode.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
TexturePool.cs Texture: Fix layout conversion when gobs in z is used with depth = 1 (#5220) 2023-06-04 20:25:57 +00:00
TexturePoolCache.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
TextureScaleMode.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
TextureSearchFlags.cs Fix some invalid blits involving depth textures (#4723) 2023-05-03 21:20:12 -03:00
TextureTarget.cs Move solution and projects to src 2023-04-27 23:51:14 +02:00
TextureViewCompatibility.cs GPU: Remove swizzle undefined matching and rework depth aliasing (#4896) 2023-05-11 21:30:47 -03:00