summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/Software/SWRenderer.cpp
diff options
context:
space:
mode:
authorPokechu22 <Pokechu022@gmail.com>2021-05-22 19:58:27 -0700
committerPokechu22 <Pokechu022@gmail.com>2021-05-24 12:16:39 -0700
commit4a4244f04d80dbca76aa560debe139aa6121125b (patch)
tree9df15f5e8a313fe74a9a66d6332ed1b2340702c6 /Source/Core/VideoBackends/Software/SWRenderer.cpp
parent51671921c4c010476ec1150703d7d62bfcde630c (diff)
Software: Fix bad backbuffer size
MAX_XFB_WIDTH/HEIGHT are the largest XFB sizes seen in practice, but do not make sense to use for the backbuffer size, which should be the size of the window. The old code created screenshots with a size of 720x540 on NTSC games when "Dump Frames at Internal Resolution" is unchecked; now, the window size is used.
Diffstat (limited to 'Source/Core/VideoBackends/Software/SWRenderer.cpp')
-rw-r--r--Source/Core/VideoBackends/Software/SWRenderer.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/Source/Core/VideoBackends/Software/SWRenderer.cpp b/Source/Core/VideoBackends/Software/SWRenderer.cpp
index 51433d311f..cde409d321 100644
--- a/Source/Core/VideoBackends/Software/SWRenderer.cpp
+++ b/Source/Core/VideoBackends/Software/SWRenderer.cpp
@@ -27,7 +27,8 @@
namespace SW
{
SWRenderer::SWRenderer(std::unique_ptr<SWOGLWindow> window)
- : ::Renderer(static_cast<int>(MAX_XFB_WIDTH), static_cast<int>(MAX_XFB_HEIGHT), 1.0f,
+ : ::Renderer(static_cast<int>(std::max(window->GetContext()->GetBackBufferWidth(), 1u)),
+ static_cast<int>(std::max(window->GetContext()->GetBackBufferHeight(), 1u)), 1.0f,
AbstractTextureFormat::RGBA8),
m_window(std::move(window))
{
@@ -56,6 +57,18 @@ SWRenderer::CreateFramebuffer(AbstractTexture* color_attachment, AbstractTexture
static_cast<SWTexture*>(depth_attachment));
}
+void SWRenderer::BindBackbuffer(const ClearColor& clear_color)
+{
+ // Look for framebuffer resizes
+ if (!m_surface_resized.TestAndClear())
+ return;
+
+ GLContext* context = m_window->GetContext();
+ context->Update();
+ m_backbuffer_width = context->GetBackBufferWidth();
+ m_backbuffer_height = context->GetBackBufferHeight();
+}
+
class SWShader final : public AbstractShader
{
public: