Commit d4df5d33c5f8bd9da8553fa7263240a1e1cc59cd

Sylvain 2021-11-15T09:43:44

GLES2: prevent batching if blend mode changes (see bug #4964)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c
index 7a39c72..df6b9fd 100644
--- a/src/render/opengles2/SDL_render_gles2.c
+++ b/src/render/opengles2/SDL_render_gles2.c
@@ -1144,6 +1144,7 @@ GLES2_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver
                         /* let's group non joined lines */
                         SDL_RenderCommand *finalcmd = cmd;
                         SDL_RenderCommand *nextcmd = cmd->next;
+                        SDL_BlendMode thisblend = cmd->data.draw.blend;
 
                         while (nextcmd != NULL) {
                             const SDL_RenderCommandType nextcmdtype = nextcmd->command;
@@ -1151,6 +1152,8 @@ GLES2_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *ver
                                 break;  /* can't go any further on this draw call, different render command up next. */
                             } else if (nextcmd->data.draw.count != 2) {
                                 break;  /* can't go any further on this draw call, those are joined lines */
+                            } else if (nextcmd->data.draw.blend != thisblend) {
+                                break;  /* can't go any further on this draw call, different 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;