Fix somewhat incorrect upscale texture handling. Replace InstancedResources reset with something that's less likely to be undefined behavior.

This commit is contained in:
elasota
2021-04-20 20:42:30 -04:00
parent 77e02927c6
commit 1dc86a703e
2 changed files with 36 additions and 15 deletions

View File

@@ -1,11 +1,16 @@
#pragma once
#include "CoreDefs.h"
template<class T>
class GpComPtr final
{
public:
GpComPtr();
GpComPtr(const GpComPtr<T> &other);
#if GP_IS_CPP11
GpComPtr(GpComPtr<T> &&other);
#endif
explicit GpComPtr(T *ptr);
~GpComPtr();
@@ -41,6 +46,23 @@ inline GpComPtr<T>::GpComPtr(const GpComPtr<T> &other)
m_ptr->AddRef();
}
#if GP_IS_CPP11
template<class T>
inline GpComPtr<T>::GpComPtr(GpComPtr<T> &&other)
: m_ptr(other.m_ptr)
{
if (m_ptr)
m_ptr->AddRef();
if (other.m_ptr)
{
other.m_ptr->Release();
other.m_ptr = nullptr;
}
}
#endif
template<class T>
inline GpComPtr<T>::GpComPtr(T *ptr)
: m_ptr(ptr)