From ac6c505442760bc9488c02237910ba3c8f878593 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 9 Aug 2024 20:30:08 +0200 Subject: [PATCH 01/15] dxc/WinAdapter.h now extends DirectX-Headers/WSL's winAdapter.h, to avoid conflicts and allow the latest DirectX-Headers to be used rather than a 2 year outdated one. Unified lots of types; all fixed int types now align properly between windows and unix (more importantly; between the two winadapters). Removed duplicate defines and type definitions. Replaced CROSS_PLATFORM_UUIDOF with __CRT_UUID_DECL so that it can use the uuid macro from wsl. Fixed type incompatiblity of a LPBOOL which really refered to a bool* (BOOL is 32-bit according to WSL). --- CMakeLists.txt | 11 +- external/DirectX-Headers | 2 +- include/dxc/WinAdapter.h | 234 +++++++++------------------------- include/dxc/dxcapi.h | 85 +++++++----- include/dxc/dxcapi.internal.h | 31 ++--- include/dxc/dxcisense.h | 50 +++++--- include/dxc/dxctools.h | 6 +- lib/DxcSupport/Unicode.cpp | 4 +- 8 files changed, 176 insertions(+), 247 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f7db99784..87c76abdf6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -671,6 +671,12 @@ if(LLVM_INCLUDE_TESTS AND WIN32) add_definitions(/DMSFT_SUPPORTS_CHILD_PROCESSES) endif() +if(EXISTS "${LLVM_MAIN_SRC_DIR}/external") + add_subdirectory(external) # SPIRV change +endif() +include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/wsl/stubs ${DIRECTX_HEADER_INCLUDE_DIR}/wsl ${DIRECTX_HEADER_INCLUDE_DIR}/directx) + + # Put this before tblgen. Else we have a circular dependence. add_subdirectory(lib/Support) add_subdirectory(lib/MSSupport) # HLSL Change @@ -686,11 +692,6 @@ add_subdirectory(include/dxc) # really depend on anything else in the build it is safe. list(APPEND LLVM_COMMON_DEPENDS HCTGen) -if(EXISTS "${LLVM_MAIN_SRC_DIR}/external") - add_subdirectory(external) # SPIRV change -endif() -include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/directx ${DIRECTX_HEADER_INCLUDE_DIR}/wsl/stubs) - # HLSL - Change End add_subdirectory(lib) diff --git a/external/DirectX-Headers b/external/DirectX-Headers index 980971e835..8cd1ddf8ed 160000 --- a/external/DirectX-Headers +++ b/external/DirectX-Headers @@ -1 +1 @@ -Subproject commit 980971e835876dc0cde415e8f9bc646e64667bf7 +Subproject commit 8cd1ddf8edecc3410df223104f936f6a3badf3e6 diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index b8c6646871..918d99b0ff 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -33,6 +33,8 @@ #include #endif // __cplusplus +#include "winadapter.h" //To avoid duplicates, somethings are defined by WSL, some by dxc + #define COM_NO_WINDOWS_H // needed to inform d3d headers that this isn't windows //===----------------------------------------------------------------------===// @@ -40,7 +42,6 @@ // Begin: Macro Definitions // //===----------------------------------------------------------------------===// -#define C_ASSERT(expr) static_assert((expr), "") #define ATLASSERT assert #define CoTaskMemAlloc malloc @@ -48,8 +49,6 @@ #define ARRAYSIZE(array) (sizeof(array) / sizeof(array[0])) -#define _countof(a) (sizeof(a) / sizeof(*(a))) - // If it is GCC, there is no UUID support and we must emulate it. #ifndef __clang__ #define __EMULATE_UUID 1 @@ -68,11 +67,6 @@ #define STDMETHODCALLTYPE #define STDMETHODIMP_(type) type STDMETHODCALLTYPE #define STDMETHODIMP STDMETHODIMP_(HRESULT) -#define STDMETHOD_(type, name) virtual STDMETHODIMP_(type) name -#define STDMETHOD(name) STDMETHOD_(HRESULT, name) -#define EXTERN_C extern "C" - -#define UNREFERENCED_PARAMETER(P) (void)(P) #define RtlEqualMemory(Destination, Source, Length) \ (!memcmp((Destination), (Source), (Length))) @@ -88,9 +82,6 @@ #define FillMemory RtlFillMemory #define ZeroMemory RtlZeroMemory -#define FALSE 0 -#define TRUE 1 - // We ignore the code page completely on Linux. #define GetConsoleOutputCP() 0 @@ -216,24 +207,9 @@ //===--------------------- HRESULT Related Macros -------------------------===// -#define S_OK ((HRESULT)0L) -#define S_FALSE ((HRESULT)1L) - -#define E_ABORT (HRESULT)0x80004004 -#define E_ACCESSDENIED (HRESULT)0x80070005 #define E_BOUNDS (HRESULT)0x8000000B -#define E_FAIL (HRESULT)0x80004005 -#define E_HANDLE (HRESULT)0x80070006 -#define E_INVALIDARG (HRESULT)0x80070057 -#define E_NOINTERFACE (HRESULT)0x80004002 -#define E_NOTIMPL (HRESULT)0x80004001 #define E_NOT_VALID_STATE (HRESULT)0x8007139F -#define E_OUTOFMEMORY (HRESULT)0x8007000E -#define E_POINTER (HRESULT)0x80004003 -#define E_UNEXPECTED (HRESULT)0x8000FFFF -#define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0) -#define FAILED(hr) (((HRESULT)(hr)) < 0) #define DXC_FAILED(hr) (((HRESULT)(hr)) < 0) #define HRESULT_FROM_WIN32(x) \ @@ -245,16 +221,7 @@ // Begin: Disable SAL Annotations // //===----------------------------------------------------------------------===// -#define _In_ -#define _In_z_ -#define _In_opt_ -#define _In_opt_count_(size) -#define _In_opt_z_ -#define _In_count_(size) -#define _In_bytecount_(size) - -#define _Out_ -#define _Out_opt_ + #define _Outptr_ #define _Outptr_opt_ #define _Outptr_result_z_ @@ -264,15 +231,6 @@ #define _Outptr_result_buffer_maybenull_(ptr) #define _Outptr_result_buffer_(ptr) -#define _COM_Outptr_ -#define _COM_Outptr_opt_ -#define _COM_Outptr_result_maybenull_ -#define _COM_Outptr_opt_result_maybenull_ - -#define THIS_ -#define THIS -#define PURE = 0 - #define _Maybenull_ #define __debugbreak() @@ -296,53 +254,64 @@ #ifdef __cplusplus -typedef unsigned char BYTE, UINT8; -typedef unsigned char *LPBYTE; - -typedef BYTE BOOLEAN; +// Note: using fixed-width here to match Windows widths +// Specifically this is different for 'long' vs 'LONG' +typedef uint8_t UINT8; +typedef int8_t INT8; +typedef uint16_t UINT16; +typedef int16_t INT16; +typedef uint32_t UINT32, UINT, ULONG, DWORD, WINBOOL, BOOL; +typedef int32_t INT32, INT, LONG; +typedef uint64_t UINT64, ULONG_PTR; +typedef int64_t INT64, LONG_PTR; +typedef void VOID, *HANDLE, *RPC_IF_HANDLE, *LPVOID; +typedef const void *LPCVOID; +typedef size_t SIZE_T; +typedef float FLOAT; +typedef double DOUBLE; +typedef unsigned char BYTE; +typedef int HWND; +typedef int PALETTEENTRY; +typedef int HDC; +typedef uint16_t WORD; +typedef void *PVOID; +typedef char BOOLEAN; +typedef uint64_t ULONGLONG; +typedef uint16_t USHORT, *PUSHORT; +typedef int64_t LONGLONG, *PLONGLONG; +typedef int64_t LONG_PTR, *PLONG_PTR; +typedef int64_t LONG64, *PLONG64; +typedef uint64_t ULONG64, *PULONG64; +typedef wchar_t WCHAR, *PWSTR; +typedef uint8_t UCHAR, *PUCHAR; +typedef uint64_t ULONG_PTR, *PULONG_PTR; +typedef uint64_t UINT_PTR, *PUINT_PTR; +typedef int64_t INT_PTR, *PINT_PTR; + +// Note: WCHAR is not the same between Windows and Linux, to enable +// string manipulation APIs to work with resulting strings. +// APIs to D3D/DXCore will work on Linux wchars, but beware with +// interactions directly with the Windows kernel. +typedef char CHAR, *PSTR, *LPSTR, TCHAR, *PTSTR; +typedef const char *LPCSTR, *PCSTR, *LPCTSTR, *PCTSTR; +typedef wchar_t WCHAR, *PWSTR, *LPWSTR, *PWCHAR; +typedef const wchar_t *LPCWSTR, *PCWSTR; + +typedef BYTE *LPBYTE; typedef BOOLEAN *PBOOLEAN; -typedef bool BOOL; typedef BOOL *LPBOOL; -typedef int INT; -typedef long LONG; -typedef unsigned int UINT; -typedef unsigned long ULONG; -typedef long long LONGLONG; -typedef long long LONG_PTR; -typedef unsigned long long ULONG_PTR; -typedef unsigned long long ULONGLONG; - -typedef uint16_t WORD; -typedef uint32_t DWORD; typedef DWORD *LPDWORD; -typedef uint32_t UINT32; -typedef uint64_t UINT64; - -typedef signed char INT8, *PINT8; -typedef signed int INT32, *PINT32; - -typedef size_t SIZE_T; -typedef const char *LPCSTR; -typedef const char *PCSTR; +typedef INT8 *PINT8; +typedef INT32 *PINT32; typedef int errno_t; -typedef wchar_t WCHAR; -typedef wchar_t *LPWSTR; -typedef wchar_t *PWCHAR; -typedef const wchar_t *LPCWSTR; -typedef const wchar_t *PCWSTR; - typedef WCHAR OLECHAR; typedef OLECHAR *BSTR; typedef OLECHAR *LPOLESTR; -typedef char *LPSTR; - -typedef void *LPVOID; -typedef const void *LPCVOID; typedef std::nullptr_t nullptr_t; @@ -368,45 +337,11 @@ typedef void *HMODULE; //===--------------------- ID Types and Macros for COM --------------------===// -#ifdef __EMULATE_UUID -struct GUID -#else // __EMULATE_UUID -// These specific definitions are required by clang -fms-extensions. -typedef struct _GUID -#endif // __EMULATE_UUID -{ - uint32_t Data1; - uint16_t Data2; - uint16_t Data3; - uint8_t Data4[8]; -} -#ifdef __EMULATE_UUID -; -#else // __EMULATE_UUID -GUID; -#endif // __EMULATE_UUID -typedef GUID CLSID; typedef const GUID &REFGUID; typedef const GUID &REFCLSID; -typedef GUID IID; typedef IID *LPIID; typedef const IID &REFIID; -inline bool IsEqualGUID(REFGUID rguid1, REFGUID rguid2) { - // Optimization: - if (&rguid1 == &rguid2) - return true; - - return !memcmp(&rguid1, &rguid2, sizeof(GUID)); -} - -inline bool operator==(REFGUID guidOne, REFGUID guidOther) { - return !!IsEqualGUID(guidOne, guidOther); -} - -inline bool operator!=(REFGUID guidOne, REFGUID guidOther) { - return !(guidOne == guidOther); -} inline bool IsEqualIID(REFIID riid1, REFIID riid2) { return IsEqualGUID(riid1, riid2); @@ -450,26 +385,6 @@ typedef struct _WIN32_FIND_DATAW { WCHAR cAlternateFileName[14]; } WIN32_FIND_DATAW, *PWIN32_FIND_DATAW, *LPWIN32_FIND_DATAW; -typedef union _LARGE_INTEGER { - struct { - DWORD LowPart; - DWORD HighPart; - } u; - LONGLONG QuadPart; -} LARGE_INTEGER; - -typedef LARGE_INTEGER *PLARGE_INTEGER; - -typedef union _ULARGE_INTEGER { - struct { - DWORD LowPart; - DWORD HighPart; - } u; - ULONGLONG QuadPart; -} ULARGE_INTEGER; - -typedef ULARGE_INTEGER *PULARGE_INTEGER; - typedef struct tagSTATSTG { LPOLESTR pwcsName; DWORD type; @@ -539,11 +454,6 @@ template inline GUID __emulated_uuidof(); return _IID; \ } -#define __uuidof(T) __emulated_uuidof::type>() - -#define IID_PPV_ARGS(ppType) \ - __uuidof(decltype(**(ppType))), reinterpret_cast(ppType) - #else // __EMULATE_UUID #ifndef CROSS_PLATFORM_UUIDOF @@ -552,38 +462,16 @@ template inline GUID __emulated_uuidof(); struct __declspec(uuid(spec)) interface; #endif -template inline void **IID_PPV_ARGS_Helper(T **pp) { - return reinterpret_cast(pp); -} -#define IID_PPV_ARGS(ppType) __uuidof(**(ppType)), IID_PPV_ARGS_Helper(ppType) - #endif // __EMULATE_UUID -// Needed for d3d headers, but fail to create actual interfaces -#define DEFINE_GUID(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ - const GUID name = {l, w1, w2, {b1, b2, b3, b4, b5, b6, b7, b8}} -#define DECLSPEC_UUID(x) -#define MIDL_INTERFACE(x) struct DECLSPEC_UUID(x) -#define DECLARE_INTERFACE(iface) struct iface -#define DECLARE_INTERFACE_(iface, parent) DECLARE_INTERFACE(iface) : parent - //===--------------------- COM Interfaces ---------------------------------===// -CROSS_PLATFORM_UUIDOF(IUnknown, "00000000-0000-0000-C000-000000000046") -struct IUnknown { - IUnknown(){}; - virtual HRESULT QueryInterface(REFIID riid, void **ppvObject) = 0; - virtual ULONG AddRef() = 0; - virtual ULONG Release() = 0; - template HRESULT QueryInterface(Q **pp) { - return QueryInterface(__uuidof(Q), (void **)pp); - } -}; - -CROSS_PLATFORM_UUIDOF(INoMarshal, "ECC8691B-C1DB-4DC0-855E-65F6C551AF49") +struct INoMarshal; +__CRT_UUID_DECL(INoMarshal, 0xECC8691B, 0xC1DB, 0x4DC0, 0x85, 0x5E, 0x65, 0xF6, 0xC5, 0x51, 0xAF, 0x49) struct INoMarshal : public IUnknown {}; -CROSS_PLATFORM_UUIDOF(IMalloc, "00000002-0000-0000-C000-000000000046") +struct IMalloc; +__CRT_UUID_DECL(IMalloc, 0x00000002, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46) struct IMalloc : public IUnknown { virtual void *Alloc(SIZE_T size) = 0; virtual void *Realloc(void *ptr, SIZE_T size) = 0; @@ -593,13 +481,15 @@ struct IMalloc : public IUnknown { virtual void HeapMinimize(void) = 0; }; -CROSS_PLATFORM_UUIDOF(ISequentialStream, "0C733A30-2A1C-11CE-ADE5-00AA0044773D") +struct ISequentialStream; +__CRT_UUID_DECL(ISequentialStream, 0x0C733A30, 0x2A1C, 0x11CE, 0xAD, 0xE5, 0x00, 0xAA, 0x00, 0x44, 0x77, 0x3D) struct ISequentialStream : public IUnknown { virtual HRESULT Read(void *pv, ULONG cb, ULONG *pcbRead) = 0; virtual HRESULT Write(const void *pv, ULONG cb, ULONG *pcbWritten) = 0; }; -CROSS_PLATFORM_UUIDOF(IStream, "0000000c-0000-0000-C000-000000000046") +struct IStream; +__CRT_UUID_DECL(IStream, 0x0000000c, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46) struct IStream : public ISequentialStream { virtual HRESULT Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) = 0; @@ -625,10 +515,12 @@ struct IStream : public ISequentialStream { // These don't need stub implementations as they come from the DirectX Headers // They still need the __uuidof() though -CROSS_PLATFORM_UUIDOF(ID3D12LibraryReflection, - "8E349D19-54DB-4A56-9DC9-119D87BDB804") -CROSS_PLATFORM_UUIDOF(ID3D12ShaderReflection, - "5A58797D-A72C-478D-8BA2-EFC6B0EFE88E") + +struct ID3D12LibraryReflection; +struct ID3D12ShaderReflection; + +__CRT_UUID_DECL(ID3D12LibraryReflection, 0x8E349D19, 0x54DB, 0x4A56, 0x9D, 0xC9, 0x11, 0x9D, 0x87, 0xBD, 0xB8, 0x04) +__CRT_UUID_DECL(ID3D12ShaderReflection, 0x5A58797D, 0xA72C, 0x478D, 0x8B, 0xA2, 0xEF, 0xC6, 0xB0, 0xEF, 0xE8, 0x8E) //===--------------------- COM Pointer Types ------------------------------===// diff --git a/include/dxc/dxcapi.h b/include/dxc/dxcapi.h index 95cc56a049..ae1bd6df46 100644 --- a/include/dxc/dxcapi.h +++ b/include/dxc/dxcapi.h @@ -144,7 +144,8 @@ typedef struct DxcShaderHash { #define DXC_ARG_DEBUG_NAME_FOR_SOURCE L"-Zss" #define DXC_ARG_DEBUG_NAME_FOR_BINARY L"-Zsb" -CROSS_PLATFORM_UUIDOF(IDxcBlob, "8BA5FB08-5195-40e2-AC58-0D989C3A0102") +struct IDxcBlob; +__CRT_UUID_DECL(IDxcBlob, 0x8BA5FB08, 0x5195, 0x40e2, 0xAC, 0x58, 0x0D, 0x98, 0x9C, 0x3A, 0x01, 0x02) /// \brief A sized buffer that can be passed in and out of DXC APIs. /// /// This is an alias of ID3D10Blob and ID3DBlob. @@ -157,7 +158,8 @@ struct IDxcBlob : public IUnknown { virtual SIZE_T STDMETHODCALLTYPE GetBufferSize(void) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcBlobEncoding, "7241d424-2646-4191-97c0-98e96e42fc68") +struct IDxcBlobEncoding; +__CRT_UUID_DECL(IDxcBlobEncoding, 0x7241d424, 0x2646, 0x4191, 0x97, 0xc0, 0x98, 0xe9, 0x6e, 0x42, 0xfc, 0x68) /// \brief A blob that might have a known encoding. struct IDxcBlobEncoding : public IDxcBlob { public: @@ -174,7 +176,8 @@ struct IDxcBlobEncoding : public IDxcBlob { _Out_ UINT32 *pCodePage) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcBlobWide, "A3F84EAB-0FAA-497E-A39C-EE6ED60B2D84") +struct IDxcBlobWide; +__CRT_UUID_DECL(IDxcBlobWide, 0xA3F84EAB, 0x0FAA, 0x497E, 0xA3, 0x9C, 0xEE, 0x6E, 0xD6, 0x0B, 0x2D, 0x84) /// \brief A blob containing a null-terminated wide string. /// /// This uses the native wide character encoding (utf16 on Windows, utf32 on @@ -197,7 +200,8 @@ struct IDxcBlobWide : public IDxcBlobEncoding { virtual SIZE_T STDMETHODCALLTYPE GetStringLength(void) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcBlobUtf8, "3DA636C9-BA71-4024-A301-30CBF125305B") +struct IDxcBlobUtf8; +__CRT_UUID_DECL(IDxcBlobUtf8, 0x3DA636C9, 0xBA71, 0x4024, 0xA3, 0x01, 0x30, 0xCB, 0xF1, 0x25, 0x30, 0x5B) /// \brief A blob containing a UTF-8 encoded string. /// /// The value returned by GetBufferSize() is the size of the buffer, in bytes, @@ -221,8 +225,8 @@ struct IDxcBlobUtf8 : public IDxcBlobEncoding { typedef IDxcBlobWide IDxcBlobUtf16; #endif -CROSS_PLATFORM_UUIDOF(IDxcIncludeHandler, - "7f61fc7d-950d-467f-b3e3-3c02fb49187c") +struct IDxcIncludeHandler; +__CRT_UUID_DECL(IDxcIncludeHandler, 0x7f61fc7d, 0x950d, 0x467f, 0xb3, 0xe3, 0x3c, 0x02, 0xfb, 0x49, 0x18, 0x7c) /// \brief Interface for handling include directives. /// /// This interface can be implemented to customize handling of include @@ -263,7 +267,8 @@ struct DxcDefine { _Maybenull_ LPCWSTR Value; ///< Optional value for the define. }; -CROSS_PLATFORM_UUIDOF(IDxcCompilerArgs, "73EFFE2A-70DC-45F8-9690-EFF64C02429D") +struct IDxcCompilerArgs; +__CRT_UUID_DECL(IDxcCompilerArgs, 0x73EFFE2A, 0x70DC, 0x45F8, 0x96, 0x90, 0xEF, 0xF6, 0x4C, 0x02, 0x42, 0x9D) /// \brief Interface for managing arguments passed to DXC. /// /// Use IDxcUtils::BuildArguments to create an instance of this interface. @@ -306,7 +311,8 @@ struct IDxcCompilerArgs : public IUnknown { // Legacy Interfaces ///////////////////////// -CROSS_PLATFORM_UUIDOF(IDxcLibrary, "e5204dc7-d18c-4c3c-bdfb-851673980fe7") +struct IDxcLibrary; +__CRT_UUID_DECL(IDxcLibrary, 0xe5204dc7, 0xd18c, 0x4c3c, 0xbd, 0xfb, 0x85, 0x16, 0x73, 0x98, 0x0f, 0xe7) /// \deprecated IDxcUtils replaces IDxcLibrary; please use IDxcUtils insted. struct IDxcLibrary : public IUnknown { /// \deprecated @@ -364,8 +370,8 @@ struct IDxcLibrary : public IUnknown { #endif }; -CROSS_PLATFORM_UUIDOF(IDxcOperationResult, - "CEDB484A-D4E9-445A-B991-CA21CA157DC2") +struct IDxcOperationResult; +__CRT_UUID_DECL(IDxcOperationResult, 0xCEDB484A, 0xD4E9, 0x445A, 0xB9, 0x91, 0xCA, 0x21, 0xCA, 0x15, 0x7D, 0xC2) /// \brief The results of a DXC operation. /// /// Note: IDxcResult replaces IDxcOperationResult and should be used wherever @@ -391,7 +397,8 @@ struct IDxcOperationResult : public IUnknown { GetErrorBuffer(_COM_Outptr_result_maybenull_ IDxcBlobEncoding **ppErrors) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcCompiler, "8c210bf3-011f-4422-8d70-6f9acb8db617") +struct IDxcCompiler; +__CRT_UUID_DECL(IDxcCompiler, 0x8c210bf3, 0x011f, 0x4422, 0x8d, 0x70, 0x6f, 0x9a, 0xcb, 0x8d, 0xb6, 0x17) /// \deprecated Please use IDxcCompiler3 instead. struct IDxcCompiler : public IUnknown { /// \brief Compile a single entry point to the target shader model. @@ -444,7 +451,8 @@ struct IDxcCompiler : public IUnknown { ) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcCompiler2, "A005A9D9-B8BB-4594-B5C9-0E633BEC4D37") +struct IDxcCompiler2; +__CRT_UUID_DECL(IDxcCompiler2, 0xA005A9D9, 0xB8BB, 0x4594, 0xB5, 0xC9, 0x0E, 0x63, 0x3B, 0xEC, 0x4D, 0x37) /// \deprecated Please use IDxcCompiler3 instead. struct IDxcCompiler2 : public IDxcCompiler { /// \brief Compile a single entry point to the target shader model with debug @@ -474,7 +482,8 @@ struct IDxcCompiler2 : public IDxcCompiler { ) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcLinker, "F1B5BE2A-62DD-4327-A1C2-42AC1E1E78E6") +struct IDxcLinker; +__CRT_UUID_DECL(IDxcLinker, 0xF1B5BE2A, 0x62DD, 0x4327, 0xA1, 0xC2, 0x42, 0xAC, 0x1E, 0x1E, 0x78, 0xE6) /// \brief DXC linker interface. /// /// Use DxcCreateInstance with CLSID_DxcLinker to obtain an instance of this @@ -507,7 +516,8 @@ struct IDxcLinker : public IUnknown { // Latest interfaces. Please use these. //////////////////////// -CROSS_PLATFORM_UUIDOF(IDxcUtils, "4605C4CB-2019-492A-ADA4-65F20BB7D67F") +struct IDxcUtils; +__CRT_UUID_DECL(IDxcUtils, 0x4605C4CB, 0x2019, 0x492A, 0xAD, 0xA4, 0x65, 0xF2, 0x0B, 0xB7, 0xD6, 0x7F) /// \brief Various utility functions for DXC. /// /// Use DxcCreateInstance with CLSID_DxcUtils to obtain an instance of this @@ -752,7 +762,8 @@ typedef enum DXC_OUT_KIND { static_assert(DXC_OUT_NUM_ENUMS == DXC_OUT_LAST + 1, "DXC_OUT_* Enum added and last value not updated."); -CROSS_PLATFORM_UUIDOF(IDxcResult, "58346CDA-DDE7-4497-9461-6F87AF5E0659") +struct IDxcResult; +__CRT_UUID_DECL(IDxcResult, 0x58346CDA, 0xDDE7, 0x4497, 0x94, 0x61, 0x6F, 0x87, 0xAF, 0x5E, 0x06, 0x59) /// \brief Result of a DXC operation. /// /// DXC operations may have multiple outputs, such as a shader object and @@ -796,7 +807,8 @@ struct IDxcResult : public IDxcOperationResult { #define DXC_EXTRA_OUTPUT_NAME_STDOUT L"*stdout*" #define DXC_EXTRA_OUTPUT_NAME_STDERR L"*stderr*" -CROSS_PLATFORM_UUIDOF(IDxcExtraOutputs, "319b37a2-a5c2-494a-a5de-4801b2faf989") +struct IDxcExtraOutputs; +__CRT_UUID_DECL(IDxcExtraOutputs, 0x319b37a2, 0xa5c2, 0x494a, 0xa5, 0xde, 0x48, 0x01, 0xb2, 0xfa, 0xf9, 0x89) /// \brief Additional outputs from a DXC operation. /// /// This can be used to obtain outputs that don't have an explicit DXC_OUT_KIND. @@ -826,7 +838,8 @@ struct IDxcExtraOutputs : public IUnknown { _COM_Outptr_opt_result_maybenull_ IDxcBlobWide **ppOutputName) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcCompiler3, "228B4687-5A6A-4730-900C-9702B2203F54") +struct IDxcCompiler3; +__CRT_UUID_DECL(IDxcCompiler3, 0x228B4687, 0x5A6A, 0x4730, 0x90, 0x0C, 0x97, 0x02, 0xB2, 0x20, 0x3F, 0x54) /// \brief Interface to the DirectX Shader Compiler. /// /// Use DxcCreateInstance with CLSID_DxcCompiler to obtain an instance of this @@ -872,7 +885,8 @@ static const UINT32 DxcValidatorFlags_RootSignatureOnly = 2; static const UINT32 DxcValidatorFlags_ModuleOnly = 4; static const UINT32 DxcValidatorFlags_ValidMask = 0x7; -CROSS_PLATFORM_UUIDOF(IDxcValidator, "A6E82BD2-1FD7-4826-9811-2857E797F49A") +struct IDxcValidator; +__CRT_UUID_DECL(IDxcValidator, 0xA6E82BD2, 0x1FD7, 0x4826, 0x98, 0x11, 0x28, 0x57, 0xE7, 0x97, 0xF4, 0x9A) /// \brief Interface to DXC shader validator. /// /// Use DxcCreateInstance with CLSID_DxcValidator to obtain an instance of this. @@ -886,7 +900,8 @@ struct IDxcValidator : public IUnknown { ) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcValidator2, "458e1fd1-b1b2-4750-a6e1-9c10f03bed92") +struct IDxcValidator2; +__CRT_UUID_DECL(IDxcValidator2, 0x458e1fd1, 0xb1b2, 0x4750, 0xa6, 0xe1, 0x9c, 0x10, 0xf0, 0x3b, 0xed, 0x92) /// \brief Interface to DXC shader validator. /// /// Use DxcCreateInstance with CLSID_DxcValidator to obtain an instance of this. @@ -902,8 +917,8 @@ struct IDxcValidator2 : public IDxcValidator { ) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcContainerBuilder, - "334b1f50-2292-4b35-99a1-25588d8c17fe") +struct IDxcContainerBuilder; +__CRT_UUID_DECL(IDxcContainerBuilder, 0x334b1f50, 0x2292, 0x4b35, 0x99, 0xa1, 0x25, 0x58, 0x8d, 0x8c, 0x17, 0xfe) /// \brief Interface to DXC container builder. /// /// Use DxcCreateInstance with CLSID_DxcContainerBuilder to obtain an instance @@ -936,7 +951,8 @@ struct IDxcContainerBuilder : public IUnknown { SerializeContainer(_Out_ IDxcOperationResult **ppResult) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcAssembler, "091f7a26-1c1f-4948-904b-e6e3a8a771d5") +struct IDxcAssembler; +__CRT_UUID_DECL(IDxcAssembler, 0x091f7a26, 0x1c1f, 0x4948, 0x90, 0x4b, 0xe6, 0xe3, 0xa8, 0xa7, 0x71, 0xd5) /// \brief Interface to DxcAssembler. /// /// Use DxcCreateInstance with CLSID_DxcAssembler to obtain an instance of this. @@ -949,8 +965,8 @@ struct IDxcAssembler : public IUnknown { ) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcContainerReflection, - "d2c21b26-8350-4bdc-976a-331ce6f4c54c") +struct IDxcContainerReflection; +__CRT_UUID_DECL(IDxcContainerReflection, 0xd2c21b26, 0x8350, 0x4bdc, 0x97, 0x6a, 0x33, 0x1c, 0xe6, 0xf4, 0xc5, 0x4c) /// \brief Interface to DxcContainerReflection. /// /// Use DxcCreateInstance with CLSID_DxcContainerReflection to obtain an @@ -1024,7 +1040,8 @@ struct IDxcContainerReflection : public IUnknown { void **ppvObject) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcOptimizerPass, "AE2CD79F-CC22-453F-9B6B-B124E7A5204C") +struct IDxcOptimizerPass; +__CRT_UUID_DECL(IDxcOptimizerPass, 0xAE2CD79F, 0xCC22, 0x453F, 0x9B, 0x6B, 0xB1, 0x24, 0xE7, 0xA5, 0x20, 0x4C) /// \brief An optimizer pass. /// /// Instances of this can be obtained via IDxcOptimizer::GetAvailablePass. @@ -1040,7 +1057,8 @@ struct IDxcOptimizerPass : public IUnknown { GetOptionArgDescription(UINT32 argIndex, _COM_Outptr_ LPWSTR *ppResult) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcOptimizer, "25740E2E-9CBA-401B-9119-4FB42F39F270") +struct IDxcOptimizer; +__CRT_UUID_DECL(IDxcOptimizer, 0x25740E2E, 0x9CBA, 0x401B, 0x91, 0x19, 0x4F, 0xB4, 0x2F, 0x39, 0xF2, 0x70) /// \brief Interface to DxcOptimizer. /// /// Use DxcCreateInstance with CLSID_DxcOptimizer to obtain an instance of this. @@ -1060,7 +1078,8 @@ static const UINT32 DxcVersionInfoFlags_Debug = 1; // Matches VS_FF_DEBUG static const UINT32 DxcVersionInfoFlags_Internal = 2; // Internal Validator (non-signing) -CROSS_PLATFORM_UUIDOF(IDxcVersionInfo, "b04f5b50-2059-4f12-a8ff-a1e0cde1cc7e") +struct IDxcVersionInfo; +__CRT_UUID_DECL(IDxcVersionInfo, 0xb04f5b50, 0x2059, 0x4f12, 0xa8, 0xff, 0xa1, 0xe0, 0xcd, 0xe1, 0xcc, 0x7e) /// \brief PDB Version information. /// /// Use IDxcPdbUtils2::GetVersionInfo to obtain an instance of this. @@ -1070,7 +1089,8 @@ struct IDxcVersionInfo : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetFlags(_Out_ UINT32 *pFlags) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcVersionInfo2, "fb6904c4-42f0-4b62-9c46-983af7da7c83") +struct IDxcVersionInfo2; +__CRT_UUID_DECL(IDxcVersionInfo2, 0xfb6904c4, 0x42f0, 0x4b62, 0x9c, 0x46, 0x98, 0x3a, 0xf7, 0xda, 0x7c, 0x83) /// \brief PDB Version Information. /// /// Use IDxcPdbUtils2::GetVersionInfo to obtain a IDxcVersionInfo interface, and @@ -1083,7 +1103,8 @@ struct IDxcVersionInfo2 : public IDxcVersionInfo { ) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcVersionInfo3, "5e13e843-9d25-473c-9ad2-03b2d0b44b1e") +struct IDxcVersionInfo3; +__CRT_UUID_DECL(IDxcVersionInfo3, 0x5e13e843, 0x9d25, 0x473c, 0x9a, 0xd2, 0x03, 0xb2, 0xd0, 0xb4, 0x4b, 0x1e) /// \brief PDB Version Information. /// /// Use IDxcPdbUtils2::GetVersionInfo to obtain a IDxcVersionInfo interface, and @@ -1101,7 +1122,8 @@ struct DxcArgPair { const WCHAR *pValue; }; -CROSS_PLATFORM_UUIDOF(IDxcPdbUtils, "E6C9647E-9D6A-4C3B-B94C-524B5A6C343D") +struct IDxcPdbUtils; +__CRT_UUID_DECL(IDxcPdbUtils, 0xE6C9647E, 0x9D6A, 0x4C3B, 0xB9, 0x4C, 0x52, 0x4B, 0x5A, 0x6C, 0x34, 0x3D) /// \deprecated Please use IDxcPdbUtils2 instead. struct IDxcPdbUtils : public IUnknown { virtual HRESULT STDMETHODCALLTYPE Load(_In_ IDxcBlob *pPdbOrDxil) = 0; @@ -1158,7 +1180,8 @@ struct IDxcPdbUtils : public IUnknown { OverrideRootSignature(_In_ const WCHAR *pRootSignature) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcPdbUtils2, "4315D938-F369-4F93-95A2-252017CC3807") +struct IDxcPdbUtils2; +__CRT_UUID_DECL(IDxcPdbUtils2, 0x4315D938, 0xF369, 0x4F93, 0x95, 0xA2, 0x25, 0x20, 0x17, 0xCC, 0x38, 0x07) /// \brief DxcPdbUtils interface. /// /// Use DxcCreateInstance with CLSID_DxcPdbUtils to create an instance of this. diff --git a/include/dxc/dxcapi.internal.h b/include/dxc/dxcapi.internal.h index b0f9a467a4..986428f655 100644 --- a/include/dxc/dxcapi.internal.h +++ b/include/dxc/dxcapi.internal.h @@ -173,8 +173,8 @@ struct HLSL_INTRINSIC { /////////////////////////////////////////////////////////////////////////////// // Interfaces. -CROSS_PLATFORM_UUIDOF(IDxcIntrinsicTable, - "f0d4da3f-f863-4660-b8b4-dfd94ded6215") +struct IDxcIntrinsicTable; +__CRT_UUID_DECL(IDxcIntrinsicTable, 0xf0d4da3f, 0xf863, 0x4660, 0xb8, 0xb4, 0xdf, 0xd9, 0x4d, 0xed, 0x62, 0x15) struct IDxcIntrinsicTable : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE GetTableName(LPCSTR *pTableName) = 0; @@ -202,8 +202,8 @@ struct IDxcIntrinsicTable : public IUnknown { UINT *pDxilOpcode) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcSemanticDefineValidator, - "1d063e4f-515a-4d57-a12a-431f6a44cfb9") +struct IDxcSemanticDefineValidator; +__CRT_UUID_DECL(IDxcSemanticDefineValidator, 0x1d063e4f, 0x515a, 0x4d57, 0xa1, 0x2a, 0x43, 0x1f, 0x6a, 0x44, 0xcf, 0xb9) struct IDxcSemanticDefineValidator : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE GetSemanticDefineWarningsAndErrors( @@ -211,8 +211,8 @@ struct IDxcSemanticDefineValidator : public IUnknown { IDxcBlobEncoding **ppErrorBlob) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcLangExtensions, - "282a56b4-3f56-4360-98c7-9ea04a752272") +struct IDxcLangExtensions; +__CRT_UUID_DECL(IDxcLangExtensions, 0x282a56b4, 0x3f56, 0x4360, 0x98, 0xc7, 0x9e, 0xa0, 0x4a, 0x75, 0x22, 0x72) struct IDxcLangExtensions : public IUnknown { public: /// @@ -240,15 +240,15 @@ struct IDxcLangExtensions : public IUnknown { SetSemanticDefineMetaDataName(LPCSTR name) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcLangExtensions2, - "2490C368-89EE-4491-A4B2-C6547B6C9381") +struct IDxcLangExtensions2; +__CRT_UUID_DECL(IDxcLangExtensions2, 0x2490C368, 0x89EE, 0x4491, 0xA4, 0xB2, 0xC6, 0x54, 0x7B, 0x6C, 0x93, 0x81) struct IDxcLangExtensions2 : public IDxcLangExtensions { public: virtual HRESULT STDMETHODCALLTYPE SetTargetTriple(LPCSTR name) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcLangExtensions3, - "A1B19880-FB1F-4920-9BC5-50356483BAC1") +struct IDxcLangExtensions3; +__CRT_UUID_DECL(IDxcLangExtensions3, 0xA1B19880, 0xFB1F, 0x4920, 0x9B, 0xC5, 0x50, 0x35, 0x64, 0x83, 0xBA, 0xC1) struct IDxcLangExtensions3 : public IDxcLangExtensions2 { public: /// Registers a semantic define which cannot be overriden using the flag @@ -257,7 +257,8 @@ struct IDxcLangExtensions3 : public IDxcLangExtensions2 { RegisterNonOptSemanticDefine(LPCWSTR name) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcSystemAccess, "454b764f-3549-475b-958c-a7a6fcd05fbc") +struct IDxcSystemAccess; +__CRT_UUID_DECL(IDxcSystemAccess, 0x454b764f, 0x3549, 0x475b, 0x95, 0x8c, 0xa7, 0xa6, 0xfc, 0xd0, 0x5f, 0xbc) struct IDxcSystemAccess : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE EnumFiles(LPCWSTR fileName, @@ -313,16 +314,16 @@ struct IDxcSystemAccess : public IUnknown { unsigned *columnCount) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcContainerEventsHandler, - "e991ca8d-2045-413c-a8b8-788b2c06e14d") +struct IDxcContainerEventsHandler; +__CRT_UUID_DECL(IDxcContainerEventsHandler, 0xe991ca8d, 0x2045, 0x413c, 0xa8, 0xb8, 0x78, 0x8b, 0x2c, 0x06, 0xe1, 0x4d) struct IDxcContainerEventsHandler : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE OnDxilContainerBuilt(IDxcBlob *pSource, IDxcBlob **ppTarget) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcContainerEvent, - "0cfc5058-342b-4ff2-83f7-04c12aad3d01") +struct IDxcContainerEvent; +__CRT_UUID_DECL(IDxcContainerEvent, 0x0cfc5058, 0x342b, 0x4ff2, 0x83, 0xf7, 0x04, 0xc1, 0x2a, 0xad, 0x3d, 0x01) struct IDxcContainerEvent : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE RegisterDxilContainerEventHandler( diff --git a/include/dxc/dxcisense.h b/include/dxc/dxcisense.h index 661de1680a..6161146f7f 100644 --- a/include/dxc/dxcisense.h +++ b/include/dxc/dxcisense.h @@ -662,7 +662,8 @@ struct IDxcCodeCompleteResults; struct IDxcCompletionResult; struct IDxcCompletionString; -CROSS_PLATFORM_UUIDOF(IDxcCursor, "1467b985-288d-4d2a-80c1-ef89c42c40bc") +struct IDxcCursor; +__CRT_UUID_DECL(IDxcCursor, 0x1467b985, 0x288d, 0x4d2a, 0x80, 0xc1, 0xef, 0x89, 0xc4, 0x2c, 0x40, 0xbc) struct IDxcCursor : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetExtent(_Outptr_result_nullonfailure_ IDxcSourceRange **pRange) = 0; @@ -728,7 +729,8 @@ struct IDxcCursor : public IUnknown { _Outptr_result_maybenull_ IDxcCursor **pResult) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcDiagnostic, "4f76b234-3659-4d33-99b0-3b0db994b564") +struct IDxcDiagnostic; +__CRT_UUID_DECL(IDxcDiagnostic, 0x4f76b234, 0x3659, 0x4d33, 0x99, 0xb0, 0x3b, 0x0d, 0xb9, 0x94, 0xb5, 0x64) struct IDxcDiagnostic : public IUnknown { virtual HRESULT STDMETHODCALLTYPE FormatDiagnostic(DxcDiagnosticDisplayOptions options, @@ -752,7 +754,8 @@ struct IDxcDiagnostic : public IUnknown { _Outptr_result_maybenull_ LPSTR *pText) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcFile, "bb2fca9e-1478-47ba-b08c-2c502ada4895") +struct IDxcFile; +__CRT_UUID_DECL(IDxcFile, 0xbb2fca9e, 0x1478, 0x47ba, 0xb0, 0x8c, 0x2c, 0x50, 0x2a, 0xda, 0x48, 0x95) struct IDxcFile : public IUnknown { /// Gets the file name for this file. virtual HRESULT STDMETHODCALLTYPE @@ -763,7 +766,8 @@ struct IDxcFile : public IUnknown { _Out_ BOOL *pResult) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcInclusion, "0c364d65-df44-4412-888e-4e552fc5e3d6") +struct IDxcInclusion; +__CRT_UUID_DECL(IDxcInclusion, 0x0c364d65, 0xdf44, 0x4412, 0x88, 0x8e, 0x4e, 0x55, 0x2f, 0xc5, 0xe3, 0xd6) struct IDxcInclusion : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetIncludedFile(_Outptr_result_nullonfailure_ IDxcFile **pResult) = 0; @@ -773,7 +777,8 @@ struct IDxcInclusion : public IUnknown { _Outptr_result_nullonfailure_ IDxcSourceLocation **pResult) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcIntelliSense, "b1f99513-46d6-4112-8169-dd0d6053f17d") +struct IDxcIntelliSense; +__CRT_UUID_DECL(IDxcIntelliSense, 0xb1f99513, 0x46d6, 0x4112, 0x81, 0x69, 0xdd, 0x0d, 0x60, 0x53, 0xf1, 0x7d) struct IDxcIntelliSense : public IUnknown { virtual HRESULT STDMETHODCALLTYPE CreateIndex(_Outptr_result_nullonfailure_ IDxcIndex **index) = 0; @@ -793,7 +798,8 @@ struct IDxcIntelliSense : public IUnknown { _Outptr_result_nullonfailure_ IDxcUnsavedFile **pResult) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcIndex, "937824a0-7f5a-4815-9ba7-7fc0424f4173") +struct IDxcIndex; +__CRT_UUID_DECL(IDxcIndex, 0x937824a0, 0x7f5a, 0x4815, 0x9b, 0xa7, 0x7f, 0xc0, 0x42, 0x4f, 0x41, 0x73) struct IDxcIndex : public IUnknown { virtual HRESULT STDMETHODCALLTYPE SetGlobalOptions(DxcGlobalOptions options) = 0; @@ -808,8 +814,8 @@ struct IDxcIndex : public IUnknown { _Out_ IDxcTranslationUnit **pTranslationUnit) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcSourceLocation, - "8e7ddf1c-d7d3-4d69-b286-85fccba1e0cf") +struct IDxcSourceLocation; +__CRT_UUID_DECL(IDxcSourceLocation, 0x8e7ddf1c, 0xd7d3, 0x4d69, 0xb2, 0x86, 0x85, 0xfc, 0xcb, 0xa1, 0xe0, 0xcf) struct IDxcSourceLocation : public IUnknown { virtual HRESULT STDMETHODCALLTYPE IsEqualTo(_In_ IDxcSourceLocation *other, _Out_ BOOL *pResult) = 0; @@ -822,7 +828,8 @@ struct IDxcSourceLocation : public IUnknown { _Out_opt_ unsigned *pCol) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcSourceRange, "f1359b36-a53f-4e81-b514-b6b84122a13f") +struct IDxcSourceRange; +__CRT_UUID_DECL(IDxcSourceRange, 0xf1359b36, 0xa53f, 0x4e81, 0xb5, 0x14, 0xb6, 0xb8, 0x41, 0x22, 0xa1, 0x3f) struct IDxcSourceRange : public IUnknown { virtual HRESULT STDMETHODCALLTYPE IsNull(_Out_ BOOL *pValue) = 0; virtual HRESULT STDMETHODCALLTYPE @@ -833,7 +840,8 @@ struct IDxcSourceRange : public IUnknown { _Out_ unsigned *endOffset) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcToken, "7f90b9ff-a275-4932-97d8-3cfd234482a2") +struct IDxcToken; +__CRT_UUID_DECL(IDxcToken, 0x7f90b9ff, 0xa275, 0x4932, 0x97, 0xd8, 0x3c, 0xfd, 0x23, 0x44, 0x82, 0xa2) struct IDxcToken : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetKind(_Out_ DxcTokenKind *pValue) = 0; virtual HRESULT STDMETHODCALLTYPE @@ -843,8 +851,8 @@ struct IDxcToken : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetSpelling(_Out_ LPSTR *pValue) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcTranslationUnit, - "9677dee0-c0e5-46a1-8b40-3db3168be63d") +struct IDxcTranslationUnit; +__CRT_UUID_DECL(IDxcTranslationUnit, 0x9677dee0, 0xc0e5, 0x46a1, 0x8b, 0x40, 0x3d, 0xb3, 0x16, 0x8b, 0xe6, 0x3d) struct IDxcTranslationUnit : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetCursor(_Out_ IDxcCursor **pCursor) = 0; virtual HRESULT STDMETHODCALLTYPE @@ -892,7 +900,8 @@ struct IDxcTranslationUnit : public IUnknown { _Outptr_result_nullonfailure_ IDxcCodeCompleteResults **pResult) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcType, "2ec912fd-b144-4a15-ad0d-1c5439c81e46") +struct IDxcType; +__CRT_UUID_DECL(IDxcType, 0x2ec912fd, 0xb144, 0x4a15, 0xad, 0x0d, 0x1c, 0x54, 0x39, 0xc8, 0x1e, 0x46) struct IDxcType : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetSpelling(_Outptr_result_z_ LPSTR *pResult) = 0; @@ -901,7 +910,8 @@ struct IDxcType : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetKind(_Out_ DxcTypeKind *pResult) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcUnsavedFile, "8ec00f98-07d0-4e60-9d7c-5a50b5b0017f") +struct IDxcUnsavedFile; +__CRT_UUID_DECL(IDxcUnsavedFile, 0x8ec00f98, 0x07d0, 0x4e60, 0x9d, 0x7c, 0x5a, 0x50, 0xb5, 0xb0, 0x01, 0x7f) struct IDxcUnsavedFile : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetFileName(_Outptr_result_z_ LPSTR *pFileName) = 0; @@ -910,8 +920,8 @@ struct IDxcUnsavedFile : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetLength(_Out_ unsigned *pLength) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcCodeCompleteResults, - "1E06466A-FD8B-45F3-A78F-8A3F76EBB552") +struct IDxcCodeCompleteResults; +__CRT_UUID_DECL(IDxcCodeCompleteResults, 0x1E06466A, 0xFD8B, 0x45F3, 0xA7, 0x8F, 0x8A, 0x3F, 0x76, 0xEB, 0xB5, 0x52) struct IDxcCodeCompleteResults : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetNumResults(_Out_ unsigned *pResult) = 0; virtual HRESULT STDMETHODCALLTYPE @@ -919,8 +929,8 @@ struct IDxcCodeCompleteResults : public IUnknown { _Outptr_result_nullonfailure_ IDxcCompletionResult **pResult) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcCompletionResult, - "943C0588-22D0-4784-86FC-701F802AC2B6") +struct IDxcCompletionResult; +__CRT_UUID_DECL(IDxcCompletionResult, 0x943C0588, 0x22D0, 0x4784, 0x86, 0xFC, 0x70, 0x1F, 0x80, 0x2A, 0xC2, 0xB6) struct IDxcCompletionResult : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetCursorKind(_Out_ DxcCursorKind *pResult) = 0; @@ -928,8 +938,8 @@ struct IDxcCompletionResult : public IUnknown { _Outptr_result_nullonfailure_ IDxcCompletionString **pResult) = 0; }; -CROSS_PLATFORM_UUIDOF(IDxcCompletionString, - "06B51E0F-A605-4C69-A110-CD6E14B58EEC") +struct IDxcCompletionString; +__CRT_UUID_DECL(IDxcCompletionString, 0x06B51E0F, 0xA605, 0x4C69, 0xA1, 0x10, 0xCD, 0x6E, 0x14, 0xB5, 0x8E, 0xEC) struct IDxcCompletionString : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetNumCompletionChunks(_Out_ unsigned *pResult) = 0; diff --git a/include/dxc/dxctools.h b/include/dxc/dxctools.h index bfdc0d86f7..4a7cfaa92b 100644 --- a/include/dxc/dxctools.h +++ b/include/dxc/dxctools.h @@ -22,7 +22,8 @@ enum RewriterOptionMask { KeepUserMacro = 8, }; -CROSS_PLATFORM_UUIDOF(IDxcRewriter, "c012115b-8893-4eb9-9c5a-111456ea1c45") +struct IDxcRewriter; +__CRT_UUID_DECL(IDxcRewriter, 0xc012115b, 0x8893, 0x4eb9, 0x9c, 0x5a, 0x11, 0x14, 0x56, 0xea, 0x1c, 0x45) struct IDxcRewriter : public IUnknown { virtual HRESULT STDMETHODCALLTYPE RemoveUnusedGlobals( @@ -55,7 +56,8 @@ CLSID_SCOPE const CLSID 0x40b3, {0x96, 0x8d, 0x93, 0xe1, 0x24, 0x73, 0x4d, 0xa4}}; -CROSS_PLATFORM_UUIDOF(IDxcRewriter2, "261afca1-0609-4ec6-a77f-d98c7035194e") +struct IDxcRewriter2; +__CRT_UUID_DECL(IDxcRewriter2, 0x261afca1, 0x0609, 0x4ec6, 0xa7, 0x7f, 0xd9, 0x8c, 0x70, 0x35, 0x19, 0x4e) struct IDxcRewriter2 : public IDxcRewriter { virtual HRESULT STDMETHODCALLTYPE RewriteWithOptions( diff --git a/lib/DxcSupport/Unicode.cpp b/lib/DxcSupport/Unicode.cpp index 1481ae27ff..ad9cc4453e 100644 --- a/lib/DxcSupport/Unicode.cpp +++ b/lib/DxcSupport/Unicode.cpp @@ -133,8 +133,8 @@ namespace Unicode { bool WideToEncodedString(const wchar_t *text, size_t cWide, DWORD cp, DWORD flags, std::string *pValue, bool *lossy) { - BOOL usedDefaultChar; - LPBOOL pUsedDefaultChar = (lossy == nullptr) ? nullptr : &usedDefaultChar; + bool usedDefaultChar; + bool *pUsedDefaultChar = (lossy == nullptr) ? nullptr : &usedDefaultChar; if (lossy != nullptr) *lossy = false; From 903325e58db82439349cddd03a2ba1531c46a291 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 9 Aug 2024 21:56:39 +0200 Subject: [PATCH 02/15] Restored most headers to what they used to be by adding the same definition that DirectX-Headers uses to define GUIDs so that either implementation of __uuidof can find the GUID. --- include/dxc/WinAdapter.h | 32 ++++++++----- include/dxc/dxcapi.h | 85 +++++++++++++---------------------- include/dxc/dxcapi.internal.h | 33 +++++++------- include/dxc/dxcisense.h | 50 +++++++++------------ include/dxc/dxctools.h | 6 +-- lib/DxcSupport/Unicode.cpp | 4 +- 6 files changed, 93 insertions(+), 117 deletions(-) diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index 918d99b0ff..a851695f29 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -453,6 +453,20 @@ template inline GUID __emulated_uuidof(); static const IID _IID = guid_from_string(spec); \ return _IID; \ } + extern "C++" \ + { \ + template <> \ + inline const GUID &__wsl_stub_uuidof() \ + { \ + static const IID _IID = guid_from_string(spec); \ + return _IID; \ + } \ + template <> \ + inline const GUID &__wsl_stub_uuidof() \ + { \ + return __wsl_stub_uuidof(); \ + } \ + } #else // __EMULATE_UUID @@ -466,12 +480,10 @@ template inline GUID __emulated_uuidof(); //===--------------------- COM Interfaces ---------------------------------===// -struct INoMarshal; -__CRT_UUID_DECL(INoMarshal, 0xECC8691B, 0xC1DB, 0x4DC0, 0x85, 0x5E, 0x65, 0xF6, 0xC5, 0x51, 0xAF, 0x49) +CROSS_PLATFORM_UUIDOF(INoMarshal, "ECC8691B-C1DB-4DC0-855E-65F6C551AF49") struct INoMarshal : public IUnknown {}; -struct IMalloc; -__CRT_UUID_DECL(IMalloc, 0x00000002, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46) +CROSS_PLATFORM_UUIDOF(IMalloc, "00000002-0000-0000-C000-000000000046") struct IMalloc : public IUnknown { virtual void *Alloc(SIZE_T size) = 0; virtual void *Realloc(void *ptr, SIZE_T size) = 0; @@ -481,15 +493,13 @@ struct IMalloc : public IUnknown { virtual void HeapMinimize(void) = 0; }; -struct ISequentialStream; -__CRT_UUID_DECL(ISequentialStream, 0x0C733A30, 0x2A1C, 0x11CE, 0xAD, 0xE5, 0x00, 0xAA, 0x00, 0x44, 0x77, 0x3D) +CROSS_PLATFORM_UUIDOF(ISequentialStream, "0C733A30-2A1C-11CE-ADE5-00AA0044773D") struct ISequentialStream : public IUnknown { virtual HRESULT Read(void *pv, ULONG cb, ULONG *pcbRead) = 0; virtual HRESULT Write(const void *pv, ULONG cb, ULONG *pcbWritten) = 0; }; -struct IStream; -__CRT_UUID_DECL(IStream, 0x0000000c, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46) +CROSS_PLATFORM_UUIDOF(IStream, "0000000c-0000-0000-C000-000000000046") struct IStream : public ISequentialStream { virtual HRESULT Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition) = 0; @@ -519,8 +529,10 @@ struct IStream : public ISequentialStream { struct ID3D12LibraryReflection; struct ID3D12ShaderReflection; -__CRT_UUID_DECL(ID3D12LibraryReflection, 0x8E349D19, 0x54DB, 0x4A56, 0x9D, 0xC9, 0x11, 0x9D, 0x87, 0xBD, 0xB8, 0x04) -__CRT_UUID_DECL(ID3D12ShaderReflection, 0x5A58797D, 0xA72C, 0x478D, 0x8B, 0xA2, 0xEF, 0xC6, 0xB0, 0xEF, 0xE8, 0x8E) +CROSS_PLATFORM_UUIDOF(ID3D12LibraryReflection, + "8E349D19-54DB-4A56-9DC9-119D87BDB804") +CROSS_PLATFORM_UUIDOF(ID3D12ShaderReflection, + "5A58797D-A72C-478D-8BA2-EFC6B0EFE88E") //===--------------------- COM Pointer Types ------------------------------===// diff --git a/include/dxc/dxcapi.h b/include/dxc/dxcapi.h index ae1bd6df46..95cc56a049 100644 --- a/include/dxc/dxcapi.h +++ b/include/dxc/dxcapi.h @@ -144,8 +144,7 @@ typedef struct DxcShaderHash { #define DXC_ARG_DEBUG_NAME_FOR_SOURCE L"-Zss" #define DXC_ARG_DEBUG_NAME_FOR_BINARY L"-Zsb" -struct IDxcBlob; -__CRT_UUID_DECL(IDxcBlob, 0x8BA5FB08, 0x5195, 0x40e2, 0xAC, 0x58, 0x0D, 0x98, 0x9C, 0x3A, 0x01, 0x02) +CROSS_PLATFORM_UUIDOF(IDxcBlob, "8BA5FB08-5195-40e2-AC58-0D989C3A0102") /// \brief A sized buffer that can be passed in and out of DXC APIs. /// /// This is an alias of ID3D10Blob and ID3DBlob. @@ -158,8 +157,7 @@ struct IDxcBlob : public IUnknown { virtual SIZE_T STDMETHODCALLTYPE GetBufferSize(void) = 0; }; -struct IDxcBlobEncoding; -__CRT_UUID_DECL(IDxcBlobEncoding, 0x7241d424, 0x2646, 0x4191, 0x97, 0xc0, 0x98, 0xe9, 0x6e, 0x42, 0xfc, 0x68) +CROSS_PLATFORM_UUIDOF(IDxcBlobEncoding, "7241d424-2646-4191-97c0-98e96e42fc68") /// \brief A blob that might have a known encoding. struct IDxcBlobEncoding : public IDxcBlob { public: @@ -176,8 +174,7 @@ struct IDxcBlobEncoding : public IDxcBlob { _Out_ UINT32 *pCodePage) = 0; }; -struct IDxcBlobWide; -__CRT_UUID_DECL(IDxcBlobWide, 0xA3F84EAB, 0x0FAA, 0x497E, 0xA3, 0x9C, 0xEE, 0x6E, 0xD6, 0x0B, 0x2D, 0x84) +CROSS_PLATFORM_UUIDOF(IDxcBlobWide, "A3F84EAB-0FAA-497E-A39C-EE6ED60B2D84") /// \brief A blob containing a null-terminated wide string. /// /// This uses the native wide character encoding (utf16 on Windows, utf32 on @@ -200,8 +197,7 @@ struct IDxcBlobWide : public IDxcBlobEncoding { virtual SIZE_T STDMETHODCALLTYPE GetStringLength(void) = 0; }; -struct IDxcBlobUtf8; -__CRT_UUID_DECL(IDxcBlobUtf8, 0x3DA636C9, 0xBA71, 0x4024, 0xA3, 0x01, 0x30, 0xCB, 0xF1, 0x25, 0x30, 0x5B) +CROSS_PLATFORM_UUIDOF(IDxcBlobUtf8, "3DA636C9-BA71-4024-A301-30CBF125305B") /// \brief A blob containing a UTF-8 encoded string. /// /// The value returned by GetBufferSize() is the size of the buffer, in bytes, @@ -225,8 +221,8 @@ struct IDxcBlobUtf8 : public IDxcBlobEncoding { typedef IDxcBlobWide IDxcBlobUtf16; #endif -struct IDxcIncludeHandler; -__CRT_UUID_DECL(IDxcIncludeHandler, 0x7f61fc7d, 0x950d, 0x467f, 0xb3, 0xe3, 0x3c, 0x02, 0xfb, 0x49, 0x18, 0x7c) +CROSS_PLATFORM_UUIDOF(IDxcIncludeHandler, + "7f61fc7d-950d-467f-b3e3-3c02fb49187c") /// \brief Interface for handling include directives. /// /// This interface can be implemented to customize handling of include @@ -267,8 +263,7 @@ struct DxcDefine { _Maybenull_ LPCWSTR Value; ///< Optional value for the define. }; -struct IDxcCompilerArgs; -__CRT_UUID_DECL(IDxcCompilerArgs, 0x73EFFE2A, 0x70DC, 0x45F8, 0x96, 0x90, 0xEF, 0xF6, 0x4C, 0x02, 0x42, 0x9D) +CROSS_PLATFORM_UUIDOF(IDxcCompilerArgs, "73EFFE2A-70DC-45F8-9690-EFF64C02429D") /// \brief Interface for managing arguments passed to DXC. /// /// Use IDxcUtils::BuildArguments to create an instance of this interface. @@ -311,8 +306,7 @@ struct IDxcCompilerArgs : public IUnknown { // Legacy Interfaces ///////////////////////// -struct IDxcLibrary; -__CRT_UUID_DECL(IDxcLibrary, 0xe5204dc7, 0xd18c, 0x4c3c, 0xbd, 0xfb, 0x85, 0x16, 0x73, 0x98, 0x0f, 0xe7) +CROSS_PLATFORM_UUIDOF(IDxcLibrary, "e5204dc7-d18c-4c3c-bdfb-851673980fe7") /// \deprecated IDxcUtils replaces IDxcLibrary; please use IDxcUtils insted. struct IDxcLibrary : public IUnknown { /// \deprecated @@ -370,8 +364,8 @@ struct IDxcLibrary : public IUnknown { #endif }; -struct IDxcOperationResult; -__CRT_UUID_DECL(IDxcOperationResult, 0xCEDB484A, 0xD4E9, 0x445A, 0xB9, 0x91, 0xCA, 0x21, 0xCA, 0x15, 0x7D, 0xC2) +CROSS_PLATFORM_UUIDOF(IDxcOperationResult, + "CEDB484A-D4E9-445A-B991-CA21CA157DC2") /// \brief The results of a DXC operation. /// /// Note: IDxcResult replaces IDxcOperationResult and should be used wherever @@ -397,8 +391,7 @@ struct IDxcOperationResult : public IUnknown { GetErrorBuffer(_COM_Outptr_result_maybenull_ IDxcBlobEncoding **ppErrors) = 0; }; -struct IDxcCompiler; -__CRT_UUID_DECL(IDxcCompiler, 0x8c210bf3, 0x011f, 0x4422, 0x8d, 0x70, 0x6f, 0x9a, 0xcb, 0x8d, 0xb6, 0x17) +CROSS_PLATFORM_UUIDOF(IDxcCompiler, "8c210bf3-011f-4422-8d70-6f9acb8db617") /// \deprecated Please use IDxcCompiler3 instead. struct IDxcCompiler : public IUnknown { /// \brief Compile a single entry point to the target shader model. @@ -451,8 +444,7 @@ struct IDxcCompiler : public IUnknown { ) = 0; }; -struct IDxcCompiler2; -__CRT_UUID_DECL(IDxcCompiler2, 0xA005A9D9, 0xB8BB, 0x4594, 0xB5, 0xC9, 0x0E, 0x63, 0x3B, 0xEC, 0x4D, 0x37) +CROSS_PLATFORM_UUIDOF(IDxcCompiler2, "A005A9D9-B8BB-4594-B5C9-0E633BEC4D37") /// \deprecated Please use IDxcCompiler3 instead. struct IDxcCompiler2 : public IDxcCompiler { /// \brief Compile a single entry point to the target shader model with debug @@ -482,8 +474,7 @@ struct IDxcCompiler2 : public IDxcCompiler { ) = 0; }; -struct IDxcLinker; -__CRT_UUID_DECL(IDxcLinker, 0xF1B5BE2A, 0x62DD, 0x4327, 0xA1, 0xC2, 0x42, 0xAC, 0x1E, 0x1E, 0x78, 0xE6) +CROSS_PLATFORM_UUIDOF(IDxcLinker, "F1B5BE2A-62DD-4327-A1C2-42AC1E1E78E6") /// \brief DXC linker interface. /// /// Use DxcCreateInstance with CLSID_DxcLinker to obtain an instance of this @@ -516,8 +507,7 @@ struct IDxcLinker : public IUnknown { // Latest interfaces. Please use these. //////////////////////// -struct IDxcUtils; -__CRT_UUID_DECL(IDxcUtils, 0x4605C4CB, 0x2019, 0x492A, 0xAD, 0xA4, 0x65, 0xF2, 0x0B, 0xB7, 0xD6, 0x7F) +CROSS_PLATFORM_UUIDOF(IDxcUtils, "4605C4CB-2019-492A-ADA4-65F20BB7D67F") /// \brief Various utility functions for DXC. /// /// Use DxcCreateInstance with CLSID_DxcUtils to obtain an instance of this @@ -762,8 +752,7 @@ typedef enum DXC_OUT_KIND { static_assert(DXC_OUT_NUM_ENUMS == DXC_OUT_LAST + 1, "DXC_OUT_* Enum added and last value not updated."); -struct IDxcResult; -__CRT_UUID_DECL(IDxcResult, 0x58346CDA, 0xDDE7, 0x4497, 0x94, 0x61, 0x6F, 0x87, 0xAF, 0x5E, 0x06, 0x59) +CROSS_PLATFORM_UUIDOF(IDxcResult, "58346CDA-DDE7-4497-9461-6F87AF5E0659") /// \brief Result of a DXC operation. /// /// DXC operations may have multiple outputs, such as a shader object and @@ -807,8 +796,7 @@ struct IDxcResult : public IDxcOperationResult { #define DXC_EXTRA_OUTPUT_NAME_STDOUT L"*stdout*" #define DXC_EXTRA_OUTPUT_NAME_STDERR L"*stderr*" -struct IDxcExtraOutputs; -__CRT_UUID_DECL(IDxcExtraOutputs, 0x319b37a2, 0xa5c2, 0x494a, 0xa5, 0xde, 0x48, 0x01, 0xb2, 0xfa, 0xf9, 0x89) +CROSS_PLATFORM_UUIDOF(IDxcExtraOutputs, "319b37a2-a5c2-494a-a5de-4801b2faf989") /// \brief Additional outputs from a DXC operation. /// /// This can be used to obtain outputs that don't have an explicit DXC_OUT_KIND. @@ -838,8 +826,7 @@ struct IDxcExtraOutputs : public IUnknown { _COM_Outptr_opt_result_maybenull_ IDxcBlobWide **ppOutputName) = 0; }; -struct IDxcCompiler3; -__CRT_UUID_DECL(IDxcCompiler3, 0x228B4687, 0x5A6A, 0x4730, 0x90, 0x0C, 0x97, 0x02, 0xB2, 0x20, 0x3F, 0x54) +CROSS_PLATFORM_UUIDOF(IDxcCompiler3, "228B4687-5A6A-4730-900C-9702B2203F54") /// \brief Interface to the DirectX Shader Compiler. /// /// Use DxcCreateInstance with CLSID_DxcCompiler to obtain an instance of this @@ -885,8 +872,7 @@ static const UINT32 DxcValidatorFlags_RootSignatureOnly = 2; static const UINT32 DxcValidatorFlags_ModuleOnly = 4; static const UINT32 DxcValidatorFlags_ValidMask = 0x7; -struct IDxcValidator; -__CRT_UUID_DECL(IDxcValidator, 0xA6E82BD2, 0x1FD7, 0x4826, 0x98, 0x11, 0x28, 0x57, 0xE7, 0x97, 0xF4, 0x9A) +CROSS_PLATFORM_UUIDOF(IDxcValidator, "A6E82BD2-1FD7-4826-9811-2857E797F49A") /// \brief Interface to DXC shader validator. /// /// Use DxcCreateInstance with CLSID_DxcValidator to obtain an instance of this. @@ -900,8 +886,7 @@ struct IDxcValidator : public IUnknown { ) = 0; }; -struct IDxcValidator2; -__CRT_UUID_DECL(IDxcValidator2, 0x458e1fd1, 0xb1b2, 0x4750, 0xa6, 0xe1, 0x9c, 0x10, 0xf0, 0x3b, 0xed, 0x92) +CROSS_PLATFORM_UUIDOF(IDxcValidator2, "458e1fd1-b1b2-4750-a6e1-9c10f03bed92") /// \brief Interface to DXC shader validator. /// /// Use DxcCreateInstance with CLSID_DxcValidator to obtain an instance of this. @@ -917,8 +902,8 @@ struct IDxcValidator2 : public IDxcValidator { ) = 0; }; -struct IDxcContainerBuilder; -__CRT_UUID_DECL(IDxcContainerBuilder, 0x334b1f50, 0x2292, 0x4b35, 0x99, 0xa1, 0x25, 0x58, 0x8d, 0x8c, 0x17, 0xfe) +CROSS_PLATFORM_UUIDOF(IDxcContainerBuilder, + "334b1f50-2292-4b35-99a1-25588d8c17fe") /// \brief Interface to DXC container builder. /// /// Use DxcCreateInstance with CLSID_DxcContainerBuilder to obtain an instance @@ -951,8 +936,7 @@ struct IDxcContainerBuilder : public IUnknown { SerializeContainer(_Out_ IDxcOperationResult **ppResult) = 0; }; -struct IDxcAssembler; -__CRT_UUID_DECL(IDxcAssembler, 0x091f7a26, 0x1c1f, 0x4948, 0x90, 0x4b, 0xe6, 0xe3, 0xa8, 0xa7, 0x71, 0xd5) +CROSS_PLATFORM_UUIDOF(IDxcAssembler, "091f7a26-1c1f-4948-904b-e6e3a8a771d5") /// \brief Interface to DxcAssembler. /// /// Use DxcCreateInstance with CLSID_DxcAssembler to obtain an instance of this. @@ -965,8 +949,8 @@ struct IDxcAssembler : public IUnknown { ) = 0; }; -struct IDxcContainerReflection; -__CRT_UUID_DECL(IDxcContainerReflection, 0xd2c21b26, 0x8350, 0x4bdc, 0x97, 0x6a, 0x33, 0x1c, 0xe6, 0xf4, 0xc5, 0x4c) +CROSS_PLATFORM_UUIDOF(IDxcContainerReflection, + "d2c21b26-8350-4bdc-976a-331ce6f4c54c") /// \brief Interface to DxcContainerReflection. /// /// Use DxcCreateInstance with CLSID_DxcContainerReflection to obtain an @@ -1040,8 +1024,7 @@ struct IDxcContainerReflection : public IUnknown { void **ppvObject) = 0; }; -struct IDxcOptimizerPass; -__CRT_UUID_DECL(IDxcOptimizerPass, 0xAE2CD79F, 0xCC22, 0x453F, 0x9B, 0x6B, 0xB1, 0x24, 0xE7, 0xA5, 0x20, 0x4C) +CROSS_PLATFORM_UUIDOF(IDxcOptimizerPass, "AE2CD79F-CC22-453F-9B6B-B124E7A5204C") /// \brief An optimizer pass. /// /// Instances of this can be obtained via IDxcOptimizer::GetAvailablePass. @@ -1057,8 +1040,7 @@ struct IDxcOptimizerPass : public IUnknown { GetOptionArgDescription(UINT32 argIndex, _COM_Outptr_ LPWSTR *ppResult) = 0; }; -struct IDxcOptimizer; -__CRT_UUID_DECL(IDxcOptimizer, 0x25740E2E, 0x9CBA, 0x401B, 0x91, 0x19, 0x4F, 0xB4, 0x2F, 0x39, 0xF2, 0x70) +CROSS_PLATFORM_UUIDOF(IDxcOptimizer, "25740E2E-9CBA-401B-9119-4FB42F39F270") /// \brief Interface to DxcOptimizer. /// /// Use DxcCreateInstance with CLSID_DxcOptimizer to obtain an instance of this. @@ -1078,8 +1060,7 @@ static const UINT32 DxcVersionInfoFlags_Debug = 1; // Matches VS_FF_DEBUG static const UINT32 DxcVersionInfoFlags_Internal = 2; // Internal Validator (non-signing) -struct IDxcVersionInfo; -__CRT_UUID_DECL(IDxcVersionInfo, 0xb04f5b50, 0x2059, 0x4f12, 0xa8, 0xff, 0xa1, 0xe0, 0xcd, 0xe1, 0xcc, 0x7e) +CROSS_PLATFORM_UUIDOF(IDxcVersionInfo, "b04f5b50-2059-4f12-a8ff-a1e0cde1cc7e") /// \brief PDB Version information. /// /// Use IDxcPdbUtils2::GetVersionInfo to obtain an instance of this. @@ -1089,8 +1070,7 @@ struct IDxcVersionInfo : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetFlags(_Out_ UINT32 *pFlags) = 0; }; -struct IDxcVersionInfo2; -__CRT_UUID_DECL(IDxcVersionInfo2, 0xfb6904c4, 0x42f0, 0x4b62, 0x9c, 0x46, 0x98, 0x3a, 0xf7, 0xda, 0x7c, 0x83) +CROSS_PLATFORM_UUIDOF(IDxcVersionInfo2, "fb6904c4-42f0-4b62-9c46-983af7da7c83") /// \brief PDB Version Information. /// /// Use IDxcPdbUtils2::GetVersionInfo to obtain a IDxcVersionInfo interface, and @@ -1103,8 +1083,7 @@ struct IDxcVersionInfo2 : public IDxcVersionInfo { ) = 0; }; -struct IDxcVersionInfo3; -__CRT_UUID_DECL(IDxcVersionInfo3, 0x5e13e843, 0x9d25, 0x473c, 0x9a, 0xd2, 0x03, 0xb2, 0xd0, 0xb4, 0x4b, 0x1e) +CROSS_PLATFORM_UUIDOF(IDxcVersionInfo3, "5e13e843-9d25-473c-9ad2-03b2d0b44b1e") /// \brief PDB Version Information. /// /// Use IDxcPdbUtils2::GetVersionInfo to obtain a IDxcVersionInfo interface, and @@ -1122,8 +1101,7 @@ struct DxcArgPair { const WCHAR *pValue; }; -struct IDxcPdbUtils; -__CRT_UUID_DECL(IDxcPdbUtils, 0xE6C9647E, 0x9D6A, 0x4C3B, 0xB9, 0x4C, 0x52, 0x4B, 0x5A, 0x6C, 0x34, 0x3D) +CROSS_PLATFORM_UUIDOF(IDxcPdbUtils, "E6C9647E-9D6A-4C3B-B94C-524B5A6C343D") /// \deprecated Please use IDxcPdbUtils2 instead. struct IDxcPdbUtils : public IUnknown { virtual HRESULT STDMETHODCALLTYPE Load(_In_ IDxcBlob *pPdbOrDxil) = 0; @@ -1180,8 +1158,7 @@ struct IDxcPdbUtils : public IUnknown { OverrideRootSignature(_In_ const WCHAR *pRootSignature) = 0; }; -struct IDxcPdbUtils2; -__CRT_UUID_DECL(IDxcPdbUtils2, 0x4315D938, 0xF369, 0x4F93, 0x95, 0xA2, 0x25, 0x20, 0x17, 0xCC, 0x38, 0x07) +CROSS_PLATFORM_UUIDOF(IDxcPdbUtils2, "4315D938-F369-4F93-95A2-252017CC3807") /// \brief DxcPdbUtils interface. /// /// Use DxcCreateInstance with CLSID_DxcPdbUtils to create an instance of this. diff --git a/include/dxc/dxcapi.internal.h b/include/dxc/dxcapi.internal.h index 986428f655..45ed19d500 100644 --- a/include/dxc/dxcapi.internal.h +++ b/include/dxc/dxcapi.internal.h @@ -138,7 +138,7 @@ static const BYTE IA_SPECIAL_SLOTS = 4; struct HLSL_INTRINSIC_ARGUMENT { LPCSTR - pName; // Name of the argument; the first argument has the function name. + pName; // Name of the argument; the first argument has the function name. UINT64 qwUsage; // A combination of // AR_QUAL_IN|AR_QUAL_OUT|AR_QUAL_COLMAJOR|AR_QUAL_ROWMAJOR in // parameter tables; other values possible elsewhere. @@ -173,8 +173,8 @@ struct HLSL_INTRINSIC { /////////////////////////////////////////////////////////////////////////////// // Interfaces. -struct IDxcIntrinsicTable; -__CRT_UUID_DECL(IDxcIntrinsicTable, 0xf0d4da3f, 0xf863, 0x4660, 0xb8, 0xb4, 0xdf, 0xd9, 0x4d, 0xed, 0x62, 0x15) +CROSS_PLATFORM_UUIDOF(IDxcIntrinsicTable, + "f0d4da3f-f863-4660-b8b4-dfd94ded6215") struct IDxcIntrinsicTable : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE GetTableName(LPCSTR *pTableName) = 0; @@ -202,8 +202,8 @@ struct IDxcIntrinsicTable : public IUnknown { UINT *pDxilOpcode) = 0; }; -struct IDxcSemanticDefineValidator; -__CRT_UUID_DECL(IDxcSemanticDefineValidator, 0x1d063e4f, 0x515a, 0x4d57, 0xa1, 0x2a, 0x43, 0x1f, 0x6a, 0x44, 0xcf, 0xb9) +CROSS_PLATFORM_UUIDOF(IDxcSemanticDefineValidator, + "1d063e4f-515a-4d57-a12a-431f6a44cfb9") struct IDxcSemanticDefineValidator : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE GetSemanticDefineWarningsAndErrors( @@ -211,8 +211,8 @@ struct IDxcSemanticDefineValidator : public IUnknown { IDxcBlobEncoding **ppErrorBlob) = 0; }; -struct IDxcLangExtensions; -__CRT_UUID_DECL(IDxcLangExtensions, 0x282a56b4, 0x3f56, 0x4360, 0x98, 0xc7, 0x9e, 0xa0, 0x4a, 0x75, 0x22, 0x72) +CROSS_PLATFORM_UUIDOF(IDxcLangExtensions, + "282a56b4-3f56-4360-98c7-9ea04a752272") struct IDxcLangExtensions : public IUnknown { public: /// @@ -240,15 +240,15 @@ struct IDxcLangExtensions : public IUnknown { SetSemanticDefineMetaDataName(LPCSTR name) = 0; }; -struct IDxcLangExtensions2; -__CRT_UUID_DECL(IDxcLangExtensions2, 0x2490C368, 0x89EE, 0x4491, 0xA4, 0xB2, 0xC6, 0x54, 0x7B, 0x6C, 0x93, 0x81) +CROSS_PLATFORM_UUIDOF(IDxcLangExtensions2, + "2490C368-89EE-4491-A4B2-C6547B6C9381") struct IDxcLangExtensions2 : public IDxcLangExtensions { public: virtual HRESULT STDMETHODCALLTYPE SetTargetTriple(LPCSTR name) = 0; }; -struct IDxcLangExtensions3; -__CRT_UUID_DECL(IDxcLangExtensions3, 0xA1B19880, 0xFB1F, 0x4920, 0x9B, 0xC5, 0x50, 0x35, 0x64, 0x83, 0xBA, 0xC1) +CROSS_PLATFORM_UUIDOF(IDxcLangExtensions3, + "A1B19880-FB1F-4920-9BC5-50356483BAC1") struct IDxcLangExtensions3 : public IDxcLangExtensions2 { public: /// Registers a semantic define which cannot be overriden using the flag @@ -257,8 +257,7 @@ struct IDxcLangExtensions3 : public IDxcLangExtensions2 { RegisterNonOptSemanticDefine(LPCWSTR name) = 0; }; -struct IDxcSystemAccess; -__CRT_UUID_DECL(IDxcSystemAccess, 0x454b764f, 0x3549, 0x475b, 0x95, 0x8c, 0xa7, 0xa6, 0xfc, 0xd0, 0x5f, 0xbc) +CROSS_PLATFORM_UUIDOF(IDxcSystemAccess, "454b764f-3549-475b-958c-a7a6fcd05fbc") struct IDxcSystemAccess : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE EnumFiles(LPCWSTR fileName, @@ -314,16 +313,16 @@ struct IDxcSystemAccess : public IUnknown { unsigned *columnCount) = 0; }; -struct IDxcContainerEventsHandler; -__CRT_UUID_DECL(IDxcContainerEventsHandler, 0xe991ca8d, 0x2045, 0x413c, 0xa8, 0xb8, 0x78, 0x8b, 0x2c, 0x06, 0xe1, 0x4d) +CROSS_PLATFORM_UUIDOF(IDxcContainerEventsHandler, + "e991ca8d-2045-413c-a8b8-788b2c06e14d") struct IDxcContainerEventsHandler : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE OnDxilContainerBuilt(IDxcBlob *pSource, IDxcBlob **ppTarget) = 0; }; -struct IDxcContainerEvent; -__CRT_UUID_DECL(IDxcContainerEvent, 0x0cfc5058, 0x342b, 0x4ff2, 0x83, 0xf7, 0x04, 0xc1, 0x2a, 0xad, 0x3d, 0x01) +CROSS_PLATFORM_UUIDOF(IDxcContainerEvent, + "0cfc5058-342b-4ff2-83f7-04c12aad3d01") struct IDxcContainerEvent : public IUnknown { public: virtual HRESULT STDMETHODCALLTYPE RegisterDxilContainerEventHandler( diff --git a/include/dxc/dxcisense.h b/include/dxc/dxcisense.h index 6161146f7f..661de1680a 100644 --- a/include/dxc/dxcisense.h +++ b/include/dxc/dxcisense.h @@ -662,8 +662,7 @@ struct IDxcCodeCompleteResults; struct IDxcCompletionResult; struct IDxcCompletionString; -struct IDxcCursor; -__CRT_UUID_DECL(IDxcCursor, 0x1467b985, 0x288d, 0x4d2a, 0x80, 0xc1, 0xef, 0x89, 0xc4, 0x2c, 0x40, 0xbc) +CROSS_PLATFORM_UUIDOF(IDxcCursor, "1467b985-288d-4d2a-80c1-ef89c42c40bc") struct IDxcCursor : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetExtent(_Outptr_result_nullonfailure_ IDxcSourceRange **pRange) = 0; @@ -729,8 +728,7 @@ struct IDxcCursor : public IUnknown { _Outptr_result_maybenull_ IDxcCursor **pResult) = 0; }; -struct IDxcDiagnostic; -__CRT_UUID_DECL(IDxcDiagnostic, 0x4f76b234, 0x3659, 0x4d33, 0x99, 0xb0, 0x3b, 0x0d, 0xb9, 0x94, 0xb5, 0x64) +CROSS_PLATFORM_UUIDOF(IDxcDiagnostic, "4f76b234-3659-4d33-99b0-3b0db994b564") struct IDxcDiagnostic : public IUnknown { virtual HRESULT STDMETHODCALLTYPE FormatDiagnostic(DxcDiagnosticDisplayOptions options, @@ -754,8 +752,7 @@ struct IDxcDiagnostic : public IUnknown { _Outptr_result_maybenull_ LPSTR *pText) = 0; }; -struct IDxcFile; -__CRT_UUID_DECL(IDxcFile, 0xbb2fca9e, 0x1478, 0x47ba, 0xb0, 0x8c, 0x2c, 0x50, 0x2a, 0xda, 0x48, 0x95) +CROSS_PLATFORM_UUIDOF(IDxcFile, "bb2fca9e-1478-47ba-b08c-2c502ada4895") struct IDxcFile : public IUnknown { /// Gets the file name for this file. virtual HRESULT STDMETHODCALLTYPE @@ -766,8 +763,7 @@ struct IDxcFile : public IUnknown { _Out_ BOOL *pResult) = 0; }; -struct IDxcInclusion; -__CRT_UUID_DECL(IDxcInclusion, 0x0c364d65, 0xdf44, 0x4412, 0x88, 0x8e, 0x4e, 0x55, 0x2f, 0xc5, 0xe3, 0xd6) +CROSS_PLATFORM_UUIDOF(IDxcInclusion, "0c364d65-df44-4412-888e-4e552fc5e3d6") struct IDxcInclusion : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetIncludedFile(_Outptr_result_nullonfailure_ IDxcFile **pResult) = 0; @@ -777,8 +773,7 @@ struct IDxcInclusion : public IUnknown { _Outptr_result_nullonfailure_ IDxcSourceLocation **pResult) = 0; }; -struct IDxcIntelliSense; -__CRT_UUID_DECL(IDxcIntelliSense, 0xb1f99513, 0x46d6, 0x4112, 0x81, 0x69, 0xdd, 0x0d, 0x60, 0x53, 0xf1, 0x7d) +CROSS_PLATFORM_UUIDOF(IDxcIntelliSense, "b1f99513-46d6-4112-8169-dd0d6053f17d") struct IDxcIntelliSense : public IUnknown { virtual HRESULT STDMETHODCALLTYPE CreateIndex(_Outptr_result_nullonfailure_ IDxcIndex **index) = 0; @@ -798,8 +793,7 @@ struct IDxcIntelliSense : public IUnknown { _Outptr_result_nullonfailure_ IDxcUnsavedFile **pResult) = 0; }; -struct IDxcIndex; -__CRT_UUID_DECL(IDxcIndex, 0x937824a0, 0x7f5a, 0x4815, 0x9b, 0xa7, 0x7f, 0xc0, 0x42, 0x4f, 0x41, 0x73) +CROSS_PLATFORM_UUIDOF(IDxcIndex, "937824a0-7f5a-4815-9ba7-7fc0424f4173") struct IDxcIndex : public IUnknown { virtual HRESULT STDMETHODCALLTYPE SetGlobalOptions(DxcGlobalOptions options) = 0; @@ -814,8 +808,8 @@ struct IDxcIndex : public IUnknown { _Out_ IDxcTranslationUnit **pTranslationUnit) = 0; }; -struct IDxcSourceLocation; -__CRT_UUID_DECL(IDxcSourceLocation, 0x8e7ddf1c, 0xd7d3, 0x4d69, 0xb2, 0x86, 0x85, 0xfc, 0xcb, 0xa1, 0xe0, 0xcf) +CROSS_PLATFORM_UUIDOF(IDxcSourceLocation, + "8e7ddf1c-d7d3-4d69-b286-85fccba1e0cf") struct IDxcSourceLocation : public IUnknown { virtual HRESULT STDMETHODCALLTYPE IsEqualTo(_In_ IDxcSourceLocation *other, _Out_ BOOL *pResult) = 0; @@ -828,8 +822,7 @@ struct IDxcSourceLocation : public IUnknown { _Out_opt_ unsigned *pCol) = 0; }; -struct IDxcSourceRange; -__CRT_UUID_DECL(IDxcSourceRange, 0xf1359b36, 0xa53f, 0x4e81, 0xb5, 0x14, 0xb6, 0xb8, 0x41, 0x22, 0xa1, 0x3f) +CROSS_PLATFORM_UUIDOF(IDxcSourceRange, "f1359b36-a53f-4e81-b514-b6b84122a13f") struct IDxcSourceRange : public IUnknown { virtual HRESULT STDMETHODCALLTYPE IsNull(_Out_ BOOL *pValue) = 0; virtual HRESULT STDMETHODCALLTYPE @@ -840,8 +833,7 @@ struct IDxcSourceRange : public IUnknown { _Out_ unsigned *endOffset) = 0; }; -struct IDxcToken; -__CRT_UUID_DECL(IDxcToken, 0x7f90b9ff, 0xa275, 0x4932, 0x97, 0xd8, 0x3c, 0xfd, 0x23, 0x44, 0x82, 0xa2) +CROSS_PLATFORM_UUIDOF(IDxcToken, "7f90b9ff-a275-4932-97d8-3cfd234482a2") struct IDxcToken : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetKind(_Out_ DxcTokenKind *pValue) = 0; virtual HRESULT STDMETHODCALLTYPE @@ -851,8 +843,8 @@ struct IDxcToken : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetSpelling(_Out_ LPSTR *pValue) = 0; }; -struct IDxcTranslationUnit; -__CRT_UUID_DECL(IDxcTranslationUnit, 0x9677dee0, 0xc0e5, 0x46a1, 0x8b, 0x40, 0x3d, 0xb3, 0x16, 0x8b, 0xe6, 0x3d) +CROSS_PLATFORM_UUIDOF(IDxcTranslationUnit, + "9677dee0-c0e5-46a1-8b40-3db3168be63d") struct IDxcTranslationUnit : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetCursor(_Out_ IDxcCursor **pCursor) = 0; virtual HRESULT STDMETHODCALLTYPE @@ -900,8 +892,7 @@ struct IDxcTranslationUnit : public IUnknown { _Outptr_result_nullonfailure_ IDxcCodeCompleteResults **pResult) = 0; }; -struct IDxcType; -__CRT_UUID_DECL(IDxcType, 0x2ec912fd, 0xb144, 0x4a15, 0xad, 0x0d, 0x1c, 0x54, 0x39, 0xc8, 0x1e, 0x46) +CROSS_PLATFORM_UUIDOF(IDxcType, "2ec912fd-b144-4a15-ad0d-1c5439c81e46") struct IDxcType : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetSpelling(_Outptr_result_z_ LPSTR *pResult) = 0; @@ -910,8 +901,7 @@ struct IDxcType : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetKind(_Out_ DxcTypeKind *pResult) = 0; }; -struct IDxcUnsavedFile; -__CRT_UUID_DECL(IDxcUnsavedFile, 0x8ec00f98, 0x07d0, 0x4e60, 0x9d, 0x7c, 0x5a, 0x50, 0xb5, 0xb0, 0x01, 0x7f) +CROSS_PLATFORM_UUIDOF(IDxcUnsavedFile, "8ec00f98-07d0-4e60-9d7c-5a50b5b0017f") struct IDxcUnsavedFile : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetFileName(_Outptr_result_z_ LPSTR *pFileName) = 0; @@ -920,8 +910,8 @@ struct IDxcUnsavedFile : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetLength(_Out_ unsigned *pLength) = 0; }; -struct IDxcCodeCompleteResults; -__CRT_UUID_DECL(IDxcCodeCompleteResults, 0x1E06466A, 0xFD8B, 0x45F3, 0xA7, 0x8F, 0x8A, 0x3F, 0x76, 0xEB, 0xB5, 0x52) +CROSS_PLATFORM_UUIDOF(IDxcCodeCompleteResults, + "1E06466A-FD8B-45F3-A78F-8A3F76EBB552") struct IDxcCodeCompleteResults : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetNumResults(_Out_ unsigned *pResult) = 0; virtual HRESULT STDMETHODCALLTYPE @@ -929,8 +919,8 @@ struct IDxcCodeCompleteResults : public IUnknown { _Outptr_result_nullonfailure_ IDxcCompletionResult **pResult) = 0; }; -struct IDxcCompletionResult; -__CRT_UUID_DECL(IDxcCompletionResult, 0x943C0588, 0x22D0, 0x4784, 0x86, 0xFC, 0x70, 0x1F, 0x80, 0x2A, 0xC2, 0xB6) +CROSS_PLATFORM_UUIDOF(IDxcCompletionResult, + "943C0588-22D0-4784-86FC-701F802AC2B6") struct IDxcCompletionResult : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetCursorKind(_Out_ DxcCursorKind *pResult) = 0; @@ -938,8 +928,8 @@ struct IDxcCompletionResult : public IUnknown { _Outptr_result_nullonfailure_ IDxcCompletionString **pResult) = 0; }; -struct IDxcCompletionString; -__CRT_UUID_DECL(IDxcCompletionString, 0x06B51E0F, 0xA605, 0x4C69, 0xA1, 0x10, 0xCD, 0x6E, 0x14, 0xB5, 0x8E, 0xEC) +CROSS_PLATFORM_UUIDOF(IDxcCompletionString, + "06B51E0F-A605-4C69-A110-CD6E14B58EEC") struct IDxcCompletionString : public IUnknown { virtual HRESULT STDMETHODCALLTYPE GetNumCompletionChunks(_Out_ unsigned *pResult) = 0; diff --git a/include/dxc/dxctools.h b/include/dxc/dxctools.h index 4a7cfaa92b..bfdc0d86f7 100644 --- a/include/dxc/dxctools.h +++ b/include/dxc/dxctools.h @@ -22,8 +22,7 @@ enum RewriterOptionMask { KeepUserMacro = 8, }; -struct IDxcRewriter; -__CRT_UUID_DECL(IDxcRewriter, 0xc012115b, 0x8893, 0x4eb9, 0x9c, 0x5a, 0x11, 0x14, 0x56, 0xea, 0x1c, 0x45) +CROSS_PLATFORM_UUIDOF(IDxcRewriter, "c012115b-8893-4eb9-9c5a-111456ea1c45") struct IDxcRewriter : public IUnknown { virtual HRESULT STDMETHODCALLTYPE RemoveUnusedGlobals( @@ -56,8 +55,7 @@ CLSID_SCOPE const CLSID 0x40b3, {0x96, 0x8d, 0x93, 0xe1, 0x24, 0x73, 0x4d, 0xa4}}; -struct IDxcRewriter2; -__CRT_UUID_DECL(IDxcRewriter2, 0x261afca1, 0x0609, 0x4ec6, 0xa7, 0x7f, 0xd9, 0x8c, 0x70, 0x35, 0x19, 0x4e) +CROSS_PLATFORM_UUIDOF(IDxcRewriter2, "261afca1-0609-4ec6-a77f-d98c7035194e") struct IDxcRewriter2 : public IDxcRewriter { virtual HRESULT STDMETHODCALLTYPE RewriteWithOptions( diff --git a/lib/DxcSupport/Unicode.cpp b/lib/DxcSupport/Unicode.cpp index ad9cc4453e..1481ae27ff 100644 --- a/lib/DxcSupport/Unicode.cpp +++ b/lib/DxcSupport/Unicode.cpp @@ -133,8 +133,8 @@ namespace Unicode { bool WideToEncodedString(const wchar_t *text, size_t cWide, DWORD cp, DWORD flags, std::string *pValue, bool *lossy) { - bool usedDefaultChar; - bool *pUsedDefaultChar = (lossy == nullptr) ? nullptr : &usedDefaultChar; + BOOL usedDefaultChar; + LPBOOL pUsedDefaultChar = (lossy == nullptr) ? nullptr : &usedDefaultChar; if (lossy != nullptr) *lossy = false; From ae5c6871490d238d6b7715f8934c28148376b2c2 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 9 Aug 2024 22:05:31 +0200 Subject: [PATCH 03/15] Fixed BOOL issues and compile issues on linux --- include/dxc/Support/Unicode.h | 10 +++++----- include/dxc/WinAdapter.h | 6 +++--- lib/DxcSupport/Unicode.cpp | 12 ++++++------ lib/DxcSupport/dxcapi.use.cpp | 2 +- projects/dxilconv/tools/dxbc2dxil/dxbc2dxil.cpp | 2 +- tools/clang/tools/dxr/dxr.cpp | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/include/dxc/Support/Unicode.h b/include/dxc/Support/Unicode.h index 64e3abccd8..2437cff38a 100644 --- a/include/dxc/Support/Unicode.h +++ b/include/dxc/Support/Unicode.h @@ -30,7 +30,7 @@ int WideCharToMultiByte(uint32_t CodePage, uint32_t dwFlags, const wchar_t *lpWideCharStr, int cchWideChar, char *lpMultiByteStr, int cbMultiByte, const char *lpDefaultChar = nullptr, - bool *lpUsedDefaultChar = nullptr); + LPBOOL lpUsedDefaultChar = nullptr); #endif // _WIN32 namespace Unicode { @@ -54,14 +54,14 @@ typedef char acp_char; typedef char ccp_char; bool UTF8ToConsoleString(const char *text, size_t textLen, std::string *pValue, - bool *lossy); + LPBOOL lossy); -bool UTF8ToConsoleString(const char *text, std::string *pValue, bool *lossy); +bool UTF8ToConsoleString(const char *text, std::string *pValue, LPBOOL lossy); bool WideToConsoleString(const wchar_t *text, size_t textLen, - std::string *pValue, bool *lossy); + std::string *pValue, LPBOOL lossy); -bool WideToConsoleString(const wchar_t *text, std::string *pValue, bool *lossy); +bool WideToConsoleString(const wchar_t *text, std::string *pValue, LPBOOL lossy); bool UTF8ToWideString(const char *pUTF8, std::wstring *pWide); diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index a851695f29..121f574fae 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -452,7 +452,7 @@ template inline GUID __emulated_uuidof(); template <> inline GUID __emulated_uuidof() { \ static const IID _IID = guid_from_string(spec); \ return _IID; \ - } + } \ extern "C++" \ { \ template <> \ @@ -462,9 +462,9 @@ template inline GUID __emulated_uuidof(); return _IID; \ } \ template <> \ - inline const GUID &__wsl_stub_uuidof() \ + inline const GUID &__wsl_stub_uuidof() \ { \ - return __wsl_stub_uuidof(); \ + return __wsl_stub_uuidof(); \ } \ } diff --git a/lib/DxcSupport/Unicode.cpp b/lib/DxcSupport/Unicode.cpp index 1481ae27ff..be4bcfa005 100644 --- a/lib/DxcSupport/Unicode.cpp +++ b/lib/DxcSupport/Unicode.cpp @@ -79,7 +79,7 @@ int WideCharToMultiByte(uint32_t /*CodePage*/, uint32_t /*dwFlags*/, const wchar_t *lpWideCharStr, int cchWideChar, char *lpMultiByteStr, int cbMultiByte, const char * /*lpDefaultChar*/, - bool *lpUsedDefaultChar) { + LPBOOL lpUsedDefaultChar) { if (lpUsedDefaultChar) { *lpUsedDefaultChar = FALSE; } @@ -132,7 +132,7 @@ int WideCharToMultiByte(uint32_t /*CodePage*/, uint32_t /*dwFlags*/, namespace Unicode { bool WideToEncodedString(const wchar_t *text, size_t cWide, DWORD cp, - DWORD flags, std::string *pValue, bool *lossy) { + DWORD flags, std::string *pValue, LPBOOL lossy) { BOOL usedDefaultChar; LPBOOL pUsedDefaultChar = (lossy == nullptr) ? nullptr : &usedDefaultChar; if (lossy != nullptr) @@ -204,7 +204,7 @@ std::wstring UTF8ToWideStringOrThrow(const char *pUTF8) { } bool UTF8ToConsoleString(const char *text, size_t textLen, std::string *pValue, - bool *lossy) { + LPBOOL lossy) { DXASSERT_NOMSG(text != nullptr); DXASSERT_NOMSG(pValue != nullptr); std::wstring text16; @@ -216,12 +216,12 @@ bool UTF8ToConsoleString(const char *text, size_t textLen, std::string *pValue, return WideToConsoleString(text16.c_str(), text16.length(), pValue, lossy); } -bool UTF8ToConsoleString(const char *text, std::string *pValue, bool *lossy) { +bool UTF8ToConsoleString(const char *text, std::string *pValue, LPBOOL lossy) { return UTF8ToConsoleString(text, strlen(text), pValue, lossy); } bool WideToConsoleString(const wchar_t *text, size_t textLen, - std::string *pValue, bool *lossy) { + std::string *pValue, LPBOOL lossy) { DXASSERT_NOMSG(text != nullptr); DXASSERT_NOMSG(pValue != nullptr); UINT cp = GetConsoleOutputCP(); @@ -229,7 +229,7 @@ bool WideToConsoleString(const wchar_t *text, size_t textLen, } bool WideToConsoleString(const wchar_t *text, std::string *pValue, - bool *lossy) { + LPBOOL lossy) { return WideToConsoleString(text, wcslen(text), pValue, lossy); } diff --git a/lib/DxcSupport/dxcapi.use.cpp b/lib/DxcSupport/dxcapi.use.cpp index 399259ef87..7628b51f35 100644 --- a/lib/DxcSupport/dxcapi.use.cpp +++ b/lib/DxcSupport/dxcapi.use.cpp @@ -114,7 +114,7 @@ static void WriteWideNullTermToConsole(const wchar_t *pText, DWORD streamType) { return; } - bool lossy; // Note: even if there was loss, print anyway + BOOL lossy; // Note: even if there was loss, print anyway std::string consoleMessage; Unicode::WideToConsoleString(pText, &consoleMessage, &lossy); if (streamType == STD_OUTPUT_HANDLE) { diff --git a/projects/dxilconv/tools/dxbc2dxil/dxbc2dxil.cpp b/projects/dxilconv/tools/dxbc2dxil/dxbc2dxil.cpp index c485709c57..ac50370052 100644 --- a/projects/dxilconv/tools/dxbc2dxil/dxbc2dxil.cpp +++ b/projects/dxilconv/tools/dxbc2dxil/dxbc2dxil.cpp @@ -373,7 +373,7 @@ int __cdecl wmain(int argc, wchar_t **argv) { } std::string textMessage; - bool lossy; + BOOL lossy; if (!Unicode::UTF8ToConsoleString(pMsg, &textMessage, &lossy) || lossy) { // Do a direct assignment as a last-ditch effort and print out as UTF-8. textMessage = pMsg; diff --git a/tools/clang/tools/dxr/dxr.cpp b/tools/clang/tools/dxr/dxr.cpp index e64a050ffc..3268864a43 100644 --- a/tools/clang/tools/dxr/dxr.cpp +++ b/tools/clang/tools/dxr/dxr.cpp @@ -171,7 +171,7 @@ int main(int argc, const char **argv) { } std::string textMessage; - bool lossy; + BOOL lossy; if (!Unicode::UTF8ToConsoleString(msg, &textMessage, &lossy) || lossy) { // Do a direct assignment as a last-ditch effort and print out as UTF-8. textMessage = msg; From dc19327ea85b08c17afb85b8f17eb4cf7536d6c0 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 9 Aug 2024 22:14:29 +0200 Subject: [PATCH 04/15] Fixed windows build --- include/dxc/Support/Unicode.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/dxc/Support/Unicode.h b/include/dxc/Support/Unicode.h index 2437cff38a..fd3ed345c4 100644 --- a/include/dxc/Support/Unicode.h +++ b/include/dxc/Support/Unicode.h @@ -14,6 +14,7 @@ #include #ifdef _WIN32 +typedef int* LPBOOL; #include #else // MultiByteToWideChar which is a Windows-specific method. From 631d446629c1438c34b2bcf932cfa47b9d3293c3 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 9 Aug 2024 22:15:54 +0200 Subject: [PATCH 05/15] Clean up for PR --- include/dxc/WinAdapter.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index 121f574fae..c21e4e17a5 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -526,9 +526,6 @@ struct IStream : public ISequentialStream { // These don't need stub implementations as they come from the DirectX Headers // They still need the __uuidof() though -struct ID3D12LibraryReflection; -struct ID3D12ShaderReflection; - CROSS_PLATFORM_UUIDOF(ID3D12LibraryReflection, "8E349D19-54DB-4A56-9DC9-119D87BDB804") CROSS_PLATFORM_UUIDOF(ID3D12ShaderReflection, From 6e41fafadb2ddb19c6574312d204d8a8a6488966 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 9 Aug 2024 22:17:35 +0200 Subject: [PATCH 06/15] Undid some changes for PR --- include/dxc/WinAdapter.h | 1 - include/dxc/dxcapi.internal.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index c21e4e17a5..07f0eceda8 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -525,7 +525,6 @@ struct IStream : public ISequentialStream { // These don't need stub implementations as they come from the DirectX Headers // They still need the __uuidof() though - CROSS_PLATFORM_UUIDOF(ID3D12LibraryReflection, "8E349D19-54DB-4A56-9DC9-119D87BDB804") CROSS_PLATFORM_UUIDOF(ID3D12ShaderReflection, diff --git a/include/dxc/dxcapi.internal.h b/include/dxc/dxcapi.internal.h index 45ed19d500..b0f9a467a4 100644 --- a/include/dxc/dxcapi.internal.h +++ b/include/dxc/dxcapi.internal.h @@ -138,7 +138,7 @@ static const BYTE IA_SPECIAL_SLOTS = 4; struct HLSL_INTRINSIC_ARGUMENT { LPCSTR - pName; // Name of the argument; the first argument has the function name. + pName; // Name of the argument; the first argument has the function name. UINT64 qwUsage; // A combination of // AR_QUAL_IN|AR_QUAL_OUT|AR_QUAL_COLMAJOR|AR_QUAL_ROWMAJOR in // parameter tables; other values possible elsewhere. From 18a489416fa4ca410473e0a09345306a271ee262 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 9 Aug 2024 22:34:20 +0200 Subject: [PATCH 07/15] DirectX-Headers is now required for windows --- CMakeLists.txt | 7 +++++-- external/CMakeLists.txt | 12 +++++------- include/dxc/Support/D3DReflection.h | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 87c76abdf6..71c73c359f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -674,8 +674,11 @@ endif() if(EXISTS "${LLVM_MAIN_SRC_DIR}/external") add_subdirectory(external) # SPIRV change endif() -include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/wsl/stubs ${DIRECTX_HEADER_INCLUDE_DIR}/wsl ${DIRECTX_HEADER_INCLUDE_DIR}/directx) - +if(WIN32) + include_directories(${DIRECTX_HEADER_INCLUDE_DIR}/directx) +else() + include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/wsl/stubs ${DIRECTX_HEADER_INCLUDE_DIR}/wsl ${DIRECTX_HEADER_INCLUDE_DIR}/directx) +endif() # Put this before tblgen. Else we have a circular dependence. add_subdirectory(lib/Support) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index a8b2638e3d..b56bc1d2ab 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -9,13 +9,11 @@ endif (NOT HLSL_ENABLE_DEBUG_ITERATORS) # Need DirectX-Headers module if not on windows if (NOT DIRECTX_HEADER_INCLUDE_DIR) - if (NOT WIN32) - if (IS_DIRECTORY "${DXC_EXTERNAL_ROOT_DIR}/DirectX-Headers") - set(DIRECTX_HEADER_INCLUDE_DIR ${DXC_EXTERNAL_ROOT_DIR}/DirectX-Headers/include PARENT_SCOPE) - else() - message(FATAL_ERROR "DirectX-Headers was not found - required for reflection support on *nix see https://github.com/microsoft/DirectX-Headers") - endif() - endif (NOT WIN32) + if (IS_DIRECTORY "${DXC_EXTERNAL_ROOT_DIR}/DirectX-Headers") + set(DIRECTX_HEADER_INCLUDE_DIR ${DXC_EXTERNAL_ROOT_DIR}/DirectX-Headers/include PARENT_SCOPE) + else() + message(FATAL_ERROR "DirectX-Headers was not found - required for reflection support on *nix see https://github.com/microsoft/DirectX-Headers") + endif() endif(NOT DIRECTX_HEADER_INCLUDE_DIR) # Enabling SPIR-V codegen requires SPIRV-Headers for spirv.hpp and diff --git a/include/dxc/Support/D3DReflection.h b/include/dxc/Support/D3DReflection.h index aeb004c7bb..4e5c0684b3 100644 --- a/include/dxc/Support/D3DReflection.h +++ b/include/dxc/Support/D3DReflection.h @@ -22,5 +22,5 @@ #undef interface #pragma GCC diagnostic pop #else -#include +#include "d3d12shader.h" #endif From d1d195a179c0bbab925296e172900e15ad0fcae5 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 9 Aug 2024 22:38:20 +0200 Subject: [PATCH 08/15] Formatting --- include/dxc/Support/Unicode.h | 5 +++-- include/dxc/WinAdapter.h | 25 ++++++++++--------------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/include/dxc/Support/Unicode.h b/include/dxc/Support/Unicode.h index fd3ed345c4..3f9442c1cd 100644 --- a/include/dxc/Support/Unicode.h +++ b/include/dxc/Support/Unicode.h @@ -14,7 +14,7 @@ #include #ifdef _WIN32 -typedef int* LPBOOL; +typedef int *LPBOOL; #include #else // MultiByteToWideChar which is a Windows-specific method. @@ -62,7 +62,8 @@ bool UTF8ToConsoleString(const char *text, std::string *pValue, LPBOOL lossy); bool WideToConsoleString(const wchar_t *text, size_t textLen, std::string *pValue, LPBOOL lossy); -bool WideToConsoleString(const wchar_t *text, std::string *pValue, LPBOOL lossy); +bool WideToConsoleString(const wchar_t *text, std::string *pValue, + LPBOOL lossy); bool UTF8ToWideString(const char *pUTF8, std::wstring *pWide); diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index 07f0eceda8..5e62911b13 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -33,7 +33,7 @@ #include #endif // __cplusplus -#include "winadapter.h" //To avoid duplicates, somethings are defined by WSL, some by dxc +#include "winadapter.h" //To avoid duplicates, somethings are defined by WSL, some by dxc #define COM_NO_WINDOWS_H // needed to inform d3d headers that this isn't windows @@ -453,20 +453,15 @@ template inline GUID __emulated_uuidof(); static const IID _IID = guid_from_string(spec); \ return _IID; \ } \ - extern "C++" \ - { \ - template <> \ - inline const GUID &__wsl_stub_uuidof() \ - { \ - static const IID _IID = guid_from_string(spec); \ - return _IID; \ - } \ - template <> \ - inline const GUID &__wsl_stub_uuidof() \ - { \ - return __wsl_stub_uuidof(); \ - } \ - } + extern "C++" { \ + template <> inline const GUID &__wsl_stub_uuidof() { \ + static const IID _IID = guid_from_string(spec); \ + return _IID; \ + } \ + template <> inline const GUID &__wsl_stub_uuidof() { \ + return __wsl_stub_uuidof(); \ + } \ + } #else // __EMULATE_UUID From d82e56d5ccef6226f27c8513b15dc996a09f12df Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Fri, 9 Aug 2024 22:53:14 +0200 Subject: [PATCH 09/15] Some compilers don't seem to like missing endline at the end of a file. Also don't like an include named winadapter.h in a file named WinAdapter.h --- CMakeLists.txt | 2 +- external/DirectX-Headers | 2 +- include/dxc/WinAdapter.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 87c76abdf6..498c70e263 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -674,7 +674,7 @@ endif() if(EXISTS "${LLVM_MAIN_SRC_DIR}/external") add_subdirectory(external) # SPIRV change endif() -include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/wsl/stubs ${DIRECTX_HEADER_INCLUDE_DIR}/wsl ${DIRECTX_HEADER_INCLUDE_DIR}/directx) +include_directories(AFTER ${DIRECTX_HEADER_INCLUDE_DIR}/wsl/stubs ${DIRECTX_HEADER_INCLUDE_DIR}/directx) # Put this before tblgen. Else we have a circular dependence. diff --git a/external/DirectX-Headers b/external/DirectX-Headers index 8cd1ddf8ed..bd5368b966 160000 --- a/external/DirectX-Headers +++ b/external/DirectX-Headers @@ -1 +1 @@ -Subproject commit 8cd1ddf8edecc3410df223104f936f6a3badf3e6 +Subproject commit bd5368b966c41efe6406b22b01a8cab11c24d3b2 diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index 121f574fae..3beffe3363 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -33,7 +33,7 @@ #include #endif // __cplusplus -#include "winadapter.h" //To avoid duplicates, somethings are defined by WSL, some by dxc +#include "../winadapter.h" //To avoid duplicates, somethings are defined by WSL, some by dxc #define COM_NO_WINDOWS_H // needed to inform d3d headers that this isn't windows From 7883cda4683cdd0c10379067cb6045352c4cbbd3 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Sat, 10 Aug 2024 00:03:49 +0200 Subject: [PATCH 10/15] Clang still needs __wsl_stub_uuidof, even though it has builtin support. Added CLSID_D3D12SDKConfiguration for older Windows sdks --- include/dxc/WinAdapter.h | 14 +++++++++++++- tools/clang/unittests/HLSLExec/ExecutionTest.cpp | 6 ++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index 2c7e07ff5d..fff6859f63 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -465,7 +465,19 @@ template inline GUID __emulated_uuidof(); #else // __EMULATE_UUID -#ifndef CROSS_PLATFORM_UUIDOF +#ifndef _WIN32 +#define CROSS_PLATFORM_UUIDOF(interface, spec) \ + struct __declspec(uuid(spec)) interface; \ + extern "C++" { \ + template <> inline const GUID &__wsl_stub_uuidof() { \ + static const IID _IID = guid_from_string(spec); \ + return _IID; \ + } \ + template <> inline const GUID &__wsl_stub_uuidof() { \ + return __wsl_stub_uuidof(); \ + } \ + } +#elif !defined(CROSS_PLATFORM_UUIDOF) // Warning: This macro exists in dxcapi.h as well #define CROSS_PLATFORM_UUIDOF(interface, spec) \ struct __declspec(uuid(spec)) interface; diff --git a/tools/clang/unittests/HLSLExec/ExecutionTest.cpp b/tools/clang/unittests/HLSLExec/ExecutionTest.cpp index f22e99e467..af0f40d659 100644 --- a/tools/clang/unittests/HLSLExec/ExecutionTest.cpp +++ b/tools/clang/unittests/HLSLExec/ExecutionTest.cpp @@ -106,6 +106,12 @@ ID3D12SDKConfiguration : public IUnknown { virtual HRESULT STDMETHODCALLTYPE SetSDKVersion(UINT SDKVersion, LPCSTR SDKPath) = 0; }; +#elif defined(_WIN32) +EXTERN_C const GUID DECLSPEC_SELECTANY CLSID_D3D12SDKConfiguration = { + 0x7cda6aca, + 0xa03e, + 0x49c8, + {0x94, 0x58, 0x03, 0x34, 0xd2, 0x0e, 0x07, 0xce}}; #endif /* __ID3D12SDKConfiguration_INTERFACE_DEFINED__ */ using namespace DirectX; From 15d406c3240df505059cad75393d780630ab801d Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Sat, 10 Aug 2024 00:04:37 +0200 Subject: [PATCH 11/15] Formatting --- include/dxc/WinAdapter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index fff6859f63..646ddcd211 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -33,7 +33,7 @@ #include #endif // __cplusplus -#include "../winadapter.h" //To avoid duplicates, some things are defined by WSL, some by dxc +#include "../winadapter.h" //To avoid duplicates, some things are defined by WSL, some by dxc #define COM_NO_WINDOWS_H // needed to inform d3d headers that this isn't windows From 21a522589302723269dfc9a4258700369c0a8c9f Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Sat, 10 Aug 2024 00:15:03 +0200 Subject: [PATCH 12/15] Clang didn't have guid_from_string yet --- include/dxc/WinAdapter.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index 646ddcd211..1372309c49 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -407,8 +407,6 @@ enum tagSTATFLAG { //===--------------------- UUID Related Macros ----------------------------===// -#ifdef __EMULATE_UUID - // The following macros are defined to facilitate the lack of 'uuid' on Linux. constexpr uint8_t nybble_from_hex(char c) { @@ -445,6 +443,8 @@ constexpr GUID guid_from_string(const char str[37]) { byte_from_hexstr(str + 32), byte_from_hexstr(str + 34)}}; } +#ifdef __EMULATE_UUID + template inline GUID __emulated_uuidof(); #define CROSS_PLATFORM_UUIDOF(interface, spec) \ From e0272d7aa3f171c762630cf0f928dd3ab5694069 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Sat, 10 Aug 2024 00:51:24 +0200 Subject: [PATCH 13/15] Removed duplicate defintions, since now d3d12.h from DirectX-Headers is included --- tools/dxexp/dxexp.cpp | 144 ------------------------------------------ 1 file changed, 144 deletions(-) diff --git a/tools/dxexp/dxexp.cpp b/tools/dxexp/dxexp.cpp index 4787200318..5ae24fbde9 100644 --- a/tools/dxexp/dxexp.cpp +++ b/tools/dxexp/dxexp.cpp @@ -42,150 +42,6 @@ static HRESULT AtlCheck(HRESULT hr) { return hr; } -// Not defined in Creators Update version of d3d12.h: -#if WDK_NTDDI_VERSION <= NTDDI_WIN10_RS2 -#define D3D12_FEATURE_D3D12_OPTIONS3 ((D3D12_FEATURE)21) -typedef enum D3D12_COMMAND_LIST_SUPPORT_FLAGS { - D3D12_COMMAND_LIST_SUPPORT_FLAG_NONE = 0, - D3D12_COMMAND_LIST_SUPPORT_FLAG_DIRECT = - (1 << D3D12_COMMAND_LIST_TYPE_DIRECT), - D3D12_COMMAND_LIST_SUPPORT_FLAG_BUNDLE = - (1 << D3D12_COMMAND_LIST_TYPE_BUNDLE), - D3D12_COMMAND_LIST_SUPPORT_FLAG_COMPUTE = - (1 << D3D12_COMMAND_LIST_TYPE_COMPUTE), - D3D12_COMMAND_LIST_SUPPORT_FLAG_COPY = (1 << D3D12_COMMAND_LIST_TYPE_COPY), - D3D12_COMMAND_LIST_SUPPORT_FLAG_VIDEO_DECODE = (1 << 4), - D3D12_COMMAND_LIST_SUPPORT_FLAG_VIDEO_PROCESS = (1 << 5) -} D3D12_COMMAND_LIST_SUPPORT_FLAGS; - -typedef enum D3D12_VIEW_INSTANCING_TIER { - D3D12_VIEW_INSTANCING_TIER_NOT_SUPPORTED = 0, - D3D12_VIEW_INSTANCING_TIER_1 = 1, - D3D12_VIEW_INSTANCING_TIER_2 = 2, - D3D12_VIEW_INSTANCING_TIER_3 = 3 -} D3D12_VIEW_INSTANCING_TIER; - -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS3 { - BOOL CopyQueueTimestampQueriesSupported; - BOOL CastingFullyTypedFormatSupported; - DWORD WriteBufferImmediateSupportFlags; - D3D12_VIEW_INSTANCING_TIER ViewInstancingTier; - BOOL BarycentricsSupported; -} D3D12_FEATURE_DATA_D3D12_OPTIONS3; -#endif - -#ifndef NTDDI_WIN10_RS3 -#define NTDDI_WIN10_RS3 0x0A000004 -#endif - -#if WDK_NTDDI_VERSION <= NTDDI_WIN10_RS3 -#define D3D12_FEATURE_D3D12_OPTIONS4 ((D3D12_FEATURE)23) -typedef enum D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER { - D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_0, - D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER_1, -} D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER; - -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS4 { - BOOL ReservedBufferPlacementSupported; - D3D12_SHARED_RESOURCE_COMPATIBILITY_TIER SharedResourceCompatibilityTier; - BOOL Native16BitShaderOpsSupported; -} D3D12_FEATURE_DATA_D3D12_OPTIONS4; -#endif - -#ifndef NTDDI_WIN10_RS4 -#define NTDDI_WIN10_RS4 0x0A000005 -#endif - -#if WDK_NTDDI_VERSION <= NTDDI_WIN10_RS4 -#define D3D12_FEATURE_D3D12_OPTIONS5 ((D3D12_FEATURE)27) -typedef enum D3D12_RENDER_PASS_TIER { - D3D12_RENDER_PASS_TIER_0 = 0, - D3D12_RENDER_PASS_TIER_1 = 1, - D3D12_RENDER_PASS_TIER_2 = 2 -} D3D12_RENDER_PASS_TIER; - -typedef enum D3D12_RAYTRACING_TIER { - D3D12_RAYTRACING_TIER_NOT_SUPPORTED = 0, - D3D12_RAYTRACING_TIER_1_0 = 10 D3D12_RAYTRACING_TIER_1_1 = 11 -} D3D12_RAYTRACING_TIER; - -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS5 { - BOOL SRVOnlyTiledResourceTier3; - D3D12_RENDER_PASS_TIER RenderPassesTier; - D3D12_RAYTRACING_TIER RaytracingTier; -} D3D12_FEATURE_DATA_D3D12_OPTIONS5; -#endif - -#ifndef NTDDI_WIN10_VB -#define NTDDI_WIN10_VB 0x0A000008 -#endif - -#if WDK_NTDDI_VERSION < NTDDI_WIN10_VB -#define D3D12_FEATURE_D3D12_OPTIONS7 ((D3D12_FEATURE)32) - -typedef enum D3D12_MESH_SHADER_TIER { - D3D12_MESH_SHADER_TIER_NOT_SUPPORTED = 0, - D3D12_MESH_SHADER_TIER_1 = 10 -} D3D12_MESH_SHADER_TIER; - -typedef enum D3D12_SAMPLER_FEEDBACK_TIER { - D3D12_SAMPLER_FEEDBACK_TIER_NOT_SUPPORTED = 0, - D3D12_SAMPLER_FEEDBACK_TIER_0_9 = 90, - D3D12_SAMPLER_FEEDBACK_TIER_1_0 = 100 -} D3D12_SAMPLER_FEEDBACK_TIER; - -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS7 { - D3D12_MESH_SHADER_TIER MeshShaderTier; - D3D12_SAMPLER_FEEDBACK_TIER SamplerFeedbackTier; -} D3D12_FEATURE_DATA_D3D12_OPTIONS7; -#endif - -#ifndef NTDDI_WIN10_FE -#define NTDDI_WIN10_FE 0x0A00000A -#endif - -#if WDK_NTDDI_VERSION < NTDDI_WIN10_FE -#define D3D12_FEATURE_D3D12_OPTIONS9 ((D3D12_FEATURE)37) - -typedef enum D3D12_WAVE_MMA_TIER { - D3D12_WAVE_MMA_TIER_NOT_SUPPORTED = 0, - D3D12_WAVE_MMA_TIER_1_0 = 10 -} D3D12_WAVE_MMA_TIER; - -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS9 { - BOOL MeshShaderPipelineStatsSupported; - BOOL MeshShaderSupportsFullRangeRenderTargetArrayIndex; - BOOL AtomicInt64OnTypedResourceSupported; - BOOL AtomicInt64OnGroupSharedSupported; - BOOL DerivativesInMeshAndAmplificationShadersSupported; - D3D12_WAVE_MMA_TIER WaveMMATier; -} D3D12_FEATURE_DATA_D3D12_OPTIONS9; -#endif - -#ifndef NTDDI_WIN10_NI -#define NTDDI_WIN10_NI 0x0A00000C -#endif - -#if WDK_NTDDI_VERSION <= NTDDI_WIN10_NI -#define D3D12_FEATURE_D3D12_OPTIONS14 ((D3D12_FEATURE)43) -typedef struct D3D12_FEATURE_DATA_D3D12_OPTIONS14 { - BOOL AdvancedTextureOpsSupported; - BOOL WriteableMSAATexturesSupported; - BOOL IndependentFrontAndBackStencilRefMaskSupported; -} D3D12_FEATURE_DATA_D3D12_OPTIONS14; -#endif - -#pragma warning(disable : 4063) -#define D3D12_RAYTRACING_TIER_1_1 ((D3D12_RAYTRACING_TIER)11) -#define D3D_SHADER_MODEL_6_1 ((D3D_SHADER_MODEL)0x61) -#define D3D_SHADER_MODEL_6_2 ((D3D_SHADER_MODEL)0x62) -#define D3D_SHADER_MODEL_6_3 ((D3D_SHADER_MODEL)0x63) -#define D3D_SHADER_MODEL_6_4 ((D3D_SHADER_MODEL)0x64) -#define D3D_SHADER_MODEL_6_5 ((D3D_SHADER_MODEL)0x65) -#define D3D_SHADER_MODEL_6_6 ((D3D_SHADER_MODEL)0x66) -#define D3D_SHADER_MODEL_6_7 ((D3D_SHADER_MODEL)0x67) -#define D3D_SHADER_MODEL_6_8 ((D3D_SHADER_MODEL)0x68) - #define DXEXP_HIGHEST_SHADER_MODEL D3D_SHADER_MODEL_6_8 static const char *BoolToStrJson(bool value) { From 504a4d5a0d5ae2ad80d14fc3898515e0e19864d5 Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 21 Aug 2024 13:34:04 +0200 Subject: [PATCH 14/15] Undid removal of #define interface, since there's definitely other stuff that relies on that --- external/DirectX-Headers | 2 +- include/dxc/WinAdapter.h | 28 ++++++++++++++-------------- tools/clang/include/clang/AST/Attr.h | 1 + 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/external/DirectX-Headers b/external/DirectX-Headers index bd5368b966..ac66e97e62 160000 --- a/external/DirectX-Headers +++ b/external/DirectX-Headers @@ -1 +1 @@ -Subproject commit bd5368b966c41efe6406b22b01a8cab11c24d3b2 +Subproject commit ac66e97e625939923cda47c3cbfd00bebbfdabd0 diff --git a/include/dxc/WinAdapter.h b/include/dxc/WinAdapter.h index 1372309c49..458d14e91f 100644 --- a/include/dxc/WinAdapter.h +++ b/include/dxc/WinAdapter.h @@ -445,42 +445,42 @@ constexpr GUID guid_from_string(const char str[37]) { #ifdef __EMULATE_UUID -template inline GUID __emulated_uuidof(); +template inline GUID __emulated_uuidof(); -#define CROSS_PLATFORM_UUIDOF(interface, spec) \ - struct interface; \ - template <> inline GUID __emulated_uuidof() { \ +#define CROSS_PLATFORM_UUIDOF(interfce, spec) \ + struct interfce; \ + template <> inline GUID __emulated_uuidof() { \ static const IID _IID = guid_from_string(spec); \ return _IID; \ } \ extern "C++" { \ - template <> inline const GUID &__wsl_stub_uuidof() { \ + template <> inline const GUID &__wsl_stub_uuidof() { \ static const IID _IID = guid_from_string(spec); \ return _IID; \ } \ - template <> inline const GUID &__wsl_stub_uuidof() { \ - return __wsl_stub_uuidof(); \ + template <> inline const GUID &__wsl_stub_uuidof() { \ + return __wsl_stub_uuidof(); \ } \ } #else // __EMULATE_UUID #ifndef _WIN32 -#define CROSS_PLATFORM_UUIDOF(interface, spec) \ - struct __declspec(uuid(spec)) interface; \ +#define CROSS_PLATFORM_UUIDOF(interfce, spec) \ + struct __declspec(uuid(spec)) interfce; \ extern "C++" { \ - template <> inline const GUID &__wsl_stub_uuidof() { \ + template <> inline const GUID &__wsl_stub_uuidof() { \ static const IID _IID = guid_from_string(spec); \ return _IID; \ } \ - template <> inline const GUID &__wsl_stub_uuidof() { \ - return __wsl_stub_uuidof(); \ + template <> inline const GUID &__wsl_stub_uuidof() { \ + return __wsl_stub_uuidof(); \ } \ } #elif !defined(CROSS_PLATFORM_UUIDOF) // Warning: This macro exists in dxcapi.h as well -#define CROSS_PLATFORM_UUIDOF(interface, spec) \ - struct __declspec(uuid(spec)) interface; +#define CROSS_PLATFORM_UUIDOF(interfce, spec) \ + struct __declspec(uuid(spec)) interfce; #endif #endif // __EMULATE_UUID diff --git a/tools/clang/include/clang/AST/Attr.h b/tools/clang/include/clang/AST/Attr.h index 4e282d68b7..8abc524ba7 100644 --- a/tools/clang/include/clang/AST/Attr.h +++ b/tools/clang/include/clang/AST/Attr.h @@ -149,6 +149,7 @@ class InheritableParamAttr : public InheritableAttr { } }; +#undef interface #include "clang/AST/Attrs.inc" inline const DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, From 100af64852b09d1b2c229b60fa6a58b9d09b010e Mon Sep 17 00:00:00 2001 From: Nielsbishere Date: Wed, 21 Aug 2024 15:28:30 +0200 Subject: [PATCH 15/15] Fixed error in HashAndUpdateOrCopy, due to not being a proper ULONG, breaking on unix --- tools/clang/tools/dxcvalidator/dxcvalidator.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/clang/tools/dxcvalidator/dxcvalidator.cpp b/tools/clang/tools/dxcvalidator/dxcvalidator.cpp index b8b71ece62..c7975c9c8f 100644 --- a/tools/clang/tools/dxcvalidator/dxcvalidator.cpp +++ b/tools/clang/tools/dxcvalidator/dxcvalidator.cpp @@ -52,7 +52,7 @@ static void HashAndUpdateOrCopy(uint32_t Flags, IDxcBlob *Shader, } else { CComPtr HashedBlobStream; IFT(CreateMemoryStream(DxcGetThreadMallocNoRef(), &HashedBlobStream)); - unsigned long CB; + ULONG CB; IFT(HashedBlobStream->Write(Shader->GetBufferPointer(), Shader->GetBufferSize(), &CB)); HashAndUpdate((DxilContainerHeader *)HashedBlobStream->GetPtr());