#pragma once #include #include "com_include.h" 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 }; }; template inline void InitReturnPtr(T** ptr) { if (ptr != nullptr) *ptr = nullptr; } }