#pragma once #include #include "com_include.h" #define COM_QUERY_IFACE(riid, ppvObject, Iface) \ do { \ if (riid == __uuidof(Iface)) { \ this->AddRef(); \ *ppvObject = static_cast(this); \ return S_OK; \ } \ } while (0) namespace dxvk { template class ComObject : public Base... { public: virtual ~ComObject() { } ULONG STDMETHODCALLTYPE AddRef() { return ++m_refCount; } ULONG STDMETHODCALLTYPE Release() { ULONG refCount = --m_refCount; if (refCount == 0) { m_refCount += 0x80000000u; delete this; } return refCount; } private: std::atomic m_refCount = { 0ul }; }; }