aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.OpenGL/Framebuffer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/Framebuffer.cs')
-rw-r--r--Ryujinx.Graphics.OpenGL/Framebuffer.cs37
1 files changed, 32 insertions, 5 deletions
diff --git a/Ryujinx.Graphics.OpenGL/Framebuffer.cs b/Ryujinx.Graphics.OpenGL/Framebuffer.cs
index d416bd03..23f015b1 100644
--- a/Ryujinx.Graphics.OpenGL/Framebuffer.cs
+++ b/Ryujinx.Graphics.OpenGL/Framebuffer.cs
@@ -10,9 +10,13 @@ namespace Ryujinx.Graphics.OpenGL
private FramebufferAttachment _lastDsAttachment;
+ private readonly TextureView[] _colors;
+
public Framebuffer()
{
Handle = GL.GenFramebuffer();
+
+ _colors = new TextureView[8];
}
public void Bind()
@@ -22,11 +26,19 @@ namespace Ryujinx.Graphics.OpenGL
public void AttachColor(int index, TextureView color)
{
- GL.FramebufferTexture(
- FramebufferTarget.Framebuffer,
- FramebufferAttachment.ColorAttachment0 + index,
- color?.Handle ?? 0,
- 0);
+ FramebufferAttachment attachment = FramebufferAttachment.ColorAttachment0 + index;
+
+ if (HwCapabilities.Vendor == HwCapabilities.GpuVendor.Amd ||
+ HwCapabilities.Vendor == HwCapabilities.GpuVendor.Intel)
+ {
+ GL.FramebufferTexture(FramebufferTarget.Framebuffer, attachment, color?.GetIncompatibleFormatViewHandle() ?? 0, 0);
+
+ _colors[index] = color;
+ }
+ else
+ {
+ GL.FramebufferTexture(FramebufferTarget.Framebuffer, attachment, color?.Handle ?? 0, 0);
+ }
}
public void AttachDepthStencil(TextureView depthStencil)
@@ -68,6 +80,21 @@ namespace Ryujinx.Graphics.OpenGL
}
}
+ public void SignalModified()
+ {
+ if (HwCapabilities.Vendor == HwCapabilities.GpuVendor.Amd ||
+ HwCapabilities.Vendor == HwCapabilities.GpuVendor.Intel)
+ {
+ for (int i = 0; i < 8; i++)
+ {
+ if (_colors[i] != null)
+ {
+ _colors[i].SignalModified();
+ }
+ }
+ }
+ }
+
public void SetDrawBuffers(int colorsCount)
{
DrawBuffersEnum[] drawBuffers = new DrawBuffersEnum[colorsCount];