diff --git a/src/core/windows/SDL_windows.c b/src/core/windows/SDL_windows.c index 16934d5e1..7f162185f 100644 --- a/src/core/windows/SDL_windows.c +++ b/src/core/windows/SDL_windows.c @@ -88,6 +88,31 @@ WIN_CoUninitialize(void) #endif } +static BOOL +IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServicePackMajor) +{ + OSVERSIONINFOEXW osvi; + DWORDLONG const dwlConditionMask = VerSetConditionMask( + VerSetConditionMask( + VerSetConditionMask( + 0, VER_MAJORVERSION, VER_GREATER_EQUAL ), + VER_MINORVERSION, VER_GREATER_EQUAL ), + VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL ); + + SDL_zero(osvi); + osvi.dwOSVersionInfoSize = sizeof(osvi); + osvi.dwMajorVersion = wMajorVersion; + osvi.dwMinorVersion = wMinorVersion; + osvi.wServicePackMajor = wServicePackMajor; + + return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, dwlConditionMask) != FALSE; +} + +BOOL WIN_IsWindowsVistaOrGreater() +{ + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_VISTA), LOBYTE(_WIN32_WINNT_VISTA), 0); +} + #endif /* __WIN32__ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/core/windows/SDL_windows.h b/src/core/windows/SDL_windows.h index 45c9d7347..bb563ccd0 100644 --- a/src/core/windows/SDL_windows.h +++ b/src/core/windows/SDL_windows.h @@ -56,6 +56,9 @@ extern int WIN_SetError(const char *prefix); extern HRESULT WIN_CoInitialize(void); extern void WIN_CoUninitialize(void); +/* Returns SDL_TRUE if we're running on Windows Vista and newer */ +extern BOOL WIN_IsWindowsVistaOrGreater(); + #endif /* _INCLUDED_WINDOWS_H */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/src/video/SDL_egl.c b/src/video/SDL_egl.c index e0efa64ef..cb0cfe2a4 100644 --- a/src/video/SDL_egl.c +++ b/src/video/SDL_egl.c @@ -135,8 +135,11 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa #if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT d3dcompiler = SDL_GetHint(SDL_HINT_VIDEO_WIN_D3DCOMPILER); if (!d3dcompiler) { - /* By default we load the Vista+ compatible compiler */ - d3dcompiler = "d3dcompiler_46.dll"; + if (WIN_IsWindowsVistaOrGreater()) { + d3dcompiler = "d3dcompiler_46.dll"; + } else { + d3dcompiler = "none"; + } } if (SDL_strcasecmp(d3dcompiler, "none") != 0) { SDL_LoadObject(d3dcompiler);