render: Replaced SDL_RenderFlush with SDL_FlushRenderer.

This uses the same `SDL_VerbNoun` format as the rest of SDL3, and also
adds stronger effort to invalidate cached state in the backend, so cooperation
improves with apps that are using lowlevel rendering APIs directly.

Fixes #367.
This commit is contained in:
Ryan C. Gordon 2023-11-25 22:41:23 -05:00
parent eef5c53668
commit dfee3f9e92
19 changed files with 156 additions and 18 deletions

View file

@ -658,6 +658,12 @@ static void SetDrawState(SDL_Surface *surface, SW_DrawStateCache *drawstate)
}
}
static void SW_InvalidateCachedState(SDL_Renderer *renderer)
{
/* SW_DrawStateCache only lives during SW_RunCommandQueue, so nothing to do here! */
}
static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, void *vertices, size_t vertsize)
{
SDL_Surface *surface = SW_ActivateRenderer(renderer);
@ -1134,6 +1140,7 @@ SDL_Renderer *SW_CreateRendererForSurface(SDL_Surface *surface)
renderer->QueueCopy = SW_QueueCopy;
renderer->QueueCopyEx = SW_QueueCopyEx;
renderer->QueueGeometry = SW_QueueGeometry;
renderer->InvalidateCachedState = SW_InvalidateCachedState;
renderer->RunCommandQueue = SW_RunCommandQueue;
renderer->RenderReadPixels = SW_RenderReadPixels;
renderer->RenderPresent = SW_RenderPresent;