D3D11HostDisplay: Add __has_include check for dxgi1_5.h

This commit is contained in:
Connor McLaughlin 2020-07-09 13:24:56 +10:00
parent 9685be9064
commit 60a739e305
1 changed files with 4 additions and 0 deletions

View File

@ -6,7 +6,9 @@
#include "display_ps.hlsl.h" #include "display_ps.hlsl.h"
#include "display_vs.hlsl.h" #include "display_vs.hlsl.h"
#include <array> #include <array>
#if defined(__has_include) && __has_include(<dxgi1_5.h>)
#include <dxgi1_5.h> #include <dxgi1_5.h>
#endif
#include <imgui.h> #include <imgui.h>
#include <imgui_impl_dx11.h> #include <imgui_impl_dx11.h>
Log_SetChannel(D3D11HostDisplay); Log_SetChannel(D3D11HostDisplay);
@ -258,6 +260,7 @@ bool D3D11HostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view
} }
m_allow_tearing_supported = false; m_allow_tearing_supported = false;
#if defined(__has_include) && __has_include(<dxgi1_5.h>)
ComPtr<IDXGIFactory5> dxgi_factory5; ComPtr<IDXGIFactory5> dxgi_factory5;
hr = m_dxgi_factory.As(&dxgi_factory5); hr = m_dxgi_factory.As(&dxgi_factory5);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
@ -268,6 +271,7 @@ bool D3D11HostDisplay::CreateRenderDevice(const WindowInfo& wi, std::string_view
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
m_allow_tearing_supported = (allow_tearing_supported == TRUE); m_allow_tearing_supported = (allow_tearing_supported == TRUE);
} }
#endif
m_window_info = wi; m_window_info = wi;
return true; return true;