aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaronKiko <BaronKiko@users.noreply.github.com>2019-03-12 04:59:12 +0000
committerjduncanator <1518948+jduncanator@users.noreply.github.com>2019-03-12 15:59:12 +1100
commita0aecd1ff85437890bb6a86fcc71fc90e80a4d24 (patch)
treedc8e8c92042838be9a18b55b02c872d23842c165
parenta2a46501084d3463203da970632640a95e32e423 (diff)
Compressed M2mf texture copy fix (#612)
Correctly calculates the number of iterations required to copy all the data from compressed textures
-rw-r--r--Ryujinx.Graphics/Graphics3d/NvGpuEngineM2mf.cs8
1 files changed, 8 insertions, 0 deletions
diff --git a/Ryujinx.Graphics/Graphics3d/NvGpuEngineM2mf.cs b/Ryujinx.Graphics/Graphics3d/NvGpuEngineM2mf.cs
index c0f444c3..45b0bbd7 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++)
{