diff --git a/Source/Core/VideoBackends/Metal/MTLObjectCache.mm b/Source/Core/VideoBackends/Metal/MTLObjectCache.mm index c4ecfc0713..7dce7a0f34 100644 --- a/Source/Core/VideoBackends/Metal/MTLObjectCache.mm +++ b/Source/Core/VideoBackends/Metal/MTLObjectCache.mm @@ -27,16 +27,6 @@ std::unique_ptr Metal::g_object_cache; static void SetupDepthStencil( MRCOwned> (&dss)[Metal::DepthStencilSelector::N_VALUES]); -Metal::ObjectCache::ObjectCache() -{ - m_internal = std::make_unique(); - SetupDepthStencil(m_dss); -} - -Metal::ObjectCache::~ObjectCache() -{ -} - void Metal::ObjectCache::Initialize(MRCOwned> device) { g_device = std::move(device); @@ -554,6 +544,17 @@ public: } }; +Metal::ObjectCache::ObjectCache() +{ + m_internal = std::make_unique(); + SetupDepthStencil(m_dss); +} + +// This is defined here instead of the header so that the definition of Internal is visible when +// m_internal is destroyed, preventing a compile error caused by calling unique_ptr's destructor +// with an incomplete type. +Metal::ObjectCache::~ObjectCache() = default; + std::unique_ptr Metal::ObjectCache::CreatePipeline(const AbstractPipelineConfig& config) {