From 0c1b29bd1a3e52f35f7ea10bdfecf1ff260766c5 Mon Sep 17 00:00:00 2001 From: Andy Adshead Date: Fri, 8 Mar 2019 13:53:25 +0000 Subject: [PATCH] Correctly calculates the number of itterations required to copy all the data from compressed textures --- Ryujinx.Graphics/Graphics3d/NvGpuEngineM2mf.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Ryujinx.Graphics/Graphics3d/NvGpuEngineM2mf.cs b/Ryujinx.Graphics/Graphics3d/NvGpuEngineM2mf.cs index c0f444c379..45b0bbd792 100644 --- a/Ryujinx.Graphics/Graphics3d/NvGpuEngineM2mf.cs +++ b/Ryujinx.Graphics/Graphics3d/NvGpuEngineM2mf.cs @@ -151,6 +151,14 @@ namespace Ryujinx.Graphics.Graphics3d dstCpp); } + // Calculate the bits per pixel + int bpp = srcPitch / xCount; + + // Copying all the bits at the same time corrupts the texture, unknown why but probably because the texture isn't linear + // To avoid this we will simply loop more times to cover all the bits, + // this allows up to recalculate the memory locations for each iteration around the loop + xCount *= bpp / srcCpp; + for (int y = 0; y < yCount; y++) for (int x = 0; x < xCount; x++) {