gl/gles/gles2 render: fix SDL_RenderClear being affected by the clip rect in some situations.
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
diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c
index c32f2dc..d3ad24f 100644
--- a/src/render/opengl/SDL_render_gl.c
+++ b/src/render/opengl/SDL_render_gl.c
@@ -1166,9 +1166,9 @@ GL_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic
data->drawstate.clear_color = color;
}
- if (data->drawstate.cliprect_enabled) {
+ if (data->drawstate.cliprect_enabled || data->drawstate.cliprect_enabled_dirty) {
data->glDisable(GL_SCISSOR_TEST);
- data->drawstate.cliprect_enabled_dirty = SDL_TRUE;
+ data->drawstate.cliprect_enabled_dirty = data->drawstate.cliprect_enabled;
}
data->glClear(GL_COLOR_BUFFER_BIT);
diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c
index 95c8bb9..dd5610b 100644
--- a/src/render/opengles/SDL_render_gles.c
+++ b/src/render/opengles/SDL_render_gles.c
@@ -866,9 +866,9 @@ GLES_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vert
data->drawstate.clear_color = color;
}
- if (data->drawstate.cliprect_enabled) {
+ if (data->drawstate.cliprect_enabled || data->drawstate.cliprect_enabled_dirty) {
data->glDisable(GL_SCISSOR_TEST);
- data->drawstate.cliprect_enabled_dirty = SDL_TRUE;
+ data->drawstate.cliprect_enabled_dirty = data->drawstate.cliprect_enabled;
}
data->glClear(GL_COLOR_BUFFER_BIT);
diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c
index 028227f..e035c1f 100644
--- a/src/render/opengles2/SDL_render_gles2.c
+++ b/src/render/opengles2/SDL_render_gles2.c
@@ -1277,9 +1277,9 @@ GLES2_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver
data->drawstate.clear_color = color;
}
- if (data->drawstate.cliprect_enabled) {
+ if (data->drawstate.cliprect_enabled || data->drawstate.cliprect_enabled_dirty) {
data->glDisable(GL_SCISSOR_TEST);
- data->drawstate.cliprect_enabled_dirty = SDL_TRUE;
+ data->drawstate.cliprect_enabled_dirty = data->drawstate.cliprect_enabled;
}
data->glClear(GL_COLOR_BUFFER_BIT);