2018-04-08 21:17:35 +02:00
|
|
|
using Ryujinx.Graphics.Gal;
|
2018-06-24 02:39:25 +02:00
|
|
|
using Ryujinx.HLE.Gpu.Memory;
|
|
|
|
using Ryujinx.HLE.Gpu.Texture;
|
2018-04-08 21:17:35 +02:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
namespace Ryujinx.HLE.Gpu.Engines
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2018-06-09 02:15:56 +02:00
|
|
|
class NvGpuEngine3d : INvGpuEngine
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
|
|
|
public int[] Registers { get; private set; }
|
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
private NvGpu Gpu;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
private Dictionary<int, NvGpuMethod> Methods;
|
|
|
|
|
|
|
|
private struct ConstBuffer
|
|
|
|
{
|
|
|
|
public bool Enabled;
|
|
|
|
public long Position;
|
|
|
|
public int Size;
|
|
|
|
}
|
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
private ConstBuffer[][] ConstBuffers;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-04-13 20:12:58 +02:00
|
|
|
private HashSet<long> FrameBuffers;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
public NvGpuEngine3d(NvGpu Gpu)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
|
|
|
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(0x585, 1, 1, VertexEndGl);
|
|
|
|
AddMethod(0x674, 1, 1, ClearBuffers);
|
|
|
|
AddMethod(0x6c3, 1, 1, QueryControl);
|
|
|
|
AddMethod(0x8e4, 16, 1, CbData);
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
AddMethod(0x904, 5, 8, CbBind);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
ConstBuffers = new ConstBuffer[6][];
|
|
|
|
|
|
|
|
for (int Index = 0; Index < ConstBuffers.Length; Index++)
|
|
|
|
{
|
|
|
|
ConstBuffers[Index] = new ConstBuffer[18];
|
|
|
|
}
|
2018-04-13 20:12:58 +02:00
|
|
|
|
|
|
|
FrameBuffers = new HashSet<long>();
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
public void CallMethod(NvGpuVmm Vmm, NvGpuPBEntry PBEntry)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
|
|
|
if (Methods.TryGetValue(PBEntry.Method, out NvGpuMethod Method))
|
|
|
|
{
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
Method(Vmm, PBEntry);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
WriteRegister(PBEntry);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
private void VertexEndGl(NvGpuVmm Vmm, NvGpuPBEntry PBEntry)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2018-07-10 04:01:59 +02:00
|
|
|
LockCaches();
|
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
SetFrameBuffer(Vmm, 0);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
long[] Keys = UploadShaders(Vmm);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
Gpu.Renderer.Shader.BindProgram();
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-07-07 04:40:12 +02:00
|
|
|
//Note: Uncomment SetFrontFace SetCullFace when flipping issues are solved
|
|
|
|
//SetFrontFace();
|
|
|
|
//SetCullFace();
|
2018-06-27 06:32:28 +02:00
|
|
|
SetDepth();
|
2018-07-05 20:47:29 +02:00
|
|
|
SetStencil();
|
2018-04-08 21:17:35 +02:00
|
|
|
SetAlphaBlending();
|
2018-07-08 18:14:35 +02:00
|
|
|
SetPrimitiveRestart();
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
UploadTextures(Vmm, Keys);
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
UploadUniforms(Vmm);
|
|
|
|
UploadVertexArrays(Vmm);
|
2018-07-10 04:01:59 +02:00
|
|
|
|
|
|
|
UnlockCaches();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void LockCaches()
|
|
|
|
{
|
|
|
|
Gpu.Renderer.Rasterizer.LockCaches();
|
|
|
|
Gpu.Renderer.Texture.LockCache();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void UnlockCaches()
|
|
|
|
{
|
|
|
|
Gpu.Renderer.Rasterizer.UnlockCaches();
|
|
|
|
Gpu.Renderer.Texture.UnlockCache();
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
private void ClearBuffers(NvGpuVmm Vmm, NvGpuPBEntry PBEntry)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
|
|
|
int Arg0 = PBEntry.Arguments[0];
|
|
|
|
|
|
|
|
int FbIndex = (Arg0 >> 6) & 0xf;
|
|
|
|
|
|
|
|
GalClearBufferFlags Flags = (GalClearBufferFlags)(Arg0 & 0x3f);
|
|
|
|
|
2018-06-28 05:11:49 +02:00
|
|
|
SetFrameBuffer(Vmm, FbIndex);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-06-28 05:11:49 +02:00
|
|
|
Gpu.Renderer.Rasterizer.ClearBuffers(Flags);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
private void SetFrameBuffer(NvGpuVmm Vmm, int FbIndex)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
long VA = MakeInt64From2xInt32(NvGpuEngine3dReg.FrameBufferNAddress + FbIndex * 0x10);
|
2018-04-13 20:12:58 +02:00
|
|
|
|
2018-06-28 05:11:49 +02:00
|
|
|
long Key = Vmm.GetPhysicalAddress(VA);
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
|
2018-06-28 05:11:49 +02:00
|
|
|
FrameBuffers.Add(Key);
|
2018-04-13 20:12:58 +02:00
|
|
|
|
|
|
|
int Width = ReadRegister(NvGpuEngine3dReg.FrameBufferNWidth + FbIndex * 0x10);
|
|
|
|
int Height = ReadRegister(NvGpuEngine3dReg.FrameBufferNHeight + FbIndex * 0x10);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-04-13 20:12:58 +02:00
|
|
|
//Note: Using the Width/Height results seems to give incorrect results.
|
|
|
|
//Maybe the size of all frame buffers is hardcoded to screen size? This seems unlikely.
|
2018-06-28 05:11:49 +02:00
|
|
|
Gpu.Renderer.FrameBuffer.Create(Key, 1280, 720);
|
|
|
|
Gpu.Renderer.FrameBuffer.Bind(Key);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
private long[] UploadShaders(NvGpuVmm Vmm)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2018-06-24 02:39:25 +02:00
|
|
|
long[] Keys = new long[5];
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
long BasePosition = MakeInt64From2xInt32(NvGpuEngine3dReg.ShaderAddress);
|
|
|
|
|
2018-06-28 04:55:08 +02:00
|
|
|
int Index = 1;
|
|
|
|
|
|
|
|
int VpAControl = ReadRegister(NvGpuEngine3dReg.ShaderNControl);
|
|
|
|
|
|
|
|
bool VpAEnable = (VpAControl & 1) != 0;
|
|
|
|
|
|
|
|
if (VpAEnable)
|
|
|
|
{
|
|
|
|
//Note: The maxwell supports 2 vertex programs, usually
|
|
|
|
//only VP B is used, but in some cases VP A is also used.
|
|
|
|
//In this case, it seems to function as an extra vertex
|
|
|
|
//shader stage.
|
|
|
|
//The graphics abstraction layer has a special overload for this
|
|
|
|
//case, which should merge the two shaders into one vertex shader.
|
|
|
|
int VpAOffset = ReadRegister(NvGpuEngine3dReg.ShaderNOffset);
|
|
|
|
int VpBOffset = ReadRegister(NvGpuEngine3dReg.ShaderNOffset + 0x10);
|
|
|
|
|
|
|
|
long VpAPos = BasePosition + (uint)VpAOffset;
|
|
|
|
long VpBPos = BasePosition + (uint)VpBOffset;
|
|
|
|
|
|
|
|
Gpu.Renderer.Shader.Create(Vmm, VpAPos, VpBPos, GalShaderType.Vertex);
|
|
|
|
Gpu.Renderer.Shader.Bind(VpBPos);
|
|
|
|
|
|
|
|
Index = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (; Index < 6; Index++)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
|
|
|
int Control = ReadRegister(NvGpuEngine3dReg.ShaderNControl + Index * 0x10);
|
|
|
|
int Offset = ReadRegister(NvGpuEngine3dReg.ShaderNOffset + Index * 0x10);
|
|
|
|
|
|
|
|
//Note: Vertex Program (B) is always enabled.
|
|
|
|
bool Enable = (Control & 1) != 0 || Index == 1;
|
|
|
|
|
|
|
|
if (!Enable)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
long Key = BasePosition + (uint)Offset;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
GalShaderType ShaderType = GetTypeFromProgram(Index);
|
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
Keys[(int)ShaderType] = Key;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
Gpu.Renderer.Shader.Create(Vmm, Key, ShaderType);
|
|
|
|
Gpu.Renderer.Shader.Bind(Key);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
2018-07-05 20:47:29 +02:00
|
|
|
float SignX = GetFlipSign(NvGpuEngine3dReg.ViewportScaleX);
|
|
|
|
float SignY = GetFlipSign(NvGpuEngine3dReg.ViewportScaleY);
|
2018-04-14 05:39:24 +02:00
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
Gpu.Renderer.Shader.SetFlip(SignX, SignY);
|
2018-04-14 05:39:24 +02:00
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
return Keys;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private static GalShaderType GetTypeFromProgram(int Program)
|
|
|
|
{
|
|
|
|
switch (Program)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
case 1: return GalShaderType.Vertex;
|
|
|
|
case 2: return GalShaderType.TessControl;
|
|
|
|
case 3: return GalShaderType.TessEvaluation;
|
|
|
|
case 4: return GalShaderType.Geometry;
|
|
|
|
case 5: return GalShaderType.Fragment;
|
|
|
|
}
|
|
|
|
|
|
|
|
throw new ArgumentOutOfRangeException(nameof(Program));
|
|
|
|
}
|
|
|
|
|
2018-07-05 20:47:29 +02:00
|
|
|
private void SetFrontFace()
|
|
|
|
{
|
|
|
|
float SignX = GetFlipSign(NvGpuEngine3dReg.ViewportScaleX);
|
|
|
|
float SignY = GetFlipSign(NvGpuEngine3dReg.ViewportScaleY);
|
|
|
|
|
|
|
|
GalFrontFace FrontFace = (GalFrontFace)ReadRegister(NvGpuEngine3dReg.FrontFace);
|
|
|
|
|
|
|
|
//Flipping breaks facing. Flipping front facing too fixes it
|
|
|
|
if (SignX != SignY)
|
|
|
|
{
|
|
|
|
switch (FrontFace)
|
|
|
|
{
|
|
|
|
case GalFrontFace.CW:
|
|
|
|
FrontFace = GalFrontFace.CCW;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GalFrontFace.CCW:
|
|
|
|
FrontFace = GalFrontFace.CW;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Gpu.Renderer.Rasterizer.SetFrontFace(FrontFace);
|
|
|
|
}
|
|
|
|
|
2018-06-27 06:32:28 +02:00
|
|
|
private void SetCullFace()
|
|
|
|
{
|
2018-07-05 20:47:29 +02:00
|
|
|
bool Enable = (ReadRegister(NvGpuEngine3dReg.CullFaceEnable) & 1) != 0;
|
|
|
|
|
|
|
|
if (Enable)
|
|
|
|
{
|
|
|
|
Gpu.Renderer.Rasterizer.EnableCullFace();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Gpu.Renderer.Rasterizer.DisableCullFace();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!Enable)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
GalCullFace CullFace = (GalCullFace)ReadRegister(NvGpuEngine3dReg.CullFace);
|
|
|
|
|
|
|
|
Gpu.Renderer.Rasterizer.SetCullFace(CullFace);
|
2018-06-27 06:32:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void SetDepth()
|
|
|
|
{
|
2018-07-05 20:47:29 +02:00
|
|
|
float ClearDepth = ReadRegisterFloat(NvGpuEngine3dReg.ClearDepth);
|
|
|
|
|
|
|
|
Gpu.Renderer.Rasterizer.SetClearDepth(ClearDepth);
|
|
|
|
|
|
|
|
bool Enable = (ReadRegister(NvGpuEngine3dReg.DepthTestEnable) & 1) != 0;
|
|
|
|
|
|
|
|
if (Enable)
|
|
|
|
{
|
|
|
|
Gpu.Renderer.Rasterizer.EnableDepthTest();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Gpu.Renderer.Rasterizer.DisableDepthTest();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!Enable)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
GalComparisonOp Func = (GalComparisonOp)ReadRegister(NvGpuEngine3dReg.DepthTestFunction);
|
|
|
|
|
|
|
|
Gpu.Renderer.Rasterizer.SetDepthFunction(Func);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void SetStencil()
|
|
|
|
{
|
|
|
|
int ClearStencil = ReadRegister(NvGpuEngine3dReg.ClearStencil);
|
|
|
|
|
|
|
|
Gpu.Renderer.Rasterizer.SetClearStencil(ClearStencil);
|
|
|
|
|
|
|
|
bool Enable = (ReadRegister(NvGpuEngine3dReg.StencilEnable) & 1) != 0;
|
|
|
|
|
|
|
|
if (Enable)
|
|
|
|
{
|
|
|
|
Gpu.Renderer.Rasterizer.EnableStencilTest();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Gpu.Renderer.Rasterizer.DisableStencilTest();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!Enable)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetFaceStencil(
|
|
|
|
bool IsFrontFace,
|
|
|
|
NvGpuEngine3dReg Func,
|
|
|
|
NvGpuEngine3dReg FuncRef,
|
|
|
|
NvGpuEngine3dReg FuncMask,
|
|
|
|
NvGpuEngine3dReg OpFail,
|
|
|
|
NvGpuEngine3dReg OpZFail,
|
|
|
|
NvGpuEngine3dReg OpZPass,
|
|
|
|
NvGpuEngine3dReg Mask)
|
|
|
|
{
|
|
|
|
Gpu.Renderer.Rasterizer.SetStencilFunction(
|
|
|
|
IsFrontFace,
|
|
|
|
(GalComparisonOp)ReadRegister(Func),
|
|
|
|
ReadRegister(FuncRef),
|
|
|
|
ReadRegister(FuncMask));
|
|
|
|
|
|
|
|
Gpu.Renderer.Rasterizer.SetStencilOp(
|
|
|
|
IsFrontFace,
|
|
|
|
(GalStencilOp)ReadRegister(OpFail),
|
|
|
|
(GalStencilOp)ReadRegister(OpZFail),
|
|
|
|
(GalStencilOp)ReadRegister(OpZPass));
|
|
|
|
|
|
|
|
Gpu.Renderer.Rasterizer.SetStencilMask(IsFrontFace, ReadRegister(Mask));
|
|
|
|
}
|
|
|
|
|
|
|
|
SetFaceStencil(false,
|
|
|
|
NvGpuEngine3dReg.StencilBackFuncFunc,
|
|
|
|
NvGpuEngine3dReg.StencilBackFuncRef,
|
|
|
|
NvGpuEngine3dReg.StencilBackFuncMask,
|
|
|
|
NvGpuEngine3dReg.StencilBackOpFail,
|
|
|
|
NvGpuEngine3dReg.StencilBackOpZFail,
|
|
|
|
NvGpuEngine3dReg.StencilBackOpZPass,
|
|
|
|
NvGpuEngine3dReg.StencilBackMask);
|
|
|
|
|
|
|
|
SetFaceStencil(true,
|
|
|
|
NvGpuEngine3dReg.StencilFrontFuncFunc,
|
|
|
|
NvGpuEngine3dReg.StencilFrontFuncRef,
|
|
|
|
NvGpuEngine3dReg.StencilFrontFuncMask,
|
|
|
|
NvGpuEngine3dReg.StencilFrontOpFail,
|
|
|
|
NvGpuEngine3dReg.StencilFrontOpZFail,
|
|
|
|
NvGpuEngine3dReg.StencilFrontOpZPass,
|
|
|
|
NvGpuEngine3dReg.StencilFrontMask);
|
2018-06-27 06:32:28 +02:00
|
|
|
}
|
|
|
|
|
2018-04-08 21:17:35 +02:00
|
|
|
private void SetAlphaBlending()
|
|
|
|
{
|
2018-04-13 20:12:58 +02:00
|
|
|
//TODO: Support independent blend properly.
|
2018-04-14 03:42:55 +02:00
|
|
|
bool Enable = (ReadRegister(NvGpuEngine3dReg.IBlendNEnable) & 1) != 0;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
if (Enable)
|
|
|
|
{
|
|
|
|
Gpu.Renderer.Blend.Enable();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Gpu.Renderer.Blend.Disable();
|
|
|
|
}
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-06-02 05:50:56 +02:00
|
|
|
if (!Enable)
|
|
|
|
{
|
|
|
|
//If blend is not enabled, then the other values have no effect.
|
|
|
|
//Note that if it is disabled, the register may contain invalid values.
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2018-04-13 20:12:58 +02:00
|
|
|
bool BlendSeparateAlpha = (ReadRegister(NvGpuEngine3dReg.IBlendNSeparateAlpha) & 1) != 0;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-04-13 20:12:58 +02:00
|
|
|
GalBlendEquation EquationRgb = (GalBlendEquation)ReadRegister(NvGpuEngine3dReg.IBlendNEquationRgb);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-04-13 20:12:58 +02:00
|
|
|
GalBlendFactor FuncSrcRgb = (GalBlendFactor)ReadRegister(NvGpuEngine3dReg.IBlendNFuncSrcRgb);
|
|
|
|
GalBlendFactor FuncDstRgb = (GalBlendFactor)ReadRegister(NvGpuEngine3dReg.IBlendNFuncDstRgb);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
if (BlendSeparateAlpha)
|
|
|
|
{
|
2018-04-13 20:12:58 +02:00
|
|
|
GalBlendEquation EquationAlpha = (GalBlendEquation)ReadRegister(NvGpuEngine3dReg.IBlendNEquationAlpha);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-04-13 20:12:58 +02:00
|
|
|
GalBlendFactor FuncSrcAlpha = (GalBlendFactor)ReadRegister(NvGpuEngine3dReg.IBlendNFuncSrcAlpha);
|
|
|
|
GalBlendFactor FuncDstAlpha = (GalBlendFactor)ReadRegister(NvGpuEngine3dReg.IBlendNFuncDstAlpha);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
Gpu.Renderer.Blend.SetSeparate(
|
2018-04-08 21:17:35 +02:00
|
|
|
EquationRgb,
|
|
|
|
EquationAlpha,
|
|
|
|
FuncSrcRgb,
|
|
|
|
FuncDstRgb,
|
|
|
|
FuncSrcAlpha,
|
|
|
|
FuncDstAlpha);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-06-24 02:39:25 +02:00
|
|
|
Gpu.Renderer.Blend.Set(EquationRgb, FuncSrcRgb, FuncDstRgb);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-08 18:14:35 +02:00
|
|
|
private void SetPrimitiveRestart()
|
|
|
|
{
|
|
|
|
bool Enable = (ReadRegister(NvGpuEngine3dReg.PrimRestartEnable) & 1) != 0;
|
|
|
|
|
|
|
|
if (Enable)
|
|
|
|
{
|
|
|
|
Gpu.Renderer.Rasterizer.EnablePrimitiveRestart();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Gpu.Renderer.Rasterizer.DisablePrimitiveRestart();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!Enable)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint Index = (uint)ReadRegister(NvGpuEngine3dReg.PrimRestartIndex);
|
|
|
|
|
|
|
|
Gpu.Renderer.Rasterizer.SetPrimitiveRestartIndex(Index);
|
|
|
|
}
|
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
private void UploadTextures(NvGpuVmm Vmm, long[] Keys)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
|
|
|
long BaseShPosition = MakeInt64From2xInt32(NvGpuEngine3dReg.ShaderAddress);
|
|
|
|
|
|
|
|
int TextureCbIndex = ReadRegister(NvGpuEngine3dReg.TextureCbIndex);
|
|
|
|
|
2018-04-13 20:12:58 +02:00
|
|
|
//Note: On the emulator renderer, Texture Unit 0 is
|
|
|
|
//reserved for drawing the frame buffer.
|
|
|
|
int TexIndex = 1;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
for (int Index = 0; Index < Keys.Length; Index++)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2018-06-24 02:39:25 +02:00
|
|
|
foreach (ShaderDeclInfo DeclInfo in Gpu.Renderer.Shader.GetTextureUsage(Keys[Index]))
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
long Position = ConstBuffers[Index][TextureCbIndex].Position;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
UploadTexture(Vmm, Position, TexIndex, DeclInfo.Index);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
Gpu.Renderer.Shader.EnsureTextureBinding(DeclInfo.Name, TexIndex);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
TexIndex++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
private void UploadTexture(NvGpuVmm Vmm, long BasePosition, int TexIndex, int HndIndex)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
|
|
|
long Position = BasePosition + HndIndex * 4;
|
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
int TextureHandle = Vmm.ReadInt32(Position);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-06-23 07:00:44 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2018-04-08 21:17:35 +02:00
|
|
|
int TicIndex = (TextureHandle >> 0) & 0xfffff;
|
|
|
|
int TscIndex = (TextureHandle >> 20) & 0xfff;
|
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
long TicPosition = MakeInt64From2xInt32(NvGpuEngine3dReg.TexHeaderPoolOffset);
|
|
|
|
long TscPosition = MakeInt64From2xInt32(NvGpuEngine3dReg.TexSamplerPoolOffset);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
TicPosition += TicIndex * 0x20;
|
|
|
|
TscPosition += TscIndex * 0x20;
|
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
GalTextureSampler Sampler = TextureFactory.MakeSampler(Gpu, Vmm, TscPosition);
|
2018-04-13 20:12:58 +02:00
|
|
|
|
2018-07-08 21:55:15 +02:00
|
|
|
long Key = Vmm.ReadInt64(TicPosition + 4) & 0xffffffffffff;
|
2018-04-13 20:12:58 +02:00
|
|
|
|
2018-07-08 21:55:15 +02:00
|
|
|
Key = Vmm.GetPhysicalAddress(Key);
|
2018-06-09 02:15:56 +02:00
|
|
|
|
2018-07-08 21:55:15 +02:00
|
|
|
if (IsFrameBufferPosition(Key))
|
2018-04-13 20:12:58 +02:00
|
|
|
{
|
|
|
|
//This texture is a frame buffer texture,
|
|
|
|
//we shouldn't read anything from memory and bind
|
|
|
|
//the frame buffer texture instead, since we're not
|
|
|
|
//really writing anything to memory.
|
2018-07-08 21:55:15 +02:00
|
|
|
Gpu.Renderer.FrameBuffer.BindTexture(Key, TexIndex);
|
2018-04-13 20:12:58 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-06-09 02:15:56 +02:00
|
|
|
GalTexture NewTexture = TextureFactory.MakeTexture(Vmm, TicPosition);
|
|
|
|
|
|
|
|
long Size = (uint)TextureHelper.GetTextureSize(NewTexture);
|
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
bool HasCachedTexture = false;
|
|
|
|
|
|
|
|
if (Gpu.Renderer.Texture.TryGetCachedTexture(Key, Size, out GalTexture Texture))
|
2018-06-09 02:15:56 +02:00
|
|
|
{
|
2018-06-24 02:39:25 +02:00
|
|
|
if (NewTexture.Equals(Texture) && !Vmm.IsRegionModified(Key, Size, NvGpuBufferType.Texture))
|
2018-06-09 02:15:56 +02:00
|
|
|
{
|
2018-06-24 02:39:25 +02:00
|
|
|
Gpu.Renderer.Texture.Bind(Key, TexIndex);
|
2018-06-09 02:15:56 +02:00
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
HasCachedTexture = true;
|
2018-06-09 02:15:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
if (!HasCachedTexture)
|
|
|
|
{
|
|
|
|
byte[] Data = TextureFactory.GetTextureData(Vmm, TicPosition);
|
2018-04-13 20:12:58 +02:00
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
Gpu.Renderer.Texture.Create(Key, Data, NewTexture);
|
|
|
|
}
|
2018-06-09 02:15:56 +02:00
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
Gpu.Renderer.Texture.Bind(Key, TexIndex);
|
2018-04-13 20:12:58 +02:00
|
|
|
}
|
2018-06-24 02:39:25 +02:00
|
|
|
|
|
|
|
Gpu.Renderer.Texture.SetSampler(Sampler);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
private void UploadUniforms(NvGpuVmm Vmm)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
|
|
|
long BasePosition = MakeInt64From2xInt32(NvGpuEngine3dReg.ShaderAddress);
|
|
|
|
|
|
|
|
for (int Index = 0; Index < 5; Index++)
|
|
|
|
{
|
|
|
|
int Control = ReadRegister(NvGpuEngine3dReg.ShaderNControl + (Index + 1) * 0x10);
|
|
|
|
int Offset = ReadRegister(NvGpuEngine3dReg.ShaderNOffset + (Index + 1) * 0x10);
|
|
|
|
|
|
|
|
//Note: Vertex Program (B) is always enabled.
|
|
|
|
bool Enable = (Control & 1) != 0 || Index == 0;
|
|
|
|
|
|
|
|
if (!Enable)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2018-06-23 07:00:44 +02:00
|
|
|
for (int Cbuf = 0; Cbuf < ConstBuffers[Index].Length; Cbuf++)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
ConstBuffer Cb = ConstBuffers[Index][Cbuf];
|
2018-04-08 21:17:35 +02:00
|
|
|
|
|
|
|
if (Cb.Enabled)
|
|
|
|
{
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
byte[] Data = Vmm.ReadBytes(Cb.Position, (uint)Cb.Size);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
Gpu.Renderer.Shader.SetConstBuffer(BasePosition + (uint)Offset, Cbuf, Data);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
private void UploadVertexArrays(NvGpuVmm Vmm)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
|
|
|
long IndexPosition = MakeInt64From2xInt32(NvGpuEngine3dReg.IndexArrayAddress);
|
|
|
|
|
2018-07-08 21:55:15 +02:00
|
|
|
long IboKey = Vmm.GetPhysicalAddress(IndexPosition);
|
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
int IndexEntryFmt = ReadRegister(NvGpuEngine3dReg.IndexArrayFormat);
|
|
|
|
int IndexFirst = ReadRegister(NvGpuEngine3dReg.IndexBatchFirst);
|
|
|
|
int IndexCount = ReadRegister(NvGpuEngine3dReg.IndexBatchCount);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
GalIndexFormat IndexFormat = (GalIndexFormat)IndexEntryFmt;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
int IndexEntrySize = 1 << IndexEntryFmt;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
if (IndexEntrySize > 4)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
|
|
|
throw new InvalidOperationException();
|
|
|
|
}
|
|
|
|
|
2018-06-18 15:59:03 +02:00
|
|
|
if (IndexCount != 0)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
2018-06-24 02:39:25 +02:00
|
|
|
int IbSize = IndexCount * IndexEntrySize;
|
2018-06-09 02:15:56 +02:00
|
|
|
|
2018-07-08 21:55:15 +02:00
|
|
|
bool IboCached = Gpu.Renderer.Rasterizer.IsIboCached(IboKey, (uint)IbSize);
|
2018-06-09 02:15:56 +02:00
|
|
|
|
2018-07-08 21:55:15 +02:00
|
|
|
if (!IboCached || Vmm.IsRegionModified(IboKey, (uint)IbSize, NvGpuBufferType.Index))
|
2018-06-09 02:15:56 +02:00
|
|
|
{
|
|
|
|
byte[] Data = Vmm.ReadBytes(IndexPosition, (uint)IbSize);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-07-08 21:55:15 +02:00
|
|
|
Gpu.Renderer.Rasterizer.CreateIbo(IboKey, Data);
|
2018-06-09 02:15:56 +02:00
|
|
|
}
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-07-10 04:01:59 +02:00
|
|
|
Gpu.Renderer.Rasterizer.SetIndexArray(IbSize, IndexFormat);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
List<GalVertexAttrib>[] Attribs = new List<GalVertexAttrib>[32];
|
|
|
|
|
|
|
|
for (int Attr = 0; Attr < 16; Attr++)
|
|
|
|
{
|
|
|
|
int Packed = ReadRegister(NvGpuEngine3dReg.VertexAttribNFormat + Attr);
|
|
|
|
|
|
|
|
int ArrayIndex = Packed & 0x1f;
|
|
|
|
|
|
|
|
if (Attribs[ArrayIndex] == null)
|
|
|
|
{
|
|
|
|
Attribs[ArrayIndex] = new List<GalVertexAttrib>();
|
|
|
|
}
|
|
|
|
|
|
|
|
Attribs[ArrayIndex].Add(new GalVertexAttrib(
|
2018-04-29 22:58:38 +02:00
|
|
|
Attr,
|
2018-04-08 21:17:35 +02:00
|
|
|
((Packed >> 6) & 0x1) != 0,
|
|
|
|
(Packed >> 7) & 0x3fff,
|
|
|
|
(GalVertexAttribSize)((Packed >> 21) & 0x3f),
|
|
|
|
(GalVertexAttribType)((Packed >> 27) & 0x7),
|
|
|
|
((Packed >> 31) & 0x1) != 0));
|
|
|
|
}
|
|
|
|
|
2018-06-09 02:15:56 +02:00
|
|
|
int VertexFirst = ReadRegister(NvGpuEngine3dReg.VertexArrayFirst);
|
|
|
|
int VertexCount = ReadRegister(NvGpuEngine3dReg.VertexArrayCount);
|
|
|
|
|
|
|
|
int PrimCtrl = ReadRegister(NvGpuEngine3dReg.VertexBeginGl);
|
|
|
|
|
2018-04-08 21:17:35 +02:00
|
|
|
for (int Index = 0; Index < 32; Index++)
|
|
|
|
{
|
2018-06-09 02:15:56 +02:00
|
|
|
if (Attribs[Index] == null)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2018-04-26 04:11:26 +02:00
|
|
|
|
2018-04-08 21:17:35 +02:00
|
|
|
int Control = ReadRegister(NvGpuEngine3dReg.VertexArrayNControl + Index * 4);
|
|
|
|
|
|
|
|
bool Enable = (Control & 0x1000) != 0;
|
|
|
|
|
2018-04-29 22:58:38 +02:00
|
|
|
long VertexPosition = MakeInt64From2xInt32(NvGpuEngine3dReg.VertexArrayNAddress + Index * 4);
|
2018-06-02 05:50:56 +02:00
|
|
|
long VertexEndPos = MakeInt64From2xInt32(NvGpuEngine3dReg.VertexArrayNEndAddr + Index * 2);
|
2018-04-29 22:58:38 +02:00
|
|
|
|
2018-04-08 21:17:35 +02:00
|
|
|
if (!Enable)
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2018-07-08 21:55:15 +02:00
|
|
|
long VboKey = Vmm.GetPhysicalAddress(VertexPosition);
|
|
|
|
|
2018-04-29 22:58:38 +02:00
|
|
|
int Stride = Control & 0xfff;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-06-27 06:32:28 +02:00
|
|
|
long VbSize = (VertexEndPos - VertexPosition) + 1;
|
2018-04-29 22:58:38 +02:00
|
|
|
|
2018-07-08 21:55:15 +02:00
|
|
|
bool VboCached = Gpu.Renderer.Rasterizer.IsVboCached(VboKey, VbSize);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-07-08 21:55:15 +02:00
|
|
|
if (!VboCached || Vmm.IsRegionModified(VboKey, VbSize, NvGpuBufferType.Vertex))
|
2018-06-09 02:15:56 +02:00
|
|
|
{
|
|
|
|
byte[] Data = Vmm.ReadBytes(VertexPosition, VbSize);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-07-08 21:55:15 +02:00
|
|
|
Gpu.Renderer.Rasterizer.CreateVbo(VboKey, Data);
|
2018-06-09 02:15:56 +02:00
|
|
|
}
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-07-10 04:01:59 +02:00
|
|
|
Gpu.Renderer.Rasterizer.SetVertexArray(Stride, VboKey, Attribs[Index].ToArray());
|
2018-06-09 02:15:56 +02:00
|
|
|
}
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-06-09 02:15:56 +02:00
|
|
|
GalPrimitiveType PrimType = (GalPrimitiveType)(PrimCtrl & 0xffff);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
2018-06-09 02:15:56 +02:00
|
|
|
if (IndexCount != 0)
|
|
|
|
{
|
2018-06-29 01:48:18 +02:00
|
|
|
int VertexBase = ReadRegister(NvGpuEngine3dReg.VertexArrayElemBase);
|
|
|
|
|
2018-07-08 21:55:15 +02:00
|
|
|
Gpu.Renderer.Rasterizer.DrawElements(IboKey, IndexFirst, VertexBase, PrimType);
|
2018-06-09 02:15:56 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2018-06-24 02:39:25 +02:00
|
|
|
Gpu.Renderer.Rasterizer.DrawArrays(VertexFirst, VertexCount, PrimType);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
private void QueryControl(NvGpuVmm Vmm, NvGpuPBEntry PBEntry)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
long Position = MakeInt64From2xInt32(NvGpuEngine3dReg.QueryAddress);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
int Seq = Registers[(int)NvGpuEngine3dReg.QuerySequence];
|
|
|
|
int Ctrl = Registers[(int)NvGpuEngine3dReg.QueryControl];
|
2018-04-08 21:17:35 +02:00
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
int Mode = Ctrl & 3;
|
|
|
|
|
|
|
|
if (Mode == 0)
|
|
|
|
{
|
|
|
|
//Write mode.
|
|
|
|
Vmm.WriteInt32(Position, Seq);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
WriteRegister(PBEntry);
|
|
|
|
}
|
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
private void CbData(NvGpuVmm Vmm, NvGpuPBEntry PBEntry)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
long Position = MakeInt64From2xInt32(NvGpuEngine3dReg.ConstBufferAddress);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
int Offset = ReadRegister(NvGpuEngine3dReg.ConstBufferOffset);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
foreach (int Arg in PBEntry.Arguments)
|
|
|
|
{
|
|
|
|
Vmm.WriteInt32(Position + Offset, Arg);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
Offset += 4;
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
|
|
|
|
WriteRegister(NvGpuEngine3dReg.ConstBufferOffset, Offset);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
private void CbBind(NvGpuVmm Vmm, NvGpuPBEntry PBEntry)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
int Stage = (PBEntry.Method - 0x904) >> 3;
|
|
|
|
|
2018-04-08 21:17:35 +02:00
|
|
|
int Index = PBEntry.Arguments[0];
|
|
|
|
|
|
|
|
bool Enabled = (Index & 1) != 0;
|
|
|
|
|
|
|
|
Index = (Index >> 4) & 0x1f;
|
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
long Position = MakeInt64From2xInt32(NvGpuEngine3dReg.ConstBufferAddress);
|
2018-04-08 21:17:35 +02:00
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
ConstBuffers[Stage][Index].Position = Position;
|
|
|
|
ConstBuffers[Stage][Index].Enabled = Enabled;
|
2018-04-08 21:17:35 +02:00
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
ConstBuffers[Stage][Index].Size = ReadRegister(NvGpuEngine3dReg.ConstBufferSize);
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
|
2018-07-05 20:47:29 +02:00
|
|
|
private float GetFlipSign(NvGpuEngine3dReg Reg)
|
|
|
|
{
|
|
|
|
return MathF.Sign(ReadRegisterFloat(Reg));
|
|
|
|
}
|
|
|
|
|
2018-04-08 21:17:35 +02:00
|
|
|
private long MakeInt64From2xInt32(NvGpuEngine3dReg Reg)
|
|
|
|
{
|
|
|
|
return
|
|
|
|
(long)Registers[(int)Reg + 0] << 32 |
|
|
|
|
(uint)Registers[(int)Reg + 1];
|
|
|
|
}
|
|
|
|
|
NvServices refactoring (#120)
* Initial implementation of NvMap/NvHostCtrl
* More work on NvHostCtrl
* Refactoring of nvservices, move GPU Vmm, make Vmm per-process, refactor most gpu devices, move Gpu to Core, fix CbBind
* Implement GetGpuTime, support CancelSynchronization, fix issue on InsertWaitingMutex, proper double buffering support (again, not working properly for commercial games, only hb)
* Try to fix perf regression reading/writing textures, moved syncpts and events to a UserCtx class, delete global state when the process exits, other minor tweaks
* Remove now unused code, add comment about probably wrong result codes
2018-05-07 20:53:23 +02:00
|
|
|
private void WriteRegister(NvGpuPBEntry PBEntry)
|
2018-04-08 21:17:35 +02:00
|
|
|
{
|
|
|
|
int ArgsCount = PBEntry.Arguments.Count;
|
|
|
|
|
|
|
|
if (ArgsCount > 0)
|
|
|
|
{
|
|
|
|
Registers[PBEntry.Method] = PBEntry.Arguments[ArgsCount - 1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private int ReadRegister(NvGpuEngine3dReg Reg)
|
|
|
|
{
|
|
|
|
return Registers[(int)Reg];
|
|
|
|
}
|
|
|
|
|
2018-07-05 20:47:29 +02:00
|
|
|
private float ReadRegisterFloat(NvGpuEngine3dReg Reg)
|
|
|
|
{
|
|
|
|
return BitConverter.Int32BitsToSingle(ReadRegister(Reg));
|
|
|
|
}
|
|
|
|
|
2018-04-08 21:17:35 +02:00
|
|
|
private void WriteRegister(NvGpuEngine3dReg Reg, int Value)
|
|
|
|
{
|
|
|
|
Registers[(int)Reg] = Value;
|
|
|
|
}
|
2018-04-13 20:12:58 +02:00
|
|
|
|
|
|
|
public bool IsFrameBufferPosition(long Position)
|
|
|
|
{
|
|
|
|
return FrameBuffers.Contains(Position);
|
|
|
|
}
|
2018-04-08 21:17:35 +02:00
|
|
|
}
|
|
|
|
}
|