Skip to content
Permalink
Browse files

Don't try to load d3dcompiler_46.dll on Windows XP

  • Loading branch information
slouken committed Apr 23, 2014
1 parent af395e9 commit acbc321c2acbc4282da6c3dc9cc61a9377f74d07
Showing with 33 additions and 2 deletions.
  1. +25 −0 src/core/windows/SDL_windows.c
  2. +3 −0 src/core/windows/SDL_windows.h
  3. +5 −2 src/video/SDL_egl.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: */
@@ -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: */
@@ -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);

0 comments on commit acbc321

Please sign in to comment.