From ebf91f3580456e208e86a1b1049369510182131d Mon Sep 17 00:00:00 2001 From: Sunrisepeak Date: Wed, 18 Nov 2026 22:53:30 +0900 Subject: [PATCH] feat(compat.sdl3): switch no-render-accelerated for 3.4.18 (revision 2) One more feature, off by default, so the default build is the one it was: at the end of the generated SDL_build_config.h, after every platform's config, it undefines the 2D renderer's accelerated back ends (SDL_VIDEO_RENDER_D3D, _D3D11, _D3D12, _GPU, _METAL, _VULKAN, _OGL, _OGL_ES2). SDL_Renderer keeps its software back end and presents through the window's surface; SDL_GPU itself stays for a program that uses it. Measured on a consumer that draws its own frames and uses SDL_Renderer only to present them (Linux x64, GCC 16, -O3): 235 KB less of an 18.1 MB program; its first frame is shown as before. 3.4.18's packaging is revision 2 with floor 2: the generated header is part of the installed payload, so installed copies are replaced to take the switch. --- pkgs/c/compat.sdl3.lua | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/pkgs/c/compat.sdl3.lua b/pkgs/c/compat.sdl3.lua index 2251599f..c5e376dd 100644 --- a/pkgs/c/compat.sdl3.lua +++ b/pkgs/c/compat.sdl3.lua @@ -186,8 +186,9 @@ package = { sha256 = "c4b08b950bd29d83caae0ab8d884298d27046a9d30700fb42841c50992665c90", -- 1: the switches no-render and no-hidapi, read at the top of -- the generated SDL_build_config.h (installed copies take them). - revision = 1, - floor = 1, + -- 2: the switch no-render-accelerated, beside them. + revision = 2, + floor = 2, }, }, macosx = { @@ -204,8 +205,9 @@ package = { sha256 = "c4b08b950bd29d83caae0ab8d884298d27046a9d30700fb42841c50992665c90", -- 1: the switches no-render and no-hidapi, read at the top of -- the generated SDL_build_config.h (installed copies take them). - revision = 1, - floor = 1, + -- 2: the switch no-render-accelerated, beside them. + revision = 2, + floor = 2, }, }, windows = { @@ -222,8 +224,9 @@ package = { sha256 = "c4b08b950bd29d83caae0ab8d884298d27046a9d30700fb42841c50992665c90", -- 1: the switches no-render and no-hidapi, read at the top of -- the generated SDL_build_config.h (installed copies take them). - revision = 1, - floor = 1, + -- 2: the switch no-render-accelerated, beside them. + revision = 2, + floor = 2, }, }, }, @@ -868,7 +871,8 @@ typedef unsigned int uintptr_t; #endif /* platform config */ -/* The package's switches (features `no-render`, `no-hidapi`), after every +/* The package's switches (features `no-render`, `no-hidapi`, + `no-render-accelerated`), after every platform's config so they win over its defines: mcpp defines MCPP_FEATURE_ for this package's own units when one is on. */ #ifdef MCPP_FEATURE_NO_RENDER @@ -878,6 +882,16 @@ typedef unsigned int uintptr_t; #define SDL_HIDAPI_DISABLED 1 #undef SDL_JOYSTICK_HIDAPI #endif +#ifdef MCPP_FEATURE_NO_RENDER_ACCELERATED +#undef SDL_VIDEO_RENDER_D3D +#undef SDL_VIDEO_RENDER_D3D11 +#undef SDL_VIDEO_RENDER_D3D12 +#undef SDL_VIDEO_RENDER_GPU +#undef SDL_VIDEO_RENDER_METAL +#undef SDL_VIDEO_RENDER_VULKAN +#undef SDL_VIDEO_RENDER_OGL +#undef SDL_VIDEO_RENDER_OGL_ES2 +#endif #endif /* SDL_build_config_h_ */ ]==], @@ -962,9 +976,15 @@ typedef unsigned int uintptr_t; -- surfaces and events stay -- no-hidapi HIDAPI's game-controller drivers (the evdev joystick -- path stays) + -- no-render-accelerated the 2D renderer's accelerated back ends + -- (Direct3D, Metal, Vulkan, OpenGL, OpenGL ES 2 and the + -- one over SDL_GPU): SDL_Renderer keeps its software + -- back end, presenting through the window's surface; + -- SDL_GPU itself stays for a program that uses it features = { ["no-render"] = {}, ["no-hidapi"] = {}, + ["no-render-accelerated"] = {}, }, linux = {