diff options
Diffstat (limited to 'src/ext/DirectX/ca/directx.cpp')
-rw-r--r-- | src/ext/DirectX/ca/directx.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/ext/DirectX/ca/directx.cpp b/src/ext/DirectX/ca/directx.cpp new file mode 100644 index 00000000..21838262 --- /dev/null +++ b/src/ext/DirectX/ca/directx.cpp | |||
@@ -0,0 +1,49 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | #include "precomp.h" | ||
4 | |||
5 | /******************************************************************** | ||
6 | WixQueryDirectXCaps - entry point for WixQueryDirectXCaps CA | ||
7 | |||
8 | Called as Type 1 custom action (DLL from the Binary table) from | ||
9 | Windows Installer to set properties that identify the DirectX | ||
10 | capabilities ("caps") of the system. | ||
11 | ********************************************************************/ | ||
12 | extern "C" UINT __stdcall WixQueryDirectXCaps( | ||
13 | __in MSIHANDLE hInstall | ||
14 | ) | ||
15 | { | ||
16 | #if 0 | ||
17 | ::MessageBoxA(0, "break into debugger now please", "---->> ATTACH TO ME!", MB_ICONEXCLAMATION); | ||
18 | #endif | ||
19 | |||
20 | HRESULT hr = S_OK; | ||
21 | DWORD er = ERROR_SUCCESS; | ||
22 | LPDIRECT3D9 pD3D = NULL; | ||
23 | |||
24 | hr = WcaInitialize(hInstall, "WixQueryDirectXCaps"); | ||
25 | ExitOnFailure(hr, "failed to initialize"); | ||
26 | |||
27 | pD3D = Direct3DCreate9(D3D_SDK_VERSION); | ||
28 | ExitOnNull(pD3D, hr, E_FAIL, "Direct3DCreate9 failed"); | ||
29 | |||
30 | D3DCAPS9 d3dCaps; | ||
31 | hr = pD3D->GetDeviceCaps( | ||
32 | 0, // first adapter | ||
33 | D3DDEVTYPE_HAL, // fail on non-HAL devices | ||
34 | &d3dCaps | ||
35 | ); | ||
36 | ExitOnFailure(hr, "GetDeviceCaps call failed"); | ||
37 | |||
38 | int iVertexShaderVersion = D3DSHADER_VERSION_MAJOR(d3dCaps.VertexShaderVersion) * 100 + D3DSHADER_VERSION_MINOR(d3dCaps.VertexShaderVersion); | ||
39 | WcaSetIntProperty(L"WIX_DIRECTX_VERTEXSHADERVERSION", iVertexShaderVersion); | ||
40 | |||
41 | int iPixelShaderVersion = D3DSHADER_VERSION_MAJOR(d3dCaps.PixelShaderVersion) * 100 + D3DSHADER_VERSION_MINOR(d3dCaps.PixelShaderVersion); | ||
42 | WcaSetIntProperty(L"WIX_DIRECTX_PIXELSHADERVERSION", iPixelShaderVersion); | ||
43 | |||
44 | LExit: | ||
45 | ReleaseObject(pD3D); | ||
46 | return WcaFinalize(er = FAILED(hr) ? ERROR_INSTALL_FAILURE : er); | ||
47 | } | ||
48 | |||
49 | |||