mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-14 09:23:53 +01:00
b81536458f
* Add QueryInterface template to IUnknown As described here https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nf-unknwn-iunknown-queryinterface\(q\)\?source\=recommendations * Implement DEFINE_ENUM_FLAG_OPERATORS * Add REFCLSID to windows_base.h This is used by the latest d3d12 headers for D3D12GetInterface
53 lines
1.2 KiB
C++
53 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "windows_base.h"
|
|
|
|
typedef interface IUnknown IUnknown;
|
|
|
|
DEFINE_GUID(IID_IUnknown, 0x00000000,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46)
|
|
|
|
#ifdef __cplusplus
|
|
struct IUnknown {
|
|
|
|
public:
|
|
|
|
virtual HRESULT QueryInterface(REFIID riid, void** ppvObject) = 0;
|
|
template<class Q>
|
|
HRESULT STDMETHODCALLTYPE QueryInterface(Q **pp) {
|
|
return QueryInterface(__uuidof(Q), (void **)pp);
|
|
}
|
|
|
|
virtual ULONG AddRef() = 0;
|
|
virtual ULONG Release() = 0;
|
|
|
|
};
|
|
#else
|
|
typedef struct IUnknownVtbl
|
|
{
|
|
BEGIN_INTERFACE
|
|
|
|
HRESULT (STDMETHODCALLTYPE *QueryInterface)(
|
|
IUnknown *This,
|
|
REFIID riid,
|
|
void **ppvObject
|
|
);
|
|
ULONG (STDMETHODCALLTYPE *AddRef)(IUnknown *This);
|
|
ULONG (STDMETHODCALLTYPE *Release)(IUnknown *This);
|
|
|
|
END_INTERFACE
|
|
} IUnknownVtbl;
|
|
|
|
interface IUnknown
|
|
{
|
|
CONST_VTBL struct IUnknownVtbl *lpVtbl;
|
|
};
|
|
|
|
#define IUnknown_AddRef(This) ((This)->lpVtbl->AddRef(This))
|
|
#define IUnknown_Release(This) ((This)->lpVtbl->Release(This))
|
|
|
|
#endif // __cplusplus
|
|
|
|
DECLARE_UUIDOF_HELPER(IUnknown, 0x00000000,0x0000,0x0000,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x46)
|
|
|
|
#define IID_PPV_ARGS(ppType) __uuidof(decltype(**(ppType))), [](auto** pp) { (void)static_cast<IUnknown*>(*pp); return reinterpret_cast<void**>(pp); }(ppType)
|