summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/RenderBase.cpp
diff options
context:
space:
mode:
authorTechjar <tecknojar@gmail.com>2019-06-15 07:05:57 -0400
committerTechjar <tecknojar@gmail.com>2019-06-15 07:12:17 -0400
commit56c818b3d86507a2653ddbe939ce9c241d77c855 (patch)
tree85aa6df3bb9d9a623ac6f43b527a15261037cddf /Source/Core/VideoCommon/RenderBase.cpp
parentc34388f75bfe6fc153f7ab40323456217f2ce092 (diff)
VideoCommon/RenderBase: Reset scissor rectangle after ImGui rendering
This fixes the problem where OBS game capture only grabs the region inside an ImGui window whenever one is open, when using the OpenGL backend. Shouldn't have any negative effects, as the scissor would've been something completely arbitrary anyways. This may affect other capture software that uses the same hooking method, but I've only tested OBS.
Diffstat (limited to 'Source/Core/VideoCommon/RenderBase.cpp')
-rw-r--r--Source/Core/VideoCommon/RenderBase.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp
index 180f81632f..78e8234a81 100644
--- a/Source/Core/VideoCommon/RenderBase.cpp
+++ b/Source/Core/VideoCommon/RenderBase.cpp
@@ -1148,6 +1148,15 @@ void Renderer::DrawImGui()
base_index += cmd.ElemCount;
}
}
+
+ // Some capture software (such as OBS) hooks SwapBuffers and uses glBlitFramebuffer to copy our
+ // back buffer just before swap. Because glBlitFramebuffer honors the scissor test, the capture
+ // itself will be clipped to whatever bounds were last set by ImGui, resulting in a rather useless
+ // capture whenever any ImGui windows are open. We'll reset the scissor rectangle to the entire
+ // viewport here to avoid this problem.
+ SetScissorRect(ConvertFramebufferRectangle(
+ MathUtil::Rectangle<int>(0, 0, m_backbuffer_width, m_backbuffer_height),
+ m_current_framebuffer));
}
std::unique_lock<std::mutex> Renderer::GetImGuiLock()