aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-06-23 02:00:44 -0300
committerGitHub <noreply@github.com>2018-06-23 02:00:44 -0300
commitc26ddd6259796e5b0b187989ce3e21b52edb00a8 (patch)
treeff4decb3f102b07a832e7a5d24fa8ba702126906 /Ryujinx.HLE
parent5182361f4b59069af1f185db73f7569d3031558a (diff)
Fix 3 graphics related issues (#180)
* Fix 3 graphics related bugs * OGLShader shouldn't be public (yet)
Diffstat (limited to 'Ryujinx.HLE')
-rw-r--r--Ryujinx.HLE/Gpu/NvGpuEngine3d.cs11
-rw-r--r--Ryujinx.HLE/Gpu/TextureFactory.cs11
-rw-r--r--Ryujinx.HLE/Gpu/TextureHelper.cs1
-rw-r--r--Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapHandle.cs6
-rw-r--r--Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapIoctl.cs6
5 files changed, 28 insertions, 7 deletions
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);
diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapHandle.cs b/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapHandle.cs
index 7902034c..21fce700 100644
--- a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapHandle.cs
+++ b/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapHandle.cs
@@ -24,14 +24,14 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap
this.Size = Size;
}
- public long IncrementRefCount()
+ public void IncrementRefCount()
{
- return Interlocked.Increment(ref Dupes);
+ Interlocked.Increment(ref Dupes);
}
public long DecrementRefCount()
{
- return Interlocked.Decrement(ref Dupes);
+ return Interlocked.Decrement(ref Dupes) + 1;
}
}
} \ No newline at end of file
diff --git a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapIoctl.cs b/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapIoctl.cs
index 376b74c1..43de4edb 100644
--- a/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapIoctl.cs
+++ b/Ryujinx.HLE/OsHle/Services/Nv/NvMap/NvMapIoctl.cs
@@ -163,9 +163,9 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap
return NvResult.InvalidInput;
}
- long RefCount = Map.DecrementRefCount();
+ long OldRefCount = Map.DecrementRefCount();
- if (RefCount <= 0)
+ if (OldRefCount <= 1)
{
DeleteNvMap(Context, Args.Handle);
@@ -178,7 +178,7 @@ namespace Ryujinx.HLE.OsHle.Services.Nv.NvMap
Args.Flags = FlagNotFreedYet;
}
- Args.RefCount = RefCount;
+ Args.RefCount = OldRefCount;
Args.Size = Map.Size;
AMemoryHelper.Write(Context.Memory, OutputPosition, Args);