Commit b786c100133aea233f349979def7e3633b092c2d

Eric Wasylishen 2021-11-26T19:45:16

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c
index 0728086..dbfcc41 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) {