Commit b0eef52fe10470dcfa026f46025d19107a9b3b90

Sylvain 2021-09-23T22:32:29

GLES2 batching: probably need to check for blendMode changes

diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c
index f48691a..c086c27 100644
--- a/src/render/opengles2/SDL_render_gles2.c
+++ b/src/render/opengles2/SDL_render_gles2.c
@@ -1199,6 +1199,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;
@@ -1211,8 +1212,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;