SDL: GLES2 batching: probably need to check for blendMode changes

From ab3cfc4c2ae9c07cc44ea0b948bac4d5ed28b590 Mon Sep 17 00:00:00 2001
From: Sylvain <[EMAIL REDACTED]>
Date: Thu, 23 Sep 2021 22:32:29 +0200
Subject: [PATCH] GLES2 batching: probably need to check for blendMode changes

---
 src/render/opengles2/SDL_render_gles2.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c
index b3df615c27..2ecb9c8279 100644
--- a/src/render/opengles2/SDL_render_gles2.c
+++ b/src/render/opengles2/SDL_render_gles2.c
@@ -1201,6 +1201,7 @@ GLES2_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver
                 /* as long as we have the same copy command in a row, with the
                    same texture, we can combine them all into a single draw call. */
                 SDL_Texture *thistexture = cmd->data.draw.texture;
+                SDL_BlendMode thisblend = cmd->data.draw.blend;
                 const SDL_RenderCommandType thiscmdtype = cmd->command;
                 SDL_RenderCommand *finalcmd = cmd;
                 SDL_RenderCommand *nextcmd = cmd->next;
@@ -1213,8 +1214,8 @@ GLES2_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver
                         if ((nextcmdtype != SDL_RENDERCMD_SETDRAWCOLOR) && (nextcmdtype != SDL_RENDERCMD_NO_OP)) {
                             break;  /* can't go any further on this draw call, different render command up next. */
                         }
-                    } else if (nextcmd->data.draw.texture != thistexture) {
-                        break;  /* can't go any further on this draw call, different texture copy up next. */
+                    } else if (nextcmd->data.draw.texture != thistexture || nextcmd->data.draw.blend != thisblend) {
+                        break;  /* can't go any further on this draw call, different texture/blendmode copy up next. */
                     } else {
                         finalcmd = nextcmd;  /* we can combine copy operations here. Mark this one as the furthest okay command. */
                         count += cmd->data.draw.count;