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

@ -21,18 +21,6 @@ namespace Ryujinx.Graphics.Gal.OpenGL
}
}
private static readonly DrawBuffersEnum[] DrawBuffers = new DrawBuffersEnum[]
{
DrawBuffersEnum.ColorAttachment0,
DrawBuffersEnum.ColorAttachment1,
DrawBuffersEnum.ColorAttachment2,
DrawBuffersEnum.ColorAttachment3,
DrawBuffersEnum.ColorAttachment4,
DrawBuffersEnum.ColorAttachment5,
DrawBuffersEnum.ColorAttachment6,
DrawBuffersEnum.ColorAttachment7,
};
private const int NativeWidth = 1280;
private const int NativeHeight = 720;
@ -194,6 +182,25 @@ namespace Ryujinx.Graphics.Gal.OpenGL
ReadTex = RawTex;
}
public void SetMap(int[] Map)
{
if (Map != null && Map.Length > 0)
{
DrawBuffersEnum[] Mode = new DrawBuffersEnum[Map.Length];
for (int i = 0; i < Map.Length; i++)
{
Mode[i] = DrawBuffersEnum.ColorAttachment0 + Map[i];
}
GL.DrawBuffers(Mode.Length, Mode);
}
else
{
GL.DrawBuffer(DrawBufferMode.ColorAttachment0);
}
}
public void SetTransform(bool FlipX, bool FlipY, int Top, int Left, int Right, int Bottom)
{
this.FlipX = FlipX;
@ -421,8 +428,6 @@ namespace Ryujinx.Graphics.Gal.OpenGL
}
GL.BindFramebuffer(FramebufferTarget.DrawFramebuffer, DummyFrameBuffer);
GL.DrawBuffers(8, DrawBuffers);
}
private void Attach(ref int OldHandle, int NewHandle, FramebufferAttachment FbAttachment)