Skip to content

Commit 77a8f8f

Browse files
committed
FOrgot to add this file
1 parent 20a8129 commit 77a8f8f

1 file changed

Lines changed: 63 additions & 0 deletions

File tree

gfx/common/dx_guids.c

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/* dx_guids.c
2+
*
3+
* Emits DirectX COM GUID storage in lieu of linking dxguid.lib.
4+
*
5+
* The Windows 7.x Platform SDK (bundled with MSVC 2010 and earlier)
6+
* does not ship dxguid.lib. Rather than require the legacy June 2010
7+
* DirectX SDK just to pick up a handful of IID_* / CLSID_* constants,
8+
* we define them ourselves in this single translation unit.
9+
*
10+
* Including <initguid.h> before any DX header causes DEFINE_GUID() to
11+
* expand to actual storage rather than extern references. Every other
12+
* TU in the program continues to see the default extern declarations
13+
* and resolves the GUIDs to the storage defined here at link time.
14+
*
15+
* IMPORTANT: no other TU in the program may include <initguid.h>
16+
* before DirectX headers, or the linker will report duplicate symbols
17+
* for IID_* / CLSID_* constants.
18+
*
19+
* This file is for the non-griffin build. The griffin build gets the
20+
* same behavior by including <initguid.h> at the top of griffin.c.
21+
*
22+
* The guard below disables this TU on:
23+
* * non-Windows platforms
24+
* * Xbox (its own SDKs provide GUID storage)
25+
* * UWP / WinRT (the modern Windows SDK ships dxguid.lib)
26+
* * griffin builds (griffin.c does the job there)
27+
*/
28+
29+
#if defined(_WIN32) && !defined(_XBOX) && !defined(HAVE_GRIFFIN) \
30+
&& (!defined(WINAPI_FAMILY) || (WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP))
31+
32+
#include <initguid.h>
33+
34+
#ifdef HAVE_D3D12
35+
#include <d3d12.h>
36+
#include <d3d12shader.h>
37+
#endif
38+
#ifdef HAVE_D3D11
39+
#include <d3d11.h>
40+
#include <d3d11shader.h>
41+
#endif
42+
#ifdef HAVE_D3D10
43+
#include <d3d10.h>
44+
#endif
45+
#ifdef HAVE_D3D9
46+
#include <d3d9.h>
47+
#endif
48+
#ifdef HAVE_D3D8
49+
#include <d3d8.h>
50+
#endif
51+
#if defined(HAVE_D3D9) || defined(HAVE_D3D10) \
52+
|| defined(HAVE_D3D11) || defined(HAVE_D3D12)
53+
#include <d3dcompiler.h>
54+
#include <dxgi.h>
55+
#endif
56+
#ifdef HAVE_DINPUT
57+
#include <dinput.h>
58+
#endif
59+
#ifdef HAVE_XAUDIO
60+
#include <xaudio2.h>
61+
#endif
62+
63+
#endif /* _WIN32 && !_XBOX && !HAVE_GRIFFIN && desktop */

0 commit comments

Comments
 (0)