render: Batching is always enabled now!

Make sure your app uses SDL_RenderFlush() before it talks to D3D/OpenGL/etc!

Fixes #8584.
This commit is contained in:
Ryan C. Gordon
2023-11-20 20:26:12 -05:00
parent b24d6bd59a
commit 6ba90f7775
7 changed files with 24 additions and 78 deletions

View File

@@ -1387,30 +1387,6 @@ extern "C" {
*/
#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS "SDL_QTWAYLAND_WINDOW_FLAGS"
/**
* A variable controlling whether the 2D render API is compatible or efficient.
*
* This variable can be set to the following values:
*
* "0" - Don't use batching to make rendering more efficient.
* "1" - Use batching, but might cause problems if app makes its own direct OpenGL calls.
*
* Up to SDL 2.0.9, the render API would draw immediately when requested. Now
* it batches up draw requests and sends them all to the GPU only when forced
* to (during SDL_RenderPresent, when changing render targets, by updating a
* texture that the batch needs, etc). This is significantly more efficient,
* but it can cause problems for apps that expect to render on top of the
* render API's output. As such, SDL will disable batching if a specific
* render backend is requested (since this might indicate that the app is
* planning to use the underlying graphics API directly). This hint can
* be used to explicitly request batching in this instance. It is a contract
* that you will either never use the underlying graphics API directly, or
* if you do, you will call SDL_RenderFlush() before you do so any current
* batch goes to the GPU before your work begins. Not following this contract
* will result in undefined behavior.
*/
#define SDL_HINT_RENDER_BATCHING "SDL_RENDER_BATCHING"
/**
* A variable controlling how the 2D render API renders lines
*

View File

@@ -1559,20 +1559,12 @@ extern DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer *renderer);
* are planning to call into OpenGL/Direct3D/Metal/whatever directly in
* addition to using an SDL_Renderer.
*
* This is for a very-specific case: if you are using SDL's render API, you
* asked for a specific renderer backend (OpenGL, Direct3D, etc), you set
* SDL_HINT_RENDER_BATCHING to "1", and you plan to make OpenGL/D3D/whatever
* calls in addition to SDL render API calls. If all of this applies, you
* should call SDL_RenderFlush() between calls to SDL's render API and the
* low-level API you're using in cooperation.
* This is for a very-specific case: if you are using SDL's render API, and
* you plan to make OpenGL/D3D/whatever calls in addition to SDL render API
* calls. If this applies, you should call SDL_RenderFlush() between calls to
* SDL's render API and the low-level API you're using in cooperation.
*
* In all other cases, you can ignore this function. This is only here to get
* maximum performance out of a specific situation. In all other cases, SDL
* will do the right thing, perhaps at a performance loss.
*
* This function is first available in SDL 2.0.10, and is not needed in 2.0.9
* and earlier, as earlier versions did not queue rendering commands at all,
* instead flushing them to the OS immediately.
* In all other cases, you can ignore this function.
*
* \param renderer the rendering context
* \returns 0 on success or a negative error code on failure; call