Temporary hack to address performance issues in https://github.com/libsdl-org/SDL/issues/6581#issuecomment-1327987916 (thanks @icculus!)

main
Sam Lantinga 2022-11-26 13:09:50 -08:00
parent bb5568ac4f
commit 9c8369e097
1 changed files with 9 additions and 1 deletions

View File

@ -500,13 +500,21 @@ SDL_Quit(void)
void void
SDL_GetVersion(SDL_version * ver) SDL_GetVersion(SDL_version * ver)
{ {
static SDL_bool check_hint = SDL_TRUE;
static SDL_bool legacy_version = SDL_FALSE;
if (!ver) { if (!ver) {
return; return;
} }
SDL_VERSION(ver); SDL_VERSION(ver);
if (SDL_GetHintBoolean("SDL_LEGACY_VERSION", SDL_FALSE)) { if (check_hint) {
check_hint = SDL_FALSE;
legacy_version = SDL_GetHintBoolean("SDL_LEGACY_VERSION", SDL_FALSE);
}
if (legacy_version) {
/* Prior to SDL 2.24.0, the patch version was incremented with every release */ /* Prior to SDL 2.24.0, the patch version was incremented with every release */
ver->patch = ver->minor; ver->patch = ver->minor;
ver->minor = 0; ver->minor = 0;