|
1 | | -#if (YY_Thunks_Target < __WindowsNT6_1) |
2 | | -#include <d3d11.h> |
3 | | -#endif |
4 | | - |
5 | | -namespace YY::Thunks |
6 | | -{ |
7 | | -#if (YY_Thunks_Target < __WindowsNT6_1) |
8 | | - |
9 | | - // Windows 7自带,Vista需要安装KB971644 |
10 | | - __DEFINE_THUNK( |
11 | | - d3d11, |
12 | | - 40, |
13 | | - HRESULT, |
14 | | - WINAPI, |
15 | | - D3D11CreateDevice, |
16 | | - _In_opt_ IDXGIAdapter* pAdapter, |
17 | | - D3D_DRIVER_TYPE DriverType, |
18 | | - HMODULE Software, |
19 | | - UINT Flags, |
20 | | - _In_reads_opt_( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels, |
21 | | - UINT FeatureLevels, |
22 | | - UINT SDKVersion, |
23 | | - _COM_Outptr_opt_ ID3D11Device** ppDevice, |
24 | | - _Out_opt_ D3D_FEATURE_LEVEL* pFeatureLevel, |
25 | | - _COM_Outptr_opt_ ID3D11DeviceContext** ppImmediateContext |
26 | | - ) |
27 | | - { |
28 | | - if (const auto _pfnD3D11CreateDevice = try_get_D3D11CreateDevice()) |
29 | | - { |
30 | | - return _pfnD3D11CreateDevice(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, ppDevice, pFeatureLevel, ppImmediateContext); |
31 | | - } |
32 | | - |
33 | | - if (ppDevice) |
34 | | - *ppDevice = nullptr; |
35 | | - |
36 | | - if (ppImmediateContext) |
37 | | - *ppImmediateContext = nullptr; |
38 | | - |
39 | | - return E_NOINTERFACE; |
40 | | - } |
41 | | -#endif |
42 | | -} |
| 1 | +#if (YY_Thunks_Target < __WindowsNT6_1) |
| 2 | +#include <d3d11.h> |
| 3 | +#endif |
| 4 | + |
| 5 | +#if (YY_Thunks_Target < __WindowsNT10_10240) |
| 6 | +#include <windows.graphics.directx.direct3d11.interop.h> |
| 7 | +#endif |
| 8 | + |
| 9 | +namespace YY::Thunks |
| 10 | +{ |
| 11 | +#if (YY_Thunks_Target < __WindowsNT6_1) |
| 12 | + |
| 13 | + // Windows 7自带,Vista需要安装KB971644 |
| 14 | + __DEFINE_THUNK( |
| 15 | + d3d11, |
| 16 | + 40, |
| 17 | + HRESULT, |
| 18 | + WINAPI, |
| 19 | + D3D11CreateDevice, |
| 20 | + _In_opt_ IDXGIAdapter* pAdapter, |
| 21 | + D3D_DRIVER_TYPE DriverType, |
| 22 | + HMODULE Software, |
| 23 | + UINT Flags, |
| 24 | + _In_reads_opt_( FeatureLevels ) CONST D3D_FEATURE_LEVEL* pFeatureLevels, |
| 25 | + UINT FeatureLevels, |
| 26 | + UINT SDKVersion, |
| 27 | + _COM_Outptr_opt_ ID3D11Device** ppDevice, |
| 28 | + _Out_opt_ D3D_FEATURE_LEVEL* pFeatureLevel, |
| 29 | + _COM_Outptr_opt_ ID3D11DeviceContext** ppImmediateContext |
| 30 | + ) |
| 31 | + { |
| 32 | + if (const auto _pfnD3D11CreateDevice = try_get_D3D11CreateDevice()) |
| 33 | + { |
| 34 | + return _pfnD3D11CreateDevice(pAdapter, DriverType, Software, Flags, pFeatureLevels, FeatureLevels, SDKVersion, ppDevice, pFeatureLevel, ppImmediateContext); |
| 35 | + } |
| 36 | + |
| 37 | + if (ppDevice) |
| 38 | + *ppDevice = nullptr; |
| 39 | + |
| 40 | + if (ppImmediateContext) |
| 41 | + *ppImmediateContext = nullptr; |
| 42 | + |
| 43 | + return E_NOINTERFACE; |
| 44 | + } |
| 45 | +#endif |
| 46 | + |
| 47 | + |
| 48 | +#if (YY_Thunks_Target < __WindowsNT10_10240) |
| 49 | + |
| 50 | + // 已知 Windows 10 10240已经自带 |
| 51 | + __DEFINE_THUNK( |
| 52 | + d3d11, |
| 53 | + 8, |
| 54 | + HRESULT, |
| 55 | + WINAPI, |
| 56 | + CreateDirect3D11DeviceFromDXGIDevice, |
| 57 | + _In_opt_ IDXGIDevice* _pDxgiDevice, |
| 58 | + _COM_Outptr_ IInspectable** _ppGraphicsDevice |
| 59 | + ) |
| 60 | + { |
| 61 | + if (const auto _pfnCreateDirect3D11DeviceFromDXGIDevice = try_get_CreateDirect3D11DeviceFromDXGIDevice()) |
| 62 | + { |
| 63 | + return _pfnCreateDirect3D11DeviceFromDXGIDevice(_pDxgiDevice, _ppGraphicsDevice); |
| 64 | + } |
| 65 | + |
| 66 | + if (_ppGraphicsDevice) |
| 67 | + *_ppGraphicsDevice = nullptr; |
| 68 | + |
| 69 | + return E_NOINTERFACE; |
| 70 | + } |
| 71 | +#endif |
| 72 | +} |
0 commit comments