SDL: Check the SDL_VIDEO_RENDER_??? macros with #if instead of #ifdef

From d0731ab9a3848c839bce0a65b337a4a421c89dea Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Thu, 15 Feb 2024 02:55:02 +0300
Subject: [PATCH] Check the SDL_VIDEO_RENDER_??? macros with #if instead of
 #ifdef

Allows users to disable them by defining them as 0.

Closes https://github.com/libsdl-org/SDL/issues/8996
---
 src/SDL_internal.h                            | 62 +++++++++++++++++++
 src/core/windows/SDL_windows.h                | 12 +---
 src/core/winrt/SDL_winrtapp_direct3d.cpp      |  4 +-
 src/render/SDL_d3dmath.c                      |  4 +-
 src/render/SDL_d3dmath.h                      |  4 +-
 src/render/SDL_render.c                       | 28 ++++-----
 src/render/direct3d/SDL_render_d3d.c          | 10 +--
 src/render/direct3d/SDL_shaders_d3d.c         |  4 +-
 src/render/direct3d11/SDL_render_d3d11.c      |  8 +--
 src/render/direct3d11/SDL_render_winrt.cpp    |  4 +-
 src/render/direct3d11/SDL_render_winrt.h      |  4 +-
 src/render/direct3d11/SDL_shaders_d3d11.c     |  4 +-
 src/render/direct3d12/SDL_render_d3d12.c      |  8 +--
 .../direct3d12/SDL_render_d3d12_xbox.cpp      |  2 +-
 src/render/direct3d12/SDL_shaders_d3d12.c     |  4 +-
 .../direct3d12/SDL_shaders_d3d12_xboxone.cpp  |  4 +-
 .../SDL_shaders_d3d12_xboxseries.cpp          |  4 +-
 src/render/metal/SDL_render_metal.m           |  4 +-
 src/render/opengl/SDL_render_gl.c             |  4 +-
 src/render/opengl/SDL_shaders_gl.c            |  4 +-
 src/render/opengles/SDL_render_gles.c         |  4 +-
 src/render/opengles2/SDL_render_gles2.c       |  4 +-
 src/render/opengles2/SDL_shaders_gles2.c      |  4 +-
 src/render/opengles2/SDL_shaders_gles2.h      |  2 +-
 src/render/ps2/SDL_render_ps2.c               |  2 +-
 src/render/psp/SDL_render_psp.c               |  2 +-
 src/render/software/SDL_blendfillrect.c       |  4 +-
 src/render/software/SDL_blendline.c           |  4 +-
 src/render/software/SDL_blendpoint.c          |  4 +-
 src/render/software/SDL_drawline.c            |  4 +-
 src/render/software/SDL_drawpoint.c           |  4 +-
 src/render/software/SDL_render_sw.c           |  4 +-
 src/render/software/SDL_rotate.c              |  4 +-
 src/render/software/SDL_triangle.c            |  4 +-
 src/render/vitagxm/SDL_render_vita_gxm.c      |  2 +-
 .../vitagxm/SDL_render_vita_gxm_memory.c      |  2 +-
 .../vitagxm/SDL_render_vita_gxm_tools.c       |  2 +-
 src/video/vita/SDL_vitamessagebox.c           |  4 +-
 38 files changed, 147 insertions(+), 95 deletions(-)

diff --git a/src/SDL_internal.h b/src/SDL_internal.h
index c2f8b80c984c..ae638e8322df 100644
--- a/src/SDL_internal.h
+++ b/src/SDL_internal.h
@@ -125,6 +125,68 @@
 #define SDL_HAVE_YUV !SDL_LEAN_AND_MEAN
 #endif
 
+#ifndef SDL_RENDER_DISABLED
+/* define the not defined ones as 0 */
+#ifndef SDL_VIDEO_RENDER_D3D
+#define SDL_VIDEO_RENDER_D3D 0
+#endif
+#ifndef SDL_VIDEO_RENDER_D3D11
+#define SDL_VIDEO_RENDER_D3D11 0
+#endif
+#ifndef SDL_VIDEO_RENDER_D3D12
+#define SDL_VIDEO_RENDER_D3D12 0
+#endif
+#ifndef SDL_VIDEO_RENDER_METAL
+#define SDL_VIDEO_RENDER_METAL 0
+#endif
+#ifndef SDL_VIDEO_RENDER_OGL
+#define SDL_VIDEO_RENDER_OGL  0
+#endif
+#ifndef SDL_VIDEO_RENDER_OGL_ES
+#define SDL_VIDEO_RENDER_OGL_ES 0
+#endif
+#ifndef SDL_VIDEO_RENDER_OGL_ES2
+#define SDL_VIDEO_RENDER_OGL_ES2 0
+#endif
+#ifndef SDL_VIDEO_RENDER_DIRECTFB
+#define SDL_VIDEO_RENDER_DIRECTFB 0
+#endif
+#ifndef SDL_VIDEO_RENDER_PS2
+#define SDL_VIDEO_RENDER_PS2 0
+#endif
+#ifndef SDL_VIDEO_RENDER_PSP
+#define SDL_VIDEO_RENDER_PSP 0
+#endif
+#ifndef SDL_VIDEO_RENDER_VITA_GXM
+#define SDL_VIDEO_RENDER_VITA_GXM 0
+#endif
+#else /* define all as 0 */
+#undef SDL_VIDEO_RENDER_SW
+#define SDL_VIDEO_RENDER_SW 0
+#undef SDL_VIDEO_RENDER_D3D
+#define SDL_VIDEO_RENDER_D3D 0
+#undef SDL_VIDEO_RENDER_D3D11
+#define SDL_VIDEO_RENDER_D3D11 0
+#undef SDL_VIDEO_RENDER_D3D12
+#define SDL_VIDEO_RENDER_D3D12 0
+#undef SDL_VIDEO_RENDER_METAL
+#define SDL_VIDEO_RENDER_METAL 0
+#undef SDL_VIDEO_RENDER_OGL
+#define SDL_VIDEO_RENDER_OGL  0
+#undef SDL_VIDEO_RENDER_OGL_ES
+#define SDL_VIDEO_RENDER_OGL_ES 0
+#undef SDL_VIDEO_RENDER_OGL_ES2
+#define SDL_VIDEO_RENDER_OGL_ES2 0
+#undef SDL_VIDEO_RENDER_DIRECTFB
+#define SDL_VIDEO_RENDER_DIRECTFB 0
+#undef SDL_VIDEO_RENDER_PS2
+#define SDL_VIDEO_RENDER_PS2 0
+#undef SDL_VIDEO_RENDER_PSP
+#define SDL_VIDEO_RENDER_PSP 0
+#undef SDL_VIDEO_RENDER_VITA_GXM
+#define SDL_VIDEO_RENDER_VITA_GXM 0
+#endif /* SDL_RENDER_DISABLED */
+
 #include "SDL_assert.h"
 #include "SDL_log.h"
 
diff --git a/src/core/windows/SDL_windows.h b/src/core/windows/SDL_windows.h
index 852fdb0074b9..2bd6257d1aae 100644
--- a/src/core/windows/SDL_windows.h
+++ b/src/core/windows/SDL_windows.h
@@ -36,7 +36,7 @@
 #endif
 #undef WINVER
 #undef _WIN32_WINNT
-#if defined(SDL_VIDEO_RENDER_D3D12)
+#if SDL_VIDEO_RENDER_D3D12
 #define _WIN32_WINNT 0xA00 /* For D3D12, 0xA00 is required */
 #elif defined(HAVE_SHELLSCALINGAPI_H)
 #define _WIN32_WINNT 0x603 /* For DPI support */
@@ -92,16 +92,6 @@
 #include <windows.h>
 #include <basetyps.h> /* for REFIID with broken mingw.org headers */
 
-/* Older Visual C++ headers don't have the Win64-compatible typedefs... */
-#if defined(_MSC_VER) && (_MSC_VER <= 1200)
-#ifndef DWORD_PTR
-#define DWORD_PTR DWORD
-#endif
-#ifndef LONG_PTR
-#define LONG_PTR LONG
-#endif
-#endif
-
 #include "SDL_rect.h"
 
 /* Routines to convert from UTF8 to native Windows text */
diff --git a/src/core/winrt/SDL_winrtapp_direct3d.cpp b/src/core/winrt/SDL_winrtapp_direct3d.cpp
index 2cf7b405e58d..0115c5da4840 100644
--- a/src/core/winrt/SDL_winrtapp_direct3d.cpp
+++ b/src/core/winrt/SDL_winrtapp_direct3d.cpp
@@ -58,7 +58,7 @@ extern "C" {
 #include "SDL_winrtapp_common.h"
 #include "SDL_winrtapp_direct3d.h"
 
-#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_D3D11
 /* Calling IDXGIDevice3::Trim on the active Direct3D 11.x device is necessary
  * when Windows 8.1 apps are about to get suspended.
  */
@@ -622,7 +622,7 @@ void SDL_WinRTApp::OnSuspending(Platform::Object ^ sender, SuspendingEventArgs ^
         // Let the Direct3D 11 renderer prepare for the app to be backgrounded.
         // This is necessary for Windows 8.1, possibly elsewhere in the future.
         // More details at: http://msdn.microsoft.com/en-us/library/windows/apps/Hh994929.aspx
-#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_D3D11
         if (WINRT_GlobalSDLWindow) {
             SDL_Renderer *renderer = SDL_GetRenderer(WINRT_GlobalSDLWindow);
             if (renderer && (SDL_strcmp(renderer->info.name, "direct3d11") == 0)) {
diff --git a/src/render/SDL_d3dmath.c b/src/render/SDL_d3dmath.c
index ad3af1ef4c43..021b8c2eec94 100644
--- a/src/render/SDL_d3dmath.c
+++ b/src/render/SDL_d3dmath.c
@@ -20,7 +20,7 @@
 */
 #include "../SDL_internal.h"
 
-#if (defined(SDL_VIDEO_RENDER_D3D) || defined(SDL_VIDEO_RENDER_D3D11) || defined(SDL_VIDEO_RENDER_D3D12)) && !defined(SDL_RENDER_DISABLED)
+#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12)
 #include "SDL_stdinc.h"
 
 #include "SDL_d3dmath.h"
@@ -130,6 +130,6 @@ Float4X4 MatrixRotationZ(float r)
     return m;
 }
 
-#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED */
+#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/SDL_d3dmath.h b/src/render/SDL_d3dmath.h
index ba486f9a0dd6..9ef2f53ed489 100644
--- a/src/render/SDL_d3dmath.h
+++ b/src/render/SDL_d3dmath.h
@@ -20,7 +20,7 @@
 */
 #include "../SDL_internal.h"
 
-#if (defined(SDL_VIDEO_RENDER_D3D) || defined(SDL_VIDEO_RENDER_D3D11) || defined(SDL_VIDEO_RENDER_D3D12)) && !defined(SDL_RENDER_DISABLED)
+#if (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12)
 
 /* Set up for C function definitions, even when using C++ */
 #ifdef __cplusplus
@@ -78,6 +78,6 @@ Float4X4 MatrixRotationZ(float r);
 }
 #endif
 
-#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) && !SDL_RENDER_DISABLED */
+#endif /* (SDL_VIDEO_RENDER_D3D || SDL_VIDEO_RENDER_D3D11 || SDL_VIDEO_RENDER_D3D12) */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index 39dcadb33603..6bf57b18707b 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -91,37 +91,37 @@ this should probably be removed at some point in the future.  --ryan. */
 
 #ifndef SDL_RENDER_DISABLED
 static const SDL_RenderDriver *render_drivers[] = {
-#ifdef SDL_VIDEO_RENDER_D3D
+#if SDL_VIDEO_RENDER_D3D
     &D3D_RenderDriver,
 #endif
-#ifdef SDL_VIDEO_RENDER_D3D11
+#if SDL_VIDEO_RENDER_D3D11
     &D3D11_RenderDriver,
 #endif
-#ifdef SDL_VIDEO_RENDER_D3D12
+#if SDL_VIDEO_RENDER_D3D12
     &D3D12_RenderDriver,
 #endif
-#ifdef SDL_VIDEO_RENDER_METAL
+#if SDL_VIDEO_RENDER_METAL
     &METAL_RenderDriver,
 #endif
-#ifdef SDL_VIDEO_RENDER_OGL
+#if SDL_VIDEO_RENDER_OGL
     &GL_RenderDriver,
 #endif
-#ifdef SDL_VIDEO_RENDER_OGL_ES2
+#if SDL_VIDEO_RENDER_OGL_ES2
     &GLES2_RenderDriver,
 #endif
-#ifdef SDL_VIDEO_RENDER_OGL_ES
+#if SDL_VIDEO_RENDER_OGL_ES
     &GLES_RenderDriver,
 #endif
-#ifdef SDL_VIDEO_RENDER_DIRECTFB
+#if SDL_VIDEO_RENDER_DIRECTFB
     &DirectFB_RenderDriver,
 #endif
-#ifdef SDL_VIDEO_RENDER_PS2
+#if SDL_VIDEO_RENDER_PS2
     &PS2_RenderDriver,
 #endif
-#ifdef SDL_VIDEO_RENDER_PSP
+#if SDL_VIDEO_RENDER_PSP
     &PSP_RenderDriver,
 #endif
-#ifdef SDL_VIDEO_RENDER_VITA_GXM
+#if SDL_VIDEO_RENDER_VITA_GXM
     &VITA_GXM_RenderDriver,
 #endif
 #if SDL_VIDEO_RENDER_SW
@@ -1108,7 +1108,7 @@ SDL_Renderer *SDL_CreateRenderer(SDL_Window *window, int index, Uint32 flags)
 
 SDL_Renderer *SDL_CreateSoftwareRenderer(SDL_Surface *surface)
 {
-#if !defined(SDL_RENDER_DISABLED) && SDL_VIDEO_RENDER_SW
+#if SDL_VIDEO_RENDER_SW
     SDL_Renderer *renderer;
 
     renderer = SW_CreateRendererForSurface(surface);
@@ -1451,7 +1451,7 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
             SDL_UpdateTexture(texture, NULL, surface->pixels, surface->pitch);
         }
 
-#ifdef SDL_VIDEO_RENDER_DIRECTFB
+#if SDL_VIDEO_RENDER_DIRECTFB
         /* DirectFB allows palette format for textures.
          * Copy SDL_Surface palette to the texture */
         if (SDL_ISPIXELFORMAT_INDEXED(format)) {
@@ -2284,7 +2284,7 @@ static int UpdateLogicalSize(SDL_Renderer *renderer, SDL_bool flush_viewport_cmd
 
     hint = SDL_GetHint(SDL_HINT_RENDER_LOGICAL_SIZE_MODE);
     if (hint && (*hint == '1' || SDL_strcasecmp(hint, "overscan") == 0)) {
-#ifdef SDL_VIDEO_RENDER_D3D
+#if SDL_VIDEO_RENDER_D3D
         SDL_bool overscan_supported = SDL_TRUE;
         /* Unfortunately, Direct3D 9 doesn't support negative viewport numbers
            which the overscan implementation relies on.
diff --git a/src/render/direct3d/SDL_render_d3d.c b/src/render/direct3d/SDL_render_d3d.c
index 07e854f9a15a..85252fe038c7 100644
--- a/src/render/direct3d/SDL_render_d3d.c
+++ b/src/render/direct3d/SDL_render_d3d.c
@@ -23,7 +23,7 @@
 #include "SDL_render.h"
 #include "SDL_system.h"
 
-#if defined(SDL_VIDEO_RENDER_D3D) && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_D3D
 
 #include "../../core/windows/SDL_windows.h"
 
@@ -34,7 +34,7 @@
 #include "../SDL_d3dmath.h"
 #include "../../video/windows/SDL_windowsvideo.h"
 
-#ifdef SDL_VIDEO_RENDER_D3D
+#if SDL_VIDEO_RENDER_D3D
 #define D3D_DEBUG_INFO
 #include <d3d9.h>
 #endif
@@ -1731,7 +1731,7 @@ SDL_RenderDriver D3D_RenderDriver = {
       0,
       0 }
 };
-#endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_D3D */
 
 #if defined(__WIN32__) || defined(__WINGDK__)
 /* This function needs to always exist on Windows, for the Dynamic API. */
@@ -1739,7 +1739,7 @@ IDirect3DDevice9 *SDL_RenderGetD3D9Device(SDL_Renderer *renderer)
 {
     IDirect3DDevice9 *device = NULL;
 
-#if defined(SDL_VIDEO_RENDER_D3D) && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_D3D
     D3D_RenderData *data = (D3D_RenderData *)renderer->driverdata;
 
     /* Make sure that this is a D3D renderer */
@@ -1752,7 +1752,7 @@ IDirect3DDevice9 *SDL_RenderGetD3D9Device(SDL_Renderer *renderer)
     if (device) {
         IDirect3DDevice9_AddRef(device);
     }
-#endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_D3D */
 
     return device;
 }
diff --git a/src/render/direct3d/SDL_shaders_d3d.c b/src/render/direct3d/SDL_shaders_d3d.c
index 1f3184f63716..2f55d80ca75f 100644
--- a/src/render/direct3d/SDL_shaders_d3d.c
+++ b/src/render/direct3d/SDL_shaders_d3d.c
@@ -23,7 +23,7 @@
 #include "SDL_render.h"
 #include "SDL_system.h"
 
-#if defined(SDL_VIDEO_RENDER_D3D) && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_D3D
 
 #include "../../core/windows/SDL_windows.h"
 
@@ -268,6 +268,6 @@ HRESULT D3D9_CreatePixelShader(IDirect3DDevice9 *d3dDevice, D3D9_Shader shader,
     return IDirect3DDevice9_CreatePixelShader(d3dDevice, D3D9_shaders[shader], pixelShader);
 }
 
-#endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_D3D */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/direct3d11/SDL_render_d3d11.c b/src/render/direct3d11/SDL_render_d3d11.c
index 748a8c76aac5..8d8cffe395ff 100644
--- a/src/render/direct3d11/SDL_render_d3d11.c
+++ b/src/render/direct3d11/SDL_render_d3d11.c
@@ -23,7 +23,7 @@
 #include "SDL_render.h"
 #include "SDL_system.h"
 
-#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_D3D11
 
 #define COBJMACROS
 #include "../../core/windows/SDL_windows.h"
@@ -2415,7 +2415,7 @@ SDL_RenderDriver D3D11_RenderDriver = {
     }
 };
 
-#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_D3D11 */
 
 #if defined(__WIN32__) || defined(__WINGDK__)
 /* This function needs to always exist on Windows, for the Dynamic API. */
@@ -2423,7 +2423,7 @@ ID3D11Device *SDL_RenderGetD3D11Device(SDL_Renderer *renderer)
 {
     ID3D11Device *device = NULL;
 
-#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_D3D11
     D3D11_RenderData *data = (D3D11_RenderData *)renderer->driverdata;
 
     /* Make sure that this is a D3D renderer */
@@ -2436,7 +2436,7 @@ ID3D11Device *SDL_RenderGetD3D11Device(SDL_Renderer *renderer)
     if (device) {
         ID3D11Device_AddRef(device);
     }
-#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_D3D11 */
 
     return device;
 }
diff --git a/src/render/direct3d11/SDL_render_winrt.cpp b/src/render/direct3d11/SDL_render_winrt.cpp
index 8ab6a7afbd8f..0ed7addbd2c2 100644
--- a/src/render/direct3d11/SDL_render_winrt.cpp
+++ b/src/render/direct3d11/SDL_render_winrt.cpp
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_D3D11
 
 #include "SDL_syswm.h"
 #include "../../video/winrt/SDL_winrtvideo_cpp.h"
@@ -109,6 +109,6 @@ D3D11_GetCurrentRotation()
     return DXGI_MODE_ROTATION_IDENTITY;
 }
 
-#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_D3D11 */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/direct3d11/SDL_render_winrt.h b/src/render/direct3d11/SDL_render_winrt.h
index cf0c43168013..dd9a17631c57 100644
--- a/src/render/direct3d11/SDL_render_winrt.h
+++ b/src/render/direct3d11/SDL_render_winrt.h
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_D3D11
 
 #include "SDL_render.h"
 
@@ -35,6 +35,6 @@ DXGI_MODE_ROTATION D3D11_GetCurrentRotation();
 }
 #endif
 
-#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_D3D11 */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/direct3d11/SDL_shaders_d3d11.c b/src/render/direct3d11/SDL_shaders_d3d11.c
index 0bda02b5c7b2..5f3a9a41f5ed 100644
--- a/src/render/direct3d11/SDL_shaders_d3d11.c
+++ b/src/render/direct3d11/SDL_shaders_d3d11.c
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#if defined(SDL_VIDEO_RENDER_D3D11) && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_D3D11
 
 #include "SDL_stdinc.h"
 
@@ -1949,6 +1949,6 @@ int D3D11_CreatePixelShader(ID3D11Device1 *d3dDevice, D3D11_Shader shader, ID3D1
     return 0;
 }
 
-#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_D3D11 */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/direct3d12/SDL_render_d3d12.c b/src/render/direct3d12/SDL_render_d3d12.c
index 6cf34db28016..6e18db64da8a 100644
--- a/src/render/direct3d12/SDL_render_d3d12.c
+++ b/src/render/direct3d12/SDL_render_d3d12.c
@@ -23,7 +23,7 @@
 #include "SDL_render.h"
 #include "SDL_system.h"
 
-#if defined(SDL_VIDEO_RENDER_D3D12) && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_D3D12
 
 #define SDL_D3D12_NUM_BUFFERS        2
 #define SDL_D3D12_NUM_VERTEX_BUFFERS 256
@@ -3055,7 +3055,7 @@ SDL_RenderDriver D3D12_RenderDriver = {
 }
 #endif
 
-#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_D3D12 */
 
 #if defined(__WIN32__) || defined(__GDK__)
 #ifdef __cplusplus
@@ -3067,7 +3067,7 @@ extern "C"
 {
     ID3D12Device *device = NULL;
 
-#if defined(SDL_VIDEO_RENDER_D3D12) && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_D3D12
     D3D12_RenderData *data = (D3D12_RenderData *)renderer->driverdata;
 
     /* Make sure that this is a D3D renderer */
@@ -3080,7 +3080,7 @@ extern "C"
     if (device) {
         D3D_CALL(device, AddRef);
     }
-#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_D3D12 */
 
     return device;
 }
diff --git a/src/render/direct3d12/SDL_render_d3d12_xbox.cpp b/src/render/direct3d12/SDL_render_d3d12_xbox.cpp
index 0c4605561c9e..7b598c016aca 100644
--- a/src/render/direct3d12/SDL_render_d3d12_xbox.cpp
+++ b/src/render/direct3d12/SDL_render_d3d12_xbox.cpp
@@ -20,7 +20,7 @@
 */
 
 #include "../../SDL_internal.h"
-#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && (defined(__XBOXONE__) || defined(__XBOXSERIES__))
+#if SDL_VIDEO_RENDER_D3D12 && (defined(__XBOXONE__) || defined(__XBOXSERIES__))
 #include "SDL_render_d3d12_xbox.h"
 #include "../../core/windows/SDL_windows.h"
 #include <XGameRuntime.h>
diff --git a/src/render/direct3d12/SDL_shaders_d3d12.c b/src/render/direct3d12/SDL_shaders_d3d12.c
index 188f0e7d3781..29862d46403d 100644
--- a/src/render/direct3d12/SDL_shaders_d3d12.c
+++ b/src/render/direct3d12/SDL_shaders_d3d12.c
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#if defined(SDL_VIDEO_RENDER_D3D12) && !defined(SDL_RENDER_DISABLED) && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
+#if SDL_VIDEO_RENDER_D3D12 && !defined(__XBOXONE__) && !defined(__XBOXSERIES__)
 
 #include "SDL_stdinc.h"
 
@@ -6934,6 +6934,6 @@ void D3D12_GetRootSignatureData(D3D12_RootSignature rootSig, D3D12_SHADER_BYTECO
     outBytecode->BytecodeLength = D3D12_rootsigs[rootSig].rs_shader_size;
 }
 
-#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED  && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */
+#endif /* SDL_VIDEO_RENDER_D3D12 && !defined(__XBOXONE__) && !defined(__XBOXSERIES__) */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp b/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp
index 456c4db77cda..cc5c84f2f441 100644
--- a/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp
+++ b/src/render/direct3d12/SDL_shaders_d3d12_xboxone.cpp
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXONE__)
+#if SDL_VIDEO_RENDER_D3D12 && defined(__XBOXONE__)
 
 #include <SDL_stdinc.h>
 
@@ -139,6 +139,6 @@ D3D12_GetRootSignatureData(D3D12_RootSignature rootSig, D3D12_SHADER_BYTECODE *o
     outBytecode->BytecodeLength = D3D12_rootsigs[rootSig].rs_shader_size;
 }
 
-#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXONE__) */
+#endif  /* SDL_VIDEO_RENDER_D3D12 && defined(__XBOXONE__) */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp b/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp
index 2fc8349be2ec..f1e4063179e3 100644
--- a/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp
+++ b/src/render/direct3d12/SDL_shaders_d3d12_xboxseries.cpp
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#if SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXSERIES__)
+#if SDL_VIDEO_RENDER_D3D12 && defined(__XBOXSERIES__)
 
 #include <SDL_stdinc.h>
 
@@ -139,6 +139,6 @@ D3D12_GetRootSignatureData(D3D12_RootSignature rootSig, D3D12_SHADER_BYTECODE *o
     outBytecode->BytecodeLength = D3D12_rootsigs[rootSig].rs_shader_size;
 }
 
-#endif /* SDL_VIDEO_RENDER_D3D12 && !SDL_RENDER_DISABLED && defined(__XBOXSERIES__) */
+#endif /* SDL_VIDEO_RENDER_D3D12 && defined(__XBOXSERIES__) */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/metal/SDL_render_metal.m b/src/render/metal/SDL_render_metal.m
index be207e4694a3..ee6b88209393 100644
--- a/src/render/metal/SDL_render_metal.m
+++ b/src/render/metal/SDL_render_metal.m
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#if defined(SDL_VIDEO_RENDER_METAL) && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_METAL
 
 #include "SDL_hints.h"
 #include "SDL_syswm.h"
@@ -1896,6 +1896,6 @@ in case we want to use it later (recreating the renderer)
     }
 };
 
-#endif /* SDL_VIDEO_RENDER_METAL && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_METAL */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/opengl/SDL_render_gl.c b/src/render/opengl/SDL_render_gl.c
index c3bd0e609d35..a7ff0bd1d0f0 100644
--- a/src/render/opengl/SDL_render_gl.c
+++ b/src/render/opengl/SDL_render_gl.c
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#if defined(SDL_VIDEO_RENDER_OGL) && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_OGL
 #include "SDL_hints.h"
 #include "../../video/SDL_sysvideo.h" /* For SDL_GL_SwapWindowWithResult */
 #include "SDL_opengl.h"
@@ -1969,6 +1969,6 @@ SDL_RenderDriver GL_RenderDriver = {
       0 }
 };
 
-#endif /* SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_OGL */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/opengl/SDL_shaders_gl.c b/src/render/opengl/SDL_shaders_gl.c
index 10906a542605..e24a36af9d01 100644
--- a/src/render/opengl/SDL_shaders_gl.c
+++ b/src/render/opengl/SDL_shaders_gl.c
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#if defined(SDL_VIDEO_RENDER_OGL) && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_OGL
 
 #include "SDL_stdinc.h"
 #include "SDL_opengl.h"
@@ -577,6 +577,6 @@ void GL_DestroyShaderContext(GL_ShaderContext *ctx)
     SDL_free(ctx);
 }
 
-#endif /* SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_OGL */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/opengles/SDL_render_gles.c b/src/render/opengles/SDL_render_gles.c
index e0cb1f195680..9906b46d8b95 100644
--- a/src/render/opengles/SDL_render_gles.c
+++ b/src/render/opengles/SDL_render_gles.c
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#if defined(SDL_VIDEO_RENDER_OGL_ES) && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_OGL_ES
 
 #include "SDL_hints.h"
 #include "../../video/SDL_sysvideo.h" /* For SDL_GL_SwapWindowWithResult */
@@ -1215,6 +1215,6 @@ SDL_RenderDriver GLES_RenderDriver = {
       0 }
 };
 
-#endif /* SDL_VIDEO_RENDER_OGL_ES && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_OGL_ES */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/opengles2/SDL_render_gles2.c b/src/render/opengles2/SDL_render_gles2.c
index 81d91bce8052..ffc09395fd69 100644
--- a/src/render/opengles2/SDL_render_gles2.c
+++ b/src/render/opengles2/SDL_render_gles2.c
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#if defined(SDL_VIDEO_RENDER_OGL_ES2) && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_OGL_ES2
 
 #include "SDL_hints.h"
 #include "../../video/SDL_sysvideo.h" /* For SDL_GL_SwapWindowWithResult */
@@ -2244,6 +2244,6 @@ SDL_RenderDriver GLES2_RenderDriver = {
       0 }
 };
 
-#endif /* SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_OGL_ES2 */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/opengles2/SDL_shaders_gles2.c b/src/render/opengles2/SDL_shaders_gles2.c
index cbb216bc581d..9a434f40b1ae 100644
--- a/src/render/opengles2/SDL_shaders_gles2.c
+++ b/src/render/opengles2/SDL_shaders_gles2.c
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#if defined(SDL_VIDEO_RENDER_OGL_ES2) && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_OGL_ES2
 
 #include "SDL_hints.h"
 #include "SDL_video.h"
@@ -444,6 +444,6 @@ const char *GLES2_GetShader(GLES2_ShaderType type)
     }
 }
 
-#endif /* SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_OGL_ES2 */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/opengles2/SDL_shaders_gles2.h b/src/render/opengles2/SDL_shaders_gles2.h
index f05d15a0eb8d..0be234f3ce36 100644
--- a/src/render/opengles2/SDL_shaders_gles2.h
+++ b/src/render/opengles2/SDL_shaders_gles2.h
@@ -23,7 +23,7 @@
 #ifndef SDL_shaders_gles2_h_
 #define SDL_shaders_gles2_h_
 
-#if defined(SDL_VIDEO_RENDER_OGL_ES2)
+#if SDL_VIDEO_RENDER_OGL_ES2
 
 typedef enum
 {
diff --git a/src/render/ps2/SDL_render_ps2.c b/src/render/ps2/SDL_render_ps2.c
index f45ea9eb2770..7c383a7a996d 100644
--- a/src/render/ps2/SDL_render_ps2.c
+++ b/src/render/ps2/SDL_render_ps2.c
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#ifdef SDL_VIDEO_RENDER_PS2
+#if SDL_VIDEO_RENDER_PS2
 
 #include "../SDL_sysrender.h"
 #include "SDL_hints.h"
diff --git a/src/render/psp/SDL_render_psp.c b/src/render/psp/SDL_render_psp.c
index eaccb52878b4..ed48d75f8ede 100644
--- a/src/render/psp/SDL_render_psp.c
+++ b/src/render/psp/SDL_render_psp.c
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#ifdef SDL_VIDEO_RENDER_PSP
+#if SDL_VIDEO_RENDER_PSP
 
 #include "SDL_hints.h"
 #include "../SDL_sysrender.h"
diff --git a/src/render/software/SDL_blendfillrect.c b/src/render/software/SDL_blendfillrect.c
index e0bd7faed63e..2026cb885d44 100644
--- a/src/render/software/SDL_blendfillrect.c
+++ b/src/render/software/SDL_blendfillrect.c
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_SW
 
 #include "SDL_draw.h"
 #include "SDL_blendfillrect.h"
@@ -343,6 +343,6 @@ int SDL_BlendFillRects(SDL_Surface *dst, const SDL_Rect *rects, int count,
     return status;
 }
 
-#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_SW */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/software/SDL_blendline.c b/src/render/software/SDL_blendline.c
index e5054689a235..19e2cdb0d6e9 100644
--- a/src/render/software/SDL_blendline.c
+++ b/src/render/software/SDL_blendline.c
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_SW
 
 #include "SDL_draw.h"
 #include "SDL_blendline.h"
@@ -859,6 +859,6 @@ int SDL_BlendLines(SDL_Surface *dst, const SDL_Point *points, int count,
     return 0;
 }
 
-#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_SW */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/software/SDL_blendpoint.c b/src/render/software/SDL_blendpoint.c
index 874a99ab838a..c3803711033f 100644
--- a/src/render/software/SDL_blendpoint.c
+++ b/src/render/software/SDL_blendpoint.c
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_SW
 
 #include "SDL_draw.h"
 #include "SDL_blendpoint.h"
@@ -348,6 +348,6 @@ int SDL_BlendPoints(SDL_Surface *dst, const SDL_Point *points, int count,
     return status;
 }
 
-#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_SW */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/software/SDL_drawline.c b/src/render/software/SDL_drawline.c
index 085b5db308e1..e164a8f08c26 100644
--- a/src/render/software/SDL_drawline.c
+++ b/src/render/software/SDL_drawline.c
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_SW
 
 #include "SDL_draw.h"
 #include "SDL_drawline.h"
@@ -197,6 +197,6 @@ int SDL_DrawLines(SDL_Surface *dst, const SDL_Point *points, int count,
     return 0;
 }
 
-#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_SW */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/software/SDL_drawpoint.c b/src/render/software/SDL_drawpoint.c
index dd4ef9feb77d..16bb9fac29a7 100644
--- a/src/render/software/SDL_drawpoint.c
+++ b/src/render/software/SDL_drawpoint.c
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_SW
 
 #include "SDL_draw.h"
 #include "SDL_drawpoint.h"
@@ -106,6 +106,6 @@ int SDL_DrawPoints(SDL_Surface *dst, const SDL_Point *points, int count,
     return 0;
 }
 
-#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_SW */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/software/SDL_render_sw.c b/src/render/software/SDL_render_sw.c
index 7aa457156122..b7843340f61b 100644
--- a/src/render/software/SDL_render_sw.c
+++ b/src/render/software/SDL_render_sw.c
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_SW
 
 #include "../SDL_sysrender.h"
 #include "SDL_render_sw_c.h"
@@ -1093,6 +1093,6 @@ SDL_RenderDriver SW_RenderDriver = {
      0}
 };
 
-#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_SW */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/software/SDL_rotate.c b/src/render/software/SDL_rotate.c
index d9faca4d430c..d29b92d68b19 100644
--- a/src/render/software/SDL_rotate.c
+++ b/src/render/software/SDL_rotate.c
@@ -30,7 +30,7 @@ Andreas Schiffler -- aschiffler at ferzkopp dot net
 */
 #include "../../SDL_internal.h"
 
-#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_SW
 
 #if defined(__WIN32__) || defined(__GDK__)
 #include "../../core/windows/SDL_windows.h"
@@ -617,4 +617,4 @@ SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, in
     return rz_dst;
 }
 
-#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_SW */
diff --git a/src/render/software/SDL_triangle.c b/src/render/software/SDL_triangle.c
index 31588b999e1a..f6af3dcabe30 100644
--- a/src/render/software/SDL_triangle.c
+++ b/src/render/software/SDL_triangle.c
@@ -20,7 +20,7 @@
 */
 #include "../../SDL_internal.h"
 
-#if SDL_VIDEO_RENDER_SW && !defined(SDL_RENDER_DISABLED)
+#if SDL_VIDEO_RENDER_SW
 
 #include <limits.h>
 
@@ -935,6 +935,6 @@ static void SDL_BlitTriangle_Slow(SDL_BlitInfo *info,
     TRIANGLE_END_LOOP
 }
 
-#endif /* SDL_VIDEO_RENDER_SW && !SDL_RENDER_DISABLED */
+#endif /* SDL_VIDEO_RENDER_SW */
 
 /* vi: set ts=4 sw=4 expandtab: */
diff --git a/src/render/vitagxm/SDL_render_vita_gxm.c b/src/render/vitagxm/SDL_render_vita_gxm.c
index be853485447d..081cdbaf49d7 100644
--- a/src/render/vitagxm/SDL_render_vita_gxm.c
+++ b/src/render/vitagxm/SDL_render_vita_gxm.c
@@ -20,7 +20,7 @@
 */
 

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