aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.OpenGL/Framebuffer.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-01-26 18:44:07 -0300
committerGitHub <noreply@github.com>2021-01-27 08:44:07 +1100
commitcaf049ed15f1c22d55aacfab79019538b2587e11 (patch)
tree33bf4b410a901fd8de49b79b73161976453e4837 /Ryujinx.Graphics.OpenGL/Framebuffer.cs
parentd6bd0470fb0507cc9c6069e577ae2814e614265b (diff)
Avoid some redundant GL calls (#1958)
Diffstat (limited to 'Ryujinx.Graphics.OpenGL/Framebuffer.cs')
-rw-r--r--Ryujinx.Graphics.OpenGL/Framebuffer.cs11
1 files changed, 9 insertions, 2 deletions
diff --git a/Ryujinx.Graphics.OpenGL/Framebuffer.cs b/Ryujinx.Graphics.OpenGL/Framebuffer.cs
index 015b0ec0..66bf892b 100644
--- a/Ryujinx.Graphics.OpenGL/Framebuffer.cs
+++ b/Ryujinx.Graphics.OpenGL/Framebuffer.cs
@@ -2,6 +2,7 @@ using OpenTK.Graphics.OpenGL;
using Ryujinx.Graphics.GAL;
using Ryujinx.Graphics.OpenGL.Image;
using System;
+using System.Runtime.CompilerServices;
namespace Ryujinx.Graphics.OpenGL
{
@@ -29,21 +30,27 @@ namespace Ryujinx.Graphics.OpenGL
return Handle;
}
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void AttachColor(int index, TextureView color)
{
+ if (_colors[index] == color)
+ {
+ return;
+ }
+
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);
}
+
+ _colors[index] = color;
}
public void AttachDepthStencil(TextureView depthStencil)