diff options
author | gdkchan <gab.dark.100@gmail.com> | 2020-03-29 09:48:39 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-29 23:48:39 +1100 |
commit | b18ef8e3a00980595f45c7fe184dcb160dcc3cb9 (patch) | |
tree | 9d9b3fea4d7822d548878988c12c18e23a72bb52 /Ryujinx.Graphics.OpenGL/Framebuffer.cs | |
parent | 5c1757f7c29fc06577b5fc551dd3d76b12b281d3 (diff) |
Workaround for AMD and Intel view format bug (#1050)
* Workaround for Intel view format bug
* Dispose of the intermmediate texture aswell
* Apply workaround on AMD aswell
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/Framebuffer.cs')
-rw-r--r-- | Ryujinx.Graphics.OpenGL/Framebuffer.cs | 37 |
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]; |