From bc9780299c02e80eb0bfdb528367ed3a09fe948c Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 17 Sep 2024 09:00:57 -0700
Subject: [PATCH] Don't define backends if SDL_GPU_DISABLED is set
---
src/gpu/SDL_gpu.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/gpu/SDL_gpu.c b/src/gpu/SDL_gpu.c
index 2c09f1671dff9..02a5eb23cd2e1 100644
--- a/src/gpu/SDL_gpu.c
+++ b/src/gpu/SDL_gpu.c
@@ -150,6 +150,7 @@
// Drivers
+#ifndef SDL_GPU_DISABLED
static const SDL_GPUBootstrap *backends[] = {
#ifdef SDL_GPU_METAL
&MetalDriver,
@@ -165,6 +166,7 @@ static const SDL_GPUBootstrap *backends[] = {
#endif
NULL
};
+#endif // !SDL_GPU_DISABLED
// Internal Utility Functions
@@ -547,7 +549,11 @@ void SDL_DestroyGPUDevice(SDL_GPUDevice *device)
int SDL_GetNumGPUDrivers(void)
{
+#ifndef SDL_GPU_DISABLED
return SDL_arraysize(backends) - 1;
+#else
+ return 0;
+#endif
}
const char * SDL_GetGPUDriver(int index)