From 601aac2a26c38086d33709f53c71bb0c939a7d6c Mon Sep 17 00:00:00 2001 From: GPUCode Date: Tue, 4 Oct 2022 22:52:42 +0300 Subject: [PATCH] renderer_opengl: Unbind unused framebuffer targets * Fixes graphical glitches in many games for some reason --- src/video_core/renderer_opengl/gl_texture_runtime.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/video_core/renderer_opengl/gl_texture_runtime.cpp b/src/video_core/renderer_opengl/gl_texture_runtime.cpp index a6bd52ab8..ae6ed6f84 100644 --- a/src/video_core/renderer_opengl/gl_texture_runtime.cpp +++ b/src/video_core/renderer_opengl/gl_texture_runtime.cpp @@ -311,11 +311,15 @@ void TextureRuntime::BindFramebuffer(GLenum target, GLint level, GLenum textarge case VideoCore::SurfaceType::Color: case VideoCore::SurfaceType::Texture: glFramebufferTexture2D(target, GL_COLOR_ATTACHMENT0, textarget, texture.handle, level); + glFramebufferTexture2D(target, GL_DEPTH_STENCIL_ATTACHMENT, textarget, 0, 0); break; case VideoCore::SurfaceType::Depth: + glFramebufferTexture2D(target, GL_COLOR_ATTACHMENT0, textarget, 0, 0); glFramebufferTexture2D(target, GL_DEPTH_ATTACHMENT, textarget, texture.handle, level); + glFramebufferTexture2D(target, GL_STENCIL_ATTACHMENT, textarget, 0, 0); break; case VideoCore::SurfaceType::DepthStencil: + glFramebufferTexture2D(target, GL_COLOR_ATTACHMENT0, textarget, 0, 0); glFramebufferTexture2D(target, GL_DEPTH_STENCIL_ATTACHMENT, textarget, texture.handle, level); break; default: