From 1fd1ec5664fdf6f29c04f2449cd3d8645e520661 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Wed, 26 Dec 2018 17:29:50 -0200 Subject: [PATCH] Do not attempt to read unused attribute, fix attributes count (#520) --- Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs | 2 +- Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs b/Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs index 92bdd658c..e6fb7ea14 100644 --- a/Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs +++ b/Ryujinx.Graphics/Gal/Shader/GlslDecompiler.cs @@ -878,7 +878,7 @@ namespace Ryujinx.Graphics.Gal.Shader } } - if (DeclInfo.Index >= 16) + if (DeclInfo.Index >= 32) { throw new InvalidOperationException($"Shader attribute offset {Abuf.Offs} is invalid."); } diff --git a/Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs b/Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs index 6fb038acb..fefd2e671 100644 --- a/Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs +++ b/Ryujinx.Graphics/Graphics3d/NvGpuEngine3d.cs @@ -734,6 +734,11 @@ namespace Ryujinx.Graphics.Graphics3d long VbPosition = MakeInt64From2xInt32(NvGpuEngine3dReg.VertexArrayNAddress + ArrayIndex * 4); + if (VbPosition == 0) + { + continue; + } + bool IsConst = ((Packed >> 6) & 1) != 0; int Offset = (Packed >> 7) & 0x3fff;