mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-02 04:29:14 +01:00
[util] Don't use if constexpr
Fixes compilation on GCC 6.3.
This commit is contained in:
parent
b3f61936d2
commit
192310d481
@ -19,6 +19,26 @@ namespace dxvk {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Ref count methods for public references
|
||||||
|
*/
|
||||||
|
template<typename T, bool Public>
|
||||||
|
struct ComRef_ {
|
||||||
|
static void incRef(T* ptr) { ptr->AddRef(); }
|
||||||
|
static void decRef(T* ptr) { ptr->Release(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Ref count methods for private references
|
||||||
|
*/
|
||||||
|
template<typename T>
|
||||||
|
struct ComRef_<T, false> {
|
||||||
|
static void incRef(T* ptr) { ptr->AddRefPrivate(); }
|
||||||
|
static void decRef(T* ptr) { ptr->ReleasePrivate(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief COM pointer
|
* \brief COM pointer
|
||||||
*
|
*
|
||||||
@ -27,7 +47,7 @@ namespace dxvk {
|
|||||||
*/
|
*/
|
||||||
template<typename T, bool Public = true>
|
template<typename T, bool Public = true>
|
||||||
class Com {
|
class Com {
|
||||||
|
using ComRef = ComRef_<T, Public>;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Com() { }
|
Com() { }
|
||||||
@ -107,21 +127,13 @@ namespace dxvk {
|
|||||||
T* m_ptr = nullptr;
|
T* m_ptr = nullptr;
|
||||||
|
|
||||||
void incRef() const {
|
void incRef() const {
|
||||||
if (m_ptr != nullptr) {
|
if (m_ptr != nullptr)
|
||||||
if constexpr (Public)
|
ComRef::incRef(m_ptr);
|
||||||
m_ptr->AddRef();
|
|
||||||
else
|
|
||||||
m_ptr->AddRefPrivate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void decRef() const {
|
void decRef() const {
|
||||||
if (m_ptr != nullptr) {
|
if (m_ptr != nullptr)
|
||||||
if constexpr (Public)
|
ComRef::decRef(m_ptr);
|
||||||
m_ptr->Release();
|
|
||||||
else
|
|
||||||
m_ptr->ReleasePrivate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user