From b786c100133aea233f349979def7e3633b092c2d Mon Sep 17 00:00:00 2001 From: Eric Wasylishen Date: Fri, 26 Nov 2021 19:45:16 -0700 Subject: [PATCH] SDL_render_gl.c: GL_RunCommandQueue: always set viewport_dirty on macOS Without this, moving the window changes the viewport and causes contents to render stretched. Fixes #1504 --- src/render/opengl/SDL_render_gl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c index 07280865e..dbfcc414c 100644 --- a/src/render/opengl/SDL_render_gl.c +++ b/src/render/opengl/SDL_render_gl.c @@ -1169,6 +1169,12 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic } } +#ifdef __MACOSX__ + // On macOS, moving the window seems to invalidate the OpenGL viewport state, + // so don't bother trying to persist it across frames; always reset it. + // Workaround for: https://github.com/libsdl-org/SDL/issues/1504 + data->drawstate.viewport_dirty = SDL_TRUE; +#endif while (cmd) { switch (cmd->command) {