Line | Count | Source (jump to first uncovered line) |
1 | | //===- WinIncludes.h --------------------------------------------*- C++ -*-===// |
2 | | /////////////////////////////////////////////////////////////////////////////// |
3 | | // // |
4 | | // WinIncludes.h // |
5 | | // Copyright (C) Microsoft Corporation. All rights reserved. // |
6 | | // This file is distributed under the University of Illinois Open Source // |
7 | | // License. See LICENSE.TXT for details. // |
8 | | // // |
9 | | /////////////////////////////////////////////////////////////////////////////// |
10 | | |
11 | | #pragma once |
12 | | |
13 | | #ifdef _MSC_VER |
14 | | |
15 | | // mingw-w64 tends to define it as 0x0502 in its headers. |
16 | | #undef _WIN32_WINNT |
17 | | #undef _WIN32_IE |
18 | | |
19 | | // Require at least Windows 7 (Updated from XP) |
20 | | #define _WIN32_WINNT 0x0601 |
21 | | #define _WIN32_IE 0x0800 // MinGW at it again. |
22 | | |
23 | | #define NOATOM 1 |
24 | | #define NOGDICAPMASKS 1 |
25 | | #define NOMETAFILE 1 |
26 | | #ifndef NOMINMAX |
27 | | #define NOMINMAX 1 |
28 | | #endif |
29 | | #define NOOPENFILE 1 |
30 | | #define NORASTEROPS 1 |
31 | | #define NOSCROLL 1 |
32 | | #define NOSOUND 1 |
33 | | #define NOSYSMETRICS 1 |
34 | | #define NOWH 1 |
35 | | #define NOCOMM 1 |
36 | | #define NOKANJI 1 |
37 | | #define NOCRYPT 1 |
38 | | #define NOMCX 1 |
39 | | #define WIN32_LEAN_AND_MEAN 1 |
40 | | #define VC_EXTRALEAN 1 |
41 | | #define NONAMELESSSTRUCT 1 |
42 | | |
43 | | #include <ObjIdl.h> |
44 | | #include <atlbase.h> // atlbase.h needs to come before strsafe.h |
45 | | #include <intsafe.h> |
46 | | #include <strsafe.h> |
47 | | #include <unknwn.h> |
48 | | #include <windows.h> |
49 | | |
50 | | #include "dxc/config.h" |
51 | | |
52 | | // Support older atlbase.h if needed |
53 | | #ifndef _ATL_DECLSPEC_ALLOCATOR |
54 | | #define _ATL_DECLSPEC_ALLOCATOR |
55 | | #endif |
56 | | |
57 | | /// Swap two ComPtr classes. |
58 | | template <class T> void swap(CComHeapPtr<T> &a, CComHeapPtr<T> &b) { |
59 | | T *c(a.m_pData); |
60 | | a.m_pData = b.m_pData; |
61 | | b.m_pData = c; |
62 | | } |
63 | | |
64 | | #else // _MSC_VER |
65 | | |
66 | | #include "dxc/WinAdapter.h" |
67 | | |
68 | | #ifdef __cplusplus |
69 | | #if !defined(DEFINE_ENUM_FLAG_OPERATORS) |
70 | | // Define operator overloads to enable bit operations on enum values that are |
71 | | // used to define flags. Use DEFINE_ENUM_FLAG_OPERATORS(YOUR_TYPE) to enable |
72 | | // these operators on YOUR_TYPE. |
73 | | extern "C++" { |
74 | | template <size_t S> struct _ENUM_FLAG_INTEGER_FOR_SIZE; |
75 | | |
76 | | template <> struct _ENUM_FLAG_INTEGER_FOR_SIZE<1> { typedef int8_t type; }; |
77 | | |
78 | | template <> struct _ENUM_FLAG_INTEGER_FOR_SIZE<2> { typedef int16_t type; }; |
79 | | |
80 | | template <> struct _ENUM_FLAG_INTEGER_FOR_SIZE<4> { typedef int32_t type; }; |
81 | | |
82 | | // used as an approximation of std::underlying_type<T> |
83 | | template <class T> struct _ENUM_FLAG_SIZED_INTEGER { |
84 | | typedef typename _ENUM_FLAG_INTEGER_FOR_SIZE<sizeof(T)>::type type; |
85 | | }; |
86 | | } |
87 | | #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \ |
88 | | extern "C++" { \ |
89 | 1.09k | inline ENUMTYPE operator|(ENUMTYPE a, ENUMTYPE b) { \ |
90 | 1.09k | return ENUMTYPE(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)a) | \ |
91 | 1.09k | ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); \ |
92 | 1.09k | } \ Unexecuted instantiation: hlsl::operator|(hlsl::DxilRootSignatureFlags, hlsl::DxilRootSignatureFlags) Unexecuted instantiation: hlsl::operator|(hlsl::DxilRootDescriptorFlags, hlsl::DxilRootDescriptorFlags) Unexecuted instantiation: hlsl::operator|(hlsl::DxilDescriptorRangeType, hlsl::DxilDescriptorRangeType) hlsl::operator|(hlsl::DxilDescriptorRangeFlags, hlsl::DxilDescriptorRangeFlags) Line | Count | Source | 89 | 1.09k | inline ENUMTYPE operator|(ENUMTYPE a, ENUMTYPE b) { \ | 90 | 1.09k | return ENUMTYPE(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)a) | \ | 91 | 1.09k | ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); \ | 92 | 1.09k | } \ |
Unexecuted instantiation: operator|(hlsl::DxilRootSignatureFlags, hlsl::DxilRootSignatureFlags) Unexecuted instantiation: operator|(hlsl::DxilRootDescriptorFlags, hlsl::DxilRootDescriptorFlags) Unexecuted instantiation: operator|(hlsl::DxilDescriptorRangeFlags, hlsl::DxilDescriptorRangeFlags) Unexecuted instantiation: operator|(hlsl::DxilRootSignatureCompilationFlags, hlsl::DxilRootSignatureCompilationFlags) |
93 | 592 | inline ENUMTYPE &operator|=(ENUMTYPE &a, ENUMTYPE b) { \ |
94 | 592 | return (ENUMTYPE &)(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type &)a) |= \ |
95 | 592 | ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); \ |
96 | 592 | } \ hlsl::operator|=(hlsl::DxilDescriptorRangeFlags&, hlsl::DxilDescriptorRangeFlags) Line | Count | Source | 93 | 128 | inline ENUMTYPE &operator|=(ENUMTYPE &a, ENUMTYPE b) { \ | 94 | 128 | return (ENUMTYPE &)(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type &)a) |= \ | 95 | 128 | ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); \ | 96 | 128 | } \ |
Unexecuted instantiation: hlsl::operator|=(hlsl::DxilRootSignatureFlags&, hlsl::DxilRootSignatureFlags) Unexecuted instantiation: hlsl::operator|=(hlsl::DxilRootDescriptorFlags&, hlsl::DxilRootDescriptorFlags) Unexecuted instantiation: hlsl::operator|=(hlsl::DxilDescriptorRangeType&, hlsl::DxilDescriptorRangeType) operator|=(hlsl::DxilRootSignatureFlags&, hlsl::DxilRootSignatureFlags) Line | Count | Source | 93 | 366 | inline ENUMTYPE &operator|=(ENUMTYPE &a, ENUMTYPE b) { \ | 94 | 366 | return (ENUMTYPE &)(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type &)a) |= \ | 95 | 366 | ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); \ | 96 | 366 | } \ |
operator|=(hlsl::DxilRootDescriptorFlags&, hlsl::DxilRootDescriptorFlags) Line | Count | Source | 93 | 26 | inline ENUMTYPE &operator|=(ENUMTYPE &a, ENUMTYPE b) { \ | 94 | 26 | return (ENUMTYPE &)(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type &)a) |= \ | 95 | 26 | ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); \ | 96 | 26 | } \ |
operator|=(hlsl::DxilDescriptorRangeFlags&, hlsl::DxilDescriptorRangeFlags) Line | Count | Source | 93 | 72 | inline ENUMTYPE &operator|=(ENUMTYPE &a, ENUMTYPE b) { \ | 94 | 72 | return (ENUMTYPE &)(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type &)a) |= \ | 95 | 72 | ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); \ | 96 | 72 | } \ |
Unexecuted instantiation: operator|=(hlsl::DxilRootSignatureCompilationFlags&, hlsl::DxilRootSignatureCompilationFlags) |
97 | 16.7k | inline ENUMTYPE operator&(ENUMTYPE a, ENUMTYPE b) { \ |
98 | 16.7k | return ENUMTYPE(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)a) & \ |
99 | 16.7k | ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); \ |
100 | 16.7k | } \ hlsl::operator&(hlsl::DxilRootSignatureFlags, hlsl::DxilRootSignatureFlags) Line | Count | Source | 97 | 13.1k | inline ENUMTYPE operator&(ENUMTYPE a, ENUMTYPE b) { \ | 98 | 13.1k | return ENUMTYPE(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)a) & \ | 99 | 13.1k | ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); \ | 100 | 13.1k | } \ |
Unexecuted instantiation: hlsl::operator&(hlsl::DxilRootDescriptorFlags, hlsl::DxilRootDescriptorFlags) Unexecuted instantiation: hlsl::operator&(hlsl::DxilDescriptorRangeType, hlsl::DxilDescriptorRangeType) Unexecuted instantiation: hlsl::operator&(hlsl::DxilDescriptorRangeFlags, hlsl::DxilDescriptorRangeFlags) operator&(hlsl::DxilRootSignatureCompilationFlags, hlsl::DxilRootSignatureCompilationFlags) Line | Count | Source | 97 | 3.64k | inline ENUMTYPE operator&(ENUMTYPE a, ENUMTYPE b) { \ | 98 | 3.64k | return ENUMTYPE(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)a) & \ | 99 | 3.64k | ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); \ | 100 | 3.64k | } \ |
Unexecuted instantiation: operator&(hlsl::DxilRootSignatureFlags, hlsl::DxilRootSignatureFlags) Unexecuted instantiation: operator&(hlsl::DxilRootDescriptorFlags, hlsl::DxilRootDescriptorFlags) Unexecuted instantiation: operator&(hlsl::DxilDescriptorRangeFlags, hlsl::DxilDescriptorRangeFlags) |
101 | 0 | inline ENUMTYPE &operator&=(ENUMTYPE &a, ENUMTYPE b) { \ |
102 | 0 | return (ENUMTYPE &)(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type &)a) &= \ |
103 | 0 | ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); \ |
104 | 0 | } \ Unexecuted instantiation: hlsl::operator&=(hlsl::DxilRootSignatureFlags&, hlsl::DxilRootSignatureFlags) Unexecuted instantiation: hlsl::operator&=(hlsl::DxilRootDescriptorFlags&, hlsl::DxilRootDescriptorFlags) Unexecuted instantiation: hlsl::operator&=(hlsl::DxilDescriptorRangeType&, hlsl::DxilDescriptorRangeType) Unexecuted instantiation: hlsl::operator&=(hlsl::DxilDescriptorRangeFlags&, hlsl::DxilDescriptorRangeFlags) Unexecuted instantiation: operator&=(hlsl::DxilRootSignatureFlags&, hlsl::DxilRootSignatureFlags) Unexecuted instantiation: operator&=(hlsl::DxilRootDescriptorFlags&, hlsl::DxilRootDescriptorFlags) Unexecuted instantiation: operator&=(hlsl::DxilDescriptorRangeFlags&, hlsl::DxilDescriptorRangeFlags) Unexecuted instantiation: operator&=(hlsl::DxilRootSignatureCompilationFlags&, hlsl::DxilRootSignatureCompilationFlags) |
105 | 10.4k | inline ENUMTYPE operator~(ENUMTYPE a) { \ |
106 | 10.4k | return ENUMTYPE(~((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)a)); \ |
107 | 10.4k | } \ hlsl::operator~(hlsl::DxilRootSignatureFlags) Line | Count | Source | 105 | 10.4k | inline ENUMTYPE operator~(ENUMTYPE a) { \ | 106 | 10.4k | return ENUMTYPE(~((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)a)); \ | 107 | 10.4k | } \ |
Unexecuted instantiation: hlsl::operator~(hlsl::DxilRootDescriptorFlags) Unexecuted instantiation: hlsl::operator~(hlsl::DxilDescriptorRangeType) Unexecuted instantiation: hlsl::operator~(hlsl::DxilDescriptorRangeFlags) Unexecuted instantiation: operator~(hlsl::DxilRootSignatureFlags) Unexecuted instantiation: operator~(hlsl::DxilRootDescriptorFlags) Unexecuted instantiation: operator~(hlsl::DxilDescriptorRangeFlags) Unexecuted instantiation: operator~(hlsl::DxilRootSignatureCompilationFlags) |
108 | 0 | inline ENUMTYPE operator^(ENUMTYPE a, ENUMTYPE b) { \ |
109 | 0 | return ENUMTYPE(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)a) ^ \ |
110 | 0 | ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); \ |
111 | 0 | } \ Unexecuted instantiation: hlsl::operator^(hlsl::DxilRootSignatureFlags, hlsl::DxilRootSignatureFlags) Unexecuted instantiation: hlsl::operator^(hlsl::DxilRootDescriptorFlags, hlsl::DxilRootDescriptorFlags) Unexecuted instantiation: hlsl::operator^(hlsl::DxilDescriptorRangeType, hlsl::DxilDescriptorRangeType) Unexecuted instantiation: hlsl::operator^(hlsl::DxilDescriptorRangeFlags, hlsl::DxilDescriptorRangeFlags) Unexecuted instantiation: operator^(hlsl::DxilRootSignatureFlags, hlsl::DxilRootSignatureFlags) Unexecuted instantiation: operator^(hlsl::DxilRootDescriptorFlags, hlsl::DxilRootDescriptorFlags) Unexecuted instantiation: operator^(hlsl::DxilDescriptorRangeFlags, hlsl::DxilDescriptorRangeFlags) Unexecuted instantiation: operator^(hlsl::DxilRootSignatureCompilationFlags, hlsl::DxilRootSignatureCompilationFlags) |
112 | 0 | inline ENUMTYPE &operator^=(ENUMTYPE &a, ENUMTYPE b) { \ |
113 | 0 | return (ENUMTYPE &)(((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type &)a) ^= \ |
114 | 0 | ((_ENUM_FLAG_SIZED_INTEGER<ENUMTYPE>::type)b)); \ |
115 | 0 | } \ Unexecuted instantiation: hlsl::operator^=(hlsl::DxilRootSignatureFlags&, hlsl::DxilRootSignatureFlags) Unexecuted instantiation: hlsl::operator^=(hlsl::DxilRootDescriptorFlags&, hlsl::DxilRootDescriptorFlags) Unexecuted instantiation: hlsl::operator^=(hlsl::DxilDescriptorRangeType&, hlsl::DxilDescriptorRangeType) Unexecuted instantiation: hlsl::operator^=(hlsl::DxilDescriptorRangeFlags&, hlsl::DxilDescriptorRangeFlags) Unexecuted instantiation: operator^=(hlsl::DxilRootSignatureFlags&, hlsl::DxilRootSignatureFlags) Unexecuted instantiation: operator^=(hlsl::DxilRootDescriptorFlags&, hlsl::DxilRootDescriptorFlags) Unexecuted instantiation: operator^=(hlsl::DxilDescriptorRangeFlags&, hlsl::DxilDescriptorRangeFlags) Unexecuted instantiation: operator^=(hlsl::DxilRootSignatureCompilationFlags&, hlsl::DxilRootSignatureCompilationFlags) |
116 | | } |
117 | | #endif // !defined(DEFINE_ENUM_FLAG_OPERATORS) |
118 | | #else |
119 | | #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) // NOP, C allows these operators. |
120 | | #endif |
121 | | |
122 | | #endif // _MSC_VER |
123 | | |
124 | | /// DxcCoGetMalloc |
125 | | #if defined(_WIN32) && !defined(DXC_DISABLE_ALLOCATOR_OVERRIDES) |
126 | | |
127 | | #define DxcCoGetMalloc CoGetMalloc |
128 | | |
129 | | #else // defined(_WIN32) && !defined(DXC_DISABLE_ALLOCATOR_OVERRIDES) |
130 | | |
131 | | #ifndef _WIN32 |
132 | | struct IMalloc; |
133 | | #endif |
134 | | |
135 | | HRESULT DxcCoGetMalloc(DWORD dwMemContext, IMalloc **ppMalloc); |
136 | | |
137 | | #endif // defined(_WIN32) && !defined(DXC_DISABLE_ALLOCATOR_OVERRIDES) |