Skip to content

Commit

Permalink
WinAdapter: Clang on Apple should not need UUID emulation
Browse files Browse the repository at this point in the history
  • Loading branch information
MarijnS95 committed Nov 19, 2020
1 parent 66c31b2 commit 9f2b30a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
9 changes: 3 additions & 6 deletions include/dxc/Support/WinAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,9 @@
#define _countof(a) (sizeof(a) / sizeof(*(a)))

// If it is GCC, there is no UUID support and we must emulate it.
#ifdef __APPLE__
#define __EMULATE_UUID 1
#else // __APPLE__
#ifdef __GNUC__
#ifndef __clang__
#define __EMULATE_UUID 1
#endif // __GNUC__
#endif // __clang__
#endif // __APPLE__

#ifdef __EMULATE_UUID
#define __declspec(x)
Expand Down Expand Up @@ -622,8 +616,11 @@ template <typename interface> inline GUID __emulated_uuidof();

#else // __EMULATE_UUID

#ifndef CROSS_PLATFORM_UUIDOF
// Warning: This macro exists in dxcapi.h as well
#define CROSS_PLATFORM_UUIDOF(interface, spec) \
struct __declspec(uuid(spec)) interface;
#endif

template <typename T> inline void **IID_PPV_ARGS_Helper(T **pp) {
return reinterpret_cast<void **>(pp);
Expand Down
17 changes: 10 additions & 7 deletions include/dxc/dxcapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,16 @@
#endif
#endif

#ifndef _WIN32
#ifdef _WIN32

#ifndef CROSS_PLATFORM_UUIDOF
// Warning: This macro exists in WinAdapter.h as well
#define CROSS_PLATFORM_UUIDOF(interface, spec) \
struct __declspec(uuid(spec)) interface;
#endif

#else

#include <dlfcn.h>
#include "dxc/Support/WinAdapter.h"
#endif
Expand Down Expand Up @@ -129,12 +138,6 @@ typedef struct DxcShaderHash {
#define DXC_ARG_DEBUG_NAME_FOR_SOURCE L"-Zss"
#define DXC_ARG_DEBUG_NAME_FOR_BINARY L"-Zsb"

// TODO: This is an unfortunately necessary copy from WinAdapter.h
#ifndef CROSS_PLATFORM_UUIDOF
#define CROSS_PLATFORM_UUIDOF(interface, spec) \
struct __declspec(uuid(spec)) interface;
#endif

// IDxcBlob is an alias of ID3D10Blob and ID3DBlob
CROSS_PLATFORM_UUIDOF(IDxcBlob, "8BA5FB08-5195-40e2-AC58-0D989C3A0102")
struct IDxcBlob : public IUnknown {
Expand Down

0 comments on commit 9f2b30a

Please sign in to comment.