aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2018-10-27 15:46:17 -0300
committerAc_K <Acoustik666@gmail.com>2018-10-27 18:46:17 +0000
commit111d14f74aca5e6467473ec73ab0825b9c0b4db1 (patch)
tree971cbea8efcee6605c8f355f3ab621e1c2de43d1
parent19152def95d3def857159fbf0014dc09b3b9bac0 (diff)
Crop instead of resizing on 2d engine texture copies (#482)
* Crop instead of resizing on 2d engine texture copies * Remove unused local
-rw-r--r--Ryujinx.Graphics/NvGpuEngine2d.cs48
-rw-r--r--Ryujinx.Graphics/NvGpuEngine2dReg.cs16
2 files changed, 29 insertions, 35 deletions
diff --git a/Ryujinx.Graphics/NvGpuEngine2d.cs b/Ryujinx.Graphics/NvGpuEngine2d.cs
index 4bf7c1e8..711df122 100644
--- a/Ryujinx.Graphics/NvGpuEngine2d.cs
+++ b/Ryujinx.Graphics/NvGpuEngine2d.cs
@@ -1,7 +1,7 @@
using Ryujinx.Graphics.Gal;
using Ryujinx.Graphics.Memory;
using Ryujinx.Graphics.Texture;
-using System.Collections.Generic;
+using System;
namespace Ryujinx.Graphics
{
@@ -22,42 +22,24 @@ namespace Ryujinx.Graphics
private NvGpu Gpu;
- private Dictionary<int, NvGpuMethod> Methods;
-
public NvGpuEngine2d(NvGpu Gpu)
{
this.Gpu = Gpu;
- Registers = new int[0xe00];
-
- Methods = new Dictionary<int, NvGpuMethod>();
-
- void AddMethod(int Meth, int Count, int Stride, NvGpuMethod Method)
- {
- while (Count-- > 0)
- {
- Methods.Add(Meth, Method);
-
- Meth += Stride;
- }
- }
-
- AddMethod(0xb5, 1, 1, TextureCopy);
+ Registers = new int[0x238];
}
public void CallMethod(NvGpuVmm Vmm, NvGpuPBEntry PBEntry)
{
- if (Methods.TryGetValue(PBEntry.Method, out NvGpuMethod Method))
- {
- Method(Vmm, PBEntry);
- }
- else
+ WriteRegister(PBEntry);
+
+ if ((NvGpuEngine2dReg)PBEntry.Method == NvGpuEngine2dReg.BlitSrcYInt)
{
- WriteRegister(PBEntry);
+ TextureCopy(Vmm);
}
}
- private void TextureCopy(NvGpuVmm Vmm, NvGpuPBEntry PBEntry)
+ private void TextureCopy(NvGpuVmm Vmm)
{
CopyOperation Operation = (CopyOperation)ReadRegister(NvGpuEngine2dReg.CopyOperation);
@@ -107,17 +89,20 @@ namespace Ryujinx.Graphics
Gpu.ResourceManager.SendTexture(Vmm, SrcKey, SrcTexture);
Gpu.ResourceManager.SendTexture(Vmm, DstKey, DstTexture);
+ int Width = Math.Min(SrcWidth, DstWidth);
+ int Height = Math.Min(SrcHeight, DstHeight);
+
Gpu.Renderer.RenderTarget.Copy(
SrcKey,
DstKey,
0,
0,
- SrcWidth,
- SrcHeight,
+ Width,
+ Height,
0,
0,
- DstWidth,
- DstHeight);
+ Width,
+ Height);
}
private static GalMemoryLayout GetLayout(bool Linear)
@@ -148,10 +133,5 @@ namespace Ryujinx.Graphics
{
return Registers[(int)Reg];
}
-
- private void WriteRegister(NvGpuEngine2dReg Reg, int Value)
- {
- Registers[(int)Reg] = Value;
- }
}
} \ No newline at end of file
diff --git a/Ryujinx.Graphics/NvGpuEngine2dReg.cs b/Ryujinx.Graphics/NvGpuEngine2dReg.cs
index 00f6f578..fe003745 100644
--- a/Ryujinx.Graphics/NvGpuEngine2dReg.cs
+++ b/Ryujinx.Graphics/NvGpuEngine2dReg.cs
@@ -20,6 +20,20 @@ namespace Ryujinx.Graphics
SrcWidth = 0x92,
SrcHeight = 0x93,
SrcAddress = 0x94,
- CopyOperation = 0xab
+ ClipEnable = 0xa4,
+ CopyOperation = 0xab,
+ BlitControl = 0x223,
+ BlitDstX = 0x22c,
+ BlitDstY = 0x22d,
+ BlitDstW = 0x22e,
+ BlitDstH = 0x22f,
+ BlitDuDxFract = 0x230,
+ BlitDuDxInt = 0x231,
+ BlitDvDyFract = 0x232,
+ BlitDvDyInt = 0x233,
+ BlitSrcXFract = 0x234,
+ BlitSrcXInt = 0x235,
+ BlitSrcYFract = 0x236,
+ BlitSrcYInt = 0x237
}
} \ No newline at end of file