From e4f68592c3a6e51414e5f78eef096f21bf735eb1 Mon Sep 17 00:00:00 2001 From: riperiperi Date: Sun, 12 Feb 2023 09:30:26 +0000 Subject: Fix partial updates for textures. (#4401) I was forcing some types of texture to partially update when investigating performance with games that stream in data, and noticed that partially loading texture data was really broken on both backends. Fixes Vulkan texture set by getting the correct expected size for the texture. Fixes partial upload on both backends for both Texture 2D Array and Cubemap using the wrong offset and uploading to the first layer/level for a handle. 3D might also be affected. This might fix textures randomly having incorrect data in games that render to it - jumbled in the case of OpenGL, and outdated/black in the case of Vulkan. This case typically happens in UE4 games. --- Ryujinx.Graphics.Vulkan/TextureView.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Ryujinx.Graphics.Vulkan') diff --git a/Ryujinx.Graphics.Vulkan/TextureView.cs b/Ryujinx.Graphics.Vulkan/TextureView.cs index d60ce39b..aa050c01 100644 --- a/Ryujinx.Graphics.Vulkan/TextureView.cs +++ b/Ryujinx.Graphics.Vulkan/TextureView.cs @@ -712,7 +712,7 @@ namespace Ryujinx.Graphics.Vulkan for (int level = 0; level < levels; level++) { - int mipSize = GetBufferDataLength(Info.GetMipSize(dstLevel + level)); + int mipSize = GetBufferDataLength(Info.GetMipSize2D(dstLevel + level) * dstLayers); int endOffset = offset + mipSize; -- cgit v1.2.3