diff --git a/VERSION b/VERSION index aa8ea2a0..209b1692 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -B1-54-g5033d17990+1 \ No newline at end of file +B1-55-g7469f54122+1 \ No newline at end of file diff --git a/c-host/platform/Windows/capture/DXGI/src/dxgi.c b/c-host/platform/Windows/capture/DXGI/src/dxgi.c index 623a6bb5..fc908145 100644 --- a/c-host/platform/Windows/capture/DXGI/src/dxgi.c +++ b/c-host/platform/Windows/capture/DXGI/src/dxgi.c @@ -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, diff --git a/common/include/common/windebug.h b/common/include/common/windebug.h index 729aa0d5..b897d697 100644 --- a/common/include/common/windebug.h +++ b/common/include/common/windebug.h @@ -21,6 +21,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA #include "debug.h" #include +#include #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 \ No newline at end of file diff --git a/common/src/platform/windows/windebug.c b/common/src/platform/windows/windebug.c index 2ae65002..bee4bf4d 100644 --- a/common/src/platform/windows/windebug.c +++ b/common/src/platform/windows/windebug.c @@ -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; } \ No newline at end of file