From c26ddd6259796e5b0b187989ce3e21b52edb00a8 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sat, 23 Jun 2018 02:00:44 -0300 Subject: Fix 3 graphics related issues (#180) * Fix 3 graphics related bugs * OGLShader shouldn't be public (yet) --- Ryujinx.HLE/Gpu/NvGpuEngine3d.cs | 11 ++++++++++- Ryujinx.HLE/Gpu/TextureFactory.cs | 11 +++++++++++ Ryujinx.HLE/Gpu/TextureHelper.cs | 1 + 3 files changed, 22 insertions(+), 1 deletion(-) (limited to 'Ryujinx.HLE/Gpu') diff --git a/Ryujinx.HLE/Gpu/NvGpuEngine3d.cs b/Ryujinx.HLE/Gpu/NvGpuEngine3d.cs index deb622fe..6d03e6b8 100644 --- a/Ryujinx.HLE/Gpu/NvGpuEngine3d.cs +++ b/Ryujinx.HLE/Gpu/NvGpuEngine3d.cs @@ -248,6 +248,15 @@ namespace Ryujinx.HLE.Gpu int TextureHandle = Vmm.ReadInt32(Position); + if (TextureHandle == 0) + { + //TODO: Is this correct? + //Some games like puyo puyo will have 0 handles. + //It may be just normal behaviour or a bug caused by sync issues. + //The game does initialize the value properly after through. + return; + } + int TicIndex = (TextureHandle >> 0) & 0xfffff; int TscIndex = (TextureHandle >> 20) & 0xfff; @@ -314,7 +323,7 @@ namespace Ryujinx.HLE.Gpu continue; } - for (int Cbuf = 0; Cbuf < ConstBuffers.Length; Cbuf++) + for (int Cbuf = 0; Cbuf < ConstBuffers[Index].Length; Cbuf++) { ConstBuffer Cb = ConstBuffers[Index][Cbuf]; diff --git a/Ryujinx.HLE/Gpu/TextureFactory.cs b/Ryujinx.HLE/Gpu/TextureFactory.cs index 9a92a016..94c6eb18 100644 --- a/Ryujinx.HLE/Gpu/TextureFactory.cs +++ b/Ryujinx.HLE/Gpu/TextureFactory.cs @@ -41,6 +41,17 @@ namespace Ryujinx.HLE.Gpu TextureSwizzle Swizzle = (TextureSwizzle)((Tic[2] >> 21) & 7); + if (Swizzle == TextureSwizzle.BlockLinear || + Swizzle == TextureSwizzle.BlockLinearColorKey) + { + TextureAddress &= ~0x1ffL; + } + else if (Swizzle == TextureSwizzle.Pitch || + Swizzle == TextureSwizzle.PitchColorKey) + { + TextureAddress &= ~0x1fL; + } + int Pitch = (Tic[3] & 0xffff) << 5; int BlockHeightLog2 = (Tic[3] >> 3) & 7; diff --git a/Ryujinx.HLE/Gpu/TextureHelper.cs b/Ryujinx.HLE/Gpu/TextureHelper.cs index e48e25ad..237d87ab 100644 --- a/Ryujinx.HLE/Gpu/TextureHelper.cs +++ b/Ryujinx.HLE/Gpu/TextureHelper.cs @@ -10,6 +10,7 @@ namespace Ryujinx.HLE.Gpu { switch (Texture.Swizzle) { + case TextureSwizzle._1dBuffer: case TextureSwizzle.Pitch: case TextureSwizzle.PitchColorKey: return new LinearSwizzle(Texture.Pitch, Bpp); -- cgit v1.2.3