[c-host] dont use DX12 feature levels on Windows8

Fixes #218
This commit is contained in:
Geoffrey McRae
2020-01-06 20:52:27 +11:00
parent 9282ed19b2
commit 5db4c32035
4 changed files with 52 additions and 3 deletions

View File

@@ -21,6 +21,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include "debug.h"
#include <windows.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
@@ -30,6 +31,8 @@ void DebugWinError(const char * file, const unsigned int line, const char * func
#define DEBUG_WINERROR(x, y) DebugWinError(STRIPPATH(__FILE__), __LINE__, __FUNCTION__, x, y)
bool IsWindows8();
#ifdef __cplusplus
}
#endif

View File

@@ -39,4 +39,26 @@ void DebugWinError(const char * file, const unsigned int line, const char * func
fprintf(stderr, "[E] %20s:%-4u | %-30s | %s: 0x%08x (%s)\n", file, line, function, desc, (int)status, buffer);
LocalFree(buffer);
}
/* credit for this function to: https://stackoverflow.com/questions/17399302/how-can-i-detect-windows-8-1-in-a-desktop-application */
inline static BOOL CompareWindowsVersion(DWORD dwMajorVersion, DWORD dwMinorVersion)
{
OSVERSIONINFOEX ver;
DWORDLONG dwlConditionMask = 0;
ZeroMemory(&ver, sizeof(OSVERSIONINFOEX));
ver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
ver.dwMajorVersion = dwMajorVersion;
ver.dwMinorVersion = dwMinorVersion;
VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, VER_EQUAL);
VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, VER_EQUAL);
return VerifyVersionInfo(&ver, VER_MAJORVERSION | VER_MINORVERSION, dwlConditionMask);
}
bool IsWindows8()
{
return CompareWindowsVersion(6, 3) == TRUE;
}