Skip to content
Permalink
Browse files
Merge pull request #9742 from Pokechu22/sw-resolution
Software: Fix bad backbuffer size
  • Loading branch information
JMC47 committed Jun 23, 2021
2 parents 63c028c + 4a4244f commit 46120a6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
@@ -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:
@@ -27,6 +27,8 @@ class SWRenderer final : public Renderer
std::unique_ptr<AbstractFramebuffer>
CreateFramebuffer(AbstractTexture* color_attachment, AbstractTexture* depth_attachment) override;

void BindBackbuffer(const ClearColor& clear_color = {}) override;

std::unique_ptr<AbstractShader> CreateShaderFromSource(ShaderStage stage,
std::string_view source) override;
std::unique_ptr<AbstractShader> CreateShaderFromBinary(ShaderStage stage, const void* data,

0 comments on commit 46120a6

Please sign in to comment.