From 32125cf1817b57f0b6eb390409ba7167a1671cf7 Mon Sep 17 00:00:00 2001 From: Stenzek Date: Thu, 23 Nov 2017 16:53:44 +1000 Subject: OGL: Fix headless frame dumping Also skips swapping the window system buffers in headless mode, as there may not be a surface which can be swapped in the first place. Instead, we call glFlush() at the end of a frame in this case. --- Source/Core/VideoCommon/RenderBase.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/RenderBase.cpp') diff --git a/Source/Core/VideoCommon/RenderBase.cpp b/Source/Core/VideoCommon/RenderBase.cpp index 4a46475344..2edd6dcfd5 100644 --- a/Source/Core/VideoCommon/RenderBase.cpp +++ b/Source/Core/VideoCommon/RenderBase.cpp @@ -94,6 +94,7 @@ Renderer::Renderer(int backbuffer_width, int backbuffer_height) if (SConfig::GetInstance().bWii) m_aspect_wide = Config::Get(Config::SYSCONF_WIDESCREEN); + m_surface_handle = Host_GetRenderHandle(); m_last_host_config_bits = ShaderHostConfig::GetCurrent().bits; } @@ -400,6 +401,11 @@ float Renderer::CalculateDrawAspectRatio() const } } +bool Renderer::IsHeadless() const +{ + return !m_surface_handle; +} + std::tuple Renderer::ScaleToDisplayAspectRatio(const int width, const int height) const { @@ -711,7 +717,7 @@ void Renderer::DoDumpFrame() void Renderer::UpdateFrameDumpTexture() { int target_width, target_height; - if (!g_ActiveConfig.bInternalResolutionFrameDumps) + if (!g_ActiveConfig.bInternalResolutionFrameDumps && !IsHeadless()) { auto target_rect = GetTargetRectangle(); target_width = target_rect.GetWidth(); -- cgit v1.2.3