SDL: include: Added `\threadsafety` notes to all SDL_render.h functions.

From 122cd4db2b2891f4b5ab2ad3c309a53a3e8a6927 Mon Sep 17 00:00:00 2001
From: "Ryan C. Gordon" <[EMAIL REDACTED]>
Date: Wed, 25 Sep 2024 16:30:04 -0400
Subject: [PATCH] include: Added `\threadsafety` notes to all SDL_render.h
 functions.

---
 include/SDL3/SDL_render.h | 170 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 167 insertions(+), 3 deletions(-)

diff --git a/include/SDL3/SDL_render.h b/include/SDL3/SDL_render.h
index 3fdedda3228e7..0a57c2c7ac179 100644
--- a/include/SDL3/SDL_render.h
+++ b/include/SDL3/SDL_render.h
@@ -40,8 +40,8 @@
  *
  * This API is designed to accelerate simple 2D operations. You may want more
  * functionality such as polygons and particle effects and in that case you
- * should use SDL's OpenGL/Direct3D support or one of the many good 3D
- * engines.
+ * should use SDL's OpenGL/Direct3D support, the SDL3 GPU API, or one of the
+ * many good 3D engines.
  *
  * These functions must be called from the main thread. See this bug for
  * details: https://github.com/libsdl-org/SDL/issues/986
@@ -140,6 +140,8 @@ typedef struct SDL_Texture SDL_Texture;
  *
  * \since This function is available since SDL 3.0.0.
  *
+ * \threadsafety It is safe to call this function from any thread.
+ *
  * \sa SDL_CreateRenderer
  * \sa SDL_GetRenderDriver
  */
@@ -163,6 +165,8 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
  *
  * \since This function is available since SDL 3.0.0.
  *
+ * \threadsafety It is safe to call this function from any thread.
+ *
  * \sa SDL_GetNumRenderDrivers
  */
 extern SDL_DECLSPEC const char * SDLCALL SDL_GetRenderDriver(int index);
@@ -182,6 +186,8 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetRenderDriver(int index);
  *
  * \since This function is available since SDL 3.0.0.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \sa SDL_CreateRenderer
  * \sa SDL_CreateWindow
  */
@@ -206,6 +212,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_CreateWindowAndRenderer(const char *title,
  * \returns a valid rendering context or NULL if there was an error; call
  *          SDL_GetError() for more information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_CreateRendererWithProperties
@@ -258,6 +266,8 @@ extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window *window
  * \returns a valid rendering context or NULL if there was an error; call
  *          SDL_GetError() for more information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_CreateProperties
@@ -293,6 +303,8 @@ extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRendererWithProperties(SDL_
  * \returns a valid rendering context or NULL if there was an error; call
  *          SDL_GetError() for more information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_DestroyRenderer
@@ -306,6 +318,8 @@ extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surfac
  * \returns the rendering context on success or NULL on failure; call
  *          SDL_GetError() for more information.
  *
+ * \threadsafety It is safe to call this function from any thread.
+ *
  * \since This function is available since SDL 3.0.0.
  */
 extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window *window);
@@ -317,6 +331,8 @@ extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window *window);
  * \returns the window on success or NULL on failure; call SDL_GetError() for
  *          more information.
  *
+ * \threadsafety It is safe to call this function from any thread.
+ *
  * \since This function is available since SDL 3.0.0.
  */
 extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetRenderWindow(SDL_Renderer *renderer);
@@ -328,6 +344,8 @@ extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetRenderWindow(SDL_Renderer *rende
  * \returns the name of the selected renderer, or NULL on failure; call
  *          SDL_GetError() for more information.
  *
+ * \threadsafety It is safe to call this function from any thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_CreateRenderer
@@ -410,6 +428,8 @@ extern SDL_DECLSPEC const char * SDLCALL SDL_GetRendererName(SDL_Renderer *rende
  * \returns a valid property ID on success or 0 on failure; call
  *          SDL_GetError() for more information.
  *
+ * \threadsafety It is safe to call this function from any thread.
+ *
  * \since This function is available since SDL 3.0.0.
  */
 extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetRendererProperties(SDL_Renderer *renderer);
@@ -450,6 +470,8 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetRendererProperties(SDL_Rende
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetCurrentRenderOutputSize
@@ -470,6 +492,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderOutputSize(SDL_Renderer *renderer,
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetRenderOutputSize
@@ -490,6 +514,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetCurrentRenderOutputSize(SDL_Renderer *re
  *          was active, the format was unsupported, or the width or height
  *          were out of range; call SDL_GetError() for more information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_CreateTextureFromSurface
@@ -518,6 +544,8 @@ extern SDL_DECLSPEC SDL_Texture * SDLCALL SDL_CreateTexture(SDL_Renderer *render
  * \returns the created texture or NULL on failure; call SDL_GetError() for
  *          more information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_CreateTexture
@@ -626,6 +654,8 @@ extern SDL_DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureFromSurface(SDL_Rende
  *          was active, the format was unsupported, or the width or height
  *          were out of range; call SDL_GetError() for more information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_CreateProperties
@@ -754,6 +784,8 @@ extern SDL_DECLSPEC SDL_Texture * SDLCALL SDL_CreateTextureWithProperties(SDL_Re
  * \returns a valid property ID on success or 0 on failure; call
  *          SDL_GetError() for more information.
  *
+ * \threadsafety It is safe to call this function from any thread.
+ *
  * \since This function is available since SDL 3.0.0.
  */
 extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetTextureProperties(SDL_Texture *texture);
@@ -809,6 +841,8 @@ extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_GetRendererFromTexture(SDL_Textur
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  */
 extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureSize(SDL_Texture *texture, float *w, float *h);
@@ -832,6 +866,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureSize(SDL_Texture *texture, float
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetTextureColorMod
@@ -860,6 +896,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureColorMod(SDL_Texture *texture, Ui
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetTextureColorModFloat
@@ -879,6 +917,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureColorModFloat(SDL_Texture *textur
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetTextureAlphaMod
@@ -897,6 +937,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureColorMod(SDL_Texture *texture, Ui
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetTextureAlphaModFloat
@@ -921,6 +963,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureColorModFloat(SDL_Texture *textur
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetTextureAlphaMod
@@ -945,6 +989,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureAlphaMod(SDL_Texture *texture, Ui
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetTextureAlphaModFloat
@@ -961,6 +1007,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureAlphaModFloat(SDL_Texture *textur
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetTextureAlphaModFloat
@@ -977,6 +1025,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureAlphaMod(SDL_Texture *texture, Ui
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetTextureAlphaMod
@@ -996,6 +1046,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureAlphaModFloat(SDL_Texture *textur
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetTextureBlendMode
@@ -1010,6 +1062,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureBlendMode(SDL_Texture *texture, S
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_SetTextureBlendMode
@@ -1028,6 +1082,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureBlendMode(SDL_Texture *texture, S
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetTextureScaleMode
@@ -1042,6 +1098,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureScaleMode(SDL_Texture *texture, S
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_SetTextureScaleMode
@@ -1071,6 +1129,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureScaleMode(SDL_Texture *texture, S
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_LockTexture
@@ -1103,6 +1163,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_UpdateTexture(SDL_Texture *texture, const S
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_UpdateNVTexture
@@ -1133,6 +1195,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_UpdateYUVTexture(SDL_Texture *texture,
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_UpdateTexture
@@ -1166,6 +1230,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_UpdateNVTexture(SDL_Texture *texture,
  *          created with `SDL_TEXTUREACCESS_STREAMING`; call SDL_GetError()
  *          for more information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_LockTextureToSurface
@@ -1202,6 +1268,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_LockTexture(SDL_Texture *texture,
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_LockTexture
@@ -1222,6 +1290,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture,
  *
  * \param texture a texture locked by SDL_LockTexture().
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_LockTexture
@@ -1242,6 +1312,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture *texture);
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetRenderTarget
@@ -1257,6 +1329,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, SDL
  * \param renderer the rendering context.
  * \returns the current render target or NULL for the default render target.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_SetRenderTarget
@@ -1294,6 +1368,8 @@ extern SDL_DECLSPEC SDL_Texture * SDLCALL SDL_GetRenderTarget(SDL_Renderer *rend
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_ConvertEventToRenderCoordinates
@@ -1314,6 +1390,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderLogicalPresentation(SDL_Renderer *
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_SetRenderLogicalPresentation
@@ -1334,6 +1412,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderLogicalPresentation(SDL_Renderer *
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_SetRenderLogicalPresentation
@@ -1351,6 +1431,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderLogicalPresentationRect(SDL_Render
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_SetRenderLogicalPresentation
@@ -1371,6 +1453,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderCoordinatesFromWindow(SDL_Renderer *r
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_SetRenderLogicalPresentation
@@ -1391,6 +1475,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderCoordinatesToWindow(SDL_Renderer *ren
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_RenderCoordinatesFromWindow
@@ -1429,6 +1515,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderViewport(SDL_Renderer *renderer, c
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_RenderViewportSet
@@ -1447,6 +1535,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderViewport(SDL_Renderer *renderer, S
  * \returns true if the viewport was set to a specific rectangle, or false if
  *          it was set to NULL (the entire target).
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetRenderViewport
@@ -1470,6 +1560,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderViewportSet(SDL_Renderer *renderer);
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  */
 extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderSafeArea(SDL_Renderer *renderer, SDL_Rect *rect);
@@ -1483,6 +1575,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderSafeArea(SDL_Renderer *renderer, S
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetRenderClipRect
@@ -1499,6 +1593,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderClipRect(SDL_Renderer *renderer, c
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_RenderClipEnabled
@@ -1513,6 +1609,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderClipRect(SDL_Renderer *renderer, S
  * \returns true if clipping is enabled or false if not; call SDL_GetError()
  *          for more information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetRenderClipRect
@@ -1537,6 +1635,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderClipEnabled(SDL_Renderer *renderer);
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetRenderScale
@@ -1552,6 +1652,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderScale(SDL_Renderer *renderer, floa
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_SetRenderScale
@@ -1574,6 +1676,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderScale(SDL_Renderer *renderer, floa
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetRenderDrawColor
@@ -1597,6 +1701,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderDrawColor(SDL_Renderer *renderer,
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetRenderDrawColorFloat
@@ -1619,6 +1725,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderDrawColorFloat(SDL_Renderer *rende
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetRenderDrawColorFloat
@@ -1641,6 +1749,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderDrawColor(SDL_Renderer *renderer,
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_SetRenderDrawColorFloat
@@ -1664,6 +1774,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderDrawColorFloat(SDL_Renderer *rende
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetRenderColorScale
@@ -1678,6 +1790,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderColorScale(SDL_Renderer *renderer,
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_SetRenderColorScale
@@ -1694,6 +1808,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderColorScale(SDL_Renderer *renderer,
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetRenderDrawBlendMode
@@ -1708,6 +1824,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer *render
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_SetRenderDrawBlendMode
@@ -1726,6 +1844,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer *render
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_SetRenderDrawColor
@@ -1741,6 +1861,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderClear(SDL_Renderer *renderer);
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_RenderPoints
@@ -1756,6 +1878,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderPoint(SDL_Renderer *renderer, float x
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_RenderPoint
@@ -1773,6 +1897,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderPoints(SDL_Renderer *renderer, const
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_RenderLines
@@ -1789,6 +1915,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderLine(SDL_Renderer *renderer, float x1
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_RenderLine
@@ -1804,6 +1932,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderLines(SDL_Renderer *renderer, const S
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_RenderRects
@@ -1820,6 +1950,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderRect(SDL_Renderer *renderer, const SD
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_RenderRect
@@ -1836,6 +1968,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderRects(SDL_Renderer *renderer, const S
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_RenderFillRects
@@ -1852,6 +1986,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderFillRect(SDL_Renderer *renderer, cons
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_RenderFillRect
@@ -1871,6 +2007,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderFillRects(SDL_Renderer *renderer, con
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_RenderTextureRotated
@@ -1898,6 +2036,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, SDL_T
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_RenderTexture
@@ -1926,6 +2066,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderTextureRotated(SDL_Renderer *renderer
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_RenderTexture
@@ -1958,6 +2100,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderTextureTiled(SDL_Renderer *renderer,
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_RenderTexture
@@ -1980,6 +2124,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderTexture9Grid(SDL_Renderer *renderer,
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_RenderGeometryRaw
@@ -2010,6 +2156,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer,
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_RenderGeometry
@@ -2037,6 +2185,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer,
  * \returns a new SDL_Surface on success or NULL on failure; call
  *          SDL_GetError() for more information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  */
 extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect);
@@ -2072,7 +2222,7 @@ extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_RenderReadPixels(SDL_Renderer *ren
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
- * \threadsafety You may only call this function on the main thread.
+ * \threadsafety You may only call this function from the main thread.
  *
  * \since This function is available since SDL 3.0.0.
  *
@@ -2099,6 +2249,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_RenderPresent(SDL_Renderer *renderer);
  *
  * \param texture the texture to destroy.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_CreateTexture
@@ -2114,6 +2266,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture *texture);
  *
  * \param renderer the rendering context.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_CreateRenderer
@@ -2147,6 +2301,8 @@ extern SDL_DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer *renderer);
  * \returns true on success or false on failure; call SDL_GetError() for more
  *          information.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  */
 extern SDL_DECLSPEC bool SDLCALL SDL_FlushRenderer(SDL_Renderer *renderer);
@@ -2161,6 +2317,8 @@ extern SDL_DECLSPEC bool SDLCALL SDL_FlushRenderer(SDL_Renderer *renderer);
  * \returns a `CAMetalLayer *` on success, or NULL if the renderer isn't a
  *          Metal renderer.
  *
+ * \threadsafety You may only call this function from the main thread.
+ *
  * \since This function is available since SDL 3.0.0.
  *
  * \sa SDL_GetRenderMetalCommandEncoder
@@ -2182,6 +2340,8 @@ extern SDL_DECLSPEC void * SDLCALL SDL_GetRenderMetalLayer(SDL_Renderer *rendere
  * \returns an `id<MTLRenderCommandEncoder>` on success, or NULL if the
  *     

(Patch may be truncated, please check the link at the top of this post.)