Implement multiple rendertarget attachments and depth writting (#375)

* Add depth writting

* Implement multiple attachments

* Address feedback
This commit is contained in:
ReinUsesLisp 2018-08-23 02:07:23 -03:00 committed by gdkchan
parent 9977acad0f
commit 624e813cd3
7 changed files with 201 additions and 29 deletions

View file

@ -102,10 +102,15 @@ namespace Ryujinx.HLE.Gpu.Engines
SetAlphaBlending(State);
SetPrimitiveRestart(State);
//Enabling multiple framebuffer attachments cause graphics reggresions
SetFrameBuffer(Vmm, 0);
for (int FbIndex = 0; FbIndex < 8; FbIndex++)
{
SetFrameBuffer(Vmm, 0);
}
SetZeta(Vmm);
SetRenderTargets();
long[] Keys = UploadShaders(Vmm);
Gpu.Renderer.Shader.BindProgram();
@ -415,6 +420,33 @@ namespace Ryujinx.HLE.Gpu.Engines
}
}
private void SetRenderTargets()
{
bool SeparateFragData = (ReadRegister(NvGpuEngine3dReg.RTSeparateFragData) & 1) != 0;
if (SeparateFragData)
{
uint Control = (uint)(ReadRegister(NvGpuEngine3dReg.RTControl));
uint Count = Control & 0xf;
int[] Map = new int[Count];
for (int i = 0; i < Count; i++)
{
int Shift = 4 + i * 3;
Map[i] = (int)((Control >> Shift) & 7);
}
Gpu.Renderer.FrameBuffer.SetMap(Map);
}
else
{
Gpu.Renderer.FrameBuffer.SetMap(null);
}
}
private void UploadTextures(NvGpuVmm Vmm, GalPipelineState State, long[] Keys)
{
long BaseShPosition = MakeInt64From2xInt32(NvGpuEngine3dReg.ShaderAddress);
@ -801,4 +833,4 @@ namespace Ryujinx.HLE.Gpu.Engines
return Vmm.IsRegionModified(Key, Size, Type);
}
}
}
}