|
|
@@ -1329,33 +1329,26 @@ namespace bgfx
|
|
|
|
|
|
static RendererDestroyFn s_rendererDestroyFn;
|
|
|
|
|
|
- bool windowsVersionIsOrAbove(uint32_t _version)
|
|
|
+ struct Condition
|
|
|
{
|
|
|
-#if BX_PLATFORM_WINDOWS
|
|
|
- OSVERSIONINFOEXA ovi;
|
|
|
- memset(&ovi, 0, sizeof(ovi) );
|
|
|
- ovi.dwOSVersionInfoSize = sizeof(ovi);
|
|
|
- // _WIN32_WINNT_WINBLUE 0x0603
|
|
|
- // _WIN32_WINNT_WIN8 0x0602
|
|
|
- // _WIN32_WINNT_WIN7 0x0601
|
|
|
- // _WIN32_WINNT_VISTA 0x0600
|
|
|
- ovi.dwMajorVersion = HIBYTE(_version);
|
|
|
- ovi.dwMinorVersion = LOBYTE(_version);
|
|
|
- DWORDLONG cond = 0;
|
|
|
- VER_SET_CONDITION(cond, VER_MAJORVERSION, VER_GREATER_EQUAL);
|
|
|
- VER_SET_CONDITION(cond, VER_MINORVERSION, VER_GREATER_EQUAL);
|
|
|
- return !!VerifyVersionInfoA(&ovi, VER_MAJORVERSION | VER_MINORVERSION, cond);
|
|
|
-#else
|
|
|
- BX_UNUSED(_version);
|
|
|
- return false;
|
|
|
-#endif // BX_PLATFORM_WINDOWS
|
|
|
- }
|
|
|
+ enum Enum
|
|
|
+ {
|
|
|
+ LessEqual,
|
|
|
+ GreaterEqual,
|
|
|
+ };
|
|
|
+ };
|
|
|
|
|
|
- bool windowsVersionIsOrBellow(uint32_t _version)
|
|
|
+ bool windowsVersionIs(Condition::Enum _op, uint32_t _version)
|
|
|
{
|
|
|
#if BX_PLATFORM_WINDOWS
|
|
|
+ static const uint8_t s_condition[] =
|
|
|
+ {
|
|
|
+ VER_LESS_EQUAL,
|
|
|
+ VER_GREATER_EQUAL,
|
|
|
+ };
|
|
|
+
|
|
|
OSVERSIONINFOEXA ovi;
|
|
|
- memset(&ovi, 0, sizeof(ovi));
|
|
|
+ memset(&ovi, 0, sizeof(ovi) );
|
|
|
ovi.dwOSVersionInfoSize = sizeof(ovi);
|
|
|
// _WIN32_WINNT_WINBLUE 0x0603
|
|
|
// _WIN32_WINNT_WIN8 0x0602
|
|
|
@@ -1364,8 +1357,8 @@ namespace bgfx
|
|
|
ovi.dwMajorVersion = HIBYTE(_version);
|
|
|
ovi.dwMinorVersion = LOBYTE(_version);
|
|
|
DWORDLONG cond = 0;
|
|
|
- VER_SET_CONDITION(cond, VER_MAJORVERSION, VER_LESS_EQUAL);
|
|
|
- VER_SET_CONDITION(cond, VER_MINORVERSION, VER_LESS_EQUAL);
|
|
|
+ VER_SET_CONDITION(cond, VER_MAJORVERSION, s_condition[_op]);
|
|
|
+ VER_SET_CONDITION(cond, VER_MINORVERSION, s_condition[_op]);
|
|
|
return !!VerifyVersionInfoA(&ovi, VER_MAJORVERSION | VER_MINORVERSION, cond);
|
|
|
#else
|
|
|
BX_UNUSED(_version);
|
|
|
@@ -1383,14 +1376,14 @@ again:
|
|
|
RendererType::Enum first = RendererType::Direct3D9;
|
|
|
RendererType::Enum second = RendererType::Direct3D11;
|
|
|
|
|
|
- if (windowsVersionIsOrAbove(0x0603) )
|
|
|
+ if (windowsVersionIs(Condition::GreaterEqual, 0x0603) )
|
|
|
{
|
|
|
first = RendererType::Direct3D11 /* Direct3D12 */;
|
|
|
second = RendererType::Direct3D11;
|
|
|
if (!s_rendererCreator[second].supported)
|
|
|
second = RendererType::Direct3D9;
|
|
|
}
|
|
|
- else if (windowsVersionIsOrAbove(0x0601) )
|
|
|
+ else if (windowsVersionIs(Condition::GreaterEqual, 0x0601) )
|
|
|
{
|
|
|
first = RendererType::Direct3D11;
|
|
|
second = RendererType::Direct3D9;
|
|
|
@@ -1913,7 +1906,12 @@ again:
|
|
|
uint8_t num = 0;
|
|
|
for (uint8_t ii = 0; ii < uint8_t(RendererType::Count); ++ii)
|
|
|
{
|
|
|
- if ((ii == RendererType::Direct3D11) && windowsVersionIsOrBellow(0x0502)) continue;
|
|
|
+ if (RendererType::Direct3D11 == ii
|
|
|
+ && windowsVersionIs(Condition::LessEqual, 0x0502) )
|
|
|
+ {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
if (s_rendererCreator[ii].supported)
|
|
|
{
|
|
|
_enum[num++] = RendererType::Enum(ii);
|