From 7edd43c276e00046009e966efb77281663f837ea Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 17 Sep 2024 08:46:05 -0700
Subject: [PATCH] Don't define render_drivers if SDL_RENDER_DISABLED is set
Fixes https://github.com/libsdl-org/SDL/issues/10861
---
src/render/SDL_render.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index f4752d6974fd3..72431af41d5a7 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -104,6 +104,7 @@ this should probably be removed at some point in the future. --ryan. */
SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_DST_COLOR, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD, \
SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD)
+#ifndef SDL_RENDER_DISABLED
static const SDL_RenderDriver *render_drivers[] = {
// Temporarily list the GPU renderer first so we get testing feedback
#ifdef SDL_VIDEO_RENDER_GPU
@@ -144,6 +145,7 @@ static const SDL_RenderDriver *render_drivers[] = {
#endif
NULL
};
+#endif // !SDL_RENDER_DISABLED
static SDL_Renderer *SDL_renderers;
@@ -797,7 +799,11 @@ static bool UpdateLogicalPresentation(SDL_Renderer *renderer);
int SDL_GetNumRenderDrivers(void)
{
+#ifndef SDL_RENDER_DISABLED
return SDL_arraysize(render_drivers) - 1;
+#else
+ return 0;
+#endif
}
const char *SDL_GetRenderDriver(int index)