diff options
Diffstat (limited to 'contrib/dxc_2025_07_14/inc/dxcapi.h')
| -rw-r--r-- | contrib/dxc_2025_07_14/inc/dxcapi.h | 1309 |
1 files changed, 1309 insertions, 0 deletions
diff --git a/contrib/dxc_2025_07_14/inc/dxcapi.h b/contrib/dxc_2025_07_14/inc/dxcapi.h new file mode 100644 index 0000000..95cc56a --- /dev/null +++ b/contrib/dxc_2025_07_14/inc/dxcapi.h | |||
| @@ -0,0 +1,1309 @@ | |||
| 1 | |||
| 2 | /////////////////////////////////////////////////////////////////////////////// | ||
| 3 | // // | ||
| 4 | // dxcapi.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 | // Provides declarations for the DirectX Compiler API entry point. // | ||
| 10 | // // | ||
| 11 | /////////////////////////////////////////////////////////////////////////////// | ||
| 12 | |||
| 13 | #ifndef __DXC_API__ | ||
| 14 | #define __DXC_API__ | ||
| 15 | |||
| 16 | #ifdef _WIN32 | ||
| 17 | #ifndef DXC_API_IMPORT | ||
| 18 | #define DXC_API_IMPORT __declspec(dllimport) | ||
| 19 | #endif | ||
| 20 | #else | ||
| 21 | #ifndef DXC_API_IMPORT | ||
| 22 | #define DXC_API_IMPORT __attribute__((visibility("default"))) | ||
| 23 | #endif | ||
| 24 | #endif | ||
| 25 | |||
| 26 | #ifdef _WIN32 | ||
| 27 | |||
| 28 | #ifndef CROSS_PLATFORM_UUIDOF | ||
| 29 | // Warning: This macro exists in WinAdapter.h as well | ||
| 30 | #define CROSS_PLATFORM_UUIDOF(interface, spec) \ | ||
| 31 | struct __declspec(uuid(spec)) interface; | ||
| 32 | #endif | ||
| 33 | |||
| 34 | #else | ||
| 35 | |||
| 36 | #include "WinAdapter.h" | ||
| 37 | #include <dlfcn.h> | ||
| 38 | #endif | ||
| 39 | |||
| 40 | struct IMalloc; | ||
| 41 | |||
| 42 | struct IDxcIncludeHandler; | ||
| 43 | |||
| 44 | /// \brief Typedef for DxcCreateInstance function pointer. | ||
| 45 | /// | ||
| 46 | /// This can be used with GetProcAddress to get the DxcCreateInstance function. | ||
| 47 | typedef HRESULT(__stdcall *DxcCreateInstanceProc)(_In_ REFCLSID rclsid, | ||
| 48 | _In_ REFIID riid, | ||
| 49 | _Out_ LPVOID *ppv); | ||
| 50 | |||
| 51 | /// \brief Typedef for DxcCreateInstance2 function pointer. | ||
| 52 | /// | ||
| 53 | /// This can be used with GetProcAddress to get the DxcCreateInstance2 function. | ||
| 54 | typedef HRESULT(__stdcall *DxcCreateInstance2Proc)(_In_ IMalloc *pMalloc, | ||
| 55 | _In_ REFCLSID rclsid, | ||
| 56 | _In_ REFIID riid, | ||
| 57 | _Out_ LPVOID *ppv); | ||
| 58 | |||
| 59 | /// \brief Creates a single uninitialized object of the class associated with a | ||
| 60 | /// specified CLSID. | ||
| 61 | /// | ||
| 62 | /// \param rclsid The CLSID associated with the data and code that will be used | ||
| 63 | /// to create the object. | ||
| 64 | /// | ||
| 65 | /// \param riid A reference to the identifier of the interface to be used to | ||
| 66 | /// communicate with the object. | ||
| 67 | /// | ||
| 68 | /// \param ppv Address of pointer variable that receives the interface pointer | ||
| 69 | /// requested in riid. Upon successful return, *ppv contains the requested | ||
| 70 | /// interface pointer. Upon failure, *ppv contains NULL. | ||
| 71 | /// | ||
| 72 | /// While this function is similar to CoCreateInstance, there is no COM | ||
| 73 | /// involvement. | ||
| 74 | extern "C" DXC_API_IMPORT | ||
| 75 | HRESULT __stdcall DxcCreateInstance(_In_ REFCLSID rclsid, _In_ REFIID riid, | ||
| 76 | _Out_ LPVOID *ppv); | ||
| 77 | |||
| 78 | /// \brief Version of DxcCreateInstance that takes an IMalloc interface. | ||
| 79 | /// | ||
| 80 | /// This can be used to create an instance of the compiler with a custom memory | ||
| 81 | /// allocator. | ||
| 82 | extern "C" DXC_API_IMPORT | ||
| 83 | HRESULT __stdcall DxcCreateInstance2(_In_ IMalloc *pMalloc, | ||
| 84 | _In_ REFCLSID rclsid, _In_ REFIID riid, | ||
| 85 | _Out_ LPVOID *ppv); | ||
| 86 | |||
| 87 | // For convenience, equivalent definitions to CP_UTF8 and CP_UTF16. | ||
| 88 | #define DXC_CP_UTF8 65001 | ||
| 89 | #define DXC_CP_UTF16 1200 | ||
| 90 | #define DXC_CP_UTF32 12000 | ||
| 91 | // Use DXC_CP_ACP for: Binary; ANSI Text; Autodetect UTF with BOM | ||
| 92 | #define DXC_CP_ACP 0 | ||
| 93 | |||
| 94 | /// Codepage for "wide" characters - UTF16 on Windows, UTF32 on other platforms. | ||
| 95 | #ifdef _WIN32 | ||
| 96 | #define DXC_CP_WIDE DXC_CP_UTF16 | ||
| 97 | #else | ||
| 98 | #define DXC_CP_WIDE DXC_CP_UTF32 | ||
| 99 | #endif | ||
| 100 | |||
| 101 | /// Indicates that the shader hash was computed taking into account source | ||
| 102 | /// information (-Zss). | ||
| 103 | #define DXC_HASHFLAG_INCLUDES_SOURCE 1 | ||
| 104 | |||
| 105 | /// Hash digest type for ShaderHash. | ||
| 106 | typedef struct DxcShaderHash { | ||
| 107 | UINT32 Flags; ///< DXC_HASHFLAG_* | ||
| 108 | BYTE HashDigest[16]; ///< The hash digest | ||
| 109 | } DxcShaderHash; | ||
| 110 | |||
| 111 | #define DXC_FOURCC(ch0, ch1, ch2, ch3) \ | ||
| 112 | ((UINT32)(UINT8)(ch0) | (UINT32)(UINT8)(ch1) << 8 | \ | ||
| 113 | (UINT32)(UINT8)(ch2) << 16 | (UINT32)(UINT8)(ch3) << 24) | ||
| 114 | #define DXC_PART_PDB DXC_FOURCC('I', 'L', 'D', 'B') | ||
| 115 | #define DXC_PART_PDB_NAME DXC_FOURCC('I', 'L', 'D', 'N') | ||
| 116 | #define DXC_PART_PRIVATE_DATA DXC_FOURCC('P', 'R', 'I', 'V') | ||
| 117 | #define DXC_PART_ROOT_SIGNATURE DXC_FOURCC('R', 'T', 'S', '0') | ||
| 118 | #define DXC_PART_DXIL DXC_FOURCC('D', 'X', 'I', 'L') | ||
| 119 | #define DXC_PART_REFLECTION_DATA DXC_FOURCC('S', 'T', 'A', 'T') | ||
| 120 | #define DXC_PART_SHADER_HASH DXC_FOURCC('H', 'A', 'S', 'H') | ||
| 121 | #define DXC_PART_INPUT_SIGNATURE DXC_FOURCC('I', 'S', 'G', '1') | ||
| 122 | #define DXC_PART_OUTPUT_SIGNATURE DXC_FOURCC('O', 'S', 'G', '1') | ||
| 123 | #define DXC_PART_PATCH_CONSTANT_SIGNATURE DXC_FOURCC('P', 'S', 'G', '1') | ||
| 124 | |||
| 125 | // Some option arguments are defined here for continuity with D3DCompile | ||
| 126 | // interface. | ||
| 127 | #define DXC_ARG_DEBUG L"-Zi" | ||
| 128 | #define DXC_ARG_SKIP_VALIDATION L"-Vd" | ||
| 129 | #define DXC_ARG_SKIP_OPTIMIZATIONS L"-Od" | ||
| 130 | #define DXC_ARG_PACK_MATRIX_ROW_MAJOR L"-Zpr" | ||
| 131 | #define DXC_ARG_PACK_MATRIX_COLUMN_MAJOR L"-Zpc" | ||
| 132 | #define DXC_ARG_AVOID_FLOW_CONTROL L"-Gfa" | ||
| 133 | #define DXC_ARG_PREFER_FLOW_CONTROL L"-Gfp" | ||
| 134 | #define DXC_ARG_ENABLE_STRICTNESS L"-Ges" | ||
| 135 | #define DXC_ARG_ENABLE_BACKWARDS_COMPATIBILITY L"-Gec" | ||
| 136 | #define DXC_ARG_IEEE_STRICTNESS L"-Gis" | ||
| 137 | #define DXC_ARG_OPTIMIZATION_LEVEL0 L"-O0" | ||
| 138 | #define DXC_ARG_OPTIMIZATION_LEVEL1 L"-O1" | ||
| 139 | #define DXC_ARG_OPTIMIZATION_LEVEL2 L"-O2" | ||
| 140 | #define DXC_ARG_OPTIMIZATION_LEVEL3 L"-O3" | ||
| 141 | #define DXC_ARG_WARNINGS_ARE_ERRORS L"-WX" | ||
| 142 | #define DXC_ARG_RESOURCES_MAY_ALIAS L"-res_may_alias" | ||
| 143 | #define DXC_ARG_ALL_RESOURCES_BOUND L"-all_resources_bound" | ||
| 144 | #define DXC_ARG_DEBUG_NAME_FOR_SOURCE L"-Zss" | ||
| 145 | #define DXC_ARG_DEBUG_NAME_FOR_BINARY L"-Zsb" | ||
| 146 | |||
| 147 | CROSS_PLATFORM_UUIDOF(IDxcBlob, "8BA5FB08-5195-40e2-AC58-0D989C3A0102") | ||
| 148 | /// \brief A sized buffer that can be passed in and out of DXC APIs. | ||
| 149 | /// | ||
| 150 | /// This is an alias of ID3D10Blob and ID3DBlob. | ||
| 151 | struct IDxcBlob : public IUnknown { | ||
| 152 | public: | ||
| 153 | /// \brief Retrieves a pointer to the blob's data. | ||
| 154 | virtual LPVOID STDMETHODCALLTYPE GetBufferPointer(void) = 0; | ||
| 155 | |||
| 156 | /// \brief Retrieves the size, in bytes, of the blob's data. | ||
| 157 | virtual SIZE_T STDMETHODCALLTYPE GetBufferSize(void) = 0; | ||
| 158 | }; | ||
| 159 | |||
| 160 | CROSS_PLATFORM_UUIDOF(IDxcBlobEncoding, "7241d424-2646-4191-97c0-98e96e42fc68") | ||
| 161 | /// \brief A blob that might have a known encoding. | ||
| 162 | struct IDxcBlobEncoding : public IDxcBlob { | ||
| 163 | public: | ||
| 164 | /// \brief Retrieve the encoding for this blob. | ||
| 165 | /// | ||
| 166 | /// \param pKnown Pointer to a variable that will be set to TRUE if the | ||
| 167 | /// encoding is known. | ||
| 168 | /// | ||
| 169 | /// \param pCodePage Pointer to variable that will be set to the encoding used | ||
| 170 | /// for this blog. | ||
| 171 | /// | ||
| 172 | /// If the encoding is not known then pCodePage will be set to CP_ACP. | ||
| 173 | virtual HRESULT STDMETHODCALLTYPE GetEncoding(_Out_ BOOL *pKnown, | ||
| 174 | _Out_ UINT32 *pCodePage) = 0; | ||
| 175 | }; | ||
| 176 | |||
| 177 | CROSS_PLATFORM_UUIDOF(IDxcBlobWide, "A3F84EAB-0FAA-497E-A39C-EE6ED60B2D84") | ||
| 178 | /// \brief A blob containing a null-terminated wide string. | ||
| 179 | /// | ||
| 180 | /// This uses the native wide character encoding (utf16 on Windows, utf32 on | ||
| 181 | /// Linux). | ||
| 182 | /// | ||
| 183 | /// The value returned by GetBufferSize() is the size of the buffer, in bytes, | ||
| 184 | /// including the null-terminator. | ||
| 185 | /// | ||
| 186 | /// This interface is used to return output name strings DXC. Other string | ||
| 187 | /// output blobs, such as errors/warnings, preprocessed HLSL, or other text are | ||
| 188 | /// returned using encodings based on the -encoding option passed to the | ||
| 189 | /// compiler. | ||
| 190 | struct IDxcBlobWide : public IDxcBlobEncoding { | ||
| 191 | public: | ||
| 192 | /// \brief Retrieves a pointer to the string stored in this blob. | ||
| 193 | virtual LPCWSTR STDMETHODCALLTYPE GetStringPointer(void) = 0; | ||
| 194 | |||
| 195 | /// \brief Retrieves the length of the string stored in this blob, in | ||
| 196 | /// characters, excluding the null-terminator. | ||
| 197 | virtual SIZE_T STDMETHODCALLTYPE GetStringLength(void) = 0; | ||
| 198 | }; | ||
| 199 | |||
| 200 | CROSS_PLATFORM_UUIDOF(IDxcBlobUtf8, "3DA636C9-BA71-4024-A301-30CBF125305B") | ||
| 201 | /// \brief A blob containing a UTF-8 encoded string. | ||
| 202 | /// | ||
| 203 | /// The value returned by GetBufferSize() is the size of the buffer, in bytes, | ||
| 204 | /// including the null-terminator. | ||
| 205 | /// | ||
| 206 | /// Depending on the -encoding option passed to the compiler, this interface is | ||
| 207 | /// used to return string output blobs, such as errors/warnings, preprocessed | ||
| 208 | /// HLSL, or other text. Output name strings always use IDxcBlobWide. | ||
| 209 | struct IDxcBlobUtf8 : public IDxcBlobEncoding { | ||
| 210 | public: | ||
| 211 | /// \brief Retrieves a pointer to the string stored in this blob. | ||
| 212 | virtual LPCSTR STDMETHODCALLTYPE GetStringPointer(void) = 0; | ||
| 213 | |||
| 214 | /// \brief Retrieves the length of the string stored in this blob, in | ||
| 215 | /// characters, excluding the null-terminator. | ||
| 216 | virtual SIZE_T STDMETHODCALLTYPE GetStringLength(void) = 0; | ||
| 217 | }; | ||
| 218 | |||
| 219 | #ifdef _WIN32 | ||
| 220 | /// IDxcBlobUtf16 is a legacy alias for IDxcBlobWide on Win32. | ||
| 221 | typedef IDxcBlobWide IDxcBlobUtf16; | ||
| 222 | #endif | ||
| 223 | |||
| 224 | CROSS_PLATFORM_UUIDOF(IDxcIncludeHandler, | ||
| 225 | "7f61fc7d-950d-467f-b3e3-3c02fb49187c") | ||
| 226 | /// \brief Interface for handling include directives. | ||
| 227 | /// | ||
| 228 | /// This interface can be implemented to customize handling of include | ||
| 229 | /// directives. | ||
| 230 | /// | ||
| 231 | /// Use IDxcUtils::CreateDefaultIncludeHandler to create a default | ||
| 232 | /// implementation that reads include files from the filesystem. | ||
| 233 | /// | ||
| 234 | struct IDxcIncludeHandler : public IUnknown { | ||
| 235 | /// \brief Load a source file to be included by the compiler. | ||
| 236 | /// | ||
| 237 | /// \param pFilename Candidate filename. | ||
| 238 | /// | ||
| 239 | /// \param ppIncludeSource Resultant source object for included file, nullptr | ||
| 240 | /// if not found. | ||
| 241 | virtual HRESULT STDMETHODCALLTYPE | ||
| 242 | LoadSource(_In_z_ LPCWSTR pFilename, | ||
| 243 | _COM_Outptr_result_maybenull_ IDxcBlob **ppIncludeSource) = 0; | ||
| 244 | }; | ||
| 245 | |||
| 246 | /// \brief Structure for supplying bytes or text input to Dxc APIs. | ||
| 247 | typedef struct DxcBuffer { | ||
| 248 | /// \brief Pointer to the start of the buffer. | ||
| 249 | LPCVOID Ptr; | ||
| 250 | |||
| 251 | /// \brief Size of the buffer in bytes. | ||
| 252 | SIZE_T Size; | ||
| 253 | |||
| 254 | /// \brief Encoding of the buffer. | ||
| 255 | /// | ||
| 256 | /// Use Encoding = 0 for non-text bytes, ANSI text, or unknown with BOM. | ||
| 257 | UINT Encoding; | ||
| 258 | } DxcText; | ||
| 259 | |||
| 260 | /// \brief Structure for supplying defines to Dxc APIs. | ||
| 261 | struct DxcDefine { | ||
| 262 | LPCWSTR Name; ///< The define name. | ||
| 263 | _Maybenull_ LPCWSTR Value; ///< Optional value for the define. | ||
| 264 | }; | ||
| 265 | |||
| 266 | CROSS_PLATFORM_UUIDOF(IDxcCompilerArgs, "73EFFE2A-70DC-45F8-9690-EFF64C02429D") | ||
| 267 | /// \brief Interface for managing arguments passed to DXC. | ||
| 268 | /// | ||
| 269 | /// Use IDxcUtils::BuildArguments to create an instance of this interface. | ||
| 270 | struct IDxcCompilerArgs : public IUnknown { | ||
| 271 | /// \brief Retrieve the array of arguments. | ||
| 272 | /// | ||
| 273 | /// This can be passed directly to the pArguments parameter of the Compile() | ||
| 274 | /// method. | ||
| 275 | virtual LPCWSTR *STDMETHODCALLTYPE GetArguments() = 0; | ||
| 276 | |||
| 277 | /// \brief Retrieve the number of arguments. | ||
| 278 | /// | ||
| 279 | /// This can be passed directly to the argCount parameter of the Compile() | ||
| 280 | /// method. | ||
| 281 | virtual UINT32 STDMETHODCALLTYPE GetCount() = 0; | ||
| 282 | |||
| 283 | /// \brief Add additional arguments to this list of compiler arguments. | ||
| 284 | virtual HRESULT STDMETHODCALLTYPE AddArguments( | ||
| 285 | _In_opt_count_(argCount) | ||
| 286 | LPCWSTR *pArguments, ///< Array of pointers to arguments to add. | ||
| 287 | _In_ UINT32 argCount ///< Number of arguments to add. | ||
| 288 | ) = 0; | ||
| 289 | |||
| 290 | /// \brief Add additional UTF-8 encoded arguments to this list of compiler | ||
| 291 | /// arguments. | ||
| 292 | virtual HRESULT STDMETHODCALLTYPE AddArgumentsUTF8( | ||
| 293 | _In_opt_count_(argCount) | ||
| 294 | LPCSTR *pArguments, ///< Array of pointers to UTF-8 arguments to add. | ||
| 295 | _In_ UINT32 argCount ///< Number of arguments to add. | ||
| 296 | ) = 0; | ||
| 297 | |||
| 298 | /// \brief Add additional defines to this list of compiler arguments. | ||
| 299 | virtual HRESULT STDMETHODCALLTYPE AddDefines( | ||
| 300 | _In_count_(defineCount) const DxcDefine *pDefines, ///< Array of defines. | ||
| 301 | _In_ UINT32 defineCount ///< Number of defines. | ||
| 302 | ) = 0; | ||
| 303 | }; | ||
| 304 | |||
| 305 | ////////////////////////// | ||
| 306 | // Legacy Interfaces | ||
| 307 | ///////////////////////// | ||
| 308 | |||
| 309 | CROSS_PLATFORM_UUIDOF(IDxcLibrary, "e5204dc7-d18c-4c3c-bdfb-851673980fe7") | ||
| 310 | /// \deprecated IDxcUtils replaces IDxcLibrary; please use IDxcUtils insted. | ||
| 311 | struct IDxcLibrary : public IUnknown { | ||
| 312 | /// \deprecated | ||
| 313 | virtual HRESULT STDMETHODCALLTYPE SetMalloc(_In_opt_ IMalloc *pMalloc) = 0; | ||
| 314 | |||
| 315 | /// \deprecated | ||
| 316 | virtual HRESULT STDMETHODCALLTYPE | ||
| 317 | CreateBlobFromBlob(_In_ IDxcBlob *pBlob, UINT32 offset, UINT32 length, | ||
| 318 | _COM_Outptr_ IDxcBlob **ppResult) = 0; | ||
| 319 | |||
| 320 | /// \deprecated | ||
| 321 | virtual HRESULT STDMETHODCALLTYPE | ||
| 322 | CreateBlobFromFile(_In_z_ LPCWSTR pFileName, _In_opt_ UINT32 *codePage, | ||
| 323 | _COM_Outptr_ IDxcBlobEncoding **pBlobEncoding) = 0; | ||
| 324 | |||
| 325 | /// \deprecated | ||
| 326 | virtual HRESULT STDMETHODCALLTYPE CreateBlobWithEncodingFromPinned( | ||
| 327 | _In_bytecount_(size) LPCVOID pText, UINT32 size, UINT32 codePage, | ||
| 328 | _COM_Outptr_ IDxcBlobEncoding **pBlobEncoding) = 0; | ||
| 329 | |||
| 330 | /// \deprecated | ||
| 331 | virtual HRESULT STDMETHODCALLTYPE CreateBlobWithEncodingOnHeapCopy( | ||
| 332 | _In_bytecount_(size) LPCVOID pText, UINT32 size, UINT32 codePage, | ||
| 333 | _COM_Outptr_ IDxcBlobEncoding **pBlobEncoding) = 0; | ||
| 334 | |||
| 335 | /// \deprecated | ||
| 336 | virtual HRESULT STDMETHODCALLTYPE CreateBlobWithEncodingOnMalloc( | ||
| 337 | _In_bytecount_(size) LPCVOID pText, IMalloc *pIMalloc, UINT32 size, | ||
| 338 | UINT32 codePage, _COM_Outptr_ IDxcBlobEncoding **pBlobEncoding) = 0; | ||
| 339 | |||
| 340 | /// \deprecated | ||
| 341 | virtual HRESULT STDMETHODCALLTYPE | ||
| 342 | CreateIncludeHandler(_COM_Outptr_ IDxcIncludeHandler **ppResult) = 0; | ||
| 343 | |||
| 344 | /// \deprecated | ||
| 345 | virtual HRESULT STDMETHODCALLTYPE CreateStreamFromBlobReadOnly( | ||
| 346 | _In_ IDxcBlob *pBlob, _COM_Outptr_ IStream **ppStream) = 0; | ||
| 347 | |||
| 348 | /// \deprecated | ||
| 349 | virtual HRESULT STDMETHODCALLTYPE GetBlobAsUtf8( | ||
| 350 | _In_ IDxcBlob *pBlob, _COM_Outptr_ IDxcBlobEncoding **pBlobEncoding) = 0; | ||
| 351 | |||
| 352 | // Renamed from GetBlobAsUtf16 to GetBlobAsWide | ||
| 353 | /// \deprecated | ||
| 354 | virtual HRESULT STDMETHODCALLTYPE GetBlobAsWide( | ||
| 355 | _In_ IDxcBlob *pBlob, _COM_Outptr_ IDxcBlobEncoding **pBlobEncoding) = 0; | ||
| 356 | |||
| 357 | #ifdef _WIN32 | ||
| 358 | // Alias to GetBlobAsWide on Win32 | ||
| 359 | /// \deprecated | ||
| 360 | inline HRESULT GetBlobAsUtf16(_In_ IDxcBlob *pBlob, | ||
| 361 | _COM_Outptr_ IDxcBlobEncoding **pBlobEncoding) { | ||
| 362 | return this->GetBlobAsWide(pBlob, pBlobEncoding); | ||
| 363 | } | ||
| 364 | #endif | ||
| 365 | }; | ||
| 366 | |||
| 367 | CROSS_PLATFORM_UUIDOF(IDxcOperationResult, | ||
| 368 | "CEDB484A-D4E9-445A-B991-CA21CA157DC2") | ||
| 369 | /// \brief The results of a DXC operation. | ||
| 370 | /// | ||
| 371 | /// Note: IDxcResult replaces IDxcOperationResult and should be used wherever | ||
| 372 | /// possible. | ||
| 373 | struct IDxcOperationResult : public IUnknown { | ||
| 374 | /// \brief Retrieve the overall status of the operation. | ||
| 375 | virtual HRESULT STDMETHODCALLTYPE GetStatus(_Out_ HRESULT *pStatus) = 0; | ||
| 376 | |||
| 377 | /// \brief Retrieve the primary output of the operation. | ||
| 378 | /// | ||
| 379 | /// This corresponds to: | ||
| 380 | /// * DXC_OUT_OBJECT - Compile() with shader or library target | ||
| 381 | /// * DXC_OUT_DISASSEMBLY - Disassemble() | ||
| 382 | /// * DXC_OUT_HLSL - Compile() with -P | ||
| 383 | /// * DXC_OUT_ROOT_SIGNATURE - Compile() with rootsig_* target | ||
| 384 | virtual HRESULT STDMETHODCALLTYPE | ||
| 385 | GetResult(_COM_Outptr_result_maybenull_ IDxcBlob **ppResult) = 0; | ||
| 386 | |||
| 387 | /// \brief Retrieves the error buffer from the operation, if there is one. | ||
| 388 | /// | ||
| 389 | // This corresponds to calling IDxcResult::GetOutput() with DXC_OUT_ERRORS. | ||
| 390 | virtual HRESULT STDMETHODCALLTYPE | ||
| 391 | GetErrorBuffer(_COM_Outptr_result_maybenull_ IDxcBlobEncoding **ppErrors) = 0; | ||
| 392 | }; | ||
| 393 | |||
| 394 | CROSS_PLATFORM_UUIDOF(IDxcCompiler, "8c210bf3-011f-4422-8d70-6f9acb8db617") | ||
| 395 | /// \deprecated Please use IDxcCompiler3 instead. | ||
| 396 | struct IDxcCompiler : public IUnknown { | ||
| 397 | /// \brief Compile a single entry point to the target shader model. | ||
| 398 | /// | ||
| 399 | /// \deprecated Please use IDxcCompiler3::Compile() instead. | ||
| 400 | virtual HRESULT STDMETHODCALLTYPE Compile( | ||
| 401 | _In_ IDxcBlob *pSource, // Source text to compile. | ||
| 402 | _In_opt_z_ LPCWSTR pSourceName, // Optional file name for pSource. Used in | ||
| 403 | // errors and include handlers. | ||
| 404 | _In_opt_z_ LPCWSTR pEntryPoint, // Entry point name. | ||
| 405 | _In_z_ LPCWSTR pTargetProfile, // Shader profile to compile. | ||
| 406 | _In_opt_count_(argCount) | ||
| 407 | LPCWSTR *pArguments, // Array of pointers to arguments. | ||
| 408 | _In_ UINT32 argCount, // Number of arguments. | ||
| 409 | _In_count_(defineCount) const DxcDefine *pDefines, // Array of defines. | ||
| 410 | _In_ UINT32 defineCount, // Number of defines. | ||
| 411 | _In_opt_ IDxcIncludeHandler | ||
| 412 | *pIncludeHandler, // User-provided interface to handle #include | ||
| 413 | // directives (optional). | ||
| 414 | _COM_Outptr_ IDxcOperationResult * | ||
| 415 | *ppResult // Compiler output status, buffer, and errors. | ||
| 416 | ) = 0; | ||
| 417 | |||
| 418 | /// \brief Preprocess source text. | ||
| 419 | /// | ||
| 420 | /// \deprecated Please use IDxcCompiler3::Compile() with the "-P" argument | ||
| 421 | /// instead. | ||
| 422 | virtual HRESULT STDMETHODCALLTYPE Preprocess( | ||
| 423 | _In_ IDxcBlob *pSource, // Source text to preprocess. | ||
| 424 | _In_opt_z_ LPCWSTR pSourceName, // Optional file name for pSource. Used in | ||
| 425 | // errors and include handlers. | ||
| 426 | _In_opt_count_(argCount) | ||
| 427 | LPCWSTR *pArguments, // Array of pointers to arguments. | ||
| 428 | _In_ UINT32 argCount, // Number of arguments. | ||
| 429 | _In_count_(defineCount) const DxcDefine *pDefines, // Array of defines. | ||
| 430 | _In_ UINT32 defineCount, // Number of defines. | ||
| 431 | _In_opt_ IDxcIncludeHandler | ||
| 432 | *pIncludeHandler, // user-provided interface to handle #include | ||
| 433 | // directives (optional). | ||
| 434 | _COM_Outptr_ IDxcOperationResult * | ||
| 435 | *ppResult // Preprocessor output status, buffer, and errors. | ||
| 436 | ) = 0; | ||
| 437 | |||
| 438 | /// \brief Disassemble a program. | ||
| 439 | /// | ||
| 440 | /// \deprecated Please use IDxcCompiler3::Disassemble() instead. | ||
| 441 | virtual HRESULT STDMETHODCALLTYPE Disassemble( | ||
| 442 | _In_ IDxcBlob *pSource, // Program to disassemble. | ||
| 443 | _COM_Outptr_ IDxcBlobEncoding **ppDisassembly // Disassembly text. | ||
| 444 | ) = 0; | ||
| 445 | }; | ||
| 446 | |||
| 447 | CROSS_PLATFORM_UUIDOF(IDxcCompiler2, "A005A9D9-B8BB-4594-B5C9-0E633BEC4D37") | ||
| 448 | /// \deprecated Please use IDxcCompiler3 instead. | ||
| 449 | struct IDxcCompiler2 : public IDxcCompiler { | ||
| 450 | /// \brief Compile a single entry point to the target shader model with debug | ||
| 451 | /// information. | ||
| 452 | /// | ||
| 453 | /// \deprecated Please use IDxcCompiler3::Compile() instead. | ||
| 454 | virtual HRESULT STDMETHODCALLTYPE CompileWithDebug( | ||
| 455 | _In_ IDxcBlob *pSource, // Source text to compile. | ||
| 456 | _In_opt_z_ LPCWSTR pSourceName, // Optional file name for pSource. Used in | ||
| 457 | // errors and include handlers. | ||
| 458 | _In_opt_z_ LPCWSTR pEntryPoint, // Entry point name. | ||
| 459 | _In_z_ LPCWSTR pTargetProfile, // Shader profile to compile. | ||
| 460 | _In_opt_count_(argCount) | ||
| 461 | LPCWSTR *pArguments, // Array of pointers to arguments. | ||
| 462 | _In_ UINT32 argCount, // Number of arguments. | ||
| 463 | _In_count_(defineCount) const DxcDefine *pDefines, // Array of defines. | ||
| 464 | _In_ UINT32 defineCount, // Number of defines. | ||
| 465 | _In_opt_ IDxcIncludeHandler | ||
| 466 | *pIncludeHandler, // user-provided interface to handle #include | ||
| 467 | // directives (optional). | ||
| 468 | _COM_Outptr_ IDxcOperationResult * | ||
| 469 | *ppResult, // Compiler output status, buffer, and errors. | ||
| 470 | _Outptr_opt_result_z_ LPWSTR | ||
| 471 | *ppDebugBlobName, // Suggested file name for debug blob. Must be | ||
| 472 | // CoTaskMemFree()'d. | ||
| 473 | _COM_Outptr_opt_ IDxcBlob **ppDebugBlob // Debug blob. | ||
| 474 | ) = 0; | ||
| 475 | }; | ||
| 476 | |||
| 477 | CROSS_PLATFORM_UUIDOF(IDxcLinker, "F1B5BE2A-62DD-4327-A1C2-42AC1E1E78E6") | ||
| 478 | /// \brief DXC linker interface. | ||
| 479 | /// | ||
| 480 | /// Use DxcCreateInstance with CLSID_DxcLinker to obtain an instance of this | ||
| 481 | /// interface. | ||
| 482 | struct IDxcLinker : public IUnknown { | ||
| 483 | public: | ||
| 484 | /// \brief Register a library with name to reference it later. | ||
| 485 | virtual HRESULT | ||
| 486 | RegisterLibrary(_In_opt_ LPCWSTR pLibName, ///< Name of the library. | ||
| 487 | _In_ IDxcBlob *pLib ///< Library blob. | ||
| 488 | ) = 0; | ||
| 489 | |||
| 490 | /// \brief Links the shader and produces a shader blob that the Direct3D | ||
| 491 | /// runtime can use. | ||
| 492 | virtual HRESULT STDMETHODCALLTYPE Link( | ||
| 493 | _In_opt_ LPCWSTR pEntryName, ///< Entry point name. | ||
| 494 | _In_ LPCWSTR pTargetProfile, ///< shader profile to link. | ||
| 495 | _In_count_(libCount) | ||
| 496 | const LPCWSTR *pLibNames, ///< Array of library names to link. | ||
| 497 | _In_ UINT32 libCount, ///< Number of libraries to link. | ||
| 498 | _In_opt_count_(argCount) | ||
| 499 | const LPCWSTR *pArguments, ///< Array of pointers to arguments. | ||
| 500 | _In_ UINT32 argCount, ///< Number of arguments. | ||
| 501 | _COM_Outptr_ IDxcOperationResult * | ||
| 502 | *ppResult ///< Linker output status, buffer, and errors. | ||
| 503 | ) = 0; | ||
| 504 | }; | ||
| 505 | |||
| 506 | ///////////////////////// | ||
| 507 | // Latest interfaces. Please use these. | ||
| 508 | //////////////////////// | ||
| 509 | |||
| 510 | CROSS_PLATFORM_UUIDOF(IDxcUtils, "4605C4CB-2019-492A-ADA4-65F20BB7D67F") | ||
| 511 | /// \brief Various utility functions for DXC. | ||
| 512 | /// | ||
| 513 | /// Use DxcCreateInstance with CLSID_DxcUtils to obtain an instance of this | ||
| 514 | /// interface. | ||
| 515 | /// | ||
| 516 | /// IDxcUtils replaces IDxcLibrary. | ||
| 517 | struct IDxcUtils : public IUnknown { | ||
| 518 | /// \brief Create a sub-blob that holds a reference to the outer blob and | ||
| 519 | /// points to its memory. | ||
| 520 | /// | ||
| 521 | /// \param pBlob The outer blob. | ||
| 522 | /// | ||
| 523 | /// \param offset The offset inside the outer blob. | ||
| 524 | /// | ||
| 525 | /// \param length The size, in bytes, of the buffer to reference from the | ||
| 526 | /// output blob. | ||
| 527 | /// | ||
| 528 | /// \param ppResult Address of the pointer that receives a pointer to the | ||
| 529 | /// newly created blob. | ||
| 530 | virtual HRESULT STDMETHODCALLTYPE | ||
| 531 | CreateBlobFromBlob(_In_ IDxcBlob *pBlob, UINT32 offset, UINT32 length, | ||
| 532 | _COM_Outptr_ IDxcBlob **ppResult) = 0; | ||
| 533 | |||
| 534 | // For codePage, use 0 (or DXC_CP_ACP) for raw binary or ANSI code page. | ||
| 535 | |||
| 536 | /// \brief Create a blob referencing existing memory, with no copy. | ||
| 537 | /// | ||
| 538 | /// \param pData Pointer to buffer containing the contents of the new blob. | ||
| 539 | /// | ||
| 540 | /// \param size The size of the pData buffer, in bytes. | ||
| 541 | /// | ||
| 542 | /// \param codePage The code page to use if the blob contains text. Use | ||
| 543 | /// DXC_CP_ACP for binary or ANSI code page. | ||
| 544 | /// | ||
| 545 | /// \param ppBlobEncoding Address of the pointer that receives a pointer to | ||
| 546 | /// the newly created blob. | ||
| 547 | /// | ||
| 548 | /// The user must manage the memory lifetime separately. | ||
| 549 | /// | ||
| 550 | /// This replaces IDxcLibrary::CreateBlobWithEncodingFromPinned. | ||
| 551 | virtual HRESULT STDMETHODCALLTYPE CreateBlobFromPinned( | ||
| 552 | _In_bytecount_(size) LPCVOID pData, UINT32 size, UINT32 codePage, | ||
| 553 | _COM_Outptr_ IDxcBlobEncoding **ppBlobEncoding) = 0; | ||
| 554 | |||
| 555 | /// \brief Create a blob, taking ownership of memory allocated with the | ||
| 556 | /// supplied allocator. | ||
| 557 | /// | ||
| 558 | /// \param pData Pointer to buffer containing the contents of the new blob. | ||
| 559 | /// | ||
| 560 | /// \param pIMalloc The memory allocator to use. | ||
| 561 | /// | ||
| 562 | /// \param size The size of thee pData buffer, in bytes. | ||
| 563 | /// | ||
| 564 | /// \param codePage The code page to use if the blob contains text. Use | ||
| 565 | /// DXC_CP_ACP for binary or ANSI code page. | ||
| 566 | /// | ||
| 567 | /// \param ppBlobEncoding Address of the pointer that receives a pointer to | ||
| 568 | /// the newly created blob. | ||
| 569 | /// | ||
| 570 | /// This replaces IDxcLibrary::CreateBlobWithEncodingOnMalloc. | ||
| 571 | virtual HRESULT STDMETHODCALLTYPE MoveToBlob( | ||
| 572 | _In_bytecount_(size) LPCVOID pData, IMalloc *pIMalloc, UINT32 size, | ||
| 573 | UINT32 codePage, _COM_Outptr_ IDxcBlobEncoding **ppBlobEncoding) = 0; | ||
| 574 | |||
| 575 | /// \brief Create a blob containing a copy of the existing data. | ||
| 576 | /// | ||
| 577 | /// \param pData Pointer to buffer containing the contents of the new blob. | ||
| 578 | /// | ||
| 579 | /// \param size The size of thee pData buffer, in bytes. | ||
| 580 | /// | ||
| 581 | /// \param codePage The code page to use if the blob contains text. Use | ||
| 582 | /// DXC_CP_ACP for binary or ANSI code page. | ||
| 583 | /// | ||
| 584 | /// \param ppBlobEncoding Address of the pointer that receives a pointer to | ||
| 585 | /// the newly created blob. | ||
| 586 | /// | ||
| 587 | /// The new blob and its contents are allocated with the current allocator. | ||
| 588 | /// This replaces IDxcLibrary::CreateBlobWithEncodingOnHeapCopy. | ||
| 589 | virtual HRESULT STDMETHODCALLTYPE | ||
| 590 | CreateBlob(_In_bytecount_(size) LPCVOID pData, UINT32 size, UINT32 codePage, | ||
| 591 | _COM_Outptr_ IDxcBlobEncoding **ppBlobEncoding) = 0; | ||
| 592 | |||
| 593 | /// \brief Create a blob with data loaded from a file. | ||
| 594 | /// | ||
| 595 | /// \param pFileName The name of the file to load from. | ||
| 596 | /// | ||
| 597 | /// \param pCodePage Optional code page to use if the blob contains text. Pass | ||
| 598 | /// NULL for binary data. | ||
| 599 | /// | ||
| 600 | /// \param ppBlobEncoding Address of the pointer that receives a pointer to | ||
| 601 | /// the newly created blob. | ||
| 602 | /// | ||
| 603 | /// The new blob and its contents are allocated with the current allocator. | ||
| 604 | /// This replaces IDxcLibrary::CreateBlobFromFile. | ||
| 605 | virtual HRESULT STDMETHODCALLTYPE | ||
| 606 | LoadFile(_In_z_ LPCWSTR pFileName, _In_opt_ UINT32 *pCodePage, | ||
| 607 | _COM_Outptr_ IDxcBlobEncoding **ppBlobEncoding) = 0; | ||
| 608 | |||
| 609 | /// \brief Create a stream that reads data from a blob. | ||
| 610 | /// | ||
| 611 | /// \param pBlob The blob to read from. | ||
| 612 | /// | ||
| 613 | /// \param ppStream Address of the pointer that receives a pointer to the | ||
| 614 | /// newly created stream. | ||
| 615 | virtual HRESULT STDMETHODCALLTYPE CreateReadOnlyStreamFromBlob( | ||
| 616 | _In_ IDxcBlob *pBlob, _COM_Outptr_ IStream **ppStream) = 0; | ||
| 617 | |||
| 618 | /// \brief Create default file-based include handler. | ||
| 619 | /// | ||
| 620 | /// \param ppResult Address of the pointer that receives a pointer to the | ||
| 621 | /// newly created include handler. | ||
| 622 | virtual HRESULT STDMETHODCALLTYPE | ||
| 623 | CreateDefaultIncludeHandler(_COM_Outptr_ IDxcIncludeHandler **ppResult) = 0; | ||
| 624 | |||
| 625 | /// \brief Convert or return matching encoded text blob as UTF-8. | ||
| 626 | /// | ||
| 627 | /// \param pBlob The blob to convert. | ||
| 628 | /// | ||
| 629 | /// \param ppBlobEncoding Address of the pointer that receives a pointer to | ||
| 630 | /// the newly created blob. | ||
| 631 | virtual HRESULT STDMETHODCALLTYPE GetBlobAsUtf8( | ||
| 632 | _In_ IDxcBlob *pBlob, _COM_Outptr_ IDxcBlobUtf8 **ppBlobEncoding) = 0; | ||
| 633 | |||
| 634 | /// \brief Convert or return matching encoded text blob as UTF-16. | ||
| 635 | /// | ||
| 636 | /// \param pBlob The blob to convert. | ||
| 637 | /// | ||
| 638 | /// \param ppBlobEncoding Address of the pointer that receives a pointer to | ||
| 639 | /// the newly created blob. | ||
| 640 | virtual HRESULT STDMETHODCALLTYPE GetBlobAsWide( | ||
| 641 | _In_ IDxcBlob *pBlob, _COM_Outptr_ IDxcBlobWide **ppBlobEncoding) = 0; | ||
| 642 | |||
| 643 | #ifdef _WIN32 | ||
| 644 | /// \brief Convert or return matching encoded text blob as UTF-16. | ||
| 645 | /// | ||
| 646 | /// \param pBlob The blob to convert. | ||
| 647 | /// | ||
| 648 | /// \param ppBlobEncoding Address of the pointer that receives a pointer to | ||
| 649 | /// the newly created blob. | ||
| 650 | /// | ||
| 651 | /// Alias to GetBlobAsWide on Win32. | ||
| 652 | inline HRESULT GetBlobAsUtf16(_In_ IDxcBlob *pBlob, | ||
| 653 | _COM_Outptr_ IDxcBlobWide **ppBlobEncoding) { | ||
| 654 | return this->GetBlobAsWide(pBlob, ppBlobEncoding); | ||
| 655 | } | ||
| 656 | #endif | ||
| 657 | |||
| 658 | /// \brief Retrieve a single part from a DXIL container. | ||
| 659 | /// | ||
| 660 | /// \param pShader The shader to retrieve the part from. | ||
| 661 | /// | ||
| 662 | /// \param DxcPart The part to retrieve (eg DXC_PART_ROOT_SIGNATURE). | ||
| 663 | /// | ||
| 664 | /// \param ppPartData Address of the pointer that receives a pointer to the | ||
| 665 | /// part. | ||
| 666 | /// | ||
| 667 | /// \param pPartSizeInBytes Address of the pointer that receives the size of | ||
| 668 | /// the part. | ||
| 669 | /// | ||
| 670 | /// The returned pointer points inside the buffer passed in pShader. | ||
| 671 | virtual HRESULT STDMETHODCALLTYPE | ||
| 672 | GetDxilContainerPart(_In_ const DxcBuffer *pShader, _In_ UINT32 DxcPart, | ||
| 673 | _Outptr_result_nullonfailure_ void **ppPartData, | ||
| 674 | _Out_ UINT32 *pPartSizeInBytes) = 0; | ||
| 675 | |||
| 676 | /// \brief Create reflection interface from serialized DXIL container or the | ||
| 677 | /// DXC_OUT_REFLECTION blob contents. | ||
| 678 | /// | ||
| 679 | /// \param pData The source data. | ||
| 680 | /// | ||
| 681 | /// \param iid The interface ID of the reflection interface to create. | ||
| 682 | /// | ||
| 683 | /// \param ppvReflection Address of the pointer that receives a pointer to the | ||
| 684 | /// newly created reflection interface. | ||
| 685 | /// | ||
| 686 | /// Use this with interfaces such as ID3D12ShaderReflection. | ||
| 687 | virtual HRESULT STDMETHODCALLTYPE CreateReflection( | ||
| 688 | _In_ const DxcBuffer *pData, REFIID iid, void **ppvReflection) = 0; | ||
| 689 | |||
| 690 | /// \brief Build arguments that can be passed to the Compile method. | ||
| 691 | virtual HRESULT STDMETHODCALLTYPE BuildArguments( | ||
| 692 | _In_opt_z_ LPCWSTR pSourceName, ///< Optional file name for pSource. Used | ||
| 693 | ///< in errors and include handlers. | ||
| 694 | _In_opt_z_ LPCWSTR pEntryPoint, ///< Entry point name (-E). | ||
| 695 | _In_z_ LPCWSTR pTargetProfile, ///< Shader profile to compile (-T). | ||
| 696 | _In_opt_count_(argCount) | ||
| 697 | LPCWSTR *pArguments, ///< Array of pointers to arguments. | ||
| 698 | _In_ UINT32 argCount, ///< Number of arguments. | ||
| 699 | _In_count_(defineCount) const DxcDefine *pDefines, ///< Array of defines. | ||
| 700 | _In_ UINT32 defineCount, ///< Number of defines. | ||
| 701 | _COM_Outptr_ IDxcCompilerArgs * | ||
| 702 | *ppArgs ///< Arguments you can use with Compile() method. | ||
| 703 | ) = 0; | ||
| 704 | |||
| 705 | /// \brief Retrieve the hash and contents of a shader PDB. | ||
| 706 | /// | ||
| 707 | /// \param pPDBBlob The blob containing the PDB. | ||
| 708 | /// | ||
| 709 | /// \param ppHash Address of the pointer that receives a pointer to the hash | ||
| 710 | /// blob. | ||
| 711 | /// | ||
| 712 | /// \param ppContainer Address of the pointer that receives a pointer to the | ||
| 713 | /// bloc containing the contents of the PDB. | ||
| 714 | /// | ||
| 715 | virtual HRESULT STDMETHODCALLTYPE | ||
| 716 | GetPDBContents(_In_ IDxcBlob *pPDBBlob, _COM_Outptr_ IDxcBlob **ppHash, | ||
| 717 | _COM_Outptr_ IDxcBlob **ppContainer) = 0; | ||
| 718 | }; | ||
| 719 | |||
| 720 | /// \brief Specifies the kind of output to retrieve from a IDxcResult. | ||
| 721 | /// | ||
| 722 | /// Note: text outputs returned from version 2 APIs are UTF-8 or UTF-16 based on | ||
| 723 | /// the -encoding option passed to the compiler. | ||
| 724 | typedef enum DXC_OUT_KIND { | ||
| 725 | DXC_OUT_NONE = 0, ///< No output. | ||
| 726 | DXC_OUT_OBJECT = 1, ///< IDxcBlob - Shader or library object. | ||
| 727 | DXC_OUT_ERRORS = 2, ///< IDxcBlobUtf8 or IDxcBlobWide. | ||
| 728 | DXC_OUT_PDB = 3, ///< IDxcBlob. | ||
| 729 | DXC_OUT_SHADER_HASH = 4, ///< IDxcBlob - DxcShaderHash of shader or shader | ||
| 730 | ///< with source info (-Zsb/-Zss). | ||
| 731 | DXC_OUT_DISASSEMBLY = 5, ///< IDxcBlobUtf8 or IDxcBlobWide - from Disassemble. | ||
| 732 | DXC_OUT_HLSL = | ||
| 733 | 6, ///< IDxcBlobUtf8 or IDxcBlobWide - from Preprocessor or Rewriter. | ||
| 734 | DXC_OUT_TEXT = 7, ///< IDxcBlobUtf8 or IDxcBlobWide - other text, such as | ||
| 735 | ///< -ast-dump or -Odump. | ||
| 736 | DXC_OUT_REFLECTION = 8, ///< IDxcBlob - RDAT part with reflection data. | ||
| 737 | DXC_OUT_ROOT_SIGNATURE = 9, ///< IDxcBlob - Serialized root signature output. | ||
| 738 | DXC_OUT_EXTRA_OUTPUTS = 10, ///< IDxcExtraOutputs - Extra outputs. | ||
| 739 | DXC_OUT_REMARKS = | ||
| 740 | 11, ///< IDxcBlobUtf8 or IDxcBlobWide - text directed at stdout. | ||
| 741 | DXC_OUT_TIME_REPORT = | ||
| 742 | 12, ///< IDxcBlobUtf8 or IDxcBlobWide - text directed at stdout. | ||
| 743 | DXC_OUT_TIME_TRACE = | ||
| 744 | 13, ///< IDxcBlobUtf8 or IDxcBlobWide - text directed at stdout. | ||
| 745 | |||
| 746 | DXC_OUT_LAST = DXC_OUT_TIME_TRACE, ///< Last value for a counter. | ||
| 747 | |||
| 748 | DXC_OUT_NUM_ENUMS, | ||
| 749 | DXC_OUT_FORCE_DWORD = 0xFFFFFFFF | ||
| 750 | } DXC_OUT_KIND; | ||
| 751 | |||
| 752 | static_assert(DXC_OUT_NUM_ENUMS == DXC_OUT_LAST + 1, | ||
| 753 | "DXC_OUT_* Enum added and last value not updated."); | ||
| 754 | |||
| 755 | CROSS_PLATFORM_UUIDOF(IDxcResult, "58346CDA-DDE7-4497-9461-6F87AF5E0659") | ||
| 756 | /// \brief Result of a DXC operation. | ||
| 757 | /// | ||
| 758 | /// DXC operations may have multiple outputs, such as a shader object and | ||
| 759 | /// errors. This interface provides access to the outputs. | ||
| 760 | struct IDxcResult : public IDxcOperationResult { | ||
| 761 | /// \brief Determines whether or not this result has the specified output. | ||
| 762 | /// | ||
| 763 | /// \param dxcOutKind The kind of output to check for. | ||
| 764 | virtual BOOL STDMETHODCALLTYPE HasOutput(_In_ DXC_OUT_KIND dxcOutKind) = 0; | ||
| 765 | |||
| 766 | /// \brief Retrieves the specified output. | ||
| 767 | /// | ||
| 768 | /// \param dxcOutKind The kind of output to retrieve. | ||
| 769 | /// | ||
| 770 | /// \param iid The interface ID of the output interface. | ||
| 771 | /// | ||
| 772 | /// \param ppvObject Address of the pointer that receives a pointer to the | ||
| 773 | /// output. | ||
| 774 | /// | ||
| 775 | /// \param ppOutputName Optional address of a pointer to receive the name | ||
| 776 | /// blob, if there is one. | ||
| 777 | virtual HRESULT STDMETHODCALLTYPE | ||
| 778 | GetOutput(_In_ DXC_OUT_KIND dxcOutKind, _In_ REFIID iid, | ||
| 779 | _COM_Outptr_opt_result_maybenull_ void **ppvObject, | ||
| 780 | _COM_Outptr_opt_result_maybenull_ IDxcBlobWide **ppOutputName) = 0; | ||
| 781 | |||
| 782 | /// \brief Retrieves the number of outputs available in this result. | ||
| 783 | virtual UINT32 GetNumOutputs() = 0; | ||
| 784 | |||
| 785 | /// \brief Retrieves the output kind at the specified index. | ||
| 786 | virtual DXC_OUT_KIND GetOutputByIndex(UINT32 Index) = 0; | ||
| 787 | |||
| 788 | /// \brief Retrieves the primary output kind for this result. | ||
| 789 | /// | ||
| 790 | /// See IDxcOperationResult::GetResult() for more information on the primary | ||
| 791 | /// output kinds. | ||
| 792 | virtual DXC_OUT_KIND PrimaryOutput() = 0; | ||
| 793 | }; | ||
| 794 | |||
| 795 | // Special names for extra output that should get written to specific streams. | ||
| 796 | #define DXC_EXTRA_OUTPUT_NAME_STDOUT L"*stdout*" | ||
| 797 | #define DXC_EXTRA_OUTPUT_NAME_STDERR L"*stderr*" | ||
| 798 | |||
| 799 | CROSS_PLATFORM_UUIDOF(IDxcExtraOutputs, "319b37a2-a5c2-494a-a5de-4801b2faf989") | ||
| 800 | /// \brief Additional outputs from a DXC operation. | ||
| 801 | /// | ||
| 802 | /// This can be used to obtain outputs that don't have an explicit DXC_OUT_KIND. | ||
| 803 | /// Use DXC_OUT_EXTRA_OUTPUTS to obtain instances of this. | ||
| 804 | struct IDxcExtraOutputs : public IUnknown { | ||
| 805 | /// \brief Retrieves the number of outputs available | ||
| 806 | virtual UINT32 STDMETHODCALLTYPE GetOutputCount() = 0; | ||
| 807 | |||
| 808 | /// \brief Retrieves the specified output. | ||
| 809 | /// | ||
| 810 | /// \param uIndex The index of the output to retrieve. | ||
| 811 | /// | ||
| 812 | /// \param iid The interface ID of the output interface. | ||
| 813 | /// | ||
| 814 | /// \param ppvObject Optional address of the pointer that receives a pointer | ||
| 815 | /// to the output if there is one. | ||
| 816 | /// | ||
| 817 | /// \param ppOutputType Optional address of the pointer that receives the | ||
| 818 | /// output type name blob if there is one. | ||
| 819 | /// | ||
| 820 | /// \param ppOutputName Optional address of the pointer that receives the | ||
| 821 | /// output name blob if there is one. | ||
| 822 | virtual HRESULT STDMETHODCALLTYPE | ||
| 823 | GetOutput(_In_ UINT32 uIndex, _In_ REFIID iid, | ||
| 824 | _COM_Outptr_opt_result_maybenull_ void **ppvObject, | ||
| 825 | _COM_Outptr_opt_result_maybenull_ IDxcBlobWide **ppOutputType, | ||
| 826 | _COM_Outptr_opt_result_maybenull_ IDxcBlobWide **ppOutputName) = 0; | ||
| 827 | }; | ||
| 828 | |||
| 829 | CROSS_PLATFORM_UUIDOF(IDxcCompiler3, "228B4687-5A6A-4730-900C-9702B2203F54") | ||
| 830 | /// \brief Interface to the DirectX Shader Compiler. | ||
| 831 | /// | ||
| 832 | /// Use DxcCreateInstance with CLSID_DxcCompiler to obtain an instance of this | ||
| 833 | /// interface. | ||
| 834 | struct IDxcCompiler3 : public IUnknown { | ||
| 835 | /// \brief Compile a shader. | ||
| 836 | /// | ||
| 837 | /// IDxcUtils::BuildArguments can be used to assist building the pArguments | ||
| 838 | /// and argCount parameters. | ||
| 839 | /// | ||
| 840 | /// Depending on the arguments, this method can be used to: | ||
| 841 | /// | ||
| 842 | /// * Compile a single entry point to the target shader model, | ||
| 843 | /// * Compile a library to a library target (-T lib_*) | ||
| 844 | /// * Compile a root signature (-T rootsig_*), | ||
| 845 | /// * Preprocess HLSL source (-P). | ||
| 846 | virtual HRESULT STDMETHODCALLTYPE Compile( | ||
| 847 | _In_ const DxcBuffer *pSource, ///< Source text to compile. | ||
| 848 | _In_opt_count_(argCount) | ||
| 849 | LPCWSTR *pArguments, ///< Array of pointers to arguments. | ||
| 850 | _In_ UINT32 argCount, ///< Number of arguments. | ||
| 851 | _In_opt_ IDxcIncludeHandler | ||
| 852 | *pIncludeHandler, ///< user-provided interface to handle include | ||
| 853 | ///< directives (optional). | ||
| 854 | _In_ REFIID riid, ///< Interface ID for the result. | ||
| 855 | _Out_ LPVOID *ppResult ///< IDxcResult: status, buffer, and errors. | ||
| 856 | ) = 0; | ||
| 857 | |||
| 858 | /// \brief Disassemble a program. | ||
| 859 | virtual HRESULT STDMETHODCALLTYPE Disassemble( | ||
| 860 | _In_ const DxcBuffer | ||
| 861 | *pObject, ///< Program to disassemble: dxil container or bitcode. | ||
| 862 | _In_ REFIID riid, ///< Interface ID for the result. | ||
| 863 | _Out_ LPVOID | ||
| 864 | *ppResult ///< IDxcResult: status, disassembly text, and errors. | ||
| 865 | ) = 0; | ||
| 866 | }; | ||
| 867 | |||
| 868 | static const UINT32 DxcValidatorFlags_Default = 0; | ||
| 869 | static const UINT32 DxcValidatorFlags_InPlaceEdit = | ||
| 870 | 1; // Validator is allowed to update shader blob in-place. | ||
| 871 | static const UINT32 DxcValidatorFlags_RootSignatureOnly = 2; | ||
| 872 | static const UINT32 DxcValidatorFlags_ModuleOnly = 4; | ||
| 873 | static const UINT32 DxcValidatorFlags_ValidMask = 0x7; | ||
| 874 | |||
| 875 | CROSS_PLATFORM_UUIDOF(IDxcValidator, "A6E82BD2-1FD7-4826-9811-2857E797F49A") | ||
| 876 | /// \brief Interface to DXC shader validator. | ||
| 877 | /// | ||
| 878 | /// Use DxcCreateInstance with CLSID_DxcValidator to obtain an instance of this. | ||
| 879 | struct IDxcValidator : public IUnknown { | ||
| 880 | /// \brief Validate a shader. | ||
| 881 | virtual HRESULT STDMETHODCALLTYPE Validate( | ||
| 882 | _In_ IDxcBlob *pShader, ///< Shader to validate. | ||
| 883 | _In_ UINT32 Flags, ///< Validation flags. | ||
| 884 | _COM_Outptr_ IDxcOperationResult * | ||
| 885 | *ppResult ///< Validation output status, buffer, and errors. | ||
| 886 | ) = 0; | ||
| 887 | }; | ||
| 888 | |||
| 889 | CROSS_PLATFORM_UUIDOF(IDxcValidator2, "458e1fd1-b1b2-4750-a6e1-9c10f03bed92") | ||
| 890 | /// \brief Interface to DXC shader validator. | ||
| 891 | /// | ||
| 892 | /// Use DxcCreateInstance with CLSID_DxcValidator to obtain an instance of this. | ||
| 893 | struct IDxcValidator2 : public IDxcValidator { | ||
| 894 | /// \brief Validate a shader with optional debug bitcode. | ||
| 895 | virtual HRESULT STDMETHODCALLTYPE ValidateWithDebug( | ||
| 896 | _In_ IDxcBlob *pShader, ///< Shader to validate. | ||
| 897 | _In_ UINT32 Flags, ///< Validation flags. | ||
| 898 | _In_opt_ DxcBuffer *pOptDebugBitcode, ///< Optional debug module bitcode | ||
| 899 | ///< to provide line numbers. | ||
| 900 | _COM_Outptr_ IDxcOperationResult * | ||
| 901 | *ppResult ///< Validation output status, buffer, and errors. | ||
| 902 | ) = 0; | ||
| 903 | }; | ||
| 904 | |||
| 905 | CROSS_PLATFORM_UUIDOF(IDxcContainerBuilder, | ||
| 906 | "334b1f50-2292-4b35-99a1-25588d8c17fe") | ||
| 907 | /// \brief Interface to DXC container builder. | ||
| 908 | /// | ||
| 909 | /// Use DxcCreateInstance with CLSID_DxcContainerBuilder to obtain an instance | ||
| 910 | /// of this. | ||
| 911 | struct IDxcContainerBuilder : public IUnknown { | ||
| 912 | /// \brief Load a DxilContainer to the builder. | ||
| 913 | virtual HRESULT STDMETHODCALLTYPE | ||
| 914 | Load(_In_ IDxcBlob *pDxilContainerHeader) = 0; | ||
| 915 | |||
| 916 | /// \brief Add a part to the container. | ||
| 917 | /// | ||
| 918 | /// \param fourCC The part identifier (eg DXC_PART_PDB). | ||
| 919 | /// | ||
| 920 | /// \param pSource The source blob. | ||
| 921 | virtual HRESULT STDMETHODCALLTYPE AddPart(_In_ UINT32 fourCC, | ||
| 922 | _In_ IDxcBlob *pSource) = 0; | ||
| 923 | |||
| 924 | /// \brief Remove a part from the container. | ||
| 925 | /// | ||
| 926 | /// \param fourCC The part identifier (eg DXC_PART_PDB). | ||
| 927 | /// | ||
| 928 | /// \return S_OK on success, DXC_E_MISSING_PART if the part was not found, or | ||
| 929 | /// other standard HRESULT error code. | ||
| 930 | virtual HRESULT STDMETHODCALLTYPE RemovePart(_In_ UINT32 fourCC) = 0; | ||
| 931 | |||
| 932 | /// \brief Build the container. | ||
| 933 | /// | ||
| 934 | /// \param ppResult Pointer to variable to receive the result. | ||
| 935 | virtual HRESULT STDMETHODCALLTYPE | ||
| 936 | SerializeContainer(_Out_ IDxcOperationResult **ppResult) = 0; | ||
| 937 | }; | ||
| 938 | |||
| 939 | CROSS_PLATFORM_UUIDOF(IDxcAssembler, "091f7a26-1c1f-4948-904b-e6e3a8a771d5") | ||
| 940 | /// \brief Interface to DxcAssembler. | ||
| 941 | /// | ||
| 942 | /// Use DxcCreateInstance with CLSID_DxcAssembler to obtain an instance of this. | ||
| 943 | struct IDxcAssembler : public IUnknown { | ||
| 944 | /// \brief Assemble DXIL in LL or LLVM bitcode to DXIL container. | ||
| 945 | virtual HRESULT STDMETHODCALLTYPE AssembleToContainer( | ||
| 946 | _In_ IDxcBlob *pShader, ///< Shader to assemble. | ||
| 947 | _COM_Outptr_ IDxcOperationResult * | ||
| 948 | *ppResult ///< Assembly output status, buffer, and errors. | ||
| 949 | ) = 0; | ||
| 950 | }; | ||
| 951 | |||
| 952 | CROSS_PLATFORM_UUIDOF(IDxcContainerReflection, | ||
| 953 | "d2c21b26-8350-4bdc-976a-331ce6f4c54c") | ||
| 954 | /// \brief Interface to DxcContainerReflection. | ||
| 955 | /// | ||
| 956 | /// Use DxcCreateInstance with CLSID_DxcContainerReflection to obtain an | ||
| 957 | /// instance of this. | ||
| 958 | struct IDxcContainerReflection : public IUnknown { | ||
| 959 | /// \brief Choose the container to perform reflection on | ||
| 960 | /// | ||
| 961 | /// \param pContainer The container to load. If null is passed then this | ||
| 962 | /// instance will release any held resources. | ||
| 963 | virtual HRESULT STDMETHODCALLTYPE Load(_In_ IDxcBlob *pContainer) = 0; | ||
| 964 | |||
| 965 | /// \brief Retrieves the number of parts in the container. | ||
| 966 | /// | ||
| 967 | /// \param pResult Pointer to variable to receive the result. | ||
| 968 | /// | ||
| 969 | /// \return S_OK on success, E_NOT_VALID_STATE if a container has not been | ||
| 970 | /// loaded using Load(), or other standard HRESULT error codes. | ||
| 971 | virtual HRESULT STDMETHODCALLTYPE GetPartCount(_Out_ UINT32 *pResult) = 0; | ||
| 972 | |||
| 973 | /// \brief Retrieve the kind of a specified part. | ||
| 974 | /// | ||
| 975 | /// \param idx The index of the part to retrieve the kind of. | ||
| 976 | /// | ||
| 977 | /// \param pResult Pointer to variable to receive the result. | ||
| 978 | /// | ||
| 979 | /// \return S_OK on success, E_NOT_VALID_STATE if a container has not been | ||
| 980 | /// loaded using Load(), E_BOUND if idx is out of bounds, or other standard | ||
| 981 | /// HRESULT error codes. | ||
| 982 | virtual HRESULT STDMETHODCALLTYPE GetPartKind(UINT32 idx, | ||
| 983 | _Out_ UINT32 *pResult) = 0; | ||
| 984 | |||
| 985 | /// \brief Retrieve the content of a specified part. | ||
| 986 | /// | ||
| 987 | /// \param idx The index of the part to retrieve. | ||
| 988 | /// | ||
| 989 | /// \param ppResult Pointer to variable to receive the result. | ||
| 990 | /// | ||
| 991 | /// \return S_OK on success, E_NOT_VALID_STATE if a container has not been | ||
| 992 | /// loaded using Load(), E_BOUND if idx is out of bounds, or other standard | ||
| 993 | /// HRESULT error codes. | ||
| 994 | virtual HRESULT STDMETHODCALLTYPE | ||
| 995 | GetPartContent(UINT32 idx, _COM_Outptr_ IDxcBlob **ppResult) = 0; | ||
| 996 | |||
| 997 | /// \brief Retrieve the index of the first part with the specified kind. | ||
| 998 | /// | ||
| 999 | /// \param kind The kind to search for. | ||
| 1000 | /// | ||
| 1001 | /// \param pResult Pointer to variable to receive the index of the matching | ||
| 1002 | /// part. | ||
| 1003 | /// | ||
| 1004 | /// \return S_OK on success, E_NOT_VALID_STATE if a container has not been | ||
| 1005 | /// loaded using Load(), HRESULT_FROM_WIN32(ERROR_NOT_FOUND) if there is no | ||
| 1006 | /// part with the specified kind, or other standard HRESULT error codes. | ||
| 1007 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1008 | FindFirstPartKind(UINT32 kind, _Out_ UINT32 *pResult) = 0; | ||
| 1009 | |||
| 1010 | /// \brief Retrieve the reflection interface for a specified part. | ||
| 1011 | /// | ||
| 1012 | /// \param idx The index of the part to retrieve the reflection interface of. | ||
| 1013 | /// | ||
| 1014 | /// \param iid The IID of the interface to retrieve. | ||
| 1015 | /// | ||
| 1016 | /// \param ppvObject Pointer to variable to receive the result. | ||
| 1017 | /// | ||
| 1018 | /// Use this with interfaces such as ID3D12ShaderReflection. | ||
| 1019 | /// | ||
| 1020 | /// \return S_OK on success, E_NOT_VALID_STATE if a container has not been | ||
| 1021 | /// loaded using Load(), E_BOUND if idx is out of bounds, or other standard | ||
| 1022 | /// HRESULT error codes. | ||
| 1023 | virtual HRESULT STDMETHODCALLTYPE GetPartReflection(UINT32 idx, REFIID iid, | ||
| 1024 | void **ppvObject) = 0; | ||
| 1025 | }; | ||
| 1026 | |||
| 1027 | CROSS_PLATFORM_UUIDOF(IDxcOptimizerPass, "AE2CD79F-CC22-453F-9B6B-B124E7A5204C") | ||
| 1028 | /// \brief An optimizer pass. | ||
| 1029 | /// | ||
| 1030 | /// Instances of this can be obtained via IDxcOptimizer::GetAvailablePass. | ||
| 1031 | struct IDxcOptimizerPass : public IUnknown { | ||
| 1032 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1033 | GetOptionName(_COM_Outptr_ LPWSTR *ppResult) = 0; | ||
| 1034 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1035 | GetDescription(_COM_Outptr_ LPWSTR *ppResult) = 0; | ||
| 1036 | virtual HRESULT STDMETHODCALLTYPE GetOptionArgCount(_Out_ UINT32 *pCount) = 0; | ||
| 1037 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1038 | GetOptionArgName(UINT32 argIndex, _COM_Outptr_ LPWSTR *ppResult) = 0; | ||
| 1039 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1040 | GetOptionArgDescription(UINT32 argIndex, _COM_Outptr_ LPWSTR *ppResult) = 0; | ||
| 1041 | }; | ||
| 1042 | |||
| 1043 | CROSS_PLATFORM_UUIDOF(IDxcOptimizer, "25740E2E-9CBA-401B-9119-4FB42F39F270") | ||
| 1044 | /// \brief Interface to DxcOptimizer. | ||
| 1045 | /// | ||
| 1046 | /// Use DxcCreateInstance with CLSID_DxcOptimizer to obtain an instance of this. | ||
| 1047 | struct IDxcOptimizer : public IUnknown { | ||
| 1048 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1049 | GetAvailablePassCount(_Out_ UINT32 *pCount) = 0; | ||
| 1050 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1051 | GetAvailablePass(UINT32 index, _COM_Outptr_ IDxcOptimizerPass **ppResult) = 0; | ||
| 1052 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1053 | RunOptimizer(IDxcBlob *pBlob, _In_count_(optionCount) LPCWSTR *ppOptions, | ||
| 1054 | UINT32 optionCount, _COM_Outptr_ IDxcBlob **pOutputModule, | ||
| 1055 | _COM_Outptr_opt_ IDxcBlobEncoding **ppOutputText) = 0; | ||
| 1056 | }; | ||
| 1057 | |||
| 1058 | static const UINT32 DxcVersionInfoFlags_None = 0; | ||
| 1059 | static const UINT32 DxcVersionInfoFlags_Debug = 1; // Matches VS_FF_DEBUG | ||
| 1060 | static const UINT32 DxcVersionInfoFlags_Internal = | ||
| 1061 | 2; // Internal Validator (non-signing) | ||
| 1062 | |||
| 1063 | CROSS_PLATFORM_UUIDOF(IDxcVersionInfo, "b04f5b50-2059-4f12-a8ff-a1e0cde1cc7e") | ||
| 1064 | /// \brief PDB Version information. | ||
| 1065 | /// | ||
| 1066 | /// Use IDxcPdbUtils2::GetVersionInfo to obtain an instance of this. | ||
| 1067 | struct IDxcVersionInfo : public IUnknown { | ||
| 1068 | virtual HRESULT STDMETHODCALLTYPE GetVersion(_Out_ UINT32 *pMajor, | ||
| 1069 | _Out_ UINT32 *pMinor) = 0; | ||
| 1070 | virtual HRESULT STDMETHODCALLTYPE GetFlags(_Out_ UINT32 *pFlags) = 0; | ||
| 1071 | }; | ||
| 1072 | |||
| 1073 | CROSS_PLATFORM_UUIDOF(IDxcVersionInfo2, "fb6904c4-42f0-4b62-9c46-983af7da7c83") | ||
| 1074 | /// \brief PDB Version Information. | ||
| 1075 | /// | ||
| 1076 | /// Use IDxcPdbUtils2::GetVersionInfo to obtain a IDxcVersionInfo interface, and | ||
| 1077 | /// then use QueryInterface to obtain an instance of this interface from it. | ||
| 1078 | struct IDxcVersionInfo2 : public IDxcVersionInfo { | ||
| 1079 | virtual HRESULT STDMETHODCALLTYPE GetCommitInfo( | ||
| 1080 | _Out_ UINT32 *pCommitCount, ///< The total number commits. | ||
| 1081 | _Outptr_result_z_ char **pCommitHash ///< The SHA of the latest commit. | ||
| 1082 | ///< Must be CoTaskMemFree()'d. | ||
| 1083 | ) = 0; | ||
| 1084 | }; | ||
| 1085 | |||
| 1086 | CROSS_PLATFORM_UUIDOF(IDxcVersionInfo3, "5e13e843-9d25-473c-9ad2-03b2d0b44b1e") | ||
| 1087 | /// \brief PDB Version Information. | ||
| 1088 | /// | ||
| 1089 | /// Use IDxcPdbUtils2::GetVersionInfo to obtain a IDxcVersionInfo interface, and | ||
| 1090 | /// then use QueryInterface to obtain an instance of this interface from it. | ||
| 1091 | struct IDxcVersionInfo3 : public IUnknown { | ||
| 1092 | virtual HRESULT STDMETHODCALLTYPE GetCustomVersionString( | ||
| 1093 | _Outptr_result_z_ char * | ||
| 1094 | *pVersionString ///< Custom version string for compiler. Must be | ||
| 1095 | ///< CoTaskMemFree()'d. | ||
| 1096 | ) = 0; | ||
| 1097 | }; | ||
| 1098 | |||
| 1099 | struct DxcArgPair { | ||
| 1100 | const WCHAR *pName; | ||
| 1101 | const WCHAR *pValue; | ||
| 1102 | }; | ||
| 1103 | |||
| 1104 | CROSS_PLATFORM_UUIDOF(IDxcPdbUtils, "E6C9647E-9D6A-4C3B-B94C-524B5A6C343D") | ||
| 1105 | /// \deprecated Please use IDxcPdbUtils2 instead. | ||
| 1106 | struct IDxcPdbUtils : public IUnknown { | ||
| 1107 | virtual HRESULT STDMETHODCALLTYPE Load(_In_ IDxcBlob *pPdbOrDxil) = 0; | ||
| 1108 | |||
| 1109 | virtual HRESULT STDMETHODCALLTYPE GetSourceCount(_Out_ UINT32 *pCount) = 0; | ||
| 1110 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1111 | GetSource(_In_ UINT32 uIndex, _COM_Outptr_ IDxcBlobEncoding **ppResult) = 0; | ||
| 1112 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1113 | GetSourceName(_In_ UINT32 uIndex, _Outptr_result_z_ BSTR *pResult) = 0; | ||
| 1114 | |||
| 1115 | virtual HRESULT STDMETHODCALLTYPE GetFlagCount(_Out_ UINT32 *pCount) = 0; | ||
| 1116 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1117 | GetFlag(_In_ UINT32 uIndex, _Outptr_result_z_ BSTR *pResult) = 0; | ||
| 1118 | |||
| 1119 | virtual HRESULT STDMETHODCALLTYPE GetArgCount(_Out_ UINT32 *pCount) = 0; | ||
| 1120 | virtual HRESULT STDMETHODCALLTYPE GetArg(_In_ UINT32 uIndex, | ||
| 1121 | _Outptr_result_z_ BSTR *pResult) = 0; | ||
| 1122 | |||
| 1123 | virtual HRESULT STDMETHODCALLTYPE GetArgPairCount(_Out_ UINT32 *pCount) = 0; | ||
| 1124 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1125 | GetArgPair(_In_ UINT32 uIndex, _Outptr_result_z_ BSTR *pName, | ||
| 1126 | _Outptr_result_z_ BSTR *pValue) = 0; | ||
| 1127 | |||
| 1128 | virtual HRESULT STDMETHODCALLTYPE GetDefineCount(_Out_ UINT32 *pCount) = 0; | ||
| 1129 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1130 | GetDefine(_In_ UINT32 uIndex, _Outptr_result_z_ BSTR *pResult) = 0; | ||
| 1131 | |||
| 1132 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1133 | GetTargetProfile(_Outptr_result_z_ BSTR *pResult) = 0; | ||
| 1134 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1135 | GetEntryPoint(_Outptr_result_z_ BSTR *pResult) = 0; | ||
| 1136 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1137 | GetMainFileName(_Outptr_result_z_ BSTR *pResult) = 0; | ||
| 1138 | |||
| 1139 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1140 | GetHash(_COM_Outptr_ IDxcBlob **ppResult) = 0; | ||
| 1141 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1142 | GetName(_Outptr_result_z_ BSTR *pResult) = 0; | ||
| 1143 | |||
| 1144 | virtual BOOL STDMETHODCALLTYPE IsFullPDB() = 0; | ||
| 1145 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1146 | GetFullPDB(_COM_Outptr_ IDxcBlob **ppFullPDB) = 0; | ||
| 1147 | |||
| 1148 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1149 | GetVersionInfo(_COM_Outptr_ IDxcVersionInfo **ppVersionInfo) = 0; | ||
| 1150 | |||
| 1151 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1152 | SetCompiler(_In_ IDxcCompiler3 *pCompiler) = 0; | ||
| 1153 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1154 | CompileForFullPDB(_COM_Outptr_ IDxcResult **ppResult) = 0; | ||
| 1155 | virtual HRESULT STDMETHODCALLTYPE OverrideArgs(_In_ DxcArgPair *pArgPairs, | ||
| 1156 | UINT32 uNumArgPairs) = 0; | ||
| 1157 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1158 | OverrideRootSignature(_In_ const WCHAR *pRootSignature) = 0; | ||
| 1159 | }; | ||
| 1160 | |||
| 1161 | CROSS_PLATFORM_UUIDOF(IDxcPdbUtils2, "4315D938-F369-4F93-95A2-252017CC3807") | ||
| 1162 | /// \brief DxcPdbUtils interface. | ||
| 1163 | /// | ||
| 1164 | /// Use DxcCreateInstance with CLSID_DxcPdbUtils to create an instance of this. | ||
| 1165 | struct IDxcPdbUtils2 : public IUnknown { | ||
| 1166 | virtual HRESULT STDMETHODCALLTYPE Load(_In_ IDxcBlob *pPdbOrDxil) = 0; | ||
| 1167 | |||
| 1168 | virtual HRESULT STDMETHODCALLTYPE GetSourceCount(_Out_ UINT32 *pCount) = 0; | ||
| 1169 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1170 | GetSource(_In_ UINT32 uIndex, _COM_Outptr_ IDxcBlobEncoding **ppResult) = 0; | ||
| 1171 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1172 | GetSourceName(_In_ UINT32 uIndex, _COM_Outptr_ IDxcBlobWide **ppResult) = 0; | ||
| 1173 | |||
| 1174 | virtual HRESULT STDMETHODCALLTYPE GetLibraryPDBCount(UINT32 *pCount) = 0; | ||
| 1175 | virtual HRESULT STDMETHODCALLTYPE GetLibraryPDB( | ||
| 1176 | _In_ UINT32 uIndex, _COM_Outptr_ IDxcPdbUtils2 **ppOutPdbUtils, | ||
| 1177 | _COM_Outptr_opt_result_maybenull_ IDxcBlobWide **ppLibraryName) = 0; | ||
| 1178 | |||
| 1179 | virtual HRESULT STDMETHODCALLTYPE GetFlagCount(_Out_ UINT32 *pCount) = 0; | ||
| 1180 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1181 | GetFlag(_In_ UINT32 uIndex, _COM_Outptr_ IDxcBlobWide **ppResult) = 0; | ||
| 1182 | |||
| 1183 | virtual HRESULT STDMETHODCALLTYPE GetArgCount(_Out_ UINT32 *pCount) = 0; | ||
| 1184 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1185 | GetArg(_In_ UINT32 uIndex, _COM_Outptr_ IDxcBlobWide **ppResult) = 0; | ||
| 1186 | |||
| 1187 | virtual HRESULT STDMETHODCALLTYPE GetArgPairCount(_Out_ UINT32 *pCount) = 0; | ||
| 1188 | virtual HRESULT STDMETHODCALLTYPE GetArgPair( | ||
| 1189 | _In_ UINT32 uIndex, _COM_Outptr_result_maybenull_ IDxcBlobWide **ppName, | ||
| 1190 | _COM_Outptr_result_maybenull_ IDxcBlobWide **ppValue) = 0; | ||
| 1191 | |||
| 1192 | virtual HRESULT STDMETHODCALLTYPE GetDefineCount(_Out_ UINT32 *pCount) = 0; | ||
| 1193 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1194 | GetDefine(_In_ UINT32 uIndex, _COM_Outptr_ IDxcBlobWide **ppResult) = 0; | ||
| 1195 | |||
| 1196 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1197 | GetTargetProfile(_COM_Outptr_result_maybenull_ IDxcBlobWide **ppResult) = 0; | ||
| 1198 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1199 | GetEntryPoint(_COM_Outptr_result_maybenull_ IDxcBlobWide **ppResult) = 0; | ||
| 1200 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1201 | GetMainFileName(_COM_Outptr_result_maybenull_ IDxcBlobWide **ppResult) = 0; | ||
| 1202 | |||
| 1203 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1204 | GetHash(_COM_Outptr_result_maybenull_ IDxcBlob **ppResult) = 0; | ||
| 1205 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1206 | GetName(_COM_Outptr_result_maybenull_ IDxcBlobWide **ppResult) = 0; | ||
| 1207 | |||
| 1208 | virtual HRESULT STDMETHODCALLTYPE GetVersionInfo( | ||
| 1209 | _COM_Outptr_result_maybenull_ IDxcVersionInfo **ppVersionInfo) = 0; | ||
| 1210 | |||
| 1211 | virtual HRESULT STDMETHODCALLTYPE GetCustomToolchainID(_Out_ UINT32 *pID) = 0; | ||
| 1212 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1213 | GetCustomToolchainData(_COM_Outptr_result_maybenull_ IDxcBlob **ppBlob) = 0; | ||
| 1214 | |||
| 1215 | virtual HRESULT STDMETHODCALLTYPE | ||
| 1216 | GetWholeDxil(_COM_Outptr_result_maybenull_ IDxcBlob **ppResult) = 0; | ||
| 1217 | |||
| 1218 | virtual BOOL STDMETHODCALLTYPE IsFullPDB() = 0; | ||
| 1219 | virtual BOOL STDMETHODCALLTYPE IsPDBRef() = 0; | ||
| 1220 | }; | ||
| 1221 | |||
| 1222 | // Note: __declspec(selectany) requires 'extern' | ||
| 1223 | // On Linux __declspec(selectany) is removed and using 'extern' results in link | ||
| 1224 | // error. | ||
| 1225 | #ifdef _MSC_VER | ||
| 1226 | #define CLSID_SCOPE __declspec(selectany) extern | ||
| 1227 | #else | ||
| 1228 | #define CLSID_SCOPE | ||
| 1229 | #endif | ||
| 1230 | |||
| 1231 | CLSID_SCOPE const CLSID CLSID_DxcCompiler = { | ||
| 1232 | 0x73e22d93, | ||
| 1233 | 0xe6ce, | ||
| 1234 | 0x47f3, | ||
| 1235 | {0xb5, 0xbf, 0xf0, 0x66, 0x4f, 0x39, 0xc1, 0xb0}}; | ||
| 1236 | |||
| 1237 | // {EF6A8087-B0EA-4D56-9E45-D07E1A8B7806} | ||
| 1238 | CLSID_SCOPE const GUID CLSID_DxcLinker = { | ||
| 1239 | 0xef6a8087, | ||
| 1240 | 0xb0ea, | ||
| 1241 | 0x4d56, | ||
| 1242 | {0x9e, 0x45, 0xd0, 0x7e, 0x1a, 0x8b, 0x78, 0x6}}; | ||
| 1243 | |||
| 1244 | // {CD1F6B73-2AB0-484D-8EDC-EBE7A43CA09F} | ||
| 1245 | CLSID_SCOPE const CLSID CLSID_DxcDiaDataSource = { | ||
| 1246 | 0xcd1f6b73, | ||
| 1247 | 0x2ab0, | ||
| 1248 | 0x484d, | ||
| 1249 | {0x8e, 0xdc, 0xeb, 0xe7, 0xa4, 0x3c, 0xa0, 0x9f}}; | ||
| 1250 | |||
| 1251 | // {3E56AE82-224D-470F-A1A1-FE3016EE9F9D} | ||
| 1252 | CLSID_SCOPE const CLSID CLSID_DxcCompilerArgs = { | ||
| 1253 | 0x3e56ae82, | ||
| 1254 | 0x224d, | ||
| 1255 | 0x470f, | ||
| 1256 | {0xa1, 0xa1, 0xfe, 0x30, 0x16, 0xee, 0x9f, 0x9d}}; | ||
| 1257 | |||
| 1258 | // {6245D6AF-66E0-48FD-80B4-4D271796748C} | ||
| 1259 | CLSID_SCOPE const GUID CLSID_DxcLibrary = { | ||
| 1260 | 0x6245d6af, | ||
| 1261 | 0x66e0, | ||
| 1262 | 0x48fd, | ||
| 1263 | {0x80, 0xb4, 0x4d, 0x27, 0x17, 0x96, 0x74, 0x8c}}; | ||
| 1264 | |||
| 1265 | CLSID_SCOPE const GUID CLSID_DxcUtils = CLSID_DxcLibrary; | ||
| 1266 | |||
| 1267 | // {8CA3E215-F728-4CF3-8CDD-88AF917587A1} | ||
| 1268 | CLSID_SCOPE const GUID CLSID_DxcValidator = { | ||
| 1269 | 0x8ca3e215, | ||
| 1270 | 0xf728, | ||
| 1271 | 0x4cf3, | ||
| 1272 | {0x8c, 0xdd, 0x88, 0xaf, 0x91, 0x75, 0x87, 0xa1}}; | ||
| 1273 | |||
| 1274 | // {D728DB68-F903-4F80-94CD-DCCF76EC7151} | ||
| 1275 | CLSID_SCOPE const GUID CLSID_DxcAssembler = { | ||
| 1276 | 0xd728db68, | ||
| 1277 | 0xf903, | ||
| 1278 | 0x4f80, | ||
| 1279 | {0x94, 0xcd, 0xdc, 0xcf, 0x76, 0xec, 0x71, 0x51}}; | ||
| 1280 | |||
| 1281 | // {b9f54489-55b8-400c-ba3a-1675e4728b91} | ||
| 1282 | CLSID_SCOPE const GUID CLSID_DxcContainerReflection = { | ||
| 1283 | 0xb9f54489, | ||
| 1284 | 0x55b8, | ||
| 1285 | 0x400c, | ||
| 1286 | {0xba, 0x3a, 0x16, 0x75, 0xe4, 0x72, 0x8b, 0x91}}; | ||
| 1287 | |||
| 1288 | // {AE2CD79F-CC22-453F-9B6B-B124E7A5204C} | ||
| 1289 | CLSID_SCOPE const GUID CLSID_DxcOptimizer = { | ||
| 1290 | 0xae2cd79f, | ||
| 1291 | 0xcc22, | ||
| 1292 | 0x453f, | ||
| 1293 | {0x9b, 0x6b, 0xb1, 0x24, 0xe7, 0xa5, 0x20, 0x4c}}; | ||
| 1294 | |||
| 1295 | // {94134294-411f-4574-b4d0-8741e25240d2} | ||
| 1296 | CLSID_SCOPE const GUID CLSID_DxcContainerBuilder = { | ||
| 1297 | 0x94134294, | ||
| 1298 | 0x411f, | ||
| 1299 | 0x4574, | ||
| 1300 | {0xb4, 0xd0, 0x87, 0x41, 0xe2, 0x52, 0x40, 0xd2}}; | ||
| 1301 | |||
| 1302 | // {54621dfb-f2ce-457e-ae8c-ec355faeec7c} | ||
| 1303 | CLSID_SCOPE const GUID CLSID_DxcPdbUtils = { | ||
| 1304 | 0x54621dfb, | ||
| 1305 | 0xf2ce, | ||
| 1306 | 0x457e, | ||
| 1307 | {0xae, 0x8c, 0xec, 0x35, 0x5f, 0xae, 0xec, 0x7c}}; | ||
| 1308 | |||
| 1309 | #endif | ||
