mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
parent
9282ed19b2
commit
5db4c32035
@ -307,7 +307,18 @@ static bool dxgi_init(void * pointerShape, const unsigned int pointerSize)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
static const D3D_FEATURE_LEVEL featureLevels[] =
|
||||
static const D3D_FEATURE_LEVEL win8[] =
|
||||
{
|
||||
D3D_FEATURE_LEVEL_11_1,
|
||||
D3D_FEATURE_LEVEL_11_0,
|
||||
D3D_FEATURE_LEVEL_10_1,
|
||||
D3D_FEATURE_LEVEL_10_0,
|
||||
D3D_FEATURE_LEVEL_9_3,
|
||||
D3D_FEATURE_LEVEL_9_2,
|
||||
D3D_FEATURE_LEVEL_9_1
|
||||
};
|
||||
|
||||
static const D3D_FEATURE_LEVEL win10[] =
|
||||
{
|
||||
D3D_FEATURE_LEVEL_12_1,
|
||||
D3D_FEATURE_LEVEL_12_0,
|
||||
@ -320,6 +331,19 @@ static bool dxgi_init(void * pointerShape, const unsigned int pointerSize)
|
||||
D3D_FEATURE_LEVEL_9_1
|
||||
};
|
||||
|
||||
const D3D_FEATURE_LEVEL * featureLevels;
|
||||
unsigned int featureLevelCount;
|
||||
if (IsWindows8())
|
||||
{
|
||||
featureLevels = win8;
|
||||
featureLevelCount = sizeof(win8) / sizeof(D3D_FEATURE_LEVEL);
|
||||
}
|
||||
else
|
||||
{
|
||||
featureLevels = win10;
|
||||
featureLevelCount = sizeof(win10) / sizeof(D3D_FEATURE_LEVEL);
|
||||
}
|
||||
|
||||
IDXGIAdapter * tmp;
|
||||
status = IDXGIAdapter1_QueryInterface(this->adapter, &IID_IDXGIAdapter, (void **)&tmp);
|
||||
if (FAILED(status))
|
||||
@ -333,7 +357,7 @@ static bool dxgi_init(void * pointerShape, const unsigned int pointerSize)
|
||||
D3D_DRIVER_TYPE_UNKNOWN,
|
||||
NULL,
|
||||
D3D11_CREATE_DEVICE_VIDEO_SUPPORT,
|
||||
featureLevels, sizeof(featureLevels) / sizeof(D3D_FEATURE_LEVEL),
|
||||
featureLevels, featureLevelCount,
|
||||
D3D11_SDK_VERSION,
|
||||
&this->device,
|
||||
&this->featureLevel,
|
||||
|
@ -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
|
@ -40,3 +40,25 @@ 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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user