render: Mark viewport/cliprect dirty when window is resized. Fixes #4751.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c
index d7f7a44..758166a 100644
--- a/src/render/opengl/SDL_render_gl.c
+++ b/src/render/opengl/SDL_render_gl.c
@@ -1279,7 +1279,14 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic
data->drawstate.target = renderer->target;
if (!data->drawstate.target) {
- SDL_GL_GetDrawableSize(renderer->window, &data->drawstate.drawablew, &data->drawstate.drawableh);
+ int w, h;
+ SDL_GL_GetDrawableSize(renderer->window, &w, &h);
+ if ((w != data->drawstate.drawablew) || (h != data->drawstate.drawableh)) {
+ data->drawstate.viewport_dirty = SDL_TRUE; // if the window dimensions changed, invalidate the current viewport, etc.
+ data->drawstate.cliprect_dirty = SDL_TRUE;
+ data->drawstate.drawablew = w;
+ data->drawstate.drawableh = h;
+ }
}
diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c
index 017229e..c0a2ce9 100644
--- a/src/render/opengles/SDL_render_gles.c
+++ b/src/render/opengles/SDL_render_gles.c
@@ -934,7 +934,15 @@ GLES_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vert
data->drawstate.target = renderer->target;
if (!renderer->target) {
- SDL_GL_GetDrawableSize(renderer->window, &data->drawstate.drawablew, &data->drawstate.drawableh);
+ int w, h;
+ SDL_GL_GetDrawableSize(renderer->window, &w, &h);
+ if ((w != data->drawstate.drawablew) || (h != data->drawstate.drawableh)) {
+ data->drawstate.viewport_dirty = SDL_TRUE; // if the window dimensions changed, invalidate the current viewport, etc.
+ data->drawstate.cliprect_dirty = SDL_TRUE;
+ data->drawstate.drawablew = w;
+ data->drawstate.drawableh = h;
+ }
+
}
while (cmd) {
diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c
index 73cca1b..7ea703d 100644
--- a/src/render/opengles2/SDL_render_gles2.c
+++ b/src/render/opengles2/SDL_render_gles2.c
@@ -1270,7 +1270,14 @@ GLES2_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver
data->drawstate.target = renderer->target;
if (!data->drawstate.target) {
- SDL_GL_GetDrawableSize(renderer->window, &data->drawstate.drawablew, &data->drawstate.drawableh);
+ int w, h;
+ SDL_GL_GetDrawableSize(renderer->window, &w, &h);
+ if ((w != data->drawstate.drawablew) || (h != data->drawstate.drawableh)) {
+ data->drawstate.viewport_dirty = SDL_TRUE; // if the window dimensions changed, invalidate the current viewport, etc.
+ data->drawstate.cliprect_dirty = SDL_TRUE;
+ data->drawstate.drawablew = w;
+ data->drawstate.drawableh = h;
+ }
}
/* upload the new VBO data for this set of commands. */
diff --git a/src/render/vitagxm/SDL_render_vita_gxm.c b/src/render/vitagxm/SDL_render_vita_gxm.c
index 67a834b..bd9230f 100644
--- a/src/render/vitagxm/SDL_render_vita_gxm.c
+++ b/src/render/vitagxm/SDL_render_vita_gxm.c
@@ -987,7 +987,15 @@ VITA_GXM_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *
data->drawstate.target = renderer->target;
if (!data->drawstate.target) {
- SDL_GL_GetDrawableSize(renderer->window, &data->drawstate.drawablew, &data->drawstate.drawableh);
+ int w, h;
+ SDL_GL_GetDrawableSize(renderer->window, &w, &h);
+ if ((w != data->drawstate.drawablew) || (h != data->drawstate.drawableh)) {
+ data->drawstate.viewport_dirty = SDL_TRUE; // if the window dimensions changed, invalidate the current viewport, etc.
+ data->drawstate.cliprect_dirty = SDL_TRUE;
+ data->drawstate.drawablew = w;
+ data->drawstate.drawableh = h;
+ }
+
}
while (cmd) {