| 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 |
#include <stdint.h> |
| 27 |
#ifndef CROSS_PLATFORM_UUIDOF |
| 28 |
// Warning: This macro exists in WinAdapter.h as well |
| 29 |
#if defined(_MSC_VER) |
| 30 |
#define CROSS_PLATFORM_UUIDOF(iface, spec) \ |
| 31 |
struct __declspec(uuid(spec)) iface; |
| 32 |
#else /* defined(_MSC_VER) */ |
| 33 |
#if defined(__MINGW32__) |
| 34 |
#include <guiddef.h> |
| 35 |
#include <sal.h> |
| 36 |
#ifndef _Maybenull_ |
| 37 |
#define _Maybenull_ |
| 38 |
#endif |
| 39 |
#ifndef _In_count_ |
| 40 |
#define _In_count_(x) |
| 41 |
#endif |
| 42 |
#ifndef _In_opt_count_ |
| 43 |
#define _In_opt_count_(x) |
| 44 |
#endif |
| 45 |
#ifndef _In_bytecount_ |
| 46 |
#define _In_bytecount_(x) |
| 47 |
#endif |
| 48 |
#endif /* defined(__MINGW32__) */ |
| 49 |
#ifndef __CRT_UUID_DECL |
| 50 |
#define __CRT_UUID_DECL(type, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ |
| 51 |
extern "C++" \ |
| 52 |
{ \ |
| 53 |
template <> \ |
| 54 |
struct __mesa_emulated_uuidof_s<type> \ |
| 55 |
{ \ |
| 56 |
static constexpr IID __uuid_inst = { \ |
| 57 |
l, w1, w2, {b1, b2, b3, b4, b5, b6, b7, b8}}; \ |
| 58 |
}; \ |
| 59 |
template <> \ |
| 60 |
constexpr const GUID &__mesa_emulated_uuidof<type>() \ |
| 61 |
{ \ |
| 62 |
return __mesa_emulated_uuidof_s<type>::__uuid_inst; \ |
| 63 |
} \ |
| 64 |
template <> \ |
| 65 |
constexpr const GUID &__mesa_emulated_uuidof<type *>() \ |
| 66 |
{ \ |
| 67 |
return __mesa_emulated_uuidof_s<type>::__uuid_inst; \ |
| 68 |
} \ |
| 69 |
} |
| 70 |
#define __uuidof(T) __mesa_emulated_uuidof<typename std::decay<T>::type>() |
| 71 |
#endif /*__CRT_UUID_DECL */ |
| 72 |
constexpr uint8_t nybble_from_hex(char c) { |
| 73 |
return ((c >= '0' && c <= '9') |
| 74 |
? (c - '0') |
| 75 |
: ((c >= 'a' && c <= 'f') |
| 76 |
? (c - 'a' + 10) |
| 77 |
: ((c >= 'A' && c <= 'F') ? (c - 'A' + 10) |
| 78 |
: /* Should be an error */ -1))); |
| 79 |
} |
| 80 |
|
| 81 |
constexpr uint8_t byte_from_hex(char c1, char c2) { |
| 82 |
return nybble_from_hex(c1) << 4 | nybble_from_hex(c2); |
| 83 |
} |
| 84 |
|
| 85 |
constexpr uint8_t byte_from_hexstr(const char str[2]) { |
| 86 |
return nybble_from_hex(str[0]) << 4 | nybble_from_hex(str[1]); |
| 87 |
} |
| 88 |
|
| 89 |
constexpr unsigned short short_from_hexstr(const char str[2], unsigned shift) |
| 90 |
{ |
| 91 |
return ((unsigned short)(nybble_from_hex(str[0]) << 4 | |
| 92 |
nybble_from_hex(str[1]))) |
| 93 |
<< shift; |
| 94 |
} |
| 95 |
|
| 96 |
constexpr unsigned long word_from_hexstr(const char str[2], unsigned shift) |
| 97 |
{ |
| 98 |
return ((unsigned long)(nybble_from_hex(str[0]) << 4 | |
| 99 |
nybble_from_hex(str[1]))) |
| 100 |
<< shift; |
| 101 |
} |
| 102 |
|
| 103 |
#define CROSS_PLATFORM_UUIDOF(iface, spec) \ |
| 104 |
struct iface; \ |
| 105 |
__CRT_UUID_DECL( \ |
| 106 |
iface, \ |
| 107 |
word_from_hexstr(spec, 24) | word_from_hexstr(spec + 2, 16) | \ |
| 108 |
word_from_hexstr(spec + 4, 8) | word_from_hexstr(spec + 6, 0), \ |
| 109 |
short_from_hexstr(spec + 9, 8) | short_from_hexstr(spec + 11, 0), \ |
| 110 |
short_from_hexstr(spec + 14, 8) | short_from_hexstr(spec + 16, 0), \ |
| 111 |
byte_from_hexstr(spec + 19), byte_from_hexstr(spec + 21), \ |
| 112 |
byte_from_hexstr(spec + 24), byte_from_hexstr(spec + 26), \ |
| 113 |
byte_from_hexstr(spec + 28), byte_from_hexstr(spec + 30), \ |
| 114 |
byte_from_hexstr(spec + 32), byte_from_hexstr(spec + 34)) |
| 115 |
|
| 116 |
#endif /* defined(_MSC_VER) */ |
| 117 |
#endif /* CROSS_PLATFORM_UUIDOF */ |
| 118 |
|
| 119 |
#ifndef _WIN32 |
| 120 |
|
| 121 |
CROSS_PLATFORM_UUIDOF(INoMarshal, "ECC8691B-C1DB-4DC0-855E-65F6C551AF49") |
| 122 |
struct INoMarshal : public IUnknown {}; |
| 123 |
|
| 124 |
CROSS_PLATFORM_UUIDOF(IMalloc, "00000002-0000-0000-C000-000000000046") |
| 125 |
struct IMalloc : public IUnknown { |
| 126 |
virtual void *Alloc(size_t size); |
| 127 |
virtual void *Realloc(void *ptr, size_t size); |
| 128 |
virtual void Free(void *ptr); |
| 129 |
virtual HRESULT QueryInterface(REFIID riid, void **ppvObject); |
| 130 |
}; |
| 131 |
|
| 132 |
CROSS_PLATFORM_UUIDOF(ISequentialStream, "0C733A30-2A1C-11CE-ADE5-00AA0044773D") |
| 133 |
struct ISequentialStream : public IUnknown { |
| 134 |
virtual HRESULT Read(void *pv, ULONG cb, ULONG *pcbRead) = 0; |
| 135 |
virtual HRESULT Write(const void *pv, ULONG cb, ULONG *pcbWritten) = 0; |
| 136 |
}; |
| 137 |
|
| 138 |
CROSS_PLATFORM_UUIDOF(IStream, "0000000c-0000-0000-C000-000000000046") |
| 139 |
struct IStream : public ISequentialStream { |
| 140 |
virtual HRESULT Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, |
| 141 |
ULARGE_INTEGER *plibNewPosition) = 0; |
| 142 |
virtual HRESULT SetSize(ULARGE_INTEGER libNewSize) = 0; |
| 143 |
virtual HRESULT CopyTo(IStream *pstm, ULARGE_INTEGER cb, |
| 144 |
ULARGE_INTEGER *pcbRead, |
| 145 |
ULARGE_INTEGER *pcbWritten) = 0; |
| 146 |
|
| 147 |
virtual HRESULT Commit(DWORD grfCommitFlags) = 0; |
| 148 |
|
| 149 |
virtual HRESULT Revert(void) = 0; |
| 150 |
|
| 151 |
virtual HRESULT LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, |
| 152 |
DWORD dwLockType) = 0; |
| 153 |
|
| 154 |
virtual HRESULT UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, |
| 155 |
DWORD dwLockType) = 0; |
| 156 |
|
| 157 |
virtual HRESULT Stat(STATSTG *pstatstg, DWORD grfStatFlag) = 0; |
| 158 |
|
| 159 |
virtual HRESULT Clone(IStream **ppstm) = 0; |
| 160 |
}; |
| 161 |
|
| 162 |
#endif |
| 163 |
|
| 164 |
struct IMalloc; |
| 165 |
|
| 166 |
struct IDxcIncludeHandler; |
| 167 |
|
| 168 |
typedef HRESULT (__stdcall *DxcCreateInstanceProc)( |
| 169 |
_In_ REFCLSID rclsid, |
| 170 |
_In_ REFIID riid, |
| 171 |
_Out_ LPVOID* ppv |
| 172 |
); |
| 173 |
|
| 174 |
typedef HRESULT(__stdcall *DxcCreateInstance2Proc)( |
| 175 |
_In_ IMalloc *pMalloc, |
| 176 |
_In_ REFCLSID rclsid, |
| 177 |
_In_ REFIID riid, |
| 178 |
_Out_ LPVOID* ppv |
| 179 |
); |
| 180 |
|
| 181 |
/// <summary> |
| 182 |
/// Creates a single uninitialized object of the class associated with a specified CLSID. |
| 183 |
/// </summary> |
| 184 |
/// <param name="rclsid"> |
| 185 |
/// The CLSID associated with the data and code that will be used to create the object. |
| 186 |
/// </param> |
| 187 |
/// <param name="riid"> |
| 188 |
/// A reference to the identifier of the interface to be used to communicate |
| 189 |
/// with the object. |
| 190 |
/// </param> |
| 191 |
/// <param name="ppv"> |
| 192 |
/// Address of pointer variable that receives the interface pointer requested |
| 193 |
/// in riid. Upon successful return, *ppv contains the requested interface |
| 194 |
/// pointer. Upon failure, *ppv contains NULL.</param> |
| 195 |
/// <remarks> |
| 196 |
/// While this function is similar to CoCreateInstance, there is no COM involvement. |
| 197 |
/// </remarks> |
| 198 |
|
| 199 |
extern "C" |
| 200 |
DXC_API_IMPORT HRESULT __stdcall DxcCreateInstance( |
| 201 |
_In_ REFCLSID rclsid, |
| 202 |
_In_ REFIID riid, |
| 203 |
_Out_ LPVOID* ppv |
| 204 |
); |
| 205 |
|
| 206 |
extern "C" |
| 207 |
DXC_API_IMPORT HRESULT __stdcall DxcCreateInstance2( |
| 208 |
_In_ IMalloc *pMalloc, |
| 209 |
_In_ REFCLSID rclsid, |
| 210 |
_In_ REFIID riid, |
| 211 |
_Out_ LPVOID* ppv |
| 212 |
); |
| 213 |
|
| 214 |
// For convenience, equivalent definitions to CP_UTF8 and CP_UTF16. |
| 215 |
#define DXC_CP_UTF8 65001 |
| 216 |
#define DXC_CP_UTF16 1200 |
| 217 |
// Use DXC_CP_ACP for: Binary; ANSI Text; Autodetect UTF with BOM |
| 218 |
#define DXC_CP_ACP 0 |
| 219 |
|
| 220 |
// This flag indicates that the shader hash was computed taking into account source information (-Zss) |
| 221 |
#define DXC_HASHFLAG_INCLUDES_SOURCE 1 |
| 222 |
|
| 223 |
// Hash digest type for ShaderHash |
| 224 |
typedef struct DxcShaderHash { |
| 225 |
UINT32 Flags; // DXC_HASHFLAG_* |
| 226 |
BYTE HashDigest[16]; |
| 227 |
} DxcShaderHash; |
| 228 |
|
| 229 |
#define DXC_FOURCC(ch0, ch1, ch2, ch3) ( \ |
| 230 |
(UINT32)(UINT8)(ch0) | (UINT32)(UINT8)(ch1) << 8 | \ |
| 231 |
(UINT32)(UINT8)(ch2) << 16 | (UINT32)(UINT8)(ch3) << 24 \ |
| 232 |
) |
| 233 |
#define DXC_PART_PDB DXC_FOURCC('I', 'L', 'D', 'B') |
| 234 |
#define DXC_PART_PDB_NAME DXC_FOURCC('I', 'L', 'D', 'N') |
| 235 |
#define DXC_PART_PRIVATE_DATA DXC_FOURCC('P', 'R', 'I', 'V') |
| 236 |
#define DXC_PART_ROOT_SIGNATURE DXC_FOURCC('R', 'T', 'S', '0') |
| 237 |
#define DXC_PART_DXIL DXC_FOURCC('D', 'X', 'I', 'L') |
| 238 |
#define DXC_PART_REFLECTION_DATA DXC_FOURCC('S', 'T', 'A', 'T') |
| 239 |
#define DXC_PART_SHADER_HASH DXC_FOURCC('H', 'A', 'S', 'H') |
| 240 |
#define DXC_PART_INPUT_SIGNATURE DXC_FOURCC('I', 'S', 'G', '1') |
| 241 |
#define DXC_PART_OUTPUT_SIGNATURE DXC_FOURCC('O', 'S', 'G', '1') |
| 242 |
#define DXC_PART_PATCH_CONSTANT_SIGNATURE DXC_FOURCC('P', 'S', 'G', '1') |
| 243 |
|
| 244 |
// Some option arguments are defined here for continuity with D3DCompile interface |
| 245 |
#define DXC_ARG_DEBUG L"-Zi" |
| 246 |
#define DXC_ARG_SKIP_VALIDATION L"-Vd" |
| 247 |
#define DXC_ARG_SKIP_OPTIMIZATIONS L"-Od" |
| 248 |
#define DXC_ARG_PACK_MATRIX_ROW_MAJOR L"-Zpr" |
| 249 |
#define DXC_ARG_PACK_MATRIX_COLUMN_MAJOR L"-Zpc" |
| 250 |
#define DXC_ARG_AVOID_FLOW_CONTROL L"-Gfa" |
| 251 |
#define DXC_ARG_PREFER_FLOW_CONTROL L"-Gfp" |
| 252 |
#define DXC_ARG_ENABLE_STRICTNESS L"-Ges" |
| 253 |
#define DXC_ARG_ENABLE_BACKWARDS_COMPATIBILITY L"-Gec" |
| 254 |
#define DXC_ARG_IEEE_STRICTNESS L"-Gis" |
| 255 |
#define DXC_ARG_OPTIMIZATION_LEVEL0 L"-O0" |
| 256 |
#define DXC_ARG_OPTIMIZATION_LEVEL1 L"-O1" |
| 257 |
#define DXC_ARG_OPTIMIZATION_LEVEL2 L"-O2" |
| 258 |
#define DXC_ARG_OPTIMIZATION_LEVEL3 L"-O3" |
| 259 |
#define DXC_ARG_WARNINGS_ARE_ERRORS L"-WX" |
| 260 |
#define DXC_ARG_RESOURCES_MAY_ALIAS L"-res_may_alias" |
| 261 |
#define DXC_ARG_ALL_RESOURCES_BOUND L"-all_resources_bound" |
| 262 |
#define DXC_ARG_DEBUG_NAME_FOR_SOURCE L"-Zss" |
| 263 |
#define DXC_ARG_DEBUG_NAME_FOR_BINARY L"-Zsb" |
| 264 |
|
| 265 |
// IDxcBlob is an alias of ID3D10Blob and ID3DBlob |
| 266 |
CROSS_PLATFORM_UUIDOF(IDxcBlob, "8BA5FB08-5195-40e2-AC58-0D989C3A0102") |
| 267 |
struct IDxcBlob : public IUnknown { |
| 268 |
public: |
| 269 |
virtual LPVOID STDMETHODCALLTYPE GetBufferPointer(void) = 0; |
| 270 |
virtual SIZE_T STDMETHODCALLTYPE GetBufferSize(void) = 0; |
| 271 |
}; |
| 272 |
|
| 273 |
CROSS_PLATFORM_UUIDOF(IDxcBlobEncoding, "7241d424-2646-4191-97c0-98e96e42fc68") |
| 274 |
struct IDxcBlobEncoding : public IDxcBlob { |
| 275 |
public: |
| 276 |
virtual HRESULT STDMETHODCALLTYPE GetEncoding(_Out_ BOOL *pKnown, |
| 277 |
_Out_ UINT32 *pCodePage) = 0; |
| 278 |
}; |
| 279 |
|
| 280 |
// Notes on IDxcBlobUtf16 and IDxcBlobUtf8 |
| 281 |
// These guarantee null-terminated text and the stated encoding. |
| 282 |
// GetBufferSize() will return the size in bytes, including null-terminator |
| 283 |
// GetStringLength() will return the length in characters, excluding the null-terminator |
| 284 |
// Name strings will use IDxcBlobUtf16, while other string output blobs, |
| 285 |
// such as errors/warnings, preprocessed HLSL, or other text will be based |
| 286 |
// on the -encoding option. |
| 287 |
|
| 288 |
// The API will use this interface for output name strings |
| 289 |
CROSS_PLATFORM_UUIDOF(IDxcBlobUtf16, "A3F84EAB-0FAA-497E-A39C-EE6ED60B2D84") |
| 290 |
struct IDxcBlobUtf16 : public IDxcBlobEncoding { |
| 291 |
public: |
| 292 |
virtual LPCWSTR STDMETHODCALLTYPE GetStringPointer(void) = 0; |
| 293 |
virtual SIZE_T STDMETHODCALLTYPE GetStringLength(void) = 0; |
| 294 |
}; |
| 295 |
CROSS_PLATFORM_UUIDOF(IDxcBlobUtf8, "3DA636C9-BA71-4024-A301-30CBF125305B") |
| 296 |
struct IDxcBlobUtf8 : public IDxcBlobEncoding { |
| 297 |
public: |
| 298 |
virtual LPCSTR STDMETHODCALLTYPE GetStringPointer(void) = 0; |
| 299 |
virtual SIZE_T STDMETHODCALLTYPE GetStringLength(void) = 0; |
| 300 |
}; |
| 301 |
|
| 302 |
CROSS_PLATFORM_UUIDOF(IDxcIncludeHandler, "7f61fc7d-950d-467f-b3e3-3c02fb49187c") |
| 303 |
struct IDxcIncludeHandler : public IUnknown { |
| 304 |
virtual HRESULT STDMETHODCALLTYPE LoadSource( |
| 305 |
_In_z_ LPCWSTR pFilename, // Candidate filename. |
| 306 |
_COM_Outptr_result_maybenull_ IDxcBlob **ppIncludeSource // Resultant source object for included file, nullptr if not found. |
| 307 |
) = 0; |
| 308 |
}; |
| 309 |
|
| 310 |
// Structure for supplying bytes or text input to Dxc APIs. |
| 311 |
// Use Encoding = 0 for non-text bytes, ANSI text, or unknown with BOM. |
| 312 |
typedef struct DxcBuffer { |
| 313 |
LPCVOID Ptr; |
| 314 |
SIZE_T Size; |
| 315 |
UINT Encoding; |
| 316 |
} DxcText; |
| 317 |
|
| 318 |
struct DxcDefine { |
| 319 |
LPCWSTR Name; |
| 320 |
_Maybenull_ LPCWSTR Value; |
| 321 |
}; |
| 322 |
|
| 323 |
CROSS_PLATFORM_UUIDOF(IDxcCompilerArgs, "73EFFE2A-70DC-45F8-9690-EFF64C02429D") |
| 324 |
struct IDxcCompilerArgs : public IUnknown { |
| 325 |
// Pass GetArguments() and GetCount() to Compile |
| 326 |
virtual LPCWSTR* STDMETHODCALLTYPE GetArguments() = 0; |
| 327 |
virtual UINT32 STDMETHODCALLTYPE GetCount() = 0; |
| 328 |
|
| 329 |
// Add additional arguments or defines here, if desired. |
| 330 |
virtual HRESULT STDMETHODCALLTYPE AddArguments( |
| 331 |
_In_opt_count_(argCount) LPCWSTR *pArguments, // Array of pointers to arguments to add |
| 332 |
_In_ UINT32 argCount // Number of arguments to add |
| 333 |
) = 0; |
| 334 |
virtual HRESULT STDMETHODCALLTYPE AddArgumentsUTF8( |
| 335 |
_In_opt_count_(argCount)LPCSTR *pArguments, // Array of pointers to UTF-8 arguments to add |
| 336 |
_In_ UINT32 argCount // Number of arguments to add |
| 337 |
) = 0; |
| 338 |
virtual HRESULT STDMETHODCALLTYPE AddDefines( |
| 339 |
_In_count_(defineCount) const DxcDefine *pDefines, // Array of defines |
| 340 |
_In_ UINT32 defineCount // Number of defines |
| 341 |
) = 0; |
| 342 |
}; |
| 343 |
|
| 344 |
////////////////////////// |
| 345 |
// Legacy Interfaces |
| 346 |
///////////////////////// |
| 347 |
|
| 348 |
// NOTE: IDxcUtils replaces IDxcLibrary |
| 349 |
CROSS_PLATFORM_UUIDOF(IDxcLibrary, "e5204dc7-d18c-4c3c-bdfb-851673980fe7") |
| 350 |
struct IDxcLibrary : public IUnknown { |
| 351 |
virtual HRESULT STDMETHODCALLTYPE SetMalloc(_In_opt_ IMalloc *pMalloc) = 0; |
| 352 |
virtual HRESULT STDMETHODCALLTYPE CreateBlobFromBlob( |
| 353 |
_In_ IDxcBlob *pBlob, UINT32 offset, UINT32 length, _COM_Outptr_ IDxcBlob **ppResult) = 0; |
| 354 |
virtual HRESULT STDMETHODCALLTYPE CreateBlobFromFile( |
| 355 |
_In_z_ LPCWSTR pFileName, _In_opt_ UINT32* codePage, |
| 356 |
_COM_Outptr_ IDxcBlobEncoding **pBlobEncoding) = 0; |
| 357 |
virtual HRESULT STDMETHODCALLTYPE CreateBlobWithEncodingFromPinned( |
| 358 |
_In_bytecount_(size) LPCVOID pText, UINT32 size, UINT32 codePage, |
| 359 |
_COM_Outptr_ IDxcBlobEncoding **pBlobEncoding) = 0; |
| 360 |
virtual HRESULT STDMETHODCALLTYPE CreateBlobWithEncodingOnHeapCopy( |
| 361 |
_In_bytecount_(size) LPCVOID pText, UINT32 size, UINT32 codePage, |
| 362 |
_COM_Outptr_ IDxcBlobEncoding **pBlobEncoding) = 0; |
| 363 |
virtual HRESULT STDMETHODCALLTYPE CreateBlobWithEncodingOnMalloc( |
| 364 |
_In_bytecount_(size) LPCVOID pText, IMalloc *pIMalloc, UINT32 size, UINT32 codePage, |
| 365 |
_COM_Outptr_ IDxcBlobEncoding **pBlobEncoding) = 0; |
| 366 |
virtual HRESULT STDMETHODCALLTYPE CreateIncludeHandler( |
| 367 |
_COM_Outptr_ IDxcIncludeHandler **ppResult) = 0; |
| 368 |
virtual HRESULT STDMETHODCALLTYPE CreateStreamFromBlobReadOnly( |
| 369 |
_In_ IDxcBlob *pBlob, _COM_Outptr_ IStream **ppStream) = 0; |
| 370 |
virtual HRESULT STDMETHODCALLTYPE GetBlobAsUtf8( |
| 371 |
_In_ IDxcBlob *pBlob, _COM_Outptr_ IDxcBlobEncoding **pBlobEncoding) = 0; |
| 372 |
virtual HRESULT STDMETHODCALLTYPE GetBlobAsUtf16( |
| 373 |
_In_ IDxcBlob *pBlob, _COM_Outptr_ IDxcBlobEncoding **pBlobEncoding) = 0; |
| 374 |
}; |
| 375 |
|
| 376 |
// NOTE: IDxcResult replaces IDxcOperationResult |
| 377 |
CROSS_PLATFORM_UUIDOF(IDxcOperationResult, "CEDB484A-D4E9-445A-B991-CA21CA157DC2") |
| 378 |
struct IDxcOperationResult : public IUnknown { |
| 379 |
virtual HRESULT STDMETHODCALLTYPE GetStatus(_Out_ HRESULT *pStatus) = 0; |
| 380 |
|
| 381 |
// GetResult returns the main result of the operation. |
| 382 |
// This corresponds to: |
| 383 |
// DXC_OUT_OBJECT - Compile() with shader or library target |
| 384 |
// DXC_OUT_DISASSEMBLY - Disassemble() |
| 385 |
// DXC_OUT_HLSL - Compile() with -P |
| 386 |
// DXC_OUT_ROOT_SIGNATURE - Compile() with rootsig_* target |
| 387 |
virtual HRESULT STDMETHODCALLTYPE GetResult(_COM_Outptr_result_maybenull_ IDxcBlob **ppResult) = 0; |
| 388 |
|
| 389 |
// GetErrorBuffer Corresponds to DXC_OUT_ERRORS. |
| 390 |
virtual HRESULT STDMETHODCALLTYPE GetErrorBuffer(_COM_Outptr_result_maybenull_ IDxcBlobEncoding **ppErrors) = 0; |
| 391 |
}; |
| 392 |
|
| 393 |
// NOTE: IDxcCompiler3 replaces IDxcCompiler and IDxcCompiler2 |
| 394 |
CROSS_PLATFORM_UUIDOF(IDxcCompiler, "8c210bf3-011f-4422-8d70-6f9acb8db617") |
| 395 |
struct IDxcCompiler : public IUnknown { |
| 396 |
// Compile a single entry point to the target shader model |
| 397 |
virtual HRESULT STDMETHODCALLTYPE Compile( |
| 398 |
_In_ IDxcBlob *pSource, // Source text to compile |
| 399 |
_In_opt_z_ LPCWSTR pSourceName, // Optional file name for pSource. Used in errors and include handlers. |
| 400 |
_In_opt_z_ LPCWSTR pEntryPoint, // entry point name |
| 401 |
_In_z_ LPCWSTR pTargetProfile, // shader profile to compile |
| 402 |
_In_opt_count_(argCount) LPCWSTR *pArguments, // Array of pointers to arguments |
| 403 |
_In_ UINT32 argCount, // Number of arguments |
| 404 |
_In_count_(defineCount) |
| 405 |
const DxcDefine *pDefines, // Array of defines |
| 406 |
_In_ UINT32 defineCount, // Number of defines |
| 407 |
_In_opt_ IDxcIncludeHandler *pIncludeHandler, // user-provided interface to handle #include directives (optional) |
| 408 |
_COM_Outptr_ IDxcOperationResult **ppResult // Compiler output status, buffer, and errors |
| 409 |
) = 0; |
| 410 |
|
| 411 |
// Preprocess source text |
| 412 |
virtual HRESULT STDMETHODCALLTYPE Preprocess( |
| 413 |
_In_ IDxcBlob *pSource, // Source text to preprocess |
| 414 |
_In_opt_z_ LPCWSTR pSourceName, // Optional file name for pSource. Used in errors and include handlers. |
| 415 |
_In_opt_count_(argCount) LPCWSTR *pArguments, // Array of pointers to arguments |
| 416 |
_In_ UINT32 argCount, // Number of arguments |
| 417 |
_In_count_(defineCount) |
| 418 |
const DxcDefine *pDefines, // Array of defines |
| 419 |
_In_ UINT32 defineCount, // Number of defines |
| 420 |
_In_opt_ IDxcIncludeHandler *pIncludeHandler, // user-provided interface to handle #include directives (optional) |
| 421 |
_COM_Outptr_ IDxcOperationResult **ppResult // Preprocessor output status, buffer, and errors |
| 422 |
) = 0; |
| 423 |
|
| 424 |
// Disassemble a program. |
| 425 |
virtual HRESULT STDMETHODCALLTYPE Disassemble( |
| 426 |
_In_ IDxcBlob *pSource, // Program to disassemble. |
| 427 |
_COM_Outptr_ IDxcBlobEncoding **ppDisassembly // Disassembly text. |
| 428 |
) = 0; |
| 429 |
}; |
| 430 |
|
| 431 |
// NOTE: IDxcCompiler3 replaces IDxcCompiler and IDxcCompiler2 |
| 432 |
CROSS_PLATFORM_UUIDOF(IDxcCompiler2, "A005A9D9-B8BB-4594-B5C9-0E633BEC4D37") |
| 433 |
struct IDxcCompiler2 : public IDxcCompiler { |
| 434 |
// Compile a single entry point to the target shader model with debug information. |
| 435 |
virtual HRESULT STDMETHODCALLTYPE CompileWithDebug( |
| 436 |
_In_ IDxcBlob *pSource, // Source text to compile |
| 437 |
_In_opt_z_ LPCWSTR pSourceName, // Optional file name for pSource. Used in errors and include handlers. |
| 438 |
_In_opt_z_ LPCWSTR pEntryPoint, // Entry point name |
| 439 |
_In_z_ LPCWSTR pTargetProfile, // Shader profile to compile |
| 440 |
_In_opt_count_(argCount) LPCWSTR *pArguments, // Array of pointers to arguments |
| 441 |
_In_ UINT32 argCount, // Number of arguments |
| 442 |
_In_count_(defineCount) |
| 443 |
const DxcDefine *pDefines, // Array of defines |
| 444 |
_In_ UINT32 defineCount, // Number of defines |
| 445 |
_In_opt_ IDxcIncludeHandler *pIncludeHandler, // user-provided interface to handle #include directives (optional) |
| 446 |
_COM_Outptr_ IDxcOperationResult **ppResult, // Compiler output status, buffer, and errors |
| 447 |
_Outptr_opt_result_z_ LPWSTR *ppDebugBlobName,// Suggested file name for debug blob. (Must be HeapFree()'d!) |
| 448 |
_COM_Outptr_opt_ IDxcBlob **ppDebugBlob // Debug blob |
| 449 |
) = 0; |
| 450 |
}; |
| 451 |
|
| 452 |
CROSS_PLATFORM_UUIDOF(IDxcLinker, "F1B5BE2A-62DD-4327-A1C2-42AC1E1E78E6") |
| 453 |
struct IDxcLinker : public IUnknown { |
| 454 |
public: |
| 455 |
// Register a library with name to ref it later. |
| 456 |
virtual HRESULT RegisterLibrary( |
| 457 |
_In_opt_ LPCWSTR pLibName, // Name of the library. |
| 458 |
_In_ IDxcBlob *pLib // Library blob. |
| 459 |
) = 0; |
| 460 |
|
| 461 |
// Links the shader and produces a shader blob that the Direct3D runtime can |
| 462 |
// use. |
| 463 |
virtual HRESULT STDMETHODCALLTYPE Link( |
| 464 |
_In_opt_ LPCWSTR pEntryName, // Entry point name |
| 465 |
_In_ LPCWSTR pTargetProfile, // shader profile to link |
| 466 |
_In_count_(libCount) |
| 467 |
const LPCWSTR *pLibNames, // Array of library names to link |
| 468 |
_In_ UINT32 libCount, // Number of libraries to link |
| 469 |
_In_opt_count_(argCount) const LPCWSTR *pArguments, // Array of pointers to arguments |
| 470 |
_In_ UINT32 argCount, // Number of arguments |
| 471 |
_COM_Outptr_ |
| 472 |
IDxcOperationResult **ppResult // Linker output status, buffer, and errors |
| 473 |
) = 0; |
| 474 |
}; |
| 475 |
|
| 476 |
///////////////////////// |
| 477 |
// Latest interfaces. Please use these |
| 478 |
//////////////////////// |
| 479 |
|
| 480 |
// NOTE: IDxcUtils replaces IDxcLibrary |
| 481 |
CROSS_PLATFORM_UUIDOF(IDxcUtils, "4605C4CB-2019-492A-ADA4-65F20BB7D67F") |
| 482 |
struct IDxcUtils : public IUnknown { |
| 483 |
// Create a sub-blob that holds a reference to the outer blob and points to its memory. |
| 484 |
virtual HRESULT STDMETHODCALLTYPE CreateBlobFromBlob( |
| 485 |
_In_ IDxcBlob *pBlob, UINT32 offset, UINT32 length, _COM_Outptr_ IDxcBlob **ppResult) = 0; |
| 486 |
|
| 487 |
// For codePage, use 0 (or DXC_CP_ACP) for raw binary or ANSI code page |
| 488 |
|
| 489 |
// Creates a blob referencing existing memory, with no copy. |
| 490 |
// User must manage the memory lifetime separately. |
| 491 |
// (was: CreateBlobWithEncodingFromPinned) |
| 492 |
virtual HRESULT STDMETHODCALLTYPE CreateBlobFromPinned( |
| 493 |
_In_bytecount_(size) LPCVOID pData, UINT32 size, UINT32 codePage, |
| 494 |
_COM_Outptr_ IDxcBlobEncoding **pBlobEncoding) = 0; |
| 495 |
|
| 496 |
// Create blob, taking ownership of memory allocated with supplied allocator. |
| 497 |
// (was: CreateBlobWithEncodingOnMalloc) |
| 498 |
virtual HRESULT STDMETHODCALLTYPE MoveToBlob( |
| 499 |
_In_bytecount_(size) LPCVOID pData, IMalloc *pIMalloc, UINT32 size, UINT32 codePage, |
| 500 |
_COM_Outptr_ IDxcBlobEncoding **pBlobEncoding) = 0; |
| 501 |
|
| 502 |
//// |
| 503 |
// New blobs and copied contents are allocated with the current allocator |
| 504 |
|
| 505 |
// Copy blob contents to memory owned by the new blob. |
| 506 |
// (was: CreateBlobWithEncodingOnHeapCopy) |
| 507 |
virtual HRESULT STDMETHODCALLTYPE CreateBlob( |
| 508 |
_In_bytecount_(size) LPCVOID pData, UINT32 size, UINT32 codePage, |
| 509 |
_COM_Outptr_ IDxcBlobEncoding **pBlobEncoding) = 0; |
| 510 |
|
| 511 |
// (was: CreateBlobFromFile) |
| 512 |
virtual HRESULT STDMETHODCALLTYPE LoadFile( |
| 513 |
_In_z_ LPCWSTR pFileName, _In_opt_ UINT32* pCodePage, |
| 514 |
_COM_Outptr_ IDxcBlobEncoding **pBlobEncoding) = 0; |
| 515 |
|
| 516 |
virtual HRESULT STDMETHODCALLTYPE CreateReadOnlyStreamFromBlob( |
| 517 |
_In_ IDxcBlob *pBlob, _COM_Outptr_ IStream **ppStream) = 0; |
| 518 |
|
| 519 |
// Create default file-based include handler |
| 520 |
virtual HRESULT STDMETHODCALLTYPE CreateDefaultIncludeHandler( |
| 521 |
_COM_Outptr_ IDxcIncludeHandler **ppResult) = 0; |
| 522 |
|
| 523 |
// Convert or return matching encoded text blobs |
| 524 |
virtual HRESULT STDMETHODCALLTYPE GetBlobAsUtf8( |
| 525 |
_In_ IDxcBlob *pBlob, _COM_Outptr_ IDxcBlobUtf8 **pBlobEncoding) = 0; |
| 526 |
virtual HRESULT STDMETHODCALLTYPE GetBlobAsUtf16( |
| 527 |
_In_ IDxcBlob *pBlob, _COM_Outptr_ IDxcBlobUtf16 **pBlobEncoding) = 0; |
| 528 |
|
| 529 |
virtual HRESULT STDMETHODCALLTYPE GetDxilContainerPart( |
| 530 |
_In_ const DxcBuffer *pShader, |
| 531 |
_In_ UINT32 DxcPart, |
| 532 |
_Outptr_result_nullonfailure_ void **ppPartData, |
| 533 |
_Out_ UINT32 *pPartSizeInBytes) = 0; |
| 534 |
|
| 535 |
// Create reflection interface from serialized Dxil container, or DXC_PART_REFLECTION_DATA. |
| 536 |
// TBD: Require part header for RDAT? (leaning towards yes) |
| 537 |
virtual HRESULT STDMETHODCALLTYPE CreateReflection( |
| 538 |
_In_ const DxcBuffer *pData, REFIID iid, void **ppvReflection) = 0; |
| 539 |
|
| 540 |
virtual HRESULT STDMETHODCALLTYPE BuildArguments( |
| 541 |
_In_opt_z_ LPCWSTR pSourceName, // Optional file name for pSource. Used in errors and include handlers. |
| 542 |
_In_opt_z_ LPCWSTR pEntryPoint, // Entry point name. (-E) |
| 543 |
_In_z_ LPCWSTR pTargetProfile, // Shader profile to compile. (-T) |
| 544 |
_In_opt_count_(argCount) LPCWSTR *pArguments, // Array of pointers to arguments |
| 545 |
_In_ UINT32 argCount, // Number of arguments |
| 546 |
_In_count_(defineCount) |
| 547 |
const DxcDefine *pDefines, // Array of defines |
| 548 |
_In_ UINT32 defineCount, // Number of defines |
| 549 |
_COM_Outptr_ IDxcCompilerArgs **ppArgs // Arguments you can use with Compile() method |
| 550 |
) = 0; |
| 551 |
|
| 552 |
// Takes the shader PDB and returns the hash and the container inside it |
| 553 |
virtual HRESULT STDMETHODCALLTYPE GetPDBContents( |
| 554 |
_In_ IDxcBlob *pPDBBlob, _COM_Outptr_ IDxcBlob **ppHash, _COM_Outptr_ IDxcBlob **ppContainer) = 0; |
| 555 |
}; |
| 556 |
|
| 557 |
// For use with IDxcResult::[Has|Get]Output dxcOutKind argument |
| 558 |
// Note: text outputs returned from version 2 APIs are UTF-8 or UTF-16 based on -encoding option |
| 559 |
typedef enum DXC_OUT_KIND { |
| 560 |
DXC_OUT_NONE = 0, |
| 561 |
DXC_OUT_OBJECT = 1, // IDxcBlob - Shader or library object |
| 562 |
DXC_OUT_ERRORS = 2, // IDxcBlobUtf8 or IDxcBlobUtf16 |
| 563 |
DXC_OUT_PDB = 3, // IDxcBlob |
| 564 |
DXC_OUT_SHADER_HASH = 4, // IDxcBlob - DxcShaderHash of shader or shader with source info (-Zsb/-Zss) |
| 565 |
DXC_OUT_DISASSEMBLY = 5, // IDxcBlobUtf8 or IDxcBlobUtf16 - from Disassemble |
| 566 |
DXC_OUT_HLSL = 6, // IDxcBlobUtf8 or IDxcBlobUtf16 - from Preprocessor or Rewriter |
| 567 |
DXC_OUT_TEXT = 7, // IDxcBlobUtf8 or IDxcBlobUtf16 - other text, such as -ast-dump or -Odump |
| 568 |
DXC_OUT_REFLECTION = 8, // IDxcBlob - RDAT part with reflection data |
| 569 |
DXC_OUT_ROOT_SIGNATURE = 9, // IDxcBlob - Serialized root signature output |
| 570 |
DXC_OUT_EXTRA_OUTPUTS = 10,// IDxcExtraResults - Extra outputs |
| 571 |
|
| 572 |
DXC_OUT_FORCE_DWORD = 0xFFFFFFFF |
| 573 |
} DXC_OUT_KIND; |
| 574 |
|
| 575 |
CROSS_PLATFORM_UUIDOF(IDxcResult, "58346CDA-DDE7-4497-9461-6F87AF5E0659") |
| 576 |
struct IDxcResult : public IDxcOperationResult { |
| 577 |
virtual BOOL STDMETHODCALLTYPE HasOutput(_In_ DXC_OUT_KIND dxcOutKind) = 0; |
| 578 |
virtual HRESULT STDMETHODCALLTYPE GetOutput(_In_ DXC_OUT_KIND dxcOutKind, |
| 579 |
_In_ REFIID iid, _COM_Outptr_opt_result_maybenull_ void **ppvObject, |
| 580 |
_COM_Outptr_ IDxcBlobUtf16 **ppOutputName) = 0; |
| 581 |
|
| 582 |
virtual UINT32 GetNumOutputs() = 0; |
| 583 |
virtual DXC_OUT_KIND GetOutputByIndex(UINT32 Index) = 0; |
| 584 |
virtual DXC_OUT_KIND PrimaryOutput() = 0; |
| 585 |
}; |
| 586 |
|
| 587 |
// Special names for extra output that should get written to specific streams |
| 588 |
#define DXC_EXTRA_OUTPUT_NAME_STDOUT L"*stdout*" |
| 589 |
#define DXC_EXTRA_OUTPUT_NAME_STDERR L"*stderr*" |
| 590 |
|
| 591 |
CROSS_PLATFORM_UUIDOF(IDxcExtraOutputs, "319b37a2-a5c2-494a-a5de-4801b2faf989") |
| 592 |
struct IDxcExtraOutputs : public IUnknown { |
| 593 |
|
| 594 |
virtual UINT32 STDMETHODCALLTYPE GetOutputCount() = 0; |
| 595 |
virtual HRESULT STDMETHODCALLTYPE GetOutput(_In_ UINT32 uIndex, |
| 596 |
_In_ REFIID iid, _COM_Outptr_opt_result_maybenull_ void **ppvObject, |
| 597 |
_COM_Outptr_opt_result_maybenull_ IDxcBlobUtf16 **ppOutputType, |
| 598 |
_COM_Outptr_opt_result_maybenull_ IDxcBlobUtf16 **ppOutputName) = 0; |
| 599 |
}; |
| 600 |
|
| 601 |
CROSS_PLATFORM_UUIDOF(IDxcCompiler3, "228B4687-5A6A-4730-900C-9702B2203F54") |
| 602 |
struct IDxcCompiler3 : public IUnknown { |
| 603 |
// Compile a single entry point to the target shader model, |
| 604 |
// Compile a library to a library target (-T lib_*), |
| 605 |
// Compile a root signature (-T rootsig_*), or |
| 606 |
// Preprocess HLSL source (-P) |
| 607 |
virtual HRESULT STDMETHODCALLTYPE Compile( |
| 608 |
_In_ const DxcBuffer *pSource, // Source text to compile |
| 609 |
_In_opt_count_(argCount) LPCWSTR *pArguments, // Array of pointers to arguments |
| 610 |
_In_ UINT32 argCount, // Number of arguments |
| 611 |
_In_opt_ IDxcIncludeHandler *pIncludeHandler, // user-provided interface to handle #include directives (optional) |
| 612 |
_In_ REFIID riid, _Out_ LPVOID *ppResult // IDxcResult: status, buffer, and errors |
| 613 |
) = 0; |
| 614 |
|
| 615 |
// Disassemble a program. |
| 616 |
virtual HRESULT STDMETHODCALLTYPE Disassemble( |
| 617 |
_In_ const DxcBuffer *pObject, // Program to disassemble: dxil container or bitcode. |
| 618 |
_In_ REFIID riid, _Out_ LPVOID *ppResult // IDxcResult: status, disassembly text, and errors |
| 619 |
) = 0; |
| 620 |
}; |
| 621 |
|
| 622 |
static const UINT32 DxcValidatorFlags_Default = 0; |
| 623 |
static const UINT32 DxcValidatorFlags_InPlaceEdit = 1; // Validator is allowed to update shader blob in-place. |
| 624 |
static const UINT32 DxcValidatorFlags_RootSignatureOnly = 2; |
| 625 |
static const UINT32 DxcValidatorFlags_ModuleOnly = 4; |
| 626 |
static const UINT32 DxcValidatorFlags_ValidMask = 0x7; |
| 627 |
|
| 628 |
CROSS_PLATFORM_UUIDOF(IDxcValidator, "A6E82BD2-1FD7-4826-9811-2857E797F49A") |
| 629 |
struct IDxcValidator : public IUnknown { |
| 630 |
// Validate a shader. |
| 631 |
virtual HRESULT STDMETHODCALLTYPE Validate( |
| 632 |
_In_ IDxcBlob *pShader, // Shader to validate. |
| 633 |
_In_ UINT32 Flags, // Validation flags. |
| 634 |
_COM_Outptr_ IDxcOperationResult **ppResult // Validation output status, buffer, and errors |
| 635 |
) = 0; |
| 636 |
}; |
| 637 |
|
| 638 |
CROSS_PLATFORM_UUIDOF(IDxcContainerBuilder, "334b1f50-2292-4b35-99a1-25588d8c17fe") |
| 639 |
struct IDxcContainerBuilder : public IUnknown { |
| 640 |
virtual HRESULT STDMETHODCALLTYPE Load(_In_ IDxcBlob *pDxilContainerHeader) = 0; // Loads DxilContainer to the builder |
| 641 |
virtual HRESULT STDMETHODCALLTYPE AddPart(_In_ UINT32 fourCC, _In_ IDxcBlob *pSource) = 0; // Part to add to the container |
| 642 |
virtual HRESULT STDMETHODCALLTYPE RemovePart(_In_ UINT32 fourCC) = 0; // Remove the part with fourCC |
| 643 |
virtual HRESULT STDMETHODCALLTYPE SerializeContainer(_Out_ IDxcOperationResult **ppResult) = 0; // Builds a container of the given container builder state |
| 644 |
}; |
| 645 |
|
| 646 |
CROSS_PLATFORM_UUIDOF(IDxcAssembler, "091f7a26-1c1f-4948-904b-e6e3a8a771d5") |
| 647 |
struct IDxcAssembler : public IUnknown { |
| 648 |
// Assemble dxil in ll or llvm bitcode to DXIL container. |
| 649 |
virtual HRESULT STDMETHODCALLTYPE AssembleToContainer( |
| 650 |
_In_ IDxcBlob *pShader, // Shader to assemble. |
| 651 |
_COM_Outptr_ IDxcOperationResult **ppResult // Assembly output status, buffer, and errors |
| 652 |
) = 0; |
| 653 |
}; |
| 654 |
|
| 655 |
CROSS_PLATFORM_UUIDOF(IDxcContainerReflection, "d2c21b26-8350-4bdc-976a-331ce6f4c54c") |
| 656 |
struct IDxcContainerReflection : public IUnknown { |
| 657 |
virtual HRESULT STDMETHODCALLTYPE Load(_In_ IDxcBlob *pContainer) = 0; // Container to load. |
| 658 |
virtual HRESULT STDMETHODCALLTYPE GetPartCount(_Out_ UINT32 *pResult) = 0; |
| 659 |
virtual HRESULT STDMETHODCALLTYPE GetPartKind(UINT32 idx, _Out_ UINT32 *pResult) = 0; |
| 660 |
virtual HRESULT STDMETHODCALLTYPE GetPartContent(UINT32 idx, _COM_Outptr_ IDxcBlob **ppResult) = 0; |
| 661 |
virtual HRESULT STDMETHODCALLTYPE FindFirstPartKind(UINT32 kind, _Out_ UINT32 *pResult) = 0; |
| 662 |
virtual HRESULT STDMETHODCALLTYPE GetPartReflection(UINT32 idx, REFIID iid, void **ppvObject) = 0; |
| 663 |
}; |
| 664 |
|
| 665 |
CROSS_PLATFORM_UUIDOF(IDxcOptimizerPass, "AE2CD79F-CC22-453F-9B6B-B124E7A5204C") |
| 666 |
struct IDxcOptimizerPass : public IUnknown { |
| 667 |
virtual HRESULT STDMETHODCALLTYPE GetOptionName(_COM_Outptr_ LPWSTR *ppResult) = 0; |
| 668 |
virtual HRESULT STDMETHODCALLTYPE GetDescription(_COM_Outptr_ LPWSTR *ppResult) = 0; |
| 669 |
virtual HRESULT STDMETHODCALLTYPE GetOptionArgCount(_Out_ UINT32 *pCount) = 0; |
| 670 |
virtual HRESULT STDMETHODCALLTYPE GetOptionArgName(UINT32 argIndex, _COM_Outptr_ LPWSTR *ppResult) = 0; |
| 671 |
virtual HRESULT STDMETHODCALLTYPE GetOptionArgDescription(UINT32 argIndex, _COM_Outptr_ LPWSTR *ppResult) = 0; |
| 672 |
}; |
| 673 |
|
| 674 |
CROSS_PLATFORM_UUIDOF(IDxcOptimizer, "25740E2E-9CBA-401B-9119-4FB42F39F270") |
| 675 |
struct IDxcOptimizer : public IUnknown { |
| 676 |
virtual HRESULT STDMETHODCALLTYPE GetAvailablePassCount(_Out_ UINT32 *pCount) = 0; |
| 677 |
virtual HRESULT STDMETHODCALLTYPE GetAvailablePass(UINT32 index, _COM_Outptr_ IDxcOptimizerPass** ppResult) = 0; |
| 678 |
virtual HRESULT STDMETHODCALLTYPE RunOptimizer(IDxcBlob *pBlob, |
| 679 |
_In_count_(optionCount) LPCWSTR *ppOptions, UINT32 optionCount, |
| 680 |
_COM_Outptr_ IDxcBlob **pOutputModule, |
| 681 |
_COM_Outptr_opt_ IDxcBlobEncoding **ppOutputText) = 0; |
| 682 |
}; |
| 683 |
|
| 684 |
static const UINT32 DxcVersionInfoFlags_None = 0; |
| 685 |
static const UINT32 DxcVersionInfoFlags_Debug = 1; // Matches VS_FF_DEBUG |
| 686 |
static const UINT32 DxcVersionInfoFlags_Internal = 2; // Internal Validator (non-signing) |
| 687 |
|
| 688 |
CROSS_PLATFORM_UUIDOF(IDxcVersionInfo, "b04f5b50-2059-4f12-a8ff-a1e0cde1cc7e") |
| 689 |
struct IDxcVersionInfo : public IUnknown { |
| 690 |
virtual HRESULT STDMETHODCALLTYPE GetVersion(_Out_ UINT32 *pMajor, _Out_ UINT32 *pMinor) = 0; |
| 691 |
virtual HRESULT STDMETHODCALLTYPE GetFlags(_Out_ UINT32 *pFlags) = 0; |
| 692 |
}; |
| 693 |
|
| 694 |
CROSS_PLATFORM_UUIDOF(IDxcVersionInfo2, "fb6904c4-42f0-4b62-9c46-983af7da7c83") |
| 695 |
struct IDxcVersionInfo2 : public IDxcVersionInfo { |
| 696 |
virtual HRESULT STDMETHODCALLTYPE GetCommitInfo(_Out_ UINT32 *pCommitCount, _Out_ char **pCommitHash) = 0; |
| 697 |
}; |
| 698 |
|
| 699 |
// Note: __declspec(selectany) requires 'extern' |
| 700 |
// On Linux __declspec(selectany) is removed and using 'extern' results in link error. |
| 701 |
#ifdef _MSC_VER |
| 702 |
#define CLSID_SCOPE __declspec(selectany) extern |
| 703 |
#else |
| 704 |
#define CLSID_SCOPE |
| 705 |
#endif |
| 706 |
|
| 707 |
CLSID_SCOPE const CLSID CLSID_DxcCompiler = { |
| 708 |
0x73e22d93, |
| 709 |
0xe6ce, |
| 710 |
0x47f3, |
| 711 |
{0xb5, 0xbf, 0xf0, 0x66, 0x4f, 0x39, 0xc1, 0xb0}}; |
| 712 |
|
| 713 |
// {EF6A8087-B0EA-4D56-9E45-D07E1A8B7806} |
| 714 |
CLSID_SCOPE const GUID CLSID_DxcLinker = { |
| 715 |
0xef6a8087, |
| 716 |
0xb0ea, |
| 717 |
0x4d56, |
| 718 |
{0x9e, 0x45, 0xd0, 0x7e, 0x1a, 0x8b, 0x78, 0x6}}; |
| 719 |
|
| 720 |
// {CD1F6B73-2AB0-484D-8EDC-EBE7A43CA09F} |
| 721 |
CLSID_SCOPE const CLSID CLSID_DxcDiaDataSource = { |
| 722 |
0xcd1f6b73, |
| 723 |
0x2ab0, |
| 724 |
0x484d, |
| 725 |
{0x8e, 0xdc, 0xeb, 0xe7, 0xa4, 0x3c, 0xa0, 0x9f}}; |
| 726 |
|
| 727 |
// {3E56AE82-224D-470F-A1A1-FE3016EE9F9D} |
| 728 |
CLSID_SCOPE const CLSID CLSID_DxcCompilerArgs = { |
| 729 |
0x3e56ae82, |
| 730 |
0x224d, |
| 731 |
0x470f, |
| 732 |
{0xa1, 0xa1, 0xfe, 0x30, 0x16, 0xee, 0x9f, 0x9d}}; |
| 733 |
|
| 734 |
// {6245D6AF-66E0-48FD-80B4-4D271796748C} |
| 735 |
CLSID_SCOPE const GUID CLSID_DxcLibrary = { |
| 736 |
0x6245d6af, |
| 737 |
0x66e0, |
| 738 |
0x48fd, |
| 739 |
{0x80, 0xb4, 0x4d, 0x27, 0x17, 0x96, 0x74, 0x8c}}; |
| 740 |
|
| 741 |
CLSID_SCOPE const GUID CLSID_DxcUtils = CLSID_DxcLibrary; |
| 742 |
|
| 743 |
// {8CA3E215-F728-4CF3-8CDD-88AF917587A1} |
| 744 |
CLSID_SCOPE const GUID CLSID_DxcValidator = { |
| 745 |
0x8ca3e215, |
| 746 |
0xf728, |
| 747 |
0x4cf3, |
| 748 |
{0x8c, 0xdd, 0x88, 0xaf, 0x91, 0x75, 0x87, 0xa1}}; |
| 749 |
|
| 750 |
// {D728DB68-F903-4F80-94CD-DCCF76EC7151} |
| 751 |
CLSID_SCOPE const GUID CLSID_DxcAssembler = { |
| 752 |
0xd728db68, |
| 753 |
0xf903, |
| 754 |
0x4f80, |
| 755 |
{0x94, 0xcd, 0xdc, 0xcf, 0x76, 0xec, 0x71, 0x51}}; |
| 756 |
|
| 757 |
// {b9f54489-55b8-400c-ba3a-1675e4728b91} |
| 758 |
CLSID_SCOPE const GUID CLSID_DxcContainerReflection = { |
| 759 |
0xb9f54489, |
| 760 |
0x55b8, |
| 761 |
0x400c, |
| 762 |
{0xba, 0x3a, 0x16, 0x75, 0xe4, 0x72, 0x8b, 0x91}}; |
| 763 |
|
| 764 |
// {AE2CD79F-CC22-453F-9B6B-B124E7A5204C} |
| 765 |
CLSID_SCOPE const GUID CLSID_DxcOptimizer = { |
| 766 |
0xae2cd79f, |
| 767 |
0xcc22, |
| 768 |
0x453f, |
| 769 |
{0x9b, 0x6b, 0xb1, 0x24, 0xe7, 0xa5, 0x20, 0x4c}}; |
| 770 |
|
| 771 |
// {94134294-411f-4574-b4d0-8741e25240d2} |
| 772 |
CLSID_SCOPE const GUID CLSID_DxcContainerBuilder = { |
| 773 |
0x94134294, |
| 774 |
0x411f, |
| 775 |
0x4574, |
| 776 |
{0xb4, 0xd0, 0x87, 0x41, 0xe2, 0x52, 0x40, 0xd2}}; |
| 777 |
#endif |