mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-03-02 07:08:19 +00:00
Change the batch if the color scale changes
The color scale is a shader constant so it can be applied in linear space
This commit is contained in:
@@ -1247,6 +1247,7 @@ static bool GPU_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||
// let's group non joined lines
|
||||
SDL_RenderCommand *finalcmd = cmd;
|
||||
SDL_RenderCommand *nextcmd;
|
||||
float thiscolorscale = cmd->data.draw.color_scale;
|
||||
SDL_BlendMode thisblend = cmd->data.draw.blend;
|
||||
SDL_GPURenderState *thisrenderstate = cmd->data.draw.gpu_render_state;
|
||||
|
||||
@@ -1261,6 +1262,7 @@ static bool GPU_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||
} 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 ||
|
||||
nextcmd->data.draw.color_scale != thiscolorscale ||
|
||||
nextcmd->data.draw.gpu_render_state != thisrenderstate) {
|
||||
break; // can't go any further on this draw call, different blendmode copy up next.
|
||||
} else {
|
||||
@@ -1280,6 +1282,7 @@ static bool GPU_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||
{
|
||||
/* 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. */
|
||||
float thiscolorscale = cmd->data.draw.color_scale;
|
||||
SDL_Texture *thistexture = cmd->data.draw.texture;
|
||||
SDL_BlendMode thisblend = cmd->data.draw.blend;
|
||||
SDL_ScaleMode thisscalemode = cmd->data.draw.texture_scale_mode;
|
||||
@@ -1305,6 +1308,7 @@ static bool GPU_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd,
|
||||
nextcmd->data.draw.texture_address_mode_u != thisaddressmode_u ||
|
||||
nextcmd->data.draw.texture_address_mode_v != thisaddressmode_v ||
|
||||
nextcmd->data.draw.blend != thisblend ||
|
||||
nextcmd->data.draw.color_scale != thiscolorscale ||
|
||||
nextcmd->data.draw.gpu_render_state != thisrenderstate) {
|
||||
break; // can't go any further on this draw call, different texture/blendmode copy up next.
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user